Subject: bug#40671: [DOC] modify literal objects

From: Paul Eggert <[email-masked]>
Date: Sun, 10 May 2020 23:28:23 -0700

On 5/10/20 9:51 PM, Michael Heerdegen wrote:
> BTW (also @Paul) there are some places (five or so) in Elisp source
> files that look like
> 
>   (nconc '(x y z) (get-some-list))
> 
> Should they be rewritten?

Yes, of course. Does the attached diff (against master) match what you found?
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 4f72251aed..fd6c6fe1ad 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1509,14 +1509,13 @@ byte-compile-side-effect-and-error-free-ops
     byte-current-buffer byte-stack-ref))
 
 (defconst byte-compile-side-effect-free-ops
-  (nconc
-   '(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref
-     byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1
-     byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate
-     byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax
-     byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt
-     byte-member byte-assq byte-quo byte-rem byte-substring)
-   byte-compile-side-effect-and-error-free-ops))
+  `(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref
+    byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1
+    byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate
+    byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax
+    byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt
+    byte-member byte-assq byte-quo byte-rem byte-substring
+    ,@byte-compile-side-effect-and-error-free-ops))
 
 ;; This crock is because of the way DEFVAR_BOOL variables work.
 ;; Consider the code
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 10c6914f52..5850561928 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -396,17 +396,17 @@ frameset-prop
 ;; or, if you're only changing a few items,
 ;;
 ;;   (defvar my-filter-alist
-;;     (nconc '((my-param1 . :never)
-;;              (my-param2 . my-filtering-function))
-;;            frameset-filter-alist)
+;;     `((my-param1 . :never)
+;;       (my-param2 . my-filtering-function)
+;;       ,@frameset-filter-alist)
 ;;     "My brief customized parameter filter alist.")
 ;;
 ;; and pass it to the FILTER arg of the save/restore functions,
 ;; ALWAYS taking care of not modifying the original lists; if you're
 ;; going to do any modifying of my-filter-alist, please use
 ;;
-;;   (nconc '((my-param1 . :never) ...)
-;;          (copy-sequence frameset-filter-alist))
+;;   `(((my-param1 . :never) ...)
+;;     ,@(copy-sequence frameset-filter-alist))
 ;;
 ;; One thing you shouldn't forget is that they are alists, so searching
 ;; in them is sequential.  If you just want to change the default of
@@ -445,39 +445,38 @@ frameset-session-filter-alist
 
 ;;;###autoload
 (defvar frameset-persistent-filter-alist
-  (nconc
-   '((background-color            . frameset-filter-sanitize-color)
-     (buffer-list                 . :never)
-     (buffer-predicate            . :never)
-     (buried-buffer-list          . :never)
-     ;; Don't save the 'client' parameter to avoid that a subsequent
-     ;; `save-buffers-kill-terminal' in a non-client session barks at
-     ;; the user (Bug#29067).
-     (client                      . :never)
-     (delete-before               . :never)
-     (font                        . frameset-filter-font-param)
-     ;; Don't save font-backend because we cannot guarantee the new
-     ;; session will support the saved backend anyway.  (Bug#38442)
-     (font-backend                . :never)
-     (foreground-color            . frameset-filter-sanitize-color)
-     (frameset--text-pixel-height . :save)
-     (frameset--text-pixel-width  . :save)
-     (fullscreen                  . frameset-filter-shelve-param)
-     (GUI:font                    . frameset-filter-unshelve-param)
-     (GUI:fullscreen              . frameset-filter-unshelve-param)
-     (GUI:height                  . frameset-filter-unshelve-param)
-     (GUI:width                   . frameset-filter-unshelve-param)
-     (height                      . frameset-filter-shelve-param)
-     (outer-window-id             . :never)
-     (parent-frame                . :never)
-     (parent-id                   . :never)
-     (mouse-wheel-frame           . :never)
-     (tty                         . frameset-filter-tty-to-GUI)
-     (tty-type                    . frameset-filter-tty-to-GUI)
-     (width                       . frameset-filter-shelve-param)
-     (window-id                   . :never)
-     (window-system               . :never))
-   frameset-session-filter-alist)
+  `((background-color            . frameset-filter-sanitize-color)
+    (buffer-list                 . :never)
+    (buffer-predicate            . :never)
+    (buried-buffer-list          . :never)
+    ;; Don't save the 'client' parameter to avoid that a subsequent
+    ;; `save-buffers-kill-terminal' in a non-client session barks at
+    ;; the user (Bug#29067).
+    (client                      . :never)
+    (delete-before               . :never)
+    (font                        . frameset-filter-font-param)
+    ;; Don't save font-backend because we cannot guarantee the new
+    ;; session will support the saved backend anyway.  (Bug#38442)
+    (font-backend                . :never)
+    (foreground-color            . frameset-filter-sanitize-color)
+    (frameset--text-pixel-height . :save)
+    (frameset--text-pixel-width  . :save)
+    (fullscreen                  . frameset-filter-shelve-param)
+    (GUI:font                    . frameset-filter-unshelve-param)
+    (GUI:fullscreen              . frameset-filter-unshelve-param)
+    (GUI:height                  . frameset-filter-unshelve-param)
+    (GUI:width                   . frameset-filter-unshelve-param)
+    (height                      . frameset-filter-shelve-param)
+    (outer-window-id             . :never)
+    (parent-frame                . :never)
+    (parent-id                   . :never)
+    (mouse-wheel-frame           . :never)
+    (tty                         . frameset-filter-tty-to-GUI)
+    (tty-type                    . frameset-filter-tty-to-GUI)
+    (width                       . frameset-filter-shelve-param)
+    (window-id                   . :never)
+    (window-system               . :never)
+    ,@frameset-session-filter-alist)
   "Parameters to filter for persistent framesets.
 DO NOT MODIFY.  See `frameset-filter-alist' for a full description.")
 
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 6f367692dd..595df607f5 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1501,9 +1501,9 @@ gnus-summary-mode-line-format-alist
 
 ;; This is here rather than in gnus-art for compilation reasons.
 (defvar gnus-article-mode-line-format-alist
-  (nconc '((?w (gnus-article-wash-status) ?s)
-	   (?m (gnus-article-mime-part-status) ?s))
-	 gnus-summary-mode-line-format-alist))
+  (nconc `((?w (gnus-article-wash-status) ?s)
+	   (?m (gnus-article-mime-part-status) ?s)
+	   ,@gnus-summary-mode-line-format-alist)))
 
 (defvar gnus-last-search-regexp nil
   "Default regexp for article search command.")