hydra.el (find-func): Fix advice

In case of *Help* for `seq-contains', the `symbol' arg
is (seq-contains nil t t), which is not a symbol. So now check for
that.

Fixes #332
master
Oleh Krehel 7 years ago
parent a2bb124a3f
commit 82ff12666e
  1. 25
      hydra.el

@ -333,18 +333,19 @@ Exitable only through a blue head.")
(around hydra-around-find-function-search-for-symbol-advice (around hydra-around-find-function-search-for-symbol-advice
(symbol type library) activate) (symbol type library) activate)
"Navigate to hydras with `find-function-search-for-symbol'." "Navigate to hydras with `find-function-search-for-symbol'."
ad-do-it (prog1 ad-do-it
;; The orignial function returns (cons (current-buffer) (point)) (when (symbolp symbol)
;; if it found the point. ;; The orignial function returns (cons (current-buffer) (point))
(unless (cdr ad-return-value) ;; if it found the point.
(with-current-buffer (find-file-noselect library) (unless (cdr ad-return-value)
(let ((sn (symbol-name symbol))) (with-current-buffer (find-file-noselect library)
(when (and (null type) (let ((sn (symbol-name symbol)))
(string-match "\\`\\(hydra-[a-z-A-Z0-9]+\\)/\\(.*\\)\\'" sn) (when (and (null type)
(re-search-forward (concat "(defhydra " (match-string 1 sn)) (string-match "\\`\\(hydra-[a-z-A-Z0-9]+\\)/\\(.*\\)\\'" sn)
nil t)) (re-search-forward (concat "(defhydra " (match-string 1 sn))
(goto-char (match-beginning 0))) nil t))
(cons (current-buffer) (point))))))) (goto-char (match-beginning 0)))
(cons (current-buffer) (point)))))))))
;;* Universal Argument ;;* Universal Argument
(defvar hydra-base-map (defvar hydra-base-map

Loading…
Cancel
Save