Open zw963 opened 2 years ago
You can use savehist-mode
😃
(savehist-mode)
(bookmark-maybe-load-default-file)
(defun my/burly-savehist-integration ()
(when (bound-and-true-p burly-opened-bookmark-name)
(setq burly-opened-bookmark-name
(substring-no-properties burly-opened-bookmark-name))))
(add-hook 'savehist-save-hook #'my/burly-savehist-integration)
(add-to-list 'savehist-additional-variables 'burly-opened-bookmark-name)
@ssl19 thanks for that snippet! Can you explain what the purpose of my/burly-savehist-integration
is? Shouldn't saving and restoring burly-opened-bookmark-name
work fine without it?
According to savehist-additional-variables The contents of variables should be printable with the Lisp printer.
You could try yourself to see the difference :)
This seems like a good idea. It would probably be sufficient to make the variable a defcustom
and save its value when necessary. (Probably, an idle timer should be used, because saving all of the customize
options can cause a noticeable delay.)
That is, it can restore the last bookmark which i saved in current emacs session.
e.g.
before restart emacs, i save to bookmark1, then reboot emacs
when i restart emacs, then run
bury-open-list-bookmark
, i expected i can restore previousbookmark1
immedately.For how to use this feature .e.g. i can add a hook like this:
When my emacs restart, will open previous bookmark automatically.
Thank you.