]> git.eshelyaron.com Git - emacs.git/commitdiff
Use with-environment-variables in more places
authorStefan Kangas <stefankangas@gmail.com>
Fri, 27 Dec 2024 04:02:55 +0000 (05:02 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:45:06 +0000 (16:45 +0100)
* lisp/gnus/gnus-search.el (gnus-search-run-search):
* lisp/man.el (Man-completion-table):
* lisp/progmodes/cperl-mode.el (cperl-pod-to-manpage):
* test/src/fileio-tests.el (fileio-tests--relative-HOME):
Prefer 'with-environment-variables'.

(cherry picked from commit 4f942b4994df82b9ba7ee10a75008b2338e38fc3)

lisp/gnus/gnus-search.el
lisp/man.el
lisp/progmodes/cperl-mode.el
test/src/fileio-tests.el

index c25163ac7709377af780d0862d252e5bcffec0a2..30f971721f74379ce8fa287d91780ee47d5f0126 100644 (file)
@@ -1591,8 +1591,7 @@ fudges a relevancy score of 100."
 ;; I can't tell if this is actually necessary.
 (cl-defmethod gnus-search-run-search :around ((_e gnus-search-namazu)
                                              _server _query _groups)
-  (let ((process-environment (copy-sequence process-environment)))
-    (setenv "LC_MESSAGES" "C")
+  (with-environment-variables (("LC_MESSAGES" "C"))
     (cl-call-next-method)))
 
 (cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-namazu)
index 4b20aec1bbfc135cf6645592d68e52d85ab95d29..f7bbe9e8ce24f343045b79ebb68095120d4a1989 100644 (file)
@@ -1019,8 +1019,8 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
           ;; whereas under macOS it seems to be BRE-style and doesn't
           ;; accept backslashes at all.  Let's not bother to
           ;; quote anything.
-          (let ((process-environment (copy-sequence process-environment)))
-            (setenv "COLUMNS" "999") ;; don't truncate long names
+          (with-environment-variables
+              (("COLUMNS" "999"))       ; don't truncate long names
             ;; manual-program might not even exist.  And since it's
             ;; run differently in Man-getpage-in-background, an error
             ;; here may not necessarily mean that we'll also get an
index f8e565eb8f7bc262cb78480ea6c80f9c3b9ad2e9..ba78f66c652e4ee942fc4c303b4ab1192a8537f4 100644 (file)
@@ -9094,9 +9094,8 @@ the appropriate statement modifier."
         (bufname (concat "Man " buffer-file-name))
         (buffer (generate-new-buffer bufname)))
     (with-current-buffer buffer
-      (let ((process-environment (copy-sequence process-environment)))
-        ;; Prevent any attempt to use display terminal fanciness.
-        (setenv "TERM" "dumb")
+      ;; Prevent any attempt to use display terminal fanciness.
+      (with-environment-variables (("TERM" "dumb"))
         (set-process-sentinel
          (start-process pod2man-program buffer "sh" "-c"
                         (format (cperl-pod2man-build-command) pod2man-args))
index 750de8444c9a29670b49734046eefe9d14271720..29177fee7ad62482bccc7994e8ce2c59e1fc6373 100644 (file)
@@ -100,8 +100,7 @@ Also check that an encoding error can appear in a symlink."
 
 (ert-deftest fileio-tests--relative-HOME ()
   "Test that `expand-file-name' works even when HOME is relative."
-  (let ((process-environment (copy-sequence process-environment)))
-    (setenv "HOME" "a/b/c")
+  (with-environment-variables (("HOME" "a/b/c"))
     (should (equal (expand-file-name "~/foo")
                    (expand-file-name "a/b/c/foo")))
     (when (memq system-type '(ms-dos windows-nt))