0

Is there a function that, for a given location (e.g. the ongoing file/line number) returns an existing bookmark (if any)?

I've looked at the list of functions in bookmark and bookmark+ libraries and could not find one.

1 Answer 1

2

I'm not sure what you're asking. You can have any number of bookmarks at a given buffer position or file position.

Function bookmark-get-position returns the recorded position of a given bookmark. You can filter the bookmarks in the current bookmark-alist with a function that tests that position.

With Bookmark+ you also have commands such as bmkp-bookmarks-lighted-at-point, which returns a list of the bookmarks highlighted at the cursor position:

bmkp-bookmarks-lighted-at-point is an interactive compiled Lisp function in bookmark+-lit.el.

It is bound to C-x x =, menu-bar file bookmark bookmarks-here bmkp-bookmarks-lighted-at-point, menu-bar file bookmark highlight bmkp-bookmarks-lighted-at-point.

(bmkp-bookmarks-lighted-at-point &optional POSITION FULLP MSGP)

Return a list of the bookmarks highlighted at point.

Include only those in the current bookmark list (bookmark-alist).

  • With no prefix arg, return the bookmark names.
  • With a prefix arg, return the full bookmark data.

Interactively, display the info.

Non-interactively:

  • Use the bookmarks at optional arg POSITION (default: point).
  • Optional arg FULLP means return full bookmark data.
  • Optional arg MSGP means display the info.

And function bmkp-choose-bookmark-lighted-at-point:

bmkp-choose-bookmark-lighted-at-point is a compiled Lisp function in bookmark+-lit.el.

(bmkp-choose-bookmark-lighted-at-point &optional POSITION NOERRORP)

Return the name of a bookmark lighted at POSITION (default: point).

If there is more than one such, prompt user to choose one.

Optional arg POSITION is a buffer position to use instead of point.

Raise an error if there is no highlighted bookmark present, unless optional arg NOERRORP is non-nil, in which case return nil.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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