diff options
| author | Stefan Monnier | 2010-12-03 19:49:49 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-03 19:49:49 -0500 |
| commit | b2e6e5bd1549cdda271e6a5370615cd72c8f4fd6 (patch) | |
| tree | b31fdc12b98701e739991c7043357c2a35b8f1fa | |
| parent | 7f0ea0ffc90f140cd6e19bc2adb25eb87f3e90d9 (diff) | |
| download | emacs-b2e6e5bd1549cdda271e6a5370615cd72c8f4fd6.tar.gz emacs-b2e6e5bd1549cdda271e6a5370615cd72c8f4fd6.zip | |
* lisp/progmodes/which-func.el (which-func-ff-hook): Log the error message.
(which-func-update-1): Distinguish symbols from strings.
(which-function): Stay within 80 columns.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/which-func.el | 53 |
2 files changed, 34 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8aa0eb8398..141881a17a4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-12-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/which-func.el (which-func-ff-hook): Log the error message. | ||
| 4 | (which-func-update-1): Distinguish symbols from strings. | ||
| 5 | (which-function): Stay within 80 columns. | ||
| 6 | |||
| 1 | 2010-12-03 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2010-12-03 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * subr.el (with-demoted-errors): Distinguish symbols from strings. | 9 | * subr.el (with-demoted-errors): Distinguish symbols from strings. |
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 049d708d191..6262e1c1958 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el | |||
| @@ -198,7 +198,7 @@ It creates the Imenu index for the buffer, if necessary." | |||
| 198 | (or (eq which-func-modes t) | 198 | (or (eq which-func-modes t) |
| 199 | (member major-mode which-func-modes)))) | 199 | (member major-mode which-func-modes)))) |
| 200 | 200 | ||
| 201 | (condition-case nil | 201 | (condition-case err |
| 202 | (if (and which-func-mode | 202 | (if (and which-func-mode |
| 203 | (not (member major-mode which-func-non-auto-modes)) | 203 | (not (member major-mode which-func-non-auto-modes)) |
| 204 | (or (null which-func-maxout) | 204 | (or (null which-func-maxout) |
| @@ -207,6 +207,7 @@ It creates the Imenu index for the buffer, if necessary." | |||
| 207 | (setq imenu--index-alist | 207 | (setq imenu--index-alist |
| 208 | (save-excursion (funcall imenu-create-index-function)))) | 208 | (save-excursion (funcall imenu-create-index-function)))) |
| 209 | (error | 209 | (error |
| 210 | (message "which-func-ff-hook error: %S" err) | ||
| 210 | (setq which-func-mode nil)))) | 211 | (setq which-func-mode nil)))) |
| 211 | 212 | ||
| 212 | (defun which-func-update () | 213 | (defun which-func-update () |
| @@ -225,7 +226,7 @@ It creates the Imenu index for the buffer, if necessary." | |||
| 225 | (force-mode-line-update))) | 226 | (force-mode-line-update))) |
| 226 | (error | 227 | (error |
| 227 | (setq which-func-mode nil) | 228 | (setq which-func-mode nil) |
| 228 | (error "Error in which-func-update: %s" info)))))) | 229 | (error "Error in which-func-update: %S" info)))))) |
| 229 | 230 | ||
| 230 | ;;;###autoload | 231 | ;;;###autoload |
| 231 | (defalias 'which-func-mode 'which-function-mode) | 232 | (defalias 'which-func-mode 'which-function-mode) |
| @@ -294,29 +295,31 @@ If no function name is found, return nil." | |||
| 294 | ;; ("submenu" ("name" . marker) ... ). The list can be | 295 | ;; ("submenu" ("name" . marker) ... ). The list can be |
| 295 | ;; arbitrarily nested. | 296 | ;; arbitrarily nested. |
| 296 | (while (or alist imstack) | 297 | (while (or alist imstack) |
| 297 | (if alist | 298 | (if (null alist) |
| 298 | (progn | 299 | (setq alist (car imstack) |
| 299 | (setq pair (car-safe alist) | 300 | namestack (cdr namestack) |
| 300 | alist (cdr-safe alist)) | 301 | imstack (cdr imstack)) |
| 301 | 302 | ||
| 302 | (cond ((atom pair)) ; skip anything not a cons | 303 | (setq pair (car-safe alist) |
| 303 | 304 | alist (cdr-safe alist)) | |
| 304 | ((imenu--subalist-p pair) | 305 | |
| 305 | (setq imstack (cons alist imstack) | 306 | (cond |
| 306 | namestack (cons (car pair) namestack) | 307 | ((atom pair)) ; Skip anything not a cons. |
| 307 | alist (cdr pair))) | 308 | |
| 308 | 309 | ((imenu--subalist-p pair) | |
| 309 | ((number-or-marker-p (setq mark (cdr pair))) | 310 | (setq imstack (cons alist imstack) |
| 310 | (if (>= (setq offset (- (point) mark)) 0) | 311 | namestack (cons (car pair) namestack) |
| 311 | (if (< offset minoffset) ; find the closest item | 312 | alist (cdr pair))) |
| 312 | (setq minoffset offset | 313 | |
| 313 | name (funcall | 314 | ((number-or-marker-p (setq mark (cdr pair))) |
| 314 | which-func-imenu-joiner-function | 315 | (when (and (>= (setq offset (- (point) mark)) 0) |
| 315 | (reverse (cons (car pair) | 316 | (< offset minoffset)) ; Find the closest item. |
| 316 | namestack))))))))) | 317 | (setq minoffset offset |
| 317 | (setq alist (car imstack) | 318 | name (if (null which-func-imenu-joiner-function) |
| 318 | namestack (cdr namestack) | 319 | (car pair) |
| 319 | imstack (cdr imstack)))))) | 320 | (funcall |
| 321 | which-func-imenu-joiner-function | ||
| 322 | (reverse (cons (car pair) namestack)))))))))))) | ||
| 320 | 323 | ||
| 321 | ;; Try using add-log support. | 324 | ;; Try using add-log support. |
| 322 | (when (and (null name) (boundp 'add-log-current-defun-function) | 325 | (when (and (null name) (boundp 'add-log-current-defun-function) |