]> git.eshelyaron.com Git - emacs.git/commitdiff
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 8 Mar 2008 22:07:23 +0000 (22:07 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 8 Mar 2008 22:07:23 +0000 (22:07 +0000)
(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.

lisp/ChangeLog
lisp/bookmark.el
lisp/info.el

index bc25479537ba6298a8910be12687835753dc7c95..74be1d7d3cb05c3d5760a7fb434d5dddb1316ae5 100644 (file)
@@ -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\e$(Q)[\e(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>
 
index 46e3841f3374a3a73060f15e3820552cf955a342..b919823ce7a6250caeabe1f3cb55598a89ee4fc7 100644 (file)
@@ -348,85 +348,73 @@ That is, all information but the name."
    (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.")
index 893fbfd8f0e9f5cdec291b8f805c5f542ade266f..2c8eee9da4785f73c8304e8a7e439c34424e3958 100644 (file)
@@ -4351,7 +4351,6 @@ When FILE is non-nil, return the Info file instead."
                     (point)
                     (- (point) bookmark-search-size))
                 nil))
-           (position . ,(point))
           (info-node . ,Info-current-node)
           (handler . Info-bookmark-jump))))
 
@@ -4368,27 +4367,19 @@ When FILE is non-nil, return the Info file instead."
 
 
 (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