Mercurial > emacs
comparison lisp/bookmark.el @ 88155:d7ddb3e565de
sync with trunk
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Mon, 16 Jan 2006 00:03:54 +0000 |
parents | 68aa78bf3f63 |
children |
comparison
equal
deleted
inserted
replaced
88154:8ce476d3ba36 | 88155:d7ddb3e565de |
---|---|
1 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later | 1 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later |
2 | 2 |
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001 Free Software Foundation | 3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003, |
4 ;; 2004, 2005 Free Software Foundation, Inc. | |
4 | 5 |
5 ;; Author: Karl Fogel <kfogel@red-bean.com> | 6 ;; Author: Karl Fogel <kfogel@red-bean.com> |
6 ;; Maintainer: Karl Fogel <kfogel@red-bean.com> | 7 ;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
7 ;; Created: July, 1993 | 8 ;; Created: July, 1993 |
8 ;; Keywords: bookmarks, placeholders, annotations | 9 ;; Keywords: bookmarks, placeholders, annotations |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 ;; GNU General Public License for more details. | 21 ;; GNU General Public License for more details. |
21 | 22 |
22 ;; You should have received a copy of the GNU General Public License | 23 ;; You should have received a copy of the GNU General Public License |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02111-1307, USA. | 26 ;; Boston, MA 02110-1301, USA. |
26 | 27 |
27 ;;; Commentary: | 28 ;;; Commentary: |
28 | 29 |
29 ;; This package is for setting "bookmarks" in files. A bookmark | 30 ;; This package is for setting "bookmarks" in files. A bookmark |
30 ;; associates a string with a location in a certain file. Thus, you | 31 ;; associates a string with a location in a certain file. Thus, you |
167 :type 'boolean | 168 :type 'boolean |
168 :group 'bookmark) | 169 :group 'bookmark) |
169 | 170 |
170 | 171 |
171 (defcustom bookmark-automatically-show-annotations t | 172 (defcustom bookmark-automatically-show-annotations t |
172 "*nil means don't show annotations when jumping to a bookmark." | 173 "*Non-nil means show annotations when jumping to a bookmark." |
173 :type 'boolean | 174 :type 'boolean |
174 :group 'bookmark) | 175 :group 'bookmark) |
175 | 176 |
176 | 177 |
177 (defcustom bookmark-bmenu-file-column 30 | 178 (defcustom bookmark-bmenu-file-column 30 |
195 "*Maximum length of a bookmark name displayed on a popup menu." | 196 "*Maximum length of a bookmark name displayed on a popup menu." |
196 :type 'integer | 197 :type 'integer |
197 :group 'bookmark) | 198 :group 'bookmark) |
198 | 199 |
199 | 200 |
201 (defface bookmark-menu-heading | |
202 '((t (:inherit font-lock-type-face))) | |
203 "Face used to highlight the heading in bookmark menu buffers." | |
204 :group 'bookmark | |
205 :version "22.1") | |
206 | |
207 | |
200 ;;; No user-serviceable parts beyond this point. | 208 ;;; No user-serviceable parts beyond this point. |
201 | 209 |
202 ;; Is it XEmacs? | 210 ;; Is it XEmacs? |
203 (defconst bookmark-xemacsp | 211 (defconst bookmark-xemacsp |
204 (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)) | 212 (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)) |
207 ;; Added for lucid emacs compatibility, db | 215 ;; Added for lucid emacs compatibility, db |
208 (or (fboundp 'defalias) (fset 'defalias 'fset)) | 216 (or (fboundp 'defalias) (fset 'defalias 'fset)) |
209 | 217 |
210 ;; suggested for lucid compatibility by david hughes: | 218 ;; suggested for lucid compatibility by david hughes: |
211 (or (fboundp 'frame-height) (defalias 'frame-height 'screen-height)) | 219 (or (fboundp 'frame-height) (defalias 'frame-height 'screen-height)) |
212 | |
213 ;; This variable is probably obsolete now... | |
214 (or (boundp 'baud-rate) | |
215 ;; some random value higher than 9600 | |
216 (setq baud-rate 19200)) | |
217 | |
218 | 220 |
219 | 221 |
220 ;;; Keymap stuff: | 222 ;;; Keymap stuff: |
221 | 223 |
222 ;; Set up these bindings dumping time *only*; | 224 ;; Set up these bindings dumping time *only*; |
232 It is not bound to any key by default: to bind it | 234 It is not bound to any key by default: to bind it |
233 so that you have a bookmark prefix, just use `global-set-key' and bind a | 235 so that you have a bookmark prefix, just use `global-set-key' and bind a |
234 key of your choice to `bookmark-map'. All interactive bookmark | 236 key of your choice to `bookmark-map'. All interactive bookmark |
235 functions have a binding in this keymap.") | 237 functions have a binding in this keymap.") |
236 | 238 |
237 ;;;###autoload | 239 ;;;###autoload (define-prefix-command 'bookmark-map) |
238 (define-prefix-command 'bookmark-map) | |
239 | 240 |
240 ;; Read the help on all of these functions for details... | 241 ;; Read the help on all of these functions for details... |
241 ;;;###autoload | 242 ;;;###autoload (define-key bookmark-map "x" 'bookmark-set) |
242 (define-key bookmark-map "x" 'bookmark-set) | 243 ;;;###autoload (define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark" |
243 ;;;###autoload | 244 ;;;###autoload (define-key bookmark-map "j" 'bookmark-jump) |
244 (define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark" | 245 ;;;###autoload (define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go" |
245 ;;;###autoload | 246 ;;;###autoload (define-key bookmark-map "i" 'bookmark-insert) |
246 (define-key bookmark-map "j" 'bookmark-jump) | 247 ;;;###autoload (define-key bookmark-map "e" 'edit-bookmarks) |
247 ;;;###autoload | 248 ;;;###autoload (define-key bookmark-map "f" 'bookmark-insert-location) ; "f" for "find" |
248 (define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go" | 249 ;;;###autoload (define-key bookmark-map "r" 'bookmark-rename) |
249 ;;;###autoload | 250 ;;;###autoload (define-key bookmark-map "d" 'bookmark-delete) |
250 (define-key bookmark-map "i" 'bookmark-insert) | 251 ;;;###autoload (define-key bookmark-map "l" 'bookmark-load) |
251 ;;;###autoload | 252 ;;;###autoload (define-key bookmark-map "w" 'bookmark-write) |
252 (define-key bookmark-map "e" 'edit-bookmarks) | 253 ;;;###autoload (define-key bookmark-map "s" 'bookmark-save) |
253 ;;;###autoload | |
254 (define-key bookmark-map "f" 'bookmark-insert-location) ; "f" for "find" | |
255 ;;;###autoload | |
256 (define-key bookmark-map "r" 'bookmark-rename) | |
257 ;;;###autoload | |
258 (define-key bookmark-map "d" 'bookmark-delete) | |
259 ;;;###autoload | |
260 (define-key bookmark-map "l" 'bookmark-load) | |
261 ;;;###autoload | |
262 (define-key bookmark-map "w" 'bookmark-write) | |
263 ;;;###autoload | |
264 (define-key bookmark-map "s" 'bookmark-save) | |
265 | 254 |
266 | 255 |
267 ;;; The annotation maps. | 256 ;;; The annotation maps. |
268 (defvar bookmark-read-annotation-mode-map (copy-keymap text-mode-map) | 257 (defvar bookmark-read-annotation-mode-map (copy-keymap text-mode-map) |
269 "Keymap for composing an annotation for a bookmark.") | 258 "Keymap for composing an annotation for a bookmark.") |
320 | 309 |
321 (defvar bookmark-current-point 0) | 310 (defvar bookmark-current-point 0) |
322 (defvar bookmark-yank-point 0) | 311 (defvar bookmark-yank-point 0) |
323 (defvar bookmark-current-buffer nil) | 312 (defvar bookmark-current-buffer nil) |
324 | 313 |
325 | 314 (defvar Info-current-node) |
315 (defvar Info-suffix-list) | |
326 | 316 |
327 ;; Helper functions. | 317 ;; Helper functions. |
328 | 318 |
329 ;; Only functions on this page and the next one (file formats) need to | 319 ;; Only functions on this page and the next one (file formats) need to |
330 ;; know anything about the format of bookmark-alist entries. | 320 ;; know anything about the format of bookmark-alist entries. |
343 (bookmark-name-from-full-record full-record)) | 333 (bookmark-name-from-full-record full-record)) |
344 bookmark-alist)) | 334 bookmark-alist)) |
345 | 335 |
346 | 336 |
347 (defun bookmark-get-bookmark (bookmark) | 337 (defun bookmark-get-bookmark (bookmark) |
348 "Return the full entry for BOOKMARK in bookmark-alist. | 338 "Return the full entry for BOOKMARK in `bookmark-alist'. |
349 If BOOKMARK is not a string, return nil." | 339 If BOOKMARK is not a string, return nil." |
350 (when (stringp bookmark) | 340 (when (stringp bookmark) |
351 (apply (if bookmark-completion-ignore-case | 341 (assoc-string bookmark bookmark-alist bookmark-completion-ignore-case))) |
352 #'assoc-ignore-case | |
353 #'assoc) | |
354 (list bookmark bookmark-alist)))) | |
355 | 342 |
356 | 343 |
357 (defun bookmark-get-bookmark-record (bookmark) | 344 (defun bookmark-get-bookmark-record (bookmark) |
358 "Return the guts of the entry for BOOKMARK in bookmark-alist. | 345 "Return the guts of the entry for BOOKMARK in `bookmark-alist'. |
359 That is, all information but the name." | 346 That is, all information but the name." |
360 (car (cdr (bookmark-get-bookmark bookmark)))) | 347 (car (cdr (bookmark-get-bookmark bookmark)))) |
361 | 348 |
362 | 349 |
363 (defun bookmark-set-name (bookmark newname) | 350 (defun bookmark-set-name (bookmark newname) |
390 "Set the full filename of BOOKMARK to FILENAME." | 377 "Set the full filename of BOOKMARK to FILENAME." |
391 (let ((cell (assq 'filename (bookmark-get-bookmark-record bookmark)))) | 378 (let ((cell (assq 'filename (bookmark-get-bookmark-record bookmark)))) |
392 (if cell | 379 (if cell |
393 (setcdr cell filename) | 380 (setcdr cell filename) |
394 (nconc (bookmark-get-bookmark-record bookmark) | 381 (nconc (bookmark-get-bookmark-record bookmark) |
395 (list (cons 'filename filename)))))) | 382 (list (cons 'filename filename)))) |
383 (setq bookmark-alist-modification-count | |
384 (1+ bookmark-alist-modification-count)) | |
385 (if (bookmark-time-to-save-p) | |
386 (bookmark-save)))) | |
396 | 387 |
397 | 388 |
398 (defun bookmark-get-position (bookmark) | 389 (defun bookmark-get-position (bookmark) |
399 "Return the position \(i.e.: point\) of BOOKMARK." | 390 "Return the position \(i.e.: point\) of BOOKMARK." |
400 (cdr (assq 'position (bookmark-get-bookmark-record bookmark)))) | 391 (cdr (assq 'position (bookmark-get-bookmark-record bookmark)))) |
452 (setcdr cell node) | 443 (setcdr cell node) |
453 (nconc (bookmark-get-bookmark-record bookmark) | 444 (nconc (bookmark-get-bookmark-record bookmark) |
454 (list (cons 'info-node node))))) | 445 (list (cons 'info-node node))))) |
455 | 446 |
456 (message "%S" (assq 'info-node (bookmark-get-bookmark-record bookmark))) | 447 (message "%S" (assq 'info-node (bookmark-get-bookmark-record bookmark))) |
457 (sit-for 4) | 448 (sit-for 4)) |
458 ) | |
459 | 449 |
460 | 450 |
461 (defvar bookmark-history nil | 451 (defvar bookmark-history nil |
462 "The history list for bookmark functions.") | 452 "The history list for bookmark functions.") |
463 | 453 |
467 PROMPT will get a \": \" stuck on the end no matter what, so you | 457 PROMPT will get a \": \" stuck on the end no matter what, so you |
468 probably don't want to include one yourself. | 458 probably don't want to include one yourself. |
469 Optional second arg DEFAULT is a string to return if the user enters | 459 Optional second arg DEFAULT is a string to return if the user enters |
470 the empty string." | 460 the empty string." |
471 (bookmark-maybe-load-default-file) ; paranoia | 461 (bookmark-maybe-load-default-file) ; paranoia |
472 (let* ((completion-ignore-case bookmark-completion-ignore-case) | 462 (if (listp last-nonmenu-event) |
473 (default default) | 463 (bookmark-menu-popup-paned-menu t prompt (bookmark-all-names)) |
474 (prompt (if default | 464 (let* ((completion-ignore-case bookmark-completion-ignore-case) |
475 (concat prompt (format " (%s): " default)) | 465 (default default) |
476 (concat prompt ": "))) | 466 (prompt (if default |
477 (str | 467 (concat prompt (format " (%s): " default)) |
478 (completing-read prompt | 468 (concat prompt ": "))) |
479 bookmark-alist | 469 (str |
480 nil | 470 (completing-read prompt |
481 0 | 471 bookmark-alist |
482 nil | 472 nil |
483 'bookmark-history))) | 473 0 |
484 (if (string-equal "" str) | 474 nil |
485 (list default) | 475 'bookmark-history))) |
486 (list str)))) | 476 (if (string-equal "" str) default str)))) |
487 | 477 |
488 | 478 |
489 (defmacro bookmark-maybe-historicize-string (string) | 479 (defmacro bookmark-maybe-historicize-string (string) |
490 "Put STRING into the bookmark prompt history, if caller non-interactive. | 480 "Put STRING into the bookmark prompt history, if caller non-interactive. |
491 We need this because sometimes bookmark functions are invoked from | 481 We need this because sometimes bookmark functions are invoked from |
628 "-*- End Of Bookmark File Format Version Stamp -*-\n" | 618 "-*- End Of Bookmark File Format Version Stamp -*-\n" |
629 "This string marks the end of the version stamp in a bookmark file.") | 619 "This string marks the end of the version stamp in a bookmark file.") |
630 | 620 |
631 | 621 |
632 (defun bookmark-alist-from-buffer () | 622 (defun bookmark-alist-from-buffer () |
633 "Return a bookmark-alist (in any format) from the current buffer. | 623 "Return a `bookmark-alist' (in any format) from the current buffer. |
634 The buffer must of course contain bookmark format information. | 624 The buffer must of course contain bookmark format information. |
635 Does not care from where in the buffer it is called, and does not | 625 Does not care from where in the buffer it is called, and does not |
636 affect point." | 626 affect point." |
637 (save-excursion | 627 (save-excursion |
638 (goto-char (point-min)) | 628 (goto-char (point-min)) |
668 old-list)) | 658 old-list)) |
669 | 659 |
670 | 660 |
671 (defun bookmark-upgrade-file-format-from-0 () | 661 (defun bookmark-upgrade-file-format-from-0 () |
672 "Upgrade a bookmark file of format 0 (the original format) to format 1. | 662 "Upgrade a bookmark file of format 0 (the original format) to format 1. |
673 This expects to be called from point-min in a bookmark file." | 663 This expects to be called from `point-min' in a bookmark file." |
674 (message "Upgrading bookmark format from 0 to %d..." | 664 (message "Upgrading bookmark format from 0 to %d..." |
675 bookmark-file-format-version) | 665 bookmark-file-format-version) |
676 (let* ((old-list (bookmark-alist-from-buffer)) | 666 (let* ((old-list (bookmark-alist-from-buffer)) |
677 (new-list (bookmark-upgrade-version-0-alist old-list))) | 667 (new-list (bookmark-upgrade-version-0-alist old-list))) |
678 (delete-region (point-min) (point-max)) | 668 (delete-region (point-min) (point-max)) |
685 ) | 675 ) |
686 | 676 |
687 | 677 |
688 (defun bookmark-grok-file-format-version () | 678 (defun bookmark-grok-file-format-version () |
689 "Return an integer which is the file-format version of this bookmark file. | 679 "Return an integer which is the file-format version of this bookmark file. |
690 This expects to be called from point-min in a bookmark file." | 680 This expects to be called from `point-min' in a bookmark file." |
691 (if (looking-at "^;;;;") | 681 (if (looking-at "^;;;;") |
692 (save-excursion | 682 (save-excursion |
693 (save-match-data | 683 (save-match-data |
694 (re-search-forward "[0-9]") | 684 (re-search-forward "[0-9]") |
695 (forward-char -1) | 685 (forward-char -1) |
700 | 690 |
701 | 691 |
702 (defun bookmark-maybe-upgrade-file-format () | 692 (defun bookmark-maybe-upgrade-file-format () |
703 "Check the file-format version of this bookmark file. | 693 "Check the file-format version of this bookmark file. |
704 If the version is not up-to-date, upgrade it automatically. | 694 If the version is not up-to-date, upgrade it automatically. |
705 This expects to be called from point-min in a bookmark file." | 695 This expects to be called from `point-min' in a bookmark file." |
706 (let ((version (bookmark-grok-file-format-version))) | 696 (let ((version (bookmark-grok-file-format-version))) |
707 (cond | 697 (cond |
708 ((= version bookmark-file-format-version) | 698 ((= version bookmark-file-format-version) |
709 ) ; home free -- version is current | 699 ) ; home free -- version is current |
710 ((= version 0) | 700 ((= version 0) |
723 ";;; " | 713 ";;; " |
724 bookmark-end-of-version-stamp-marker)) | 714 bookmark-end-of-version-stamp-marker)) |
725 | 715 |
726 | 716 |
727 ;;; end file-format stuff | 717 ;;; end file-format stuff |
718 | |
719 | |
720 ;;; Generic helpers. | |
721 | |
722 (defun bookmark-maybe-message (fmt &rest args) | |
723 "Apply `message' to FMT and ARGS, but only if the display is fast enough." | |
724 (if (>= baud-rate 9600) | |
725 (apply 'message fmt args))) | |
728 | 726 |
729 | 727 |
730 ;;; Core code: | 728 ;;; Core code: |
731 | 729 |
732 ;;;###autoload | 730 ;;;###autoload |
792 | 790 |
793 | 791 |
794 (defun bookmark-kill-line (&optional newline-too) | 792 (defun bookmark-kill-line (&optional newline-too) |
795 "Kill from point to end of line. | 793 "Kill from point to end of line. |
796 If optional arg NEWLINE-TOO is non-nil, delete the newline too. | 794 If optional arg NEWLINE-TOO is non-nil, delete the newline too. |
797 Does not affect the kill-ring." | 795 Does not affect the kill ring." |
798 (let ((eol (save-excursion (end-of-line) (point)))) | 796 (let ((eol (save-excursion (end-of-line) (point)))) |
799 (delete-region (point) eol) | 797 (delete-region (point) eol) |
800 (if (and newline-too (looking-at "\n")) | 798 (if (and newline-too (looking-at "\n")) |
801 (delete-char 1)))) | 799 (delete-char 1)))) |
802 | 800 |
851 "# Date: " (current-time-string) "\n")) | 849 "# Date: " (current-time-string) "\n")) |
852 | 850 |
853 | 851 |
854 (defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text | 852 (defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text |
855 "Function to return default text to use for a bookmark annotation. | 853 "Function to return default text to use for a bookmark annotation. |
856 It takes the name of the bookmark, as a string, as an arg.") | 854 It takes one argument, the name of the bookmark, as a string.") |
857 | 855 |
858 (defun bookmark-read-annotation-mode (buf point parg bookmark) | 856 (defun bookmark-read-annotation-mode (buf point parg bookmark) |
859 "Mode for composing annotations for a bookmark. | 857 "Mode for composing annotations for a bookmark. |
860 Wants BUF POINT PARG and BOOKMARK. | 858 Wants BUF, POINT, PARG, and BOOKMARK. |
861 When you have finished composing, type \\[bookmark-send-annotation] to send | 859 When you have finished composing, type \\[bookmark-send-annotation] to send |
862 the annotation. | 860 the annotation. |
863 | 861 |
864 \\{bookmark-read-annotation-mode-map} | 862 \\{bookmark-read-annotation-mode-map} |
865 " | 863 " |
876 (setq bookmark-annotation-file (buffer-file-name buf)) | 874 (setq bookmark-annotation-file (buffer-file-name buf)) |
877 (setq bookmark-annotation-point point) | 875 (setq bookmark-annotation-point point) |
878 (use-local-map bookmark-read-annotation-mode-map) | 876 (use-local-map bookmark-read-annotation-mode-map) |
879 (setq major-mode 'bookmark-read-annotation-mode) | 877 (setq major-mode 'bookmark-read-annotation-mode) |
880 (insert (funcall bookmark-read-annotation-text-func bookmark)) | 878 (insert (funcall bookmark-read-annotation-text-func bookmark)) |
881 (run-hooks 'text-mode-hook)) | 879 (run-mode-hooks 'text-mode-hook)) |
882 | 880 |
883 | 881 |
884 (defun bookmark-read-annotation (parg bookmark) | 882 (defun bookmark-read-annotation (parg bookmark) |
885 "Pop up a buffer for entering a bookmark annotation. | 883 "Pop up a buffer for entering a bookmark annotation. |
886 Text surrounding the bookmark is PARG; the bookmark name is BOOKMARK." | 884 Text surrounding the bookmark is PARG; the bookmark name is BOOKMARK." |
907 (interactive) | 905 (interactive) |
908 (kill-all-local-variables) | 906 (kill-all-local-variables) |
909 (make-local-variable 'bookmark-annotation-name) | 907 (make-local-variable 'bookmark-annotation-name) |
910 (setq bookmark-annotation-name bookmark) | 908 (setq bookmark-annotation-name bookmark) |
911 (use-local-map bookmark-edit-annotation-mode-map) | 909 (use-local-map bookmark-edit-annotation-mode-map) |
912 (setq major-mode 'bookmark-edit-annotation-mode) | 910 (setq major-mode 'bookmark-edit-annotation-mode |
911 mode-name "Edit Bookmark Annotation") | |
913 (insert (funcall bookmark-read-annotation-text-func bookmark)) | 912 (insert (funcall bookmark-read-annotation-text-func bookmark)) |
914 (let ((annotation (bookmark-get-annotation bookmark))) | 913 (let ((annotation (bookmark-get-annotation bookmark))) |
915 (if (and annotation (not (string-equal annotation ""))) | 914 (if (and annotation (not (string-equal annotation ""))) |
916 (insert annotation))) | 915 (insert annotation))) |
917 (run-hooks 'text-mode-hook)) | 916 (run-mode-hooks 'text-mode-hook)) |
918 | 917 |
919 | 918 |
920 (defun bookmark-send-edited-annotation () | 919 (defun bookmark-send-edited-annotation () |
921 "Use buffer contents (minus beginning with `#' as annotation for a bookmark." | 920 "Use buffer contents as annotation for a bookmark. |
921 Lines beginning with `#' are ignored." | |
922 (interactive) | 922 (interactive) |
923 (if (not (eq major-mode 'bookmark-edit-annotation-mode)) | 923 (if (not (eq major-mode 'bookmark-edit-annotation-mode)) |
924 (error "Not in bookmark-edit-annotation-mode")) | 924 (error "Not in bookmark-edit-annotation-mode")) |
925 (goto-char (point-min)) | 925 (goto-char (point-min)) |
926 (while (< (point) (point-max)) | 926 (while (< (point) (point-max)) |
935 (kill-buffer (current-buffer))) | 935 (kill-buffer (current-buffer))) |
936 | 936 |
937 | 937 |
938 (defun bookmark-edit-annotation (bookmark) | 938 (defun bookmark-edit-annotation (bookmark) |
939 "Pop up a buffer for editing bookmark BOOKMARK's annotation." | 939 "Pop up a buffer for editing bookmark BOOKMARK's annotation." |
940 (let ((buf (current-buffer)) | 940 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
941 (point (point))) | 941 (bookmark-edit-annotation-mode bookmark)) |
942 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) | |
943 (bookmark-edit-annotation-mode bookmark))) | |
944 | 942 |
945 | 943 |
946 (defun bookmark-insert-current-bookmark () | 944 (defun bookmark-insert-current-bookmark () |
947 "Insert this buffer's value of bookmark-current-bookmark. | 945 "Insert this buffer's value of `bookmark-current-bookmark'. |
948 Default to file name if it's nil." | 946 Default to file name if it's nil." |
949 (interactive) | 947 (interactive) |
950 (let ((str | 948 (let ((str |
951 (save-excursion | 949 (save-excursion |
952 (set-buffer bookmark-current-buffer) | 950 (set-buffer bookmark-current-buffer) |
1002 (forward-word 1) | 1000 (forward-word 1) |
1003 (setq bookmark-yank-point (point))))))) | 1001 (setq bookmark-yank-point (point))))))) |
1004 (insert string))) | 1002 (insert string))) |
1005 | 1003 |
1006 | 1004 |
1005 (defvar Info-current-file) | |
1006 | |
1007 (defun bookmark-buffer-file-name () | 1007 (defun bookmark-buffer-file-name () |
1008 "Return the current buffer's file in a way useful for bookmarks. | 1008 "Return the current buffer's file in a way useful for bookmarks. |
1009 For example, if this is a Info buffer, return the Info file's name." | 1009 For example, if this is a Info buffer, return the Info file's name." |
1010 (if (eq major-mode 'Info-mode) | 1010 (if (eq major-mode 'Info-mode) |
1011 Info-current-file | 1011 Info-current-file |
1044 (sort (copy-alist bookmark-alist) | 1044 (sort (copy-alist bookmark-alist) |
1045 (function | 1045 (function |
1046 (lambda (x y) (string-lessp (car x) (car y)))))))) | 1046 (lambda (x y) (string-lessp (car x) (car y)))))))) |
1047 | 1047 |
1048 | 1048 |
1049 (defvar bookmark-after-jump-hook nil | |
1050 "Hook run after `bookmark-jump' jumps to a bookmark. | |
1051 Useful for example to unhide text in `outline-mode'.") | |
1052 | |
1049 ;;;###autoload | 1053 ;;;###autoload |
1050 (defun bookmark-jump (bookmark) | 1054 (defun bookmark-jump (bookmark) |
1051 "Jump to bookmark BOOKMARK (a point in some file). | 1055 "Jump to bookmark BOOKMARK (a point in some file). |
1052 You may have a problem using this function if the value of variable | 1056 You may have a problem using this function if the value of variable |
1053 `bookmark-alist' is nil. If that happens, you need to load in some | 1057 `bookmark-alist' is nil. If that happens, you need to load in some |
1054 bookmarks. See help on function `bookmark-load' for more about | 1058 bookmarks. See help on function `bookmark-load' for more about |
1055 this. | 1059 this. |
1056 | 1060 |
1057 If the file pointed to by BOOKMARK no longer exists, you will be asked | 1061 If the file pointed to by BOOKMARK no longer exists, you will be asked |
1058 if you wish to give the bookmark a new location, and bookmark-jump | 1062 if you wish to give the bookmark a new location, and `bookmark-jump' |
1059 will then jump to the new location, as well as recording it in place | 1063 will then jump to the new location, as well as recording it in place |
1060 of the old one in the permanent bookmark record." | 1064 of the old one in the permanent bookmark record." |
1061 (interactive | 1065 (interactive |
1062 (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark)) | 1066 (list (bookmark-completing-read "Jump to bookmark" |
1067 bookmark-current-bookmark))) | |
1068 (unless bookmark | |
1069 (error "No bookmark specified")) | |
1063 (bookmark-maybe-historicize-string bookmark) | 1070 (bookmark-maybe-historicize-string bookmark) |
1064 (let ((cell (bookmark-jump-noselect bookmark))) | 1071 (let ((cell (bookmark-jump-noselect bookmark))) |
1065 (and cell | 1072 (and cell |
1066 (switch-to-buffer (car cell)) | 1073 (switch-to-buffer (car cell)) |
1067 (goto-char (cdr cell)) | 1074 (goto-char (cdr cell)) |
1075 (progn (run-hooks 'bookmark-after-jump-hook) t) | |
1068 (if bookmark-automatically-show-annotations | 1076 (if bookmark-automatically-show-annotations |
1069 ;; if there is an annotation for this bookmark, | 1077 ;; if there is an annotation for this bookmark, |
1070 ;; show it in a buffer. | 1078 ;; show it in a buffer. |
1071 (bookmark-show-annotation bookmark))))) | 1079 (bookmark-show-annotation bookmark))))) |
1072 | 1080 |
1108 (save-window-excursion | 1116 (save-window-excursion |
1109 (if info-node | 1117 (if info-node |
1110 ;; Info nodes must be visited with care. | 1118 ;; Info nodes must be visited with care. |
1111 (progn | 1119 (progn |
1112 (require 'info) | 1120 (require 'info) |
1113 (Info-find-node file info-node)) | 1121 (with-no-warnings |
1122 (Info-find-node file info-node))) | |
1114 ;; Else no Info. Can do an ordinary find-file: | 1123 ;; Else no Info. Can do an ordinary find-file: |
1115 (set-buffer (find-file-noselect file)) | 1124 (set-buffer (find-file-noselect file)) |
1116 (goto-char place)) | 1125 (goto-char place)) |
1117 | 1126 |
1118 ;; Go searching forward first. Then, if forward-str exists and | 1127 ;; Go searching forward first. Then, if forward-str exists and |
1150 (defun bookmark-relocate (bookmark) | 1159 (defun bookmark-relocate (bookmark) |
1151 "Relocate BOOKMARK to another file (reading file name with minibuffer). | 1160 "Relocate BOOKMARK to another file (reading file name with minibuffer). |
1152 This makes an already existing bookmark point to that file, instead of | 1161 This makes an already existing bookmark point to that file, instead of |
1153 the one it used to point at. Useful when a file has been renamed | 1162 the one it used to point at. Useful when a file has been renamed |
1154 after a bookmark was set in it." | 1163 after a bookmark was set in it." |
1155 (interactive (bookmark-completing-read "Bookmark to relocate")) | 1164 (interactive (list (bookmark-completing-read "Bookmark to relocate"))) |
1156 (bookmark-maybe-historicize-string bookmark) | 1165 (bookmark-maybe-historicize-string bookmark) |
1157 (bookmark-maybe-load-default-file) | 1166 (bookmark-maybe-load-default-file) |
1158 (let* ((bmrk-filename (bookmark-get-filename bookmark)) | 1167 (let* ((bmrk-filename (bookmark-get-filename bookmark)) |
1159 (newloc (expand-file-name | 1168 (newloc (expand-file-name |
1160 (read-file-name | 1169 (read-file-name |
1167 ;;;###autoload | 1176 ;;;###autoload |
1168 (defun bookmark-insert-location (bookmark &optional no-history) | 1177 (defun bookmark-insert-location (bookmark &optional no-history) |
1169 "Insert the name of the file associated with BOOKMARK. | 1178 "Insert the name of the file associated with BOOKMARK. |
1170 Optional second arg NO-HISTORY means don't record this in the | 1179 Optional second arg NO-HISTORY means don't record this in the |
1171 minibuffer history list `bookmark-history'." | 1180 minibuffer history list `bookmark-history'." |
1172 (interactive (bookmark-completing-read "Insert bookmark location")) | 1181 (interactive (list (bookmark-completing-read "Insert bookmark location"))) |
1173 (or no-history (bookmark-maybe-historicize-string bookmark)) | 1182 (or no-history (bookmark-maybe-historicize-string bookmark)) |
1174 (let ((start (point))) | 1183 (let ((start (point))) |
1175 (prog1 | 1184 (prog1 |
1176 (insert (bookmark-location bookmark)) ; *Return this line* | 1185 (insert (bookmark-location bookmark)) ; *Return this line* |
1177 (if (and (display-color-p) (display-mouse-p)) | 1186 (if (and (display-color-p) (display-mouse-p)) |
1178 (add-text-properties start | 1187 (add-text-properties |
1179 (save-excursion (re-search-backward | 1188 start |
1180 "[^ \t]") | 1189 (save-excursion (re-search-backward |
1190 "[^ \t]") | |
1181 (1+ (point))) | 1191 (1+ (point))) |
1182 '(mouse-face highlight | 1192 '(mouse-face highlight |
1183 help-echo "mouse-2: go to this bookmark")))))) | 1193 follow-link t |
1194 help-echo "mouse-2: go to this bookmark in other window")))))) | |
1184 | 1195 |
1185 ;;;###autoload | 1196 ;;;###autoload |
1186 (defalias 'bookmark-locate 'bookmark-insert-location) | 1197 (defalias 'bookmark-locate 'bookmark-insert-location) |
1187 | 1198 |
1188 (defun bookmark-location (bookmark) | 1199 (defun bookmark-location (bookmark) |
1202 must pass at least OLD when calling from Lisp. | 1213 must pass at least OLD when calling from Lisp. |
1203 | 1214 |
1204 While you are entering the new name, consecutive C-w's insert | 1215 While you are entering the new name, consecutive C-w's insert |
1205 consecutive words from the text of the buffer into the new bookmark | 1216 consecutive words from the text of the buffer into the new bookmark |
1206 name." | 1217 name." |
1207 (interactive (bookmark-completing-read "Old bookmark name")) | 1218 (interactive (list (bookmark-completing-read "Old bookmark name"))) |
1208 (bookmark-maybe-historicize-string old) | 1219 (bookmark-maybe-historicize-string old) |
1209 (bookmark-maybe-load-default-file) | 1220 (bookmark-maybe-load-default-file) |
1210 | 1221 |
1211 (setq bookmark-current-point (point)) | 1222 (setq bookmark-current-point (point)) |
1212 (setq bookmark-yank-point (point)) | 1223 (setq bookmark-yank-point (point)) |
1235 "Insert the text of the file pointed to by bookmark BOOKMARK. | 1246 "Insert the text of the file pointed to by bookmark BOOKMARK. |
1236 You may have a problem using this function if the value of variable | 1247 You may have a problem using this function if the value of variable |
1237 `bookmark-alist' is nil. If that happens, you need to load in some | 1248 `bookmark-alist' is nil. If that happens, you need to load in some |
1238 bookmarks. See help on function `bookmark-load' for more about | 1249 bookmarks. See help on function `bookmark-load' for more about |
1239 this." | 1250 this." |
1240 (interactive (bookmark-completing-read "Insert bookmark contents")) | 1251 (interactive (list (bookmark-completing-read "Insert bookmark contents"))) |
1241 (bookmark-maybe-historicize-string bookmark) | 1252 (bookmark-maybe-historicize-string bookmark) |
1242 (bookmark-maybe-load-default-file) | 1253 (bookmark-maybe-load-default-file) |
1243 (let ((orig-point (point)) | 1254 (let ((orig-point (point)) |
1244 (str-to-insert | 1255 (str-to-insert |
1245 (save-excursion | 1256 (save-excursion |
1258 not be deleted. Defaults to the \"current\" bookmark \(that is, the | 1269 not be deleted. Defaults to the \"current\" bookmark \(that is, the |
1259 one most recently used in this file, if any\). | 1270 one most recently used in this file, if any\). |
1260 Optional second arg BATCH means don't update the bookmark list buffer, | 1271 Optional second arg BATCH means don't update the bookmark list buffer, |
1261 probably because we were called from there." | 1272 probably because we were called from there." |
1262 (interactive | 1273 (interactive |
1263 (bookmark-completing-read "Delete bookmark" bookmark-current-bookmark)) | 1274 (list (bookmark-completing-read "Delete bookmark" |
1275 bookmark-current-bookmark))) | |
1264 (bookmark-maybe-historicize-string bookmark) | 1276 (bookmark-maybe-historicize-string bookmark) |
1265 (bookmark-maybe-load-default-file) | 1277 (bookmark-maybe-load-default-file) |
1266 (let ((will-go (bookmark-get-bookmark bookmark))) | 1278 (let ((will-go (bookmark-get-bookmark bookmark))) |
1267 (setq bookmark-alist (delq will-go bookmark-alist)) | 1279 (setq bookmark-alist (delq will-go bookmark-alist)) |
1268 ;; Added by db, nil bookmark-current-bookmark if the last | 1280 ;; Added by db, nil bookmark-current-bookmark if the last |
1309 "Save currently defined bookmarks. | 1321 "Save currently defined bookmarks. |
1310 Saves by default in the file defined by the variable | 1322 Saves by default in the file defined by the variable |
1311 `bookmark-default-file'. With a prefix arg, save it in file FILE | 1323 `bookmark-default-file'. With a prefix arg, save it in file FILE |
1312 \(second argument\). | 1324 \(second argument\). |
1313 | 1325 |
1314 If you are calling this from Lisp, the two arguments are PREFIX-ARG | 1326 If you are calling this from Lisp, the two arguments are PARG and |
1315 and FILE, and if you just want it to write to the default file, then | 1327 FILE, and if you just want it to write to the default file, then |
1316 pass no arguments. Or pass in nil and FILE, and it will save in FILE | 1328 pass no arguments. Or pass in nil and FILE, and it will save in FILE |
1317 instead. If you pass in one argument, and it is non-nil, then the | 1329 instead. If you pass in one argument, and it is non-nil, then the |
1318 user will be interactively queried for a file to save in. | 1330 user will be interactively queried for a file to save in. |
1319 | 1331 |
1320 When you want to load in the bookmarks from a file, use | 1332 When you want to load in the bookmarks from a file, use |
1344 | 1356 |
1345 | 1357 |
1346 (defun bookmark-write-file (file) | 1358 (defun bookmark-write-file (file) |
1347 (save-excursion | 1359 (save-excursion |
1348 (save-window-excursion | 1360 (save-window-excursion |
1349 (if (>= baud-rate 9600) | 1361 (bookmark-maybe-message "Saving bookmarks to file %s..." file) |
1350 (message "Saving bookmarks to file %s..." file)) | 1362 (set-buffer (get-buffer-create " *Bookmarks*")) |
1351 (set-buffer (let ((enable-local-variables nil)) | |
1352 (find-file-noselect file))) | |
1353 (goto-char (point-min)) | 1363 (goto-char (point-min)) |
1364 (delete-region (point-min) (point-max)) | |
1354 (let ((print-length nil) | 1365 (let ((print-length nil) |
1355 (print-level nil)) | 1366 (print-level nil)) |
1356 (delete-region (point-min) (point-max)) | |
1357 (bookmark-insert-file-format-version-stamp) | 1367 (bookmark-insert-file-format-version-stamp) |
1358 (pp bookmark-alist (current-buffer)) | 1368 (pp bookmark-alist (current-buffer)) |
1359 (let ((version-control | 1369 (let ((version-control |
1360 (cond | 1370 (cond |
1361 ((null bookmark-version-control) nil) | 1371 ((null bookmark-version-control) nil) |
1362 ((eq 'never bookmark-version-control) 'never) | 1372 ((eq 'never bookmark-version-control) 'never) |
1363 ((eq 'nospecial bookmark-version-control) version-control) | 1373 ((eq 'nospecial bookmark-version-control) version-control) |
1364 (t | 1374 (t |
1365 t)))) | 1375 t)))) |
1366 (write-file file) | 1376 (condition-case nil |
1377 (write-region (point-min) (point-max) file) | |
1378 (file-error (message "Can't write %s" file))) | |
1367 (kill-buffer (current-buffer)) | 1379 (kill-buffer (current-buffer)) |
1368 (if (>= baud-rate 9600) | 1380 (bookmark-maybe-message |
1369 (message "Saving bookmarks to file %s...done" file))))))) | 1381 "Saving bookmarks to file %s...done" file)))))) |
1370 | 1382 |
1371 | 1383 |
1372 (defun bookmark-import-new-list (new-list) | 1384 (defun bookmark-import-new-list (new-list) |
1373 ;; Walk over the new list, adding each individual bookmark | 1385 ;; Walk over the new list, adding each individual bookmark |
1374 ;; carefully. "Carefully" means checking against the existing | 1386 ;; carefully. "Carefully" means checking against the existing |
1430 "~/" bookmark-default-file 'confirm))) | 1442 "~/" bookmark-default-file 'confirm))) |
1431 (setq file (expand-file-name file)) | 1443 (setq file (expand-file-name file)) |
1432 (if (file-readable-p file) | 1444 (if (file-readable-p file) |
1433 (save-excursion | 1445 (save-excursion |
1434 (save-window-excursion | 1446 (save-window-excursion |
1435 (if (and (null no-msg) (>= baud-rate 9600)) | 1447 (if (null no-msg) |
1436 (message "Loading bookmarks from %s..." file)) | 1448 (bookmark-maybe-message "Loading bookmarks from %s..." file)) |
1437 (set-buffer (let ((enable-local-variables nil)) | 1449 (set-buffer (let ((enable-local-variables nil)) |
1438 (find-file-noselect file))) | 1450 (find-file-noselect file))) |
1439 (goto-char (point-min)) | 1451 (goto-char (point-min)) |
1440 (bookmark-maybe-upgrade-file-format) | 1452 (bookmark-maybe-upgrade-file-format) |
1441 (let ((blist (bookmark-alist-from-buffer))) | 1453 (let ((blist (bookmark-alist-from-buffer))) |
1454 file) | 1466 file) |
1455 (setq bookmarks-already-loaded t)) | 1467 (setq bookmarks-already-loaded t)) |
1456 (bookmark-bmenu-surreptitiously-rebuild-list)) | 1468 (bookmark-bmenu-surreptitiously-rebuild-list)) |
1457 (error "Invalid bookmark list in %s" file))) | 1469 (error "Invalid bookmark list in %s" file))) |
1458 (kill-buffer (current-buffer))) | 1470 (kill-buffer (current-buffer))) |
1459 (if (and (null no-msg) (>= baud-rate 9600)) | 1471 (if (null no-msg) |
1460 (message "Loading bookmarks from %s...done" file))) | 1472 (bookmark-maybe-message "Loading bookmarks from %s...done" file))) |
1461 (error "Cannot read bookmark file %s" file))) | 1473 (error "Cannot read bookmark file %s" file))) |
1462 | 1474 |
1463 | 1475 |
1464 | 1476 |
1465 ;;; Code supporting the dired-like bookmark menu. Prefix is | 1477 ;;; Code supporting the dired-like bookmark menu. Prefix is |
1503 (define-key bookmark-bmenu-mode-map "?" 'describe-mode) | 1515 (define-key bookmark-bmenu-mode-map "?" 'describe-mode) |
1504 (define-key bookmark-bmenu-mode-map "u" 'bookmark-bmenu-unmark) | 1516 (define-key bookmark-bmenu-mode-map "u" 'bookmark-bmenu-unmark) |
1505 (define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark) | 1517 (define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark) |
1506 (define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load) | 1518 (define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load) |
1507 (define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename) | 1519 (define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename) |
1520 (define-key bookmark-bmenu-mode-map "R" 'bookmark-bmenu-relocate) | |
1508 (define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames) | 1521 (define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames) |
1509 (define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation) | 1522 (define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation) |
1510 (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations) | 1523 (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations) |
1511 (define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation) | 1524 (define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation) |
1512 (define-key bookmark-bmenu-mode-map [mouse-2] | 1525 (define-key bookmark-bmenu-mode-map [mouse-2] |
1544 (interactive) | 1557 (interactive) |
1545 (bookmark-maybe-load-default-file) | 1558 (bookmark-maybe-load-default-file) |
1546 (if (interactive-p) | 1559 (if (interactive-p) |
1547 (switch-to-buffer (get-buffer-create "*Bookmark List*")) | 1560 (switch-to-buffer (get-buffer-create "*Bookmark List*")) |
1548 (set-buffer (get-buffer-create "*Bookmark List*"))) | 1561 (set-buffer (get-buffer-create "*Bookmark List*"))) |
1549 (let ((buffer-read-only nil)) | 1562 (let ((inhibit-read-only t)) |
1550 (delete-region (point-max) (point-min)) | 1563 (erase-buffer) |
1551 (goto-char (point-min)) ;sure are playing it safe... | |
1552 (insert "% Bookmark\n- --------\n") | 1564 (insert "% Bookmark\n- --------\n") |
1565 (add-text-properties (point-min) (point) | |
1566 '(font-lock-face bookmark-menu-heading)) | |
1553 (bookmark-maybe-sort-alist) | 1567 (bookmark-maybe-sort-alist) |
1554 (mapcar | 1568 (mapcar |
1555 (lambda (full-record) | 1569 (lambda (full-record) |
1556 ;; if a bookmark has an annotation, prepend a "*" | 1570 ;; if a bookmark has an annotation, prepend a "*" |
1557 ;; in the list of bookmarks. | 1571 ;; in the list of bookmarks. |
1561 (insert " *") | 1575 (insert " *") |
1562 (insert " ")) | 1576 (insert " ")) |
1563 (let ((start (point))) | 1577 (let ((start (point))) |
1564 (insert (bookmark-name-from-full-record full-record)) | 1578 (insert (bookmark-name-from-full-record full-record)) |
1565 (if (and (display-color-p) (display-mouse-p)) | 1579 (if (and (display-color-p) (display-mouse-p)) |
1566 (add-text-properties start | 1580 (add-text-properties |
1567 (save-excursion (re-search-backward | 1581 start |
1568 "[^ \t]") | 1582 (save-excursion (re-search-backward |
1569 (1+ (point))) | 1583 "[^ \t]") |
1570 '(mouse-face highlight | 1584 (1+ (point))) |
1571 help-echo "mouse-2: go to this bookmark"))) | 1585 '(mouse-face highlight |
1586 follow-link t | |
1587 help-echo "mouse-2: go to this bookmark in other window"))) | |
1572 (insert "\n") | 1588 (insert "\n") |
1573 ))) | 1589 ))) |
1574 bookmark-alist)) | 1590 bookmark-alist)) |
1575 (goto-char (point-min)) | 1591 (goto-char (point-min)) |
1576 (forward-line 2) | 1592 (forward-line 2) |
1602 \\[bookmark-bmenu-this-window] -- select this bookmark in place of the bookmark menu buffer. | 1618 \\[bookmark-bmenu-this-window] -- select this bookmark in place of the bookmark menu buffer. |
1603 \\[bookmark-bmenu-other-window] -- select this bookmark in another window, | 1619 \\[bookmark-bmenu-other-window] -- select this bookmark in another window, |
1604 so the bookmark menu bookmark remains visible in its window. | 1620 so the bookmark menu bookmark remains visible in its window. |
1605 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark. | 1621 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark. |
1606 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\). | 1622 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\). |
1623 \\[bookmark-bmenu-relocate] -- relocate this bookmark's file \(prompts for new file\). | |
1607 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down. | 1624 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down. |
1608 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. | 1625 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. |
1609 \\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'. | 1626 \\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'. |
1610 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file. | 1627 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file. |
1611 With a prefix arg, prompts for a file to save in. | 1628 With a prefix arg, prompts for a file to save in. |
1621 (use-local-map bookmark-bmenu-mode-map) | 1638 (use-local-map bookmark-bmenu-mode-map) |
1622 (setq truncate-lines t) | 1639 (setq truncate-lines t) |
1623 (setq buffer-read-only t) | 1640 (setq buffer-read-only t) |
1624 (setq major-mode 'bookmark-bmenu-mode) | 1641 (setq major-mode 'bookmark-bmenu-mode) |
1625 (setq mode-name "Bookmark Menu") | 1642 (setq mode-name "Bookmark Menu") |
1626 (run-hooks 'bookmark-bmenu-mode-hook)) | 1643 (run-mode-hooks 'bookmark-bmenu-mode-hook)) |
1627 | 1644 |
1628 | 1645 |
1629 (defun bookmark-bmenu-toggle-filenames (&optional show) | 1646 (defun bookmark-bmenu-toggle-filenames (&optional show) |
1630 "Toggle whether filenames are shown in the bookmark list. | 1647 "Toggle whether filenames are shown in the bookmark list. |
1631 Optional argument SHOW means show them unconditionally." | 1648 Optional argument SHOW means show them unconditionally." |
1649 (save-excursion | 1666 (save-excursion |
1650 (save-window-excursion | 1667 (save-window-excursion |
1651 (goto-char (point-min)) | 1668 (goto-char (point-min)) |
1652 (forward-line 2) | 1669 (forward-line 2) |
1653 (setq bookmark-bmenu-hidden-bookmarks ()) | 1670 (setq bookmark-bmenu-hidden-bookmarks ()) |
1654 (let ((buffer-read-only nil)) | 1671 (let ((inhibit-read-only t)) |
1655 (while (< (point) (point-max)) | 1672 (while (< (point) (point-max)) |
1656 (let ((bmrk (bookmark-bmenu-bookmark))) | 1673 (let ((bmrk (bookmark-bmenu-bookmark))) |
1657 (setq bookmark-bmenu-hidden-bookmarks | 1674 (setq bookmark-bmenu-hidden-bookmarks |
1658 (cons bmrk bookmark-bmenu-hidden-bookmarks)) | 1675 (cons bmrk bookmark-bmenu-hidden-bookmarks)) |
1659 (let ((start (save-excursion (end-of-line) (point)))) | 1676 (let ((start (save-excursion (end-of-line) (point)))) |
1682 (goto-char (point-min)) | 1699 (goto-char (point-min)) |
1683 (search-forward "Bookmark") | 1700 (search-forward "Bookmark") |
1684 (backward-word 1) | 1701 (backward-word 1) |
1685 (setq bookmark-bmenu-bookmark-column (current-column))) | 1702 (setq bookmark-bmenu-bookmark-column (current-column))) |
1686 (save-excursion | 1703 (save-excursion |
1687 (let ((buffer-read-only nil)) | 1704 (let ((inhibit-read-only t)) |
1688 (while bookmark-bmenu-hidden-bookmarks | 1705 (while bookmark-bmenu-hidden-bookmarks |
1689 (move-to-column bookmark-bmenu-bookmark-column t) | 1706 (move-to-column bookmark-bmenu-bookmark-column t) |
1690 (bookmark-kill-line) | 1707 (bookmark-kill-line) |
1691 (let ((start (point))) | 1708 (let ((start (point))) |
1692 (insert (car bookmark-bmenu-hidden-bookmarks)) | 1709 (insert (car bookmark-bmenu-hidden-bookmarks)) |
1693 (if (and (display-color-p) (display-mouse-p)) | 1710 (if (and (display-color-p) (display-mouse-p)) |
1694 (add-text-properties start | 1711 (add-text-properties |
1695 (save-excursion (re-search-backward | 1712 start |
1696 "[^ \t]") | 1713 (save-excursion (re-search-backward |
1697 (1+ (point))) | 1714 "[^ \t]") |
1698 '(mouse-face highlight | 1715 (1+ (point))) |
1699 help-echo | 1716 '(mouse-face highlight |
1700 "mouse-2: go to this bookmark")))) | 1717 follow-link t |
1718 help-echo | |
1719 "mouse-2: go to this bookmark in other window")))) | |
1701 (setq bookmark-bmenu-hidden-bookmarks | 1720 (setq bookmark-bmenu-hidden-bookmarks |
1702 (cdr bookmark-bmenu-hidden-bookmarks)) | 1721 (cdr bookmark-bmenu-hidden-bookmarks)) |
1703 (forward-line 1)))))))) | 1722 (forward-line 1)))))))) |
1704 | 1723 |
1705 | 1724 |
1785 (defun bookmark-bmenu-mark () | 1804 (defun bookmark-bmenu-mark () |
1786 "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]." | 1805 "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]." |
1787 (interactive) | 1806 (interactive) |
1788 (beginning-of-line) | 1807 (beginning-of-line) |
1789 (if (bookmark-bmenu-check-position) | 1808 (if (bookmark-bmenu-check-position) |
1790 (let ((buffer-read-only nil)) | 1809 (let ((inhibit-read-only t)) |
1791 (delete-char 1) | 1810 (delete-char 1) |
1792 (insert ?>) | 1811 (insert ?>) |
1793 (forward-line 1) | 1812 (forward-line 1) |
1794 (bookmark-bmenu-check-position)))) | 1813 (bookmark-bmenu-check-position)))) |
1795 | 1814 |
1804 (others ()) | 1823 (others ()) |
1805 tem) | 1824 tem) |
1806 (goto-char (point-min)) | 1825 (goto-char (point-min)) |
1807 (while (re-search-forward "^>" nil t) | 1826 (while (re-search-forward "^>" nil t) |
1808 (setq tem (bookmark-bmenu-bookmark)) | 1827 (setq tem (bookmark-bmenu-bookmark)) |
1809 (let ((buffer-read-only nil)) | 1828 (let ((inhibit-read-only t)) |
1810 (delete-char -1) | 1829 (delete-char -1) |
1811 (insert ?\ )) | 1830 (insert ?\s)) |
1812 (or (string-equal tem bmrk) | 1831 (or (string-equal tem bmrk) |
1813 (member tem others) | 1832 (member tem others) |
1814 (setq others (cons tem others)))) | 1833 (setq others (cons tem others)))) |
1815 (setq others (nreverse others) | 1834 (setq others (nreverse others) |
1816 tem (/ (1- (frame-height)) (1+ (length others)))) | 1835 tem (/ (1- (frame-height)) (1+ (length others)))) |
1951 Optional BACKUP means move up." | 1970 Optional BACKUP means move up." |
1952 (interactive "P") | 1971 (interactive "P") |
1953 (beginning-of-line) | 1972 (beginning-of-line) |
1954 (if (bookmark-bmenu-check-position) | 1973 (if (bookmark-bmenu-check-position) |
1955 (progn | 1974 (progn |
1956 (let ((buffer-read-only nil)) | 1975 (let ((inhibit-read-only t)) |
1957 (delete-char 1) | 1976 (delete-char 1) |
1958 ;; any flags to reset according to circumstances? How about a | 1977 ;; any flags to reset according to circumstances? How about a |
1959 ;; flag indicating whether this bookmark is being visited? | 1978 ;; flag indicating whether this bookmark is being visited? |
1960 ;; well, we don't have this now, so maybe later. | 1979 ;; well, we don't have this now, so maybe later. |
1961 (insert " ")) | 1980 (insert " ")) |
1978 "Mark bookmark on this line to be deleted. | 1997 "Mark bookmark on this line to be deleted. |
1979 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." | 1998 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." |
1980 (interactive) | 1999 (interactive) |
1981 (beginning-of-line) | 2000 (beginning-of-line) |
1982 (if (bookmark-bmenu-check-position) | 2001 (if (bookmark-bmenu-check-position) |
1983 (let ((buffer-read-only nil)) | 2002 (let ((inhibit-read-only t)) |
1984 (delete-char 1) | 2003 (delete-char 1) |
1985 (insert ?D) | 2004 (insert ?D) |
1986 (forward-line 1) | 2005 (forward-line 1) |
1987 (bookmark-bmenu-check-position)))) | 2006 (bookmark-bmenu-check-position)))) |
1988 | 2007 |
2052 (defun bookmark-bmenu-locate () | 2071 (defun bookmark-bmenu-locate () |
2053 "Display location of this bookmark. Displays in the minibuffer." | 2072 "Display location of this bookmark. Displays in the minibuffer." |
2054 (interactive) | 2073 (interactive) |
2055 (if (bookmark-bmenu-check-position) | 2074 (if (bookmark-bmenu-check-position) |
2056 (let ((bmrk (bookmark-bmenu-bookmark))) | 2075 (let ((bmrk (bookmark-bmenu-bookmark))) |
2057 (message (bookmark-location bmrk))))) | 2076 (message "%s" (bookmark-location bmrk))))) |
2058 | 2077 |
2078 (defun bookmark-bmenu-relocate () | |
2079 "Change the file path of the bookmark on the current line, | |
2080 prompting with completion for the new path." | |
2081 (interactive) | |
2082 (if (bookmark-bmenu-check-position) | |
2083 (let ((bmrk (bookmark-bmenu-bookmark)) | |
2084 (thispoint (point))) | |
2085 (bookmark-relocate bmrk) | |
2086 (goto-char thispoint)))) | |
2059 | 2087 |
2060 | 2088 |
2061 ;;; Menu bar stuff. Prefix is "bookmark-menu". | 2089 ;;; Menu bar stuff. Prefix is "bookmark-menu". |
2062 | |
2063 (defun bookmark-menu-build-paned-menu (name entries) | |
2064 "Build a multi-paned menu named NAME from the strings in ENTRIES. | |
2065 That is, ENTRIES is a list of strings which appear as the choices | |
2066 in the menu. The number of panes depends on the number of entries. | |
2067 The visible entries are truncated to `bookmark-menu-length', but the | |
2068 strings returned are not." | |
2069 (let* ((f-height (/ (frame-height) 2)) | |
2070 (pane-list | |
2071 (let (temp-pane-list | |
2072 (iter 0)) | |
2073 (while entries | |
2074 (let (lst | |
2075 (count 0)) | |
2076 (while (and (< count f-height) entries) | |
2077 (let ((str (car entries))) | |
2078 (setq lst (cons | |
2079 (cons | |
2080 (if (> (length str) bookmark-menu-length) | |
2081 (substring str 0 bookmark-menu-length) | |
2082 str) | |
2083 str) | |
2084 lst)) | |
2085 (setq entries (cdr entries)) | |
2086 (setq count (1+ count)))) | |
2087 (setq iter (1+ iter)) | |
2088 (setq | |
2089 temp-pane-list | |
2090 (cons | |
2091 (cons | |
2092 (format "-*- %s (%d) -*-" name iter) | |
2093 (nreverse lst)) | |
2094 temp-pane-list)))) | |
2095 (nreverse temp-pane-list)))) | |
2096 | |
2097 ;; Return the menu: | |
2098 (cons (concat "-*- " name " -*-") pane-list))) | |
2099 | |
2100 | 2090 |
2101 (defun bookmark-menu-popup-paned-menu (event name entries) | 2091 (defun bookmark-menu-popup-paned-menu (event name entries) |
2102 "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. | 2092 "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. |
2103 That is, ENTRIES is a list of strings which appear as the choices | 2093 That is, ENTRIES is a list of strings which appear as the choices |
2104 in the menu. | 2094 in the menu. |
2105 The number of panes depends on the number of entries." | 2095 The number of panes depends on the number of entries. |
2106 (interactive "e") | 2096 The visible entries are truncated to `bookmark-menu-length', but the |
2107 (x-popup-menu event (bookmark-menu-build-paned-menu name entries))) | 2097 strings returned are not." |
2108 | 2098 (let ((f-height (/ (frame-height) 2)) |
2109 | 2099 (pane-list nil) |
2110 (defun bookmark-menu-popup-paned-bookmark-menu (event name) | 2100 (iter 0)) |
2111 "Pop up menu of bookmarks, return chosen bookmark. | 2101 (while entries |
2112 Pop up at EVENT, menu's name is NAME. | 2102 (let (lst |
2113 The number of panes depends on the number of bookmarks." | 2103 (count 0)) |
2114 (bookmark-menu-popup-paned-menu event name (bookmark-all-names))) | 2104 (while (and (< count f-height) entries) |
2115 | 2105 (let ((str (car entries))) |
2116 | 2106 (push (cons |
2117 (defun bookmark-popup-menu-and-apply-function (func-sym menu-label event) | 2107 (if (> (length str) bookmark-menu-length) |
2118 ;; help function for making menus that need to apply a bookmark | 2108 (substring str 0 bookmark-menu-length) |
2119 ;; function to a string. | 2109 str) |
2120 (let* ((choice (bookmark-menu-popup-paned-bookmark-menu | 2110 str) |
2121 event menu-label))) | 2111 lst) |
2122 (if choice (apply func-sym (list choice))))) | 2112 (setq entries (cdr entries)) |
2123 | 2113 (setq count (1+ count)))) |
2124 | 2114 (setq iter (1+ iter)) |
2125 ;;;###autoload | 2115 (push (cons |
2126 (defun bookmark-menu-insert (event) | 2116 (format "-*- %s (%d) -*-" name iter) |
2127 "Insert the text of the file pointed to by bookmark BOOKMARK. | 2117 (nreverse lst)) |
2128 You may have a problem using this function if the value of variable | 2118 pane-list))) |
2129 `bookmark-alist' is nil. If that happens, you need to load in some | 2119 |
2130 bookmarks. See help on function `bookmark-load' for more about | 2120 ;; Popup the menu and return the string. |
2131 this. | 2121 (x-popup-menu event (cons (concat "-*- " name " -*-") |
2132 | 2122 (nreverse pane-list))))) |
2133 Warning: this function only takes an EVENT as argument. Use the | |
2134 corresponding bookmark function from Lisp \(the one without the | |
2135 \"-menu-\" in its name\)." | |
2136 (interactive "e") | |
2137 (bookmark-popup-menu-and-apply-function | |
2138 'bookmark-insert "Insert Bookmark Contents" event)) | |
2139 | |
2140 | |
2141 ;;;###autoload | |
2142 (defun bookmark-menu-jump (event) | |
2143 "Jump to bookmark BOOKMARK (a point in some file). | |
2144 You may have a problem using this function if the value of variable | |
2145 `bookmark-alist' is nil. If that happens, you need to load in some | |
2146 bookmarks. See help on function `bookmark-load' for more about | |
2147 this. | |
2148 | |
2149 Warning: this function only takes an EVENT as argument. Use the | |
2150 corresponding bookmark function from Lisp \(the one without the | |
2151 \"-menu-\" in its name\)." | |
2152 (interactive "e") | |
2153 (bookmark-popup-menu-and-apply-function | |
2154 'bookmark-jump "Jump to Bookmark" event)) | |
2155 | |
2156 | |
2157 ;;;###autoload | |
2158 (defun bookmark-menu-locate (event) | |
2159 "Insert the name of the file associated with BOOKMARK. | |
2160 \(This is not the same as the contents of that file\). | |
2161 | |
2162 Warning: this function only takes an EVENT as argument. Use the | |
2163 corresponding bookmark function from Lisp \(the one without the | |
2164 \"-menu-\" in its name\)." | |
2165 (interactive "e") | |
2166 (bookmark-popup-menu-and-apply-function | |
2167 'bookmark-insert-location "Insert Bookmark Location" event)) | |
2168 | |
2169 | |
2170 ;;;###autoload | |
2171 (defun bookmark-menu-rename (event) | |
2172 "Change the name of OLD-BOOKMARK to NEWNAME. | |
2173 If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME. | |
2174 If called from menubar, OLD-BOOKMARK is selected from a menu, and | |
2175 prompts for NEWNAME. | |
2176 If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was | |
2177 passed as an argument. If called with two strings, then no prompting | |
2178 is done. You must pass at least OLD-BOOKMARK when calling from Lisp. | |
2179 | |
2180 While you are entering the new name, consecutive C-w's insert | |
2181 consecutive words from the text of the buffer into the new bookmark | |
2182 name. | |
2183 | |
2184 Warning: this function only takes an EVENT as argument. Use the | |
2185 corresponding bookmark function from Lisp \(the one without the | |
2186 \"-menu-\" in its name\)." | |
2187 (interactive "e") | |
2188 (bookmark-popup-menu-and-apply-function | |
2189 'bookmark-rename "Rename Bookmark" event)) | |
2190 | |
2191 | |
2192 ;;;###autoload | |
2193 (defun bookmark-menu-delete (event) | |
2194 "Delete the bookmark named NAME from the bookmark list. | |
2195 Removes only the first instance of a bookmark with that name. If | |
2196 there are one or more other bookmarks with the same name, they will | |
2197 not be deleted. Defaults to the \"current\" bookmark \(that is, the | |
2198 one most recently used in this file, if any\). | |
2199 | |
2200 Warning: this function only takes an EVENT as argument. Use the | |
2201 corresponding bookmark function from Lisp \(the one without the | |
2202 \"-menu-\" in its name\)." | |
2203 (interactive "e") | |
2204 (bookmark-popup-menu-and-apply-function | |
2205 'bookmark-delete "Delete Bookmark" event)) | |
2206 | 2123 |
2207 | 2124 |
2208 ;; Thanks to Roland McGrath for fixing menubar.el so that the | 2125 ;; Thanks to Roland McGrath for fixing menubar.el so that the |
2209 ;; following works, and for explaining what to do to make it work. | 2126 ;; following works, and for explaining what to do to make it work. |
2210 | 2127 |
2212 ;; that the whole job is done in loaddefs.el. | 2129 ;; that the whole job is done in loaddefs.el. |
2213 | 2130 |
2214 ;; Emacs menubar stuff. | 2131 ;; Emacs menubar stuff. |
2215 | 2132 |
2216 ;;;###autoload | 2133 ;;;###autoload |
2217 (defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions")) | 2134 (defvar menu-bar-bookmark-map |
2135 (let ((map (make-sparse-keymap "Bookmark functions"))) | |
2136 (define-key map [load] '("Load a Bookmark File..." . bookmark-load)) | |
2137 (define-key map [write] '("Save Bookmarks As..." . bookmark-write)) | |
2138 (define-key map [save] '("Save Bookmarks" . bookmark-save)) | |
2139 (define-key map [edit] '("Edit Bookmark List" . bookmark-bmenu-list)) | |
2140 (define-key map [delete] '("Delete Bookmark..." . bookmark-delete)) | |
2141 (define-key map [rename] '("Rename Bookmark..." . bookmark-rename)) | |
2142 (define-key map [locate] '("Insert Location..." . bookmark-locate)) | |
2143 (define-key map [insert] '("Insert Contents..." . bookmark-insert)) | |
2144 (define-key map [set] '("Set Bookmark..." . bookmark-set)) | |
2145 (define-key map [jump] '("Jump to Bookmark..." . bookmark-jump)) | |
2146 map)) | |
2218 | 2147 |
2219 ;;;###autoload | 2148 ;;;###autoload |
2220 (defalias 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map)) | 2149 (defalias 'menu-bar-bookmark-map menu-bar-bookmark-map) |
2221 | 2150 |
2222 ;; make bookmarks appear toward the right side of the menu. | 2151 ;; make bookmarks appear toward the right side of the menu. |
2223 (if (boundp 'menu-bar-final-items) | 2152 (if (boundp 'menu-bar-final-items) |
2224 (if menu-bar-final-items | 2153 (if menu-bar-final-items |
2225 (setq menu-bar-final-items | 2154 (setq menu-bar-final-items |
2226 (cons 'bookmark menu-bar-final-items))) | 2155 (cons 'bookmark menu-bar-final-items))) |
2227 (setq menu-bar-final-items '(bookmark))) | 2156 (setq menu-bar-final-items '(bookmark))) |
2228 | 2157 |
2229 ;;;###autoload | |
2230 (define-key menu-bar-bookmark-map [load] | |
2231 '("Load a Bookmark File..." . bookmark-load)) | |
2232 | |
2233 ;;;###autoload | |
2234 (define-key menu-bar-bookmark-map [write] | |
2235 '("Save Bookmarks As..." . bookmark-write)) | |
2236 | |
2237 ;;;###autoload | |
2238 (define-key menu-bar-bookmark-map [save] | |
2239 '("Save Bookmarks" . bookmark-save)) | |
2240 | |
2241 ;;;###autoload | |
2242 (define-key menu-bar-bookmark-map [edit] | |
2243 '("Edit Bookmark List" . bookmark-bmenu-list)) | |
2244 | |
2245 ;;;###autoload | |
2246 (define-key menu-bar-bookmark-map [delete] | |
2247 '("Delete Bookmark" . bookmark-menu-delete)) | |
2248 | |
2249 ;;;###autoload | |
2250 (define-key menu-bar-bookmark-map [rename] | |
2251 '("Rename Bookmark" . bookmark-menu-rename)) | |
2252 | |
2253 ;;;###autoload | |
2254 (define-key menu-bar-bookmark-map [locate] | |
2255 '("Insert Location" . bookmark-menu-locate)) | |
2256 | |
2257 ;;;###autoload | |
2258 (define-key menu-bar-bookmark-map [insert] | |
2259 '("Insert Contents" . bookmark-menu-insert)) | |
2260 | |
2261 ;;;###autoload | |
2262 (define-key menu-bar-bookmark-map [set] | |
2263 '("Set Bookmark" . bookmark-set)) | |
2264 | |
2265 ;;;###autoload | |
2266 (define-key menu-bar-bookmark-map [jump] | |
2267 '("Jump to Bookmark" . bookmark-menu-jump)) | |
2268 | |
2269 ;;;; end bookmark menu stuff ;;;; | 2158 ;;;; end bookmark menu stuff ;;;; |
2270 | 2159 |
2271 | 2160 |
2272 ;;; Load Hook | 2161 ;;; Load Hook |
2273 (defvar bookmark-load-hook nil | 2162 (defvar bookmark-load-hook nil |
2274 "Hook to run at the end of loading bookmark.") | 2163 "Hook run at the end of loading bookmark.") |
2275 | 2164 |
2276 ;;; Exit Hook, called from kill-emacs-hook | 2165 ;;; Exit Hook, called from kill-emacs-hook |
2277 (defvar bookmark-exit-hook nil | 2166 (defvar bookmark-exit-hook nil |
2278 "Hook to run when emacs exits") | 2167 "Hook run when Emacs exits.") |
2168 | |
2169 (define-obsolete-variable-alias 'bookmark-exit-hooks 'bookmark-exit-hook "22.1") | |
2279 | 2170 |
2280 (defun bookmark-exit-hook-internal () | 2171 (defun bookmark-exit-hook-internal () |
2281 "Save bookmark state, if necessary, at Emacs exit time. | 2172 "Save bookmark state, if necessary, at Emacs exit time. |
2282 This also runs `bookmark-exit-hooks'." | 2173 This also runs `bookmark-exit-hook'." |
2283 (and | 2174 (run-hooks 'bookmark-exit-hook) |
2284 (progn (run-hooks 'bookmark-exit-hooks) t) | 2175 (and bookmark-alist |
2285 bookmark-alist | 2176 (bookmark-time-to-save-p t) |
2286 (bookmark-time-to-save-p t) | 2177 (bookmark-save))) |
2287 (bookmark-save))) | |
2288 | 2178 |
2289 (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) | 2179 (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) |
2290 | 2180 |
2291 | 2181 |
2292 (run-hooks 'bookmark-load-hook) | 2182 (run-hooks 'bookmark-load-hook) |
2293 | 2183 |
2294 (provide 'bookmark) | 2184 (provide 'bookmark) |
2295 | 2185 |
2186 ;;; arch-tag: 139f519a-dd0c-4b8d-8b5d-f9fcf53ca8f6 | |
2296 ;;; bookmark.el ends here | 2187 ;;; bookmark.el ends here |