I am using spacemacs-light theme in Emacs and love it.

In my spacemacs-light theme, some org-files open with bullets not hidden though. In those cases I go to the top of the file and hit C-c C-c to refresh my org-file. And then I go back to where I was via C-u C-SPC.

Now I would like to create an elisp function that does this in a single step and map it to a key.[^1] Here is my approach in Elisp:

(defun my-refresh-org-fle ()
    (set-mark-command nil)

But it does not work. It won't go back to where I was.

I guess I haven't quite understood the functions set-mark-command and pop-mark. Although I do understand the concept of the mark-ring, and I enjoy using it (love jumping back to where I was prior to jumping to other files).

[^1]: Of course I could start debugging as to why I have this behaviour in spacemacs-theme in Emacs 26.x, but I don't have the time to.


1 Answer 1


You're on the right track, but the standard elisp idiom for "go somewhere else in the buffer, do some stuff, and then go back to where you came from" is to use save-excursion.

You can rewrite (and simplify!) your command as follows:

(defun my-refresh-org-fle ()
    (goto-char (point-min))

As an aside, the docstring for beginning-of-buffer says:

This function is for interactive use only; in Lisp code use (goto-char (point-min)) instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.