From: Jose A Ortega Ruiz <jao@gnu.org>
To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org
Subject: Re: [PATCH v4] emacs: customizable names for search buffers
Date: Thu, 13 Jan 2022 22:43:36 +0000 [thread overview]
Message-ID: <87h7a7uuhz.fsf@gnus.jao.io> (raw)
In-Reply-To: <m2h7a8yxu9.fsf@guru.guru-group.fi>
On Thu, Jan 13 2022, Tomi Ollila wrote:
[...]
> I am curious about this regexp, \b is matching word/non-word boundary -- so
> I had to test it.
>
> (replace-regexp-in-string "\\b%t\\b" "repl" "foo %t bar") ;; no replacement
> (replace-regexp-in-string "\\b%t\\b" "repl" "foo-%t-bar") ;; no replacement
> ...
> (replace-regexp-in-string "\\b%t\\b" "repl" "foox%t-bar") ;; replacement!
>
> before % there is "word" character and after t there is "non-word" character.
Ah, yes... i messed up, i think we want here
(replace-regexp-in-string "\\_<%t\\_>" "repl" "foo %t bar")
i.e. \_< .. \_> to correctly delimit beginning and end of word, not just
boundary (i always trip on this!).
> Also tried (format-spec "foo-%t-bar" '((?t . "repl"))) ;; which works as
> I'd expect.
yeah, that's what i use and didn't notice my error above. format-spec
is much nicer than a plain regexp subs, one can use format specifiers
like %3t and many others, but unfortunately seems to have been
introduced in emacs 27.
thanks for checking, and if you can confirm the above fix looks better,
i'll submit a new version.
cheers,
jao
--
A language that doesn't affect the way you think about programming, is
not worth knowing.
- Alan Perlis, Epigrams on Programming
next prev parent reply other threads:[~2022-01-13 22:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 18:16 [PATCH v4] emacs: customizable names for search buffers jao
2022-01-13 6:05 ` Tomi Ollila
2022-01-13 22:43 ` Jose A Ortega Ruiz [this message]
2022-01-14 0:57 ` Jose A Ortega Ruiz
2022-01-16 19:42 ` Tomi Ollila
2022-01-16 20:40 ` Jose A Ortega Ruiz
2022-01-16 20:34 ` Kyle Meyer
2022-01-16 22:25 ` Jose A Ortega Ruiz
2022-01-16 23:06 ` Kyle Meyer
2022-01-16 23:51 ` Jose A Ortega Ruiz
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://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7a7uuhz.fsf@gnus.jao.io \
--to=jao@gnu.org \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/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.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
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).