emacs-devel
[Top][All Lists]
Advanced

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

Re: prin1 / princ vs message ?


From: Jean-Christophe Helary
Subject: Re: prin1 / princ vs message ?
Date: Sun, 2 Jul 2017 23:02:09 +0900

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 <address@hidden> wrote:


On Jul 2, 2017, at 22:21, Tino Calancha <address@hidden> 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 


reply via email to

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