changeset 56442:e8032355ca23

(which-func-keymap): New var. (which-func-face): New face. (which-func-format): Use them.
author Daniel Pfeiffer <occitan@esperanto.org>
date Sat, 17 Jul 2004 08:08:57 +0000
parents 99304c916e62
children 2b402c8ba024
files lisp/progmodes/which-func.el
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/progmodes/which-func.el	Fri Jul 16 18:55:01 2004 +0000
+++ b/lisp/progmodes/which-func.el	Sat Jul 17 08:08:57 2004 +0000
@@ -99,7 +99,33 @@
   :group 'which-func
   :type 'integer)
 
-(defcustom which-func-format '("[" which-func-current "]")
+(defvar which-func-keymap
+  (let ((map (make-sparse-keymap)))
+    (define-key map [mode-line mouse-1] 'beginning-of-defun)
+    (define-key map [mode-line mouse-2]
+      (lambda ()
+	(interactive)
+	(if (eq (point-min) 1)
+	    (narrow-to-defun)
+	  (widen))))
+    (define-key map [mode-line mouse-3] 'end-of-defun)
+    map)
+  "Keymap to display on mode line which-func.")
+
+(defface which-func-face
+  '((t (:inherit font-lock-function-name-face)))
+  "Face used to highlight mode line function names.
+Defaults to `font-lock-function-name-face' if font-lock is loaded."
+  :group 'which-func)
+
+(defcustom which-func-format
+  `("["
+    (:propertize which-func-current
+		 local-map ,which-func-keymap
+		 face which-func-face
+		 ;;mouse-face highlight	; currently not evaluated :-(
+		 help-echo "mouse-1: go to beginning, mouse-2: toggle rest visibility, mouse-3: go to end")
+    "]")
   "Format for displaying the function in the mode line."
   :group 'which-func
   :type 'sexp)