GNU bug report logs - #49376
Feature request (poll): default function for pretty printing when called interactively

Previous Next

Package: emacs;

Reported by: dalanicolai <at> gmail.com

Date: Sun, 4 Jul 2021 11:24:01 UTC

Severity: wishlist

Tags: wontfix

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49376 in the body.
You can then email your comments to 49376 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Sun, 04 Jul 2021 11:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to dalanicolai <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 04 Jul 2021 11:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: dalanicolai <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: Feature request (poll): default function for pretty printing when
 called interactively
Date: Sun, 04 Jul 2021 13:22:59 +0200
I find myself quite frequently prefering to use the following form for
exiting/returning from a function:
```
        (when (called-interactively-p)
          (pp some-datastructure)
          data-structure))))
```
because often I prefer to see a pretty printed representation of a
data-structure when calling as a command, while I would like to use the
data-structure in another function when called as a function (which
unfortunately is not possible with the pretty printed data-structure)

So I was wondering if it would be reasonable to add a basic output
function for this to the Emacs core. Not very important of course, but
I figured that it could be a reasonable addition. If anybody has a
strong opinion about it, please share. Thank you!





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Sun, 04 Jul 2021 11:54:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: dalanicolai <at> gmail.com
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: bug#49376: Feature request (poll): default function for pretty
 printing when called interactively
Date: Sun, 04 Jul 2021 13:53:44 +0200
It is mainly useful when parsing text/code/buffers, so it might be
called parse<->print (<-> means optionally interchanged). On the other
hand it is used mainly when "developing" (or when transforming
text/code), so it might be called devel<->print.
Obviously it is no problem to just define this function in my
package(s), where I like to provide users with an 'even easier'
introspection option for some 'reusable' functions (e.g. parsing a pdf
to a dom (html/xml). Where we often want to apply it to the currently
viewed document).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Sun, 04 Jul 2021 12:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 49376 <at> debbugs.gnu.org (full text, mbox):

From: dalanicolai <dalanicolai <at> gmail.com>
To: 49376 <at> debbugs.gnu.org
Date: Sun, 4 Jul 2021 14:23:35 +0200
[Message part 1 (text/plain, inline)]
I guess it should actually be the following macro, to function as it is
supposed to:
```
(defmacro parse-print (data)
  `(if (called-interactively-p)
       (pp ,data)
    ,data))
```
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Sun, 04 Jul 2021 13:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 49376 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: dalanicolai <at> gmail.com
Cc: 49376 <at> debbugs.gnu.org
Subject: Re: bug#49376: Feature request (poll): default function for pretty
 printing when called interactively
Date: Sun, 04 Jul 2021 15:40:24 +0200
dalanicolai <at> gmail.com writes:

> So I was wondering if it would be reasonable to add a basic output
> function for this to the Emacs core.

I can't quite remember writing any command that would pretty-print a
Lisp expression when called interactively -- when a command displays
information to the user, pp-ing a Lisp expression is usually not the
most readable way.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Tue, 06 Jul 2021 12:46:01 GMT) Full text and rfc822 format available.

Message #17 received at 49376 <at> debbugs.gnu.org (full text, mbox):

From: dalanicolai <dalanicolai <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 49376 <at> debbugs.gnu.org
Subject: Re: bug#49376: Feature request (poll): default function for pretty
 printing when called interactively
Date: Tue, 6 Jul 2021 14:44:47 +0200
[Message part 1 (text/plain, inline)]
I agree it is not that important. But now I do wonder what then, in general,
would provide a more readable way for printing lisp expressions.

On Sun, 4 Jul 2021 at 15:40, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> dalanicolai <at> gmail.com writes:
>
> > So I was wondering if it would be reasonable to add a basic output
> > function for this to the Emacs core.
>
> I can't quite remember writing any command that would pretty-print a
> Lisp expression when called interactively -- when a command displays
> information to the user, pp-ing a Lisp expression is usually not the
> most readable way.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Tue, 06 Jul 2021 14:40:02 GMT) Full text and rfc822 format available.

Message #20 received at 49376 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: dalanicolai <dalanicolai <at> gmail.com>
Cc: 49376 <at> debbugs.gnu.org
Subject: Re: bug#49376: Feature request (poll): default function for pretty
 printing when called interactively
Date: Tue, 06 Jul 2021 16:38:53 +0200
dalanicolai <dalanicolai <at> gmail.com> writes:

> I agree it is not that important. But now I do wonder what then, in general,
> would provide a more readable way for printing lisp expressions.

Messaging a Lisp expression at the user is pretty uncommon in itself, I
think?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49376; Package emacs. (Thu, 04 Nov 2021 22:19:02 GMT) Full text and rfc822 format available.

Message #23 received at 49376 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: dalanicolai <dalanicolai <at> gmail.com>
Cc: 49376 <at> debbugs.gnu.org
Subject: Re: bug#49376: Feature request (poll): default function for pretty
 printing when called interactively
Date: Thu, 04 Nov 2021 23:18:24 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> dalanicolai <dalanicolai <at> gmail.com> writes:
>
>> I agree it is not that important. But now I do wonder what then, in general,
>> would provide a more readable way for printing lisp expressions.
>
> Messaging a Lisp expression at the user is pretty uncommon in itself, I
> think?

I think the conclusion here was that we don't really want to add
something like this, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 04 Nov 2021 22:19:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 49376 <at> debbugs.gnu.org and dalanicolai <at> gmail.com Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 04 Nov 2021 22:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 03 Dec 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.