From unknown Sun Jun 22 17:11:08 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#14694 <14694@debbugs.gnu.org> To: bug#14694 <14694@debbugs.gnu.org> Subject: Status: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct Reply-To: bug#14694 <14694@debbugs.gnu.org> Date: Mon, 23 Jun 2025 00:11:08 +0000 retitle 14694 24.3; format-mode-line failing with :eval form via a variable= in a conditional construct reassign 14694 emacs submitter 14694 Phil Sainty severity 14694 normal tag 14694 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 01:12:39 2013 Received: (at submit) by debbugs.gnu.org; 23 Jun 2013 05:12:39 +0000 Received: from localhost ([127.0.0.1]:35699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqcbO-0003SH-Cr for submit@debbugs.gnu.org; Sun, 23 Jun 2013 01:12:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45259) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqcbJ-0003Rz-Mg for submit@debbugs.gnu.org; Sun, 23 Jun 2013 01:12:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqcbD-000717-8H for submit@debbugs.gnu.org; Sun, 23 Jun 2013 01:12:28 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-99.2 required=5.0 tests=BAYES_50,FREEMAIL_FROM, USER_IN_WHITELIST autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqcbD-000713-4u for submit@debbugs.gnu.org; Sun, 23 Jun 2013 01:12:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqcbB-0006vB-KX for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2013 01:12:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqcbA-00070a-BT for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2013 01:12:25 -0400 Received: from nctlincom01.orcon.net.nz ([60.234.4.69]:47557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uqcb9-0006zO-Qp for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2013 01:12:24 -0400 Received: from mx5.orcon.net.nz (mx5.orcon.net.nz [219.88.242.55]) by nctlincom01.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5N5QJgg019499 for ; Sun, 23 Jun 2013 17:26:19 +1200 Received: from Debian-exim by mx5.orcon.net.nz with local (Exim 4.69) (envelope-from ) id 1Uqcaz-0000xV-BQ for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2013 17:12:13 +1200 Received: from [121.99.89.166] (helo=[10.1.1.3]) by mx5.orcon.net.nz with esmtpa (Exim 4.69) (envelope-from ) id 1Uqcaz-0000xN-3b for bug-gnu-emacs@gnu.org; Sun, 23 Jun 2013 17:12:13 +1200 Message-ID: <51C6839D.9070909@orcon.net.nz> Date: Sun, 23 Jun 2013 17:11:57 +1200 From: Phil Sainty User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DSPAM-Check: by mx5.orcon.net.nz on Sun, 23 Jun 2013 17:12:13 +1200 X-DSPAM-Result: Innocent X-DSPAM-Processed: Sun Jun 23 17:12:13 2013 X-DSPAM-Confidence: 0.5161 X-DSPAM-Probability: 0.0000 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, default) X-CanIt-Geo: ip=121.99.89.166; country=NZ; region=E7; city=Auckland; latitude=-36.8667; longitude=174.7667; http://maps.google.com/maps?q=-36.8667,174.7667&z=6 X-CanItPRO-Stream: base:default X-Canit-Stats-ID: 06JPFqjuA - aa02f29d14d0 - 20130623 X-Scanned-By: CanIt (www . roaringpenguin . com) on 172.16.100.174 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) From emacs -Q the following returns an empty string, which seems like a bug: ELISP> (setq indirect-eval '(:eval "indirect eval")) ELISP> (format-mode-line '(t indirect-eval "else")) "" Other tests have worked as expected: ELISP> (format-mode-line '(t "then" "else")) "then" ELISP> (setq indirect-string "indirect string") ELISP> (format-mode-line '(t indirect-string "else")) "indirect string" ELISP> (format-mode-line '(:eval "direct eval")) "direct eval" ELISP> (format-mode-line '(t (:eval "direct eval") "else")) "direct eval" ELISP> (setq indirect-eval '(:eval "indirect eval")) ELISP> (format-mode-line indirect-eval) "indirect eval" It just seems to be the combination of the (:eval) form as the value of a variable in a conditional form which is failing. And a related question, if I may: Other than wrapping advice around format-mode-line to let-bind a variable, is there any way for me to ascertain whether a mode line construct is being processed for an actual mode line redraw (in which case format-mode-line is not called), as opposed to some other situation (e.g. describe-mode) in which format-mode-line will be used? My goal is to use the conditional construct to display the original value when calling format-mode-line, but an alternative value in the mode line itself, with the two values being stored in buffer local variables. At the moment I'm using advice to supply the condition (and of course I found the above bug when testing that my code worked for the different types of construct). thanks, -Phil In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2013-06-23 on xerxes Windowing system distributor `The X.Org Foundation', version 11.0.11300000 System Description: Ubuntu 12.04.2 LTS Important settings: value of $LANG: en_NZ.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r t - e m a Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. user-error: Beginning of history; no preceding item Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 11:26:49 2013 Received: (at 14694) by debbugs.gnu.org; 23 Jun 2013 15:26:49 +0000 Received: from localhost ([127.0.0.1]:36525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqmBk-0004kX-MP for submit@debbugs.gnu.org; Sun, 23 Jun 2013 11:26:49 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:36585) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqmBh-0004kF-5l for 14694@debbugs.gnu.org; Sun, 23 Jun 2013 11:26:46 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MOU00B00QRMOO00@a-mtaout23.012.net.il> for 14694@debbugs.gnu.org; Sun, 23 Jun 2013 18:26:37 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MOU00BNKQW7NL30@a-mtaout23.012.net.il>; Sun, 23 Jun 2013 18:26:32 +0300 (IDT) Date: Sun, 23 Jun 2013 18:26:31 +0300 From: Eli Zaretskii Subject: Re: bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct In-reply-to: <51C6839D.9070909@orcon.net.nz> X-012-Sender: halo1@inter.net.il To: Phil Sainty Message-id: <83bo6wlufs.fsf@gnu.org> References: <51C6839D.9070909@orcon.net.nz> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 14694 Cc: 14694@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Sun, 23 Jun 2013 17:11:57 +1200 > From: Phil Sainty > > From emacs -Q the following returns an empty string, which seems > like a bug: > > ELISP> (setq indirect-eval '(:eval "indirect eval")) > ELISP> (format-mode-line '(t indirect-eval "else")) > "" It's not a bug. The Lisp expressions supported in mode-line format are those documented in the manual, and nothing else. In particular, the ':eval' part must appear explicitly, and any symbol stands for its value (which is not eval'ed). IOW, you seem to expect a full-blown Lisp evaluation there, but that was never implemented or intended. > And a related question, if I may: Other than wrapping advice around > format-mode-line to let-bind a variable, is there any way for me to > ascertain whether a mode line construct is being processed for an > actual mode line redraw (in which case format-mode-line is not called), > as opposed to some other situation (e.g. describe-mode) in which > format-mode-line will be used? > > My goal is to use the conditional construct to display the original > value when calling format-mode-line, but an alternative value in the > mode line itself, with the two values being stored in buffer local > variables. At the moment I'm using advice to supply the condition > (and of course I found the above bug when testing that my code worked > for the different types of construct). I don't understand: format-mode-line is a function you cannot change or hook, so where exactly do you want to display a different value? Both format-mode-line and the internal code that processes the mode line format in the display engine access the same variable. And anyway, why would you need format-mode-line to produce a different value? From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 12:45:55 2013 Received: (at 14694) by debbugs.gnu.org; 23 Jun 2013 16:45:55 +0000 Received: from localhost ([127.0.0.1]:36657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqnQG-0006z6-Jr for submit@debbugs.gnu.org; Sun, 23 Jun 2013 12:45:53 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:7657) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqnQD-0006yd-Cq for 14694@debbugs.gnu.org; Sun, 23 Jun 2013 12:45:50 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYHCxQYDSSIJMEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFMCppA/2dsb2JhbABEvw4Xc4IfAQVWIxALDiYHCxQYDSSIJMEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="16990795" Received: from 76-10-154-64.dsl.teksavvy.com (HELO pastel.home) ([76.10.154.64]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Jun 2013 12:45:38 -0400 Received: by pastel.home (Postfix, from userid 20848) id DC85C6336B; Sun, 23 Jun 2013 12:45:42 -0400 (EDT) From: Stefan Monnier To: Phil Sainty Subject: Re: bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct Message-ID: References: <51C6839D.9070909@orcon.net.nz> Date: Sun, 23 Jun 2013 12:45:42 -0400 In-Reply-To: <51C6839D.9070909@orcon.net.nz> (Phil Sainty's message of "Sun, 23 Jun 2013 17:11:57 +1200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 14694 Cc: 14694@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) ELISP> (setq indirect-eval '(:eval "indirect eval")) ELISP> (format-mode-line '(t indirect-eval "else")) > "" You need (put 'indirect-eval 'risky-local-variable t) Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 13:48:51 2013 Received: (at 14694) by debbugs.gnu.org; 23 Jun 2013 17:48:51 +0000 Received: from localhost ([127.0.0.1]:36787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqoPC-0000Jc-O8 for submit@debbugs.gnu.org; Sun, 23 Jun 2013 13:48:51 -0400 Received: from nctlincom02.orcon.net.nz ([60.234.4.76]:50202) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UqoP9-0000JQ-DI for 14694@debbugs.gnu.org; Sun, 23 Jun 2013 13:48:48 -0400 Received: from mx5.orcon.net.nz (mx5.orcon.net.nz [219.88.242.55]) by nctlincom02.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id r5NHmh9v030237 for <14694@debbugs.gnu.org>; Mon, 24 Jun 2013 05:48:43 +1200 Received: from Debian-exim by mx5.orcon.net.nz with local (Exim 4.69) (envelope-from ) id 1UqoP5-0002u6-6V for 14694@debbugs.gnu.org; Mon, 24 Jun 2013 05:48:43 +1200 Received: from [121.99.89.166] (helo=[10.1.1.3]) by mx5.orcon.net.nz with esmtpa (Exim 4.69) (envelope-from ) id 1UqoP4-0002tN-T8; Mon, 24 Jun 2013 05:48:42 +1200 Message-ID: <51C734E7.5010303@orcon.net.nz> Date: Mon, 24 Jun 2013 05:48:23 +1200 From: Phil Sainty User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Stefan Monnier Subject: Re: bug#14694: 24.3; format-mode-line failing with :eval form via a variable in a conditional construct References: <51C6839D.9070909@orcon.net.nz> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DSPAM-Check: by mx5.orcon.net.nz on Mon, 24 Jun 2013 05:48:43 +1200 X-DSPAM-Result: Innocent X-DSPAM-Processed: Mon Jun 24 05:48:43 2013 X-DSPAM-Confidence: 0.5470 X-DSPAM-Probability: 0.0016 X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, default) X-Spam-Score: -3.00 () [Hold at 4.00] CC(NZ:-3) X-CanIt-Geo: ip=121.99.89.166; country=NZ; region=E7; city=Auckland; latitude=-36.8667; longitude=174.7667; http://maps.google.com/maps?q=-36.8667,174.7667&z=6 X-CanItPRO-Stream: base:default X-Canit-Stats-ID: 05JPRMHG1 - aa2b1365dbd5 - 20130624 X-Scanned-By: CanIt (www . roaringpenguin . com) on 172.16.100.175 X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 14694 Cc: 14694@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) On 24/06/2013 04:45, Stefan Monnier wrote: > ELISP> (setq indirect-eval '(:eval "indirect eval")) > ELISP> (format-mode-line '(t indirect-eval "else")) >> "" > > You need (put 'indirect-eval 'risky-local-variable t) Argh, I see that in the documentation now. Thank you Stefan (and Eli). I'm afraid I made an embarrassing rookie mistake in checking the result of (format-mode-line indirect-eval) instead of (format-mode-line 'indirect-eval), and thinking that I was seeing an inconsistency when there was none. Otherwise I'd no doubt have spotted the information about that property. My apologies; please close. Eli asked: > And anyway, why would you need format-mode-line to produce a > different value? The specific goal was to enable customisation of the display of `mode-name' in the mode line (generally to abbreviate it and reduce the space used) *without* also affecting what is displayed when that variable is processed in other contexts (such as by `describe-mode'), in which cases `format-mode-line' will be called. Advising `format-mode-line' to provide an indicator variable to use in a conditional construct does facilitate this. I just wanted check that I wasn't missing another approach which didn't require the advice. -Phil From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 23 14:33:33 2013 Received: (at control) by debbugs.gnu.org; 23 Jun 2013 18:33:34 +0000 Received: from localhost ([127.0.0.1]:36856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uqp6T-0001av-I2 for submit@debbugs.gnu.org; Sun, 23 Jun 2013 14:33:33 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:53652 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uqp6Q-0001ac-MX for control@debbugs.gnu.org; Sun, 23 Jun 2013 14:33:31 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Uqp6P-0008D2-V1 for control@debbugs.gnu.org; Sun, 23 Jun 2013 14:33:30 -0400 Date: Sun, 23 Jun 2013 14:33:29 -0400 Message-Id: Subject: control message for bug 14694 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.1 (------) tag 14694 notabug close 14694 From unknown Sun Jun 22 17:11:08 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 22 Jul 2013 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator