[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 24ee55b: Fix which-func for curly quotes: look for
From: |
Daniel Colascione |
Subject: |
[Emacs-diffs] master 24ee55b: Fix which-func for curly quotes: look for symbol, not message |
Date: |
Sun, 30 Aug 2015 01:06:21 +0000 |
branch: master
commit 24ee55bfd4371e24a03db0fbd830ad5adac0ac4f
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>
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.
---
lisp/imenu.el | 15 +++++++++++----
lisp/progmodes/which-func.el | 8 ++++----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 158718b..717ac63 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 81f3b8f..a8c2813 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 ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 24ee55b: Fix which-func for curly quotes: look for symbol, not message,
Daniel Colascione <=