From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Changing Color Of Column # In Modeline Date: Wed, 23 Nov 2005 22:21:33 -0800 Message-ID: References: <1132791604.697417.9830@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1132813621 20494 80.91.229.2 (24 Nov 2005 06:27:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 24 Nov 2005 06:27:01 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 24 07:26:48 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EfAUX-00079a-RU for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Nov 2005 07:21:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EfAUW-0001iQ-1e for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Nov 2005 01:21:56 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EfAUF-0001iA-B5 for help-gnu-emacs@gnu.org; Thu, 24 Nov 2005 01:21:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EfAUE-0001hy-MU for help-gnu-emacs@gnu.org; Thu, 24 Nov 2005 01:21:39 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EfAUE-0001hv-Hs for help-gnu-emacs@gnu.org; Thu, 24 Nov 2005 01:21:38 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EfAUE-0007si-Dg for help-gnu-emacs@gnu.org; Thu, 24 Nov 2005 01:21:38 -0500 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.186.50]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jAO6ZklG010384; Thu, 24 Nov 2005 00:35:46 -0600 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id jAO6LamH032558; Wed, 23 Nov 2005 23:21:36 -0700 Original-Received: from dradamslap (dhcp-amer-whq-csvpn-gw3-141-144-80-145.vpn.oracle.com [141.144.80.145]) by rgmsgw301.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id jAO6LZP2032551 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Wed, 23 Nov 2005 23:21:36 -0700 Original-To: "gamename" , X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <1132791604.697417.9830@g49g2000cwa.googlegroups.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:31316 Archived-At: I was having similar problems. I'm using v21 as well. But how do you use what you're proposing? I added it to my init file, then evaluated, then toggled my major-mode (tcl-mode in this case). Nothing happened. What am I missing? The code I sent, like the code that MJF sent, requires Emacs 22, because it uses variable `mode-line-position'. What I said wrt Emacs 21 was that you could do something similar in Emacs 21, using variable `mode-line-format' instead of `mode-line-position'. The following works in Emacs 21. I just took the default value for `mode-line-format' (defined in bindings.el), wrapped it in (:eval...), and added the conditional face expression for `column-number-mode'. (defcustom my-column-limit 70 "When current column is > this, column is highlighted in mode-line." :type 'integer :group 'convenience) (setq mode-line-format '(:eval (let* ((help-echo "mouse-1: select window, mouse-2: \ delete others, mouse-3: delete ...") (dashes (propertize "--" 'help-echo help-echo))) (list (propertize "-" 'help-echo help-echo) 'mode-line-mule-info 'mode-line-modified 'mode-line-frame-identification 'mode-line-buffer-identification (propertize " " 'help-echo help-echo) 'global-mode-string (propertize " %[(" 'help-echo help-echo) '(:eval (mode-line-mode-name)) 'mode-line-process 'minor-mode-alist (propertize "%n" 'help-echo "mouse-2: widen" 'local-map (make-mode-line-mouse-map 'mouse-2 #'mode-line-widen)) (propertize ")%]--" 'help-echo help-echo) `(which-func-mode ("" which-func-format ,dashes)) `(line-number-mode (,(propertize "L%l" 'help-echo help-echo) ,dashes)) `(column-number-mode (,(propertize "C%c" 'face (and (> (current-column) 50) 'bold) 'help-echo help-echo) ,dashes)) `(-3 . ,(propertize "%p" 'help-echo help-echo)) (propertize "-%-" 'help-echo help-echo))))) Note: You could, alternatively, put the (:eval ...) around only the column-number-mode stuff, but then you would also need to substitute the values for `help-echo' and `dashes' (because they would be quoted inside the '(:eval ...), so they wouldn't pick up the values from the `let'). IOW, you could remove the (:eval ...) from around the `let' above, and do this in place of the (column-number-mode...) stuff: '(:eval `(column-number-mode (,(propertize "C%c" 'face (and (> (current-column) 50) 'bold) 'help-echo "mouse-1: select window,....") ,(propertize "--" 'help-echo "mouse-1: select window,...")))) That's maybe (maybe not) a bit more understandable, if a bit redundant. If you don't care about the `help-echo' strings, then that becomes much simpler: '(:eval `(column-number-mode (,(propertize "C%c" 'face (and (> (current-column) 50) 'bold)) "--"))) And don't forget to turn on `column-number-mode': (column-number-mode 1) ;-). HTH. - Drew