Eliminate some mutation of program constants
authorMattias Engdegård <mattiase@acm.org>
Wed, 17 May 2023 08:56:44 +0000 (10:56 +0200)
committerMattias Engdegård <mattiase@acm.org>
Wed, 17 May 2023 09:00:25 +0000 (11:00 +0200)
* lisp/foldout.el:
* lisp/gnus/mml2015.el (mml2015-epg-key-image-to-string):
* lisp/international/ja-dic-cnv.el (skkdic-set-postfix)
(skkdic-set-prefix):
* lisp/international/quail.el (quail-insert-kbd-layout):
* lisp/mail/rmail.el (rmail-set-attribute-1):
* lisp/net/tramp.el (tramp-handle-memory-info):
* lisp/org/org-macs.el (org-replace-escapes):
Work on newly created objects, or use non-destructive operations.

lisp/foldout.el
lisp/gnus/mml2015.el
lisp/international/ja-dic-cnv.el
lisp/international/quail.el
lisp/mail/rmail.el
lisp/net/tramp.el
lisp/org/org-macs.el

index 5a3afc9508a91976bd207c6eaad17262fd2e7b2c..ace242ffbc78d43596d6f878b719a3608e5330d4 100644 (file)
@@ -229,7 +229,7 @@ An end marker of nil means the fold ends after (point-max).")
          (error "Can't find outline-minor-mode in minor-mode-alist"))
 
       ;; slip our fold announcement into the list
-      (setcdr outl-entry (nconc foldout-entry (cdr outl-entry)))))
+      (setcdr outl-entry (append foldout-entry (cdr outl-entry)))))
 
 \f
 
index b8dd61de3b9de6de647647a7fda875c638c29195..21bb46b8fa73e5d40539e40e927f62b4002036a0 100644 (file)
@@ -752,7 +752,7 @@ If set, it overrides the setting of `mml2015-sign-with-sender'."
     (if (not key-image)
        ""
       (condition-case nil
-         (let ((result "  "))
+         (let ((result (copy-sequence "  ")))
            (put-text-property
             1 2 'display
             (gnus-rescale-image key-image
index 9ce31f11d91e7cdeb143a88765db7e2dce574f3e..5477473ae8cd0b32a812dae2333adca2a095d28c 100644 (file)
@@ -484,7 +484,7 @@ To get complete usage, invoke:
 (defmacro skkdic-set-postfix (&rest entries)
   `(defconst skkdic-postfix
      ',(let ((l entries)
-            (map '(nil))
+            (map (list nil))
             (longest 1)
             len entry)
         (while l
@@ -507,7 +507,7 @@ To get complete usage, invoke:
 (defmacro skkdic-set-prefix (&rest entries)
   `(defconst skkdic-prefix
      ',(let ((l entries)
-            (map '(nil))
+            (map (list nil))
             (longest 1)
             len entry)
         (while l
index 317ea8495de994c31c7d6c79cbdc53daa446aaad..894378bda8b950ce5d453e0c573de2c3680c525a 100644 (file)
@@ -804,13 +804,12 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
       (setq i (1+ i)))
 
     (let ((pos (point))
-         (bar "|")
+         (bar (propertize "|" 'face 'bold))
          lower upper row)
       ;; Make table without horizontal lines.  Each column for a key
       ;; has the form "| LU |" where L is for lower key and U is
       ;; for a upper key.  If width of L (U) is greater than 1,
       ;; preceding (following) space is not inserted.
-      (put-text-property 0 1 'face 'bold bar)
       (setq i 0)
       (while (< i quail-keyboard-layout-len)
        (when (= (% i 30) 0)
index c56f4ce62dca8fd662c7f271f45632cd322046b8..d07a1fda901cff485f62e9122a53cd31b6d1a03a 100644 (file)
@@ -2285,7 +2285,7 @@ significant attribute change was made."
             (insert value)))
       ;; Otherwise add a header line to record the attributes and set
       ;; all but this one to no.
-      (let ((header-value "--------"))
+      (let ((header-value (copy-sequence "--------")))
         (aset header-value attr value)
         (goto-char (if limit (1- limit) (point-max)))
         (setq altered (/= value ?-))
index 3eb2dd13cbc8b2fb07b7d46cb07d7c003085e9d5..910d534330cee25549037ffbacee3a2d92cc2ef0 100644 (file)
@@ -5142,7 +5142,7 @@ support symbolic links."
 
 (defun tramp-handle-memory-info ()
   "Like `memory-info' for Tramp files."
-  (let ((result '(0 0 0 0))
+  (let ((result (list 0 0 0 0))
         process-file-side-effects)
     (with-temp-buffer
       (cond
index 1552675f8a8ce9391f50fa08483233c7131a2a7b..4efa8ba68008cae4ffef13a6224dbbce9efde2bd 100644 (file)
@@ -1288,7 +1288,7 @@ so values can contain further %-escapes if they are define later in TABLE."
       (setq re (concat "%-?[0-9.]*" (substring (car e) 1)))
       (when (and (cdr e) (string-match re (cdr e)))
         (let ((sref (substring (cdr e) (match-beginning 0) (match-end 0)))
-              (safe "SREF"))
+              (safe (copy-sequence "SREF")))
           (add-text-properties 0 3 (list 'sref sref) safe)
           (setcdr e (replace-match safe t t (cdr e)))))
       (while (string-match re string)