Skip to content

counsel-M-x make some lisp not work as expected #810

Description

@seudut

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions