aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2003-05-17 22:21:36 +0000
committerStefan Monnier2003-05-17 22:21:36 +0000
commit6f25499a2a8ffcc5ff9951666c7f97a65dd24278 (patch)
tree6888c03bd8d66e000547d9ded5db31a44d3a1526
parentd47f75159ac07b74ead665b287c46fe4a774ab7a (diff)
downloademacs-6f25499a2a8ffcc5ff9951666c7f97a65dd24278.tar.gz
emacs-6f25499a2a8ffcc5ff9951666c7f97a65dd24278.zip
(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.
-rw-r--r--lisp/ChangeLog30
-rw-r--r--lisp/which-func.el30
2 files changed, 41 insertions, 19 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a43f048c400..af840feb1e1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,19 +1,41 @@
12003-05-17 Stefan Monnier <monnier@cs.yale.edu>
2
3 * which-func.el (which-func-format): Make it risky-local-variable.
4 (which-func-table): New var.
5 (which-func-current): Make it into a constant modeline spec.
6 (which-func-previous): Remove.
7 (which-func-update): Only update the selected window.
8 (which-func-update-1): Use the new var to allow the current
9 function to be different for a buffer shown in two windows.
10
11 * subr.el (with-selected-window): New macro.
12 (dolist, dotimes, with-current-buffer): Use backquotes.
13 (when, unless, save-match-data, combine-after-change-calls)
14 (with-output-to-string, with-temp-buffer): Add `declare' info.
15 (listify-key-sequence): Don't allocate unnecessarily.
16 (read-quoted-char): Allow up to base 36.
17 (prepare-change-group): Remove unimplemented argument.
18
19 * wid-edit.el (pp-to-string, Info-goto-node): Don't autoload.
20 (widget-choose, widget-map-buttons): Use with-current-buffer.
21 (widget-field-add-space): Change to nil (and to defconst).
22 (widget-info-link-action): Use `info'.
23
12003-05-17 Nick Roberts <nick@nick.uklinux.net> 242003-05-17 Nick Roberts <nick@nick.uklinux.net>
2 25
3 * gdb-ui.el (gdb-info-frames-custom): Reverse contrast of face for 26 * gdb-ui.el (gdb-info-frames-custom): Reverse contrast of face for
4 selected frame. 27 selected frame.
5 (gdb-annotation-rules): Stop using frames-invalid and 28 (gdb-annotation-rules): Stop using frames-invalid and
6 breakpoints-invalid annotations. Update after post-prompt instead. 29 breakpoints-invalid annotations. Update after post-prompt instead.
7 (gdb-post-prompt): Update frames and breakpoints here. 30 (gdb-post-prompt): Update frames and breakpoints here.
8 (gdb-invalidate-frame-and-assembler) 31 (gdb-invalidate-frame-and-assembler)
9 (gdb-invalidate-breakpoints-and-assembler): Remove. 32 (gdb-invalidate-breakpoints-and-assembler): Remove.
10 (gdb-current-address): Remove. 33 (gdb-current-address): Remove.
11 (gdb-previous-address): New variable. 34 (gdb-previous-address): New variable.
12 (gud-until): Extend to work in Assembler buffer 35 (gud-until): Extend to work in Assembler buffer
13 (gdb-append-to-inferior-io): Select IO buffer when there is 36 (gdb-append-to-inferior-io): Select IO buffer when there is output.
14 output.
15 (gdb-assembler-custom): Try to get line marker (arrow) to display 37 (gdb-assembler-custom): Try to get line marker (arrow) to display
16 in window. Correct parsing for OS dependent output syntax of Gdb 38 in window. Correct parsing for OS dependent output syntax of Gdb
17 command, where. 39 command, where.
18 (gdb-frame-handler): Correct parsing for OS dependent output 40 (gdb-frame-handler): Correct parsing for OS dependent output
19 syntax of Gdb command, frame. 41 syntax of Gdb command, frame.
diff --git a/lisp/which-func.el b/lisp/which-func.el
index 7b178ab25ea..57e9463f444 100644
--- a/lisp/which-func.el
+++ b/lisp/which-func.el
@@ -1,6 +1,6 @@
1;;; which-func.el --- print current function in mode line 1;;; which-func.el --- print current function in mode line
2 2
3;; Copyright (C) 1994, 1997, 1998, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1997, 1998, 2001, 2003 Free Software Foundation, Inc.
4 4
5;; Author: Alex Rezinsky <alexr@msil.sps.mot.com> 5;; Author: Alex Rezinsky <alexr@msil.sps.mot.com>
6;; (doesn't seem to be responsive any more) 6;; (doesn't seem to be responsive any more)
@@ -103,6 +103,7 @@ Zero means compute the Imenu menu regardless of size."
103 "Format for displaying the function in the mode line." 103 "Format for displaying the function in the mode line."
104 :group 'which-func 104 :group 'which-func
105 :type 'sexp) 105 :type 'sexp)
106(put 'which-func-format 'risky-local-variable t)
106 107
107(defvar which-func-cleanup-function nil 108(defvar which-func-cleanup-function nil
108 "Function to transform a string before displaying it in the mode line. 109 "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
120;;; 121;;;
121(require 'imenu) 122(require 'imenu)
122 123
123(defvar which-func-current which-func-unknown) 124(defvar which-func-table (make-hash-table :test 'eq :weakness 'key))
124(defvar which-func-previous which-func-unknown) 125
125(make-variable-buffer-local 'which-func-current) 126(defconst which-func-current
126(make-variable-buffer-local 'which-func-previous) 127 '(:eval (gethash (selected-window) which-func-table which-func-unknown)))
128(put 'which-func-current 'risky-local-variable t)
127 129
128(defvar which-func-mode nil 130(defvar which-func-mode nil
129 "Non-nil means display current function name in mode line. 131 "Non-nil means display current function name in mode line.
@@ -153,21 +155,19 @@ It creates the Imenu index for the buffer, if necessary."
153 (setq which-func-mode nil)))) 155 (setq which-func-mode nil))))
154 156
155(defun which-func-update () 157(defun which-func-update ()
156 "Update the Which-Function mode display for all windows." 158 ;; "Update the Which-Function mode display for all windows."
157 (walk-windows 'which-func-update-1 nil 'visible)) 159 ;; (walk-windows 'which-func-update-1 nil 'visible))
160 (which-func-update-1 (selected-window)))
158 161
159(defun which-func-update-1 (window) 162(defun which-func-update-1 (window)
160 "Update the Which-Function mode display for window WINDOW." 163 "Update the Which-Function mode display for window WINDOW."
161 (save-selected-window 164 (with-selected-window window
162 (select-window window)
163 ;; Update the string containing the current function.
164 (when which-func-mode 165 (when which-func-mode
165 (condition-case info 166 (condition-case info
166 (progn 167 (let ((current (which-function)))
167 (setq which-func-current (or (which-function) which-func-unknown)) 168 (unless (equal current (gethash window which-func-table))
168 (unless (string= which-func-current which-func-previous) 169 (puthash window current which-func-table)
169 (force-mode-line-update) 170 (force-mode-line-update)))
170 (setq which-func-previous which-func-current)))
171 (error 171 (error
172 (which-func-mode -1) 172 (which-func-mode -1)
173 (error "Error in which-func-update: %s" info)))))) 173 (error "Error in which-func-update: %s" info))))))