I have these code snippet in scratch buffer
(defun sd/test ()
"fjoefjei"
(interactive)
(print (current-buffer))
(setq-local default-directory "~/"))
(setq-local default-directory "~/temp")
(pwd)
I try to test using the function sd/test() to change to default-directory of current buffer.
The problem is that when I called the command sd/test from counsel-M-x, this function not works as expected. the default-directory isn't changed at all.
Bule if I called this command from M-x, it works well. the default-directory is changed to ~/
I also posted a question in stackovflow for this issue, because at that time I didn't find where the problem was.
http://stackoverflow.com/questions/40857251/different-result-when-a-function-run-as-interactive-command-and-run-as-eval-expr/40857760#40857760
I have these code snippet in scratch buffer
I try to test using the function
sd/test()to change todefault-directoryof current buffer.The problem is that when I called the command
sd/testfromcounsel-M-x, this function not works as expected. the default-directory isn't changed at all.Bule if I called this command from
M-x, it works well. thedefault-directoryis changed to~/I also posted a question in stackovflow for this issue, because at that time I didn't find where the problem was.
http://stackoverflow.com/questions/40857251/different-result-when-a-function-run-as-interactive-command-and-run-as-eval-expr/40857760#40857760