]> git.eshelyaron.com Git - emacs.git/commitdiff
Use 'alist-set' where appropriate
authorEshel Yaron <me@eshelyaron.com>
Tue, 7 Jan 2025 19:06:17 +0000 (20:06 +0100)
committerEshel Yaron <me@eshelyaron.com>
Tue, 7 Jan 2025 19:06:17 +0000 (20:06 +0100)
25 files changed:
lisp/files.el
lisp/frameset.el
lisp/gnus/gnus-agent.el
lisp/gnus/gnus-group.el
lisp/gnus/gnus-search.el
lisp/gnus/nnmaildir.el
lisp/gnus/nnselect.el
lisp/kmacro.el
lisp/mouse.el
lisp/net/rcirc.el
lisp/org/org-persist.el
lisp/progmodes/elisp-mode.el
lisp/progmodes/flymake.el
lisp/progmodes/gud.el
lisp/progmodes/refactor-elisp.el
lisp/register.el
lisp/tab-bar.el
lisp/tempo.el
lisp/textmodes/tex-mode.el
lisp/tooltip.el
lisp/transient.el
lisp/treesit.el
lisp/tty-tip.el
lisp/winner.el
lisp/yank-media.el

index 0e9fe928576091d0acf2230fe2eccab272b5ef5c..b4f24bf4d57f52acfe5bfe35d8bf113183c52fc1 100644 (file)
@@ -4701,7 +4701,7 @@ VARIABLES list of the class.  The list is processed in order.
 * If the element is of the form (DIRECTORY . LIST), and DIRECTORY
   is an initial substring of the file's directory, then LIST is
   applied by recursively following these rules."
-  (setf (alist-get class dir-locals-class-alist) variables))
+  (alist-set class dir-locals-class-alist variables))
 
 (defconst dir-locals-file ".dir-locals.el"
   "File that contains directory-local variables.
index a3d53e45492f652db2664e0c3a74711462ab2221..73f6137672ece1f0bf0bdfe9314e9bf358e3c592 100644 (file)
@@ -702,7 +702,7 @@ nil while the filtering is done to restore it."
     ;; Set the display parameter after filtering, so that filter functions
     ;; have access to its original value.
     (when frameset--target-display
-      (setf (alist-get 'display filtered) (cdr frameset--target-display)))
+      (alist-set 'display filtered (cdr frameset--target-display)))
     filtered))
 
 \f
@@ -1035,9 +1035,9 @@ Internal use only."
     (let ((text-pixel-width (cdr (assq 'frameset--text-pixel-width parameters)))
           (text-pixel-height (cdr (assq 'frameset--text-pixel-height parameters))))
       (when text-pixel-width
-        (setf (alist-get 'width filtered-cfg) (cons 'text-pixels text-pixel-width)))
+        (alist-set 'width filtered-cfg (cons 'text-pixels text-pixel-width)))
       (when text-pixel-height
-        (setf (alist-get 'height filtered-cfg) (cons 'text-pixels text-pixel-height))))
+        (alist-set 'height filtered-cfg (cons 'text-pixels text-pixel-height))))
 
     (when fullscreen
       ;; Currently Emacs has the limitation that it does not record the size
index 73f636b5992c6d8032b89f82240c4914516eec05..f61e8bcfa1ca38c5db5760f7f8adc3d0961c2ee2 100644 (file)
@@ -2724,12 +2724,12 @@ The following commands are available:
                         old-list)))))))
           ;; Possibly decode group names.
           (dolist (cat list)
-            (setf (alist-get 'agent-groups cat)
-                  (mapcar (lambda (g)
-                            (if (string-match-p "[^[:ascii:]]" g)
-                                (decode-coding-string g 'utf-8-emacs)
-                              g))
-                          (alist-get 'agent-groups cat))))
+            (alist-set 'agent-groups cat
+                       (mapcar (lambda (g)
+                                 (if (string-match-p "[^[:ascii:]]" g)
+                                     (decode-coding-string g 'utf-8-emacs)
+                                   g))
+                               (alist-get 'agent-groups cat))))
           list)
          (list (gnus-agent-cat-make 'default 'short)))))
 
@@ -2741,12 +2741,13 @@ The following commands are available:
   ;; pending an upgrade of Gnus' file formats.
   (let ((gnus-category-alist
         (mapcar (lambda (cat)
-                  (setf (alist-get 'agent-groups cat)
-                        (mapcar (lambda (g)
-                                  (if (multibyte-string-p g)
-                                      (encode-coding-string g 'utf-8-emacs)
-                                    g))
-                                (alist-get 'agent-groups cat)))
+                  (alist-set
+                    'agent-groups cat
+                   (mapcar (lambda (g)
+                             (if (multibyte-string-p g)
+                                 (encode-coding-string g 'utf-8-emacs)
+                               g))
+                           (alist-get 'agent-groups cat)))
                   cat)
                 (copy-tree gnus-category-alist))))
    (gnus-make-directory (nnheader-concat gnus-agent-directory "lib"))
index 5b1fa0385553af87da170f3d5a8bbb3cff0cf916..9156b7f5a1c71dc47fb4aa275b06879c605688ca 100644 (file)
@@ -3177,7 +3177,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and
        ;; If our query came via an old call to nnir, we know not to
        ;; parse the query.
        (when (assq 'nnir-query-spec specs)
-         (setf (alist-get 'raw query-spec) t))
+         (alist-set 'raw query-spec t))
        (gnus-group-make-group
         name
         (list 'nnselect "nnselect")
@@ -3231,7 +3231,7 @@ non-nil SPECS arg must be an alist with `search-query-spec' and
     ;; If our query came via an old call to nnir, we know not to parse
     ;; the query.
     (when (assq 'nnir-query-spec specs)
-      (setf (alist-get 'raw query-spec) t))
+      (alist-set 'raw query-spec t))
     (gnus-group-read-ephemeral-group
      (concat "nnselect-" (message-unique-id))
      (list 'nnselect "nnselect")
index 6cce9af87ff1be676fd64cc47053dadd5840021c..56732ea78266c6fc71dc9e73eeb0a31c0ef22dd1 100644 (file)
@@ -2114,20 +2114,20 @@ remaining string, then adds all that to the top-level spec."
              "\\(thread\\|grep\\|limit\\|raw\\):\\([^ ]+\\)"
              query)
        (setq val (match-string 2 query))
-       (setf (alist-get (intern (match-string 1 query)) query-spec)
-             ;; This is stupid.
-             (cond
-              ((equal val "t"))
-              ((null (zerop (string-to-number val)))
-               (string-to-number val))
-              (t val)))
+       (alist-set (intern (match-string 1 query)) query-spec
+                  ;; This is stupid.
+                  (cond
+                   ((equal val "t"))
+                   ((null (zerop (string-to-number val)))
+                    (string-to-number val))
+                   (t val)))
        (setq query
              (string-trim (replace-match "" t t query 0)))
-       (setf (alist-get 'query query-spec) query)))
+       (alist-set 'query query-spec query)))
     (when (and gnus-search-use-parsed-queries
               (null (alist-get 'raw query-spec)))
-      (setf (alist-get 'parsed-query query-spec)
-           (gnus-search-parse-query query)))
+      (alist-set 'parsed-query query-spec
+                (gnus-search-parse-query query)))
     query-spec))
 
 ;; This should be done once at Gnus startup time, when the servers are
index 3fb87f3a712418177cddfc7dde1f89b867ce17bb..7f40b46f38d0d86577df1c1841be930c2bd14493 100644 (file)
@@ -678,9 +678,7 @@ This variable is set by `nnmaildir-request-article'.")
               (throw 'return t))
        (setq server (make-nnmaildir--srv :address server-string))
        (let ((inhibit-quit t))
-         (setf (alist-get server-string nnmaildir--servers
-                          nil nil #'equal)
-               server)))
+         (alist-set server-string nnmaildir--servers server #'equal)))
       (setq dir (assq 'directory defs))
       (unless dir
        (setf (nnmaildir--srv-error server)
index 19d3936777f1dd7b920d75ebe320b1644b476c12..ca6305690afdfa9e5d7e3fde64fda68135681544 100644 (file)
@@ -669,8 +669,8 @@ group info."
       (pcase-dolist (`(,type . ,mark-list) newmarks)
         (let ((mark-type (gnus-article-mark-to-type type)))
           (unless (eq mark-type 'tuple)
-            (setf (alist-get type newmarks)
-                  (gnus-compress-sequence (sort mark-list #'<))))))
+            (alist-set type newmarks
+                       (gnus-compress-sequence (sort mark-list #'<))))))
       ;; and ensure an unexist key.
       (unless (assq 'unexist newmarks)
         (push (cons 'unexist nil) newmarks))
index 893db781d6e809b4adb5c53c89016c49d7e84ef0..53029fdc19511631bd71dfc0bf218522a8565b00 100644 (file)
@@ -1705,9 +1705,9 @@ Marked macros can be operated on by `kmacro-menu-do-copy' and
   (kmacro-menu--query-revert)
   (kmacro-menu--do-region
    (lambda (id)
-     (setf (alist-get (kmacro-menu--id-position id)
-                      kmacro-menu--marks)
-           t)
+     (alist-set (kmacro-menu--id-position id)
+                kmacro-menu--marks
+                t)
      (kmacro-menu--propertize-keys 'kmacro-menu-marked)
      (tabulated-list-put-tag #("*" 0 1 (face kmacro-menu-mark))))))
 
@@ -1724,9 +1724,9 @@ Flagged macros can be deleted via `kmacro-menu-do-flagged-delete'."
   (kmacro-menu--query-revert)
   (kmacro-menu--do-region
    (lambda (id)
-     (setf (alist-get (kmacro-menu--id-position id)
-                      kmacro-menu--deletion-flags)
-           t)
+     (alist-set (kmacro-menu--id-position id)
+                kmacro-menu--deletion-flags
+                t)
      (kmacro-menu--propertize-keys 'kmacro-menu-flagged)
      (tabulated-list-put-tag #("D" 0 1 (face kmacro-menu-mark))))))
 
index 2e9862852d2233921fb212cded5e623c9f4c077e..2574b9da0f7f7b2b34a19d6147c663078d645a20 100644 (file)
@@ -3156,10 +3156,10 @@ Call `tooltip-show-help-non-mode' instead on non-graphical displays."
            (fg (face-attribute 'tooltip :foreground))
            (bg (face-attribute 'tooltip :background)))
        (when (stringp fg)
-         (setf (alist-get 'foreground-color params) fg)
-         (setf (alist-get 'border-color params) fg))
+         (alist-set 'foreground-color params fg)
+         (alist-set 'border-color params fg))
        (when (stringp bg)
-         (setf (alist-get 'background-color params) bg))
+         (alist-set 'background-color params bg))
         ;; Don't time out: this leads to very confusing behavior when
         ;; Emacs isn't visible, and the only indication that the user
         ;; is actually dragging something abruptly disappears.
index a1d8c655c3e71b96450059d34ce4350b5942bc6b..3bc4006cfda3aad5a753f4a298e834202e969266 100644 (file)
@@ -3800,8 +3800,8 @@ object for the current connection."
        ((= (aref (car args) 0) ?+)      ;start a new batch
         (when (assoc id rcirc-batch-attributes)
           (error "Starting batch with already used ID"))
-        (setf (alist-get id rcirc-batch-attributes nil nil #'string=)
-              (cons type (cddr args))))
+        (alist-set id rcirc-batch-attributes (cons type (cddr args))
+                   #'string=))
        ((= (aref (car args) 0) ?-)      ;close a batch
         (unless (assoc id rcirc-batch-attributes)
           (error "Closing a unknown batch"))
index 2d91f34e839c850e8f04de1569f9344c3a8ef1db..deab2544cbd7106e79c8557e838a4035992b329d 100644 (file)
@@ -1226,8 +1226,8 @@ Remove expired sessions timestamps."
   (let* ((file (org-file-name-concat org-persist-directory org-persist-gc-lock-file))
          (alist (when (file-exists-p file) (org-persist--read-elisp-file file)))
          new-alist)
-    (setf (alist-get before-init-time alist nil nil #'equal)
-          (current-time))
+    (alist-set before-init-time alist (current-time)
+               #'equal)
     (dolist (record alist)
       (when (< (- (float-time (cdr record)) (float-time (current-time)))
                org-persist-gc-lock-expiry)
index d7c5d2a80a7ddaea43a2b02284120300e3e10e13..82c92593d2ad5bd3527ae4a31eabbacffcf8417d 100644 (file)
@@ -1044,7 +1044,7 @@ namespace but with lower confidence."
       (scope (lambda (_type beg len bin)
                (when (<= beg pos (+ beg len))
                  (setq cur bin))
-               (when bin (setf (alist-get beg all) (list len bin))))
+               (when bin (alist-set beg all (list len bin))))
              (current-buffer)))
     (seq-keep
      (pcase-lambda (`(,sym ,len ,bin)) (when (equal bin cur) (cons sym len)))
index 3ab48b0a5422ffbb1357daa6013c2e41fb368de3..9ec7a7b59f0ac63bfb18197445d5377ca5c5b4de 100644 (file)
@@ -1998,8 +1998,8 @@ correctly.")
 TYPE is usually keyword `:error', `:warning' or `:note'."
   (let ((probe (alist-get type flymake--mode-line-counter-cache 'none)))
     (if (eq probe 'none)
-        (setf (alist-get type flymake--mode-line-counter-cache)
-            (flymake--mode-line-counter-1 type))
+        (alist-set type flymake--mode-line-counter-cache
+                   (flymake--mode-line-counter-1 type))
       probe)))
 
 ;;; Per-buffer diagnostic listing
index d8ec1c8872b604aece76edcf93fb118d0de0f661..dd8e7608aefe20d3d3f77d5f414dcee59a8c1f03 100644 (file)
@@ -303,8 +303,7 @@ Check it when `gud-running' is t")
      :button (:toggle . gud-tooltip-mode)]
     ["Info (debugger)" gud-goto-info]))
 
-(setf (alist-get 'gud-minor-mode minor-mode-map-alist)
-      gud-minor-mode-map)
+(alist-set 'gud-minor-mode minor-mode-map-alist gud-minor-mode-map)
 
 (defvar gud-tool-bar-map
   (let ((map (make-sparse-keymap)))
index a747ecc761f87f75b8d1c990923f72b2c86e9a52..10ecab64925af62ceb4ea1740e5c016c933f3a2b 100644 (file)
@@ -62,7 +62,7 @@
            (let (res)
              (pcase-dolist (`(,beg ,len ,bin) all)
                (when (equal bin dec)
-                 (setf (alist-get beg res) (list (+ beg len) new))))
+                 (alist-set beg res (list (+ beg len) new))))
              res)))))
 
 (cl-defmethod refactor-backend-rename-highlight-regions
@@ -81,7 +81,7 @@
       (let (res)
         (pcase-dolist (`(,beg ,len ,bin) all)
           (when (equal bin dec)
-            (setf (alist-get beg res) (+ beg len))))
+            (alist-set beg res (+ beg len))))
         res))))
 
 (provide 'refactor-elisp)
index f11ab31c661b7f5add061f65142d73dc5f56bce6..fe8dbe110002e49350bf28deb3249805dce317d1 100644 (file)
@@ -127,7 +127,7 @@ argument of that function."
 (defun set-register (register value)
   "Set contents of Emacs register named REGISTER to VALUE.  Return VALUE.
 See the documentation of the variable `register-alist' for possible VALUEs."
-  (setf (alist-get register register-alist) value))
+  (alist-set register register-alist value))
 
 (defun register-describe-oneline (c)
   "Return a one-line description of register C."
index b1c6e793a103e21c00d4b42250f399d3f623f852..400c7a4a744431953f81d9b340810b104e53e1b1 100644 (file)
@@ -133,11 +133,11 @@ For easier selection of tabs by their numbers, consider customizing
   (when (and (memq 'tab-bar-format-global tab-bar-format)
              (member '(global-mode-string ("" global-mode-string))
                      mode-line-misc-info))
-    (setf (alist-get 'global-mode-string mode-line-misc-info)
-          '(("" (:eval (if (and tab-bar-mode
-                                (memq 'tab-bar-format-global
-                                      tab-bar-format))
-                           "" global-mode-string)))))))
+    (alist-set 'global-mode-string mode-line-misc-info
+               '(("" (:eval (if (and tab-bar-mode
+                                     (memq 'tab-bar-format-global
+                                           tab-bar-format))
+                                "" global-mode-string)))))))
 
 (defun tab-bar--undefine-keys ()
   "Uninstall key bindings previously bound by `tab-bar--define-keys'."
index 9849fe1271194fe5839ad3fe68ef1d428e4a0ea8..1fb9b3b172c93a02fc405cbb5c43172f69d0c783 100644 (file)
@@ -586,7 +586,7 @@ function or string that is used by \\[tempo-complete-tag] to find a
 string to match the tag against.  It has the same definition as the
 variable `tempo-match-finder'.  In this version, supplying a
 COMPLETION-FUNCTION just sets `tempo-match-finder' locally."
-  (setf (alist-get tag-list tempo-local-tags) completion-function)
+  (alist-set tag-list tempo-local-tags completion-function)
   (if completion-function
       (setq tempo-match-finder completion-function))
   (tempo-invalidate-collection))
index 8ab387d6180e9218f7a836cec6d8f848ca714209..a112cfc11792e8ae3aa23f216c6d54a450ed67ad 100644 (file)
@@ -3968,8 +3968,7 @@ There might be text before point."
                                      extlist-new)))
                      ((push finext extlist-new)))))
         (unless (seq-set-equal-p extlist-new extlist)
-          (setf (alist-get mode grep-filepattern-alist)
-                extlist-new))))
+          (alist-set mode grep-filepattern-alist extlist-new))))
     (let* (setsyntax
            (punct (with-syntax-table (tex-find-references-syntax-table)
                     (seq-positions identifier (list ?w ?_)
index a198a3d8d08d23cb98e429fca26b12496b0baa0b..072a8c41ae2d22565929fa4f5dbb2b7cef42c986 100644 (file)
@@ -258,10 +258,10 @@ toolkit."
              (fg (face-attribute (or default-face 'tooltip) :foreground))
              (bg (face-attribute (or default-face 'tooltip) :background)))
          (when (stringp fg)
-           (setf (alist-get 'foreground-color params) fg)
-           (setf (alist-get 'border-color params) fg))
+           (alist-set 'foreground-color params fg)
+           (alist-set 'border-color params fg))
          (when (stringp bg)
-           (setf (alist-get 'background-color params) bg))
+           (alist-set 'background-color params bg))
           ;; Use non-nil APPEND argument below to avoid overriding any
           ;; faces used in our TEXT.  Among other things, this allows
           ;; tooltips to use the `help-key-binding' face used in
index bf64dd94e19eaf1916f063edf9f2c7cbb14ed8cd..6612012872960339b06ee258c244e4cdec223ad6 100644 (file)
@@ -3120,8 +3120,8 @@ For example:
                                             (eq (oref obj command) command))
                                           transient--suffixes))
                (setq akey (cons command (this-command-keys))))))
-      (setf (alist-get akey alist) level)
-      (setf (alist-get prefix transient-levels) alist))
+      (alist-set akey alist level)
+      (alist-set prefix transient-levels alist))
     (transient-save-levels)
     (transient--show))
    (t
@@ -3435,8 +3435,8 @@ it\", in which case it is pointless to preserve history.)"
                      (stringp (car transient--history)))
             (set-text-properties 0 (length (car transient--history)) nil
                                  (car transient--history)))
-          (setf (alist-get history-key transient-history)
-                (delete-dups transient--history)))
+          (alist-set history-key transient-history
+                     (delete-dups transient--history)))
         value))))
 
 (cl-defmethod transient-infix-read ((obj transient-switch))
@@ -3607,7 +3607,7 @@ See also `transient-prefix-set'.")
 (cl-defmethod transient-save-value ((obj transient-prefix))
   (let ((value (transient-get-value)))
     (oset (oref obj prototype) value value)
-    (setf (alist-get (oref obj command) transient-values) value)
+    (alist-set (oref obj command) transient-values value)
     (transient-save-values))
   (transient--history-push obj))
 
@@ -3842,9 +3842,9 @@ Otherwise return the value of the `command' slot."
 
 (cl-defmethod transient--history-push ((obj transient-prefix))
   (let ((key (transient--history-key obj)))
-    (setf (alist-get key transient-history)
-          (let ((args (transient-get-value)))
-            (cons args (delete args (alist-get key transient-history)))))))
+    (alist-set key transient-history
+               (let ((args (transient-get-value)))
+                 (cons args (delete args (alist-get key transient-history)))))))
 
 (cl-defgeneric transient--history-init (obj)
   "Initialize OBJ's `history' slot.
@@ -3957,9 +3957,9 @@ have a history of their own.")
       (pcase-let ((`(,height ,width)
                    (buffer-line-statistics transient--buffer))
                   (params (assq 'pop-up-frame-parameters (cdr action))))
-        (setf (alist-get 'height params) height)
-        (setf (alist-get 'width params)
-              (max width (or transient-minimal-frame-width 0)))))
+        (alist-set 'height params height)
+        (alist-set 'width params
+                   (max width (or transient-minimal-frame-width 0)))))
     action))
 
 (defun transient--fit-window-to-buffer (window)
index 99368a4db8371c1872052d41212ffd293aa539ae..3e6a109b60522dad88975360198307563a11baa9 100644 (file)
@@ -3284,8 +3284,9 @@ meaning the order of elements are kept."
               (alist-get category return-entries nil nil #'equal)))
         (if (not existing-entries)
             (push entry return-entries)
-          (setf (alist-get category return-entries nil nil #'equal)
-                (append existing-entries sub-entries)))))
+          (alist-set category return-entries
+                     (append existing-entries sub-entries)
+                     #'equal))))
     (nreverse return-entries)))
 
 (defun treesit--generate-simple-imenu (node settings)
@@ -4241,8 +4242,7 @@ nil, the grammar is installed to the standard location, the
                                     (cdr err))
                             " ")))
                 ;; If success, Save the recipe for the current session.
-                (setf (alist-get lang treesit-language-source-alist)
-                      (cdr recipe)))))
+                (alist-set lang treesit-language-source-alist (cdr recipe)))))
         (error
          (display-warning
           'treesit
index e02efdfd359862e297d22942f9e842526636fbf8..988b255016d461dca8c19241a5e38c74f579930d 100644 (file)
@@ -94,9 +94,9 @@
         (fg (face-attribute 'tooltip :foreground))
         (bg (face-attribute 'tooltip :background)))
     (when (stringp fg)
-      (setf (alist-get 'foreground-color params) fg))
+      (alist-set 'foreground-color params fg))
     (when (stringp bg)
-      (setf (alist-get 'background-color params) bg))
+      (alist-set 'background-color params bg))
     params))
 
 (defvar tty-tip--help-message nil)
index 7fdf3b65fbaf5f3da06f03e01576c72967902d11..4e279504c09acbe407cc45f91db5a53a0884c68d 100644 (file)
@@ -97,7 +97,7 @@ You may want to include buffer names such as *Help*, *Buffer List*,
 ;; Save current configuration.
 ;; (Called below by `winner-save-old-configurations').
 (defun winner-remember ()
-  (setf (alist-get (selected-frame) winner-currents) (winner-conf)))
+  (alist-set (selected-frame) winner-currents (winner-conf)))
 
 ;; Consult `winner-currents'.
 (defun winner-configuration (&optional frame)
index 62f5b34355a6e26a9d4a36a28e6315c64c989d70..8929181df83c7cd4e0de6095a6b95b0b3ebd3818 100644 (file)
@@ -102,8 +102,7 @@ MIME type (a symbol of the form `image/png') and the selection
 data (a string)."
   (make-local-variable 'yank-media--registered-handlers)
   (dolist (type (ensure-list types))
-    (setf (alist-get type yank-media--registered-handlers nil nil #'equal)
-          handler)))
+    (alist-set type yank-media--registered-handlers handler #'equal)))
 
 (defun yank-media-types (&optional all)
   "Yank any element present in the primary selection or the clipboard.