summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
authorDaniel Colascione <dancol@dancol.org>2015-08-29 18:06:13 -0700
committerDaniel Colascione <dancol@dancol.org>2015-08-29 18:06:13 -0700
commit24ee55bfd4371e24a03db0fbd830ad5adac0ac4f (patch)
tree12d66bec3390b39a686aa2c83b00142f1ad23546 /lisp/imenu.el
parent57e1205767c012d4fcea87d99db987bc7c0d5585 (diff)
downloademacs-24ee55bfd4371e24a03db0fbd830ad5adac0ac4f.tar.gz
Fix which-func for curly quotes: look for symbol, not message
* lisp/progmodes/which-func.el (which-func-ff-hook): Look for new imenu-unavailable error symbol instead of trying to match message exactly. * lisp/imenu.el (imenu-unavailable): New error (imenu-unavailable-error): New function.
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 158718b08a9..717ac633665 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -348,6 +348,12 @@ Don't move point."
;;; Lisp
;;;
+(define-error 'imenu-unavailable "imenu unavailable")
+
+(defun imenu-unavailable-error (format &rest args)
+ (signal 'imenu-unavailable
+ (list (apply #'format-message format args))))
+
(defun imenu-example--lisp-extract-index-name ()
;; Example of a candidate for `imenu-extract-index-name-function'.
;; This will generate a flat index of definitions in a lisp file.
@@ -590,7 +596,8 @@ See `imenu--index-alist' for the format of the index alist."
(funcall imenu-create-index-function))))
(imenu--truncate-items imenu--index-alist)))
(or imenu--index-alist noerror
- (user-error "No items suitable for an index found in this buffer"))
+ (imenu-unavailable-error
+ "No items suitable for an index found in this buffer"))
(or imenu--index-alist
(setq imenu--index-alist (list nil)))
;; Add a rescan option to the index.
@@ -704,7 +711,7 @@ The alternate method, which is the one most often used, is to call
((and imenu-generic-expression)
(imenu--generic-function imenu-generic-expression))
(t
- (user-error "This buffer cannot use `imenu-default-create-index-function'"))))
+ (imenu-unavailable-error "This buffer cannot use `imenu-default-create-index-function'"))))
;;;
;;; Generic index gathering function.
@@ -956,8 +963,8 @@ See the command `imenu' for more information."
`(menu-item ,name ,imenu--menubar-keymap))
(use-local-map newmap)
(add-hook 'menu-bar-update-hook 'imenu-update-menubar)))
- (user-error "The mode `%s' does not support Imenu"
- (format-mode-line mode-name))))
+ (imenu-unavailable-error "The mode `%s' does not support Imenu"
+ (format-mode-line mode-name))))
;;;###autoload
(defun imenu-add-menubar-index ()