Make 'purecopy' an obsolete function alias for 'identity'

* lisp/subr.el (purecopy): New obsolete function alias for 'identity'.
* src/alloc.c (purecopy): Remove function.
(Fpurecopy): Remove DEFUN.
(syms_of_alloc): Remove defsubr for above DEFUN.
* lisp/loadup.el (purify-flag): Don't set to hash table.

* doc/lispref/spellfile:
* doc/lispref/keymaps.texi (Tool Bar):
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Delete
references to 'purecopy'
This commit is contained in:
Stefan Kangas 2024-12-10 19:39:03 +01:00
parent b299a5d184
commit d6b05b1282
7 changed files with 8 additions and 62 deletions

View file

@ -3056,7 +3056,7 @@ By default, the global map binds @code{[tool-bar]} as follows:
@example @example
(keymap-global-set "<tool-bar>" (keymap-global-set "<tool-bar>"
`(menu-item ,(purecopy "tool bar") ignore '(menu-item "tool bar" ignore
:filter tool-bar-make-keymap)) :filter tool-bar-make-keymap))
@end example @end example

View file

@ -418,7 +418,6 @@ ps
psf psf
psychotherapy psychotherapy
pty pty
purecopy
qu qu
quux quux
rassq rassq

View file

@ -883,6 +883,9 @@ restore the old behavior, you can set 'eshell-pwd-convert-function' to
* Lisp Changes in Emacs 31.1 * Lisp Changes in Emacs 31.1
+++
** The function 'purecopy' is now an obsolete alias for 'identity'.
--- ---
** New function 'native-compile-directory'. ** New function 'native-compile-directory'.
This function natively-compiles all Lisp files in a directory and in its This function natively-compiles all Lisp files in a directory and in its

View file

@ -1859,7 +1859,7 @@ See Info node `(elisp) Integer Basics'."
(side-effect-and-error-free-fns (side-effect-and-error-free-fns
'( '(
;; alloc.c ;; alloc.c
bool-vector cons list make-marker purecopy record vector bool-vector cons list make-marker record vector
;; buffer.c ;; buffer.c
buffer-list buffer-live-p current-buffer overlay-lists overlayp buffer-list buffer-live-p current-buffer overlay-lists overlayp
;; casetab.c ;; casetab.c

View file

@ -105,10 +105,6 @@
;; than usual. ;; than usual.
(setq max-lisp-eval-depth (max max-lisp-eval-depth 3400)))) (setq max-lisp-eval-depth (max max-lisp-eval-depth 3400))))
(if (eq t purify-flag)
;; Hash consing saved around 11% of pure space in my tests.
(setq purify-flag (make-hash-table :test #'equal :size 80000)))
(message "Using load-path %s" load-path) (message "Using load-path %s" load-path)
(if dump-mode (if dump-mode
@ -565,25 +561,8 @@ directory got moved. This is set to be a pair in the form of:
;; file-local variables. ;; file-local variables.
(defvar comp--no-native-compile (make-hash-table :test #'equal))) (defvar comp--no-native-compile (make-hash-table :test #'equal)))
(when (hash-table-p purify-flag)
(let ((strings 0)
(vectors 0)
(bytecodes 0)
(conses 0)
(others 0))
(maphash (lambda (k v)
(cond
((stringp k) (setq strings (1+ strings)))
((vectorp k) (setq vectors (1+ vectors)))
((consp k) (setq conses (1+ conses)))
((byte-code-function-p v) (setq bytecodes (1+ bytecodes)))
(t (setq others (1+ others)))))
purify-flag)
(message "Pure-hashed: %d strings, %d vectors, %d conses, %d bytecodes, %d others"
strings vectors conses bytecodes others)))
;; Avoid error if user loads some more libraries now and make sure the ;; Avoid error if user loads some more libraries now.
;; hash-consing hash table is GC'd.
(setq purify-flag nil) (setq purify-flag nil)
(if (null (garbage-collect)) (if (null (garbage-collect))

View file

@ -2042,6 +2042,8 @@ instead; it will indirectly limit the specpdl stack size as well.")
(define-obsolete-function-alias 'fetch-bytecode #'ignore "30.1") (define-obsolete-function-alias 'fetch-bytecode #'ignore "30.1")
(define-obsolete-function-alias 'purecopy #'identity "31.1")
;;;; Alternate names for functions - these are not being phased out. ;;;; Alternate names for functions - these are not being phased out.

View file

@ -5585,42 +5585,6 @@ hash_table_free_bytes (void *p, ptrdiff_t nbytes)
xfree (p); xfree (p);
} }
static Lisp_Object purecopy (Lisp_Object obj);
DEFUN ("purecopy", Fpurecopy, Spurecopy, 1, 1, 0,
doc: /* Make a copy of object OBJ in pure storage.
Recursively copies contents of vectors and cons cells.
Does not copy symbols. Copies strings without text properties. */)
(register Lisp_Object obj)
{
if (NILP (Vpurify_flag))
return obj;
else if (MARKERP (obj) || OVERLAYP (obj) || SYMBOLP (obj))
/* Can't purify those. */
return obj;
else
return purecopy (obj);
}
static Lisp_Object
purecopy (Lisp_Object obj)
{
if (FIXNUMP (obj) || SUBRP (obj))
return obj; /* No need to hash. */
if (HASH_TABLE_P (Vpurify_flag)) /* Hash consing. */
{
Lisp_Object tmp = Fgethash (obj, Vpurify_flag, Qnil);
if (!NILP (tmp))
return tmp;
Fputhash (obj, obj, Vpurify_flag);
}
return obj;
}
/*********************************************************************** /***********************************************************************
Protection from GC Protection from GC
@ -7748,7 +7712,6 @@ N should be nonnegative. */);
defsubr (&Smake_symbol); defsubr (&Smake_symbol);
defsubr (&Smake_marker); defsubr (&Smake_marker);
defsubr (&Smake_finalizer); defsubr (&Smake_finalizer);
defsubr (&Spurecopy);
defsubr (&Sgarbage_collect); defsubr (&Sgarbage_collect);
defsubr (&Sgarbage_collect_maybe); defsubr (&Sgarbage_collect_maybe);
defsubr (&Smemory_info); defsubr (&Smemory_info);