From: Karl Fogel Date: Wed, 14 Jul 2010 15:57:54 +0000 (-0400) Subject: Preparation for setting bookmarks in Gnus article buffers (Bug#5975). X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~51^2~52 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e44fa724e4563cfd3f30b85c3c16a2d2dab65ccd;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d9dba910224..a24f7083b72 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,26 @@ +2010-07-13 Karl Fogel + Thierry Volpiatto + + Preparation for setting bookmarks in Gnus article buffers (Bug#5975). + + * bookmark.el (bookmark-make-record-default): Allow unneeded + information to be omitted from the record. + + Adjust declarations and calls: + + * info.el (bookmark-make-record-default): Adjust declaration. + (Info-bookmark-make-record): Adjust call. + + * woman.el (bookmark-make-record-default): Adjust declaration. + (woman-bookmark-make-record): Adjust call. + + * man.el (bookmark-make-record-default): Adjust declaration. + (Man-bookmark-make-record): Adjust call. + + * image-mode.el (bookmark-make-record-default): Adjust declaration. + + * doc-view.el (bookmark-make-record-default): Adjust declaration. + 2010-07-13 Karl Fogel * bookmark.el (bookmark-show-annotation): Use `when' instead of `if'. 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 diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 528d5979ce1..4f183f4b9dc 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1349,8 +1349,8 @@ See the command `doc-view-mode' for more information on this mode." ;;;; Bookmark integration -(declare-function bookmark-make-record-default "bookmark" - (&optional point-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index d25caf70347..a32da68da36 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2010-07-13 Karl Fogel + + * gnus/gnus-sum.el (bookmark-make-record-default): Adjust + declaration, based on changes in bookmark.el. + 2010-06-22 Mark A. Hershberger * mm-url.el (mm-url-encode-multipart-form-data): New function to handle diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 98a0556d499..ce945186fbf 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -12621,7 +12621,8 @@ If ALL is a number, fetch this number of articles." (gnus-summary-position-point))) ;;; Bookmark support for Gnus. -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 585d82e9beb..ca17569c91e 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -516,8 +516,8 @@ the image file and `image-mode' showing the image as an image." ;;; Support for bookmark.el -(declare-function bookmark-make-record-default "bookmark" - (&optional point-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) diff --git a/lisp/info.el b/lisp/info.el index 9a30f63fff0..65b9492e351 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4901,7 +4901,8 @@ BUFFER is the buffer speedbar is requesting buttons for." '(Info-mode . Info-restore-desktop-buffer)) ;;;; Bookmark support -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -4910,7 +4911,7 @@ BUFFER is the buffer speedbar is requesting buttons for." "This implements the `bookmark-make-record-function' type (which see) for Info nodes." `(,Info-current-node - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (filename . ,Info-current-file) (info-node . ,Info-current-node) (handler . Info-bookmark-jump))) diff --git a/lisp/man.el b/lisp/man.el index f448795c1cb..88d1aa7c604 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1674,7 +1674,8 @@ Specify which REFERENCE to use; default is based on word at point." complete-path)) ;;; Bookmark Man Support -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -1691,7 +1692,7 @@ Uses `Man-name-local-regexp'." (defun Man-bookmark-make-record () "Make a bookmark entry for a Man buffer." `(,(Man-default-bookmark-title) - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (location . ,(concat "man " Man-arguments)) (man-args . ,Man-arguments) (handler . Man-bookmark-jump))) diff --git a/lisp/woman.el b/lisp/woman.el index 3efe15d5f7d..291ebcee740 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -4521,7 +4521,8 @@ logging the message." nil) ; for woman-file-readable-p etc. ;;; Bookmark Woman support. -(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) (declare-function bookmark-prop-get "bookmark" (bookmark prop)) (declare-function bookmark-default-handler "bookmark" (bmk)) (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) @@ -4532,7 +4533,7 @@ logging the message." (defun woman-bookmark-make-record () "Make a bookmark entry for a Woman buffer." `(,(Man-default-bookmark-title) - ,@(bookmark-make-record-default 'point-only) + ,@(bookmark-make-record-default 'no-file) (location . ,(concat "woman " woman-last-file-name)) ;; Use the same form as man's bookmarks, as much as possible. (man-args . ,woman-last-file-name)