:version "20.3")
(defcustom which-func-modes
- '(emacs-lisp-mode c-mode c++-mode perl-mode makefile-mode sh-mode)
+ '(emacs-lisp-mode c-mode c++-mode perl-mode makefile-mode sh-mode
+ fortran-mode)
"List of major modes for which Which Function mode should be used.
For other modes it is disabled. If this is equal to t,
then Which Function mode is enabled in any major mode that supports it."
"*Toggle `which-func-mode'.
You must modify via \\[customize] for this variable to have an effect."
:set #'(lambda (symbol value)
- (which-func-mode (or value 0)))
+ (which-func-mode (if value 1 0)))
:initialize 'custom-initialize-default
:type 'boolean
:group 'which-func
(setq which-func-mode which-func-mode-global)
(setq which-func-mode nil))
- (if (and which-func-mode
- (not (member major-mode which-func-non-auto-modes))
- (or (< buffer-saved-size which-func-maxout)
- (= which-func-maxout 0)))
- (setq imenu--index-alist
- (save-excursion (funcall imenu-create-index-function)))))
+ (condition-case nil
+ (if (and which-func-mode
+ (not (member major-mode which-func-non-auto-modes))
+ (or (< buffer-saved-size which-func-maxout)
+ (= which-func-maxout 0)))
+ (setq imenu--index-alist
+ (save-excursion (funcall imenu-create-index-function))))
+ (error
+ (setq which-func-mode nil))))
(defun which-func-update ()
;; Update the string containing the current function.
(let ((pair (car-safe imenu--index-alist))
(rest (cdr-safe imenu--index-alist))
(name nil))
- (while (and pair (or (not (number-or-marker-p (cdr pair)))
- (> (point) (cdr pair))))
+ (while (and (or rest pair)
+ (or (not (number-or-marker-p (cdr pair)))
+ (> (point) (cdr pair))))
(setq name (car pair))
(setq pair (car-safe rest))
(setq rest (cdr-safe rest)))