emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117812: * lisp/progmodes/which-func.el (which-func-


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117812: * lisp/progmodes/which-func.el (which-func-ff-hook): Obey pre-existing
Date: Wed, 03 Sep 2014 19:10:23 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117812
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2014-09-03 15:10:15 -0400
message:
  * lisp/progmodes/which-func.el (which-func-ff-hook): Obey pre-existing
  buffer-local setting of which-func-mode.
  (which-func-mode): Use defvar-local.
  (which-function-mode): Don't reset which-func-mode in each buffer since
  it might have been set by someone else.
  (which-func-update-ediff-windows): Check which-function-mode.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/which-func.el   
whichfunc.el-20091113204419-o5vbwnq5f7feedwu-2593
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-03 15:10:29 +0000
+++ b/lisp/ChangeLog    2014-09-03 19:10:15 +0000
@@ -1,3 +1,12 @@
+2014-09-03  Stefan Monnier  <address@hidden>
+
+       * progmodes/which-func.el (which-func-ff-hook): Obey pre-existing
+       buffer-local setting of which-func-mode.
+       (which-func-mode): Use defvar-local.
+       (which-function-mode): Don't reset which-func-mode in each buffer since
+       it might have been set by someone else.
+       (which-func-update-ediff-windows): Check which-function-mode.
+
 2014-09-03  Martin Rudalics  <address@hidden>
 
        * frame.el (frame-initialize): Remove horizontal-scroll-bars

=== modified file 'lisp/progmodes/which-func.el'
--- a/lisp/progmodes/which-func.el      2014-01-01 07:43:34 +0000
+++ b/lisp/progmodes/which-func.el      2014-09-03 19:10:15 +0000
@@ -187,21 +187,20 @@
                which-func-unknown))))
 ;;;###autoload (put 'which-func-current 'risky-local-variable t)
 
-(defvar which-func-mode nil
+(defvar-local which-func-mode nil
   "Non-nil means display current function name in mode line.
 This makes a difference only if `which-function-mode' is non-nil.")
-(make-variable-buffer-local 'which-func-mode)
-;;(put 'which-func-mode 'permanent-local t)
 
 (add-hook 'find-file-hook 'which-func-ff-hook t)
 
 (defun which-func-ff-hook ()
   "File find hook for Which Function mode.
 It creates the Imenu index for the buffer, if necessary."
-  (setq which-func-mode
-       (and which-function-mode
-            (or (eq which-func-modes t)
-                (member major-mode which-func-modes))))
+  (unless (local-variable-p 'which-func-mode)
+    (setq which-func-mode
+          (and which-function-mode
+               (or (eq which-func-modes t)
+                   (member major-mode which-func-modes)))))
 
   (condition-case err
       (if (and which-func-mode
@@ -259,15 +258,13 @@
       ;;Turn it on
       (progn
         (setq which-func-update-timer
-              (run-with-idle-timer idle-update-delay t 'which-func-update))
+              (run-with-idle-timer idle-update-delay t #'which-func-update))
         (dolist (buf (buffer-list))
           (with-current-buffer buf
-            (setq which-func-mode
-                  (or (eq which-func-modes t)
-                      (member major-mode which-func-modes))))))
-    ;; Turn it off
-    (dolist (buf (buffer-list))
-      (with-current-buffer buf (setq which-func-mode nil)))))
+            (unless (local-variable-p 'which-func-mode)
+              (setq which-func-mode
+                    (or (eq which-func-modes t)
+                        (member major-mode which-func-modes)))))))))
 
 (defvar which-function-imenu-failed nil
   "Locally t in a buffer if `imenu--make-index-alist' found nothing there.")
@@ -347,10 +344,11 @@
 (defvar ediff-window-B)
 (defvar ediff-window-C)
 
+;; FIXME: Why does ediff require special support?
 (defun which-func-update-ediff-windows ()
   "Update Which-Function mode display for Ediff windows.
 This function is meant to be called from `ediff-select-hook'."
-  (when (eq major-mode 'ediff-mode)
+  (when (and (derived-mode-p 'ediff-mode) which-function-mode)
     (when ediff-window-A
       (which-func-update-1 ediff-window-A))
     (when ediff-window-B


reply via email to

[Prev in Thread] Current Thread [Next in Thread]