diff options
author | Karl Fogel <kfogel@red-bean.com> | 2010-07-14 11:57:54 -0400 |
---|---|---|
committer | Karl Fogel <kfogel@red-bean.com> | 2010-07-14 11:57:54 -0400 |
commit | e44fa724e4563cfd3f30b85c3c16a2d2dab65ccd (patch) | |
tree | 0d518ac756edeaf43522be1cec5c784f8dc1f702 /lisp/bookmark.el | |
parent | 2bb8db3ea7516856cc42e2b597a3348fe8e5e678 (diff) | |
download | emacs-e44fa724e4563cfd3f30b85c3c16a2d2dab65ccd.tar.gz |
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
* lisp/bookmark.el (bookmark-make-record-default): Allow unneeded
information to be omitted from the record.
Adjust declarations and calls:
* lisp/info.el (bookmark-make-record-default): Adjust declaration.
(Info-bookmark-make-record): Adjust call.
* lisp/woman.el (bookmark-make-record-default): Adjust declaration.
(woman-bookmark-make-record): Adjust call.
* lisp/man.el (bookmark-make-record-default): Adjust declaration.
(Man-bookmark-make-record): Adjust call.
* lisp/image-mode.el (bookmark-make-record-default): Adjust declaration.
* lisp/doc-view.el (bookmark-make-record-default): Adjust declaration.
* lisp/gnus/gnus-sum.el (bookmark-make-record-default): Adjust declaration.
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r-- | lisp/bookmark.el | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 7c8ac45bb04..c9e7f824ee3 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -528,26 +528,36 @@ old one." (setq bookmark-current-bookmark stripped-name) (bookmark-bmenu-surreptitiously-rebuild-list))) -(defun bookmark-make-record-default (&optional point-only) +(defun bookmark-make-record-default (&optional no-file no-context posn) "Return the record describing the location of a new bookmark. -Must be at the correct position in the buffer in which the bookmark is -being set. -If POINT-ONLY is non-nil, then only return the subset of the -record that pertains to the location within the buffer." - `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name)))) - (front-context-string - . ,(if (>= (- (point-max) (point)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (+ (point) bookmark-search-size)) - nil)) - (rear-context-string - . ,(if (>= (- (point) (point-min)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (- (point) bookmark-search-size)) - nil)) - (position . ,(point)))) +Point should be at the buffer in which the bookmark is being set, +and normally should be at the position where the bookmark is desired, +but see the optional arguments for other possibilities. + +If NO-FILE is non-nil, then only return the subset of the +record that pertains to the location within the buffer, leaving off +the part that records the filename. + +If NO-CONTEXT is non-nil, do not include the front- and rear-context +strings in the record -- the position is enough. + +If POSN is non-nil, record POSN as the point instead of `(point)'." + `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name)))) + ,@(unless no-context `((front-context-string + . ,(if (>= (- (point-max) (point)) + bookmark-search-size) + (buffer-substring-no-properties + (point) + (+ (point) bookmark-search-size)) + nil)))) + ,@(unless no-context `((rear-context-string + . ,(if (>= (- (point) (point-min)) + bookmark-search-size) + (buffer-substring-no-properties + (point) + (- (point) bookmark-search-size)) + nil)))) + (position . ,(or posn (point))))) ;;; File format stuff |