From: Mattias EngdegÄrd Date: Wed, 24 May 2023 20:36:19 +0000 (+0200) Subject: Fix apparently wrong `delete` and `delq` value discards (bug#61730) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=af4791b5706f494d73fd00c391ff867fb2c5a06d;p=emacs.git Fix apparently wrong `delete` and `delq` value discards (bug#61730) * lisp/startup.el (normal-top-level): Update process-environment in case the DISPLAY variable comes first. Also stop iterating over initial-environment once the first DISPLAY is found. * lisp/allout.el (allout-get-configvar-values): * lisp/org/org.el (org-display-inline-remove-overlay): * lisp/progmodes/gdb-mi.el (gdb-get-location): * lisp/progmodes/idlwave.el (idlwave-convert-xml-clean-routine-aliases) (idlwave-convert-xml-clean-sysvar-aliases): * lisp/textmodes/reftex.el (reftex-ref-style-toggle): Update the base variable after performing a destructive deletion, where it was obvious that this was intended. --- diff --git a/lisp/allout.el b/lisp/allout.el index be2fd632c69..d3203800168 100644 --- a/lisp/allout.el +++ b/lisp/allout.el @@ -6307,7 +6307,7 @@ not its value." (if (yes-or-no-p (format-message "%s entry `%s' is unbound -- remove it? " configvar-name sym)) - (delq sym (symbol-value configvar-name))) + (set configvar-name (delq sym (symbol-value configvar-name)))) (push (symbol-value sym) got))) (reverse got))) ;;;_ : Topics: diff --git a/lisp/org/org.el b/lisp/org/org.el index d3e14fecec3..e42704778bd 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -16422,7 +16422,7 @@ buffer boundaries with possible narrowing." (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len) "Remove inline-display overlay if a corresponding region is modified." (when (and ov after) - (delete ov org-inline-image-overlays) + (setq org-inline-image-overlays (delete ov org-inline-image-overlays)) ;; Clear image from cache to avoid image not updating upon ;; changing on disk. See Emacs bug#59902. (when (overlay-get ov 'org-image-overlay) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 260b0270831..4428fa72c78 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -3244,7 +3244,8 @@ Place breakpoint icon in its buffer." (if (re-search-forward gdb-source-file-regexp nil t) (progn (setq source-file (gdb-mi--c-string-from-string (match-string 1))) - (delete (cons bptno "File not found") gdb-location-alist) + (setq gdb-location-alist + (delete (cons bptno "File not found") gdb-location-alist)) (push (cons bptno source-file) gdb-location-alist)) (gdb-resync) (unless (assoc bptno gdb-location-alist) diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el index cafd7b95da7..488e6aa3d2d 100644 --- a/lisp/progmodes/idlwave.el +++ b/lisp/progmodes/idlwave.el @@ -4653,7 +4653,7 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.") (setcar alias (car x)) (push alias idlwave-system-routines))) (cl-loop for x in remove-list do - (delq x idlwave-system-routines)))) + (setq idlwave-system-routines (delq x idlwave-system-routines))))) (defun idlwave-convert-xml-clean-sysvar-aliases (aliases) ;; Duplicate and trim original routine aliases from rinfo list @@ -4666,7 +4666,8 @@ Gets set in cached XML rinfo, or `idlw-rinfo.el'.") (setcar alias (car x)) (push alias idlwave-system-variables-alist))) (cl-loop for x in remove-list do - (delq x idlwave-system-variables-alist)))) + (setq idlwave-system-variables-alist + (delq x idlwave-system-variables-alist))))) (defun idlwave-xml-create-sysvar-alist (xml-entry) diff --git a/lisp/startup.el b/lisp/startup.el index 9ae53f4e50b..835ad785af1 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -837,12 +837,16 @@ It is the default value of the variable `top-level'." (let ((display (frame-parameter nil 'display))) ;; Be careful which DISPLAY to remove from process-environment: follow ;; the logic of `callproc.c'. - (if (stringp display) (setq display (concat "DISPLAY=" display)) - (dolist (varval initial-environment) - (if (string-match "\\`DISPLAY=" varval) - (setq display varval)))) + (if (stringp display) + (setq display (concat "DISPLAY=" display)) + (let ((env initial-environment)) + (while (and env (or (not (string-match "\\`DISPLAY=" (car env))) + (progn + (setq display (car env)) + nil))) + (setq env (cdr env))))) (when display - (delete display process-environment)))) + (setq process-environment (delete display process-environment))))) (startup--honor-delayed-native-compilations)) ;; Precompute the keyboard equivalents in the menu bar items. diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 57284db36b1..916e0d89a1d 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -477,9 +477,9 @@ will deactivate it." changed t) (setq list (delete style list)))) (t - (if (member style list) - (delete style list) - (setq list (append list (list style)))) + (setq list (if (member style list) + (delete style list) + (append list (list style)))) (setq reftex-tables-dirty t changed t))) (when changed