Skip to content

Commit e890eb2

Browse files
committed
lispy.el (lispy-goto-local): Fall back to counsel-imenu
Useful for clojure-mode, which has no official (only unofficial) semantic implementation. Fixes #432
1 parent b256863 commit e890eb2

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

lispy-pkg.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
'((emacs "24.3")
44
(ace-window "0.9.0")
55
(iedit "0.9.9")
6-
(swiper "0.11.0")
6+
(counsel "0.11.0")
77
(hydra "0.14.0")
88
(zoutline "0.1.0")))

lispy-tags.el

+4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@
5656
(lambda (x) (string-match "\\(?:^\\.?#\\|~$\\|loaddefs.el\\)" x))
5757
(file-expand-wildcards (format "*.%s" ext)))))))
5858

59+
(define-error 'no-semantic-support "No semantic support for major-mode")
60+
5961
(defun lispy--fetch-this-file-tags (&optional file)
6062
"Fetch tags for FILE."
6163
(setq file (or file (buffer-file-name)))
6264
(semantic-new-buffer-fcn)
65+
(when (null semantic--parse-table)
66+
(signal 'no-semantic-support nil))
6367
(let ((tags (semantic-parse-region (point-min) (point-max))))
6468
(when (memq major-mode (cons 'lisp-mode lispy-elisp-modes))
6569
(let ((arity (cdr (assoc major-mode lispy-tag-arity)))

lispy.el

+8-5
Original file line numberDiff line numberDiff line change
@@ -4099,11 +4099,14 @@ When ARG isn't nil, call `lispy-goto-projectile' instead."
40994099
When ARG is non-nil, force a reparse."
41004100
(interactive "P")
41014101
(deactivate-mark)
4102-
(let ((lispy-force-reparse arg))
4103-
(lispy--select-candidate
4104-
(mapcar #'lispy--format-tag-line
4105-
(lispy--fetch-tags (list (buffer-file-name))))
4106-
#'lispy--action-jump)))
4102+
(condition-case nil
4103+
(let ((lispy-force-reparse arg))
4104+
(lispy--select-candidate
4105+
(mapcar #'lispy--format-tag-line
4106+
(lispy--fetch-tags (list (buffer-file-name))))
4107+
#'lispy--action-jump))
4108+
(no-semantic-support
4109+
(counsel-imenu))))
41074110

41084111
(defun lispy-goto-elisp-commands (&optional arg)
41094112
"Jump to Elisp commands within current file.

0 commit comments

Comments
 (0)