summaryrefslogtreecommitdiff
path: root/lisp/bookmark.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-03-08 22:07:23 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-03-08 22:07:23 +0000
commit02a5ba27b755b4918f563f81ff0734bb894abadf (patch)
treec1769f48afb648f44c0090b0aed5a4e6627300c4 /lisp/bookmark.el
parent67a9fd0dd7ad2ee053b4c4b54896c1475334bc52 (diff)
downloademacs-02a5ba27b755b4918f563f81ff0734bb894abadf.tar.gz
* 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.
Diffstat (limited to 'lisp/bookmark.el')
-rw-r--r--lisp/bookmark.el64
1 files changed, 26 insertions, 38 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 46e3841f337..b919823ce7a 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -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.")