emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 b7f03333551: Improve warning about changing the string returned


From: Gregory Heytings
Subject: emacs-29 b7f03333551: Improve warning about changing the string returned by symbol-name
Date: Sun, 19 Mar 2023 17:19:46 -0400 (EDT)

branch: emacs-29
commit b7f03333551b2214f4d151d25d319e62402167c1
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>

    Improve warning about changing the string returned by symbol-name
    
    * src/data.c (Fsymbol_name): Add warning.  See bug#62009.
    
    * doc/lispref/symbols.texi (Creating Symbols): Improve warning.
---
 doc/lispref/symbols.texi | 5 ++---
 src/data.c               | 5 ++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 5b53cbe310a..c6a0408abd1 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -276,9 +276,8 @@ This function returns the string that is @var{symbol}'s 
name.  For example:
 @end group
 @end example
 
-@strong{Warning:} Changing the string by substituting characters does
-change the name of the symbol, but fails to update the obarray, so don't
-do it!
+@strong{Warning:} Never alter the string returned by that function.
+Doing that might make Emacs dysfunctional, and might even crash Emacs.
 @end defun
 
 @cindex uninterned symbol, and generating Lisp code
diff --git a/src/data.c b/src/data.c
index 0f1d881e00b..930d476bc3f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -773,7 +773,10 @@ DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 
0,
 }
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
-       doc: /* Return SYMBOL's name, a string.  */)
+       doc: /* Return SYMBOL's name, a string.
+
+Warning: never alter the string returned by `symbol-name'.
+Doing that might make Emacs dysfunctional, and might even crash Emacs.  */)
   (register Lisp_Object symbol)
 {
   register Lisp_Object name;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]