Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] burly-open-last-bookmark can cross session. #48

Open
zw963 opened this issue Jan 3, 2022 · 4 comments
Open

[Feature Request] burly-open-last-bookmark can cross session. #48

zw963 opened this issue Jan 3, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@zw963
Copy link

zw963 commented Jan 3, 2022

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
previous bookmark1 immedately.

For how to use this feature .e.g. i can add a hook like this:

(if (and (fboundp 'daemonp) (daemonp))
    (add-hook 'after-make-frame-functions 'burly-open-last-bookmark t)
  )

When my emacs restart, will open previous bookmark automatically.

Thank you.

@ssl19
Copy link

ssl19 commented Jan 23, 2022

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)

@gsingh93
Copy link

gsingh93 commented Sep 2, 2022

@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?

@ssl19
Copy link

ssl19 commented Sep 2, 2022

According to savehist-additional-variables
The contents of variables should be printable with the Lisp
printer.

You could try yourself to see the difference :)

@alphapapa alphapapa self-assigned this Sep 9, 2022
@alphapapa alphapapa added enhancement New feature or request help wanted Extra attention is needed labels Sep 9, 2022
@alphapapa alphapapa added this to the 0.3 milestone Sep 9, 2022
@alphapapa
Copy link
Owner

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.)

@alphapapa alphapapa modified the milestones: 0.3, 0.4 Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants