* bug#49376: Feature request (poll): default function for pretty printing when called interactively
@ 2021-07-04 11:22 dalanicolai
2021-07-04 11:53 ` dalanicolai
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: dalanicolai @ 2021-07-04 11:22 UTC (permalink / raw)
To: 49376
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!
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376: Feature request (poll): default function for pretty printing when called interactively
2021-07-04 11:22 bug#49376: Feature request (poll): default function for pretty printing when called interactively dalanicolai
@ 2021-07-04 11:53 ` dalanicolai
2021-07-04 12:23 ` bug#49376: dalanicolai
2021-07-04 13:40 ` bug#49376: Feature request (poll): default function for pretty printing when called interactively Lars Ingebrigtsen
2 siblings, 0 replies; 7+ messages in thread
From: dalanicolai @ 2021-07-04 11:53 UTC (permalink / raw)
To: 49376
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).
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376:
2021-07-04 11:22 bug#49376: Feature request (poll): default function for pretty printing when called interactively dalanicolai
2021-07-04 11:53 ` dalanicolai
@ 2021-07-04 12:23 ` dalanicolai
2021-07-04 13:40 ` bug#49376: Feature request (poll): default function for pretty printing when called interactively Lars Ingebrigtsen
2 siblings, 0 replies; 7+ messages in thread
From: dalanicolai @ 2021-07-04 12:23 UTC (permalink / raw)
To: 49376
[-- Attachment #1: Type: text/plain, Size: 184 bytes --]
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))
```
[-- Attachment #2: Type: text/html, Size: 267 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376: Feature request (poll): default function for pretty printing when called interactively
2021-07-04 11:22 bug#49376: Feature request (poll): default function for pretty printing when called interactively dalanicolai
2021-07-04 11:53 ` dalanicolai
2021-07-04 12:23 ` bug#49376: dalanicolai
@ 2021-07-04 13:40 ` Lars Ingebrigtsen
2021-07-06 12:44 ` dalanicolai
2 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-04 13:40 UTC (permalink / raw)
To: dalanicolai; +Cc: 49376
dalanicolai@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376: Feature request (poll): default function for pretty printing when called interactively
2021-07-04 13:40 ` bug#49376: Feature request (poll): default function for pretty printing when called interactively Lars Ingebrigtsen
@ 2021-07-06 12:44 ` dalanicolai
2021-07-06 14:38 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: dalanicolai @ 2021-07-06 12:44 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 49376
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
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@gnus.org> wrote:
> dalanicolai@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
>
[-- Attachment #2: Type: text/html, Size: 1196 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376: Feature request (poll): default function for pretty printing when called interactively
2021-07-06 12:44 ` dalanicolai
@ 2021-07-06 14:38 ` Lars Ingebrigtsen
2021-11-04 22:18 ` Lars Ingebrigtsen
0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-06 14:38 UTC (permalink / raw)
To: dalanicolai; +Cc: 49376
dalanicolai <dalanicolai@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#49376: Feature request (poll): default function for pretty printing when called interactively
2021-07-06 14:38 ` Lars Ingebrigtsen
@ 2021-11-04 22:18 ` Lars Ingebrigtsen
0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-04 22:18 UTC (permalink / raw)
To: dalanicolai; +Cc: 49376
Lars Ingebrigtsen <larsi@gnus.org> writes:
> dalanicolai <dalanicolai@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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-11-04 22:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-04 11:22 bug#49376: Feature request (poll): default function for pretty printing when called interactively dalanicolai
2021-07-04 11:53 ` dalanicolai
2021-07-04 12:23 ` bug#49376: dalanicolai
2021-07-04 13:40 ` bug#49376: Feature request (poll): default function for pretty printing when called interactively Lars Ingebrigtsen
2021-07-06 12:44 ` dalanicolai
2021-07-06 14:38 ` Lars Ingebrigtsen
2021-11-04 22:18 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).