unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable
@ 2016-09-30 14:13 Dmitri Paduchikh
  2017-10-28 18:53 ` Win Treese
  2019-07-02 16:22 ` Stefan Kangas
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitri Paduchikh @ 2016-09-30 14:13 UTC (permalink / raw)
  To: 24573

Hello,

I start emacs -q, open the *Help* buffer, set a bookmark there, and save
bookmarks to file. After this I get the following error message while
trying to load bookmarks back.

Saving bookmarks to file ~/.emacs.d/bookmarks...done
Loading bookmarks from ~/.emacs.d/bookmarks...
bookmark-alist-from-buffer: Invalid read syntax: "#"

And indeed, the file contains text #<buffer *GNU Emacs*>. Replacing this
by nil manually fixes the problem.

;;;; Emacs Bookmark Format Version 1 ;;;;
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
(("car"
 (position . 49)
 (help-fn .
	  #[514 "\301.!\205\a.\211.\302.!)\207"
		[describe-function-orig-buffer buffer-live-p describe-function]
		4 "\n\n(fn FUNCTION BUFFER)"])
 (help-args car #<buffer *GNU Emacs*>)
 (position . 49)
 (handler . help-bookmark-jump))
)


In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)
 of 2016-09-18 built on juergen

Regards,
Dmitri Paduchikh





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable
  2016-09-30 14:13 bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable Dmitri Paduchikh
@ 2017-10-28 18:53 ` Win Treese
  2017-10-28 19:48   ` Noam Postavsky
  2019-07-02 16:22 ` Stefan Kangas
  1 sibling, 1 reply; 5+ messages in thread
From: Win Treese @ 2017-10-28 18:53 UTC (permalink / raw)
  To: 24573; +Cc: Win Treese

I ran into the same problem.

To reproduce:

1. C-h f find-file

2. In the *Help* buffer:

    C-x r m  ; create a bookmark to the help for find-file

3. Exit Emacs (which should save the bookmark)

4. In a fresh Emacs,
   C-x r b    ; to visit any bookmark

This results in an error:

   bookmark-alist-from-buffer: Invalid read syntax: "#"

Note that the bookmark works fine until Emacs attempts to restore
the bookmarks saved to a file. In normal use, it only shows up after
Emacs is restarted.

Finding the problem:

The problem appears to be in the definition for describe-function i
help-fns.el. help-setup-xref is called with a lambda instead of a
function symbol (as it was before this code was changed).
When the bookmark is saved, the syntax for the lambda is not
parsable by read to restore it.

I don't understand the code well enough to propose an appropriate change.

I am using Aquamacs, but the code noted is the same in the master git
branch now. Version information;

Aquamacs 3.4 development
Emacs version 25.2.1

Regards,

Win Treese
treese@acm.org







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable
  2017-10-28 18:53 ` Win Treese
@ 2017-10-28 19:48   ` Noam Postavsky
  0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2017-10-28 19:48 UTC (permalink / raw)
  To: Win Treese; +Cc: Dmitri Paduchikh, 24573

Win Treese <treese@acm.org> writes:

> Finding the problem:
>
> The problem appears to be in the definition for describe-function i
> help-fns.el. help-setup-xref is called with a lambda instead of a
> function symbol (as it was before this code was changed).
> When the bookmark is saved, the syntax for the lambda is not
> parsable by read to restore it.

The lambda is fine, it's the buffer which uses the unreadable print
synax: #<...>.  The following which swaps buffer objects with their name
seems to fix it, although I haven't really tested this much.

--- i/lisp/help-mode.el
+++ w/lisp/help-mode.el
@@ -756,7 +756,9 @@ help-bookmark-make-record
     (error "Cannot create bookmark - help command not known"))
   `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
       (help-fn     . ,(car help-xref-stack-item))
-      (help-args   . ,(cdr help-xref-stack-item))
+      (help-args   . ,(mapcar (lambda (a)
+                                (if (bufferp a) (buffer-name a) a))
+                              (cdr help-xref-stack-item)))
       (position    . ,(point))
       (handler     . help-bookmark-jump)))
 







^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable
  2016-09-30 14:13 bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable Dmitri Paduchikh
  2017-10-28 18:53 ` Win Treese
@ 2019-07-02 16:22 ` Stefan Kangas
  2019-07-06 18:42   ` Noam Postavsky
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-07-02 16:22 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Dmitri Paduchikh, 24573, Win Treese

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

tags 24573 patch
quit

Noam Postavsky <npostavs@users.sourceforge.net> writes:

> The lambda is fine, it's the buffer which uses the unreadable print
> synax: #<...>.  The following which swaps buffer objects with their name
> seems to fix it, although I haven't really tested this much.
>
> --- i/lisp/help-mode.el
> +++ w/lisp/help-mode.el
> @@ -756,7 +756,9 @@ help-bookmark-make-record
>      (error "Cannot create bookmark - help command not known"))
>    `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
>        (help-fn     . ,(car help-xref-stack-item))
> -      (help-args   . ,(cdr help-xref-stack-item))
> +      (help-args   . ,(mapcar (lambda (a)
> +                                (if (bufferp a) (buffer-name a) a))
> +                              (cdr help-xref-stack-item)))
>        (position    . ,(point))
>        (handler     . help-bookmark-jump)))

I can confirm this bug, which I've recently stumbled into myself.

I can also confirm that Noam Postavsky's fix works.

In the interest of getting it merged as soon as possible, I'm sending
it here as a diff to be easier to apply.  I could send it as a patch
too if that will get it merged faster.  But the credit for fixing this
should fully go to Noam Postavsky.

Thanks,
Stefan Kangas

[-- Attachment #2: bug24573.diff --]
[-- Type: text/x-patch, Size: 648 bytes --]

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index dc2992cd4a..cd4138c365 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -787,7 +787,9 @@ help-bookmark-make-record
     (error "Cannot create bookmark - help command not known"))
   `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
       (help-fn     . ,(car help-xref-stack-item))
-      (help-args   . ,(cdr help-xref-stack-item))
+      (help-args   . ,(mapcar (lambda (a)
+                            (if (bufferp a) (buffer-name a) a))
+                          (cdr help-xref-stack-item)))
       (position    . ,(point))
       (handler     . help-bookmark-jump)))
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable
  2019-07-02 16:22 ` Stefan Kangas
@ 2019-07-06 18:42   ` Noam Postavsky
  0 siblings, 0 replies; 5+ messages in thread
From: Noam Postavsky @ 2019-07-06 18:42 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Dmitri Paduchikh, 24573, Win Treese

tags 24573 fixed
close 24573 27.1
quit

Stefan Kangas <stefan@marxist.se> writes:
>> -      (help-args   . ,(cdr help-xref-stack-item))
>> +      (help-args   . ,(mapcar (lambda (a)
>> +                                (if (bufferp a) (buffer-name a) a))
>> +                              (cdr help-xref-stack-item)))

> I can confirm this bug, which I've recently stumbled into myself.
>
> I can also confirm that Noam Postavsky's fix works.

Ah right, kind of forgot about this.  Now pushed to master.

8d43315cfa 2019-07-06T14:34:47-04:00 "Use buffer's name for help-mode bookmarks (Bug#24573)"
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8d43315cfa3db295736826272472ec1e394ecb60






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-06 18:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-30 14:13 bug#24573: 25.1; Setting bookmark in buffer *Help* makes bookmarks non-loadable Dmitri Paduchikh
2017-10-28 18:53 ` Win Treese
2017-10-28 19:48   ` Noam Postavsky
2019-07-02 16:22 ` Stefan Kangas
2019-07-06 18:42   ` Noam Postavsky

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).