* bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic
@ 2020-03-31 7:09 oitofelix
2020-04-14 13:52 ` Noam Postavsky
2020-08-08 13:14 ` Lars Ingebrigtsen
0 siblings, 2 replies; 5+ messages in thread
From: oitofelix @ 2020-03-31 7:09 UTC (permalink / raw)
To: 40341
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: make example homoiconic --]
[-- Type: text/x-diff, Size: 927 bytes --]
From 5a707993cdee582dcbc423f990205798ae3c421e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bruno=20F=C3=A9lix=20Rezende=20Ribeiro?= <oitofelix@gnu.org>
Date: Tue, 31 Mar 2020 03:55:35 -0300
Subject: [PATCH] * doc/lispref/os.texi (Session Management): make example
homoiconic
---
doc/lispref/os.texi | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index e72858b..680d327 100644
--- 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)
@end group
@end example
--
2.7.4
[-- Attachment #3: Type: text/plain, Size: 97 bytes --]
--
Bruno Félix Rezende Ribeiro (oitofelix) [0x28D618AF]
<http://oitofelix.freeshell.org/>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic
2020-03-31 7:09 bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic oitofelix
@ 2020-04-14 13:52 ` Noam Postavsky
2020-04-14 17:54 ` Eli Zaretskii
2020-08-08 13:14 ` Lars Ingebrigtsen
2020-08-08 13:14 ` Lars Ingebrigtsen
1 sibling, 2 replies; 5+ messages in thread
From: Noam Postavsky @ 2020-04-14 13:52 UTC (permalink / raw)
To: oitofelix; +Cc: 40341
severity 40341 minor
quit
oitofelix@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.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic
2020-04-14 13:52 ` Noam Postavsky
@ 2020-04-14 17:54 ` Eli Zaretskii
2020-08-08 13:14 ` Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2020-04-14 17:54 UTC (permalink / raw)
To: Noam Postavsky; +Cc: oitofelix, 40341
> From: Noam Postavsky <npostavs@gmail.com>
> Date: Tue, 14 Apr 2020 09:52:56 -0400
> Cc: 40341@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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic
2020-04-14 13:52 ` Noam Postavsky
2020-04-14 17:54 ` Eli Zaretskii
@ 2020-08-08 13:14 ` Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-08 13:14 UTC (permalink / raw)
To: Noam Postavsky; +Cc: oitofelix, 40341
Noam Postavsky <npostavs@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic
2020-03-31 7:09 bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic oitofelix
2020-04-14 13:52 ` Noam Postavsky
@ 2020-08-08 13:14 ` Lars Ingebrigtsen
1 sibling, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-08 13:14 UTC (permalink / raw)
To: oitofelix; +Cc: 40341
oitofelix@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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-08 13:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-31 7:09 bug#40341: [PATCH] * doc/lispref/os.texi (Session Management): make example homoiconic oitofelix
2020-04-14 13:52 ` Noam Postavsky
2020-04-14 17:54 ` Eli Zaretskii
2020-08-08 13:14 ` Lars Ingebrigtsen
2020-08-08 13:14 ` 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).