Change unsetting with set-lookup-handlers!
Instead of passing :unset, pass in nil as its second argument.
This commit is contained in:
parent
ff7823bfc9
commit
be48751a45
1 changed files with 27 additions and 26 deletions
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
;;;###autodef
|
;;;###autodef
|
||||||
(defun set-lookup-handlers! (modes &rest plist)
|
(defun set-lookup-handlers! (modes &rest plist)
|
||||||
"Defines a jump target for major MODES.
|
"Define a jump target for major MODES.
|
||||||
|
|
||||||
This overwrites previously defined handlers for MODES. If used on minor modes,
|
This overwrites previously defined handlers for MODES. If used on minor modes,
|
||||||
they are combined with handlers defined for other minor modes or the major mode
|
they are combined with handlers defined for other minor modes or the major mode
|
||||||
it's activated in.
|
it's activated in.
|
||||||
|
|
||||||
If the CAR of PLIST is :unset, other properties are ignored and all existing
|
If the CAR of PLIST is nil, other properties are ignored and all existing jump
|
||||||
jump handlers for MODES are cleared. Otherwise, PLIST accepts the following
|
handlers for MODES are cleared. Otherwise, PLIST accepts the following
|
||||||
properties:
|
properties:
|
||||||
|
|
||||||
:definition FN
|
:definition FN
|
||||||
|
@ -30,29 +30,30 @@ properties:
|
||||||
Defines an xref backend for a major-mode. If you define :definition and
|
Defines an xref backend for a major-mode. If you define :definition and
|
||||||
:references along with :xref-backend, those will have higher precedence."
|
:references along with :xref-backend, those will have higher precedence."
|
||||||
(dolist (mode (doom-enlist modes))
|
(dolist (mode (doom-enlist modes))
|
||||||
(let ((fn (intern (format "+lookup|init-%s" mode)))
|
(let ((hook (intern (format "%s-hook" mode)))
|
||||||
(hook (intern (format "%s-hook" mode))))
|
(fn (intern (format "+lookup|init-%s" mode))))
|
||||||
(if (eq (car plist) :unset)
|
(cond ((null (car plist))
|
||||||
(remove-hook hook fn)
|
(remove-hook hook fn)
|
||||||
(fset fn
|
(unintern fn))
|
||||||
(lambda ()
|
((fset fn
|
||||||
(when (or (eq major-mode mode)
|
(lambda ()
|
||||||
(and (boundp mode)
|
(when (or (eq major-mode mode)
|
||||||
(symbol-value mode)))
|
(and (boundp mode)
|
||||||
(cl-destructuring-bind
|
(symbol-value mode)))
|
||||||
(&key definition references documentation file xref-backend)
|
(cl-destructuring-bind
|
||||||
plist
|
(&key definition references documentation file xref-backend)
|
||||||
(when definition
|
plist
|
||||||
(add-hook '+lookup-definition-functions definition nil t))
|
(when definition
|
||||||
(when references
|
(add-hook '+lookup-definition-functions definition nil t))
|
||||||
(add-hook '+lookup-references-functions references nil t))
|
(when references
|
||||||
(when documentation
|
(add-hook '+lookup-references-functions references nil t))
|
||||||
(add-hook '+lookup-documentation-functions documentation nil t))
|
(when documentation
|
||||||
(when file
|
(add-hook '+lookup-documentation-functions documentation nil t))
|
||||||
(add-hook '+lookup-file-functions file nil t))
|
(when file
|
||||||
(when xref-backend
|
(add-hook '+lookup-file-functions file nil t))
|
||||||
(add-hook 'xref-backend-functions xref-backend nil t))))))
|
(when xref-backend
|
||||||
(add-hook hook fn)))))
|
(add-hook 'xref-backend-functions xref-backend nil t))))))
|
||||||
|
(add-hook hook fn))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(def-setting! :lookup (modes &rest plist)
|
(def-setting! :lookup (modes &rest plist)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue