all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 60454@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#60454: 30.0.50; `format-message' does not allow displaying "`" and "'" verbatim
Date: Sat, 31 Dec 2022 19:29:48 +0000	[thread overview]
Message-ID: <0a62cbaeff6a36ea26cd@heytings.org> (raw)
In-Reply-To: <87o7rj8pur.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]


>> Just let-bind text-quoting-style:
>>
>> (let ((text-quoting-style 'grave))
>>    (format-message "foo `bar' baz"))
>
> This won't work when I sometimes actually want the replacement to 
> happen:
>
> (format-message "This is variable `foo', and the code 'bar")
>

Indeed.  If you want both literal ` ' and interpreted ` ', until Stefan's 
suggestion is implemented, you can either use what Andreas suggested, or 
use a variant of format-message such as:

(defun format-message-alt (format &rest objects)
   "Format a string out of a format-string and arguments.

This acts like `format-message', which see, except that the grave
accent (\\=`) and apostrophe (\\=') can be escaped with `\\\\​=',
in which case they are not replaced by the left and right quote
replacement characters specified by `text-quoting-style'."
   (let* ((fq
 	  (replace-regexp-in-string
 	   "\\\\=`" "\uE001"
 	   (replace-regexp-in-string
 	    "\\\\='" "\uE000" format)))
 	 (fm (format-message fq objects))
 	 (fu
 	  (replace-regexp-in-string
 	   "\uE001" "`"
 	   (replace-regexp-in-string
 	    "\uE000" "'" fm))))
     fu))

  reply	other threads:[~2022-12-31 19:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-31 15:04 bug#60454: 30.0.50; `format-message' does not allow displaying "`" and "'" verbatim Ihor Radchenko
2022-12-31 15:41 ` Andreas Schwab
2022-12-31 16:39   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-31 15:42 ` Gregory Heytings
2022-12-31 17:06   ` Ihor Radchenko
2022-12-31 19:29     ` Gregory Heytings [this message]
2022-12-31 20:17       ` Gregory Heytings

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a62cbaeff6a36ea26cd@heytings.org \
    --to=gregory@heytings.org \
    --cc=60454@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@posteo.net \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.