aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/progmodes/which-func.el28
2 files changed, 22 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d4bb37d32c6..d8c48287c14 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12014-09-03 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/which-func.el (which-func-ff-hook): Obey pre-existing
4 buffer-local setting of which-func-mode.
5 (which-func-mode): Use defvar-local.
6 (which-function-mode): Don't reset which-func-mode in each buffer since
7 it might have been set by someone else.
8 (which-func-update-ediff-windows): Check which-function-mode.
9
12014-09-03 Martin Rudalics <rudalics@gmx.at> 102014-09-03 Martin Rudalics <rudalics@gmx.at>
2 11
3 * frame.el (frame-initialize): Remove horizontal-scroll-bars 12 * frame.el (frame-initialize): Remove horizontal-scroll-bars
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index aa68f9fcc1a..e62ad271089 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -187,21 +187,20 @@ and you want to simplify them for the mode line
187 which-func-unknown)))) 187 which-func-unknown))))
188;;;###autoload (put 'which-func-current 'risky-local-variable t) 188;;;###autoload (put 'which-func-current 'risky-local-variable t)
189 189
190(defvar which-func-mode nil 190(defvar-local which-func-mode nil
191 "Non-nil means display current function name in mode line. 191 "Non-nil means display current function name in mode line.
192This makes a difference only if `which-function-mode' is non-nil.") 192This makes a difference only if `which-function-mode' is non-nil.")
193(make-variable-buffer-local 'which-func-mode)
194;;(put 'which-func-mode 'permanent-local t)
195 193
196(add-hook 'find-file-hook 'which-func-ff-hook t) 194(add-hook 'find-file-hook 'which-func-ff-hook t)
197 195
198(defun which-func-ff-hook () 196(defun which-func-ff-hook ()
199 "File find hook for Which Function mode. 197 "File find hook for Which Function mode.
200It creates the Imenu index for the buffer, if necessary." 198It creates the Imenu index for the buffer, if necessary."
201 (setq which-func-mode 199 (unless (local-variable-p 'which-func-mode)
202 (and which-function-mode 200 (setq which-func-mode
203 (or (eq which-func-modes t) 201 (and which-function-mode
204 (member major-mode which-func-modes)))) 202 (or (eq which-func-modes t)
203 (member major-mode which-func-modes)))))
205 204
206 (condition-case err 205 (condition-case err
207 (if (and which-func-mode 206 (if (and which-func-mode
@@ -259,15 +258,13 @@ in certain major modes."
259 ;;Turn it on 258 ;;Turn it on
260 (progn 259 (progn
261 (setq which-func-update-timer 260 (setq which-func-update-timer
262 (run-with-idle-timer idle-update-delay t 'which-func-update)) 261 (run-with-idle-timer idle-update-delay t #'which-func-update))
263 (dolist (buf (buffer-list)) 262 (dolist (buf (buffer-list))
264 (with-current-buffer buf 263 (with-current-buffer buf
265 (setq which-func-mode 264 (unless (local-variable-p 'which-func-mode)
266 (or (eq which-func-modes t) 265 (setq which-func-mode
267 (member major-mode which-func-modes)))))) 266 (or (eq which-func-modes t)
268 ;; Turn it off 267 (member major-mode which-func-modes)))))))))
269 (dolist (buf (buffer-list))
270 (with-current-buffer buf (setq which-func-mode nil)))))
271 268
272(defvar which-function-imenu-failed nil 269(defvar which-function-imenu-failed nil
273 "Locally t in a buffer if `imenu--make-index-alist' found nothing there.") 270 "Locally t in a buffer if `imenu--make-index-alist' found nothing there.")
@@ -347,10 +344,11 @@ If no function name is found, return nil."
347(defvar ediff-window-B) 344(defvar ediff-window-B)
348(defvar ediff-window-C) 345(defvar ediff-window-C)
349 346
347;; FIXME: Why does ediff require special support?
350(defun which-func-update-ediff-windows () 348(defun which-func-update-ediff-windows ()
351 "Update Which-Function mode display for Ediff windows. 349 "Update Which-Function mode display for Ediff windows.
352This function is meant to be called from `ediff-select-hook'." 350This function is meant to be called from `ediff-select-hook'."
353 (when (eq major-mode 'ediff-mode) 351 (when (and (derived-mode-p 'ediff-mode) which-function-mode)
354 (when ediff-window-A 352 (when ediff-window-A
355 (which-func-update-1 ediff-window-A)) 353 (which-func-update-1 ediff-window-A))
356 (when ediff-window-B 354 (when ediff-window-B