0

Is there a reasonable way to evaluate elisp within a bookmarks file in Emacs?

For example, I bookmark all of my typical remote file paths and am in the middle of trying to get a dynamic IP address set up on a local machine. I have the following lines in my file '~/.emacs.d/bookmarks':

("example-remote-file"
 (filename . "/scp:[email protected]:/file/path/"))

But without setting a dynamic host, a network reset can change the path to something like "/scp:[email protected]". A handy solution for the time being would be to evaluate something like (setq my-remote-ip "10.112.X.X") at initialization and then have the following in the bookmarks file:

("example-remote-file"
 (filename . (concat "/scp:tdstoff@" my-remote-ip ":/file/path/"))).

Is something like this reasonably possible? Currently I get a completion related error: Error in post-command-hook (vertico--exhibit): (wrong-type-argument stringp (concat my-remote-ip "/scp:[email protected]:/file/path/"))

1

1 Answer 1

0

The answer is no. A bookmarks file is read as Elisp code (a list), but it's not evaluated.

What you can do is use a different bookmark type, e.g., one that you define, which has a handler that does what you want.

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.