From: Stefan Kangas Date: Tue, 10 Dec 2024 18:39:03 +0000 (+0100) Subject: Make 'purecopy' an obsolete function alias for 'identity' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0a39375db0decca1e255dd35ec4fde724745dcc8;p=emacs.git 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' (cherry picked from commit d6b05b128280cc23dc77a1a06194c4e69d1ac519) --- diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index dc9666d4422..518abf0bb2e 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi @@ -3058,7 +3058,7 @@ By default, the global map binds @code{[tool-bar]} as follows: @example (keymap-global-set "" - `(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/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 70cb2504c35..0c72f9625db 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -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 diff --git a/lisp/loadup.el b/lisp/loadup.el index 8b234d91dd6..d793956b88c 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 d80ecf068c3..d9d7f7a5fa3 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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") + ;;;; Alternate names for functions - these are not being phased out. diff --git a/src/alloc.c b/src/alloc.c index da6ec52ec3b..dfa1d68d122 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -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; -} - - /*********************************************************************** 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);