]> git.eshelyaron.com Git - emacs.git/commitdiff
(which-func-format): Make it risky-local-variable.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 17 May 2003 22:21:36 +0000 (22:21 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 17 May 2003 22:21:36 +0000 (22:21 +0000)
(which-func-table): New var.
(which-func-current): Make it into a constant modeline spec.
(which-func-previous): Remove.
(which-func-update): Only update the selected window.
(which-func-update-1): Use the new var to allow the current
function to be different for a buffer shown in two windows.

lisp/ChangeLog
lisp/which-func.el

index a43f048c400a1559bdf777be25c0394795677f26..af840feb1e173cd6ecbfd2d5c61c4f50063923e6 100644 (file)
@@ -1,19 +1,41 @@
+2003-05-17  Stefan Monnier  <monnier@cs.yale.edu>
+
+       * which-func.el (which-func-format): Make it risky-local-variable.
+       (which-func-table): New var.
+       (which-func-current): Make it into a constant modeline spec.
+       (which-func-previous): Remove.
+       (which-func-update): Only update the selected window.
+       (which-func-update-1): Use the new var to allow the current
+       function to be different for a buffer shown in two windows.
+
+       * subr.el (with-selected-window): New macro.
+       (dolist, dotimes, with-current-buffer): Use backquotes.
+       (when, unless, save-match-data, combine-after-change-calls)
+       (with-output-to-string, with-temp-buffer): Add `declare' info.
+       (listify-key-sequence): Don't allocate unnecessarily.
+       (read-quoted-char): Allow up to base 36.
+       (prepare-change-group): Remove unimplemented argument.
+
+       * wid-edit.el (pp-to-string, Info-goto-node): Don't autoload.
+       (widget-choose, widget-map-buttons): Use with-current-buffer.
+       (widget-field-add-space): Change to nil (and to defconst).
+       (widget-info-link-action): Use `info'.
+
 2003-05-17  Nick Roberts  <nick@nick.uklinux.net>
 
        * gdb-ui.el (gdb-info-frames-custom): Reverse contrast of face for
        selected frame.
        (gdb-annotation-rules): Stop using frames-invalid and
-       breakpoints-invalid annotations. Update after post-prompt instead.
+       breakpoints-invalid annotations.  Update after post-prompt instead.
        (gdb-post-prompt): Update frames and breakpoints here.
        (gdb-invalidate-frame-and-assembler)
        (gdb-invalidate-breakpoints-and-assembler): Remove.
        (gdb-current-address): Remove.
        (gdb-previous-address): New variable.
        (gud-until): Extend to work in Assembler buffer
-       (gdb-append-to-inferior-io): Select IO buffer when there is
-       output.
+       (gdb-append-to-inferior-io): Select IO buffer when there is output.
        (gdb-assembler-custom): Try to get line marker (arrow) to display
-       in window. Correct parsing for OS dependent output syntax of Gdb
+       in window.  Correct parsing for OS dependent output syntax of Gdb
        command, where.
        (gdb-frame-handler): Correct parsing for OS dependent output
        syntax of Gdb command, frame.
index 7b178ab25ea04dc8f1f525cf9e5e99012859359a..57e9463f444c5cddca74ac4fcdb2311de8b95011 100644 (file)
@@ -1,6 +1,6 @@
 ;;; which-func.el --- print current function in mode line
 
-;; Copyright (C) 1994, 1997, 1998, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
 
 ;; Author:   Alex Rezinsky <alexr@msil.sps.mot.com>
 ;;           (doesn't seem to be responsive any more)
@@ -103,6 +103,7 @@ Zero means compute the Imenu menu regardless of size."
   "Format for displaying the function in the mode line."
   :group 'which-func
   :type 'sexp)
+(put 'which-func-format 'risky-local-variable t)
 
 (defvar which-func-cleanup-function nil
   "Function to transform a string before displaying it in the mode line.
@@ -120,10 +121,11 @@ and you want to simplify them for the mode line
 ;;;
 (require 'imenu)
 
-(defvar which-func-current  which-func-unknown)
-(defvar which-func-previous which-func-unknown)
-(make-variable-buffer-local 'which-func-current)
-(make-variable-buffer-local 'which-func-previous)
+(defvar which-func-table (make-hash-table :test 'eq :weakness 'key))
+
+(defconst which-func-current
+  '(:eval (gethash (selected-window) which-func-table which-func-unknown)))
+(put 'which-func-current 'risky-local-variable t)
 
 (defvar which-func-mode nil
   "Non-nil means display current function name in mode line.
@@ -153,21 +155,19 @@ It creates the Imenu index for the buffer, if necessary."
      (setq which-func-mode nil))))
 
 (defun which-func-update ()
-  "Update the Which-Function mode display for all windows."
-  (walk-windows 'which-func-update-1 nil 'visible))
+  ;; "Update the Which-Function mode display for all windows."
+  ;; (walk-windows 'which-func-update-1 nil 'visible))
+  (which-func-update-1 (selected-window)))
 
 (defun which-func-update-1 (window)
   "Update the Which-Function mode display for window WINDOW."
-  (save-selected-window
-    (select-window window)
-    ;; Update the string containing the current function.
+  (with-selected-window window
     (when which-func-mode
       (condition-case info
-         (progn
-           (setq which-func-current (or (which-function) which-func-unknown))
-           (unless (string= which-func-current which-func-previous)
-             (force-mode-line-update)
-             (setq which-func-previous which-func-current)))
+         (let ((current (which-function)))
+           (unless (equal current (gethash window which-func-table))
+             (puthash window current which-func-table)
+             (force-mode-line-update)))
        (error
         (which-func-mode -1)
         (error "Error in which-func-update: %s" info))))))