Mercurial > emacs
diff lisp/info.el @ 96280:bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
used until now in bookmark.el's code.
(bookmark-get-bookmark): Accept bookmark names or bookmark records.
(bookmark-get-bookmark-record): Allow the 2 slightly different formats
used until now in bookmark.el's code.
(bookmark-set-filename): Remove special code, moved to its only caller.
(bookmark-store): Use the newer format.
(bookmark-make-record-default): Add arg `point-only'.
Rename from bookmark-make-record-for-text-file.
(bookmark--jump-via): New function.
(bookmark-jump, bookmark-jump-other-window, bookmark-bmenu-2-window)
(bookmark-bmenu-other-window, bookmark-bmenu-switch-other-window):
Use it.
(bookmark-jump-noselect, bookmark-default-handler):
Don't return an alist, instead return the data implicitly by changing
current buffer and point. Signal an error if the file doesn't exist.
* info.el (Info-bookmark-make-record):
Use bookmark-make-record-default.
(Info-bookmark-jump): Use bookmark-default-handler.
* image-mode.el (image-bookmark-make-record):
Use bookmark-make-record-default.
(image-bookmark-jump): Use bookmark-default-handler.
* doc-view.el (doc-view-bookmark-make-record):
Use bookmark-make-record-default.
(doc-view-bookmark-jump): Use bookmark-default-handler.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 25 Jun 2008 16:51:33 +0000 |
parents | 70f417028d53 |
children | d45acf0c8d23 |
line wrap: on
line diff
--- a/lisp/info.el Wed Jun 25 15:46:23 2008 +0000 +++ b/lisp/info.el Wed Jun 25 16:51:33 2008 +0000 @@ -34,7 +34,7 @@ ;;; Code: -(eval-when-compile (require 'jka-compr)) +(eval-when-compile (require 'jka-compr) (require 'cl)) (defgroup info nil "Info subsystem." @@ -4379,62 +4379,30 @@ '(Info-mode . Info-restore-desktop-buffer)) ;;;; Bookmark support - -(defvar bookmark-search-size) - -;; This is only called from bookmark.el. -(declare-function bookmark-buffer-file-name "bookmark" ()) +(declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) +(declare-function bookmark-prop-get "bookmark" (bookmark prop)) +(declare-function bookmark-default-handler "bookmark" (bmk)) +(declare-function bookmark-get-bookmark-record "bookmark" (bmk)) (defun Info-bookmark-make-record () `(,Info-current-node - (filename . ,(bookmark-buffer-file-name)) - (front-context-string - . ,(if (>= (- (point-max) (point)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (+ (point) bookmark-search-size)) - nil)) - (rear-context-string - . ,(if (>= (- (point) (point-min)) bookmark-search-size) - (buffer-substring-no-properties - (point) - (- (point) bookmark-search-size)) - nil)) + ,@(bookmark-make-record-default 'point-only) + (filename . ,Info-current-file) (info-node . ,Info-current-node) (handler . Info-bookmark-jump))) - -(defvar bookmark-current-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)) - ;;;###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-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 - (with-no-warnings - (Info-find-node file info-node)) - ;; Go searching forward first. Then, if forward-str exists and was - ;; found in the file, we can search backward for behind-str. - ;; Rationale is that if text was inserted between the two in the - ;; file, it's better to be put before it so you can read it, rather - ;; than after and remain perhaps unaware of the changes. - (if forward-str - (if (search-forward forward-str (point-max) t) - (goto-char (match-beginning 0)))) - (if behind-str - (if (search-backward behind-str (point-min) t) - (goto-char (match-end 0)))) - `((buffer ,(current-buffer)) (position ,(point)))))))) + (let* ((file (bookmark-prop-get bmk 'filename)) + (info-node (bookmark-prop-get bmk 'info-node)) + (buf (save-window-excursion ;FIXME: doesn't work with frames! + (Info-find-node file info-node) (current-buffer)))) + ;; Use bookmark-default-handler to move to the appropriate location + ;; within the node. + (bookmark-default-handler + (list* "" `(buffer . ,buf) (bookmark-get-bookmark-record bmk))))) (provide 'info)