all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: Toggle appointment notification
Date: Wed, 2 Dec 2020 15:10:28 +0100	[thread overview]
Message-ID: <trinity-ed8cee5f-8788-484a-bcf8-fe5f40eb306e-1606918228341@3c-app-mailcom-bs14> (raw)
In-Reply-To: <20201202135234.GE14592@tuxteam.de>

> 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
>



  reply	other threads:[~2020-12-02 14:10 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  3:47 Toggle appointment notification pietru
2020-12-01  4:56 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-01  5:03   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-01 18:35     ` pietru
2020-12-01 18:52       ` Jean Louis
2020-12-01 19:01         ` pietru
2020-12-01 19:13         ` pietru
2020-12-01 19:23           ` Jean Louis
2020-12-01 19:38             ` pietru
2020-12-01 19:53             ` tomas
2020-12-01 19:58               ` pietru
2020-12-02 15:00                 ` pietru
2020-12-02 15:15                   ` pietru
2020-12-02 15:47                     ` Michael Heerdegen
2020-12-02 15:58                       ` pietru
2020-12-02 17:39                         ` pietru
2020-12-02 17:46                           ` pietru
2020-12-03  1:39                             ` Michael Heerdegen
2020-12-03  2:18                               ` pietru
2020-12-03 22:32                                 ` Michael Heerdegen
2020-12-03  1:50                         ` Michael Heerdegen
2020-12-03  2:14                           ` pietru
2020-12-03  3:23                             ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-03  4:06                               ` pietru
2020-12-03  4:22                                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-03 22:38                               ` Michael Heerdegen
2020-12-12  1:07                                 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  1:26                                   ` Christopher Dimech
2020-12-12  1:50                                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  1:48                                   ` Christopher Dimech
2020-12-12  1:53                                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  1:59                                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12  3:55                                   ` Michael Heerdegen
2020-12-12  4:23                                     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-12 22:42                                       ` Michael Heerdegen
2020-12-17  4:31                                         ` Michael Heerdegen
2020-12-03  2:17                           ` daniela-spit
2020-12-03  3:19                           ` Pankaj Jangid
2020-12-03  5:35                           ` pietru
2020-12-03 15:19                           ` pietru
2020-12-03 17:09                             ` Jean Louis
2020-12-03 17:20                               ` pietru
2020-12-03 17:58                                 ` Jean Louis
2020-12-03 18:29                                   ` pietru
2020-12-03 19:41                                     ` Jean Louis
2020-12-03 19:58                                     ` Jean Louis
2020-12-03 20:23                                       ` pietru
2020-12-03 20:38                                         ` Jean Louis
2020-12-03 21:30                                           ` Christopher Dimech
2020-12-03 22:43                                             ` Arthur Miller
2020-12-03 22:51                                               ` Christopher Dimech
2020-12-03 23:12                                             ` Michael Heerdegen
2020-12-03 23:03                                     ` Michael Heerdegen
2020-12-03 23:49                                       ` Jean Louis
2020-12-04  0:28                                         ` pietru
2020-12-04  5:59                                           ` Jean Louis
2020-12-04  6:28                                             ` pietru
2020-12-04  7:11                                               ` Jean Louis
2020-12-03 23:59                                       ` pietru
2020-12-04  1:13                                         ` Michael Heerdegen
2020-12-04  1:39                                           ` pietru
2020-12-03 10:19                   ` Jean Louis
2020-12-01 21:44               ` Michael Heerdegen
2020-12-02  8:41                 ` tomas
2020-12-02 12:05                   ` Christopher Dimech
2020-12-02 12:37                     ` tomas
2020-12-02 13:15                       ` Christopher Dimech
2020-12-02 13:52                         ` tomas
2020-12-02 14:10                           ` Christopher Dimech [this message]
2020-12-02 14:20                             ` Robert Pluim
2020-12-02 15:04                               ` Christopher Dimech
2020-12-02 15:08                         ` Jean Louis
2020-12-02 21:14                           ` tomas
2020-12-02 21:41                             ` Jean Louis
2020-12-02 22:35                               ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-02 22:54                                 ` Jean Louis
2020-12-02 15:25                         ` Drew Adams
2020-12-02 15:04                   ` Jean Louis
2020-12-02  1:54               ` daniela-spit
2020-12-02  2:47                 ` Michael Heerdegen
2020-12-02  3:04                   ` daniela-spit
2020-12-02  3:23                     ` Michael Heerdegen
2020-12-02  4:16                       ` daniela-spit
2020-12-02  4:26                       ` daniela-spit
2020-12-02  4:59                     ` Jean Louis
2020-12-01  9:13 ` Andreas

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=trinity-ed8cee5f-8788-484a-bcf8-fe5f40eb306e-1606918228341@3c-app-mailcom-bs14 \
    --to=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /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.