comparison lisp/bookmark.el @ 109395:fa4400531412

Preparation for setting bookmarks in Gnus article buffers (Bug#5975). * lisp/bookmark.el (bookmark-make-record-default): Allow unneeded information to be omitted from the record. Adjust declarations and calls: * lisp/info.el (bookmark-make-record-default): Adjust declaration. (Info-bookmark-make-record): Adjust call. * lisp/woman.el (bookmark-make-record-default): Adjust declaration. (woman-bookmark-make-record): Adjust call. * lisp/man.el (bookmark-make-record-default): Adjust declaration. (Man-bookmark-make-record): Adjust call. * lisp/image-mode.el (bookmark-make-record-default): Adjust declaration. * lisp/doc-view.el (bookmark-make-record-default): Adjust declaration. * lisp/gnus/gnus-sum.el (bookmark-make-record-default): Adjust declaration.
author Karl Fogel <kfogel@red-bean.com>
date Wed, 14 Jul 2010 11:57:54 -0400
parents 32e3de61d8a0
children 4e6b8160da4b
comparison
equal deleted inserted replaced
109394:31fa830edbcc 109395:fa4400531412
526 (bookmark-save)) 526 (bookmark-save))
527 527
528 (setq bookmark-current-bookmark stripped-name) 528 (setq bookmark-current-bookmark stripped-name)
529 (bookmark-bmenu-surreptitiously-rebuild-list))) 529 (bookmark-bmenu-surreptitiously-rebuild-list)))
530 530
531 (defun bookmark-make-record-default (&optional point-only) 531 (defun bookmark-make-record-default (&optional no-file no-context posn)
532 "Return the record describing the location of a new bookmark. 532 "Return the record describing the location of a new bookmark.
533 Must be at the correct position in the buffer in which the bookmark is 533 Point should be at the buffer in which the bookmark is being set,
534 being set. 534 and normally should be at the position where the bookmark is desired,
535 If POINT-ONLY is non-nil, then only return the subset of the 535 but see the optional arguments for other possibilities.
536 record that pertains to the location within the buffer." 536
537 `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name)))) 537 If NO-FILE is non-nil, then only return the subset of the
538 (front-context-string 538 record that pertains to the location within the buffer, leaving off
539 . ,(if (>= (- (point-max) (point)) bookmark-search-size) 539 the part that records the filename.
540 (buffer-substring-no-properties 540
541 (point) 541 If NO-CONTEXT is non-nil, do not include the front- and rear-context
542 (+ (point) bookmark-search-size)) 542 strings in the record -- the position is enough.
543 nil)) 543
544 (rear-context-string 544 If POSN is non-nil, record POSN as the point instead of `(point)'."
545 . ,(if (>= (- (point) (point-min)) bookmark-search-size) 545 `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name))))
546 (buffer-substring-no-properties 546 ,@(unless no-context `((front-context-string
547 (point) 547 . ,(if (>= (- (point-max) (point))
548 (- (point) bookmark-search-size)) 548 bookmark-search-size)
549 nil)) 549 (buffer-substring-no-properties
550 (position . ,(point)))) 550 (point)
551 (+ (point) bookmark-search-size))
552 nil))))
553 ,@(unless no-context `((rear-context-string
554 . ,(if (>= (- (point) (point-min))
555 bookmark-search-size)
556 (buffer-substring-no-properties
557 (point)
558 (- (point) bookmark-search-size))
559 nil))))
560 (position . ,(or posn (point)))))
551 561
552 562
553 ;;; File format stuff 563 ;;; File format stuff
554 564
555 ;; *IMPORTANT NOTICE* If you are thinking about modifying (redefining) 565 ;; *IMPORTANT NOTICE* If you are thinking about modifying (redefining)