changeset 92556:5944be8c8211

Change a return type, for greater extensibility. See http://lists.gnu.org/archive/html/emacs-devel/2007-12/msg01077.html and its thread for discussion leading to this change. * emacs-cvs/lisp/bookmark.el: (bookmark-jump-noselect): Return an alist instead of a dotted pair. (bookmark-jump, bookmark-jump-other-window, bookmark-insert) (bookmark-bmenu-2-window, bookmark-bmenu-other-window) (bookmark-bmenu-switch-other-window): Adjust accordingly. (bookmark-make-cell-function): Adjust documentation accordingly. * emacs-cvs/lisp/image-mode.el (image-bookmark-jump): Adjust return type accordingly; document. * emacs-cvs/lisp/doc-view.el (doc-view-bookmark-jump): Adjust return type accordingly; document.
author Karl Fogel <kfogel@red-bean.com>
date Fri, 07 Mar 2008 05:44:37 +0000
parents d238ebc2c1e0
children 3cfb033a3bca
files lisp/ChangeLog lisp/bookmark.el lisp/doc-view.el lisp/gnus/ChangeLog lisp/gnus/gnus-bookmark.el lisp/image-mode.el lisp/info.el
diffstat 7 files changed, 65 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/ChangeLog	Fri Mar 07 05:44:37 2008 +0000
@@ -1,3 +1,27 @@
+2008-03-07  Karl Fogel  <kfogel@red-bean.com>
+
+	Give a better name to part of the bookmark interface.
+
+	This was originally a much larger change, but halfway through I
+	updated and discovered that Stefan Monnier had done the rest.
+	It looks like he anticipated the new name too, because he used
+	`the-record' instead of `the-cell' for some internal variable names.
+
+	* lisp/bookmark.el
+	(bookmark-make-record-function): Was `bookmark-make-cell-function'.
+	(bookmark-make, bookmark-send-annotation): Update for above.
+	(bookmark-make-record-for-text-file): Was
+	`bookmark-make-cell-for-text-file.  Fix doc string re rev 1.102.
+
+	* lisp/info.el: Adjust accordingly.
+	(Info-bookmark-make-record): Was `Info-bookmark-make-cell'.
+
+	* lisp/image-mode.el: Adjust accordingly.
+	(image-bookmark-make-record): Was `image-bookmark-make-cell'.
+
+	* lisp/doc-view.el: Adjust accordingly.
+	(doc-view-bookmark-make-record): Was `doc-view-bookmark-make-cell'.
+
 2008-03-07  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
--- a/lisp/bookmark.el	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/bookmark.el	Fri Mar 07 05:44:37 2008 +0000
@@ -463,13 +463,14 @@
     (interactive-p)
     (setq bookmark-history (cons ,string bookmark-history))))
 
-(defvar bookmark-make-cell-function 'bookmark-make-cell-for-text-file
-  "A function that should be called to create the bookmark
-record.  Modes may set this variable buffer-locally to enable
-bookmarking of non-text files like images or pdf documents.
+(defvar bookmark-make-record-function 'bookmark-make-record-for-text-file
+  "A function that should be called to create a bookmark record.
+Modes may set this variable buffer-locally to enable bookmarking of
+locations that should be treated specially, such as Info nodes,
+news posts, images, pdf documents, etc.
 
 The function will be called with one argument: ANNOTATION.
-See `bookmark-make-cell-for-text-file' for a description.
+See `bookmark-make-record-for-text-file' for a description.
 
 The returned record may contain a special cons (handler . SOME-FUNCTION)
 which sets the handler function that should be used to open this
@@ -492,7 +493,7 @@
         ;; already existing bookmark under that name and
         ;; no prefix arg means just overwrite old bookmark
         (setcdr (bookmark-get-bookmark stripped-name)
-                (list (funcall bookmark-make-cell-function annotation)))
+                (list (funcall bookmark-make-record-function annotation)))
 
       ;; otherwise just cons it onto the front (either the bookmark
       ;; doesn't exist already, or there is no prefix arg.  In either
@@ -501,7 +502,7 @@
       (setq bookmark-alist
             (cons
              (list stripped-name
-                   (funcall bookmark-make-cell-function annotation))
+                   (funcall bookmark-make-record-function annotation))
              bookmark-alist)))
 
     ;; Added by db
@@ -512,12 +513,10 @@
         (bookmark-save))))
 
 
-(defun bookmark-make-cell-for-text-file (annotation)
+(defun bookmark-make-record-for-text-file (annotation)
   "Return the record part of a new bookmark, given ANNOTATION.
 Must be at the correct position in the buffer in which the bookmark is
-being set.  This might change someday.
-Optional second arg INFO-NODE means this bookmark is at info node
-INFO-NODE, so record this fact in the bookmark's entry."
+being set (this might change someday)."
   (let ((the-record
          `((filename . ,(bookmark-buffer-file-name))
            (front-context-string
@@ -807,11 +806,12 @@
 	(bookmark bookmark-annotation-name)
 	(pt bookmark-annotation-point)
 	(buf bookmark-annotation-buffer))
-    ;; for bookmark-make-cell to work, we need to be
+    ;; for bookmark-make-record-function to work, we need to be
     ;; in the relevant buffer, at the relevant point.
-    ;; Actually, bookmark-make-cell should probably be re-written,
-    ;; to avoid this need.  Should I handle the error if a buffer is
-    ;; killed between "C-x r m" and a "C-c C-c" in the annotation buffer?
+    ;; Actually, the bookmark-make-record-function spec should
+    ;; probably be changed to avoid this need.  Should I handle the
+    ;; error if a buffer is killed between "C-x r m" and a "C-c C-c"
+    ;; in the annotation buffer?
     (save-excursion
       (pop-to-buffer buf)
       (goto-char pt)
--- a/lisp/doc-view.el	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/doc-view.el	Fri Mar 07 05:44:37 2008 +0000
@@ -969,7 +969,7 @@
 	      (file-name-extension doc-view-buffer-file-name)" files is missing.  "
 	      "Type \\[doc-view-toggle-display] to switch to an editing mode.")))))
 
-(defvar bookmark-make-cell-function)
+(defvar bookmark-make-record-function)
 
 (defun doc-view-clone-buffer-hook ()
   ;; FIXME: There are several potential problems linked with reconversion
@@ -1046,8 +1046,8 @@
   (set (make-local-variable 'cursor-type) nil)
   (use-local-map doc-view-mode-map)
   (set (make-local-variable 'after-revert-hook) 'doc-view-reconvert-doc)
-  (set (make-local-variable 'bookmark-make-cell-function)
-       'doc-view-bookmark-make-cell)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'doc-view-bookmark-make-record)
   (setq mode-name "DocView"
 	buffer-read-only t
 	major-mode 'doc-view-mode)
@@ -1082,7 +1082,7 @@
 
 ;;;; Bookmark integration
 
-(defun doc-view-bookmark-make-cell (annotation &rest args)
+(defun doc-view-bookmark-make-record (annotation &rest args)
   (let ((the-record
          `((filename . ,buffer-file-name)
            (page     . ,(doc-view-current-page))
@@ -1104,7 +1104,7 @@
 ;;;###autoload
 (defun doc-view-bookmark-jump (bmk)
   ;; This implements the `handler' function interface for record type
-  ;; returned by `bookmark-make-cell-function', which see.
+  ;; returned by `doc-view-bookmark-make-record', which see.
   (save-window-excursion
     (let ((filename (bookmark-get-filename bmk))
 	  (page (cdr (assq 'page (bookmark-get-bookmark-record bmk)))))
--- a/lisp/gnus/ChangeLog	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/gnus/ChangeLog	Fri Mar 07 05:44:37 2008 +0000
@@ -1,3 +1,9 @@
+2008-03-07  Karl Fogel  <kfogel@red-bean.com>
+
+	* lisp/gnus/gnus-bookmark.el: Adjust for renames in bookmark.el.
+	(gnus-bookmark-make-record): Was `gnus-bookmark-make-cell'.
+	(gnus-bookmark-jump): Adjust some variable names.
+
 2008-03-05  Glenn Morris  <rgm@gnu.org>
 
 	* gnus-art.el (gnus-article-mode-line-format-alist): Move to gnus-sum.
--- a/lisp/gnus/gnus-bookmark.el	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/gnus/gnus-bookmark.el	Fri Mar 07 05:44:37 2008 +0000
@@ -207,13 +207,13 @@
       (setq gnus-bookmark-alist
 	    (cons
 	     (list (gnus-bookmark-remove-properties bmk-name)
-		   (gnus-bookmark-make-cell
+		   (gnus-bookmark-make-record
 		    group message-id author date subject annotation))
 	     gnus-bookmark-alist))))
   (gnus-bookmark-bmenu-surreptitiously-rebuild-list)
   (gnus-bookmark-write-file))
 
-(defun gnus-bookmark-make-cell
+(defun gnus-bookmark-make-record
   (group message-id author date subject annotation)
   "Return the record part of a new bookmark, given GROUP MESSAGE-ID AUTHOR DATE SUBJECT and ANNOTATION."
   (let ((the-record
@@ -288,9 +288,9 @@
   (let* ((bookmark (or bmk-name
 	  (completing-read "Jump to bookmarked article: "
 			   gnus-bookmark-alist)))
-	 (bmk-cell (cadr (assoc bookmark gnus-bookmark-alist)))
-	 (group (cdr (assoc 'group bmk-cell)))
-	 (message-id (cdr (assoc 'message-id bmk-cell))))
+	 (bmk-record (cadr (assoc bookmark gnus-bookmark-alist)))
+	 (group (cdr (assoc 'group bmk-record)))
+	 (message-id (cdr (assoc 'message-id bmk-record))))
     (when group
       (unless (get-buffer gnus-group-buffer)
 	(gnus-no-server))
--- a/lisp/image-mode.el	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/image-mode.el	Fri Mar 07 05:44:37 2008 +0000
@@ -278,7 +278,7 @@
     map)
   "Major mode keymap for viewing images as text in Image mode.")
 
-(defvar bookmark-make-cell-function)
+(defvar bookmark-make-record-function)
 
 ;;;###autoload
 (defun image-mode ()
@@ -290,8 +290,8 @@
   (setq mode-name "Image[text]")
   (setq major-mode 'image-mode)
   ;; Use our own bookmarking function for images.
-  (set (make-local-variable 'bookmark-make-cell-function)
-       'image-bookmark-make-cell)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'image-bookmark-make-record)
 
   ;; Keep track of [vh]scroll when switching buffers
   (image-mode-setup-winprops)
@@ -431,7 +431,7 @@
 
 ;;; Support for bookmark.el
 
-(defun image-bookmark-make-cell (annotation &rest args)
+(defun image-bookmark-make-record (annotation &rest args)
   (let ((the-record
          `((filename   . ,(buffer-file-name))
 	   (image-type . ,image-type)
@@ -454,7 +454,7 @@
 ;;;###autoload
 (defun image-bookmark-jump (bmk)
   ;; This implements the `handler' function interface for record type
-  ;; returned by `bookmark-make-cell-function', which see.
+  ;; returned by `bookmark-make-record-function', which see.
   (save-window-excursion
     (let ((filename (bookmark-get-filename bmk))
 	  (type (cdr (assq 'image-type (bookmark-get-bookmark-record bmk))))
--- a/lisp/info.el	Fri Mar 07 05:33:49 2008 +0000
+++ b/lisp/info.el	Fri Mar 07 05:44:37 2008 +0000
@@ -3374,7 +3374,7 @@
 (put 'Info-mode 'no-clone-indirect t)
 
 (defvar tool-bar-map)
-(defvar bookmark-make-cell-function)
+(defvar bookmark-make-record-function)
 
 ;; Autoload cookie needed by desktop.el
 ;;;###autoload
@@ -3487,8 +3487,8 @@
   (set (make-local-variable 'revert-buffer-function)
        'Info-revert-buffer-function)
   (Info-set-mode-line)
-  (set (make-local-variable 'bookmark-make-cell-function)
-       'Info-bookmark-make-cell)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'Info-bookmark-make-record)
   (run-mode-hooks 'Info-mode-hook))
 
 ;; When an Info buffer is killed, make sure the associated tags buffer
@@ -4326,7 +4326,7 @@
 ;; This is only called from bookmark.el.
 (declare-function bookmark-buffer-file-name "bookmark" ())
 
-(defun Info-bookmark-make-cell (annotation &rest args)
+(defun Info-bookmark-make-record (annotation &rest args)
   (let ((the-record
          `((filename . ,(bookmark-buffer-file-name))
            (front-context-string
@@ -4368,7 +4368,7 @@
 ;;;###autoload
 (defun Info-bookmark-jump (bmk)
   ;; This implements the `handler' function interface for record type returned
-  ;; by `Info-make-cell-function', which see.
+  ;; by `Info-bookmark-make-record', which see.
   (let* ((file (expand-file-name (bookmark-get-filename bmk)))
          (forward-str            (bookmark-get-front-context-string bmk))
          (behind-str             (bookmark-get-rear-context-string bmk))