From: Christopher Dimech <dimech@gmx.com>
To: Heime <heimeborgia@protonmail.com>
Cc: Manuel Giraud <manuel@ledu-giraud.fr>,
Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: backquote upon variable for :eval
Date: Sun, 28 Jul 2024 23:04:40 +0200 [thread overview]
Message-ID: <trinity-2c555b52-73ea-4b10-b486-d06ca3bb1861-1722200680592@3c-app-mailcom-bs05> (raw)
In-Reply-To: <y_575rKuqKl4vpvyW3YiWXCoCHZqVx4usGUyjKAI4eeucw8qKyjair2r1q5rqBMk0oH6BGdxfWTts76UpbAlnjjuOMJAAie-5m5TeYpAW1w=@protonmail.com>
> Sent: Monday, July 29, 2024 at 8:44 AM
> From: "Heime" <heimeborgia@protonmail.com>
> To: "Manuel Giraud" <manuel@ledu-giraud.fr>
> Cc: "Heime via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> Subject: Re: backquote upon variable for :eval
>
>
>
>
>
>
> Sent with Proton Mail secure email.
>
> On Monday, July 29th, 2024 at 8:24 AM, Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> > Heime heimeborgia@protonmail.com writes:
> >
> > > I am using the backquote, but I get errors when using ,tknm
> > >
> > > How can this be fixed ? Perhaps I got to arrange the code in a
> > > different way ?
> >
> >
> > Yes I think that you should re-arrange and re-read "(elisp) Backquote"
> > and maybe "(elisp) Evaluation" too.
> >
> > [...]
> >
> > > (defun vodil-bfnap (wmax &optional actn)
> > >
> > > (setq-default mode-line-buffer-identification
> > > `(:eval
> > > (let* ( (bfnm (buffer-name (window-buffer)))
> > > (tknm (if (> (length bfnm) wmax)
> > > (vodil-ellipses bfnm wmax actn)
> > > bfnm)) )
> > > (propertized-buffer-identification (format " %s " ,tknm))))))
> >
> >
> > What could contain an evaluation of tknm here?
> > --
> > Manuel Giraud
>
> Have done this, but although it works, the buffer name is always *scratch*
>
> (defun vodil-bfnap (wmax &optional actm)
>
> (let* ( (bfnm (buffer-name (window-buffer)))
> (tknm (if (> (length bfnm) wmax)
> (vodil-ellipses bfnm wmax actm)
> bfnm)))
> (setq-default mode-line-buffer-identification
> `(:eval (propertized-buffer-identification (format " %s " ,tknm))))))
In your function, the values of wmax and actm need to be evaluated because they are
external variables passed as arguments. The other variables (bfnm and tknm) are local
to the let* block and do not require special handling with the backquote-comma syntax
for evaluation.
(defun vodil-bfnap (wmax &optional actn)
(setq-default mode-line-buffer-identification
`(:eval
(let* ( (bfnm (buffer-name (window-buffer)))
(tknm (if (> (length bfnm) ,wmax)
(vodil-ellipses bfnm ,wmax ,actn)
bfnm)) )
(propertized-buffer-identification (format " %s " tknm))))))
prev parent reply other threads:[~2024-07-28 21:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-28 20:10 backquote upon variable for :eval Heime
2024-07-28 20:24 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 20:44 ` Heime
2024-07-28 21:04 ` Christopher Dimech [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-2c555b52-73ea-4b10-b486-d06ca3bb1861-1722200680592@3c-app-mailcom-bs05 \
--to=dimech@gmx.com \
--cc=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=manuel@ledu-giraud.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).