From: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
To: Emacs developers <emacs-devel@gnu.org>
Subject: Re: prin1 / princ vs message ?
Date: Sun, 2 Jul 2017 23:02:09 +0900 [thread overview]
Message-ID: <E1BFA99E-4E8C-4E09-A725-9C85CBB4729C@gmail.com> (raw)
In-Reply-To: <86E604C6-4A01-42D2-A3CD-D758FC5DD8B1@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]
Conclusion of that exchange (sorry for being a little slow to understand everything the 3 of you wrote):
This:
(prin1 name)
(princ " is ")
(princ (if (memq (aref status 0) '(?a ?e ?i ?o ?u)) "an " "a "))
(princ status)
(princ " package.\n\n")
Can reasonably be replaced by this:
(let (sentence (format "The status of package %1$S is `%2$s'.\n\n" name status)))
(princ sentence))
Is that correct ? (I am using the numbered fields that Philipp Stephani implemented in June.)
Jean-Christophe
> On Jul 2, 2017, at 22:47, Jean-Christophe Helary <jean.christophe.helary@gmail.com> wrote:
>
>
>> On Jul 2, 2017, at 22:21, Tino Calancha <tino.calancha@gmail.com <mailto:tino.calancha@gmail.com>> wrote:
>>
>>> Instead of using message to replace that code:
>>>
>>> (let ((name "JC"))
>>> (prin1 "My name ")
>>> (princ " is ")
>>> (princ name)
>>> (princ ".\n\n"))
>>>
>>> It would be better to use something like:
>>>
>>> (let ((sentence (format "My name is %s.\n\n)))
>>> (prin1 sentence))
>>>
>>> That way I keep the possibility to redirect the output somewhere else while making the sentence actually maintainable...
>> That's sounds pretty OK.
>> I would just modify a bit your example, because currenty doesn't work,
>> you get the error:
>> read-from-minibuffer: End of file during parsing
>
> Yes, I just realized that I had forgotten a lot of required stuff :) Sorry.
>
> As for Noam's question, the mixing is, I guess, intended but was not properly reflected in my example:
>
> (let ((name "JC"))
> (princ "My name ")
> (princ " is ")
> (prin1 name)
> (princ ".\n\n"))
>
>
> Jean-Christophe
[-- Attachment #2: Type: text/html, Size: 6590 bytes --]
next prev parent reply other threads:[~2017-07-02 14:02 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-02 10:12 prin1 / princ vs message ? Jean-Christophe Helary
2017-07-02 11:57 ` Tino Calancha
2017-07-02 12:21 ` Jean-Christophe Helary
2017-07-02 12:32 ` Andreas Schwab
2017-07-02 12:41 ` Jean-Christophe Helary
2017-07-02 12:44 ` Tino Calancha
2017-07-02 12:45 ` Noam Postavsky
2017-07-02 13:09 ` Jean-Christophe Helary
2017-07-02 13:17 ` Noam Postavsky
2017-07-02 13:21 ` Tino Calancha
2017-07-02 13:47 ` Jean-Christophe Helary
2017-07-02 14:02 ` Jean-Christophe Helary [this message]
2017-07-02 14:23 ` Tino Calancha
2017-07-02 14:26 ` Jean-Christophe Helary
2017-07-02 14:27 ` Philipp Stephani
2017-07-02 14:38 ` Jean-Christophe Helary
2017-07-02 14:30 ` (format "Hello %1$S%2$s" 'world "!") Clément Pit-Claudel
2017-07-02 14:39 ` Jean-Christophe Helary
2017-07-02 15:03 ` Noam Postavsky
2017-07-02 16:32 ` Clément Pit-Claudel
2017-07-02 16:54 ` Noam Postavsky
2017-07-02 17:25 ` Clément Pit-Claudel
2017-12-22 21:50 ` Philipp Stephani
2017-07-02 16:56 ` Vivek Dasmohapatra
2017-12-22 21:48 ` Philipp Stephani
2017-12-22 21:44 ` Philipp Stephani
2017-07-02 14:29 ` prin1 / princ vs message ? Stefan Monnier
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=E1BFA99E-4E8C-4E09-A725-9C85CBB4729C@gmail.com \
--to=jean.christophe.helary@gmail.com \
--cc=emacs-devel@gnu.org \
/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.