emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs 26.1 release branch created


From: Paul Eggert
Subject: Re: Emacs 26.1 release branch created
Date: Mon, 25 Sep 2017 15:25:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 09/25/2017 01:24 PM, John Wiegley wrote:
Why not mention both ways of resolving the matter in the documentation?
(message "%s") for all the simple cases (which should be most of them), and
let-binding text-quoting-style for the complex cases.

Because the complex cases are where the let-binding style falls down. For example, this plausible-looking code:

   (let ((text-quoting-style 'grave))
     (message "(setq coding-system '%S)"
              (find-operation-coding-system 'write-region "x")))

is incorrect, because it changes the quoting style not just for the message, but also for the internals of find-operation-coding-system, internals that are unrelated to the message and which will behave contrary to user preference. In contrast, this:

  (message "%s" (format "(setq coding-system '%S)"
                        (find-operation-coding-system 'write-region "x")))

limits the style override to just the format, which is what is typically wanted for messages.As the size of the 'let' increases, this sort of error becomes more likely.

The let-binding approach is appropriate only for simple cases where you know all the code that will be executed inside the 'let', and know that you want to override user preference for all of the code. It is inflexible and error-prone compared to the easier-to-use '(message "%s" ...)' style that Emacs has used for decades.This is not a close call: we should document what has worked rather than try to promote an experimental alternative that has no significant technical advantages.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]