* 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)
;; 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)
;; 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
(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))
(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))