From: Stefan Monnier Date: Sat, 17 May 2003 22:21:36 +0000 (+0000) Subject: (which-func-format): Make it risky-local-variable. X-Git-Tag: ttn-vms-21-2-B4~10115 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6f25499a2a8ffcc5ff9951666c7f97a65dd24278;p=emacs.git (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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a43f048c400..af840feb1e1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,19 +1,41 @@ +2003-05-17 Stefan Monnier + + * 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 * 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. 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 @@ ;;; 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 ;; (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))))))