[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58137: 28.1; M-x setenv RET PATH RET should default to the current $
From: |
Stefan Kangas |
Subject: |
bug#58137: 28.1; M-x setenv RET PATH RET should default to the current $PATH |
Date: |
Wed, 28 Sep 2022 09:35:50 -0400 |
tags 58137 + moreinfo
thanks
"Trent W. Buck" <trentbuck@gmail.com> writes:
> I wish M-x setenv, when setting a variable that already has a value,
> defaulted to that value (instead of the empty string).
>
> This would make it easier to make minor adjustments to a long messy value.
> The history is already there (M-p), but it's input history.
AFAICT, M-p already brings in the previous value of the variable, if it
was set:
(let* ((var (read-envvar-name "Set environment variable: " nil))
(value (getenv var)))
(when value
(add-to-history 'setenv-history value))
;; Here finally we specify the args to give call setenv with.
(list var
(read-from-minibuffer (format "Set %s to value: " var)
nil nil nil 'setenv-history
value)
t))))
> If the variable was initially set outside of Emacs, it won't be in history.
Do you have a recipe to reproduce this?
What is the value of (getenv "FOO") before you run `M-x setenv'?