Let's say, If I have a directory variable named a-directory
with its value. Also I have another variable named b-directory
which gets its value from the previous variable.
(setq a-directory "C:/Users/Paper")
(setq b-directory (expand-file-name "org-mode.org" a-directory))
Every time when I change the value of a-directory
, I need to eval
the b-directory
again to get its new value. So here comes the question: How can I get the updated value without evaling b-directory
when changing the value of a-directory
?
b-directory
could be a function:(defun b-directory () (expand-file-name "org-mode.org" a-directory))
- in this case it will evaluate the expression every time (slight overhead), but will be always up to date. – wvxvw May 22 '16 at 5:30a-directory
directly throughsetq
but from achange-a-directory
function that would update botha-directory
andb-directory
. – JeanPierre May 22 '16 at 7:38