unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: emacs-devel@gnu.org
Subject: Typo in defconst-1 and defvar-1 docstrings?
Date: Thu, 06 Oct 2022 18:45:40 +0000	[thread overview]
Message-ID: <87v8owlrjf.fsf@posteo.net> (raw)

[-- 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


             reply	other threads:[~2022-10-06 18:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 18:45 Philip Kaludercic [this message]
2022-10-06 18:48 ` Typo in defconst-1 and defvar-1 docstrings? Philip Kaludercic
2022-10-06 20:06   ` Stefan Monnier
2022-10-06 19:22 ` Stefan Monnier
2022-10-06 19:48   ` Philip Kaludercic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8owlrjf.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).