From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Nick Roberts Newsgroups: gmane.emacs.devel Subject: format-mode-line and mode-line mouse events Date: Sat, 18 Dec 2004 21:20:58 +1300 Message-ID: <16835.59498.223861.172917@farnswood.snap.net.nz> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1103358549 1860 80.91.229.6 (18 Dec 2004 08:29:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 18 Dec 2004 08:29:09 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 18 09:29:04 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CfZxX-0004jm-00 for ; Sat, 18 Dec 2004 09:29:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cfa7s-0006Oj-Q8 for ged-emacs-devel@m.gmane.org; Sat, 18 Dec 2004 03:39:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Cfa7h-0006MX-F4 for emacs-devel@gnu.org; Sat, 18 Dec 2004 03:39:33 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Cfa7f-0006L0-0Y for emacs-devel@gnu.org; Sat, 18 Dec 2004 03:39:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cfa7e-0006KX-Rf for emacs-devel@gnu.org; Sat, 18 Dec 2004 03:39:30 -0500 Original-Received: from [202.37.101.8] (helo=viper.snap.net.nz) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CfZwB-0007rx-Ow for emacs-devel@gnu.org; Sat, 18 Dec 2004 03:27:40 -0500 Original-Received: from farnswood.snap.net.nz (p45-tnt1.snap.net.nz [202.124.110.45]) by viper.snap.net.nz (Postfix) with ESMTP id 3E978EDBDA for ; Sat, 18 Dec 2004 21:27:38 +1300 (NZDT) Original-Received: by farnswood.snap.net.nz (Postfix, from userid 501) id B8333628AD; Sat, 18 Dec 2004 08:20:58 +0000 (GMT) Original-To: emacs-devel@gnu.org X-Mailer: VM 6.97 under Emacs 21.2.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:31253 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31253 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