Subject: bug#5476: 23.1.91; bookmark open info node in fundamental mode

From: Thierry Volpiatto <[email-masked]>
Date: Tue, 26 Jan 2010 08:11:08 +0100

Stefan Monnier <[email-masked]> writes:

>>> 1. Emacs -q
>>> 2. C-h i m d emacs RET
>>> 3. C-x r m RET
>>> 4. C-x r b and select the bookmark in step 3 (It is 'top' in my case)
>>> 
>>> The info will be opened in fundamental mode. Tested with bookmark.el
>>> from the devel repo.
>>> 
>>> In GNU Emacs 23.1.91.2 (i386-apple-darwin9.8.0, Carbon Version 1.6.0 AppKit 949.54)
>>> of 2010-01-01 on victoria.local
>>> Windowing system distributor `Apple Inc.', version 10.5.8
>>> configured using `configure  '--with-mac' '--prefix=/usr/local/opensource/emacs''
>
>> The bug come from bookmark-default-handler that now doesn't handle
>> buffer anymore (only file) thus most info functions are not loaded and
>> `list*' (Cl) also.
>
>> I have fixed bookmark-default-handler,
>
> I'm not sure that would be right.  Instead, the bookmark for the info
> buffer should create a bookmark that uses a different handler.

Exactly, it's what does Info-bookmark-jump:

,----
|     (bookmark-default-handler
|      (list* "" `(buffer . ,buf) (bookmark-get-bookmark-record bmk)))))
`----

But for that work bookmark-default-handler have to set a buffer-name
with the buffer info given by the handler.

Actually it doesn't, it use only the filename:

,----
|     (if (not file)
|         (signal 'bookmark-error-no-filename (list 'stringp file))
|       (set-buffer (find-file-noselect file))
`----

So we should add in bookmark-default-handler the info given by handler:

,----
|    (let ((file          (bookmark-get-filename bmk-record))
|   =====>(buf           (bookmark-prop-get bmk-record 'buffer))
|         (forward-str   (bookmark-get-front-context-string bmk-record))
|         (behind-str    (bookmark-get-rear-context-string bmk-record))
|         (place         (bookmark-get-position bmk-record)))
`----

And then something like this: (need to clean for bookmark.el)

,----
| (if (and file (file-readable-p file) (not (buffer-live-p buf)))
|     (with-current-buffer (find-file-noselect file) (setq buf  (buffer-name)))
|     ;; No file found.  See if a non-file buffer exists for this.  If not, raise error.
|     (unless (and buf (get-buffer buf))
|       (signal 'file-error `("Jumping to bookmark" "No such file or directory" file))))
| (set-buffer buf) ;>>>>>>>Now we are in the buffer given by the handler
`----

Though we also need a buffer-name entry in bookmark alist to be able to
bookmark also in all non--filenames bookmarks, but that another thing.
(See bookmark-extension.el).

-- 
Thierry Volpiatto