aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-03-08 22:07:23 +0000
committerStefan Monnier2008-03-08 22:07:23 +0000
commit02a5ba27b755b4918f563f81ff0734bb894abadf (patch)
treec1769f48afb648f44c0090b0aed5a4e6627300c4
parent67a9fd0dd7ad2ee053b4c4b54896c1475334bc52 (diff)
downloademacs-02a5ba27b755b4918f563f81ff0734bb894abadf.tar.gz
emacs-02a5ba27b755b4918f563f81ff0734bb894abadf.zip
* 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.
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/bookmark.el64
-rw-r--r--lisp/info.el19
3 files changed, 49 insertions, 54 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bc25479537b..74be1d7d3cb 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,19 @@
12008-03-08 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
4 (bookmark-get-annotation, bookmark-set-annotation)
5 (bookmark-get-filename, bookmark-set-filename, bookmark-get-position)
6 (bookmark-set-position, bookmark-get-front-context-string)
7 (bookmark-set-front-context-string, bookmark-get-rear-context-string)
8 (bookmark-set-rear-context-string, bookmark-get-handler): Use them.
9 * info.el (Info-bookmark-make-record): Don't bother recording point.
10 (bookmark-get-filename, bookmark-get-front-context-string)
11 (bookmark-get-rear-context-string, bookmark-get-position):
12 Don't declare any more.
13 (bookmark-get-info-node): Remove.
14 (bookmark-prop-get): Declare.
15 (Info-bookmark-jump): Use it.
16
12008-03-08 Johan Bockg$(Q)[(Brd <bojohan@gnu.org> 172008-03-08 Johan Bockg$(Q)[(Brd <bojohan@gnu.org>
2 18
3 * subr.el (while-no-input): Don't splice BODY directly into the 19 * subr.el (while-no-input): Don't splice BODY directly into the
@@ -5,8 +21,8 @@
5 21
62008-03-08 Dan Nicolaescu <dann@ics.uci.edu> 222008-03-08 Dan Nicolaescu <dann@ics.uci.edu>
7 23
8 * diff-mode.el (diff-ignore-whitespace-hunk): Bind 24 * diff-mode.el (diff-ignore-whitespace-hunk):
9 inhibit-read-only before trying to change the buffer. 25 Bind inhibit-read-only before trying to change the buffer.
10 26
112008-03-08 Glenn Morris <rgm@gnu.org> 272008-03-08 Glenn Morris <rgm@gnu.org>
12 28
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."
348 (if (stringp bookmark) (bookmark-get-bookmark bookmark) bookmark) 348 (if (stringp bookmark) (bookmark-get-bookmark bookmark) bookmark)
349 newname)) 349 newname))
350 350
351(defun bookmark-prop-get (bookmark prop)
352 "Return the property PROP of BOOKMARK, or nil if none."
353 (cdr (assq prop (bookmark-get-bookmark-record bookmark))))
354
355(defun bookmark-prop-set (bookmark prop val)
356 "Set the property PROP of BOOKMARK to VAL."
357 (let ((cell (assq prop (bookmark-get-bookmark-record bookmark))))
358 (if cell
359 (setcdr cell val)
360 (nconc (bookmark-get-bookmark-record bookmark)
361 (list (cons prop val))))))
351 362
352(defun bookmark-get-annotation (bookmark) 363(defun bookmark-get-annotation (bookmark)
353 "Return the annotation of BOOKMARK, or nil if none." 364 "Return the annotation of BOOKMARK, or nil if none."
354 (cdr (assq 'annotation (bookmark-get-bookmark-record bookmark)))) 365 (bookmark-prop-get bookmark 'annotation))
355
356 366
357(defun bookmark-set-annotation (bookmark ann) 367(defun bookmark-set-annotation (bookmark ann)
358 "Set the annotation of BOOKMARK to ANN." 368 "Set the annotation of BOOKMARK to ANN."
359 (let ((cell (assq 'annotation (bookmark-get-bookmark-record bookmark)))) 369 (bookmark-prop-set bookmark 'annotation ann))
360 (if cell
361 (setcdr cell ann)
362 (nconc (bookmark-get-bookmark-record bookmark)
363 (list (cons 'annotation ann))))))
364 370
365 371
366(defun bookmark-get-filename (bookmark) 372(defun bookmark-get-filename (bookmark)
367 "Return the full filename of BOOKMARK." 373 "Return the full filename of BOOKMARK."
368 (cdr (assq 'filename (bookmark-get-bookmark-record bookmark)))) 374 (bookmark-prop-get bookmark 'filename))
369 375
370 376
371(defun bookmark-set-filename (bookmark filename) 377(defun bookmark-set-filename (bookmark filename)
372 "Set the full filename of BOOKMARK to FILENAME." 378 "Set the full filename of BOOKMARK to FILENAME."
373 (let ((cell (assq 'filename (bookmark-get-bookmark-record bookmark)))) 379 (bookmark-prop-set bookmark 'filename filename)
374 (if cell 380 (setq bookmark-alist-modification-count
375 (setcdr cell filename) 381 (1+ bookmark-alist-modification-count))
376 (nconc (bookmark-get-bookmark-record bookmark) 382 (if (bookmark-time-to-save-p)
377 (list (cons 'filename filename)))) 383 (bookmark-save)))
378 (setq bookmark-alist-modification-count
379 (1+ bookmark-alist-modification-count))
380 (if (bookmark-time-to-save-p)
381 (bookmark-save))))
382 384
383 385
384(defun bookmark-get-position (bookmark) 386(defun bookmark-get-position (bookmark)
385 "Return the position \(i.e.: point\) of BOOKMARK." 387 "Return the position \(i.e.: point\) of BOOKMARK."
386 (cdr (assq 'position (bookmark-get-bookmark-record bookmark)))) 388 (bookmark-prop-get bookmark 'position))
387 389
388 390
389(defun bookmark-set-position (bookmark position) 391(defun bookmark-set-position (bookmark position)
390 "Set the position \(i.e.: point\) of BOOKMARK to POSITION." 392 "Set the position \(i.e.: point\) of BOOKMARK to POSITION."
391 (let ((cell (assq 'position (bookmark-get-bookmark-record bookmark)))) 393 (bookmark-prop-set bookmark 'position position))
392 (if cell
393 (setcdr cell position)
394 (nconc (bookmark-get-bookmark-record bookmark)
395 (list (cons 'position position))))))
396 394
397 395
398(defun bookmark-get-front-context-string (bookmark) 396(defun bookmark-get-front-context-string (bookmark)
399 "Return the front-context-string of BOOKMARK." 397 "Return the front-context-string of BOOKMARK."
400 (cdr (assq 'front-context-string (bookmark-get-bookmark-record bookmark)))) 398 (bookmark-prop-get bookmark 'front-context-string))
401 399
402 400
403(defun bookmark-set-front-context-string (bookmark string) 401(defun bookmark-set-front-context-string (bookmark string)
404 "Set the front-context-string of BOOKMARK to STRING." 402 "Set the front-context-string of BOOKMARK to STRING."
405 (let ((cell (assq 'front-context-string 403 (bookmark-prop-set bookmark 'front-context-string string))
406 (bookmark-get-bookmark-record bookmark))))
407 (if cell
408 (setcdr cell string)
409 (nconc (bookmark-get-bookmark-record bookmark)
410 (list (cons 'front-context-string string))))))
411 404
412 405
413(defun bookmark-get-rear-context-string (bookmark) 406(defun bookmark-get-rear-context-string (bookmark)
414 "Return the rear-context-string of BOOKMARK." 407 "Return the rear-context-string of BOOKMARK."
415 (cdr (assq 'rear-context-string (bookmark-get-bookmark-record bookmark)))) 408 (bookmark-prop-get bookmark 'rear-context-string))
416 409
417 410
418(defun bookmark-set-rear-context-string (bookmark string) 411(defun bookmark-set-rear-context-string (bookmark string)
419 "Set the rear-context-string of BOOKMARK to STRING." 412 "Set the rear-context-string of BOOKMARK to STRING."
420 (let ((cell (assq 'rear-context-string 413 (bookmark-prop-set bookmark 'rear-context-string string))
421 (bookmark-get-bookmark-record bookmark))))
422 (if cell
423 (setcdr cell string)
424 (nconc (bookmark-get-bookmark-record bookmark)
425 (list (cons 'rear-context-string string))))))
426 414
427 415
428(defun bookmark-get-handler (bookmark) 416(defun bookmark-get-handler (bookmark)
429 (cdr (assq 'handler (bookmark-get-bookmark-record bookmark)))) 417 (bookmark-prop-get bookmark 'handler))
430 418
431(defvar bookmark-history nil 419(defvar bookmark-history nil
432 "The history list for bookmark functions.") 420 "The history list for bookmark functions.")
diff --git a/lisp/info.el b/lisp/info.el
index 893fbfd8f0e..2c8eee9da47 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4351,7 +4351,6 @@ When FILE is non-nil, return the Info file instead."
4351 (point) 4351 (point)
4352 (- (point) bookmark-search-size)) 4352 (- (point) bookmark-search-size))
4353 nil)) 4353 nil))
4354 (position . ,(point))
4355 (info-node . ,Info-current-node) 4354 (info-node . ,Info-current-node)
4356 (handler . Info-bookmark-jump)))) 4355 (handler . Info-bookmark-jump))))
4357 4356
@@ -4368,27 +4367,19 @@ When FILE is non-nil, return the Info file instead."
4368 4367
4369 4368
4370(defvar bookmark-current-bookmark) 4369(defvar bookmark-current-bookmark)
4371(declare-function bookmark-get-filename "bookmark" (bookmark)) 4370(declare-function bookmark-prop-get "bookmark" (bookmark prop))
4372(declare-function bookmark-get-front-context-string "bookmark" (bookmark))
4373(declare-function bookmark-get-rear-context-string "bookmark" (bookmark))
4374(declare-function bookmark-get-position "bookmark" (bookmark))
4375(declare-function bookmark-file-or-variation-thereof "bookmark" (file)) 4371(declare-function bookmark-file-or-variation-thereof "bookmark" (file))
4376(declare-function bookmark-jump-noselect "bookmark" (str)) 4372(declare-function bookmark-jump-noselect "bookmark" (str))
4377(declare-function bookmark-get-bookmark-record "bookmark" (bookmark)) 4373(declare-function bookmark-get-bookmark-record "bookmark" (bookmark))
4378 4374
4379(defun bookmark-get-info-node (bookmark)
4380 "Get the info node associated with BOOKMARK."
4381 (cdr (assq 'info-node (bookmark-get-bookmark-record bookmark))))
4382
4383;;;###autoload 4375;;;###autoload
4384(defun Info-bookmark-jump (bmk) 4376(defun Info-bookmark-jump (bmk)
4385 ;; This implements the `handler' function interface for record type returned 4377 ;; This implements the `handler' function interface for record type returned
4386 ;; by `Info-bookmark-make-record', which see. 4378 ;; by `Info-bookmark-make-record', which see.
4387 (let* ((file (expand-file-name (bookmark-get-filename bmk))) 4379 (let* ((file (expand-file-name (bookmark-prop-get bmk 'filename)))
4388 (forward-str (bookmark-get-front-context-string bmk)) 4380 (forward-str (bookmark-prop-get bmk 'front-context-string))
4389 (behind-str (bookmark-get-rear-context-string bmk)) 4381 (behind-str (bookmark-prop-get bmk 'rear-context-string))
4390 (place (bookmark-get-position bmk)) 4382 (info-node (bookmark-prop-get bmk 'info-node)))
4391 (info-node (bookmark-get-info-node bmk)))
4392 (if (setq file (bookmark-file-or-variation-thereof file)) 4383 (if (setq file (bookmark-file-or-variation-thereof file))
4393 (save-excursion 4384 (save-excursion
4394 (save-window-excursion 4385 (save-window-excursion