emacs-diffs
[Top][All Lists]
Advanced

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

scratch/no-purespace 62891830cb8 39/41: Make 'purecopy' an obsolete func


From: Stefan Kangas
Subject: scratch/no-purespace 62891830cb8 39/41: Make 'purecopy' an obsolete function alias for 'identity'
Date: Tue, 10 Dec 2024 19:09:42 -0500 (EST)

branch: scratch/no-purespace
commit 62891830cb856956e4ba586df38cc7076f5ac90e
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    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'
---
 doc/lispref/keymaps.texi    |  2 +-
 doc/lispref/spellfile       |  1 -
 etc/NEWS                    |  3 +++
 lisp/emacs-lisp/byte-opt.el |  2 +-
 lisp/loadup.el              | 25 ++-----------------------
 lisp/subr.el                |  2 ++
 src/alloc.c                 | 37 -------------------------------------
 7 files changed, 9 insertions(+), 63 deletions(-)

diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index 87723720b1e..878f51555c1 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -3056,7 +3056,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
 
diff --git a/doc/lispref/spellfile b/doc/lispref/spellfile
index 11a6ce813af..d1875b464c6 100644
--- a/doc/lispref/spellfile
+++ b/doc/lispref/spellfile
@@ -418,7 +418,6 @@ ps
 psf
 psychotherapy
 pty
-purecopy
 qu
 quux
 rassq
diff --git a/etc/NEWS b/etc/NEWS
index e1c2f1face1..82114f276c8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -849,6 +849,9 @@ restore the old behavior, you can set 
'eshell-pwd-convert-function' to
 
 * Lisp Changes in Emacs 31.1
 
++++
+** The function 'purecopy' is now an obsolete alias for 'identity'.
+
 ---
 ** New function 'native-compile-directory'.
 This function natively-compiles all Lisp files in a directory and in its
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 0a89a33cbc3..217445e9d15 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1859,7 +1859,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
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 1ba25d967b5..74fbc2372ab 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -105,10 +105,6 @@
       ;; 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))
diff --git a/lisp/subr.el b/lisp/subr.el
index c72e6eb0b0e..0c54393494c 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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 'purecopy #'identity "31.1")
+
 
 ;;;; Alternate names for functions - these are not being phased out.
 
diff --git a/src/alloc.c b/src/alloc.c
index 5e2747af1f0..82d1a3a9891 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5585,42 +5585,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;
-}
-
-
 
 /***********************************************************************
                          Protection from GC
@@ -7748,7 +7712,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);



reply via email to

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