unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34504: 'pp' causally mentioned
@ 2019-02-16 19:33 積丹尼 Dan Jacobson
  2019-02-17 15:28 ` Eli Zaretskii
  2019-09-16  3:03 ` Stefan Kangas
  0 siblings, 2 replies; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-02-16 19:33 UTC (permalink / raw)
  To: 34504

In (info "(emacs) Program Indent") it says:
   Emacs also provides a Lisp pretty-printer in the ‘pp’ package, which
reformats Lisp objects with nice-looking indentation."

OK, as there is no hyperlink to click on, say the user eventually finds
that indeed there is
$ dlocate /pp\\.
emacs-el: /usr/share/emacs/26.1/lisp/emacs-lisp/pp.el.gz
and loads it, but he still cannot use it because there is no further
example of how, provided, even within that file. E.g., you could mention
how to pretty print one's .emacs with it.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-16 19:33 bug#34504: 'pp' causally mentioned 積丹尼 Dan Jacobson
@ 2019-02-17 15:28 ` Eli Zaretskii
  2019-02-17 15:37   ` 積丹尼 Dan Jacobson
  2019-09-16  3:03 ` Stefan Kangas
  1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2019-02-17 15:28 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34504

tags 34504 notabug
thanks

> From: 積丹尼 Dan Jacobson
> 	<jidanni@jidanni.org>
> Date: Sun, 17 Feb 2019 03:33:50 +0800
> 
> In (info "(emacs) Program Indent") it says:
>    Emacs also provides a Lisp pretty-printer in the ‘pp’ package, which
> reformats Lisp objects with nice-looking indentation."
> 
> OK, as there is no hyperlink to click on

In my version of the manual, that sentence is followed by a hyperlink:

     Emacs also provides a Lisp pretty-printer in the ‘pp’ package, which
  reformats Lisp objects with nice-looking indentation.  *Note pp:
  (elisp)Output Functions.

> say the user eventually finds
> that indeed there is
> $ dlocate /pp\\.
> emacs-el: /usr/share/emacs/26.1/lisp/emacs-lisp/pp.el.gz
> and loads it, but he still cannot use it because there is no further
> example of how, provided, even within that file. E.g., you could mention
> how to pretty print one's .emacs with it.

pp doesn't by itself pretty-print files, it can only pretty-print Lisp
objects (as the hyperlinked node of the ELisp manual describes).





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 15:28 ` Eli Zaretskii
@ 2019-02-17 15:37   ` 積丹尼 Dan Jacobson
  2019-02-17 17:54     ` Michael Heerdegen
  2019-02-17 18:57     ` Eli Zaretskii
  0 siblings, 2 replies; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-02-17 15:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 34504

OK it can only do objects, not a collection of objects, which is what I
suppose a file is. So how to pretty print one's .emacs file with it
might be mentioned as an exercise for the reader on that page.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 15:37   ` 積丹尼 Dan Jacobson
@ 2019-02-17 17:54     ` Michael Heerdegen
  2019-02-17 18:45       ` 積丹尼 Dan Jacobson
  2019-02-17 18:57     ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2019-02-17 17:54 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34504

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

> OK it can only do objects, not a collection of objects, which is what
> I suppose a file is. So how to pretty print one's .emacs file with it
> might be mentioned as an exercise for the reader on that page.

There's `pp-buffer'.  It's only a function, however.

Note that AFAIK, pp is nothing more as a very thin wrapper around the
standard Elisp printer that adds some additional line breaks, and even
that in a not very intelligent way.  A good pretty printer you could use
to prettify your .emacs still has to be written.


Michael.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 17:54     ` Michael Heerdegen
@ 2019-02-17 18:45       ` 積丹尼 Dan Jacobson
  2019-02-17 23:01         ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-02-17 18:45 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 34504

MH> There's `pp-buffer'.  It's only a function, however.
OK maybe tell the user to
M-: (pp-buffer)    [eval-expression]
C-x h              [mark-whole-buffer]
<tab>              [indent-for-tab-command]
Now one's lisp looks pretty good.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 15:37   ` 積丹尼 Dan Jacobson
  2019-02-17 17:54     ` Michael Heerdegen
@ 2019-02-17 18:57     ` Eli Zaretskii
  1 sibling, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2019-02-17 18:57 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34504

> From: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
> Cc: 34504@debbugs.gnu.org
> Date: Sun, 17 Feb 2019 23:37:29 +0800
> 
> OK it can only do objects, not a collection of objects, which is what I
> suppose a file is.

No, a file is not a collection of objects, not unless you eval it.

> So how to pretty print one's .emacs file with it
> might be mentioned as an exercise for the reader on that page.

I don't think 'pp' is something that would support such an exercise.
IOW, I think you are looking for a feature in the wrong place.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 18:45       ` 積丹尼 Dan Jacobson
@ 2019-02-17 23:01         ` Michael Heerdegen
  2019-02-18  2:03           ` 積丹尼 Dan Jacobson
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2019-02-17 23:01 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 34504

積丹尼 Dan Jacobson <jidanni@jidanni.org> writes:

> MH> There's `pp-buffer'.  It's only a function, however.
> OK maybe tell the user to
> M-: (pp-buffer)    [eval-expression]
> C-x h              [mark-whole-buffer]
> <tab>              [indent-for-tab-command]
> Now one's lisp looks pretty good.

In some cases it looks prettier, but in others it looks uglier.  For
example

#+begin_src emacs-lisp
(let ((x 1) (y 2))
  (+ x y))

(defun f (n) (1+ n))
#+end_src

becomes

#+begin_src emacs-lisp
(let
    ((x 1)
     (y 2))
  (+ x y))
(defun f
    (n)
  (1+ n))
#+end_src

after your treatment.  Too many added line breaks for my gusto, but OTOH
the empty line between the two expressions has disappeared.

pp may be ok for improving how an evaluation result is presented to the
user, but it's IMHO by far not suitable for reformatting hand-written
code.


Michael.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-17 23:01         ` Michael Heerdegen
@ 2019-02-18  2:03           ` 積丹尼 Dan Jacobson
  0 siblings, 0 replies; 9+ messages in thread
From: 積丹尼 Dan Jacobson @ 2019-02-18  2:03 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 34504

(Well it helped for .newsrc.eld files.)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#34504: 'pp' causally mentioned
  2019-02-16 19:33 bug#34504: 'pp' causally mentioned 積丹尼 Dan Jacobson
  2019-02-17 15:28 ` Eli Zaretskii
@ 2019-09-16  3:03 ` Stefan Kangas
  1 sibling, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2019-09-16  3:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 34504-done, 積丹尼 Dan Jacobson

Eli Zaretskii <eliz@gnu.org> writes:

> tags 34504 notabug
> thanks
>
>> From: 積丹尼 Dan Jacobson
>>     <jidanni@jidanni.org>
>> Date: Sun, 17 Feb 2019 03:33:50 +0800
>>
>> In (info "(emacs) Program Indent") it says:
>>    Emacs also provides a Lisp pretty-printer in the ‘pp’ package, which
>> reformats Lisp objects with nice-looking indentation."
>>
>> OK, as there is no hyperlink to click on
>
> In my version of the manual, that sentence is followed by a hyperlink:
>
>      Emacs also provides a Lisp pretty-printer in the ‘pp’ package, which
>   reformats Lisp objects with nice-looking indentation.  *Note pp:
>   (elisp)Output Functions.
>
>> say the user eventually finds
>> that indeed there is
>> $ dlocate /pp\\.
>> emacs-el: /usr/share/emacs/26.1/lisp/emacs-lisp/pp.el.gz
>> and loads it, but he still cannot use it because there is no further
>> example of how, provided, even within that file. E.g., you could mention
>> how to pretty print one's .emacs with it.
>
> pp doesn't by itself pretty-print files, it can only pretty-print Lisp
> objects (as the hyperlinked node of the ELisp manual describes).

Already marked notabug, and from reading the discussion it doesn't look
like there's more to do here.  I'm therefore closing this bug.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-16  3:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-16 19:33 bug#34504: 'pp' causally mentioned 積丹尼 Dan Jacobson
2019-02-17 15:28 ` Eli Zaretskii
2019-02-17 15:37   ` 積丹尼 Dan Jacobson
2019-02-17 17:54     ` Michael Heerdegen
2019-02-17 18:45       ` 積丹尼 Dan Jacobson
2019-02-17 23:01         ` Michael Heerdegen
2019-02-18  2:03           ` 積丹尼 Dan Jacobson
2019-02-17 18:57     ` Eli Zaretskii
2019-09-16  3:03 ` Stefan Kangas

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