I have some trouble with bookmarks, where I previously defined a function that worked just fine, though now it's not working anymore.
The error I am facing is when calling bookmark "last" it says "Invalid bookmark last
", without quotes.
(defun go-bookmark-last ()
(interactive)
(bookmark-jump "last")
(message "Went to most recent bookmark.")
)
(defun save-bookmark-as-last ()
(interactive)
(bookmark-set "last")
(message "Save as most recent bookmark.")
)
These functions as macro's used to work no problem. Now the problem is that I can't visit my last bookmark until I "activate" bookmarks or something by using my "save-bookmark-as-last" function. Also, when I run the command bookmark-bmenu-list
, then I can run the go-bookmark-last immediately. Somehow I need to "activate" the bookmarks before I can go to that last bookmark. Does anyone have an idea how to solve this?
I assume that you encounter this error when you restart Emacs. You are seeing this error because the bookmark file is not loaded. You can use bookmark-maybe-load-default-file
function to load the default bookmark file. Modify your go-bookmark-last
function like this:
(require 'bookmark)
(defun go-bookmark-last ()
(interactive)
(bookmark-maybe-load-default-file)
(bookmark-jump "last")
(message "Went to most recent bookmark."))