GNU bug report logs - #40341
[PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic

Previous Next

Package: emacs;

Reported by: oitofelix <at> gnu.org

Date: Tue, 31 Mar 2020 07:10:01 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 28.1

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 40341 in the body.
You can then email your comments to 40341 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#40341; Package emacs. (Tue, 31 Mar 2020 07:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to oitofelix <at> gnu.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 31 Mar 2020 07:10:01 GMT) Full text and rfc822 format available.

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

From: oitofelix <at> gnu.org
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] * doc/lispref/os.texi (Session Management): make example
 homoiconic
Date: Tue, 31 Mar 2020 04:09:22 -0300
[Message part 1 (text/plain, inline)]
I think hardcoded strings with Lisp code in Lisp code is a bad practice,
given that Lisp’s main distinguishing feature is its homocoinicity.  In
my opinion the Lisp reference manual should encouraged homoiconic
programming --- or, at least, not to promote the contrary.

[0001-doc-lispref-os.texi-Session-Management-make-example-.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
-- 
Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
<http://oitofelix.freeshell.org/>

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40341; Package emacs. (Tue, 14 Apr 2020 13:54:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: oitofelix <at> gnu.org
Cc: 40341 <at> debbugs.gnu.org
Subject: Re: bug#40341: [PATCH] * doc/lispref/os.texi (Session Management):
 make example homoiconic
Date: Tue, 14 Apr 2020 09:52:56 -0400
severity 40341 minor
quit

oitofelix <at> gnu.org writes:

> --- a/doc/lispref/os.texi
> +++ b/doc/lispref/os.texi
> @@ -2675,10 +2675,10 @@ Emacs is restarted by the session manager.
>  
>  @group
>  (defun save-yourself-test ()
> -  (insert "(save-current-buffer
> -  (switch-to-buffer \"*scratch*\")
> -  (insert \"I am restored\"))")
> -  nil)
> +    (insert (format "%S" '(save-current-buffer
> +                           (switch-to-buffer "*scratch*")
> +                           (insert "I am restored"))))
> +    nil)

Shouldn't this example also be using set-buffer instead of
switch-to-buffer?  (Or rather, with-current-buffer instead of
save-current-buffer + switch-to-buffer.)




Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 14 Apr 2020 13:54:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40341; Package emacs. (Tue, 14 Apr 2020 17:55:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: oitofelix <at> gnu.org, 40341 <at> debbugs.gnu.org
Subject: Re: bug#40341: [PATCH] * doc/lispref/os.texi (Session Management):
 make example homoiconic
Date: Tue, 14 Apr 2020 20:54:30 +0300
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Tue, 14 Apr 2020 09:52:56 -0400
> Cc: 40341 <at> debbugs.gnu.org
> 
> > +    (insert (format "%S" '(save-current-buffer
> > +                           (switch-to-buffer "*scratch*")
> > +                           (insert "I am restored"))))
> > +    nil)
> 
> Shouldn't this example also be using set-buffer instead of
> switch-to-buffer?  (Or rather, with-current-buffer instead of
> save-current-buffer + switch-to-buffer.)

It wouldn't hurt to put our money where our mouth is, I agree.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40341; Package emacs. (Sat, 08 Aug 2020 13:15:03 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: oitofelix <at> gnu.org
Cc: 40341 <at> debbugs.gnu.org
Subject: Re: bug#40341: [PATCH] * doc/lispref/os.texi (Session Management):
 make example homoiconic
Date: Sat, 08 Aug 2020 15:14:26 +0200
oitofelix <at> gnu.org writes:

> I think hardcoded strings with Lisp code in Lisp code is a bad practice,
> given that Lisp’s main distinguishing feature is its homocoinicity.  In
> my opinion the Lisp reference manual should encouraged homoiconic
> programming --- or, at least, not to promote the contrary.

[...]

>  @group
>  (defun save-yourself-test ()
> -  (insert "(save-current-buffer
> -  (switch-to-buffer \"*scratch*\")
> -  (insert \"I am restored\"))")
> -  nil)
> +    (insert (format "%S" '(save-current-buffer
> +                           (switch-to-buffer "*scratch*")
> +                           (insert "I am restored"))))
> +    nil)

Thanks; applied to Emacs 28.1.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#40341; Package emacs. (Sat, 08 Aug 2020 13:15:03 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: oitofelix <at> gnu.org, 40341 <at> debbugs.gnu.org
Subject: Re: bug#40341: [PATCH] * doc/lispref/os.texi (Session Management):
 make example homoiconic
Date: Sat, 08 Aug 2020 15:14:42 +0200
Noam Postavsky <npostavs <at> gmail.com> writes:

> Shouldn't this example also be using set-buffer instead of
> switch-to-buffer?  (Or rather, with-current-buffer instead of
> save-current-buffer + switch-to-buffer.)

I've now done this change.

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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:15:04 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 40341 <at> debbugs.gnu.org and oitofelix <at> gnu.org Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:15:04 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. (Sun, 06 Sep 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 231 days ago.

Previous Next


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