* bookmarks / switch-to-buffer
@ 2005-11-10 0:49 David Reitter
2005-11-10 1:08 ` Luc Teirlinck
0 siblings, 1 reply; 3+ messages in thread
From: David Reitter @ 2005-11-10 0:49 UTC (permalink / raw)
The function `bookmark-jump' failed to work in my environment, where
switch-to-buffer is advised.
The reason was that bookmark-jump expects switch-to-buffer to return
a non-nil value (if succeeded), but switch-to-buffer is not actually
documented to do so.
Therefore I'd suggest to ignore the return value of switch-to-buffer
in bookmark's bookmark-jump function. This fixed the problem for me.
*** bookmark.el 19 Oct 2005 09:45:43 -0000 1.84
--- bookmark.el 10 Nov 2005 00:46:21 -0000
***************
*** 1062,1068 ****
(bookmark-maybe-historicize-string bookmark)
(let ((cell (bookmark-jump-noselect bookmark)))
(and cell
! (switch-to-buffer (car cell))
(goto-char (cdr cell))
(progn (run-hooks 'bookmark-after-jump-hook) t)
(if bookmark-automatically-show-annotations
--- 1062,1068 ----
(bookmark-maybe-historicize-string bookmark)
(let ((cell (bookmark-jump-noselect bookmark)))
(and cell
! (or (switch-to-buffer (car cell)) t)
(goto-char (cdr cell))
(progn (run-hooks 'bookmark-after-jump-hook) t)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bookmarks / switch-to-buffer
2005-11-10 0:49 bookmarks / switch-to-buffer David Reitter
@ 2005-11-10 1:08 ` Luc Teirlinck
2005-11-11 6:45 ` Karl Fogel
0 siblings, 1 reply; 3+ messages in thread
From: Luc Teirlinck @ 2005-11-10 1:08 UTC (permalink / raw)
Cc: emacs-devel
David Reitter wrote:
The reason was that bookmark-jump expects switch-to-buffer to return
a non-nil value (if succeeded), but switch-to-buffer is not actually
documented to do so.
>From the docstring:
This function returns the buffer it switched to.
>From the description of the function in the Elisp manual:
It returns the buffer that it switched to.
Therefore I'd suggest to ignore the return value of switch-to-buffer
in bookmark's bookmark-jump function. This fixed the problem for me.
I believe that you should fix your problem locally by fixing your advise.
If you advise a function to return a value that is different from the
documented one, then of course you run the risk to run into problems.
That is a bug in your advise, not a bug in Emacs.
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: bookmarks / switch-to-buffer
2005-11-10 1:08 ` Luc Teirlinck
@ 2005-11-11 6:45 ` Karl Fogel
0 siblings, 0 replies; 3+ messages in thread
From: Karl Fogel @ 2005-11-11 6:45 UTC (permalink / raw)
Cc: david.reitter, emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> If you advise a function to return a value that is different from the
> documented one, then of course you run the risk to run into problems.
> That is a bug in your advise, not a bug in Emacs.
I agree with Luc on this one.
The code may be a bit misleading there, because the return value of
the 'switch-to-buffer' call isn't really used for its conditional
value in the 'and', it's just one of the things that needs to happen
in the sequence of events. But it's still correct. If you advise a
function in such a way as to change its documented return value, you
should be prepared for code to stop working...
Best,
-Karl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-11-11 6:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-10 0:49 bookmarks / switch-to-buffer David Reitter
2005-11-10 1:08 ` Luc Teirlinck
2005-11-11 6:45 ` Karl Fogel
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.