From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: Style in elisp: how to show a flag value in the modeline? Date: Thu, 20 Feb 2003 13:48:59 +0100 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <87of579t70.fsf@noos.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1045745661 23491 80.91.224.249 (20 Feb 2003 12:54:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 20 Feb 2003 12:54:21 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18lqDS-00066V-00 for ; Thu, 20 Feb 2003 13:54:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18lq9a-0002xJ-09 for gnu-help-gnu-emacs@m.gmane.org; Thu, 20 Feb 2003 07:50:18 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!proxad.net!skynet.be!skynet.be!fu-berlin.de!uni-berlin.de!dialin-145-254-192-250.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: dialin-145-254-192-250.arcor-ip.net (145.254.192.250) Original-X-Trace: fu-berlin.de 1045745350 52040853 145.254.192.250 (16 [87814]) X-Operating-System: GNU/Linux, built from scratch: http://www.linuxfromscratch.org/ X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6;Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-msvc-nt5.1.2600) Cancel-Lock: sha1:7aMq9fg5l2DI+2/jdUu7+zGjm/g= Original-Xref: shelby.stanford.edu gnu.emacs.help:110428 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6930 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6930 francois.fleuret@noos.fr (François Fleuret) writes: > Hi, > > What is the good way to show in the modeline the value of a boolean of > a flag associated to a major-mode ? The current solution I came with > is to change the value of `mode-name'. But I have the feeling that > should be done another way. Any advice ? Hmm, how about: (defvar my-flag t) (setq mode-line-format (copy-sequence mode-line-format)) (setcdr (nthcdr 4 mode-line-format) (cons '(:eval (if my-flag " True" " False")) (nthcdr 5 mode-line-format))) It seems like an odd way to modify the mode-line, but I can't think of any better right now. Oliver -- 2 Ventôse an 211 de la Révolution Liberté, Egalité, Fraternité!