emacs-devel
[Top][All Lists]
Advanced

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

format-mode-line and mode-line mouse events


From: Nick Roberts
Subject: format-mode-line and mode-line mouse events
Date: Sat, 18 Dec 2004 21:20:58 +1300

I want to make mouse clicks on the mode-line work properly on a text terminal
(and xterm). Currently you can only drag or delete when you click anywhere on
the mode-line as before Emacs 21. I think all that is needed for the click
event is the the string (with properties) and the column number clicked on:

OBJECT
     This is the object on which the click occurred.  It is either
     `nil' if there is no string property, or it has the form (STRING .
     STRING-POS) when there is a string-type text property at the click
     position.

I think I should be able to get this with:

((format-mode-line) . COL)

but it only works on part of the mode-line.

mode-line-format is pretty complex and I think format-mode-line expands it
incorrectly:

(format-mode-line mode-line-buffer-identification)

correctly gives:

#("*scratch*   " 0 9 (face Buffer-menu-buffer-face help-echo "mouse-1: previous 
buffer, mouse-3: next buffer" local-map (keymap (header-line keymap ... ... ... 
...) (mode-line keymap ... ...))) 9 12 (face Buffer-menu-buffer-face help-echo 
"mouse-1: previous buffer, mouse-3: next buffer" local-map (keymap (header-line 
keymap ... ... ... ...) (mode-line keymap ... ...))))

but the part of (format-mode-line) due to mode-line-buffer-identification is:

#("-1:**  *scratch*      All L2      (Lisp Interaction)-----"... 7 16 (face 
(Buffer-menu-buffer-face mode-line)) ...)

The keymap has been lost and, as far as I know, 
(face (Buffer-menu-buffer-face mode-line)) means nothing.

Is that a bug? If so, can anyone see what is wrong with format-mode-line?

Should

(WINDOW mode-line (X . Y) TIMESTAMP
      ((format-mode-line) . COL) TEXT-POS (COL . ROW)
      IMAGE (DX . DY) (WIDTH . HEIGHT))

work as a click event on the mode-line?


Nick





reply via email to

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