initial commit
[emacs-init.git] / auto-install / bookmark+-key.el
1 ;;; bookmark+-key.el --- Bookmark+ key and menu bindings.
2 ;; 
3 ;; Filename: bookmark+-key.el
4 ;; Description: Bookmark+ key and menu bindings.
5 ;; Author: Drew Adams
6 ;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
7 ;; Copyright (C) 2010-2011, Drew Adams, all rights reserved.
8 ;; Created: Fri Apr  1 15:34:50 2011 (-0700)
9 ;; Version: 
10 ;; Last-Updated: Mon Apr 25 06:54:55 2011 (-0700)
11 ;;           By: dradams
12 ;;     Update #: 256
13 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-key.el
14 ;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, info, url, w3m, gnus
15 ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x
16 ;; 
17 ;; Features that might be required by this library:
18 ;;
19 ;;   None
20 ;;
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 ;; 
23 ;;; Commentary: 
24 ;; 
25 ;;    The Bookmark+ libraries are these:
26 ;;
27 ;;    `bookmark+.el'     - main (driver) library
28 ;;    `bookmark+-mac.el' - Lisp macros
29 ;;    `bookmark+-lit.el' - (optional) code for highlighting bookmarks
30 ;;    `bookmark+-bmu.el' - code for the `*Bookmark List*' (bmenu)
31 ;;    `bookmark+-1.el'   - other (non-bmenu) required code
32 ;;    `bookmark+-key.el' - key and menu bindings (this file)
33 ;;
34 ;;    `bookmark+-doc.el' - documentation (comment-only file)
35 ;;    `bookmark+-chg.el' - change log (comment-only file)
36 ;;
37 ;;    The documentation (in `bookmark+-doc.el') includes how to
38 ;;    byte-compile and install Bookmark+.  The documentation is also
39 ;;    available in these ways:
40 ;;
41 ;;    1. From the bookmark list (`C-x r l'):
42 ;;       Use `?' to show the current bookmark-list status and general
43 ;;       help, then click link `Doc in Commentary' or link `Doc on the
44 ;;       Web'.
45 ;;
46 ;;    2. From the Emacs-Wiki Web site:
47 ;;       http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus.
48 ;;    
49 ;;    3. From the Bookmark+ group customization buffer:
50 ;;       `M-x customize-group bookmark-plus', then click link
51 ;;       `Commentary'.
52 ;;
53 ;;    (The commentary links in #1 and #3 work only if you have library
54 ;;    `bookmark+-doc.el' in your `load-path'.)
55 ;;
56 ;;
57 ;;  Internal variables defined here:
58 ;;
59 ;;    `bmkp-find-file-menu', `bmkp-highlight-menu', `bmkp-jump-map',
60 ;;    `bmkp-jump-menu', `bmkp-options-menu',
61 ;;    `bmkp-jump-other-window-map', `bmkp-jump-tags-menu',
62 ;;    `bmkp-set-map', `bmkp-tags-map', `bmkp-tags-menu'.
63 ;;
64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65 ;; 
66 ;; *This program is free software; you can redistribute it and/or
67 ;; modify it under the terms of the GNU General Public License as
68 ;; published by the Free Software Foundation; either version 3, or
69 ;; (at your option) any later version.
70 ;; 
71 ;; This program is distributed in the hope that it will be useful,
72 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
73 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
74 ;; General Public License for more details.
75 ;; 
76 ;; You should have received a copy of the GNU General Public License
77 ;; along with this program; see the file COPYING.  If not, write to
78 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
79 ;; Floor, Boston, MA 02110-1301, USA.
80 ;; 
81 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82 ;; 
83 ;;; Code:
84
85 ;;;;;;;;;;;;;;;;;;;;;
86
87 ;; Quiet the byte-compiler
88
89 (defvar bmkp-bmenu-menubar-menu)        ; Defined in `bookmark+-bmu.el'.
90 (defvar bmkp-crosshairs-flag)           ; Defined in `bookmark+-1.el'.
91 (defvar bmkp-prompt-for-tags-flag)      ; Defined in `bookmark+-1.el'.
92 (defvar bmkp-save-new-location-flag)    ; Defined in `bookmark+-1.el'.
93 (defvar diredp-menu-bar-subdir-menu)    ; Defined in `dired+.el'.
94 (defvar gnus-summary-mode-map)          ; Defined in `gnus-sum.el'.
95 (defvar Info-mode-map)                  ; Defined in `info.el'.
96 (defvar Info-mode-menu)                 ; Defined in `info.el'.
97 (defvar Man-mode-map)                   ; Defined in `man.el'.
98 (defvar mouse-wheel-down-event)         ; Defined in `mwheel.el'.
99 (defvar mouse-wheel-up-event)           ; Defined in `mwheel.el'.
100 (defvar w3m-minor-mode-map)             ; Defined in `w3m.el'.
101 (defvar w3m-mode-map)                   ; Defined in `w3m.el'.
102 (defvar woman-menu)                     ; Defined in `woman.el'.
103 (defvar woman-mode-map)                 ; Defined in `woman.el'.
104  
105 ;;(@* "Keymaps")
106 ;;; Keymaps ----------------------------------------------------------
107
108 ;; `bookmark-map'
109
110 (define-key ctl-x-map "p" bookmark-map)
111 (define-key ctl-x-map "pj" 'bookmark-jump-other-window)
112 (define-key ctl-x-map "rK" 'bmkp-set-desktop-bookmark)
113 (define-key bookmark-map "0"      'bmkp-empty-file)
114 (define-key bookmark-map "B"      'bmkp-choose-navlist-from-bookmark-list)
115 (define-key bookmark-map "E"      'bmkp-edit-bookmark)
116 (define-key bookmark-map "I"      'bookmark-insert-location) ; The original in `bookmark.el' was `f'.
117 (define-key bookmark-map "K"      'bmkp-set-desktop-bookmark)
118 (define-key bookmark-map "L"      'bmkp-switch-bookmark-file)
119 (define-key bookmark-map "N"      'bmkp-navlist-bmenu-list)
120 (define-key bookmark-map "o"      'bookmark-jump-other-window)
121 (define-key bookmark-map "q"      'bookmark-jump-other-window)
122 (define-key bookmark-map "x"      'bmkp-set-bookmark-file-bookmark)
123 (when (featurep 'bookmark+-lit)
124   (define-key bookmark-map "h"    'bmkp-light-bookmark-this-buffer)
125   (define-key bookmark-map "H"    'bmkp-light-bookmarks)
126   (define-key bookmark-map "u"    'bmkp-unlight-bookmark-this-buffer)
127   (define-key bookmark-map "U"    'bmkp-unlight-bookmarks)
128   (define-key bookmark-map "\C-u" 'bmkp-unlight-bookmark-here)
129   (define-key bookmark-map "="    'bmkp-bookmarks-lighted-at-point))
130 (define-key bookmark-map "."      'bmkp-this-buffer-bmenu-list)
131 (define-key bookmark-map "?"      'bmkp-describe-bookmark)
132 (define-key bookmark-map ":"      'bmkp-choose-navlist-of-type)
133 (define-key bookmark-map "\r"     'bmkp-toggle-autonamed-bookmark-set/delete)
134 (define-key bookmark-map [delete] 'bmkp-delete-bookmarks)
135
136 ;; If you use Emacs before Emacs 22, then you will want to bind the commands
137 ;; whose names do *not* end in `-repeat' to keys that are easily repeatable.
138 ;; For example, you might want to bind `bmkp-next-bookmark-this-buffer'
139 ;; (not `bmkp-next-bookmark-this-buffer-repeat') to a key such as [f2].
140 ;;
141 (when (> emacs-major-version 21)
142   (define-key bookmark-map [down]       'bmkp-next-bookmark-this-buffer-repeat)
143   (define-key bookmark-map "n"          'bmkp-next-bookmark-this-buffer-repeat)
144   (define-key bookmark-map "\C-n"       'bmkp-next-bookmark-this-buffer-repeat)
145
146   ;; This requires the fix for Emacs bug #6256, which is in Emacs 23.3 (presumably).
147   ;; For older Emacs versions you can bind the wheel event to `bmkp-next-bookmark-this-buffer'
148   ;; in the global map.  IOW, prior to Emacs 23.3 a mouse event won't work with `repeat'.
149   (when (and (boundp 'mouse-wheel-up-event)
150              (or (> emacs-major-version 23)
151                  (and (= emacs-major-version 23) (> emacs-minor-version 2))))
152     (define-key bookmark-map (vector (list mouse-wheel-up-event))
153       'bmkp-next-bookmark-this-buffer-repeat))
154   (define-key bookmark-map [up]         'bmkp-previous-bookmark-this-buffer-repeat)
155   (define-key bookmark-map "p"          'bmkp-previous-bookmark-this-buffer-repeat)
156   (define-key bookmark-map "\C-p"       'bmkp-previous-bookmark-this-buffer-repeat)
157
158   ;; This requires the fix for Emacs bug #6256, which is in Emacs 23.3 (presumably).
159   ;; For older Emacs versions you can bind the wheel event to `bmkp-previous-bookmark-this-buffer'
160   ;; in the global map.  IOW, prior to Emacs 23.3 a mouse event won't work with `repeat'.
161   (when (and (boundp 'mouse-wheel-down-event)
162              (or (> emacs-major-version 23)
163                  (and (= emacs-major-version 23) (> emacs-minor-version 2))))
164     (define-key bookmark-map (vector (list mouse-wheel-down-event))
165       'bmkp-previous-bookmark-this-buffer-repeat))
166   (define-key bookmark-map [right]      'bmkp-next-bookmark-repeat)
167   (define-key bookmark-map "f"          'bmkp-next-bookmark-repeat)
168   (define-key bookmark-map "\C-f"       'bmkp-next-bookmark-repeat)
169   (define-key bookmark-map [left]       'bmkp-previous-bookmark-repeat)
170   (define-key bookmark-map "b"          'bmkp-previous-bookmark-repeat)
171   (define-key bookmark-map "\C-b"       'bmkp-previous-bookmark-repeat)
172   (define-key bookmark-map [next]       'bmkp-next-bookmark-w32-repeat)
173   (define-key bookmark-map [prior]      'bmkp-previous-bookmark-w32-repeat)
174   (when (featurep 'bookmark+-lit)
175     (define-key bookmark-map [C-down]   'bmkp-next-lighted-this-buffer-repeat)
176     (define-key bookmark-map [C-up]     'bmkp-previous-lighted-this-buffer-repeat)))
177
178
179 ;; `bmkp-set-map': prefix `C-x p c'
180
181 (defvar bmkp-set-map nil "Keymap containing bindings for bookmark set commands.")
182
183 (define-prefix-command 'bmkp-set-map)
184 (define-key bookmark-map "c"  bmkp-set-map) ; `C-x p c' for create
185
186 (define-key bmkp-set-map "a"  'bmkp-autofile-set) ; `C-x p c a'
187 (define-key bmkp-set-map "f"  'bmkp-file-target-set) ; `C-x p c f'
188 (define-key bmkp-set-map "K"  'bmkp-set-desktop-bookmark) ; `C-x p c K'
189 (define-key bmkp-set-map "m"  'bookmark-set) ; `C-x p c m'
190 (define-key bmkp-set-map "u"  'bmkp-url-target-set) ; `C-x p c u'
191 (define-key bmkp-set-map "x"  'bmkp-set-bookmark-file-bookmark) ; `C-x p c x'
192 (define-key bmkp-set-map "\r" 'bmkp-toggle-autonamed-bookmark-set/delete) ; `C-x p c RET'
193
194
195 ;; Add set commands to other keymaps: occur, compilation: `C-c C-b', `C-c C-M-b', `C-c C-M-B'.
196 ;; See `dired+.el' for Dired bookmarking keys, which are different.
197
198 (add-hook 'occur-mode-hook
199           #'(lambda ()
200               (unless (lookup-key occur-mode-map "\C-c\C-b")
201                 (define-key occur-mode-map "\C-c\C-b" 'bmkp-occur-target-set))
202               (unless (lookup-key occur-mode-map "\C-c\C-\M-b")
203                 (define-key occur-mode-map "\C-c\C-\M-b" 'bmkp-occur-target-set-all))
204               (unless (lookup-key occur-mode-map [(control ?c) (control meta shift ?b)])
205                 (define-key occur-mode-map [(control ?c) (control meta shift ?b)]
206                   'bmkp-occur-create-autonamed-bookmarks))))
207
208 (add-hook 'compilation-mode-hook
209           #'(lambda ()
210               (unless (lookup-key occur-mode-map "\C-c\C-b")
211                 (define-key occur-mode-map "\C-c\C-b" 'bmkp-compilation-target-set))
212               (unless (lookup-key occur-mode-map "\C-c\C-\M-b")
213                 (define-key occur-mode-map "\C-c\C-\M-b" 'bmkp-compilation-target-set-all))))
214
215 (add-hook 'compilation-minor-mode-hook
216           #'(lambda ()
217               (unless (lookup-key occur-mode-map "\C-c\C-b")
218                 (define-key occur-mode-map "\C-c\C-b" 'bmkp-compilation-target-set))
219               (unless (lookup-key occur-mode-map "\C-c\C-\M-b")
220                 (define-key occur-mode-map "\C-c\C-\M-b" 'bmkp-compilation-target-set-all))))
221
222
223 ;; `bmkp-tags-map': prefix `C-x p t'
224
225 (defvar bmkp-tags-map nil "Keymap containing bindings for bookmark tag commands.")
226
227 (define-prefix-command 'bmkp-tags-map)
228 (define-key bookmark-map "t"  bmkp-tags-map) ; `C-x p t' for tags
229
230 (define-key bmkp-tags-map "0"    'bmkp-remove-all-tags) ; `C-x p t 0'
231 (define-key bmkp-tags-map "+"    nil) ; For Emacs 20
232 (define-key bmkp-tags-map "+b"   'bmkp-add-tags) ; `C-x p t + b'
233 (define-key bmkp-tags-map "-b"   'bmkp-remove-tags) ; `C-x p t - b'
234 (define-key bmkp-tags-map "+a"   'bmkp-tag-a-file) ; `C-x p t + a'
235 (define-key bmkp-tags-map "-a"   'bmkp-untag-a-file) ; `C-x p t - a'
236 (define-key bmkp-tags-map "c"    'bmkp-copy-tags) ; `C-x p t c'
237 (define-key bmkp-tags-map "d"    'bmkp-remove-tags-from-all) ; `C-x p t d'
238 (define-key bmkp-tags-map "e"    'bmkp-edit-tags) ; `C-x p t e'
239 (define-key bmkp-tags-map "l"    'bmkp-list-all-tags) ; `C-x p t l'
240 (define-key bmkp-tags-map "p"    'bmkp-paste-add-tags) ; `C-x p t p'
241 (define-key bmkp-tags-map "q"    'bmkp-paste-replace-tags) ; `C-x p t q'
242 (define-key bmkp-tags-map "r"    'bmkp-rename-tag) ; `C-x p t r'
243 (define-key bmkp-tags-map "v"    'bmkp-set-tag-value) ; `C-x p t v'
244 (define-key bmkp-tags-map "V"    'bmkp-set-tag-value-for-navlist) ; `C-x p t V'
245 (define-key bmkp-tags-map "\M-w" 'bmkp-copy-tags) ; `C-x p t M-w'
246 (define-key bmkp-tags-map "\C-y" 'bmkp-paste-add-tags) ; `C-x p t C-y'
247
248
249 ;; `bmkp-jump-map' and `bmkp-jump-other-window-map': prefixes `C-x j' and `C-x 4 j'
250
251 (defvar bmkp-jump-map nil "Keymap containing bindings for bookmark jump commands.")
252
253 (defvar bmkp-jump-other-window-map nil
254   "Keymap containing bindings for bookmark jump other-window commands.")
255
256 (define-prefix-command 'bmkp-jump-map)
257 (define-prefix-command 'bmkp-jump-other-window-map)
258 (define-key ctl-x-map   "j" bmkp-jump-map)
259 (define-key ctl-x-4-map "j" bmkp-jump-other-window-map)
260
261 (define-key bmkp-jump-map              "."    'bmkp-this-buffer-jump) ; `C-x j .'
262 (define-key bmkp-jump-other-window-map "."    'bmkp-this-buffer-jump-other-window) ; `C-x 4 j .'
263 (define-key bmkp-jump-map              "#"    nil) ; For Emacs 20
264 (define-key bmkp-jump-other-window-map "#"    nil) ; For Emacs 20
265 (define-key bmkp-jump-map              "##"   'bmkp-autonamed-jump) ; `C-x j # #'
266 (define-key bmkp-jump-other-window-map "##"   'bmkp-autonamed-jump-other-window) ; `C-x 4 j # #'
267 (define-key bmkp-jump-map              "#."   'bmkp-autonamed-this-buffer-jump) ; `C-x j # .'
268 (define-key bmkp-jump-other-window-map "#."
269   'bmkp-autonamed-this-buffer-jump-other-window) ; `C-x 4 j # .'
270 (define-key bmkp-jump-map              "="    nil) ; For Emacs 20
271 (define-key bmkp-jump-other-window-map "="    nil) ; For Emacs 20
272 (define-key bmkp-jump-map              "=b"   'bmkp-specific-buffers-jump) ; `C-x j = b'
273 (define-key bmkp-jump-other-window-map "=b"   'bmkp-specific-buffers-jump-other-window) ; `C-x 4 j = b'
274 (define-key bmkp-jump-map              "=f"   'bmkp-specific-files-jump) ; `C-x j = f'
275 (define-key bmkp-jump-other-window-map "=f"   'bmkp-specific-files-jump-other-window) ; `C-x 4 j = f'
276 (when (> emacs-major-version 21)        ; Needs `read-file-name' with a PREDICATE arg.
277   (define-key bmkp-jump-map              "a"  'bmkp-find-file) ; `C-x j a'
278   (define-key bmkp-jump-other-window-map "a"  'bmkp-find-file-other-window)) ; `C-x 4 j a'
279 (define-key bmkp-jump-map              "b"    'bmkp-non-file-jump) ; `C-x j b'
280 (define-key bmkp-jump-other-window-map "b"    'bmkp-non-file-jump-other-window) ; `C-x 4 j b'
281 (define-key bmkp-jump-map              "B"    'bmkp-bookmark-list-jump) ; `C-x j B'
282 (define-key bmkp-jump-other-window-map "B"    'bmkp-bookmark-list-jump) ; SAME
283 (define-key bmkp-jump-map              "d"    'bmkp-dired-jump) ; `C-x j d'
284 (define-key bmkp-jump-other-window-map "d"    'bmkp-dired-jump-other-window) ; `C-x 4 j d'
285 (define-key bmkp-jump-map              "\C-d" 'bmkp-dired-this-dir-jump) ; `C-x j C-d'
286 (define-key bmkp-jump-other-window-map "\C-d" 'bmkp-dired-this-dir-jump-other-window) ; `C-x 4 j C-d'
287 (define-key bmkp-jump-map              "f"    'bmkp-file-jump) ; `C-x j f'
288 (define-key bmkp-jump-other-window-map "f"    'bmkp-file-jump-other-window) ; `C-x 4 j f'
289 (define-key bmkp-jump-map              "\C-f" 'bmkp-file-this-dir-jump) ; `C-x j C-f'
290 (define-key bmkp-jump-other-window-map "\C-f" 'bmkp-file-this-dir-jump-other-window) ; `C-x 4 j C-f'
291 (define-key bmkp-jump-map              "g"    'bmkp-gnus-jump) ; `C-x j g'
292 (define-key bmkp-jump-other-window-map "g"    'bmkp-gnus-jump-other-window) ; `C-x 4 j g'
293 (define-key bmkp-jump-map              "h"    'bmkp-lighted-jump) ; `C-x j h'
294 (define-key bmkp-jump-other-window-map "h"    'bmkp-lighted-jump-other-window) ; `C-x 4 j h'
295 (define-key bmkp-jump-map              "i"    'bmkp-info-jump) ; `C-x j i'
296 (define-key bmkp-jump-other-window-map "i"    'bmkp-info-jump-other-window) ; `C-x 4 j i'
297 (define-key bmkp-jump-map              "j"    'bookmark-jump) ; `C-x j j'
298 (put 'bookmark-jump :advertised-binding "\C-xjj")
299
300 (define-key bmkp-jump-other-window-map "j"    'bookmark-jump-other-window) ; `C-x 4 j j'
301 (put 'bookmark-jump-other-window :advertised-binding "\C-x4jj")
302 (put 'jump-other :advertised-binding "\C-x4jj")
303
304 (define-key bmkp-jump-map              "K"    'bmkp-desktop-jump) ; `C-x j K'
305 (define-key bmkp-jump-other-window-map "K"    'bmkp-desktop-jump) ; SAME
306 (define-key bmkp-jump-map              "l"    'bmkp-local-file-jump) ; `C-x j l'
307 (define-key bmkp-jump-other-window-map "l"    'bmkp-local-file-jump-other-window) ; `C-x 4 j l'
308 (define-key bmkp-jump-map              "m"    'bmkp-man-jump) ; `C-x j m'
309 (define-key bmkp-jump-other-window-map "m"    'bmkp-man-jump-other-window) ; `C-x 4 j m'
310 (define-key bmkp-jump-map              "n"    'bmkp-remote-file-jump) ; `C-x j n' ("_n_etwork")
311 (define-key bmkp-jump-other-window-map "n"    'bmkp-remote-file-jump-other-window) ; `C-x 4 j n'
312 (define-key bmkp-jump-map              "N"    'bmkp-jump-in-navlist) ; `C-x j N'
313 (define-key bmkp-jump-other-window-map "N"    'bmkp-jump-in-navlist-other-window) ; `C-x 4 j N'
314 (define-key bmkp-jump-map              "r"    'bmkp-region-jump) ; `C-x j r'
315 (define-key bmkp-jump-other-window-map "r"    'bmkp-region-jump-other-window) ; `C-x 4 j r'
316
317 (define-key bmkp-jump-map              "t"    nil) ; For Emacs 20
318 (define-key bmkp-jump-other-window-map "t"    nil) ; For Emacs 20
319 (define-key bmkp-jump-map              "t*"   'bmkp-all-tags-jump) ; `C-x j t *'
320 (define-key bmkp-jump-other-window-map "t*"   'bmkp-all-tags-jump-other-window) ; `C-x 4 j t *'
321 (define-key bmkp-jump-map              "t+"   'bmkp-some-tags-jump) ; `C-x j t +'
322 (define-key bmkp-jump-other-window-map "t+"   'bmkp-some-tags-jump-other-window) ; `C-x 4 j t +'
323 (define-key bmkp-jump-map              "t%"   nil) ; For Emacs 20
324 (define-key bmkp-jump-other-window-map "t%"   nil) ; For Emacs 20
325 (define-key bmkp-jump-map              "t%*"  'bmkp-all-tags-regexp-jump) ; `C-x j t % *'
326 (define-key bmkp-jump-other-window-map "t%*"
327   'bmkp-all-tags-regexp-jump-other-window) ; `C-x 4 j t % *'
328 (define-key bmkp-jump-map              "t%+"  'bmkp-some-tags-regexp-jump) ; `C-x j t % +'
329 (define-key bmkp-jump-other-window-map "t%+"
330   'bmkp-some-tags-regexp-jump-other-window) ; `C-x 4 j t % +'
331
332 (when (> emacs-major-version 21)        ; Needs `read-file-name' with a PREDICATE arg.
333   (define-key bmkp-jump-map              "ta*"  'bmkp-find-file-all-tags) ; `C-x j t a *'
334   (define-key bmkp-jump-other-window-map "ta*" 'bmkp-find-file-all-tags-other-window) ; `C-x 4 j t a *'
335   (define-key bmkp-jump-map              "ta+"  'bmkp-find-file-some-tags) ; `C-x j t a +'
336   (define-key bmkp-jump-other-window-map "ta+"
337     'bmkp-find-file-some-tags-other-window) ; `C-x 4 j t a +'
338   (define-key bmkp-jump-map              "ta%*" 'bmkp-find-file-all-tags-regexp) ; `C-x j t a % *'
339   (define-key bmkp-jump-other-window-map "ta%*"
340     'bmkp-find-file-all-tags-regexp-other-window) ; `C-x 4 j t a % *'
341   (define-key bmkp-jump-map              "ta%+" 'bmkp-find-file-some-tags-regexp) ; `C-x j t a % +'
342   (define-key bmkp-jump-other-window-map "ta%+"
343     'bmkp-find-file-some-tags-regexp-other-window)) ; `C-x 4 j t a % +'
344
345 (define-key bmkp-jump-map              "tf"   nil) ; For Emacs 20
346 (define-key bmkp-jump-other-window-map "tf"   nil) ; For Emacs 20
347 (define-key bmkp-jump-map              "tf*"  'bmkp-file-all-tags-jump) ; `C-x j t f *'
348 (define-key bmkp-jump-other-window-map "tf*"  'bmkp-file-all-tags-jump-other-window) ; `C-x 4 j t f *'
349 (define-key bmkp-jump-map              "tf+"  'bmkp-file-some-tags-jump) ; `C-x j t f +'
350 (define-key bmkp-jump-other-window-map "tf+"  'bmkp-file-some-tags-jump-other-window) ; `C-x 4 j t f +'
351 (define-key bmkp-jump-map              "tf%"  nil) ; For Emacs 20
352 (define-key bmkp-jump-other-window-map "tf%"  nil) ; For Emacs 20
353 (define-key bmkp-jump-map              "tf%*" 'bmkp-file-all-tags-regexp-jump) ; `C-x j t f % *'
354 (define-key bmkp-jump-other-window-map "tf%*"
355   'bmkp-file-all-tags-regexp-jump-other-window) ; `C-x 4 j t f % *'
356 (define-key bmkp-jump-map              "tf%+" 'bmkp-file-some-tags-regexp-jump) ; `C-x j t f % +'
357 (define-key bmkp-jump-other-window-map "tf%+"
358   'bmkp-file-some-tags-regexp-jump-other-window) ; `C-x 4 j t f % +'
359
360 (define-key bmkp-jump-map              "t\C-f"   nil) ; For Emacs 20
361 (define-key bmkp-jump-other-window-map "t\C-f"   nil) ; For Emacs 20
362 (define-key bmkp-jump-map              "t\C-f*"  'bmkp-file-this-dir-all-tags-jump) ; `C-x j t C-f *'
363 (define-key bmkp-jump-other-window-map "t\C-f*"
364   'bmkp-file-this-dir-all-tags-jump-other-window) ; `C-x 4 j t C-f *'
365 (define-key bmkp-jump-map              "t\C-f+"  'bmkp-file-this-dir-some-tags-jump) ; `C-x j t C-f +'
366 (define-key bmkp-jump-other-window-map "t\C-f+"
367   'bmkp-file-this-dir-some-tags-jump-other-window) ; `C-x 4 j t C-f +'
368 (define-key bmkp-jump-map              "t\C-f%"  nil) ; For Emacs 20
369 (define-key bmkp-jump-other-window-map "t\C-f%"  nil) ; For Emacs 20
370 (define-key bmkp-jump-map              "t\C-f%*"
371   'bmkp-file-this-dir-all-tags-regexp-jump) ; `C-x j t C-f % *'
372 (define-key bmkp-jump-other-window-map "t\C-f%*"
373   'bmkp-file-this-dir-all-tags-regexp-jump-other-window) ; `C-x 4 j t C-f % *'
374 (define-key bmkp-jump-map              "t\C-f%+"
375   'bmkp-file-this-dir-some-tags-regexp-jump) ; `C-x j t C-f % +'
376 (define-key bmkp-jump-other-window-map "t\C-f%+"
377   'bmkp-file-this-dir-some-tags-regexp-jump-other-window) ; `C-x 4 j t C-f % +'
378
379 (define-key bmkp-jump-map              "u"    'bmkp-url-jump) ; `C-x j u'
380 (define-key bmkp-jump-other-window-map "u"    'bmkp-url-jump-other-window) ; `C-x 4 j u'
381 (define-key bmkp-jump-map              "v"    'bmkp-variable-list-jump) ; `C-x j v'
382 (define-key bmkp-jump-map              "w"    'bmkp-w3m-jump) ; `C-x j w'
383 (define-key bmkp-jump-other-window-map "w"    'bmkp-w3m-jump-other-window) ; `C-x 4 j w'
384 (define-key bmkp-jump-map              "x"    'bmkp-bookmark-file-jump) ; `C-x j x'
385 (define-key bmkp-jump-map              ":"    'bmkp-jump-to-type) ; `C-x j :'
386 (define-key bmkp-jump-other-window-map ":"    'bmkp-jump-to-type-other-window) ; `C-x 4 j :'
387
388 ;; Add jump commands to other keymaps: Buffer-menu, Dired, Gnus, Info, Man, Woman, W3M.
389 (add-hook 'buffer-menu-mode-hook
390           #'(lambda () (unless (lookup-key Buffer-menu-mode-map "j")
391                          (define-key Buffer-menu-mode-map "j" 'bmkp-non-file-jump))))
392 (add-hook 'dired-mode-hook
393           #'(lambda ()
394               (let ((now  (lookup-key dired-mode-map "J")))
395                 ;; Uppercase, since `j' is `dired-goto-file'.
396                 (unless (and now (not (eq now 'undefined))) ; `dired+.el' uses `undefined'.
397                   (define-key dired-mode-map "J" 'bmkp-dired-jump))
398                 (setq now  (lookup-key dired-mode-map "\C-j"))
399                 (unless (and now (not (eq now 'undefined))) ; `dired+.el' uses `undefined'.
400                   (define-key dired-mode-map "\C-j" 'bmkp-dired-this-dir-jump)))
401               (let ((map   dired-mode-map)
402                     (sep   '(menu-bar subdir separator-bmkp))
403                     (bdj   '(menu-bar subdir bmkp-dired-jump))
404                     (bdjc  '(menu-bar subdir bmkp-dired-this-dir-jump)))
405                 (when (boundp 'diredp-menu-bar-subdir-menu) ; In `dired+el'.
406                   (setq map   diredp-menu-bar-subdir-menu
407                         sep   (cddr sep)
408                         bdj   (cddr bdj)
409                         bdjc  (cddr bdjc)))
410                 (define-key map (apply #'vector sep) '("--"))
411                 (define-key map (apply #'vector bdj)
412                   '(menu-item "Jump to a Dired Bookmark" bmkp-dired-jump
413                     :help "Jump to a bookmarked Dired buffer"))
414                 (define-key map (apply #'vector bdjc)
415                   '(menu-item "Show This Dir Using a Bookmark" bmkp-dired-this-dir-jump
416                     :help "Use a bookmarked version of this directory")))))
417 (add-hook 'gnus-summary-mode-hook
418           #'(lambda () (unless (lookup-key gnus-summary-mode-map "j")
419                          (define-key gnus-summary-mode-map "j" 'bmkp-gnus-jump))))
420 (add-hook 'Info-mode-hook
421           #'(lambda ()
422               (unless (lookup-key Info-mode-map "j")
423                 (define-key Info-mode-map "j" 'bmkp-info-jump))
424               (define-key-after Info-mode-menu [bmkp-info-jump]
425                 '(menu-item "Jump to an Info Bookmark" bmkp-info-jump
426                   :help "Jump to a bookmarked Info node")
427                 'Go\ to\ Node\.\.\.)))  ; Used by `info(+).el' - corresponds to `Info-goto-node'.
428 (add-hook 'Man-mode-hook
429           #'(lambda () (unless (lookup-key Man-mode-map "j")
430                          (define-key Man-mode-map "j" 'bmkp-man-jump))))
431 (add-hook 'woman-mode-hook
432           #'(lambda ()
433               (unless (lookup-key woman-mode-map "j") (define-key woman-mode-map "j" 'bmkp-man-jump))
434               (when (boundp 'woman-menu)
435                 (define-key-after woman-menu [bmkp-man-jump]
436                   '(menu-item "Jump to a `man'-page Bookmark" bmkp-man-jump
437                     :help "Jump to a bookmarked `man' page")
438                   'WoMan\.\.\.))))      ; Used by `woman.el' - corresponds to command `woman'.
439 (add-hook 'w3m-minor-mode-hook
440           #'(lambda () (unless (lookup-key w3m-minor-mode-map "j")
441                          (define-key w3m-minor-mode-map "j" 'bmkp-w3m-jump))))
442 (add-hook 'w3m-mode-hook
443           #'(lambda () (unless (lookup-key w3m-mode-map "j")
444                          (define-key w3m-mode-map "j" 'bmkp-w3m-jump))))
445
446
447 ;;; Vanilla Emacs `Bookmarks' menu (see also [jump] from `Bookmark+' menu, below).
448
449 (define-key-after menu-bar-bookmark-map [separator-set] '("--") 'jump)
450 (define-key-after menu-bar-bookmark-map [set]
451   '(menu-item "Set Bookmark..." (lambda () (interactive) (call-interactively #'bookmark-set))
452     :help "Set a bookmark at point")
453   'separator-set)
454 (define-key-after menu-bar-bookmark-map [bmkp-autofile-set]
455   '(menu-item "Set Autofile Bookmark..." bmkp-autofile-set
456     :help "Set and automatically name a bookmark for a given file")
457   'set)
458 (define-key-after menu-bar-bookmark-map [bmkp-file-target-set]
459   '(menu-item "Set Bookmark for File..." bmkp-file-target-set
460     :help "Set a bookmark with a given name for a given file")
461   'bmkp-autofile-set)
462 (define-key-after menu-bar-bookmark-map [bmkp-url-target-set]
463   '(menu-item "Set Bookmark for URL..." bmkp-url-target-set
464     :help "Set a bookmark for a given URL")
465   'bmkp-file-target-set)
466 (define-key-after menu-bar-bookmark-map [bmkp-set-desktop-bookmark]
467   '(menu-item "Set Bookmark for Desktop" bmkp-set-desktop-bookmark
468     :help "Save the current desktop as a bookmark")
469   'bmkp-url-target-set)
470 (define-key-after menu-bar-bookmark-map [bmkp-set-bookmark-file-bookmark]
471   '(menu-item "Set Bookmark for Bookmark File..." bmkp-set-bookmark-file-bookmark
472     :help "Set a bookmark that loads a bookmark file when jumped to")
473   'bmkp-set-desktop-bookmark)
474 (define-key-after menu-bar-bookmark-map [bmkp-toggle-autoname-bookmark-set]
475   '(menu-item "Set Autonamed Bookmark" bmkp-toggle-autonamed-bookmark-set/delete
476     :help "Set an autonamed bookmark at point"
477     :visible (not (bookmark-get-bookmark (funcall bmkp-autoname-bookmark-function (point))
478                    'noerror)))
479   'bmkp-set-bookmark-file-bookmark)
480 (define-key-after menu-bar-bookmark-map [separator-delete] '("--") 'bmkp-toggle-autoname-bookmark-set)
481 (define-key-after menu-bar-bookmark-map [bmkp-toggle-autoname-bookmark-delete]
482   '(menu-item "Delete Autonamed Bookmark" bmkp-toggle-autonamed-bookmark-set/delete
483     :help "Delete the autonamed bookmark at point"
484     :visible (bookmark-get-bookmark (funcall bmkp-autoname-bookmark-function (point))
485               'noerror))
486   'bmkp-set-bookmark-file-bookmark)
487 (define-key-after menu-bar-bookmark-map [bmkp-delete-all-autonamed-for-this-buffer]
488   '(menu-item "Delete All Autonamed Bookmarks Here..."
489     bmkp-delete-all-autonamed-for-this-buffer
490     :help "Delete all autonamed bookmarks for the current buffer"
491     :enable (mapcar #'bookmark-name-from-full-record (bmkp-autonamed-this-buffer-alist-only)))
492   'bmkp-toggle-autonamed-bookmark-set/delete)
493 (define-key-after menu-bar-bookmark-map [bmkp-delete-bookmarks]
494   '(menu-item "Delete Bookmarks Here..." bmkp-delete-bookmarks
495     :help "Delete some bookmarks at point or, with `C-u', all bookmarks in the buffer"
496     :enable (mapcar #'bookmark-name-from-full-record (bmkp-this-buffer-alist-only)))
497   'bmkp-delete-all-autonamed-for-this-buffer)
498 (define-key-after menu-bar-bookmark-map [delete]
499   '(menu-item "Delete Bookmark..." bookmark-delete
500     :help "Delete the bookmark you choose by name" :enable bookmark-alist)
501   'bmkp-delete-bookmarks)
502 (define-key-after menu-bar-bookmark-map [rename]
503   '(menu-item "Rename Bookmark..." bookmark-rename
504     :help "Rename the bookmark you choose by name" :enable bookmark-alist)
505   'delete)
506 (define-key-after menu-bar-bookmark-map [bmkp-purge-notags-autofiles]
507   '(menu-item "Purge Autofiles with No Tags..." bmkp-purge-notags-autofiles
508     :help "Delete all autofile bookmarks that have no tags" :enable bookmark-alist)
509   'rename)
510
511 (define-key-after menu-bar-bookmark-map [separator-0] '("--") 'bmkp-purge-notags-autofiles)
512 (define-key-after menu-bar-bookmark-map [edit]
513   '(menu-item "Show Bookmark List" bookmark-bmenu-list
514     :help "Open the list of bookmarks in buffer `*Bookmark List*'")
515   'separator-0)
516 (define-key-after menu-bar-bookmark-map [bmkp-this-buffer-bmenu-list]
517   '(menu-item "Show Bookmark List for This Buffer" bmkp-this-buffer-bmenu-list
518     :help "Open `*Bookmark List*' for the bookmarks in the current buffer (only)"
519     :enable (mapcar #'bookmark-name-from-full-record (bmkp-this-buffer-alist-only)))
520   'edit)
521 (define-key-after menu-bar-bookmark-map [bmkp-navlist-bmenu-list]
522   '(menu-item "Show Bookmark List for Navlist" bmkp-navlist-bmenu-list
523     :help "Open `*Bookmark List*' for bookmarks in navlist (only)"
524     :enable bmkp-nav-alist)
525   'bmkp-this-buffer-bmenu-list)
526
527 (define-key-after menu-bar-bookmark-map [separator-2] '("--") 'bmkp-navlist-bmenu-list)
528 (define-key-after menu-bar-bookmark-map [bmkp-choose-navlist-of-type]
529   '(menu-item "Set Navlist to Bookmarks of Type..." bmkp-choose-navlist-of-type
530     :help "Set the navigation list to the bookmarks of a certain type")
531   'separator-2)
532 (define-key-after menu-bar-bookmark-map [bmkp-choose-navlist-from-bookmark-list]
533   '(menu-item "Set Navlist from Bookmark-List Bookmark..." bmkp-choose-navlist-from-bookmark-list
534     :help "Set the navigation list from a bookmark-list bookmark")
535   'bmkp-choose-navlist-of-type)
536 (define-key-after menu-bar-bookmark-map [bmkp-list-defuns-in-commands-file]
537   '(menu-item "List User-Defined Bookmark Commands" bmkp-list-defuns-in-commands-file
538     :help "List the functions defined in `bmkp-bmenu-commands-file'"
539     :enable (and bmkp-bmenu-commands-file (file-readable-p bmkp-bmenu-commands-file)))
540   'bmkp-choose-navlist-from-bookmark-list)
541 (define-key-after menu-bar-bookmark-map [bmkp-make-function-bookmark]
542   '(menu-item "New Function Bookmark..." bmkp-make-function-bookmark
543     :help "Create a bookmark that will invoke FUNCTION when \"jumped\" to")
544   'bmkp-list-defuns-in-commands-file)
545
546 (define-key-after menu-bar-bookmark-map [insert]
547   '(menu-item "Insert Bookmark Contents..." bookmark-insert :help "Insert bookmarked text")
548   'bmkp-make-function-bookmark)
549 (define-key-after menu-bar-bookmark-map [locate]
550   '(menu-item "Insert Bookmark Location..." bookmark-locate ; Alias for `bookmark-insert-location'.
551     :help "Insert a bookmark's file or buffer name")
552   'insert)
553
554 (define-key-after menu-bar-bookmark-map [separator-3] '("--") 'locate)
555 (define-key-after menu-bar-bookmark-map [save]
556   '(menu-item "Save Bookmarks" bookmark-save :help "Save currently defined bookmarks")
557   'separator-3)
558 (define-key-after menu-bar-bookmark-map [write]
559   '(menu-item "Save Bookmarks As..." bookmark-write
560     :help "Write current bookmarks to a bookmark file")
561   'save)
562 (define-key-after menu-bar-bookmark-map [bmkp-empty-file]
563   '(menu-item "New (Empty) Bookmark File..." bmkp-empty-file
564     :help "Create a new, empty bookmark file, or empty an existing bookmark file")
565   'write)
566 (define-key-after menu-bar-bookmark-map [load]
567   '(menu-item "Add Bookmarks from File..." bookmark-load
568     :help "Load additional bookmarks from a bookmark file")
569   'bmkp-empty-file)
570 (define-key-after menu-bar-bookmark-map [load-read-only]
571   '(menu-item "Switch to Bookmark File..." bmkp-switch-bookmark-file
572     :help "Switch to a different bookmark file, *replacing* the current set of bookmarks")
573   'load)
574
575
576 ;; `bmkp-highlight-menu' of `Bookmarks' menu
577
578 (when (featurep 'bookmark+-lit)
579   (defvar bmkp-highlight-menu (make-sparse-keymap)
580     "`Highlight' submenu for menu-bar `Bookmarks' menu.")
581   (define-key menu-bar-bookmark-map [highlight] (cons "Highlight" bmkp-highlight-menu))
582
583   (define-key bmkp-highlight-menu [bmkp-unlight-bookmarks]
584     '(menu-item "Unhighlight All" bmkp-unlight-bookmarks
585       :help "Unhighlight all bookmarks (everywhere)."))
586   (define-key bmkp-highlight-menu [bmkp-unlight-this-buffer]
587     '(menu-item "Unhighlight All in Buffer" bmkp-unlight-this-buffer
588       :help "Unhighlight all bookmarks in this buffer."))
589   (define-key bmkp-highlight-menu [bmkp-unlight-non-autonamed-this-buffer]
590     '(menu-item "Unhighlight All Non-Autonamed in Buffer" bmkp-unlight-non-autonamed-this-buffer
591       :help "Unhighlight all non-autonamed bookmarks in this buffer."))
592   (define-key bmkp-highlight-menu [bmkp-unlight-autonamed-this-buffer]
593     '(menu-item "Unhighlight All Autonamed in Buffer" bmkp-unlight-autonamed-this-buffer
594       :help "Unhighlight all autonamed bookmarks in this buffer."))
595   (define-key bmkp-highlight-menu [bmkp-unlight-bookmark]
596     '(menu-item "Unhighlight One..." bmkp-unlight-bookmark
597       :help "Unhighlight a bookmark."))
598   (define-key bmkp-highlight-menu [bmkp-unlight-bookmark-this-buffer]
599     '(menu-item "Unhighlight One in Buffer..." bmkp-unlight-bookmark-this-buffer
600       :help "Unhighlight a bookmark in this buffer."))
601   (define-key bmkp-highlight-menu [bmkp-unlight-bookmark-here]
602     '(menu-item "Unhighlight This One" bmkp-unlight-bookmark-here
603       :help "Unhighlight a bookmark at point or on its line."))
604   (define-key bmkp-highlight-menu [separator-1] '("--"))
605   (define-key bmkp-highlight-menu [bmkp-light-bookmarks-in-region]
606     '(menu-item "Highlight All in Region" bmkp-light-bookmarks-in-region
607       :help "Highlight all bookmarks in the region."))
608   (define-key bmkp-highlight-menu [bmkp-light-this-buffer]
609     '(menu-item "Highlight All in Buffer" bmkp-light-this-buffer
610       :help "Highlight all bookmarks in this buffer."))
611   (define-key bmkp-highlight-menu [bmkp-light-non-autonamed-this-buffer]
612     '(menu-item "Highlight All Non-Autonamed in Buffer" bmkp-light-non-autonamed-this-buffer
613       :help "Highlight all non-autonamed bookmarks in this buffer."))
614   (define-key bmkp-highlight-menu [bmkp-light-autonamed-this-buffer]
615     '(menu-item "Highlight All Autonamed in Buffer" bmkp-light-autonamed-this-buffer
616       :help "Highlight all autonamed bookmarks in this buffer."))
617   (define-key bmkp-highlight-menu [bmkp-light-navlist-bookmarks]
618     '(menu-item "Highlight All in Navigation List" bmkp-light-navlist-bookmarks
619       :help "Highlight all bookmarks in the navigation list."))
620   (define-key bmkp-highlight-menu [bmkp-light-bookmark-this-buffer]
621     '(menu-item "Highlight One in Buffer..." bmkp-light-bookmark-this-buffer
622       :help "Highlight a bookmark in this buffer."))
623   (define-key bmkp-highlight-menu [bmkp-light-bookmark]
624     '(menu-item "Highlight One..." bmkp-light-bookmark
625       :help "Highlight a bookmark."))
626   (define-key bmkp-highlight-menu [separator-0] '("--"))
627   (define-key bmkp-highlight-menu [bmkp-next-lighted-this-buffer]
628     '(menu-item "Next in Buffer" bmkp-next-lighted-this-buffer
629       :help "Cycle to the next highlighted bookmark in this buffer."))
630   (define-key bmkp-highlight-menu [bmkp-previous-lighted-this-buffer]
631     '(menu-item "Previous in Buffer" bmkp-previous-lighted-this-buffer
632       :help "Cycle to the previous highlighted bookmark in this buffer."))
633   (define-key bmkp-highlight-menu [bmkp-bookmarks-lighted-at-point]
634     '(menu-item "List Highlighted at Point" bmkp-bookmarks-lighted-at-point
635       :help "List the bookmarks at point that are highlighted."))
636   (define-key bmkp-highlight-menu [bmkp-set-lighting-for-bookmark]
637     '(menu-item "Set Highlighting for One..." bmkp-set-lighting-for-bookmark
638       :help "Set individual highlighting for a bookmark.")))
639
640
641 ;; `bmkp-options-menu' of `Bookmarks' menu
642
643 (defvar bmkp-options-menu (make-sparse-keymap)
644   "`Toggle Option' submenu for menu-bar `Bookmarks' menu.")
645 (define-key menu-bar-bookmark-map [options] (cons "Toggle Option" bmkp-options-menu))
646
647 (define-key bmkp-options-menu [bmkp-crosshairs-flag]
648   (bmkp-menu-bar-make-toggle bmkp-crosshairs-flag bmkp-crosshairs-flag
649                              "Highlight Jump using Crosshairs"
650                              "Crosshairs highlighting is %s"
651                              "Temporarily highlight visited bookmarks using crosshairs"))
652 (define-key bmkp-options-menu [bmkp-save-new-location-flag]
653   (bmkp-menu-bar-make-toggle bmkp-save-new-location-flag bmkp-save-new-location-flag
654                              "Save after Relocating"
655                              "Saving relocated bookmarks is %s"
656                              "Save a bookmark after automatically relocating it"))
657 (define-key bmkp-options-menu [bmkp-prompt-for-tags-flag]
658   (bmkp-menu-bar-make-toggle bmkp-prompt-for-tags-flag bmkp-prompt-for-tags-flag
659                              "Prompt for Tags when Setting"
660                              "Prompting for tags when setting a bookmark is %s"
661                              "Prompt for tags when setting a bookmark interactively"))
662
663 ;; `bmkp-tags-menu' of `Bookmarks' menu
664
665 (defvar bmkp-tags-menu (make-sparse-keymap)
666   "`Tags' submenu for menu-bar `Bookmarks' menu.")
667 (define-key menu-bar-bookmark-map [tags] (cons "Tags" bmkp-tags-menu))
668
669 (define-key bmkp-tags-menu [bmkp-list-all-tags]
670   '(menu-item "List All Tags" bmkp-list-all-tags :help "List all tags used for any bookmarks"))
671 (define-key bmkp-tags-menu [bmkp-purge-notags-autofiles]
672   '(menu-item "Purge Autofiles with No Tags..." bmkp-purge-notags-autofiles
673     :help "Delete all autofile bookmarks that have no tags"))
674 (define-key bmkp-tags-menu [bmkp-untag-a-file]
675   '(menu-item "Untag a File (Remove Some)..." bmkp-untag-a-file
676     :help "Remove some tags from autofile bookmark for a file"))
677 (define-key bmkp-tags-menu [bmkp-tag-a-file]
678   '(menu-item "Tag a File (Add Some)..." bmkp-tag-a-file
679     :help "Add some tags to the autofile bookmark for a file"))
680 (define-key bmkp-tags-menu [bmkp-rename-tag]
681   '(menu-item "Rename Tag..." bmkp-rename-tag :help "Rename a tag in all bookmarks"))
682 (define-key bmkp-tags-menu [bmkp-set-tag-value]
683   '(menu-item "Set Tag Value..." bmkp-set-tag-value :help "Set the tag value for a given bookmark"))
684 (define-key bmkp-tags-menu [bmkp-remove-tags-from-all]
685   '(menu-item "Remove Some Tags from All..." bmkp-remove-tags-from-all
686     :help "Remove a set of tags from all bookmarks"))
687 (define-key bmkp-tags-menu [bmkp-remove-tags]
688   '(menu-item "Remove Some Tags..." bmkp-remove-tags :help "Remove a set of tags from a bookmark"))
689 (define-key bmkp-tags-menu [bmkp-add-tags]
690   '(menu-item "Add Some Tags..." bmkp-add-tags :help "Add a set of tags to a bookmark"))
691 (define-key bmkp-tags-menu [bmkp-paste-replace-tags]
692   '(menu-item "Paste Tags (Replace)..." bmkp-paste-replace-tags
693     :help "Replace tags for a bookmark with tags copied from another"))
694 (define-key bmkp-tags-menu [bmkp-paste-add-tags]
695   '(menu-item "Paste Tags (Add)..." bmkp-paste-add-tags
696     :help "Add tags to a bookmark that were previously copied from another"))
697 (define-key bmkp-tags-menu [bmkp-copy-tags]
698   '(menu-item "Copy Tags..." bmkp-copy-tags
699     :help "Copy the tags from a bookmark, so you can paste them to another"))
700
701 ;; `bmkp-jump-menu' of `Bookmarks' menu
702
703 (defvar bmkp-jump-menu (make-sparse-keymap)
704   "`Jump To' submenu for menu-bar `Bookmarks' menu.")
705 ;; Add jump menu to vanilla Emacs `Bookmarks' menu and remove the two jump commands already there.
706 (define-key menu-bar-bookmark-map [jump] nil)
707 (define-key menu-bar-bookmark-map [jump-other] nil)
708 (define-key menu-bar-bookmark-map [bmkp-jump] (cons "Jump To" bmkp-jump-menu))
709
710 ;; `Jump To': Add jump menu also to the `Bookmark+' menu, and remove the two jump commands there.
711 (define-key bmkp-bmenu-menubar-menu [jump] (cons "Jump To" bmkp-jump-menu))
712
713 (define-key bmkp-jump-menu [bmkp-autonamed-this-buffer-jump]
714   '(menu-item "Autonamed for This Buffer..." bmkp-autonamed-this-buffer-jump
715     :help "Jump to an autonamed bookmark in this buffer"))
716 (define-key bmkp-jump-menu [bmkp-autonamed-jump-other-window]
717   '(menu-item "Autonamed..." bmkp-autonamed-jump-other-window
718     :help "Jump to an autonamed bookmark"))
719 (define-key bmkp-jump-menu [bmkp-specific-files-jump-other-window]
720   '(menu-item "For Specific Files..." bmkp-specific-files-jump-other-window
721     :help "Jump to a bookmark for specific files"))
722 (define-key bmkp-jump-menu [bmkp-specific-buffers-jump-other-window]
723   '(menu-item "For Specific Buffers..." bmkp-specific-buffers-jump-other-window
724     :help "Jump to a bookmark for specific buffers"))
725 (define-key bmkp-jump-menu [bmkp-this-buffer-jump]
726   '(menu-item "For This Buffer..." bmkp-this-buffer-jump
727     :help "Jump to a bookmark for the current buffer"
728     :enable (mapcar #'bookmark-name-from-full-record (bmkp-this-buffer-alist-only))))
729 (when (featurep 'bookmark+-lit)
730   (define-key bmkp-jump-menu [bmkp-lighted-jump-other-window]
731     '(menu-item "Highlighted..." bmkp-lighted-jump-other-window
732       :help "Jump to a highlighted bookmark"
733       :enable (bmkp-lighted-alist-only))))
734 (define-key bmkp-jump-menu [bmkp-jump-in-navlist-other-window]
735   '(menu-item "In Navigation List..." bmkp-jump-in-navlist-other-window
736     :help "Jump to a bookmark that is in the navigation list" :enable bmkp-nav-alist))
737 (define-key bmkp-jump-menu [jump-sep0] '("--"))
738 (define-key bmkp-jump-menu [bmkp-url-jump-other-window]
739   '(menu-item "URL..." bmkp-url-jump-other-window :help "Jump to a URL bookmark"
740     :enable (bmkp-url-alist-only)))
741 (define-key bmkp-jump-menu [bmkp-gnus-jump-other-window]
742   '(menu-item "Gnus..." bmkp-gnus-jump-other-window :help "Jump to a Gnus bookmark"
743     :enable (bmkp-gnus-alist-only)))
744 (define-key bmkp-jump-menu [bmkp-man-jump-other-window]
745   '(menu-item "Man Page..." bmkp-man-jump-other-window :help "Jump to a `man'-page bookmark"
746     :enable (bmkp-man-alist-only)))
747 (define-key bmkp-jump-menu [bmkp-info-jump-other-window]
748   '(menu-item "Info Node..." bmkp-info-jump-other-window :help "Jump to an Info bookmark"
749     :enable (bmkp-info-alist-only)))
750 (define-key bmkp-jump-menu [bmkp-non-file-jump-other-window]
751   '(menu-item "Buffer (Non-File)..." bmkp-non-file-jump-other-window
752     :help "Jump to a non-file (buffer) bookmark" :enable (bmkp-non-file-alist-only)))
753 (define-key bmkp-jump-menu [bmkp-region-jump-other-window]
754   '(menu-item "Region..." bmkp-region-jump-other-window
755     :help "Jump to a bookmark that defines the active region" :enable (bmkp-region-alist-only)))
756 (define-key bmkp-jump-menu [bmkp-remote-file-jump-other-window]
757   '(menu-item "Remote File..." bmkp-remote-file-jump-other-window
758     :help "Jump to a remote file or directory bookmark" :enable (bmkp-remote-file-alist-only)))
759 (define-key bmkp-jump-menu [bmkp-local-file-jump-other-window]
760   '(menu-item "Local File..." bmkp-local-file-jump-other-window
761     :help "Jump to a local file or directory bookmark" :enable (bmkp-local-file-alist-only)))
762 (define-key bmkp-jump-menu [bmkp-file-this-dir-jump-other-window]
763   '(menu-item "File in This Dir..." bmkp-file-this-dir-jump-other-window
764     :help "Jump to a bookmark for a file or subdirectory in the `default-directory'."
765     :enable (bmkp-file-alist-only)))
766 (define-key bmkp-jump-menu [bmkp-file-jump-other-window]
767   '(menu-item "File..." bmkp-file-jump-other-window :help "Jump to a file or directory bookmark"
768     :enable (bmkp-file-alist-only)))
769 (define-key bmkp-jump-menu [bmkp-dired-this-dir-jump-other-window]
770   '(menu-item "Dired for This Dir..." bmkp-dired-this-dir-jump-other-window
771     :help "Jump to a Dired bookmark for `default-directory', restoring recorded state"
772     :enable (bmkp-dired-alist-only)))
773 (define-key bmkp-jump-menu [bmkp-dired-jump-other-window]
774   '(menu-item "Dired..." bmkp-dired-jump-other-window
775     :help "Jump to a Dired bookmark, restoring the recorded Dired state"
776     :enable (bmkp-dired-alist-only)))
777 (define-key bmkp-jump-menu [bmkp-variable-list-jump]
778   '(menu-item "Variable List..." bmkp-variable-list-jump :help "Jump to a variable-list bookmark"
779     :enable (bmkp-variable-list-alist-only)))
780 (define-key bmkp-jump-menu [bmkp-bookmark-file-jump]
781   '(menu-item "Bookmark File..." bmkp-bookmark-file-jump
782     :help "Jump to (load) a bookmark-file bookmark" :enable (bmkp-bookmark-file-alist-only)))
783 (define-key bmkp-jump-menu [bmkp-bookmark-list-jump]
784   '(menu-item "Bookmark List..." bmkp-bookmark-list-jump :help "Jump to a bookmark-list bookmark"
785     :enable (bmkp-bookmark-list-alist-only)))
786 (define-key bmkp-jump-menu [bmkp-desktop-jump]
787   '(menu-item "Desktop..." bmkp-desktop-jump :help "Jump to a desktop bookmark"
788     :enable (bmkp-desktop-alist-only)))
789 (define-key bmkp-jump-menu [bmkp-jump-to-type-other-window]
790   '(menu-item "Of Type..." bmkp-jump-to-type-other-window
791     :help "Jump to a bookmark of a type that you specify"))
792
793 (defvar bmkp-jump-tags-menu (make-sparse-keymap)
794   "`With Tags' submenu for `Jump To' submenu of `Bookmarks' menu.")
795 (define-key bmkp-jump-menu [bmkp-tags] (cons "With Tags" bmkp-jump-tags-menu))
796 (define-key bmkp-jump-tags-menu [bmkp-file-this-dir-all-tags-regexp-jump-other-window]
797   '(menu-item "File in This Dir, All Tags Matching Regexp..."
798     bmkp-file-this-dir-all-tags-regexp-jump-other-window
799     :help "Jump to a file bookmark in this dir where each tag matches a regexp"))
800 (define-key bmkp-jump-tags-menu [bmkp-file-this-dir-some-tags-regexp-jump-other-window]
801   '(menu-item "File in This Dir, Any Tag Matching Regexp..."
802     bmkp-file-this-dir-some-tags-regexp-jump-other-window
803     :help "Jump to a file bookmark in this dir where at least one tag matches a regexp"))
804 (define-key bmkp-jump-tags-menu [bmkp-file-this-dir-all-tags-jump-other-window]
805   '(menu-item "File in This Dir, All Tags in Set..." bmkp-file-this-dir-all-tags-jump-other-window
806     :help "Jump to a file bookmark in this dir that has all of a set of tags that you enter"))
807 (define-key bmkp-jump-tags-menu [bmkp-file-this-dir-some-tags-jump-other-window]
808   '(menu-item "File in This Dir, Any Tag in Set..." bmkp-file-this-dir-some-tags-jump-other-window
809     :help "Jump to a file bookmark in this dir that has some of a set of tags that you enter"))
810 (define-key bmkp-jump-tags-menu [jump-sep4] '("--"))
811 (define-key bmkp-jump-tags-menu [bmkp-file-all-tags-regexp-jump-other-window]
812   '(menu-item "File, All Tags Matching Regexp..." bmkp-file-all-tags-regexp-jump-other-window
813     :help "Jump to a file or dir bookmark where each tag matches a regexp that you enter"))
814 (define-key bmkp-jump-tags-menu [bmkp-file-some-tags-regexp-jump-other-window]
815   '(menu-item "File, Any Tag Matching Regexp..." bmkp-file-some-tags-regexp-jump-other-window
816     :help "Jump to a file or dir bookmark where at least one tag matches a regexp that you enter"))
817 (define-key bmkp-jump-tags-menu [bmkp-file-all-tags-jump-other-window]
818   '(menu-item "File, All Tags in Set..." bmkp-file-all-tags-jump-other-window
819     :help "Jump to a file or dir bookmark that has all of a set of tags that you enter"))
820 (define-key bmkp-jump-tags-menu [bmkp-file-some-tags-jump-other-window]
821   '(menu-item "File, Any Tag in Set..." bmkp-file-some-tags-jump-other-window
822     :help "Jump to a file or dir bookmark that has some of a set of tags that you enter"))
823 (define-key bmkp-jump-tags-menu [jump-sep3] '("--"))
824 (define-key bmkp-jump-tags-menu [bmkp-find-file-all-tags-regexp-other-window]
825   '(menu-item "Autofile, All Tags Matching Regexp..." bmkp-find-file-all-tags-regexp-other-window
826     :help "Jump to a file or dir bookmark where each tag matches a regexp that you enter"))
827 (define-key bmkp-jump-tags-menu [bmkp-find-file-some-tags-regexp-other-window]
828   '(menu-item "Autofile, Any Tag Matching Regexp..." bmkp-find-file-some-tags-regexp-other-window
829     :help "Jump to a file or dir bookmark where at least one tag matches a regexp that you enter"))
830 (define-key bmkp-jump-tags-menu [bmkp-find-file-all-tags-other-window]
831   '(menu-item "Autofile, All Tags in Set..." bmkp-find-file-all-tags-other-window
832     :help "Jump to a file or dir bookmark that has all of a set of tags that you enter"))
833 (define-key bmkp-jump-tags-menu [bmkp-find-file-some-tags-other-window]
834   '(menu-item "Autofile, Any Tag in Set..." bmkp-find-file-some-tags-other-window
835     :help "Jump to a file or dir bookmark that has some of a set of tags that you enter"))
836 (define-key bmkp-jump-tags-menu [jump-sep2] '("--"))
837 (define-key bmkp-jump-tags-menu [bmkp-all-tags-regexp-jump-other-window]
838   '(menu-item "All Tags Matching Regexp..." bmkp-all-tags-regexp-jump-other-window
839     :help "Jump to a bookmark that has each tag matching a regexp that you enter"))
840 (define-key bmkp-jump-tags-menu [bmkp-some-tags-regexp-jump-other-window]
841   '(menu-item "Any Tag Matching Regexp..." bmkp-some-tags-regexp-jump-other-window
842     :help "Jump to a bookmark that has at least one tag matching a regexp that you enter"))
843 (define-key bmkp-jump-tags-menu [bmkp-all-tags-jump-other-window]
844   '(menu-item "All Tags in Set..." bmkp-all-tags-jump-other-window
845     :help "Jump to a bookmark that has all of a set of tags that you enter"))
846 (define-key bmkp-jump-tags-menu [bmkp-some-tags-jump-other-window]
847   '(menu-item "Any Tag in Set..." bmkp-some-tags-jump-other-window
848     :help "Jump to a bookmark that has some of a set of tags that you enter"))
849 (define-key bmkp-jump-menu [bookmark-jump-other-window]
850   '(menu-item "Any in Other Window..." bookmark-jump-other-window
851     :help "Jump to a bookmark of any type, in another window"))
852 (define-key bmkp-jump-menu [bookmark-jump]
853   '(menu-item "Any..." bookmark-jump :help "Jump to a bookmark of any type, in this window"))
854
855 ;; `bmkp-find-file-menu' submenu of `File' menu
856 (defvar bmkp-find-file-menu (make-sparse-keymap)
857   "`Bookmarked File' submenu for menu-bar `File' menu.")
858 (define-key menu-bar-file-menu [bmkp-find-file]
859   (list 'menu-item "Bookmarked File" bmkp-find-file-menu))
860 (define-key bmkp-find-file-menu [bmkp-find-file-all-tags-regexp-other-window]
861   '(menu-item "All Tags Matching Regexp..." bmkp-find-file-all-tags-regexp-other-window
862     :help "Visit a file or dir where each tag matches a regexp that you enter"))
863 (define-key bmkp-find-file-menu [bmkp-find-file-some-tags-regexp-other-window]
864   '(menu-item "Any Tag Matching Regexp..." bmkp-find-file-some-tags-regexp-other-window
865     :help "Jump to a file or dir bookmark where at least one tag matches a regexp that you enter"))
866 (define-key bmkp-find-file-menu [bmkp-find-file-all-tags-other-window]
867   '(menu-item "All Tags in Set..." bmkp-find-file-all-tags-other-window
868     :help "Visit a file or dir that has all of a set of tags that you enter"))
869 (define-key bmkp-find-file-menu [bmkp-find-file-some-tags-other-window]
870   '(menu-item "Any Tag in Set..." bmkp-find-file-some-tags-other-window
871     :help "Visit a file or dir that has some of a set of tags that you enter"))
872 (define-key bmkp-find-file-menu [bmkp-find-file-other-window]
873   '(menu-item "File..." bmkp-find-file-other-window
874     :help "Visit a bookmarked file or directory: an autofile bookmark."))
875
876 ;;;;;;;;;;;;;;;;;;;;;
877
878 (provide 'bookmark+-key)
879
880 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
881 ;;; bookmark+-key.el ends here