Is it possible to have the default bookmark name ( when we add a bookmark ) as the "name of the file: line n开发者_运维技巧umber" instead of prompting us everytime ? Trying to get the bookmark+.el package be similar to bm.el.
You can customize the bookmark-make-record-function
variable to a new routine which creates a default name that you want:
(setq bookmark-make-record-function 'my-bookmark-make-record-default)
(defun my-bookmark-make-record-default ()
"add on a default name for the bookmark"
(cons (format "%s:%d" (bookmark-buffer-name) (line-number-at-pos (point)))
(bookmark-make-record-default)))
Note: this makes the default name be what you requested (file:line), but you're still prompted - just press RET to accept the new name.
Bookmark+ gives you lots of possibilities, including the ability to bookmark files without visiting them and to have the bookmark name be taken automatically from the file name. So I think the OP is mistaken.
See, for instance:
- Autonamed bookmarks -- similar to
bm.el
bookmarks, which you mentioned -- the bookmark name reflects the file name and position in the file. - Autofile bookmarks -- let you treat files like bookmarks (add tags to files etc.) -- the bookmark name is the file name.
精彩评论