1 |
;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later |
;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later |
2 |
|
|
3 |
;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001 Free Software Foundation |
;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2003 Free Software Foundation |
4 |
|
|
5 |
;; Author: Karl Fogel <kfogel@red-bean.com> |
;; Author: Karl Fogel <kfogel@red-bean.com> |
6 |
;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
234 |
key of your choice to `bookmark-map'. All interactive bookmark |
key of your choice to `bookmark-map'. All interactive bookmark |
235 |
functions have a binding in this keymap.") |
functions have a binding in this keymap.") |
236 |
|
|
237 |
;;;###autoload |
;;;###autoload (define-prefix-command 'bookmark-map) |
|
(define-prefix-command 'bookmark-map) |
|
238 |
|
|
239 |
;; Read the help on all of these functions for details... |
;; Read the help on all of these functions for details... |
240 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "x" 'bookmark-set) |
241 |
(define-key bookmark-map "x" 'bookmark-set) |
;;;###autoload (define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark" |
242 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "j" 'bookmark-jump) |
243 |
(define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark" |
;;;###autoload (define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go" |
244 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "i" 'bookmark-insert) |
245 |
(define-key bookmark-map "j" 'bookmark-jump) |
;;;###autoload (define-key bookmark-map "e" 'edit-bookmarks) |
246 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "f" 'bookmark-insert-location) ; "f" for "find" |
247 |
(define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go" |
;;;###autoload (define-key bookmark-map "r" 'bookmark-rename) |
248 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "d" 'bookmark-delete) |
249 |
(define-key bookmark-map "i" 'bookmark-insert) |
;;;###autoload (define-key bookmark-map "l" 'bookmark-load) |
250 |
;;;###autoload |
;;;###autoload (define-key bookmark-map "w" 'bookmark-write) |
251 |
(define-key bookmark-map "e" 'edit-bookmarks) |
;;;###autoload (define-key bookmark-map "s" 'bookmark-save) |
|
;;;###autoload |
|
|
(define-key bookmark-map "f" 'bookmark-insert-location) ; "f" for "find" |
|
|
;;;###autoload |
|
|
(define-key bookmark-map "r" 'bookmark-rename) |
|
|
;;;###autoload |
|
|
(define-key bookmark-map "d" 'bookmark-delete) |
|
|
;;;###autoload |
|
|
(define-key bookmark-map "l" 'bookmark-load) |
|
|
;;;###autoload |
|
|
(define-key bookmark-map "w" 'bookmark-write) |
|
|
;;;###autoload |
|
|
(define-key bookmark-map "s" 'bookmark-save) |
|
252 |
|
|
253 |
|
|
254 |
;;; The annotation maps. |
;;; The annotation maps. |
456 |
Optional second arg DEFAULT is a string to return if the user enters |
Optional second arg DEFAULT is a string to return if the user enters |
457 |
the empty string." |
the empty string." |
458 |
(bookmark-maybe-load-default-file) ; paranoia |
(bookmark-maybe-load-default-file) ; paranoia |
459 |
(let* ((completion-ignore-case bookmark-completion-ignore-case) |
(if (listp last-nonmenu-event) |
460 |
(default default) |
(bookmark-menu-popup-paned-menu t prompt (bookmark-all-names)) |
461 |
(prompt (if default |
(let* ((completion-ignore-case bookmark-completion-ignore-case) |
462 |
(concat prompt (format " (%s): " default)) |
(default default) |
463 |
(concat prompt ": "))) |
(prompt (if default |
464 |
(str |
(concat prompt (format " (%s): " default)) |
465 |
(completing-read prompt |
(concat prompt ": "))) |
466 |
bookmark-alist |
(str |
467 |
nil |
(completing-read prompt |
468 |
0 |
bookmark-alist |
469 |
nil |
nil |
470 |
'bookmark-history))) |
0 |
471 |
(if (string-equal "" str) |
nil |
472 |
(list default) |
'bookmark-history))) |
473 |
(list str)))) |
(if (string-equal "" str) default str)))) |
474 |
|
|
475 |
|
|
476 |
(defmacro bookmark-maybe-historicize-string (string) |
(defmacro bookmark-maybe-historicize-string (string) |
924 |
|
|
925 |
(defun bookmark-edit-annotation (bookmark) |
(defun bookmark-edit-annotation (bookmark) |
926 |
"Pop up a buffer for editing bookmark BOOKMARK's annotation." |
"Pop up a buffer for editing bookmark BOOKMARK's annotation." |
927 |
(let ((buf (current-buffer)) |
(pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
928 |
(point (point))) |
(bookmark-edit-annotation-mode bookmark)) |
|
(pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
|
|
(bookmark-edit-annotation-mode bookmark))) |
|
929 |
|
|
930 |
|
|
931 |
(defun bookmark-insert-current-bookmark () |
(defun bookmark-insert-current-bookmark () |
1044 |
will then jump to the new location, as well as recording it in place |
will then jump to the new location, as well as recording it in place |
1045 |
of the old one in the permanent bookmark record." |
of the old one in the permanent bookmark record." |
1046 |
(interactive |
(interactive |
1047 |
(bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark)) |
(list (bookmark-completing-read "Jump to bookmark" |
1048 |
|
bookmark-current-bookmark))) |
1049 |
(bookmark-maybe-historicize-string bookmark) |
(bookmark-maybe-historicize-string bookmark) |
1050 |
(let ((cell (bookmark-jump-noselect bookmark))) |
(let ((cell (bookmark-jump-noselect bookmark))) |
1051 |
(and cell |
(and cell |
1138 |
This makes an already existing bookmark point to that file, instead of |
This makes an already existing bookmark point to that file, instead of |
1139 |
the one it used to point at. Useful when a file has been renamed |
the one it used to point at. Useful when a file has been renamed |
1140 |
after a bookmark was set in it." |
after a bookmark was set in it." |
1141 |
(interactive (bookmark-completing-read "Bookmark to relocate")) |
(interactive (list (bookmark-completing-read "Bookmark to relocate"))) |
1142 |
(bookmark-maybe-historicize-string bookmark) |
(bookmark-maybe-historicize-string bookmark) |
1143 |
(bookmark-maybe-load-default-file) |
(bookmark-maybe-load-default-file) |
1144 |
(let* ((bmrk-filename (bookmark-get-filename bookmark)) |
(let* ((bmrk-filename (bookmark-get-filename bookmark)) |
1155 |
"Insert the name of the file associated with BOOKMARK. |
"Insert the name of the file associated with BOOKMARK. |
1156 |
Optional second arg NO-HISTORY means don't record this in the |
Optional second arg NO-HISTORY means don't record this in the |
1157 |
minibuffer history list `bookmark-history'." |
minibuffer history list `bookmark-history'." |
1158 |
(interactive (bookmark-completing-read "Insert bookmark location")) |
(interactive (list (bookmark-completing-read "Insert bookmark location"))) |
1159 |
(or no-history (bookmark-maybe-historicize-string bookmark)) |
(or no-history (bookmark-maybe-historicize-string bookmark)) |
1160 |
(let ((start (point))) |
(let ((start (point))) |
1161 |
(prog1 |
(prog1 |
1190 |
While you are entering the new name, consecutive C-w's insert |
While you are entering the new name, consecutive C-w's insert |
1191 |
consecutive words from the text of the buffer into the new bookmark |
consecutive words from the text of the buffer into the new bookmark |
1192 |
name." |
name." |
1193 |
(interactive (bookmark-completing-read "Old bookmark name")) |
(interactive (list (bookmark-completing-read "Old bookmark name"))) |
1194 |
(bookmark-maybe-historicize-string old) |
(bookmark-maybe-historicize-string old) |
1195 |
(bookmark-maybe-load-default-file) |
(bookmark-maybe-load-default-file) |
1196 |
|
|
1223 |
`bookmark-alist' is nil. If that happens, you need to load in some |
`bookmark-alist' is nil. If that happens, you need to load in some |
1224 |
bookmarks. See help on function `bookmark-load' for more about |
bookmarks. See help on function `bookmark-load' for more about |
1225 |
this." |
this." |
1226 |
(interactive (bookmark-completing-read "Insert bookmark contents")) |
(interactive (list (bookmark-completing-read "Insert bookmark contents"))) |
1227 |
(bookmark-maybe-historicize-string bookmark) |
(bookmark-maybe-historicize-string bookmark) |
1228 |
(bookmark-maybe-load-default-file) |
(bookmark-maybe-load-default-file) |
1229 |
(let ((orig-point (point)) |
(let ((orig-point (point)) |
1246 |
Optional second arg BATCH means don't update the bookmark list buffer, |
Optional second arg BATCH means don't update the bookmark list buffer, |
1247 |
probably because we were called from there." |
probably because we were called from there." |
1248 |
(interactive |
(interactive |
1249 |
(bookmark-completing-read "Delete bookmark" bookmark-current-bookmark)) |
(list (bookmark-completing-read "Delete bookmark" |
1250 |
|
bookmark-current-bookmark))) |
1251 |
(bookmark-maybe-historicize-string bookmark) |
(bookmark-maybe-historicize-string bookmark) |
1252 |
(bookmark-maybe-load-default-file) |
(bookmark-maybe-load-default-file) |
1253 |
(let ((will-go (bookmark-get-bookmark bookmark))) |
(let ((will-go (bookmark-get-bookmark bookmark))) |
1533 |
(if (interactive-p) |
(if (interactive-p) |
1534 |
(switch-to-buffer (get-buffer-create "*Bookmark List*")) |
(switch-to-buffer (get-buffer-create "*Bookmark List*")) |
1535 |
(set-buffer (get-buffer-create "*Bookmark List*"))) |
(set-buffer (get-buffer-create "*Bookmark List*"))) |
1536 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1537 |
(delete-region (point-max) (point-min)) |
(erase-buffer) |
|
(goto-char (point-min)) ;sure are playing it safe... |
|
1538 |
(insert "% Bookmark\n- --------\n") |
(insert "% Bookmark\n- --------\n") |
1539 |
(bookmark-maybe-sort-alist) |
(bookmark-maybe-sort-alist) |
1540 |
(mapcar |
(mapcar |
1637 |
(goto-char (point-min)) |
(goto-char (point-min)) |
1638 |
(forward-line 2) |
(forward-line 2) |
1639 |
(setq bookmark-bmenu-hidden-bookmarks ()) |
(setq bookmark-bmenu-hidden-bookmarks ()) |
1640 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1641 |
(while (< (point) (point-max)) |
(while (< (point) (point-max)) |
1642 |
(let ((bmrk (bookmark-bmenu-bookmark))) |
(let ((bmrk (bookmark-bmenu-bookmark))) |
1643 |
(setq bookmark-bmenu-hidden-bookmarks |
(setq bookmark-bmenu-hidden-bookmarks |
1670 |
(backward-word 1) |
(backward-word 1) |
1671 |
(setq bookmark-bmenu-bookmark-column (current-column))) |
(setq bookmark-bmenu-bookmark-column (current-column))) |
1672 |
(save-excursion |
(save-excursion |
1673 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1674 |
(while bookmark-bmenu-hidden-bookmarks |
(while bookmark-bmenu-hidden-bookmarks |
1675 |
(move-to-column bookmark-bmenu-bookmark-column t) |
(move-to-column bookmark-bmenu-bookmark-column t) |
1676 |
(bookmark-kill-line) |
(bookmark-kill-line) |
1773 |
(interactive) |
(interactive) |
1774 |
(beginning-of-line) |
(beginning-of-line) |
1775 |
(if (bookmark-bmenu-check-position) |
(if (bookmark-bmenu-check-position) |
1776 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1777 |
(delete-char 1) |
(delete-char 1) |
1778 |
(insert ?>) |
(insert ?>) |
1779 |
(forward-line 1) |
(forward-line 1) |
1792 |
(goto-char (point-min)) |
(goto-char (point-min)) |
1793 |
(while (re-search-forward "^>" nil t) |
(while (re-search-forward "^>" nil t) |
1794 |
(setq tem (bookmark-bmenu-bookmark)) |
(setq tem (bookmark-bmenu-bookmark)) |
1795 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1796 |
(delete-char -1) |
(delete-char -1) |
1797 |
(insert ?\ )) |
(insert ?\ )) |
1798 |
(or (string-equal tem bmrk) |
(or (string-equal tem bmrk) |
1939 |
(beginning-of-line) |
(beginning-of-line) |
1940 |
(if (bookmark-bmenu-check-position) |
(if (bookmark-bmenu-check-position) |
1941 |
(progn |
(progn |
1942 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1943 |
(delete-char 1) |
(delete-char 1) |
1944 |
;; any flags to reset according to circumstances? How about a |
;; any flags to reset according to circumstances? How about a |
1945 |
;; flag indicating whether this bookmark is being visited? |
;; flag indicating whether this bookmark is being visited? |
1966 |
(interactive) |
(interactive) |
1967 |
(beginning-of-line) |
(beginning-of-line) |
1968 |
(if (bookmark-bmenu-check-position) |
(if (bookmark-bmenu-check-position) |
1969 |
(let ((buffer-read-only nil)) |
(let ((inhibit-read-only t)) |
1970 |
(delete-char 1) |
(delete-char 1) |
1971 |
(insert ?D) |
(insert ?D) |
1972 |
(forward-line 1) |
(forward-line 1) |
2046 |
|
|
2047 |
;;; Menu bar stuff. Prefix is "bookmark-menu". |
;;; Menu bar stuff. Prefix is "bookmark-menu". |
2048 |
|
|
|
(defun bookmark-menu-build-paned-menu (name entries) |
|
|
"Build a multi-paned menu named NAME from the strings in ENTRIES. |
|
|
That is, ENTRIES is a list of strings which appear as the choices |
|
|
in the menu. The number of panes depends on the number of entries. |
|
|
The visible entries are truncated to `bookmark-menu-length', but the |
|
|
strings returned are not." |
|
|
(let* ((f-height (/ (frame-height) 2)) |
|
|
(pane-list |
|
|
(let (temp-pane-list |
|
|
(iter 0)) |
|
|
(while entries |
|
|
(let (lst |
|
|
(count 0)) |
|
|
(while (and (< count f-height) entries) |
|
|
(let ((str (car entries))) |
|
|
(setq lst (cons |
|
|
(cons |
|
|
(if (> (length str) bookmark-menu-length) |
|
|
(substring str 0 bookmark-menu-length) |
|
|
str) |
|
|
str) |
|
|
lst)) |
|
|
(setq entries (cdr entries)) |
|
|
(setq count (1+ count)))) |
|
|
(setq iter (1+ iter)) |
|
|
(setq |
|
|
temp-pane-list |
|
|
(cons |
|
|
(cons |
|
|
(format "-*- %s (%d) -*-" name iter) |
|
|
(nreverse lst)) |
|
|
temp-pane-list)))) |
|
|
(nreverse temp-pane-list)))) |
|
|
|
|
|
;; Return the menu: |
|
|
(cons (concat "-*- " name " -*-") pane-list))) |
|
|
|
|
|
|
|
2049 |
(defun bookmark-menu-popup-paned-menu (event name entries) |
(defun bookmark-menu-popup-paned-menu (event name entries) |
2050 |
"Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. |
"Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. |
2051 |
That is, ENTRIES is a list of strings which appear as the choices |
That is, ENTRIES is a list of strings which appear as the choices |
2052 |
in the menu. |
in the menu. |
2053 |
The number of panes depends on the number of entries." |
The number of panes depends on the number of entries. |
2054 |
(interactive "e") |
The visible entries are truncated to `bookmark-menu-length', but the |
2055 |
(x-popup-menu event (bookmark-menu-build-paned-menu name entries))) |
strings returned are not." |
2056 |
|
(let ((f-height (/ (frame-height) 2)) |
2057 |
|
(pane-list nil) |
2058 |
(defun bookmark-menu-popup-paned-bookmark-menu (event name) |
(iter 0)) |
2059 |
"Pop up menu of bookmarks, return chosen bookmark. |
(while entries |
2060 |
Pop up at EVENT, menu's name is NAME. |
(let (lst |
2061 |
The number of panes depends on the number of bookmarks." |
(count 0)) |
2062 |
(bookmark-menu-popup-paned-menu event name (bookmark-all-names))) |
(while (and (< count f-height) entries) |
2063 |
|
(let ((str (car entries))) |
2064 |
|
(push (cons |
2065 |
(defun bookmark-popup-menu-and-apply-function (func-sym menu-label event) |
(if (> (length str) bookmark-menu-length) |
2066 |
;; help function for making menus that need to apply a bookmark |
(substring str 0 bookmark-menu-length) |
2067 |
;; function to a string. |
str) |
2068 |
(let* ((choice (bookmark-menu-popup-paned-bookmark-menu |
str) |
2069 |
event menu-label))) |
lst) |
2070 |
(if choice (apply func-sym (list choice))))) |
(setq entries (cdr entries)) |
2071 |
|
(setq count (1+ count)))) |
2072 |
|
(setq iter (1+ iter)) |
2073 |
;;;###autoload |
(push (cons |
2074 |
(defun bookmark-menu-insert (event) |
(format "-*- %s (%d) -*-" name iter) |
2075 |
"Insert the text of the file pointed to by bookmark BOOKMARK. |
(nreverse lst)) |
2076 |
You may have a problem using this function if the value of variable |
pane-list))) |
2077 |
`bookmark-alist' is nil. If that happens, you need to load in some |
|
2078 |
bookmarks. See help on function `bookmark-load' for more about |
;; Popup the menu and return the string. |
2079 |
this. |
(x-popup-menu event (cons (concat "-*- " name " -*-") |
2080 |
|
(nreverse pane-list))))) |
|
Warning: this function only takes an EVENT as argument. Use the |
|
|
corresponding bookmark function from Lisp \(the one without the |
|
|
\"-menu-\" in its name\)." |
|
|
(interactive "e") |
|
|
(bookmark-popup-menu-and-apply-function |
|
|
'bookmark-insert "Insert Bookmark Contents" event)) |
|
|
|
|
|
|
|
|
;;;###autoload |
|
|
(defun bookmark-menu-jump (event) |
|
|
"Jump to bookmark BOOKMARK (a point in some file). |
|
|
You may have a problem using this function if the value of variable |
|
|
`bookmark-alist' is nil. If that happens, you need to load in some |
|
|
bookmarks. See help on function `bookmark-load' for more about |
|
|
this. |
|
|
|
|
|
Warning: this function only takes an EVENT as argument. Use the |
|
|
corresponding bookmark function from Lisp \(the one without the |
|
|
\"-menu-\" in its name\)." |
|
|
(interactive "e") |
|
|
(bookmark-popup-menu-and-apply-function |
|
|
'bookmark-jump "Jump to Bookmark" event)) |
|
|
|
|
|
|
|
|
;;;###autoload |
|
|
(defun bookmark-menu-locate (event) |
|
|
"Insert the name of the file associated with BOOKMARK. |
|
|
\(This is not the same as the contents of that file\). |
|
|
|
|
|
Warning: this function only takes an EVENT as argument. Use the |
|
|
corresponding bookmark function from Lisp \(the one without the |
|
|
\"-menu-\" in its name\)." |
|
|
(interactive "e") |
|
|
(bookmark-popup-menu-and-apply-function |
|
|
'bookmark-insert-location "Insert Bookmark Location" event)) |
|
|
|
|
|
|
|
|
;;;###autoload |
|
|
(defun bookmark-menu-rename (event) |
|
|
"Change the name of OLD-BOOKMARK to NEWNAME. |
|
|
If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME. |
|
|
If called from menubar, OLD-BOOKMARK is selected from a menu, and |
|
|
prompts for NEWNAME. |
|
|
If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was |
|
|
passed as an argument. If called with two strings, then no prompting |
|
|
is done. You must pass at least OLD-BOOKMARK when calling from Lisp. |
|
|
|
|
|
While you are entering the new name, consecutive C-w's insert |
|
|
consecutive words from the text of the buffer into the new bookmark |
|
|
name. |
|
|
|
|
|
Warning: this function only takes an EVENT as argument. Use the |
|
|
corresponding bookmark function from Lisp \(the one without the |
|
|
\"-menu-\" in its name\)." |
|
|
(interactive "e") |
|
|
(bookmark-popup-menu-and-apply-function |
|
|
'bookmark-rename "Rename Bookmark" event)) |
|
|
|
|
|
|
|
|
;;;###autoload |
|
|
(defun bookmark-menu-delete (event) |
|
|
"Delete the bookmark named NAME from the bookmark list. |
|
|
Removes only the first instance of a bookmark with that name. If |
|
|
there are one or more other bookmarks with the same name, they will |
|
|
not be deleted. Defaults to the \"current\" bookmark \(that is, the |
|
|
one most recently used in this file, if any\). |
|
|
|
|
|
Warning: this function only takes an EVENT as argument. Use the |
|
|
corresponding bookmark function from Lisp \(the one without the |
|
|
\"-menu-\" in its name\)." |
|
|
(interactive "e") |
|
|
(bookmark-popup-menu-and-apply-function |
|
|
'bookmark-delete "Delete Bookmark" event)) |
|
2081 |
|
|
2082 |
|
|
2083 |
;; Thanks to Roland McGrath for fixing menubar.el so that the |
;; Thanks to Roland McGrath for fixing menubar.el so that the |
2089 |
;; Emacs menubar stuff. |
;; Emacs menubar stuff. |
2090 |
|
|
2091 |
;;;###autoload |
;;;###autoload |
2092 |
(defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions")) |
(defvar menu-bar-bookmark-map |
2093 |
|
(let ((map (make-sparse-keymap "Bookmark functions"))) |
2094 |
|
(define-key map [load] '("Load a Bookmark File..." . bookmark-load)) |
2095 |
|
(define-key map [write] '("Save Bookmarks As..." . bookmark-write)) |
2096 |
|
(define-key map [save] '("Save Bookmarks" . bookmark-save)) |
2097 |
|
(define-key map [edit] '("Edit Bookmark List" . bookmark-bmenu-list)) |
2098 |
|
(define-key map [delete] '("Delete Bookmark" . bookmark-delete)) |
2099 |
|
(define-key map [rename] '("Rename Bookmark" . bookmark-rename)) |
2100 |
|
(define-key map [locate] '("Insert Location" . bookmark-locate)) |
2101 |
|
(define-key map [insert] '("Insert Contents" . bookmark-insert)) |
2102 |
|
(define-key map [set] '("Set Bookmark" . bookmark-set)) |
2103 |
|
(define-key map [jump] '("Jump to Bookmark" . bookmark-jump)) |
2104 |
|
map)) |
2105 |
|
|
2106 |
;;;###autoload |
;;;###autoload |
2107 |
(defalias 'menu-bar-bookmark-map (symbol-value 'menu-bar-bookmark-map)) |
(defalias 'menu-bar-bookmark-map menu-bar-bookmark-map) |
2108 |
|
|
2109 |
;; make bookmarks appear toward the right side of the menu. |
;; make bookmarks appear toward the right side of the menu. |
2110 |
(if (boundp 'menu-bar-final-items) |
(if (boundp 'menu-bar-final-items) |
2113 |
(cons 'bookmark menu-bar-final-items))) |
(cons 'bookmark menu-bar-final-items))) |
2114 |
(setq menu-bar-final-items '(bookmark))) |
(setq menu-bar-final-items '(bookmark))) |
2115 |
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [load] |
|
|
'("Load a Bookmark File..." . bookmark-load)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [write] |
|
|
'("Save Bookmarks As..." . bookmark-write)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [save] |
|
|
'("Save Bookmarks" . bookmark-save)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [edit] |
|
|
'("Edit Bookmark List" . bookmark-bmenu-list)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [delete] |
|
|
'("Delete Bookmark" . bookmark-menu-delete)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [rename] |
|
|
'("Rename Bookmark" . bookmark-menu-rename)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [locate] |
|
|
'("Insert Location" . bookmark-menu-locate)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [insert] |
|
|
'("Insert Contents" . bookmark-menu-insert)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [set] |
|
|
'("Set Bookmark" . bookmark-set)) |
|
|
|
|
|
;;;###autoload |
|
|
(define-key menu-bar-bookmark-map [jump] |
|
|
'("Jump to Bookmark" . bookmark-menu-jump)) |
|
|
|
|
2116 |
;;;; end bookmark menu stuff ;;;; |
;;;; end bookmark menu stuff ;;;; |
2117 |
|
|
2118 |
|
|
2119 |
;;; Load Hook |
;;; Load Hook |
2120 |
(defvar bookmark-load-hook nil |
(defvar bookmark-load-hook nil |
2121 |
"Hook to run at the end of loading bookmark.") |
"Hook run at the end of loading bookmark.") |
2122 |
|
|
2123 |
;;; Exit Hook, called from kill-emacs-hook |
;;; Exit Hook, called from kill-emacs-hook |
2124 |
(defvar bookmark-exit-hook nil |
(defvar bookmark-exit-hook nil |
2125 |
"Hook to run when emacs exits") |
"Hook run when emacs exits.") |
2126 |
|
|
2127 |
(defun bookmark-exit-hook-internal () |
(defun bookmark-exit-hook-internal () |
2128 |
"Save bookmark state, if necessary, at Emacs exit time. |
"Save bookmark state, if necessary, at Emacs exit time. |
2129 |
This also runs `bookmark-exit-hooks'." |
This also runs `bookmark-exit-hooks'." |
2130 |
(and |
(run-hooks 'bookmark-exit-hooks) |
2131 |
(progn (run-hooks 'bookmark-exit-hooks) t) |
(and bookmark-alist |
2132 |
bookmark-alist |
(bookmark-time-to-save-p t) |
2133 |
(bookmark-time-to-save-p t) |
(bookmark-save))) |
|
(bookmark-save))) |
|
2134 |
|
|
2135 |
(add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) |
(add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) |
2136 |
|
|
2139 |
|
|
2140 |
(provide 'bookmark) |
(provide 'bookmark) |
2141 |
|
|
2142 |
|
;;; arch-tag: 139f519a-dd0c-4b8d-8b5d-f9fcf53ca8f6 |
2143 |
;;; bookmark.el ends here |
;;; bookmark.el ends here |