Change prefix arg behavior for +lookup/documentation
Would formerly open documentation in "other window", but this doesn't make sense for this function (as it should always do this). Instead, it will be passed on to documentation handlers to do as they like with.
This commit is contained in:
parent
b054190820
commit
27822ef006
1 changed files with 11 additions and 7 deletions
|
@ -100,7 +100,8 @@ Otherwise, these properties are available to be set:
|
||||||
provider))))
|
provider))))
|
||||||
|
|
||||||
(defun +lookup--symbol-or-region (&optional initial)
|
(defun +lookup--symbol-or-region (&optional initial)
|
||||||
(cond (initial)
|
(cond ((stringp initial)
|
||||||
|
initial)
|
||||||
((use-region-p)
|
((use-region-p)
|
||||||
(buffer-substring-no-properties (region-beginning)
|
(buffer-substring-no-properties (region-beginning)
|
||||||
(region-end)))
|
(region-end)))
|
||||||
|
@ -117,12 +118,15 @@ Otherwise, these properties are available to be set:
|
||||||
;; reliably, so we set up the new window ahead of time.
|
;; reliably, so we set up the new window ahead of time.
|
||||||
(switch-to-buffer-other-window (current-buffer))
|
(switch-to-buffer-other-window (current-buffer))
|
||||||
(goto-char (marker-position origin)))
|
(goto-char (marker-position origin)))
|
||||||
(call-interactively hook)
|
(if (commandp hook)
|
||||||
|
(call-interactively hook)
|
||||||
|
(funcall hook identifier))
|
||||||
t)
|
t)
|
||||||
(save-window-excursion
|
(save-window-excursion
|
||||||
(when (or (if (commandp hook)
|
(when (or (if (commandp hook)
|
||||||
(call-interactively hook)
|
(call-interactively hook)
|
||||||
(funcall hook identifier))
|
(funcall hook identifier))
|
||||||
|
(null origin)
|
||||||
(/= (point-marker) origin))
|
(/= (point-marker) origin))
|
||||||
(point-marker))))
|
(point-marker))))
|
||||||
((error user-error)
|
((error user-error)
|
||||||
|
@ -137,7 +141,9 @@ Otherwise, these properties are available to be set:
|
||||||
:file '+lookup-file-functions)
|
:file '+lookup-file-functions)
|
||||||
prop)
|
prop)
|
||||||
'+lookup--run-hooks
|
'+lookup--run-hooks
|
||||||
identifier (point-marker) other-window)))
|
identifier
|
||||||
|
(point-marker)
|
||||||
|
other-window)))
|
||||||
(cond ((null ret)
|
(cond ((null ret)
|
||||||
(message "Could not find '%s'" identifier)
|
(message "Could not find '%s'" identifier)
|
||||||
nil)
|
nil)
|
||||||
|
@ -263,7 +269,7 @@ search otherwise."
|
||||||
((error "Couldn't find references of '%s'" identifier))))
|
((error "Couldn't find references of '%s'" identifier))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +lookup/documentation (identifier &optional other-window)
|
(defun +lookup/documentation (identifier &optional arg)
|
||||||
"Show documentation for IDENTIFIER (defaults to symbol at point or selection.
|
"Show documentation for IDENTIFIER (defaults to symbol at point or selection.
|
||||||
|
|
||||||
First attempts the :documentation handler specified with `set-lookup-handlers!'
|
First attempts the :documentation handler specified with `set-lookup-handlers!'
|
||||||
|
@ -272,9 +278,7 @@ for the current mode/buffer (if any), then falls back to the backends in
|
||||||
(interactive
|
(interactive
|
||||||
(list (+lookup--symbol-or-region)
|
(list (+lookup--symbol-or-region)
|
||||||
current-prefix-arg))
|
current-prefix-arg))
|
||||||
(cond ((null identifier) (user-error "Nothing under point"))
|
(cond ((+lookup--jump-to :documentation identifier t))
|
||||||
|
|
||||||
((+lookup--jump-to :documentation identifier other-window))
|
|
||||||
|
|
||||||
((user-error "Couldn't find documentation for '%s'" identifier))))
|
((user-error "Couldn't find documentation for '%s'" identifier))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue