[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Following links from help buffers - how to modify?
From: |
Kevin Rodgers |
Subject: |
Re: Following links from help buffers - how to modify? |
Date: |
Thu, 02 Jun 2005 12:08:31 -0600 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041105) |
David Reitter wrote:
> I've advised my switch-to-buffer to open buffers in new frames in order
> to take advantage of my native window manager.
>
> Turns out that this doesn't work at all for links to source code in
> help mode. When a link to a source definition is clicked in a help
> buffer (suppose you have done C-h f <function>), the source file opens
> in SOME other window - probably the one that the help buffer was called
> from.
>
> Now I don't like that at all, and I've gone through the sources to find
> out how a link is followed, but I'm still clueless.
>
> Why doesn't link-following go through switch-to-buffer-other-window?
Because it goes through pop-to-buffer (see describe-function-1 in
help.el):
(if file-name
(progn
(princ " in `")
;; We used to add .el to the file name,
;; but that's completely wrong when the user used load-file.
(princ file-name)
(princ "'")
;; Make a hyperlink to the library.
(with-current-buffer "*Help*"
(save-excursion
(re-search-backward "`\\([^`']+\\)'" nil t)
(help-xref-button
1
#'(lambda (fun file)
(require 'find-func)
;; Don't use find-function-noselect because it follows
;; aliases (which fails for built-in functions).
(let* ((location (find-function-search-for-symbol
fun nil file)))
(pop-to-buffer (car location))
(goto-char (cdr location))))
(list function file-name)
"mouse-2, RET: find function's definition")))))
--
Kevin Rodgers