changeset 92661:c8674d7009d4

* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs. (bookmark-get-annotation, bookmark-set-annotation) (bookmark-get-filename, bookmark-set-filename, bookmark-get-position) (bookmark-set-position, bookmark-get-front-context-string) (bookmark-set-front-context-string, bookmark-get-rear-context-string) (bookmark-set-rear-context-string, bookmark-get-handler): Use them. * info.el (Info-bookmark-make-record): Don't bother recording point. (bookmark-get-filename, bookmark-get-front-context-string) (bookmark-get-rear-context-string, bookmark-get-position): Don't declare. (bookmark-get-info-node): Remove. (bookmark-prop-get): Declare. (Info-bookmark-jump): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 08 Mar 2008 22:07:23 +0000
parents e64439fb46dc
children 4b12e6633ee4
files lisp/ChangeLog lisp/bookmark.el lisp/info.el
diffstat 3 files changed, 49 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Mar 08 21:36:38 2008 +0000
+++ b/lisp/ChangeLog	Sat Mar 08 22:07:23 2008 +0000
@@ -1,3 +1,19 @@
+2008-03-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
+	(bookmark-get-annotation, bookmark-set-annotation)
+	(bookmark-get-filename, bookmark-set-filename, bookmark-get-position)
+	(bookmark-set-position, bookmark-get-front-context-string)
+	(bookmark-set-front-context-string, bookmark-get-rear-context-string)
+	(bookmark-set-rear-context-string, bookmark-get-handler): Use them.
+	* info.el (Info-bookmark-make-record): Don't bother recording point.
+	(bookmark-get-filename, bookmark-get-front-context-string)
+	(bookmark-get-rear-context-string, bookmark-get-position):
+	Don't declare any more.
+	(bookmark-get-info-node): Remove.
+	(bookmark-prop-get): Declare.
+	(Info-bookmark-jump): Use it.
+
 2008-03-08  Johan Bockg$(Q)[(Brd  <bojohan@gnu.org>
 
 	* subr.el (while-no-input): Don't splice BODY directly into the
@@ -5,8 +21,8 @@
 
 2008-03-08  Dan Nicolaescu  <dann@ics.uci.edu>
 
-	* diff-mode.el (diff-ignore-whitespace-hunk): Bind
-	inhibit-read-only before trying to change the buffer.
+	* diff-mode.el (diff-ignore-whitespace-hunk):
+	Bind inhibit-read-only before trying to change the buffer.
 
 2008-03-08  Glenn Morris  <rgm@gnu.org>
 
--- a/lisp/bookmark.el	Sat Mar 08 21:36:38 2008 +0000
+++ b/lisp/bookmark.el	Sat Mar 08 22:07:23 2008 +0000
@@ -348,85 +348,73 @@
    (if (stringp bookmark) (bookmark-get-bookmark bookmark) bookmark)
    newname))
 
+(defun bookmark-prop-get (bookmark prop)
+  "Return the property PROP of BOOKMARK, or nil if none."
+  (cdr (assq prop (bookmark-get-bookmark-record bookmark))))
+
+(defun bookmark-prop-set (bookmark prop val)
+  "Set the property PROP of BOOKMARK to VAL."
+  (let ((cell (assq prop (bookmark-get-bookmark-record bookmark))))
+    (if cell
+        (setcdr cell val)
+      (nconc (bookmark-get-bookmark-record bookmark)
+             (list (cons prop val))))))
 
 (defun bookmark-get-annotation (bookmark)
   "Return the annotation of BOOKMARK, or nil if none."
-  (cdr (assq 'annotation (bookmark-get-bookmark-record bookmark))))
-
+  (bookmark-prop-get bookmark 'annotation))
 
 (defun bookmark-set-annotation (bookmark ann)
   "Set the annotation of BOOKMARK to ANN."
-  (let ((cell (assq 'annotation (bookmark-get-bookmark-record bookmark))))
-    (if cell
-        (setcdr cell ann)
-      (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'annotation ann))))))
+  (bookmark-prop-set bookmark 'annotation ann))
 
 
 (defun bookmark-get-filename (bookmark)
   "Return the full filename of BOOKMARK."
-  (cdr (assq 'filename (bookmark-get-bookmark-record bookmark))))
+  (bookmark-prop-get bookmark 'filename))
 
 
 (defun bookmark-set-filename (bookmark filename)
   "Set the full filename of BOOKMARK to FILENAME."
-  (let ((cell (assq 'filename (bookmark-get-bookmark-record bookmark))))
-    (if cell
-        (setcdr cell filename)
-      (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'filename filename))))
-    (setq bookmark-alist-modification-count
-          (1+ bookmark-alist-modification-count))
-    (if (bookmark-time-to-save-p)
-        (bookmark-save))))
+  (bookmark-prop-set bookmark 'filename filename)
+  (setq bookmark-alist-modification-count
+        (1+ bookmark-alist-modification-count))
+  (if (bookmark-time-to-save-p)
+      (bookmark-save)))
 
 
 (defun bookmark-get-position (bookmark)
   "Return the position \(i.e.: point\) of BOOKMARK."
-  (cdr (assq 'position (bookmark-get-bookmark-record bookmark))))
+  (bookmark-prop-get bookmark 'position))
 
 
 (defun bookmark-set-position (bookmark position)
   "Set the position \(i.e.: point\) of BOOKMARK to POSITION."
-  (let ((cell (assq 'position (bookmark-get-bookmark-record bookmark))))
-    (if cell
-        (setcdr cell position)
-      (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'position position))))))
+  (bookmark-prop-set bookmark 'position position))
 
 
 (defun bookmark-get-front-context-string (bookmark)
   "Return the front-context-string of BOOKMARK."
-  (cdr (assq 'front-context-string (bookmark-get-bookmark-record bookmark))))
+  (bookmark-prop-get bookmark 'front-context-string))
 
 
 (defun bookmark-set-front-context-string (bookmark string)
   "Set the front-context-string of BOOKMARK to STRING."
-  (let ((cell (assq 'front-context-string
-                    (bookmark-get-bookmark-record bookmark))))
-    (if cell
-        (setcdr cell string)
-      (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'front-context-string string))))))
+  (bookmark-prop-set bookmark 'front-context-string string))
 
 
 (defun bookmark-get-rear-context-string (bookmark)
   "Return the rear-context-string of BOOKMARK."
-  (cdr (assq 'rear-context-string (bookmark-get-bookmark-record bookmark))))
+  (bookmark-prop-get bookmark 'rear-context-string))
 
 
 (defun bookmark-set-rear-context-string (bookmark string)
   "Set the rear-context-string of BOOKMARK to STRING."
-  (let ((cell (assq 'rear-context-string
-                    (bookmark-get-bookmark-record bookmark))))
-    (if cell
-        (setcdr cell string)
-      (nconc (bookmark-get-bookmark-record bookmark)
-             (list (cons 'rear-context-string string))))))
+  (bookmark-prop-set bookmark 'rear-context-string string))
 
 
 (defun bookmark-get-handler (bookmark)
-  (cdr (assq 'handler (bookmark-get-bookmark-record bookmark))))
+  (bookmark-prop-get bookmark 'handler))
 
 (defvar bookmark-history nil
   "The history list for bookmark functions.")
--- a/lisp/info.el	Sat Mar 08 21:36:38 2008 +0000
+++ b/lisp/info.el	Sat Mar 08 22:07:23 2008 +0000
@@ -4351,7 +4351,6 @@
                     (point)
                     (- (point) bookmark-search-size))
 		 nil))
-           (position . ,(point))
 	   (info-node . ,Info-current-node)
 	   (handler . Info-bookmark-jump))))
 
@@ -4368,27 +4367,19 @@
 
 
 (defvar bookmark-current-bookmark)
-(declare-function bookmark-get-filename              "bookmark" (bookmark))
-(declare-function bookmark-get-front-context-string  "bookmark" (bookmark))
-(declare-function bookmark-get-rear-context-string   "bookmark" (bookmark))
-(declare-function bookmark-get-position              "bookmark" (bookmark))
+(declare-function bookmark-prop-get                  "bookmark" (bookmark prop))
 (declare-function bookmark-file-or-variation-thereof "bookmark" (file))
 (declare-function bookmark-jump-noselect             "bookmark" (str))
 (declare-function bookmark-get-bookmark-record       "bookmark" (bookmark))
 
-(defun bookmark-get-info-node (bookmark)
-  "Get the info node associated with BOOKMARK."
-  (cdr (assq 'info-node (bookmark-get-bookmark-record bookmark))))
-
 ;;;###autoload
 (defun Info-bookmark-jump (bmk)
   ;; This implements the `handler' function interface for record type returned
   ;; 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))
-         (place                  (bookmark-get-position bmk))
-	 (info-node              (bookmark-get-info-node bmk)))
+  (let* ((file (expand-file-name (bookmark-prop-get bmk 'filename)))
+         (forward-str            (bookmark-prop-get bmk 'front-context-string))
+         (behind-str             (bookmark-prop-get bmk 'rear-context-string))
+	 (info-node              (bookmark-prop-get bmk 'info-node)))
     (if (setq file (bookmark-file-or-variation-thereof file))
         (save-excursion
           (save-window-excursion