[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Toggle appointment notification
From: |
Christopher Dimech |
Subject: |
Re: Toggle appointment notification |
Date: |
Wed, 2 Dec 2020 15:10:28 +0100 |
> Sent: Wednesday, December 02, 2020 at 2:52 PM
> From: tomas@tuxteam.de
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Toggle appointment notification
>
> On Wed, Dec 02, 2020 at 02:15:20PM +0100, Christopher Dimech wrote:
> > > Sent: Wednesday, December 02, 2020 at 1:37 PM
> > > From: tomas@tuxteam.de
> > > To: "Christopher Dimech" <dimech@gmx.com>
> > > Cc: help-gnu-emacs@gnu.org
> > > Subject: Re: Toggle appointment notification
> > >
> > > On Wed, Dec 02, 2020 at 01:05:07PM +0100, Christopher Dimech wrote:
> > > > > Sent: Wednesday, December 02, 2020 at 9:41 AM
> > > > > From: tomas@tuxteam.de
> > > > > To: help-gnu-emacs@gnu.org
> > > > > Subject: Re: Toggle appointment notification
> > > > >
> > > > > On Tue, Dec 01, 2020 at 10:44:09PM +0100, Michael Heerdegen wrote:
> > > > > > <tomas@tuxteam.de> writes:
> > > > > >
> > > > > > > (message "my heading: %s" (prin1-to-string any))
> > > > > >
> > > > > > Or equivalent
> > > > > >
> > > > > > (message "my heading: %S" any)
> > > > > >
> > > > > > , no?
> > > > >
> > > > > Indeed. Recommended reading "4.7 Formatting Strings" in the Emacs Lisp
> > > > > manual (in the Intertubes here [1]).
> > > >
> > > > How does one deal with conditionals (1, nil) in format?
> > >
> > > Care to pose a more complete example?
> > >
> > > As far as I understood you, you'd put a Lisp expression in the 2nd...nth
> > > arguments of (message fmt ...), but I might be misunderstanding you
> > > completely.
> >
> > As I read it, the format it is mainly for numerical and strings.
> >
> > (format "%s" arbitrary-string)
> >
> > Although it mentions printed representation of the object
> >
> > I am sure users would be more interested is printing results
> > of expressions.
>
> But the result of an expression /is/ a Lisp object. That's
> the whole point of Lisp!
Correct. Must have got brain damage by working too much with C.
> So you can do:
>
> (format "look here: %S" (list (+ 3 4) (list 'a 'b 'c) (current-time-string)
> (current-fill-column)))
>
> => "look here: (7 (a b c) \"Wed Dec 2 14:42:30 2020\" 70)"
Did not know one may use a single format specifier for multiple objects.
> > But I suppose one should use "print", "prin1", and "princ"
> > for that.
>
> Use whatever is convenient, yes.
>
> > However, a valid format specification for conditional could be.
> >
> > (message "Result: %s" (> 5 3))
>
> Yes, that works. Have you actually tried it? What is the result?
> Does that match your expectations? If yes, why? If not, why not?
Yes, matches expectations.
> > %s mentions objects, but the sections seems to imply attention
> > to strings in "4.7 Formatting Strings".
> >
> > I think this is quite valid:
> >
> > (format "%s" arbitrary-string)
> >
> > But perhaps not completely true.
>
> It is incomplete: the format specifier %s takes a generic
> Lisp object, as does the %S. The difference is that %S puts
> strings in quotes, and %s doesn't. With %s, the above example
> yields
>
> => look here: (7 (a b c) Wed Dec 2 14:46:19 2020 70)
>
> Roughly speaking: use %S if your target audience is a
> computer program (or a human doing debugging, which
> amounts to much the same), and %s if your target audience
> is a human :)
>
> Now I'm again paraphrasing (badly) the manual for you.
> I'm doing something wrong I guess.
The manual explains it. Wrong? Must have been from the goodness
of your heart. Yes, I understood about %S.
> Cheers
> - t
>
- Re: Toggle appointment notification, (continued)
- Re: Toggle appointment notification, Jean Louis, 2020/12/03
- Re: Toggle appointment notification, Michael Heerdegen, 2020/12/01
- Re: Toggle appointment notification, tomas, 2020/12/02
- Re: Toggle appointment notification, Christopher Dimech, 2020/12/02
- Re: Toggle appointment notification, tomas, 2020/12/02
- Re: Toggle appointment notification, Christopher Dimech, 2020/12/02
- Re: Toggle appointment notification, tomas, 2020/12/02
- Re: Toggle appointment notification,
Christopher Dimech <=
- Re: Toggle appointment notification, Robert Pluim, 2020/12/02
- Re: Toggle appointment notification, Christopher Dimech, 2020/12/02
- Re: Toggle appointment notification, Jean Louis, 2020/12/02
- Re: Toggle appointment notification, tomas, 2020/12/02
- Re: Toggle appointment notification, Jean Louis, 2020/12/02
- Re: Toggle appointment notification, Emanuel Berg, 2020/12/02
- Re: Toggle appointment notification, Jean Louis, 2020/12/02
- RE: Toggle appointment notification, Drew Adams, 2020/12/02
- Re: Toggle appointment notification, Jean Louis, 2020/12/02
- Re: Toggle appointment notification, daniela-spit, 2020/12/01