unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Typo in defconst-1 and defvar-1 docstrings?
@ 2022-10-06 18:45 Philip Kaludercic
  2022-10-06 18:48 ` Philip Kaludercic
  2022-10-06 19:22 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Philip Kaludercic @ 2022-10-06 18:45 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]


I was reading through the implementation of defconst-1, but was confused
by the docstring that states:

   More specifically behaves like (defvar SYM 'INITVALUE DOCSTRING).

Isn't the point of defconst-1 as a functional variant of defconst, that
SYM will evaluate to a symbol?  And why should INITVALUE be quoted?
Unless I am mistaken, this patch ought to resolve the confusion:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-misquoted-examples-in-def-var-const-1.patch --]
[-- Type: text/x-patch, Size: 1385 bytes --]

From 8fbe8fa10355845f759b3d8abbb1894f31b46eed Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Thu, 6 Oct 2022 20:41:51 +0200
Subject: [PATCH] Fix misquoted examples in def{var,const}-1

* src/eval.c (Fdefvar_1): Quote the SYM, not the INITVAL.
(Fdefconst_1): Quote the SYM, not the INITVAL.
---
 src/eval.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index 8810136c04..56c5c7ea06 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -834,7 +834,7 @@ DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
 
 DEFUN ("defvar-1", Fdefvar_1, Sdefvar_1, 2, 3, 0,
        doc: /* Like `defvar' but as a function.
-More specifically behaves like (defvar SYM 'INITVALUE DOCSTRING).  */)
+More specifically behaves like (defvar 'SYM INITVALUE DOCSTRING).  */)
   (Lisp_Object sym, Lisp_Object initvalue, Lisp_Object docstring)
 {
   return defvar (sym, initvalue, docstring, false);
@@ -875,7 +875,7 @@ DEFUN ("defconst", Fdefconst, Sdefconst, 2, UNEVALLED, 0,
 
 DEFUN ("defconst-1", Fdefconst_1, Sdefconst_1, 2, 3, 0,
        doc: /* Like `defconst' but as a function.
-More specifically, behaves like (defconst SYM 'INITVALUE DOCSTRING).  */)
+More specifically, behaves like (defconst 'SYM INITVALUE DOCSTRING).  */)
   (Lisp_Object sym, Lisp_Object initvalue, Lisp_Object docstring)
 {
   CHECK_SYMBOL (sym);
-- 
2.37.3


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

end of thread, other threads:[~2022-10-06 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 18:45 Typo in defconst-1 and defvar-1 docstrings? Philip Kaludercic
2022-10-06 18:48 ` Philip Kaludercic
2022-10-06 20:06   ` Stefan Monnier
2022-10-06 19:22 ` Stefan Monnier
2022-10-06 19:48   ` Philip Kaludercic

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