summaryrefslogtreecommitdiff
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
parent57e1205767c012d4fcea87d99db987bc7c0d5585 (diff)
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.
-rw-r--r--lisp/imenu.el15
-rw-r--r--lisp/progmodes/which-func.el8
2 files changed, 15 insertions, 8 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 158718b08a..717ac63366 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 ()
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 81f3b8ff9b..a8c2813066 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -209,11 +209,11 @@ It creates the Imenu index for the buffer, if necessary."
(< buffer-saved-size which-func-maxout)
(= which-func-maxout 0)))
(setq imenu--index-alist
- (save-excursion (funcall imenu-create-index-function))))
+ (save-excursion (funcall imenu-create-index-function))))
+ (imenu-unavailable
+ (setq which-func-mode nil))
(error
- (unless (equal err
- '(user-error "This buffer cannot use `imenu-default-create-index-function'"))
- (message "which-func-ff-hook error: %S" err))
+ (message "which-func-ff-hook error: %S" err)
(setq which-func-mode nil))))
(defun which-func-update ()