help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Temporary notes in Emacs buffers?


From: Drew Adams
Subject: RE: Temporary notes in Emacs buffers?
Date: Sun, 12 Jan 2020 08:37:30 -0800 (PST)

> I tried to make a file use a separate bookmark file (for only this
> file's bookmarks) and specify the location of that bookmark file as a
> file local variable, somehow.  How would you do that with vanilla
> bookmarks?

I'm no expert on file-local variables.  Looking at
the doc for them, and throwing something together
quickly, does this help?

(defun create-bmk-file-for-file (bookmark-file target-file)
  "Create a new, empty BOOKMARK-FILE for TARGET-FILE."
  (interactive "FCreate bookmark file: \nFTarget file: ")
  (require 'bookmark)
  (let ((bookmark-alist  ()))
    (let ((baud-rate  0)) (bookmark-write-file bookmark-file))
    (with-current-buffer (find-file-noselect target-file)
      (add-file-local-variable 'local-bookmark-file bookmark-file)
      (save-buffer))))

(defun switch-to-local-bookmark-file ()
  "Switch to local bookmark file for current file."
  (interactive)
  (hack-local-variables)
  (let ((bfile  local-bookmark-file))
    (bookmark-load bfile 'SWITCH)))

`create-*' creates a new, empty BOOKMARK-FILE, and
it adds its name to the file-local variables of the
TARGET-FILE.

`switch-*' should be used when visiting TARGET-FILE.
It switches the current bookmark file to BOOKMARK-FILE.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]