]> git.eshelyaron.com Git - emacs.git/commitdiff
Make 'purecopy' an obsolete function alias for 'identity'
authorStefan Kangas <stefankangas@gmail.com>
Tue, 10 Dec 2024 18:39:03 +0000 (19:39 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 3 Feb 2025 11:06:18 +0000 (12:06 +0100)
* 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'

(cherry picked from commit d6b05b128280cc23dc77a1a06194c4e69d1ac519)

doc/lispref/keymaps.texi
doc/lispref/spellfile
lisp/emacs-lisp/byte-opt.el
lisp/loadup.el
lisp/subr.el
src/alloc.c

index dc9666d44227b25d590f7d9b69f2c5e7827aa260..518abf0bb2ec262f57784b99611ae29f40968462 100644 (file)
@@ -3058,7 +3058,7 @@ By default, the global map binds @code{[tool-bar]} as follows:
 
 @example
 (keymap-global-set "<tool-bar>"
-                   `(menu-item ,(purecopy "tool bar") ignore
+                   '(menu-item "tool bar" ignore
                                :filter tool-bar-make-keymap))
 @end example
 
index 11a6ce813afc0591b991adcda87d04299fa0ca78..d1875b464c6b31178500ec58f1a2be9bf5cc5e71 100644 (file)
@@ -418,7 +418,6 @@ ps
 psf
 psychotherapy
 pty
-purecopy
 qu
 quux
 rassq
index 70cb2504c356d1f146a24c2ee63983754f6802ca..0c72f9625db2f2cb20afbfc05728e61eea566862 100644 (file)
@@ -1774,7 +1774,7 @@ See Info node `(elisp) Integer Basics'."
       (side-effect-and-error-free-fns
        '(
          ;; alloc.c
-         bool-vector cons list make-marker purecopy record vector
+         bool-vector cons list make-marker record vector
          ;; buffer.c
          buffer-list buffer-live-p current-buffer overlay-lists overlayp
          ;; casetab.c
index 8b234d91dd64e62aa49a833bbfa5e91c1b7c7ea9..d793956b88ce32ffc67b7a602d617c7062359c88 100644 (file)
       ;; than usual.
       (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)
 
 (if dump-mode
@@ -565,25 +561,8 @@ directory got moved.  This is set to be a pair in the form of:
   ;; file-local variables.
   (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
-;; hash-consing hash table is GC'd.
+
+;; Avoid error if user loads some more libraries now.
 (setq purify-flag nil)
 
 (if (null (garbage-collect))
index d80ecf068c35f4d265f94e6be3231a2593b0c42c..d9d7f7a5fa3541ed3c59cccd9520c967dfb84c85 100644 (file)
@@ -2048,6 +2048,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 'purecopy #'identity "31.1")
+
 \f
 ;;;; Alternate names for functions - these are not being phased out.
 
index da6ec52ec3b8f7c7acc1b03f7756e0e0028cc898..dfa1d68d1222a5cde40ac2dd0aa4f0c6bfcd08aa 100644 (file)
@@ -5513,42 +5513,6 @@ hash_table_free_bytes (void *p, ptrdiff_t nbytes)
   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;
-}
-
-
 \f
 /***********************************************************************
                          Protection from GC
@@ -7680,7 +7644,6 @@ N should be nonnegative.  */);
   defsubr (&Smake_symbol);
   defsubr (&Smake_marker);
   defsubr (&Smake_finalizer);
-  defsubr (&Spurecopy);
   defsubr (&Sgarbage_collect);
   defsubr (&Sgarbage_collect_maybe);
   defsubr (&Smemory_info);