diff lisp/bookmark.el @ 109395:fa4400531412

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.
author Karl Fogel <kfogel@red-bean.com>
date Wed, 14 Jul 2010 11:57:54 -0400
parents 32e3de61d8a0
children 4e6b8160da4b
line wrap: on
line diff
--- a/lisp/bookmark.el	Wed Jul 14 11:54:26 2010 -0400
+++ b/lisp/bookmark.el	Wed Jul 14 11:57:54 2010 -0400
@@ -528,26 +528,36 @@
     (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