;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later
-;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2003 Free Software Foundation
+;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003,
+;; 2004, 2005 Free Software Foundation, Inc.
;; Author: Karl Fogel <kfogel@red-bean.com>
;; Maintainer: Karl Fogel <kfogel@red-bean.com>
:group 'bookmark)
+(defface bookmark-menu-heading
+ '((t (:inherit font-lock-type-face)))
+ "Face used to highlight the heading in bookmark menu buffers."
+ :group 'bookmark
+ :version "22.1")
+
+
;;; No user-serviceable parts beyond this point.
;; Is it XEmacs?
;; suggested for lucid compatibility by david hughes:
(or (fboundp 'frame-height) (defalias 'frame-height 'screen-height))
-;; This variable is probably obsolete now...
-(or (boundp 'baud-rate)
- ;; some random value higher than 9600
- (setq baud-rate 19200))
-
-
\f
;;; Keymap stuff:
(insert string)))
+(defvar Info-current-file)
+
(defun bookmark-buffer-file-name ()
"Return the current buffer's file in a way useful for bookmarks.
For example, if this is a Info buffer, return the Info file's name."
(lambda (x y) (string-lessp (car x) (car y))))))))
+(defvar bookmark-after-jump-hook nil
+ "Hook run after `bookmark-jump' jumps to a bookmark.
+Useful for example to unhide text in `outline-mode'.")
+
;;;###autoload
(defun bookmark-jump (bookmark)
"Jump to bookmark BOOKMARK (a point in some file).
(and cell
(switch-to-buffer (car cell))
(goto-char (cdr cell))
+ (progn (run-hooks 'bookmark-after-jump-hook) t)
(if bookmark-automatically-show-annotations
;; if there is an annotation for this bookmark,
;; show it in a buffer.
;; Info nodes must be visited with care.
(progn
(require 'info)
- (Info-find-node file info-node))
+ (with-no-warnings
+ (Info-find-node file info-node)))
;; Else no Info. Can do an ordinary find-file:
(set-buffer (find-file-noselect file))
(goto-char place))
(prog1
(insert (bookmark-location bookmark)) ; *Return this line*
(if (and (display-color-p) (display-mouse-p))
- (add-text-properties start
- (save-excursion (re-search-backward
- "[^ \t]")
+ (add-text-properties
+ start
+ (save-excursion (re-search-backward
+ "[^ \t]")
(1+ (point)))
- '(mouse-face highlight
- help-echo "mouse-2: go to this bookmark"))))))
+ '(mouse-face highlight
+ follow-link t
+ help-echo "mouse-2: go to this bookmark in other window"))))))
;;;###autoload
(defalias 'bookmark-locate 'bookmark-insert-location)
(let ((inhibit-read-only t))
(erase-buffer)
(insert "% Bookmark\n- --------\n")
+ (add-text-properties (point-min) (point)
+ '(font-lock-face bookmark-menu-heading))
(bookmark-maybe-sort-alist)
(mapcar
(lambda (full-record)
(let ((start (point)))
(insert (bookmark-name-from-full-record full-record))
(if (and (display-color-p) (display-mouse-p))
- (add-text-properties start
- (save-excursion (re-search-backward
- "[^ \t]")
- (1+ (point)))
- '(mouse-face highlight
- help-echo "mouse-2: go to this bookmark")))
+ (add-text-properties
+ start
+ (save-excursion (re-search-backward
+ "[^ \t]")
+ (1+ (point)))
+ '(mouse-face highlight
+ follow-link t
+ help-echo "mouse-2: go to this bookmark in other window")))
(insert "\n")
)))
bookmark-alist))
(let ((start (point)))
(insert (car bookmark-bmenu-hidden-bookmarks))
(if (and (display-color-p) (display-mouse-p))
- (add-text-properties start
- (save-excursion (re-search-backward
- "[^ \t]")
- (1+ (point)))
- '(mouse-face highlight
- help-echo
- "mouse-2: go to this bookmark"))))
+ (add-text-properties
+ start
+ (save-excursion (re-search-backward
+ "[^ \t]")
+ (1+ (point)))
+ '(mouse-face highlight
+ follow-link t
+ help-echo
+ "mouse-2: go to this bookmark in other window"))))
(setq bookmark-bmenu-hidden-bookmarks
(cdr bookmark-bmenu-hidden-bookmarks))
(forward-line 1))))))))
(interactive)
(if (bookmark-bmenu-check-position)
(let ((bmrk (bookmark-bmenu-bookmark)))
- (message (bookmark-location bmrk)))))
+ (message "%s" (bookmark-location bmrk)))))
(defun bookmark-bmenu-relocate ()
"Change the file path of the bookmark on the current line,