3

I'm using Emacs (latest master branch as of June,2017) and I'm using Syncthing (like Dropbox) to store my emacs-bookmark file which I load in my configuration using

'(bookmark-default-file "~/Sync/emacs-bookmarks")

On one computer I have to do a bookmark-save command to output my current bookmarks to the ~/Sync/emacs-bookmarks file. On the other computer this file is updated but when I do a list of bookmarks using C-x r l the listing is not refreshed it's showing the old bookmarks.

Is there a way without restarting emacs to reload the bookmarks file?

  • 1
    There are two popular threads that deal with synchronizing packages and user-configurations across multiple computers, including, but not limited to using DropBox. It may behoove you to consider editing your question title, and perhaps the body of the question to distinguish your question. At first glance, I immediately assumed it was a duplicate. Then, I read it a couple of times and saw it was about bookmarks, but I didn't quite get the gist of the question. Perhaps another forum participant will immediately understand this question as being different and will have an answer . . .. – lawlist Jul 14 '17 at 6:14
1

Take a look at bookmark+. There are a lot of things in that package but this is very handy:

bookmark-load is an interactive compiled Lisp function in  bookmark+-1.el .

It is bound to C-x p l, <menu-bar> <edit> <bookmark> <load>.

(bookmark-load FILE &optional OVERWRITE BATCHP)

Load bookmarks from FILE (which must be in the standard format).
Without a prefix argument (argument OVERWRITE is nil), add the newly
loaded bookmarks to those already current.  They are saved to the
current bookmark file when bookmarks are saved.

I also set this in my init file:

(setq bmkp-last-as-first-bookmark-file nil) ;; always uses the value of  bookmark-default-file  as the initial bookmark file
  • 1
    I don't think you need bookmark+ to reload the bookmarks file. bookmark-load is part of bookmark.el. – Dan Jul 14 '17 at 21:48
  • 1
    What @Dan says is true. bookmark-load exists also in vanilla Emacs (i.e., without Bookmark+). But interactively it does not switch to a different bookmark file. See the doc string in Bookmark+ for the differences in behavior. Or see the comment before the Bookmark+ definition. In particular, with the Bookmark+ version, a prefix arg switches to using the bookmark file you specify (instead of just adding its bookmarks). In the bookmark-list display (C-x r l) you can use L to switch to another bookmark file. – Drew Jul 20 '17 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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