From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: How to analyze the value of `mode-line-misc-info'? Date: Tue, 15 Feb 2022 17:45:56 +0700 Message-ID: References: <878rudmm7g.fsf@laposte.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3788"; mail-complaints-to="usenet@ciao.gmane.io" To: Kevin Vigouroux , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 15 11:54:16 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJvTL-0000oI-Pl for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 11:54:15 +0100 Original-Received: from localhost ([::1]:47342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJvTK-0007ZY-Be for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 15 Feb 2022 05:54:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJvSX-0007SS-HM for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 05:53:25 -0500 Original-Received: from [2607:f8b0:4864:20::e31] (port=45919 helo=mail-vs1-xe31.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJvSV-0005CF-QH for help-gnu-emacs@gnu.org; Tue, 15 Feb 2022 05:53:25 -0500 Original-Received: by mail-vs1-xe31.google.com with SMTP id e5so4638403vsg.12 for ; Tue, 15 Feb 2022 02:53:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=GrXRLWEgo4aDIKAclsZpPXW97IAfaQWvvcmgH14Yp3c=; b=UynRS4mG6D/F250lfeFqZEvR379hACfetp+kU/hil0pFhh9YZgu3HdS3PkQ5oSTqJG aW8x2QeVtLCVJy5o7VELzFxjheY6FBQXbNBVWlPq7t2ZWgTP1fi2Bru+lHSIC9w1cNYt dNevNvEMRd8N89TBiTOwvFCpECDFAuU5TfIl69hN7cgbClIkpMnofmpuOmrFVie3l+UZ zhJ90vbUC74iRdj/giMX/ObjvYAA0qROW8mIS3sq5lp3ZNzOtkk+f7zno1dkFIZctttI vCBMPji7lB+rgYA1EvJhdeANqUSfpKuKvCNmq7u1lsyB4RT29umahflFopkLyAd5+iLh NMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=GrXRLWEgo4aDIKAclsZpPXW97IAfaQWvvcmgH14Yp3c=; b=lM1QOi16lt0TnvxidGL+bxw+B1h364NsM66mRKAPhSb+gk6m3rxOF/FRgpNwLitNUQ cIhUSLB9almuVa0cWk9CK/uBzpJgBnZEWlX/Cx/CnH7uWFUx7R/7e4fOLDe+SJLotiFz ROogyzdj48MQvfjUtVRjD1gtufvcJbJ23hcRAXFy0YFVpXVW/6o9t5EsprYdSvI0FhOY 92yJMdFvIS0XuzsHaQBE5pyz5ikWXMEinqYEzyQDnq1H21vaO/H52oAU7Cn2Zh3UjZfl aYtqz8kFyWCUHUKstECFY/tiGJ3pJCCf3gj3JIIGYiNMa4Hr4NOksccd0sYEi4ieeaCj DiCg== X-Gm-Message-State: AOAM530WrtecdFoUJWyAX1U7kqdrJwLY7e8uT6qlf7/sQjWKyun4HiH5 daVAckRCPLZ/+YtfPnNISB3tzjsoMJ8TfrL0vWWtkFK7HGCcFA== X-Google-Smtp-Source: ABdhPJyZ+b9uVTP6mYk2jo/J4JwGNPSdTXDNLS8uT/Cu36zgR1/Jkl4/KJy3CYk/uUJ79Om1+izgkd0dp2AWMG4dBfc= X-Received: by 2002:a67:c396:: with SMTP id s22mr1146147vsj.46.1644921967985; Tue, 15 Feb 2022 02:46:07 -0800 (PST) In-Reply-To: <878rudmm7g.fsf@laposte.net> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::e31 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::e31; envelope-from=yurivkhan@gmail.com; helo=mail-vs1-xe31.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.904, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135960 Archived-At: On Mon, 14 Feb 2022 at 23:46, Kevin Vigouroux via Users list for the GNU Emacs text editor wrote: > > #+begin_src emacs-lisp > ELISP> mode-line-misc-info > ((global-mode-string > ("" global-mode-string " "))) > #+end_src > > I don=E2=80=99t understand why there are two nested lists. I thought the = second > list was used as a conditional statement (e.g. `global-mode-string' > returns non-`nil') to finally concatenate several strings. > > =E2=80=A2 Emacs Lisp Ref. manual =E2=80=94 23.4.2 =E2=80=9CThe Data Struc= ture of the Mode Line=E2=80=9D > - https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Dat= a.html Let=E2=80=99s apply the documented behavior to the data structure you have. > ((global-mode-string > ("" global-mode-string " "))) This is a list and its first (and only) element is a list, so we process it recursively and concatenate the only result. > (global-mode-string > ("" global-mode-string " ")) This is a list whose first element is a symbol, so it=E2=80=99s a condition= al. We take the value of =E2=80=98global-mode-string=E2=80=99 as a variable. If= it=E2=80=99s nil, the result is nil; if non-nil, we interpret the =E2=80=98then=E2=80=99 part= : > ("" global-mode-string " ") This is a list whose first element is an empty string, so we concatenate the results of processing each element. As for your question: > I don=E2=80=99t understand why there are two nested lists. Probably so that modes could plug their own mode line constructs into the outer list. For me, =E2=80=98mode-line-misc-info=E2=80=99 has this valu= e: ((which-function-mode (which-func-mode (#1=3D"" which-func-format " "))) (global-mode-string (#1# global-mode-string " "))) so, two independent conditionals, whose results are to be concatenated. (The first conditional has another conditional inside it, so the display in fact depends on non-nilness of two variables.)