Fix switch-from-wrong-buffer issue with help-mode links
This commit is contained in:
parent
ad225d2591
commit
8cf4e62a26
1 changed files with 9 additions and 6 deletions
|
@ -85,9 +85,9 @@
|
||||||
|
|
||||||
(after! help-mode
|
(after! help-mode
|
||||||
;; So that help buffer links do not open in the help popup, we need to redefine these
|
;; So that help buffer links do not open in the help popup, we need to redefine these
|
||||||
;; three button types to use `switch-to-buffer-other-window' rather than
|
;; three button types to use `switch-to-buffer' rather than `pop-to-buffer'.
|
||||||
;; `pop-to-buffer'. Instead of lambas these help-functions should be function symbols,
|
;; Instead of lambas these help-functions should be function symbols, so that
|
||||||
;; so that we could advise those instead of clumsify redefine these button types.
|
;; we could advise those instead of clumsify redefine these button types.
|
||||||
(define-button-type 'help-function-def
|
(define-button-type 'help-function-def
|
||||||
:supertype 'help-xref
|
:supertype 'help-xref
|
||||||
'help-function (lambda (fun file)
|
'help-function (lambda (fun file)
|
||||||
|
@ -96,7 +96,8 @@
|
||||||
(setq file (help-C-file-name (indirect-function fun) 'fun)))
|
(setq file (help-C-file-name (indirect-function fun) 'fun)))
|
||||||
(let ((location
|
(let ((location
|
||||||
(find-function-search-for-symbol fun nil file)))
|
(find-function-search-for-symbol fun nil file)))
|
||||||
(switch-to-buffer-other-window (car location))
|
(doom/popup-save
|
||||||
|
(switch-to-buffer (car location)))
|
||||||
(if (cdr location)
|
(if (cdr location)
|
||||||
(goto-char (cdr location))
|
(goto-char (cdr location))
|
||||||
(message "Unable to find location in file"))))
|
(message "Unable to find location in file"))))
|
||||||
|
@ -108,7 +109,8 @@
|
||||||
(when (eq file 'C-source)
|
(when (eq file 'C-source)
|
||||||
(setq file (help-C-file-name var 'var)))
|
(setq file (help-C-file-name var 'var)))
|
||||||
(let ((location (find-variable-noselect var file)))
|
(let ((location (find-variable-noselect var file)))
|
||||||
(switch-to-buffer-other-window (car location))
|
(doom/popup-save
|
||||||
|
(switch-to-buffer (car location)))
|
||||||
(if (cdr location)
|
(if (cdr location)
|
||||||
(goto-char (cdr location))
|
(goto-char (cdr location))
|
||||||
(message "Unable to find location in file"))))
|
(message "Unable to find location in file"))))
|
||||||
|
@ -120,7 +122,8 @@
|
||||||
(require 'find-func)
|
(require 'find-func)
|
||||||
(let ((location
|
(let ((location
|
||||||
(find-function-search-for-symbol fun 'defface file)))
|
(find-function-search-for-symbol fun 'defface file)))
|
||||||
(switch-to-buffer-other-window (car location))
|
(doom/popup-save
|
||||||
|
(switch-to-buffer (car location)))
|
||||||
(if (cdr location)
|
(if (cdr location)
|
||||||
(goto-char (cdr location))
|
(goto-char (cdr location))
|
||||||
(message "Unable to find location in file"))))
|
(message "Unable to find location in file"))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue