2 ;;; bookmark+-bmu.el --- Bookmark+ code for the `*Bookmark List*' (bmenu).
4 ;; Filename: bookmark+-bmu.el
5 ;; Description: Bookmark+ code for the `*Bookmark List*' (bmenu).
6 ;; Author: Drew Adams, Thierry Volpiatto
7 ;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
8 ;; Copyright (C) 2000-2011, Drew Adams, all rights reserved.
9 ;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved.
10 ;; Created: Mon Jul 12 09:05:21 2010 (-0700)
11 ;; Last-Updated: Fri Jul 1 14:51:29 2011 (-0700)
14 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-bmu.el
15 ;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, info, url, w3m, gnus
16 ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x
18 ;; Features that might be required by this library:
20 ;; `bookmark', `bookmark+-mac', `pp'.
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;; This library contains code for buffer `*Bookmark List*' (mode
27 ;; `bookmark-bmenu-mode').
29 ;; The Bookmark+ libraries are these:
31 ;; `bookmark+.el' - main (driver) library
32 ;; `bookmark+-mac.el' - Lisp macros
33 ;; `bookmark+-lit.el' - (optional) code for highlighting bookmarks
34 ;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (this file)
35 ;; `bookmark+-1.el' - other required code (non-bmenu)
36 ;; `bookmark+-key.el' - key and menu bindings
38 ;; `bookmark+-doc.el' - documentation (comment-only file)
39 ;; `bookmark+-chg.el' - change log (comment-only file)
41 ;; The documentation (in `bookmark+-doc.el') includes how to
42 ;; byte-compile and install Bookmark+. The documentation is also
43 ;; available in these ways:
45 ;; 1. From the bookmark list (`C-x r l'):
46 ;; Use `?' to show the current bookmark-list status and general
47 ;; help, then click link `Doc in Commentary' or link `Doc on the
50 ;; 2. From the Emacs-Wiki Web site:
51 ;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus.
53 ;; 3. From the Bookmark+ group customization buffer:
54 ;; `M-x customize-group bookmark-plus', then click link
57 ;; (The commentary links in #1 and #3 work only if you have library
58 ;; `bookmark+-doc.el' in your `load-path'.)
65 ;; If you have library `linkd.el' and Emacs 22 or later, load
66 ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily
67 ;; navigate around the sections of this doc. Linkd mode will
68 ;; highlight this Index, as well as the cross-references and section
69 ;; headings throughout this file. You can get `linkd.el' here:
70 ;; http://dto.freeshell.org/notebook/Linkd.html.
72 ;; (@> "Things Defined Here")
73 ;; (@> "Faces (Customizable)")
74 ;; (@> "User Options (Customizable)")
75 ;; (@> "Internal Variables")
76 ;; (@> "Compatibility Code for Older Emacs Versions")
77 ;; (@> "Menu List Replacements (`bookmark-bmenu-*')")
78 ;; (@> "Bookmark+ Functions (`bmkp-*')")
79 ;; (@> "Menu-List (`*-bmenu-*') Filter Commands")
80 ;; (@> "Menu-List (`*-bmenu-*') Commands Involving Marks")
81 ;; (@> "Omitted Bookmarks")
82 ;; (@> "Search-and-Replace Locations of Marked Bookmarks")
84 ;; (@> "General Menu-List (`-*bmenu-*') Commands and Functions")
85 ;; (@> "Sorting - Commands")
86 ;; (@> "Other Bookmark+ Functions (`bmkp-*')")
89 ;;(@* "Things Defined Here")
91 ;; Things Defined Here
92 ;; -------------------
94 ;; Commands defined here:
96 ;; `bmkp-bmenu-add-tags', `bmkp-bmenu-add-tags-to-marked',
97 ;; `bmkp-bmenu-change-sort-order',
98 ;; `bmkp-bmenu-change-sort-order-repeat', `bmkp-bmenu-copy-tags',
99 ;; `bmkp-bmenu-define-command',
100 ;; `bmkp-bmenu-define-full-snapshot-command',
101 ;; `bmkp-bmenu-define-jump-marked-command',
102 ;; `bmkp-bmenu-delete-marked', `bmkp-bmenu-describe-marked',
103 ;; `bmkp-bmenu-describe-this+move-down',
104 ;; `bmkp-bmenu-describe-this+move-up',
105 ;; `bmkp-bmenu-describe-this-bookmark',`bmkp-bmenu-dired-marked',
106 ;; `bmkp-bmenu-edit-bookmark', `bmkp-edit-tags-send',
107 ;; `bmkp-bmenu-filter-annotation-incrementally',
108 ;; `bmkp-bmenu-filter-bookmark-name-incrementally',
109 ;; `bmkp-bmenu-filter-file-name-incrementally',
110 ;; `bmkp-bmenu-filter-tags-incrementally',
111 ;; `bmkp-bmenu-isearch-marked-bookmarks' (Emacs 23+),
112 ;; `bmkp-bmenu-isearch-marked-bookmarks-regexp' (Emacs 23+),
113 ;; `bmkp-bmenu-make-sequence-from-marked', `bmkp-bmenu-mark-all',
114 ;; `bmkp-bmenu-mark-autofile-bookmarks',
115 ;; `bmkp-bmenu-mark-bookmark-file-bookmarks',
116 ;; `bmkp-bmenu-mark-bookmarks-satisfying',
117 ;; `bmkp-bmenu-mark-bookmarks-tagged-all',
118 ;; `bmkp-bmenu-mark-bookmarks-tagged-none',
119 ;; `bmkp-bmenu-mark-bookmarks-tagged-not-all',
120 ;; `bmkp-bmenu-mark-bookmarks-tagged-regexp',
121 ;; `bmkp-bmenu-mark-bookmarks-tagged-some',
122 ;; `bmkp-bmenu-mark-desktop-bookmarks',
123 ;; `bmkp-bmenu-mark-dired-bookmarks',
124 ;; `bmkp-bmenu-mark-file-bookmarks',
125 ;; `bmkp-bmenu-mark-gnus-bookmarks',
126 ;; `bmkp-bmenu-mark-info-bookmarks',
127 ;; `bmkp-bmenu-mark-lighted-bookmarks',
128 ;; `bmkp-bmenu-mark-man-bookmarks',
129 ;; `bmkp-bmenu-mark-non-file-bookmarks',
130 ;; `bmkp-bmenu-mark-region-bookmarks',
131 ;; `bmkp-bmenu-mark-specific-buffer-bookmarks',
132 ;; `bmkp-bmenu-mark-specific-file-bookmarks',
133 ;; `bmkp-bmenu-mark-url-bookmarks',
134 ;; `bmkp-bmenu-mark-w3m-bookmarks', `bmkp-bmenu-mouse-3-menu',
135 ;; `bmkp-bmenu-mode-status-help', `bmkp-bmenu-omit',
136 ;; `bmkp-bmenu-omit-marked', `bmkp-bmenu-omit/unomit-marked',
137 ;; `bmkp-bmenu-paste-add-tags',
138 ;; `bmkp-bmenu-paste-add-tags-to-marked',
139 ;; `bmkp-bmenu-paste-replace-tags',
140 ;; `bmkp-bmenu-paste-replace-tags-for-marked',
141 ;; `bmkp-bmenu-query-replace-marked-bookmarks-regexp',
142 ;; `bmkp-bmenu-quit', `bmkp-bmenu-refresh-menu-list',
143 ;; `bmkp-bmenu-regexp-mark', `bookmark-bmenu-relocate' (Emacs 20,
144 ;; 21), `bmkp-bmenu-remove-all-tags', `bmkp-bmenu-remove-tags',
145 ;; `bmkp-bmenu-remove-tags-from-marked',
146 ;; `bmkp-bmenu-search-marked-bookmarks-regexp',
147 ;; `bmkp-bmenu-set-tag-value',
148 ;; `bmkp-bmenu-set-tag-value-for-marked', `bmkp-bmenu-show-all',
149 ;; `bmkp-bmenu-show-only-autofiles',
150 ;; `bmkp-bmenu-show-only-autonamed.',
151 ;; `bmkp-bmenu-show-only-bookmark-files',
152 ;; `bmkp-bmenu-show-only-desktops', `bmkp-bmenu-show-only-dired',
153 ;; `bmkp-bmenu-show-only-files', `bmkp-bmenu-show-only-gnus',
154 ;; `bmkp-bmenu-show-only-info-nodes',
155 ;; `bmkp-bmenu-show-only-man-pages',
156 ;; `bmkp-bmenu-show-only-non-files',
157 ;; `bmkp-bmenu-show-only-omitted', `bmkp-bmenu-show-only-regions',
158 ;; `bmkp-bmenu-show-only-specific-buffer',
159 ;; `bmkp-bmenu-show-only-specific-file',
160 ;; `bmkp-bmenu-show-only-tagged', `bmkp-bmenu-show-only-urls',
161 ;; `bmkp-bmenu-show-only-variable-lists',
162 ;; `bmkp-bmenu-show-only-w3m-urls',
163 ;; `bmkp-bmenu-sort-by-bookmark-name',
164 ;; `bmkp-bmenu-sort-by-bookmark-visit-frequency',
165 ;; `bmkp-bmenu-sort-by-creation-time',
166 ;; `bmkp-bmenu-sort-by-file-name',
167 ;; `bmkp-bmenu-sort-by-Gnus-thread',
168 ;; `bmkp-bmenu-sort-by-Info-location',
169 ;; `bmkp-bmenu-sort-by-last-bookmark-access',
170 ;; `bmkp-bmenu-sort-by-last-buffer-or-file-access',
171 ;; `bmkp-bmenu-sort-by-last-local-file-access',
172 ;; `bmkp-bmenu-sort-by-last-local-file-update',
173 ;; `bmkp-bmenu-sort-by-local-file-size',
174 ;; `bmkp-bmenu-sort-by-local-file-type', `bmkp-bmenu-sort-by-url',
175 ;; `bmkp-bmenu-sort-marked-before-unmarked',
176 ;; `bmkp-bmenu-toggle-marks', `bmkp-bmenu-toggle-show-only-marked',
177 ;; `bmkp-bmenu-toggle-show-only-unmarked', `bmkp-bmenu-unmark-all',
178 ;; `bmkp-bmenu-unmark-bookmarks-tagged-all',
179 ;; `bmkp-bmenu-unmark-bookmarks-tagged-none',
180 ;; `bmkp-bmenu-unmark-bookmarks-tagged-not-all',
181 ;; `bmkp-bmenu-unmark-bookmarks-tagged-regexp',
182 ;; `bmkp-bmenu-unmark-bookmarks-tagged-some',
183 ;; `bmkp-bmenu-unomit-marked', `bmkp-bmenu-w32-open',
184 ;; `bmkp-bmenu-w32-open-select', `bmkp-bmenu-w32-open-with-mouse',
185 ;; `bmkp-define-tags-sort-command'.
187 ;; Faces defined here:
189 ;; `bmkp->-mark', `bmkp-a-mark', `bmkp-bad-bookmark',
190 ;; `bmkp-bookmark-file', `bmkp-bookmark-list', `bmkp-buffer',
191 ;; `bmkp-D-mark', `bmkp-desktop', `bmkp-function', `bmkp-gnus',
192 ;; `bmkp-heading', `bmkp-info', `bmkp-local-directory',
193 ;; `bmkp-local-file-with-region', `bmkp-local-file-without-region',
194 ;; `bmkp-man', `bmkp-non-file', `bmkp-remote-file',
195 ;; `bmkp-sequence', `bmkp-su-or-sudo', `bmkp-t-mark', `bmkp-url',
196 ;; `bmkp-variable-list'.
198 ;; User options defined here:
200 ;; `bmkp-bmenu-commands-file', `bmkp-bmenu-omitted-bookmarks',
201 ;; `bmkp-bmenu-state-file', `bmkp-propertize-bookmark-names-flag',
202 ;; `bmkp-sort-orders-alist', `bmkp-sort-orders-for-cycling-alist'.
204 ;; Non-interactive functions defined here:
206 ;; `bmkp-bmenu-barf-if-not-in-menu-list',
207 ;; `bmkp-bmenu-cancel-incremental-filtering',
208 ;; `bmkp-bmenu-filter-alist-by-annotation-regexp',
209 ;; `bmkp-bmenu-filter-alist-by-bookmark-name-regexp',
210 ;; `bmkp-bmenu-filter-alist-by-file-name-regexp',
211 ;; `bmkp-bmenu-filter-alist-by-tags-regexp',
212 ;; `bmkp-bmenu-get-marked-files', `bmkp-bmenu-goto-bookmark-named',
213 ;; `bmkp-bmenu-list-1',
214 ;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none',
215 ;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all',
216 ;; `bmkp-bmenu-propertize-item', `bmkp-bmenu-read-filter-input',
217 ;; `bmkp-maybe-unpropertize-bookmark-names',
218 ;; `bmkp-reverse-multi-sort-order', `bmkp-reverse-sort-order'.
220 ;; Internal variables defined here:
222 ;; `bmkp-bmenu-before-hide-marked-alist',
223 ;; `bmkp-bmenu-before-hide-unmarked-alist',
224 ;; `bmkp-bmenu-define-command-menu', `bmkp-bmenu-filter-function',
225 ;; `bmkp-bmenu-filter-pattern', `bmkp-bmenu-filter-prompt',
226 ;; `bmkp-bmenu-filter-timer', `bmkp-bmenu-first-time-p',
227 ;; `bmkp-bmenu-header-lines', `bmkp-bmenu-highlight-menu',
228 ;; `bmkp-bmenu-line-overlay', `bmkp-bmenu-mark-menu',
229 ;; `bmkp-bmenu-marked-bookmarks', `bmkp-bmenu-marks-width',
230 ;; `bmkp-bmenu-menubar-menu', `bmkp-bmenu-omit-menu',
231 ;; `bmkp-bmenu-show-menu', `bmkp-bmenu-sort-menu',
232 ;; `bmkp-bmenu-tags-menu', `bmkp-bmenu-title',
233 ;; `bmkp-bookmark-file-history', `bmkp-bookmark-list-history',
234 ;; `bmkp-current-bookmark-file', `bmkp-current-nav-bookmark',
235 ;; `bmkp-desktop-history', `bmkp-dired-history',
236 ;; `bmkp-file-history', `bmkp-gnus-history', `bmkp-highlight-menu',
237 ;; `bmkp-info-history', `bmkp-isearch-bookmarks' (Emacs 23+),
238 ;; `bmkp-jump-display-function', `bmkp-jump-map', `bmkp-jump-menu',
239 ;; `bmkp-jump-other-window-map', `bmkp-last-bmenu-bookmark'.
242 ;; ***** NOTE: The following commands defined in `bookmark.el'
243 ;; have been REDEFINED HERE:
245 ;; `bookmark-bmenu-execute-deletions', `bookmark-bmenu-list',
246 ;; `bookmark-bmenu-mark', `bookmark-bmenu-1-window',
247 ;; `bookmark-bmenu-2-window', `bookmark-bmenu-other-window',
248 ;; `bookmark-bmenu-other-window-with-mouse',
249 ;; `bookmark-bmenu-this-window', `bookmark-bmenu-rename',
250 ;; `bookmark-bmenu-show-annotation',
251 ;; `bookmark-bmenu-switch-other-window', `bookmark-bmenu-unmark'.
254 ;; ***** NOTE: The following non-interactive functions defined in
255 ;; `bookmark.el' have been REDEFINED HERE:
257 ;; `bookmark-bmenu-bookmark', `bookmark-bmenu-check-position',
258 ;; `bookmark-bmenu-delete', `bookmark-bmenu-ensure-position' (Emacs
259 ;; 23.2+), `bookmark-bmenu-hide-filenames', `bookmark-bmenu-mode',
260 ;; `bookmark-bmenu-show-filenames',
261 ;; `bookmark-bmenu-surreptitiously-rebuild-list',
262 ;; `bookmark-bmenu-switch-other-window' (Emacs 20-22).
264 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
266 ;; This program is free software; you can redistribute it and/or
267 ;; modify it under the terms of the GNU General Public License as
268 ;; published by the Free Software Foundation; either version 3, or
269 ;; (at your option) any later version.
271 ;; This program is distributed in the hope that it will be useful,
272 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
273 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
274 ;; General Public License for more details.
276 ;; You should have received a copy of the GNU General Public License
277 ;; along with this program; see the file COPYING. If not, write to
278 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
279 ;; Floor, Boston, MA 02110-1301, USA.
281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
285 ;;;;;;;;;;;;;;;;;;;;;;;
287 (eval-when-compile (require 'cl)) ;; case
290 ;; bookmark-alist, bookmark-bmenu-file-column,
291 ;; bookmark-bmenu-hidden-bookmarks, bookmark-bmenu-mode-map,
292 ;; bookmark-bmenu-select, bookmark-bmenu-toggle-filenames,
293 ;; bookmark-get-annotation, bookmark-get-bookmark,
294 ;; bookmark-get-filename, bookmark-get-handler, bookmark-kill-line,
295 ;; bookmark-maybe-load-default-file, bookmark-name-from-full-record,
296 ;; bookmark-name-from-record, bookmark-prop-get,
297 ;; bookmark-show-annotation, bookmark-store
299 ;;; Fix incompatibility introduced by gratuitous Emacs name change.
300 (cond ((and (fboundp 'bookmark-name-from-record) (not (fboundp 'bookmark-name-from-full-record)))
301 (defalias 'bookmark-name-from-full-record 'bookmark-name-from-record))
302 ((and (fboundp 'bookmark-name-from-full-record) (not (fboundp 'bookmark-name-from-record)))
303 (defalias 'bookmark-name-from-record 'bookmark-name-from-full-record)))
305 (require 'bookmark+-mac) ;; bmkp-define-sort-command
307 ;; (eval-when-compile (require 'bookmark+-1))
308 ;; bmkp-add-tags, bmkp-alpha-p, bmkp-bookmark-creation-cp,
309 ;; bmkp-bookmark-description, bmkp-bookmark-file-bookmark-p,
310 ;; bmkp-bookmark-last-access-cp, bmkp-bookmark-list-bookmark-p,
311 ;; bmkp-buffer-last-access-cp, bmkp-completing-read-buffer-name,
312 ;; bmkp-completing-read-file-name, bmkp-current-bookmark-file,
313 ;; bmkp-current-sort-order, bmkp-describe-bookmark,
314 ;; bmkp-describe-bookmark-internals, bmkp-desktop-bookmark-p,
315 ;; bmkp-edit-bookmark, bmkp-face-prop, bmkp-file-alpha-cp,
316 ;; bmkp-file-remote-p, bmkp-function-bookmark-p, bmkp-get-buffer-name,
317 ;; bmkp-get-tags, bmkp-gnus-bookmark-p, bmkp-gnus-cp, bmkp-handler-cp,
318 ;; bmkp-incremental-filter-delay, bmkp-info-bookmark-p, bmkp-info-cp,
319 ;; bmkp-isearch-bookmarks, bmkp-isearch-bookmarks-regexp, bmkp-jump-1,
320 ;; bmkp-last-bookmark-file, bmkp-last-specific-buffer,
321 ;; bmkp-last-specific-file, bmkp-latest-bookmark-alist,
322 ;; bmkp-local-file-bookmark-p, bmkp-local-file-type-cp,
323 ;; bmkp-local-file-accessed-more-recently-cp,
324 ;; bmkp-local-file-updated-more-recently-cp, bmkp-man-bookmark-p,
325 ;; bmkp-marked-bookmark-p, bmkp-marked-bookmarks-only, bmkp-marked-cp,
326 ;; bmkp-msg-about-sort-order, bmkp-non-file-filename,
327 ;; bmkp-read-tag-completing, bmkp-read-tags-completing,
328 ;; bmkp-refresh-menu-list, bmkp-region-bookmark-p,
329 ;; bmkp-remove-all-tags, bmkp-remove-if, bmkp-remove-tags,
330 ;; bmkp-repeat-command, bmkp-reverse-multi-sort-p,
331 ;; bmkp-reverse-sort-p, bmkp-root-or-sudo-logged-p, bmkp-same-file-p,
332 ;; bmkp-save-menu-list-state, bmkp-sequence-bookmark-p,
333 ;; bmkp-set-tag-value, bmkp-set-tag-value-for-bookmarks,
334 ;; bmkp-set-union, bmkp-some, bmkp-some-marked-p,
335 ;; bmkp-some-unmarked-p, bmkp-sort-omit, bmkp-sort-comparer, bmkp-sorted-alist,
336 ;; bmkp-sort-orders-for-cycling-alist, bmkp-su-or-sudo-regexp,
337 ;; bmkp-tag-name, bmkp-tags-list, bmkp-url-bookmark-p, bmkp-url-cp,
338 ;; bmkp-unmarked-bookmarks-only, bmkp-variable-list-bookmark-p,
339 ;; bmkp-visited-more-cp
341 ;; (eval-when-compile (require 'bookmark+-lit nil t))
344 ;;;;;;;;;;;;;;;;;;;;;;;
346 ;; Quiet the byte-compiler
347 (defvar dired-re-mark) ; Defined in `dired.el'.
348 (defvar tramp-file-name-regexp) ; Defined in `tramp.el'.
350 (defvar bmkp-sort-orders-alist) ; Defined in `bookmark+-1.el'.
351 (defvar bmkp-sort-orders-for-cycling-alist) ; Defined in `bookmark+-1.el'.
353 ;;(@* "Faces (Customizable)")
354 ;;; Faces (Customizable) ---------------------------------------------
356 (defgroup bookmark-plus nil
357 "Bookmark enhancements."
358 :prefix "bmkp-" :group 'bookmark
359 :link `(url-link :tag "Send Bug Report"
360 ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\
362 &body=Describe bug here, starting with `emacs -q'. \
363 Don't forget to mention your Emacs and library versions."))
364 :link '(url-link :tag "Download" "http://www.emacswiki.org/bookmark+.el")
365 :link '(url-link :tag "Description" "http://www.emacswiki.org/BookmarkPlus")
366 :link '(emacs-commentary-link :tag "Commentary" "bookmark+"))
368 (defface bmkp->-mark '((((background dark)) (:foreground "Yellow"))
369 (t (:foreground "Blue")))
370 ;; (:foreground "Magenta2" :box (:line-width 1 :style pressed-button))))
371 "*Face used for a `>' mark in the bookmark list."
372 :group 'bookmark-plus :group 'faces)
374 (defface bmkp-a-mark '((((background dark)) (:background "SaddleBrown"))
375 (t (:background "SkyBlue")))
376 "*Face used for an annotation mark (`a') in the bookmark list."
377 :group 'bookmark-plus :group 'faces)
379 (defface bmkp-bad-bookmark '((t (:foreground "Red" :background "Chartreuse1")))
380 "*Face used for a bookmark that seems to be bad: e.g., nonexistent file."
381 :group 'bookmark-plus :group 'faces)
383 (defface bmkp-bookmark-file
384 '((((background dark))
385 (:foreground "#00005A5AFFFF" :background "#FFFF9B9BFFFF")) ; ~ blue, ~ pink
386 (t (:foreground "Orange" :background "DarkGreen")))
387 "*Face used for a bookmark-file bookmark."
388 :group 'bookmark-plus :group 'faces)
390 (defface bmkp-bookmark-list
391 '((((background dark)) (:foreground "#7474FFFFFFFF" :background "DimGray")) ; ~ cyan
392 (t (:foreground "DarkRed" :background "LightGray")))
393 "*Face used for a bookmark-list bookmark."
394 :group 'bookmark-plus :group 'faces)
397 '((((background dark)) (:foreground "#FFFF9B9BFFFF")) ; ~ pink
398 (t (:foreground "DarkGreen")))
399 "*Face used for a bookmarked existing buffer not associated with a file."
400 :group 'bookmark-plus :group 'faces)
402 (defface bmkp-D-mark '((t (:foreground "Yellow" :background "Red")))
403 "*Face used for a deletion mark (`D') in the bookmark list."
404 :group 'bookmark-plus :group 'faces)
406 (defface bmkp-desktop
407 '((((background dark)) (:foreground "Orange" :background "DarkSlateBlue"))
408 (t (:foreground "DarkBlue" :background "PaleGoldenrod")))
409 "*Face used for a bookmarked desktop."
410 :group 'bookmark-plus :group 'faces)
412 (defface bmkp-function
413 '((((background dark)) (:foreground "#0000EBEB6C6C")) ; ~ green
414 (t (:foreground "DeepPink1")))
415 "*Face used for a function bookmark: a bookmark that invokes a function."
416 :group 'bookmark-plus :group 'faces)
419 '((((background dark)) (:foreground "Gold"))
420 (t (:foreground "DarkBlue")))
421 "*Face used for a gnus bookmark."
422 :group 'bookmark-plus :group 'faces)
425 '((((background dark)) (:foreground "#7474FFFFFFFF")) ; ~ light cyan
426 (t (:foreground "DarkRed")))
427 "*Face used for a bookmarked Info node."
428 :group 'bookmark-plus :group 'faces)
430 (defface bmkp-local-directory
431 '((((background dark))
432 (:foreground "Pink" :background "DarkBlue"))
433 (t (:foreground "DarkBlue" :background "HoneyDew2")))
434 "*Face used for a bookmarked local directory."
435 :group 'bookmark-plus :group 'faces)
437 (defface bmkp-local-file-without-region
438 '((((background dark)) (:foreground "White"))
439 (t (:foreground "Black")))
440 "*Face used for a bookmarked local file (without a region)."
441 :group 'bookmark-plus :group 'faces)
443 (defface bmkp-local-file-with-region
444 '((((background dark)) (:foreground "Yellow"))
445 (t (:foreground "Blue")))
446 "*Face used for a region bookmark in a local file."
447 :group 'bookmark-plus :group 'faces)
450 '((((background dark)) (:foreground "Orchid"))
451 (t (:foreground "Orange4")))
452 "*Face used for a `man' page bookmark."
453 :group 'bookmark-plus :group 'faces)
455 (defface bmkp-non-file
456 '((t (:foreground "gray60")))
457 "*Face used for a bookmark not associated with an existing file or buffer."
458 :group 'bookmark-plus :group 'faces)
460 (defface bmkp-remote-file
461 '((((background dark)) (:foreground "#6B6BFFFF2C2C")) ; ~ green
462 (t (:foreground "DarkViolet")))
463 "*Face used for a bookmarked tramp remote file (/ssh:)."
464 :group 'bookmark-plus :group 'faces)
466 (defface bmkp-sequence
467 '((((background dark)) (:foreground "DeepSkyBlue"))
468 (t (:foreground "DarkOrange2")))
469 "*Face used for a sequence bookmark: one composed of other bookmarks."
470 :group 'bookmark-plus :group 'faces)
472 (defface bmkp-su-or-sudo '((t (:foreground "Red")))
473 "*Face used for a bookmarked tramp file (/su: or /sudo:)."
474 :group 'bookmark-plus :group 'faces)
476 (defface bmkp-t-mark '((t (:foreground "Red")))
477 "*Face used for a tags mark (`t') in the bookmark list."
478 :group 'bookmark-plus :group 'faces)
481 '((((background dark)) (:foreground "#7474FFFF7474")) ; ~ green
482 (t (:foreground "DarkMagenta")))
483 "*Face used for a bookmarked URL."
484 :group 'bookmark-plus :group 'faces)
486 (defface bmkp-variable-list
487 '((((background dark)) (:foreground "#FFFF74747474")) ; ~ salmon
488 (t (:foreground "DarkCyan")))
489 "*Face used for a bookmarked list of variables."
490 :group 'bookmark-plus :group 'faces)
492 ;; $$$$$$ Not used now - using `bmkp-url' instead.
494 ;; '((((background dark)) (:foreground "yellow"))
495 ;; (t (:foreground "DarkMagenta")))
496 ;; "*Face used for a bookmarked w3m url."
497 ;; :group 'bookmark-plus :group 'faces)
499 ;; Instead of vanilla `bookmark-menu-heading' (defined in Emacs 22+), to use a better default.
500 (defface bmkp-heading '((((background dark)) (:foreground "Yellow"))
501 (t (:foreground "Blue")))
502 "*Face used to highlight the headings in various Bookmark+ buffers."
503 :group 'bookmark-plus :version "22.1" :group 'faces)
505 ;;(@* "User Options (Customizable)")
506 ;;; User Options (Customizable) --------------------------------------
509 (defcustom bmkp-bmenu-omitted-bookmarks ()
510 "*List of names of omitted bookmarks.
511 They are generally not available for display in the bookmark list.
512 You can, however, use \\<bookmark-bmenu-mode-map>\
513 `\\[bmkp-bmenu-show-only-omitted]' to see them.
514 You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]'
515 to make those that are marked available again for the bookmark list."
516 :type '(repeat (string :tag "Bookmark name")) :group 'bookmark-plus)
519 (defcustom bmkp-bmenu-commands-file (convert-standard-filename "~/.emacs-bmk-bmenu-commands.el")
520 "*File for saving user-defined bookmark-list commands.
521 This must be an absolute file name (possibly containing `~') or nil
522 \(it is not expanded).
524 You can use `\\[bmkp-list-defuns-in-commands-file]' to list the
525 commands defined in the file and how many times each is defined.
527 NOTE: Each time you define a command using \\<bookmark-bmenu-mode-map>\
528 `\\[bmkp-bmenu-define-command]', `\\[bmkp-bmenu-define-full-snapshot-command]', \
529 `\\[bmkp-bmenu-define-jump-marked-command], or `\\[bmkp-define-tags-sort-command]',
530 it is saved in the file. The new definition is simply appended to the
531 file - old definitions of the same command are not overwritten. So
532 you might want to clean up the file occasionally, to remove any old,
533 unused definitions. This is especially advisable if you used \
534 `\\[bmkp-bmenu-define-full-snapshot-command]',
535 because such command definitions can be very large."
536 :type '(file :tag "File for saving menu-list state") :group 'bookmark-plus)
539 (defcustom bmkp-bmenu-state-file (convert-standard-filename "~/.emacs-bmk-bmenu-state.el")
540 "*File for saving `*Bookmark List*' state when you quit bookmark list.
541 This must be an absolute file name (possibly containing `~') or nil
542 \(it is not expanded).
544 The state is also saved when you quit Emacs, even if you don't quit
545 the bookmark list first (using \\<bookmark-bmenu-mode-map>`\\[bmkp-bmenu-quit]').
547 Set this to nil if you do not want to restore the bookmark list as it
548 was the last time you used it."
550 (const :tag "Do not save and restore menu-list state" nil)
551 (file :tag "File for saving menu-list state"))
552 :group 'bookmark-plus)
554 ;; This is a general option. It is in this file because it is used mainly by the bmenu code.
555 (when (> emacs-major-version 20)
556 (defcustom bmkp-sort-orders-alist ()
557 "*Alist of all available sort functions.
558 This is a pseudo option - you probably do NOT want to customize this.
561 * To add a new sort function to this list, use macro
562 `bmkp-define-sort-command'. It defines a new sort function
563 and automatically adds it to this list.
565 * To have fewer sort orders available for cycling by \\<bookmark-bmenu-mode-map>\
566 `\\[bmkp-bmenu-change-sort-order-repeat]'...,
567 customize option `bmkp-sort-orders-for-cycling-alist'.
569 Each alist element has the form (SORT-ORDER . COMPARER):
571 SORT-ORDER is a short string or symbol describing the sort order.
572 Examples: \"by last access time\", \"by bookmark name\".
574 COMPARER compares two bookmarks. It must be acceptable as a value of
575 `bmkp-sort-comparer'."
577 :key-type (choice :tag "Sort order" string symbol)
579 (const :tag "None (do not sort)" nil)
580 (function :tag "Sorting Predicate")
581 (list :tag "Sorting Multi-Predicate"
582 (repeat (function :tag "Component Predicate"))
584 (const :tag "None" nil)
585 (function :tag "Final Predicate")))))
586 :group 'bookmark-plus))
588 (unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist.
589 (defcustom bmkp-sort-orders-alist ()
590 "*Alist of all available sort functions.
591 This is a pseudo option - you probably do NOT want to customize this.
594 * To add a new sort function to this list, use macro
595 `bmkp-define-sort-command'. It defines a new sort function
596 and automatically adds it to this list.
598 * To have fewer sort orders available for cycling by \\<bookmark-bmenu-mode-map>\
599 `\\[bmkp-bmenu-change-sort-order-repeat]'...,
600 customize option `bmkp-sort-orders-for-cycling-alist'.
602 Each alist element has the form (SORT-ORDER . COMPARER):
604 SORT-ORDER is a short string or symbol describing the sort order.
605 Examples: \"by last access time\", \"by bookmark name\".
607 COMPARER compares two bookmarks. It must be acceptable as a value of
608 `bmkp-sort-comparer'."
611 (choice :tag "Sort order" string symbol)
613 (const :tag "None (do not sort)" nil)
614 (function :tag "Sorting Predicate")
615 (list :tag "Sorting Multi-Predicate"
616 (repeat (function :tag "Component Predicate"))
618 (const :tag "None" nil)
619 (function :tag "Final Predicate"))))))
620 :group 'bookmark-plus))
622 (defcustom bmkp-propertize-bookmark-names-flag (> emacs-major-version 20)
623 "*Non-nil means to propertize bookmark names to hold full bookmark data.
624 This means that you can effectively have more than one bookmark with
627 Emacs 20 users: If you need to use your bookmarks with Emacs 20 then
628 set this to nil. In particular, if your bookmark file was written
629 with this as non-nil, then it contains propertized strings which are
630 unreadable by Emacs 20. To convert the file to be usable with Emacs
631 20 you must, in Emacs 21 or later, set this to nil and then do `M-x
633 :type 'boolean :group 'bookmark-plus)
635 ;;(@* "Internal Variables")
636 ;;; Internal Variables -----------------------------------------------
638 (defconst bmkp-bmenu-header-lines 2
639 "Number of lines used for the `*Bookmark List*' header.")
641 (defconst bmkp-bmenu-marks-width 4
642 "Number of columns (chars) used for the `*Bookmark List*' marks columns.")
644 (defvar bmkp-bmenu-marked-bookmarks ()
645 "Names of the marked bookmarks.
646 This includes possibly omitted bookmarks, that is, bookmarks listed in
647 `bmkp-bmenu-omitted-bookmarks'.")
649 (defvar bmkp-bmenu-before-hide-unmarked-alist ()
650 "Copy of `bookmark-alist' made before hiding unmarked bookmarks.")
652 (defvar bmkp-bmenu-before-hide-marked-alist ()
653 "Copy of `bookmark-alist' made before hiding marked bookmarks.")
655 (defvar bmkp-bmenu-filter-function nil "Latest filtering function for `*Bookmark List*' display.")
657 (defvar bmkp-bmenu-title "" "Latest title for `*Bookmark List*' display.")
659 (defvar bmkp-bmenu-filter-pattern "" "Regexp for incremental filtering.")
661 (defvar bmkp-bmenu-filter-prompt "Pattern: " "Prompt for `bmkp-bmenu-filter-incrementally'.")
663 (defvar bmkp-bmenu-filter-timer nil "Timer used for incremental filtering.")
665 (defvar bmkp-bmenu-first-time-p t
666 "Non-nil means bookmark list has not yet been shown after quitting it.
667 Quitting the list or the Emacs session resets this to t.
668 The first time the list is displayed, it is set to nil.")
670 ;; This is a general variable. It is in this file because it is used only in the bmenu code.
671 (defvar bmkp-last-bmenu-bookmark nil "The name of the last bookmark current in the bookmark list.")
673 ;;(@* "Compatibility Code for Older Emacs Versions")
674 ;;; Compatibility Code for Older Emacs Versions ----------------------
676 (when (< emacs-major-version 22)
677 (defun bookmark-bmenu-relocate ()
678 "Change the file path of the bookmark on the current line,
679 prompting with completion for the new path."
681 (let ((bmk (bookmark-bmenu-bookmark))
683 (bookmark-relocate bmk)
684 (goto-char thispoint))))
686 ;;(@* "Menu List Replacements (`bookmark-bmenu-*')")
687 ;;; Menu List Replacements (`bookmark-bmenu-*') ----------------------
691 ;; REPLACES ORIGINAL in `bookmark.el'.
693 ;; 1. Return t. Value doesn't mean anything (didn't anyway), but must be non-nil for vanilla Emacs.
694 ;; 2. Do not count lines. Just make sure we're on a bookmark line.
696 (defalias 'bookmark-bmenu-check-position 'bookmark-bmenu-ensure-position)
697 (defun bookmark-bmenu-ensure-position ()
698 "Move to the beginning of the nearest bookmark line."
700 (unless (bookmark-bmenu-bookmark)
701 (if (and (bolp) (eobp))
702 (beginning-of-line 0)
703 (goto-char (point-min))
704 (forward-line bmkp-bmenu-header-lines)))
705 t) ; Older vanilla bookmark code depends on non-nil value.
708 ;; REPLACES ORIGINAL in `bookmark.el'.
710 ;; 1. Add bookmark to `bmkp-bmenu-marked-bookmarks'.
711 ;; 2. Don't call `bookmark-bmenu-ensure-position' again at end.
712 ;; 3. Raise error if not in `*Bookmark List*'.
715 (defun bookmark-bmenu-mark () ; Bound to `m' in bookmark list
716 "Mark the bookmark on this line, using mark `>'."
718 (bmkp-bmenu-barf-if-not-in-menu-list)
719 (bookmark-bmenu-ensure-position)
721 (let ((inhibit-read-only t))
722 (push (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)
723 (delete-char 1) (insert ?>) (put-text-property (1- (point)) (point) 'face 'bmkp->-mark)
727 ;; REPLACES ORIGINAL in `bookmark.el'.
729 ;; 1. Remove bookmark from `bmkp-bmenu-marked-bookmarks'.
730 ;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'.
731 ;; 3. Don't call `bookmark-bmenu-ensure-position' again at end.
732 ;; 4. Raise error if not in `*Bookmark List*'.
735 (defun bookmark-bmenu-unmark (&optional backup) ; Bound to `u' in bookmark list
736 "Unmark the bookmark on this line, then move down to the next.
737 Optional BACKUP means move up instead."
739 (bmkp-bmenu-barf-if-not-in-menu-list)
740 (bookmark-bmenu-ensure-position)
742 (let ((inhibit-read-only t))
743 (delete-char 1) (insert " ")
744 (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list
745 (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)))
746 (forward-line (if backup -1 1)))
749 ;; REPLACES ORIGINAL in `bookmark.el'.
751 ;; 1. Do not use `bookmark-bmenu-ensure-position' as a test - it always returns non-nil anyway.
752 ;; And don't call it at again the end.
753 ;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'.
754 ;; 3. Use face `bmkp-bad-bookmark' on the `D' flag.
755 ;; 4. Raise error if not in buffer `*Bookmark List*'.
756 ;; 5. Remove bookmark from `bmkp-bmenu-marked-bookmarks'.
759 (defun bookmark-bmenu-delete () ; Bound to `d', `k' in bookmark list
760 "Flag this bookmark for deletion, using mark `D'.
761 Use `\\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]' to carry out \
764 (bmkp-bmenu-barf-if-not-in-menu-list)
766 (bookmark-bmenu-ensure-position)
767 (let ((inhibit-read-only t))
768 (delete-char 1) (insert ?D) (put-text-property (1- (point)) (point) 'face 'bmkp-D-mark))
769 (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list
770 (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks))
774 ;; REPLACES ORIGINAL in `bookmark.el'.
776 ;; 1. Rebuild the menu list using the last filtered alist in use, `bmkp-latest-bookmark-alist'.
777 ;; 2. Update the menu-list title.
779 (defun bookmark-bmenu-surreptitiously-rebuild-list ()
780 "Rebuild the bookmark list, if it exists."
781 (when (get-buffer "*Bookmark List*")
782 (save-excursion (save-window-excursion (let ((bookmark-alist bmkp-latest-bookmark-alist))
783 (bookmark-bmenu-list 'filteredp))))))
786 ;; REPLACES ORIGINAL in `bookmark.el'.
788 ;; 1. Added args TITLE, FILTEREDP, DONT-TOGGLE-FILENAMES-P.
789 ;; 2. Handles also region bookmarks and buffer (non-file) bookmarks.
790 ;; 3. Uses `pop-to-buffer', not `switch-to-buffer', so we respect `special-display-*'
791 ;; (but keep `one-window-p' if that's the case).
792 ;; 4. If option `bmkp-bmenu-state-file' is non-nil, then the first time since the last quit
793 ;; (or the last Emacs session) restores the last menu-list state.
794 ;; 5. If option `bmkp-bmenu-commands-file' is non-nil, then read that file, which contains
795 ;; user-defined `*Bookmark List*' commands.
798 (defalias 'list-bookmarks 'bookmark-bmenu-list)
800 (defun bookmark-bmenu-list (&optional filteredp) ; Bound to `C-x r l'
801 "Display a list of existing bookmarks, in buffer `*Bookmark List*'.
802 The leftmost column of a bookmark entry shows `D' if the bookmark is
803 flagged for deletion, or `>' if it is marked normally.
804 The second column shows `t' if the bookmark has tags.
805 The third column shows `a' if the bookmark has an annotation.
807 The following faces are used for the list entries.
808 Use `customize-face' if you want to change the appearance.
810 `bmkp-bad-bookmark', `bmkp-bookmark-list', `bmkp-buffer',
811 `bmkp-desktop', `bmkp-function', `bmkp-gnus', `bmkp-info',
812 `bmkp-local-directory', `bmkp-local-file-without-region',
813 `bmkp-local-file-with-region', `bmkp-man', `bmkp-non-file',
814 `bmkp-remote-file', `bmkp-sequence', `bmkp-su-or-sudo', `bmkp-url',
815 `bmkp-variable-list'.
817 If option `bmkp-bmenu-state-file' is non-nil then the state of the
818 displayed bookmark-list is saved when you quit it, and it is restored
819 when you next use this command. That saved state is not restored,
820 however, if it represents a different file from the current bookmark
823 If you call this interactively when buffer `*Bookmark List*' exists,
824 that buffer is refreshed to show all current bookmarks, and any
825 markings are removed. If you instead want to show the buffer in its
826 latest state then just do that: use `C-x b' or similar. If you want
827 to refresh the displayed buffer, to show the latest state, reflecting
828 any additions, deletions, renamings, and so on, use \\<bookmark-bmenu-mode-map>\
829 `\\[bmkp-bmenu-refresh-menu-list]'.
831 In Lisp code, non-nil optional argument FILTEREDP means the bookmark
832 list has been filtered, which means:
833 * Use `bmkp-bmenu-title' not the default menu-list title.
834 * Do not reset `bmkp-latest-bookmark-alist' to `bookmark-alist'."
836 (bookmark-maybe-load-default-file)
837 (when (and bmkp-bmenu-first-time-p bmkp-bmenu-commands-file
838 (file-readable-p bmkp-bmenu-commands-file))
839 (with-current-buffer (let ((enable-local-variables ())
840 (emacs-lisp-mode-hook nil))
841 (find-file-noselect bmkp-bmenu-commands-file))
842 (goto-char (point-min))
843 (while (not (eobp)) (condition-case nil (eval (read (current-buffer))) (error nil)))
844 (kill-buffer (current-buffer))))
845 (cond ((and bmkp-bmenu-first-time-p bmkp-bmenu-state-file ; Restore from state file.
846 (file-readable-p bmkp-bmenu-state-file))
848 (with-current-buffer (let ((enable-local-variables nil)
849 (emacs-lisp-mode-hook nil))
850 (find-file-noselect bmkp-bmenu-state-file))
851 (goto-char (point-min))
852 (setq state (condition-case nil (read (current-buffer)) (error nil)))
853 (kill-buffer (current-buffer)))
854 (let ((last-bookmark-file-from-state (cdr (assq 'last-bookmark-file state))))
855 (when (and (consp state)
856 ;; If bookmark file has changed, then do not use state saved from other file.
857 (or (not last-bookmark-file-from-state)
858 (bmkp-same-file-p last-bookmark-file-from-state
859 bmkp-current-bookmark-file)))
860 (setq bmkp-sort-comparer (cdr (assq 'last-sort-comparer state))
861 bmkp-reverse-sort-p (cdr (assq 'last-reverse-sort-p state))
862 bmkp-reverse-multi-sort-p (cdr (assq 'last-reverse-multi-sort-p state))
863 bmkp-latest-bookmark-alist (cdr (assq 'last-latest-bookmark-alist state))
864 bmkp-bmenu-omitted-bookmarks (cdr (assq 'last-bmenu-omitted-bookmarks state))
865 bmkp-bmenu-marked-bookmarks (cdr (assq 'last-bmenu-marked-bookmarks state))
866 bmkp-bmenu-filter-function (cdr (assq 'last-bmenu-filter-function state))
867 bmkp-bmenu-filter-pattern
868 (or (cdr (assq 'last-bmenu-filter-pattern state)) "")
869 bmkp-bmenu-title (cdr (assq 'last-bmenu-title state))
870 bmkp-last-bmenu-bookmark (cdr (assq 'last-bmenu-bookmark state))
871 bmkp-last-specific-buffer (cdr (assq 'last-specific-buffer state))
872 bmkp-last-specific-file (cdr (assq 'last-specific-file state))
873 bookmark-bmenu-toggle-filenames (cdr (assq 'last-bmenu-toggle-filenames state))
874 bmkp-last-bookmark-file bmkp-current-bookmark-file
875 bmkp-current-bookmark-file last-bookmark-file-from-state
876 bmkp-bmenu-before-hide-marked-alist
877 (cdr (assq 'last-bmenu-before-hide-marked-alist state))
878 bmkp-bmenu-before-hide-unmarked-alist
879 (cdr (assq 'last-bmenu-before-hide-unmarked-alist state))))))
880 (setq bmkp-bmenu-first-time-p nil)
881 (let ((bookmark-alist (or bmkp-latest-bookmark-alist bookmark-alist)))
882 (bmkp-bmenu-list-1 'filteredp nil (interactive-p)))
883 (when bmkp-last-bmenu-bookmark
884 (with-current-buffer (get-buffer "*Bookmark List*")
885 (bmkp-bmenu-goto-bookmark-named bmkp-last-bmenu-bookmark))))
887 (setq bmkp-bmenu-first-time-p nil)
888 (bmkp-bmenu-list-1 filteredp
889 (or (interactive-p) (not (get-buffer "*Bookmark List*")))
892 (defun bmkp-bmenu-list-1 (filteredp reset-marked-p interactivep)
893 "Helper for `bookmark-bmenu-list'.
894 See `bookmark-bmenu-list' for the description of FILTEREDP.
895 Non-nil RESET-MARKED-P resets `bmkp-bmenu-marked-bookmarks'.
896 Non-nil INTERACTIVEP means `bookmark-bmenu-list' was called
897 interactively, so pop to the bookmark list and communicate the sort
899 (when reset-marked-p (setq bmkp-bmenu-marked-bookmarks ()))
900 (unless filteredp (setq bmkp-latest-bookmark-alist bookmark-alist))
902 (let ((one-win-p (one-window-p)))
903 (pop-to-buffer (get-buffer-create "*Bookmark List*"))
904 (when one-win-p (delete-other-windows)))
905 (set-buffer (get-buffer-create "*Bookmark List*")))
906 (let* ((inhibit-read-only t)
907 (title (if (and filteredp bmkp-bmenu-title (not (equal "" bmkp-bmenu-title)))
911 (insert (format "%s\n%s\n" title (make-string (length title) ?-)))
912 (add-text-properties (point-min) (point) (bmkp-face-prop 'bmkp-heading))
914 name markedp tags annotation start)
915 (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist
916 (and (not (eq bmkp-bmenu-filter-function
917 'bmkp-omitted-alist-only))
918 bmkp-bmenu-omitted-bookmarks)))
919 (dolist (bmk bmkp-sorted-alist)
920 (setq max-width (max max-width (length (bookmark-name-from-full-record bmk)))))
921 (setq max-width (+ max-width bmkp-bmenu-marks-width))
922 (dolist (bmk bmkp-sorted-alist)
923 (setq name (bookmark-name-from-full-record bmk)
924 markedp (bmkp-marked-bookmark-p bmk)
925 tags (bmkp-get-tags bmk)
926 annotation (bookmark-get-annotation bmk)
927 start (+ bmkp-bmenu-marks-width (point)))
930 (insert ">") (put-text-property (1- (point)) (point) 'face 'bmkp->-mark))
933 (insert "t") (put-text-property (1- (point)) (point) 'face 'bmkp-t-mark))
934 (if (not (and annotation (not (string-equal annotation ""))))
936 (insert "a") (put-text-property (1- (point)) (point) 'face 'bmkp-a-mark))
938 (when (and (featurep 'bookmark+-lit) (bmkp-get-lighting bmk)) ; Highlight highlight overrides.
939 (put-text-property (1- (point)) (point) 'face 'bmkp-light-mark))
941 (move-to-column max-width t)
942 (bmkp-bmenu-propertize-item bmk start (point))
944 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
945 (bookmark-bmenu-mode)
946 (when bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t))
947 (when (and (fboundp 'fit-frame-if-one-window)
948 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
949 (fit-frame-if-one-window)))
950 (when (and interactivep bmkp-sort-comparer)
951 (bmkp-msg-about-sort-order (bmkp-current-sort-order))))
954 ;; REPLACES ORIGINAL in `bookmark.el'.
957 ;; 1. Get name of the current bookmark from text property `bmkp-bookmark-name'.
958 ;; 2. Added optional arg FULL, to return full bookmark record.
959 ;; 3. Use `condition-case' in case we're at eob (so cannot advance).
961 (defun bookmark-bmenu-bookmark (&optional full)
962 "Return the name of the bookmark on this line.
963 Normally, the string returned is propertized with property
964 `bmkp-full-record', which records the full bookmark record.
965 Non-nil optional FULL means return the bookmark record, not the name."
967 (let ((name (save-excursion (forward-line 0) (forward-char (1+ bmkp-bmenu-marks-width))
968 (get-text-property (point) 'bmkp-bookmark-name))))
970 (get-text-property 0 'bmkp-full-record name)
975 ;; REPLACES ORIGINAL in `bookmark.el'.
977 ;; Only the doc string is different.
979 (defun bookmark-bmenu-mode ()
980 "Major mode for editing a list of bookmarks.
981 Each line represents an Emacs bookmark.\\<bookmark-bmenu-mode-map>
983 More bookmarking help below. Keys without prefix `C-x' are available
984 only in buffer `*Bookmark List*'. Others are available everywhere.
990 \\[bmkp-bmenu-describe-this-bookmark]\t- Show information about this bookmark (`C-u': \
992 \\[bmkp-bmenu-describe-this+move-down]\t- Show the info, then move to next bookmark
993 \\[bmkp-bmenu-describe-this+move-up]\t- Show the info, then move to previous bookmark
994 \\[bmkp-bmenu-describe-marked]\t- Show info about the marked bookmarks (`C-u': internal form)
995 \\[bookmark-bmenu-locate]\t- Show the location of this bookmark in the minibuffer
996 \\[bookmark-bmenu-show-annotation]\t- Show this bookmark's annotation
997 \\[bookmark-bmenu-show-all-annotations]\t- Show the annotations of all annotated bookmarks
998 \\[bookmark-bmenu-toggle-filenames]\t- Toggle showing filenames next to bookmarks
1000 \\[bmkp-list-defuns-in-commands-file]
1001 \t- List the commands defined in `bmkp-bmenu-commands-file'
1007 \\[bmkp-bmenu-refresh-menu-list]\t- Refresh (revert) to up-to-date bookmark list
1008 \\[bmkp-bmenu-quit]\t- Quit (`*Bookmark List*')
1009 \\[bmkp-bmenu-dired-marked]\t- Open Dired for the marked files and directories
1011 \\[bookmark-bmenu-load]\t- Add bookmarks from a different bookmark file (extra load)
1012 \\[bmkp-switch-bookmark-file]\t- Switch to a different bookmark file (overwrite load)
1013 C-u \\[bmkp-switch-bookmark-file]\t- Switch back to the last bookmark file (overwrite load)
1014 \\[bmkp-set-bookmark-file-bookmark]\t- Create a bookmark to a bookmark file \
1015 \(`\\[bmkp-bookmark-file-jump]' to load)
1017 \\[bmkp-toggle-saving-bookmark-file]\t- Toggle autosaving the bookmark file
1018 \\[bmkp-toggle-saving-menu-list-state]\t- Toggle autosaving bookmark-list display state (this list)
1019 \\[bookmark-bmenu-save]\t- Save bookmarks (`C-u': prompt for the bookmark file to use)
1020 \\[bmkp-save-menu-list-state]\t- Save bookmark-list display state
1022 \\[bmkp-choose-navlist-of-type]\t- Set the navlist to the bookmarks of a type you choose
1023 \\[bmkp-choose-navlist-from-bookmark-list]\t- Set the navlist to the bookmarks of a \
1024 bookmark-list bookmark
1025 \\[bmkp-navlist-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in navlist
1026 \\[bmkp-this-buffer-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in current buffer
1027 \\[bmkp-delete-bookmarks]\t- Delete some bookmarks at point or all in buffer
1029 \\[bmkp-toggle-bookmark-set-refreshes]
1030 \t- Toggle whether `bookmark-set' refreshes the bookmark list
1031 \\[bmkp-make-function-bookmark]
1032 \t- Create a function bookmark
1033 \\[bmkp-bmenu-make-sequence-from-marked]
1034 \t- Create a sequence bookmark from the marked bookmarks
1040 \\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Set/delete an autonamed bookmark here
1041 \\[bmkp-autofile-set]\t- Set and autoname a bookmark for a file
1042 \\[bmkp-file-target-set]\t- Set a bookmark for a file
1043 \\[bmkp-url-target-set]\t- Set a bookmark for a URL
1044 \\[bookmark-set]\t- Set a bookmark here
1045 \\[bmkp-set-desktop-bookmark]\t- Set a bookmark for the current desktop
1046 \\[bmkp-set-bookmark-file-bookmark]\t- Set a bookmark for a bookmark file
1052 \\[bookmark-bmenu-select]\t- This bookmark and also visit bookmarks marked `>'
1053 \\[bookmark-bmenu-this-window]\t- This bookmark in the same window
1054 \\[bookmark-bmenu-other-window]\t- This bookmark in another window
1055 \\[bookmark-bmenu-switch-other-window]\t- This bookmark in other window, without selecting it
1056 \\[bookmark-bmenu-1-window]\t- This bookmark in a full-frame window
1057 \\[bookmark-bmenu-2-window]\t- This bookmark and last-visited bookmark
1059 \\[bookmark-jump]\t- Bookmark by name
1060 \\[bmkp-jump-to-type]\t- Bookmark by type
1061 \\[bmkp-jump-in-navlist]\t- Bookmark in the navigation list
1062 \\[bmkp-lighted-jump]\t- Highlighted bookmark
1063 \\[bmkp-desktop-jump]\t- Desktop bookmark
1064 \\[bmkp-bookmark-list-jump]\t- Bookmark-list bookmark
1065 \\[bmkp-bookmark-file-jump]\t- Bookmark-file bookmark
1066 \\[bmkp-dired-jump]\t- Dired bookmark
1067 \\[bmkp-file-jump]\t- File or directory bookmark
1068 \\[bmkp-dired-this-dir-jump]\t- Dired bookmark for this dir
1069 \\[bmkp-file-this-dir-jump]\t- Bookmark for a file or subdir in this dir
1070 \\[bmkp-local-file-jump]\t- Local-file bookmark
1071 \\[bmkp-remote-file-jump]\t- Remote-file bookmark
1072 \\[bmkp-region-jump]\t- Region bookmark
1073 \\[bmkp-info-jump]\t- Info bookmark
1074 \\[bmkp-man-jump]\t- `man'-page bookmark
1075 \\[bmkp-non-file-jump]\t- Non-file (buffer) bookmark
1076 \\[bmkp-gnus-jump]\t- Gnus bookmark
1077 \\[bmkp-url-jump]\t- URL bookmark
1078 \\[bmkp-variable-list-jump]\t- Variable-list bookmark
1079 \\[bmkp-autonamed-jump]\t- Autonamed bookmark
1080 \\[bmkp-autonamed-this-buffer-jump]\t- Autonamed bookmark in buffer
1081 \\[bmkp-some-tags-jump]\t- Bookmark having some tags you specify
1082 \\[bmkp-all-tags-jump]\t- Bookmark having each tag you specify
1083 \\[bmkp-some-tags-regexp-jump]\t- Bookmark having a tag that matches a regexp
1084 \\[bmkp-all-tags-regexp-jump]\t- Bookmark having all its tags match a regexp
1085 \\[bmkp-file-some-tags-jump]\t- File bookmark having some tags you specify
1086 \\[bmkp-file-all-tags-jump]\t- File bookmark having each tag you specify
1087 \\[bmkp-file-some-tags-regexp-jump]\t- File bookmark having a tag that matches a regexp
1088 \\[bmkp-file-all-tags-regexp-jump]\t- File bookmark having all its tags match a regexp
1089 \\[bmkp-file-this-dir-some-tags-jump]\t- File in this dir having some tags you specify
1090 \\[bmkp-file-this-dir-all-tags-jump]\t- File in this dir having each tag you specify
1091 \\[bmkp-file-this-dir-some-tags-regexp-jump]\t- File in this dir having a tag that matches a regexp
1092 \\[bmkp-file-this-dir-all-tags-regexp-jump]\t- File in this dir having all its tags match a regexp
1095 Cycle Bookmarks and Autonamed Bookmarks
1096 ---------------------------------------
1098 \\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Create/delete autonamed bookmark at point
1099 \\[bmkp-autonamed-jump]\t- Jump to an autonamed bookmark
1100 \\[bmkp-autonamed-this-buffer-jump]\t- Jump to an autonamed bookmark in buffer
1101 C-x p n n ...\t- Next bookmark in buffer (C-x p C-n, C-x p down)
1102 C-x p p p ...\t- Previous bookmark in buffer (C-x p C-p, C-x p up)
1103 C-x p f f ...\t- Next bookmark in navlist (C-x p C-f, C-x p right)
1104 C-x p b b ...\t- Previous bookmark in navlist (C-x p C-b, C-x p left)
1105 C-x p next ...\t- MS Windows `Open' next bookmark in navlist
1106 C-x p prior ...\t- MS Windows `Open' previous bookmark in navlist
1107 C-x C-down ...\t- Next highlighted bookmark in buffer
1108 C-x C-up ...\t- Previous highlighted bookmark in buffer
1110 \\[bmkp-delete-all-autonamed-for-this-buffer]
1111 \t- Delete all autonamed bookmarks in current buffer
1114 Search-and-Replace Targets (in sort order)
1115 --------------------------
1117 M-s a C-s\t- Isearch the marked bookmarks (Emacs 23+)
1118 M-s a C-M-s\t- Regexp-isearch the marked bookmarks (Emacs 23+)
1119 \\[bmkp-bmenu-search-marked-bookmarks-regexp]\t- Regexp-search the marked file bookmarks
1120 \\[bmkp-bmenu-query-replace-marked-bookmarks-regexp]\t\t- Query-replace the marked file \
1127 \(Mark means `>'. Flag means `D'. See also `Tags', below.)
1129 \\[bookmark-bmenu-delete]\t- Flag this bookmark `D' for deletion, then move down
1130 \\[bookmark-bmenu-delete-backwards]\t- Flag this bookmark `D' for deletion, then move up
1132 \\[bookmark-bmenu-mark]\t- Mark this bookmark
1133 \\[bookmark-bmenu-unmark]\t- Unmark this bookmark (`C-u': move up one line)
1134 \\[bookmark-bmenu-backup-unmark]\t- Unmark previous bookmark (move up, then unmark)
1136 \\[bmkp-bmenu-mark-all]\t- Mark all bookmarks
1137 \\[bmkp-bmenu-regexp-mark]\t- Mark all bookmarks whose names match a regexp
1138 \\[bmkp-bmenu-unmark-all]\t- Unmark all bookmarks (`C-u': interactive query)
1139 \\[bmkp-bmenu-toggle-marks]\t- Toggle marks: unmark the marked and mark the unmarked
1141 \\[bmkp-bmenu-mark-autofile-bookmarks]\t- Mark autofile bookmarks
1142 \\[bmkp-bmenu-mark-non-file-bookmarks]\t- Mark non-file (i.e. buffer) bookmarks
1143 \\[bmkp-bmenu-mark-dired-bookmarks]\t- Mark Dired bookmarks
1144 \\[bmkp-bmenu-mark-file-bookmarks]\t- Mark file & directory bookmarks (`C-u': local only)
1145 \\[bmkp-bmenu-mark-gnus-bookmarks]\t- Mark Gnus bookmarks
1146 \\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark the highlighted bookmarks
1147 \\[bmkp-bmenu-mark-info-bookmarks]\t- Mark Info bookmarks
1148 \\[bmkp-bmenu-mark-desktop-bookmarks]\t- Mark desktop bookmarks
1149 \\[bmkp-bmenu-mark-bookmark-file-bookmarks]\t- Mark bookmark-file bookmarks
1150 \\[bmkp-bmenu-mark-man-bookmarks]\t- Mark `man' page bookmarks (that's `M' twice, not Meta-M)
1151 \\[bmkp-bmenu-mark-region-bookmarks]\t- Mark region bookmarks
1152 \\[bmkp-bmenu-mark-url-bookmarks]\t- Mark URL bookmarks
1153 \\[bmkp-bmenu-mark-w3m-bookmarks]\t- Mark W3M (URL) bookmarks
1159 \(See also `Tags', next.)
1161 \\[bookmark-bmenu-edit-annotation]\t- Edit this bookmark's annotation
1162 \\[bmkp-bmenu-edit-bookmark]\t- Rename and relocate this bookmark
1163 \\[bookmark-bmenu-rename]\t- Rename this bookmark
1164 \\[bookmark-bmenu-relocate]\t- Relocate this bookmark (change file)
1165 \\[bmkp-bmenu-edit-tags]\t- Edit this bookmark's tags
1166 \\[bookmark-bmenu-execute-deletions]\t- Delete (visible) bookmarks flagged `D'
1167 \\[bmkp-bmenu-delete-marked]\t- Delete (visible) bookmarks marked `>'
1173 \\[bmkp-add-tags]\t- Add some tags to a bookmark
1174 \\[bmkp-remove-tags]\t- Remove some tags from a bookmark
1175 \\[bmkp-remove-all-tags]\t- Remove all tags from a bookmark
1176 \\[bmkp-remove-tags-from-all]\t- Remove some tags from all bookmarks
1177 \\[bmkp-rename-tag]\t- Rename a tag in all bookmarks
1178 \\[bmkp-list-all-tags]\t- List all tags used in any bookmarks (`C-u': show tag values)
1179 \\[bmkp-bmenu-edit-tags]\t- Edit this bookmark's tags
1180 \\[bmkp-bmenu-set-tag-value]\t- Set the value of a tag (as attribute)
1182 \\[bmkp-bmenu-add-tags-to-marked]\t- Add some tags to the marked bookmarks
1183 \\[bmkp-bmenu-remove-tags-from-marked]\t- Remove some tags from the marked bookmarks
1185 \\[bmkp-bmenu-mark-bookmarks-tagged-regexp]\t- Mark bookmarks having at least one \
1186 tag that matches a regexp
1187 \\[bmkp-bmenu-mark-bookmarks-tagged-some]\t- Mark bookmarks having at least one tag \
1189 \\[bmkp-bmenu-mark-bookmarks-tagged-all]\t- Mark bookmarks having all of the tags \
1191 \\[bmkp-bmenu-mark-bookmarks-tagged-none]\t- Mark bookmarks not having any of the tags \
1193 \\[bmkp-bmenu-mark-bookmarks-tagged-not-all]\t- Mark bookmarks not having all of the \
1194 tags in a set (NOT AND)
1196 \\[bmkp-bmenu-unmark-bookmarks-tagged-regexp]\t- Unmark bookmarks having at least one \
1197 tag that matches a regexp
1198 \\[bmkp-bmenu-unmark-bookmarks-tagged-some]\t- Unmark bookmarks having at least one \
1200 \\[bmkp-bmenu-unmark-bookmarks-tagged-all]\t- Unmark bookmarks having all of the tags \
1202 \\[bmkp-bmenu-unmark-bookmarks-tagged-none]\t- Unmark bookmarks not having any tags \
1204 \\[bmkp-bmenu-unmark-bookmarks-tagged-not-all]\t- Unmark bookmarks not having all tags \
1208 Bookmark Highlighting
1209 ---------------------
1211 \\[bmkp-bmenu-show-only-lighted]\t- Show only the highlighted bookmarks
1212 \\[bmkp-bmenu-set-lighting]\t- Set highlighting for this bookmark
1213 \\[bmkp-bmenu-set-lighting-for-marked]\t- Set highlighting for marked bookmarks
1214 \\[bmkp-bmenu-light]\t- Highlight this bookmark
1215 \\[bmkp-bmenu-unlight]\t- Unhighlight this bookmark
1216 \\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark the highlighted bookmarks
1217 \\[bmkp-bmenu-light-marked]\t- Highlight the marked bookmarks
1218 \\[bmkp-bmenu-unlight-marked]\t- Unhighlight the marked bookmarks
1219 \\[bmkp-light-bookmark-this-buffer]\t- Highlight a bookmark in current buffer
1220 \\[bmkp-unlight-bookmark-this-buffer]\t- Unhighlight a bookmark in current buffer
1221 \\[bmkp-light-bookmarks]\t- Highlight bookmarks (see prefix arg)
1222 \\[bmkp-unlight-bookmarks]\t- Unhighlight bookmarks (see prefix arg)
1223 \\[bmkp-bookmarks-lighted-at-point]\t- List bookmarks highlighted at point
1224 \\[bmkp-unlight-bookmark-here]\t- Unhighlight a bookmark at point or on same line
1230 \(Repeat to cycle normal/reversed/off, except as noted.)
1232 \\[bmkp-bmenu-sort-marked-before-unmarked]\t- Sort marked bookmarks first
1233 \\[bmkp-bmenu-sort-by-last-buffer-or-file-access]\t- Sort by last buffer or file \
1235 \\[bmkp-bmenu-sort-by-Gnus-thread]\t- Sort by Gnus thread: group, article, message
1236 \\[bmkp-bmenu-sort-by-Info-location]\t- Sort by Info manual, node, position
1237 \\[bmkp-bmenu-sort-by-bookmark-type]\t- Sort by bookmark type
1238 \\[bmkp-bmenu-sort-by-bookmark-name]\t- Sort by bookmark name
1239 \\[bmkp-bmenu-sort-by-creation-time]\t- Sort by bookmark creation time
1240 \\[bmkp-bmenu-sort-by-last-bookmark-access]\t- Sort by last bookmark access time
1241 \\[bmkp-bmenu-sort-by-bookmark-visit-frequency]\t- Sort by bookmark visit frequency
1242 \\[bmkp-bmenu-sort-by-url]\t- Sort by URL
1244 \\[bmkp-bmenu-sort-by-local-file-type]\t- Sort by local file type: file, symlink, dir
1245 \\[bmkp-bmenu-sort-by-file-name]\t- Sort by file name
1246 \\[bmkp-bmenu-sort-by-local-file-size]\t- Sort by local file size
1247 \\[bmkp-bmenu-sort-by-last-local-file-access]\t- Sort by last local file access
1248 \\[bmkp-bmenu-sort-by-last-local-file-update]\t- Sort by last local file update (edit)
1250 \\[bmkp-reverse-sort-order]\t- Reverse current sort direction (repeat to toggle)
1251 \\[bmkp-reverse-multi-sort-order]\t- Complement sort predicate decisions (repeat \
1253 \\[bmkp-bmenu-change-sort-order-repeat]\t- Cycle sort orders (repeat \
1260 \\[bmkp-bmenu-show-all]\t- Show all bookmarks
1261 \\[bmkp-bmenu-toggle-show-only-marked]\t- Toggle showing only marked bookmarks
1262 \\[bmkp-bmenu-toggle-show-only-unmarked]\t- Toggle showing only unmarked bookmarks
1263 \\[bmkp-bmenu-show-only-autofiles]\t- Show only autofile bookmarks
1264 \\[bmkp-bmenu-show-only-autonamed]\t- Show only autonamed bookmarks
1265 \\[bmkp-bmenu-show-only-non-files]\t- Show only non-file (i.e. buffer) bookmarks
1266 \\[bmkp-bmenu-show-only-dired]\t- Show only Dired bookmarks
1267 \\[bmkp-bmenu-show-only-files]\t- Show only file & directory bookmarks (`C-u': local only)
1268 \\[bmkp-bmenu-show-only-gnus]\t- Show only Gnus bookmarks
1269 \\[bmkp-bmenu-show-only-info-nodes]\t- Show only Info bookmarks
1270 \\[bmkp-bmenu-show-only-desktops]\t- Show only desktop bookmarks
1271 \\[bmkp-bmenu-show-only-bookmark-files]\t- Show only bookmark-file bookmarks
1272 \\[bmkp-bmenu-show-only-man-pages]\t- Show only `man' page bookmarks
1273 \\[bmkp-bmenu-show-only-regions]\t- Show only region bookmarks
1274 \\[bmkp-bmenu-show-only-variable-lists]\t- Show only variable-list bookmarks
1275 \\[bmkp-bmenu-show-only-urls]\t- Show only URL bookmarks
1276 \\[bmkp-bmenu-show-only-w3m-urls]\t- Show only W3M (URL) bookmarks
1277 \\[bmkp-bmenu-filter-bookmark-name-incrementally]\t- Incrementally show only bookmarks \
1278 whose names match a regexp
1279 \\[bmkp-bmenu-filter-file-name-incrementally]\t- Incrementally show only bookmarks whose \
1280 files match a regexp
1281 \\[bmkp-bmenu-filter-annotation-incrementally]\t- Incrementally show only bookmarks whose \
1282 annotations match a regexp
1283 \\[bmkp-bmenu-filter-tags-incrementally]\t- Incrementally show only bookmarks whose tags \
1285 \\[bmkp-bmenu-show-only-tagged]\t- Show only bookmarks that have tags
1291 \\[bmkp-bmenu-show-only-omitted]\t- Show (only) the omitted bookmarks
1292 \\[bmkp-bmenu-show-all]\t- Show the un-omitted bookmarks (all)
1293 \\[bmkp-bmenu-omit/unomit-marked]\t- Omit the marked bookmarks; un-omit them if after \
1294 `\\[bmkp-bmenu-show-only-omitted]'
1295 \\[bmkp-unomit-all]\t- Un-omit all omitted bookmarks
1298 Define Commands for `*Bookmark List*'
1299 -------------------------------------
1301 \\[bmkp-bmenu-define-command]\t- Define a command to restore the current sort order & filter
1302 \\[bmkp-bmenu-define-full-snapshot-command]\t- Define a command to restore the current \
1304 \\[bmkp-define-tags-sort-command]\t- Define a command to sort bookmarks by tags
1305 \\[bmkp-bmenu-define-jump-marked-command]\t- Define a command to jump to a bookmark that is \
1309 Options for `*Bookmark List*'
1310 -----------------------------
1312 bookmark-bmenu-file-column - Bookmark width if files are shown
1313 bookmark-bmenu-toggle-filenames - Show filenames initially?
1315 bmkp-bmenu-omitted-bookmarks - List of omitted bookmarks
1316 bmkp-bmenu-state-file - File to save bookmark-list state
1317 (\"home\") nil: do not save/restore
1318 bmkp-sort-comparer - Initial sort
1319 bmkp-sort-orders-for-cycling-alist
1320 \t - Sort orders that `\\[bmkp-bmenu-change-sort-order-repeat]'... cycles
1326 bookmark-automatically-show-annotations - Show annotation when visit?
1327 bookmark-completion-ignore-case - Case-sensitive completion?
1328 bookmark-default-file - File to save bookmarks in
1329 bookmark-menu-length - Max size of bookmark-name menu item
1330 bookmark-save-flag - Whether and when to save
1331 bookmark-use-annotations - Query for annotation when saving?
1332 bookmark-version-control - Numbered backups of bookmark file?
1334 bmkp-autoname-format - Format of autonamed bookmark name
1335 bmkp-crosshairs-flag - Highlight position when visit?
1336 bmkp-menu-popup-max-length - Use menus to choose bookmarks?
1337 bmkp-save-new-location-flag - Save if bookmark relocated?
1338 bmkp-sequence-jump-display-function - How to display a sequence
1339 bmkp-sort-comparer - Predicates for sorting bookmarks
1340 bmkp-su-or-sudo-regexp - Bounce-show each end of region?
1341 bmkp-this-buffer-cycle-sort-comparer - This-buffer cycling sort
1342 bmkp-use-region - Activate saved region when visit?"
1343 (kill-all-local-variables)
1344 (use-local-map bookmark-bmenu-mode-map)
1345 (setq truncate-lines t
1347 major-mode 'bookmark-bmenu-mode
1348 mode-name "Bookmark Menu")
1349 (if (fboundp 'run-mode-hooks)
1350 (run-mode-hooks 'bookmark-bmenu-mode-hook)
1351 (run-hooks 'bookmark-bmenu-mode-hook)))
1354 ;; REPLACES ORIGINAL in `bookmark.el'.
1356 ;; 1. Put `mouse-face' on whole line, with the same help-echo as for the bookmark name.
1357 ;; 2. Fit one-window frame.
1358 ;; 3. Added doc string.
1360 (defun bookmark-bmenu-show-filenames (&optional force)
1362 (if (and (not force) bookmark-bmenu-toggle-filenames)
1363 nil ; Already shown, so do nothing.
1365 (save-window-excursion
1366 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1367 (setq bookmark-bmenu-hidden-bookmarks ())
1368 (let ((inhibit-read-only t))
1369 (while (< (point) (point-max))
1370 (let ((bmk (bookmark-bmenu-bookmark)))
1371 (setq bookmark-bmenu-hidden-bookmarks (cons bmk bookmark-bmenu-hidden-bookmarks))
1372 (let ((start (save-excursion (end-of-line) (point))))
1373 (move-to-column bookmark-bmenu-file-column t))
1374 (delete-region (point) (progn (end-of-line) (point)))
1376 (bookmark-insert-location bmk t) ; Pass the NO-HISTORY arg.
1377 (when (if (fboundp 'display-color-p) ; Emacs 21+.
1378 (and (display-color-p) (display-mouse-p))
1380 (let ((help (get-text-property (+ bmkp-bmenu-marks-width
1381 (line-beginning-position)) 'help-echo)))
1382 (put-text-property (+ bmkp-bmenu-marks-width (line-beginning-position))
1383 (point) 'mouse-face 'highlight)
1384 (when help (put-text-property (+ bmkp-bmenu-marks-width (line-beginning-position))
1385 (point) 'help-echo help))))
1386 (forward-line 1))))))
1387 (when (and (fboundp 'fit-frame-if-one-window)
1388 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
1389 (fit-frame-if-one-window))))
1392 ;; REPLACES ORIGINAL in `bookmark.el'.
1394 ;; 1. Add text properties when hiding filenames.
1395 ;; 2. Do not set or use `bookmark-bmenu-bookmark-column' - use `bmkp-bmenu-marks-width' always.
1396 ;; 3. Fit one-window frame.
1397 ;; 4. Added doc string.
1399 (defun bookmark-bmenu-hide-filenames (&optional force)
1400 "Hide filenames in bookmark-list buffer.
1401 If either optional arg FORCE or `bookmark-bmenu-toggle-filenames' is
1402 non-nil, then do nothing."
1403 (when (and (not force) bookmark-bmenu-toggle-filenames)
1405 (save-window-excursion
1406 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1407 (setq bookmark-bmenu-hidden-bookmarks (nreverse bookmark-bmenu-hidden-bookmarks))
1408 (let ((max-width 0))
1409 (dolist (name bookmark-bmenu-hidden-bookmarks)
1410 (setq max-width (max max-width (length name))))
1411 (setq max-width (+ max-width bmkp-bmenu-marks-width))
1413 (let ((inhibit-read-only t))
1414 (while bookmark-bmenu-hidden-bookmarks
1415 (move-to-column bmkp-bmenu-marks-width t)
1416 (bookmark-kill-line)
1417 (let ((name (car bookmark-bmenu-hidden-bookmarks))
1421 (move-to-column max-width t)
1423 (bmkp-bmenu-propertize-item name start end))
1424 (setq bookmark-bmenu-hidden-bookmarks (cdr bookmark-bmenu-hidden-bookmarks))
1425 (forward-line 1)))))))
1426 (when (and (fboundp 'fit-frame-if-one-window)
1427 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
1428 (fit-frame-if-one-window))))
1431 ;; REPLACES ORIGINAL in `bookmark.el'.
1433 ;; 1. Prefix arg reverses `bmkp-use-region'.
1434 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1437 (defun bookmark-bmenu-1-window (&optional use-region-p) ; Bound to `1' in bookmark list
1438 "Select this line's bookmark, alone, in full frame.
1439 See `bookmark-jump' for info about the prefix arg."
1441 (bmkp-bmenu-barf-if-not-in-menu-list)
1442 (bookmark-bmenu-ensure-position)
1443 (bmkp-jump-1 (bookmark-bmenu-bookmark) 'pop-to-buffer use-region-p)
1444 (bury-buffer (other-buffer))
1445 (delete-other-windows))
1448 ;; REPLACES ORIGINAL in `bookmark.el'.
1450 ;; 1. Prefix arg reverses `bmkp-use-region'.
1451 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1454 (defun bookmark-bmenu-2-window (&optional use-region-p) ; Bound to `2' in bookmark list
1455 "Select this line's bookmark, with previous buffer in second window.
1456 See `bookmark-jump' for info about the prefix arg."
1458 (bmkp-bmenu-barf-if-not-in-menu-list)
1459 (bookmark-bmenu-ensure-position)
1460 (let ((bookmark-name (bookmark-bmenu-bookmark))
1461 (menu (current-buffer))
1463 (delete-other-windows)
1464 (switch-to-buffer (other-buffer))
1465 ;; (let ((bookmark-automatically-show-annotations nil)) ; $$$$$$ Needed?
1466 (bmkp-jump-1 bookmark-name 'pop-to-buffer use-region-p)
1467 (bury-buffer menu)))
1470 ;; REPLACES ORIGINAL in `bookmark.el'.
1472 ;; 1. Prefix arg reverses `bmkp-use-region'.
1473 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1476 (defun bookmark-bmenu-this-window (&optional use-region-p) ; Bound to `RET' in bookmark list
1477 "Select this line's bookmark in this window.
1478 See `bookmark-jump' for info about the prefix arg."
1480 (bmkp-bmenu-barf-if-not-in-menu-list)
1481 (bookmark-bmenu-ensure-position)
1482 (let ((bookmark-name (bookmark-bmenu-bookmark)))
1483 (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)))
1486 ;; REPLACES ORIGINAL in `bookmark.el'.
1488 ;; 1. Use `pop-to-buffer', not `switch-to-buffer-other-window'.
1489 ;; 2. Prefix arg reverses `bmkp-use-region'.
1490 ;; 3. Raise error if not in buffer `*Bookmark List*'.
1493 (defun bookmark-bmenu-other-window (&optional use-region-p) ; Bound to `o' in bookmark list
1494 "Select this line's bookmark in other window. Show `*Bookmark List*' still.
1495 See `bookmark-jump' for info about the prefix arg."
1497 (bmkp-bmenu-barf-if-not-in-menu-list)
1498 (bookmark-bmenu-ensure-position)
1499 (let ((bookmark-name (bookmark-bmenu-bookmark)))
1500 ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed?
1501 (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)))
1504 ;; REPLACES ORIGINAL in `bookmark.el'.
1506 ;; 1. Prefix arg reverses `bmkp-use-region'.
1507 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1510 (defun bookmark-bmenu-switch-other-window (&optional use-region-p) ; Bound to `C-o' in bookmark list
1511 "Make the other window select this line's bookmark.
1512 The current window remains selected.
1513 See `bookmark-jump' for info about the prefix arg."
1515 (bmkp-bmenu-barf-if-not-in-menu-list)
1516 (bookmark-bmenu-ensure-position)
1517 (let ((bookmark-name (bookmark-bmenu-bookmark))
1519 (same-window-buffer-names ())
1520 (same-window-regexps ()))
1521 ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed?
1522 (bmkp-jump-1 bookmark-name 'display-buffer use-region-p)))
1525 ;; REPLACES ORIGINAL in `bookmark.el'.
1527 ;; 1. Prefix arg reverses `bmkp-use-region'.
1528 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1531 (defun bookmark-bmenu-other-window-with-mouse (event &optional use-region-p)
1532 "Select clicked bookmark in other window. Show `*Bookmark List*' still."
1533 (interactive "e\nP")
1534 (with-current-buffer (window-buffer (posn-window (event-end event)))
1535 (save-excursion (goto-char (posn-point (event-end event)))
1536 (bookmark-bmenu-other-window use-region-p))))
1539 ;; REPLACES ORIGINAL in `bookmark.el'.
1541 ;; 1. Added optional arg MSGP.
1542 ;; 2. Call `bookmark-show-annotation' with arg MSGP.
1543 ;; 3. Raise error if not in buffer `*Bookmark List*'.
1546 (defun bookmark-bmenu-show-annotation (msgp)
1547 "Show the annotation for the current bookmark in another window."
1549 (bmkp-bmenu-barf-if-not-in-menu-list)
1550 (bookmark-bmenu-ensure-position)
1551 (let ((bookmark (bookmark-bmenu-bookmark)))
1552 (bookmark-show-annotation bookmark msgp)))
1555 ;; REPLACES ORIGINAL in `bookmark.el'.
1557 ;; 1. Added optional arg MARKEDP: handle bookmarks marked `>', not just those flagged `D'.
1558 ;; 2. Use `bookmark-bmenu-surreptitiously-rebuild-list', instead of using
1559 ;; `bookmark-bmenu-list', updating the modification count, and saving.
1560 ;; 3. Update `bmkp-latest-bookmark-alist' to reflect the deletions.
1561 ;; 4. Pass full bookmark, not name, to `delete' (and do not use `assoc').
1562 ;; 5. Use `bmkp-bmenu-goto-bookmark-named'.
1563 ;; 6. Added status messages.
1564 ;; 7. Raise error if not in buffer `*Bookmark List*'.
1567 (defun bookmark-bmenu-execute-deletions (&optional markedp) ; Bound to `x' in bookmark list
1568 "Delete (visible) bookmarks flagged `D'.
1569 With a prefix argument, delete the bookmarks marked `>' instead, after
1572 (bmkp-bmenu-barf-if-not-in-menu-list)
1573 (if (or (not markedp) (yes-or-no-p "Delete bookmarks marked `>' (not `D') "))
1574 (let* ((mark-type (if markedp "^>" "^D"))
1575 (o-str (and (not (looking-at mark-type)) (bookmark-bmenu-bookmark)))
1578 (message "Deleting bookmarks...")
1579 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1580 (while (re-search-forward mark-type (point-max) t)
1581 (let* ((bmk-name (bookmark-bmenu-bookmark))
1582 (bmk (bookmark-get-bookmark bmk-name)))
1583 (bookmark-delete bmk-name 'batch)
1584 (setq count (1+ count)
1585 bmkp-latest-bookmark-alist (delete bmk bmkp-latest-bookmark-alist))))
1587 (message (if markedp "No marked bookmarks" "No bookmarks flagged for deletion"))
1588 (bookmark-bmenu-surreptitiously-rebuild-list)
1589 (message "Deleted %d bookmarks" count))
1591 (bmkp-bmenu-goto-bookmark-named o-str)
1593 (beginning-of-line)))
1594 (message "OK, nothing deleted")))
1597 ;; REPLACES ORIGINAL in `bookmark.el'.
1599 ;; 1. Do not call `bookmark-bmenu-list' (it was already called).
1600 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1601 ;; 3. Use `bmkp-bmenu-goto-bookmark-named' instead of just searching for name.
1604 (defun bookmark-bmenu-rename () ; Bound to `r' in bookmark list
1605 "Rename bookmark on current line. Prompts for a new name."
1607 (bmkp-bmenu-barf-if-not-in-menu-list)
1608 (bookmark-bmenu-ensure-position)
1609 (let ((newname (bookmark-rename (bookmark-bmenu-bookmark))))
1610 (bmkp-bmenu-goto-bookmark-named newname)))
1612 ;;(@* "Bookmark+ Functions (`bmkp-*')")
1613 ;;; Bookmark+ Functions (`bmkp-*') -----------------------------------
1616 ;;(@* "Menu-List (`*-bmenu-*') Filter Commands")
1617 ;; *** Menu-List (`*-bmenu-*') Filter Commands ***
1620 (defun bmkp-bmenu-show-only-autofiles (&optional arg) ; Bound to `A S' in bookmark list
1621 "Display (only) the autofile bookmarks.
1622 This means bookmarks whose names are the same as their (non-directory)
1623 file names. But with a prefix arg you are prompted for a prefix that
1624 each bookmark name must have."
1626 (bmkp-bmenu-barf-if-not-in-menu-list)
1627 (setq bmkp-bmenu-filter-function (if (not arg)
1628 'bmkp-autofile-alist-only
1629 (let ((prefix (read-string "Prefix for bookmark names: "
1631 `(lambda () (bmkp-autofile-alist-only ,prefix))))
1632 bmkp-bmenu-title "Autofile Bookmarks")
1633 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1634 (setq bmkp-latest-bookmark-alist bookmark-alist)
1635 (bookmark-bmenu-list 'filteredp))
1636 (when (interactive-p)
1637 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autofile bookmarks are shown")))
1640 (defun bmkp-bmenu-show-only-autonamed () ; Bound to `# S' in bookmark list
1641 "Display (only) the autonamed bookmarks."
1643 (bmkp-bmenu-barf-if-not-in-menu-list)
1644 (setq bmkp-bmenu-filter-function 'bmkp-autonamed-alist-only
1645 bmkp-bmenu-title "Autonamed Bookmarks")
1646 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1647 (setq bmkp-latest-bookmark-alist bookmark-alist)
1648 (bookmark-bmenu-list 'filteredp))
1649 (when (interactive-p)
1650 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autonamed bookmarks are shown")))
1653 (defun bmkp-bmenu-show-only-bookmark-files () ; Bound to `X S' in bookmark list
1654 "Display (only) the bookmark-file bookmarks."
1656 (bmkp-bmenu-barf-if-not-in-menu-list)
1657 (setq bmkp-bmenu-filter-function 'bmkp-bookmark-file-alist-only
1658 bmkp-bmenu-title "Bookmark-File Bookmarks")
1659 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1660 (setq bmkp-latest-bookmark-alist bookmark-alist)
1661 (bookmark-bmenu-list 'filteredp))
1662 (when (interactive-p)
1663 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmark-file bookmarks are shown")))
1666 (defun bmkp-bmenu-show-only-desktops () ; Bound to `K S' in bookmark list
1667 "Display (only) the desktop bookmarks."
1669 (bmkp-bmenu-barf-if-not-in-menu-list)
1670 (setq bmkp-bmenu-filter-function 'bmkp-desktop-alist-only
1671 bmkp-bmenu-title "Desktop Bookmarks")
1672 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1673 (setq bmkp-latest-bookmark-alist bookmark-alist)
1674 (bookmark-bmenu-list 'filteredp))
1675 (when (interactive-p)
1676 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only desktop bookmarks are shown")))
1679 (defun bmkp-bmenu-show-only-dired () ; Bound to `M-d M-s' in bookmark list
1680 "Display (only) the Dired bookmarks."
1682 (bmkp-bmenu-barf-if-not-in-menu-list)
1683 (setq bmkp-bmenu-filter-function 'bmkp-dired-alist-only
1684 bmkp-bmenu-title "Dired Bookmarks")
1685 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1686 (setq bmkp-latest-bookmark-alist bookmark-alist)
1687 (bookmark-bmenu-list 'filteredp))
1688 (when (interactive-p)
1689 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Dired bookmarks are shown")))
1692 (defun bmkp-bmenu-show-only-files (arg) ; Bound to `F S' in bookmark list
1693 "Display a list of file and directory bookmarks (only).
1694 With a prefix argument, do not include remote files or directories."
1696 (bmkp-bmenu-barf-if-not-in-menu-list)
1697 (setq bmkp-bmenu-filter-function (if arg 'bmkp-local-file-alist-only 'bmkp-file-alist-only)
1698 bmkp-bmenu-title (if arg
1699 "Local File and Directory Bookmarks"
1700 "File and Directory Bookmarks"))
1701 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1702 (setq bmkp-latest-bookmark-alist bookmark-alist)
1703 (bookmark-bmenu-list 'filteredp))
1704 (when (interactive-p)
1705 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only file bookmarks are shown")))
1708 (defun bmkp-bmenu-show-only-non-files () ; Bound to `B S' in bookmark list
1709 "Display (only) the non-file bookmarks."
1711 (bmkp-bmenu-barf-if-not-in-menu-list)
1712 (setq bmkp-bmenu-filter-function 'bmkp-non-file-alist-only
1713 bmkp-bmenu-title "Non-File Bookmarks")
1714 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1715 (setq bmkp-latest-bookmark-alist bookmark-alist)
1716 (bookmark-bmenu-list 'filteredp))
1717 (when (interactive-p)
1718 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only non-file bookmarks are shown")))
1721 (defun bmkp-bmenu-show-only-gnus () ; Bound to `G S' in bookmark list
1722 "Display (only) the Gnus bookmarks."
1724 (bmkp-bmenu-barf-if-not-in-menu-list)
1725 (setq bmkp-bmenu-filter-function 'bmkp-gnus-alist-only
1726 bmkp-bmenu-title "Gnus Bookmarks")
1727 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1728 (setq bmkp-latest-bookmark-alist bookmark-alist)
1729 (bookmark-bmenu-list 'filteredp))
1730 (when (interactive-p)
1731 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Gnus bookmarks are shown")))
1734 (defun bmkp-bmenu-show-only-info-nodes () ; Bound to `I S' in bookmark list
1735 "Display (only) the Info bookmarks."
1737 (bmkp-bmenu-barf-if-not-in-menu-list)
1738 (setq bmkp-bmenu-filter-function 'bmkp-info-alist-only
1739 bmkp-bmenu-title "Info Bookmarks")
1740 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1741 (setq bmkp-latest-bookmark-alist bookmark-alist)
1742 (bookmark-bmenu-list 'filteredp))
1743 (when (interactive-p)
1744 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Info bookmarks are shown")))
1747 (defun bmkp-bmenu-show-only-man-pages () ; Bound to `M S' in bookmark list
1748 "Display (only) the `man' page bookmarks."
1750 (bmkp-bmenu-barf-if-not-in-menu-list)
1751 (setq bmkp-bmenu-filter-function 'bmkp-man-alist-only
1752 bmkp-bmenu-title "`man' Page Bookmarks")
1753 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1754 (setq bmkp-latest-bookmark-alist bookmark-alist)
1755 (bookmark-bmenu-list 'filteredp))
1756 (when (interactive-p)
1757 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only `man' page bookmarks are shown")))
1760 (defun bmkp-bmenu-show-only-regions () ; Bound to `R S' in bookmark list
1761 "Display (only) the bookmarks that record a region."
1763 (bmkp-bmenu-barf-if-not-in-menu-list)
1764 (setq bmkp-bmenu-filter-function 'bmkp-region-alist-only
1765 bmkp-bmenu-title "Region Bookmarks")
1766 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1767 (setq bmkp-latest-bookmark-alist bookmark-alist)
1768 (bookmark-bmenu-list 'filteredp))
1769 (when (interactive-p)
1770 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmarks with regions are shown")))
1773 (defun bmkp-bmenu-show-only-variable-lists () ; Bound to `V S' in bookmark list
1774 "Display (only) the variable-list bookmarks."
1776 (bmkp-bmenu-barf-if-not-in-menu-list)
1777 (setq bmkp-bmenu-filter-function 'bmkp-variable-list-alist-only
1778 bmkp-bmenu-title "Variable-list Bookmarks")
1779 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1780 (setq bmkp-latest-bookmark-alist bookmark-alist)
1781 (bookmark-bmenu-list 'filteredp))
1782 (when (interactive-p)
1783 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only variable-list bookmarks are shown")))
1786 (defun bmkp-bmenu-show-only-specific-buffer (&optional buffer) ; Bound to `= b S' in bookmark list
1787 "Display (only) the bookmarks for BUFFER.
1788 Interactively, read the BUFFER name.
1789 If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it."
1790 (interactive (list (bmkp-completing-read-buffer-name)))
1791 (bmkp-bmenu-barf-if-not-in-menu-list)
1792 (when buffer (setq bmkp-last-specific-buffer buffer))
1793 (setq bmkp-bmenu-filter-function 'bmkp-last-specific-buffer-alist-only
1794 bmkp-bmenu-title (format "Buffer `%s' Bookmarks" bmkp-last-specific-buffer))
1795 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1796 (setq bmkp-latest-bookmark-alist bookmark-alist)
1797 (bookmark-bmenu-list 'filteredp))
1798 (when (interactive-p)
1799 (bmkp-msg-about-sort-order (bmkp-current-sort-order)
1800 (format "Only bookmarks for buffer `%s' are shown"
1801 bmkp-last-specific-buffer))))
1804 (defun bmkp-bmenu-show-only-specific-file (&optional file) ; Bound to `= f S' in bookmark list
1805 "Display (only) the bookmarks for FILE, an absolute file name.
1806 Interactively, read the FILE name.
1807 If FILE is non-nil, set `bmkp-last-specific-file' to it."
1808 (interactive (list (bmkp-completing-read-file-name)))
1809 (bmkp-bmenu-barf-if-not-in-menu-list)
1810 (when file (setq bmkp-last-specific-file file))
1811 (setq bmkp-bmenu-filter-function 'bmkp-last-specific-file-alist-only
1812 bmkp-bmenu-title (format "File `%s' Bookmarks" bmkp-last-specific-file))
1813 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1814 (setq bmkp-latest-bookmark-alist bookmark-alist)
1815 (bookmark-bmenu-list 'filteredp))
1816 (when (interactive-p)
1817 (bmkp-msg-about-sort-order (bmkp-current-sort-order)
1818 (format "Only bookmarks for file `%s' are shown"
1819 bmkp-last-specific-file))))
1822 (defun bmkp-bmenu-show-only-urls () ; Bound to `M-u M-s' in bookmark list
1823 "Display (only) the URL bookmarks."
1825 (bmkp-bmenu-barf-if-not-in-menu-list)
1826 (setq bmkp-bmenu-filter-function 'bmkp-url-alist-only
1827 bmkp-bmenu-title "URL Bookmarks")
1828 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1829 (setq bmkp-latest-bookmark-alist bookmark-alist)
1830 (bookmark-bmenu-list 'filteredp))
1831 (when (interactive-p)
1832 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only URL bookmarks are shown")))
1835 (defun bmkp-bmenu-show-only-w3m-urls () ; Bound to `W S' in bookmark list
1836 "Display (only) the W3M URL bookmarks."
1838 (bmkp-bmenu-barf-if-not-in-menu-list)
1839 (setq bmkp-bmenu-filter-function 'bmkp-w3m-alist-only
1840 bmkp-bmenu-title "W3M Bookmarks")
1841 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1842 (setq bmkp-latest-bookmark-alist bookmark-alist)
1843 (bookmark-bmenu-list 'filteredp))
1844 (when (interactive-p)
1845 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only W3M bookmarks are shown")))
1848 (defun bmkp-bmenu-show-all () ; Bound to `.' in bookmark list
1849 "Show all bookmarks known to the bookmark list (aka \"menu list\").
1850 Omitted bookmarks are not shown, however.
1851 Also, this does not revert the bookmark list, to bring it up to date.
1852 To revert the list, use `\\<bookmark-bmenu-mode-map>\\[bmkp-bmenu-refresh-menu-list]'."
1854 (bmkp-bmenu-barf-if-not-in-menu-list)
1855 (setq bmkp-bmenu-filter-function nil
1856 bmkp-bmenu-title "All Bookmarks"
1857 bmkp-latest-bookmark-alist bookmark-alist)
1858 (bookmark-bmenu-list)
1859 (when (interactive-p)
1860 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "All bookmarks are shown")))
1863 (defun bmkp-bmenu-refresh-menu-list () ; Bound to `g' in bookmark list
1864 "Refresh (revert) the bookmark list (\"menu list\").
1865 This brings the displayed list up to date. It does not change the
1866 current filtering or sorting of the displayed list.
1868 If you want setting a bookmark to refresh the list automatically, you
1869 can use command `bmkp-toggle-bookmark-set-refreshes'."
1871 (bmkp-bmenu-barf-if-not-in-menu-list)
1872 (bmkp-refresh-menu-list (bookmark-bmenu-bookmark)))
1875 (defun bmkp-bmenu-filter-bookmark-name-incrementally () ; Bound to `P B' in bookmark list
1876 "Incrementally filter bookmarks by bookmark name using a regexp."
1878 (bmkp-bmenu-barf-if-not-in-menu-list)
1880 (progn (setq bmkp-bmenu-filter-timer
1881 (run-with-timer 0 bmkp-incremental-filter-delay
1882 #'bmkp-bmenu-filter-alist-by-bookmark-name-regexp))
1883 (bmkp-bmenu-read-filter-input))
1884 (bmkp-bmenu-cancel-incremental-filtering)))
1886 (defun bmkp-bmenu-filter-alist-by-bookmark-name-regexp ()
1887 "Filter bookmarks by bookmark name, then refresh the bookmark list."
1888 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-bookmark-name-alist-only
1889 bmkp-bmenu-title (format "Bookmarks with Names Matching Regexp `%s'"
1890 bmkp-bmenu-filter-pattern))
1891 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1892 (setq bmkp-latest-bookmark-alist bookmark-alist)
1893 (bookmark-bmenu-list 'filteredp)))
1896 (defun bmkp-bmenu-filter-file-name-incrementally () ; Bound to `P F' in bookmark list
1897 "Incrementally filter bookmarks by file name using a regexp."
1899 (bmkp-bmenu-barf-if-not-in-menu-list)
1901 (progn (setq bmkp-bmenu-filter-timer
1902 (run-with-timer 0 bmkp-incremental-filter-delay
1903 #'bmkp-bmenu-filter-alist-by-file-name-regexp))
1904 (bmkp-bmenu-read-filter-input))
1905 (bmkp-bmenu-cancel-incremental-filtering)))
1907 (defun bmkp-bmenu-filter-alist-by-file-name-regexp ()
1908 "Filter bookmarks by file name, then refresh the bookmark list."
1909 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-file-name-alist-only
1910 bmkp-bmenu-title (format "Bookmarks with File Names Matching Regexp `%s'"
1911 bmkp-bmenu-filter-pattern))
1912 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1913 (setq bmkp-latest-bookmark-alist bookmark-alist)
1914 (bookmark-bmenu-list 'filteredp)))
1917 (defun bmkp-bmenu-filter-annotation-incrementally () ; Bound to `P A' in bookmark list
1918 "Incrementally filter bookmarks by their annotations using a regexp."
1920 (bmkp-bmenu-barf-if-not-in-menu-list)
1922 (progn (setq bmkp-bmenu-filter-timer
1923 (run-with-timer 0 bmkp-incremental-filter-delay
1924 #'bmkp-bmenu-filter-alist-by-annotation-regexp))
1925 (bmkp-bmenu-read-filter-input))
1926 (bmkp-bmenu-cancel-incremental-filtering)))
1928 (defun bmkp-bmenu-filter-alist-by-annotation-regexp ()
1929 "Filter bookmarks by annoation, then refresh the bookmark list."
1930 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-annotation-alist-only
1931 bmkp-bmenu-title (format "Bookmarks with Annotations Matching Regexp `%s'"
1932 bmkp-bmenu-filter-pattern))
1933 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1934 (setq bmkp-latest-bookmark-alist bookmark-alist)
1935 (bookmark-bmenu-list 'filteredp)))
1938 (defun bmkp-bmenu-filter-tags-incrementally () ; Bound to `P T' in bookmark list
1939 "Incrementally filter bookmarks by tags using a regexp."
1941 (bmkp-bmenu-barf-if-not-in-menu-list)
1943 (progn (setq bmkp-bmenu-filter-timer
1944 (run-with-timer 0 bmkp-incremental-filter-delay
1945 #'bmkp-bmenu-filter-alist-by-tags-regexp))
1946 (bmkp-bmenu-read-filter-input))
1947 (bmkp-bmenu-cancel-incremental-filtering)))
1949 (defun bmkp-bmenu-filter-alist-by-tags-regexp ()
1950 "Filter bookmarks by tags, then refresh the bookmark list."
1951 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-tags-alist-only
1952 bmkp-bmenu-title (format "Bookmarks with Tags Matching Regexp `%s'"
1953 bmkp-bmenu-filter-pattern))
1954 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1955 (setq bmkp-latest-bookmark-alist bookmark-alist)
1956 (bookmark-bmenu-list 'filteredp)))
1958 (defun bmkp-bmenu-read-filter-input ()
1959 "Read input and add it to `bmkp-bmenu-filter-pattern'."
1960 (setq bmkp-bmenu-filter-pattern "")
1963 (catch 'bmkp-bmenu-read-filter-input-1
1965 (catch 'bmkp-bmenu-read-filter-input-2
1967 (setq char (read-char (concat bmkp-bmenu-filter-prompt bmkp-bmenu-filter-pattern)))
1968 (error (throw 'bmkp-bmenu-read-filter-input-1 nil)))
1970 ((?\e ?\r) (throw 'bmkp-bmenu-read-filter-input-1 nil)) ; Break and exit.
1972 (pop tmp-list) ; Delete last char of `bmkp-bmenu-filter-pattern'.
1973 (setq bmkp-bmenu-filter-pattern (mapconcat 'identity (reverse tmp-list) ""))
1974 (throw 'bmkp-bmenu-read-filter-input-2 nil))
1976 (push (text-char-description char) tmp-list)
1977 (setq bmkp-bmenu-filter-pattern (mapconcat 'identity (reverse tmp-list) ""))
1978 (throw 'bmkp-bmenu-read-filter-input-2 nil))))))))
1980 (defun bmkp-bmenu-cancel-incremental-filtering ()
1981 "Cancel timer used for incrementally filtering bookmarks."
1982 (cancel-timer bmkp-bmenu-filter-timer)
1983 (setq bmkp-bmenu-filter-timer nil))
1986 (defun bmkp-bmenu-toggle-show-only-unmarked () ; Bound to `<' in bookmark list
1987 "Hide all marked bookmarks. Repeat to toggle, showing all."
1989 (bmkp-bmenu-barf-if-not-in-menu-list)
1990 (if (or (bmkp-some-marked-p bmkp-latest-bookmark-alist)
1991 (bmkp-some-marked-p bmkp-bmenu-before-hide-marked-alist))
1992 (let ((bookmark-alist bmkp-latest-bookmark-alist)
1994 (if bmkp-bmenu-before-hide-marked-alist
1995 (setq bookmark-alist bmkp-bmenu-before-hide-marked-alist
1996 bmkp-bmenu-before-hide-marked-alist ()
1997 bmkp-latest-bookmark-alist bookmark-alist
1999 (setq bmkp-bmenu-before-hide-marked-alist bmkp-latest-bookmark-alist
2000 bookmark-alist (bmkp-unmarked-bookmarks-only)
2001 bmkp-latest-bookmark-alist bookmark-alist
2003 (bookmark-bmenu-surreptitiously-rebuild-list)
2004 (cond ((eq status 'hidden)
2005 (bookmark-bmenu-ensure-position)
2006 (message "Marked bookmarks are now hidden"))
2008 (goto-char (point-min))
2009 (when (re-search-forward "^>" (point-max) t) (forward-line 0))
2010 (message "Marked bookmarks no longer hidden"))))
2011 (message "No marked bookmarks to hide"))
2012 (when (and (fboundp 'fit-frame-if-one-window)
2013 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2014 (fit-frame-if-one-window)))
2017 (defun bmkp-bmenu-toggle-show-only-marked () ; Bound to `>' in bookmark list
2018 "Hide all unmarked bookmarks. Repeat to toggle, showing all."
2020 (bmkp-bmenu-barf-if-not-in-menu-list)
2021 (if (or (bmkp-some-unmarked-p bmkp-latest-bookmark-alist)
2022 (bmkp-some-unmarked-p bmkp-bmenu-before-hide-unmarked-alist))
2023 (let ((bookmark-alist bmkp-latest-bookmark-alist)
2025 (if bmkp-bmenu-before-hide-unmarked-alist
2026 (setq bookmark-alist bmkp-bmenu-before-hide-unmarked-alist
2027 bmkp-bmenu-before-hide-unmarked-alist ()
2028 bmkp-latest-bookmark-alist bookmark-alist
2030 (setq bmkp-bmenu-before-hide-unmarked-alist bmkp-latest-bookmark-alist
2031 bookmark-alist (bmkp-marked-bookmarks-only)
2032 bmkp-latest-bookmark-alist bookmark-alist
2034 (bookmark-bmenu-surreptitiously-rebuild-list)
2035 (cond ((eq status 'hidden)
2036 (bookmark-bmenu-ensure-position)
2037 (message "Unmarked bookmarks are now hidden"))
2039 (goto-char (point-min))
2040 (when (re-search-forward "^>" (point-max) t) (forward-line 0))
2041 (message "Unmarked bookmarks no longer hidden"))))
2042 (message "No unmarked bookmarks to hide"))
2043 (when (and (fboundp 'fit-frame-if-one-window)
2044 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2045 (fit-frame-if-one-window)))
2048 ;;(@* "Menu-List (`*-bmenu-*') Commands Involving Marks")
2049 ;; *** Menu-List (`*-bmenu-*') Commands Involving Marks ***
2052 (defun bmkp-bmenu-mark-all () ; Bound to `M-m' in bookmark list
2053 "Mark all bookmarks, using mark `>'."
2055 (bmkp-bmenu-barf-if-not-in-menu-list)
2058 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2059 (while (not (eobp)) (bookmark-bmenu-mark) (setq count (1+ count)))
2060 (message "Marked: %d" count))))
2062 ;; This is similar to `dired-unmark-all-files'.
2064 (defun bmkp-bmenu-unmark-all (mark &optional arg) ; Bound to `M-DEL', `U' in bookmark list
2065 "Remove a mark from each bookmark.
2066 Hit the mark character (`>' or `D') to remove those marks,
2067 or hit `RET' to remove all marks (both `>' and `D').
2068 With a prefix arg, you are queried to unmark each marked bookmark.
2069 Use `\\[help-command]' during querying for help."
2070 (interactive "cRemove marks (RET means all): \nP")
2071 (bmkp-bmenu-barf-if-not-in-menu-list)
2072 (require 'dired-aux)
2075 (inhibit-read-only t)
2076 (case-fold-search nil)
2078 (string (format "\n%c" mark))
2079 (help-form "Type SPC or `y' to unmark one bookmark, DEL or `n' to skip to next,
2080 `!' to unmark all remaining bookmarks with no more questions."))
2081 (goto-char (point-min))
2082 (forward-line (if (eq mark ?\r)
2083 bmkp-bmenu-header-lines
2084 (1- bmkp-bmenu-header-lines))) ; Because STRING starts with a newline.
2085 (while (and (not (eobp))
2087 (re-search-forward dired-re-mark nil t)
2088 (let ((case-fold-search t)) ; Treat `d' the same as `D'.
2089 (search-forward string nil t))))
2090 (when (or (not arg) (let ((bmk (bookmark-bmenu-bookmark)))
2091 (and bmk (dired-query 'query "Unmark bookmark `%s'? " bmk))))
2092 (bookmark-bmenu-unmark) (forward-line -1)
2093 (setq count (1+ count))))
2094 (if (= 1 count) (message "1 mark removed") (message "%d marks removed" count)))))
2097 (defun bmkp-bmenu-regexp-mark (regexp) ; Bound to `% m' in bookmark list
2098 "Mark bookmarks that match REGEXP.
2099 The entire bookmark line is tested: bookmark name and possibly file name."
2100 (interactive "sRegexp: ")
2101 (bmkp-bmenu-barf-if-not-in-menu-list)
2103 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2105 (while (and (not (eobp)) (re-search-forward regexp (point-max) t))
2106 (bookmark-bmenu-mark)
2107 (setq count (1+ count)))
2108 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2111 (defun bmkp-bmenu-mark-autofile-bookmarks (&optional arg) ; Bound to `A M' in bookmark list
2112 "Mark autofile bookmarks: those whose names are the same as their files.
2113 With a prefix arg you are prompted for a prefix that each bookmark
2117 (bmkp-bmenu-mark-bookmarks-satisfying #'bmkp-autofile-bookmark-p)
2118 (let ((prefix (read-string "Prefix for bookmark names: " nil nil "")))
2119 (bmkp-bmenu-mark-bookmarks-satisfying #'(lambda (bb) (bmkp-autofile-bookmark-p bb prefix))))))
2122 (defun bmkp-bmenu-mark-bookmark-file-bookmarks () ; Bound to `X M' in bookmark list
2123 "Mark bookmark-file bookmarks."
2125 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-bookmark-file-bookmark-p))
2128 (defun bmkp-bmenu-mark-desktop-bookmarks () ; Bound to `K M' in bookmark list
2129 "Mark desktop bookmarks."
2131 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-desktop-bookmark-p))
2134 (defun bmkp-bmenu-mark-dired-bookmarks () ; Bound to `M-d M-m' in bookmark list
2135 "Mark Dired bookmarks."
2137 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-dired-bookmark-p))
2140 (defun bmkp-bmenu-mark-file-bookmarks (arg) ; Bound to `F M' in bookmark list
2141 "Mark file bookmarks.
2142 With a prefix argument, do not mark remote files or directories."
2144 (bmkp-bmenu-mark-bookmarks-satisfying
2145 (if arg 'bmkp-local-file-bookmark-p 'bmkp-file-bookmark-p)))
2148 (defun bmkp-bmenu-mark-gnus-bookmarks () ; Bound to `G M' in bookmark list
2149 "Mark Gnus bookmarks."
2151 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-gnus-bookmark-p))
2154 (defun bmkp-bmenu-mark-info-bookmarks () ; Bound to `I M' in bookmark list
2155 "Mark Info bookmarks."
2157 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-info-bookmark-p))
2160 (defun bmkp-bmenu-mark-man-bookmarks () ; Bound to `M M' in bookmark list
2161 "Mark `man' page bookmarks."
2163 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-man-bookmark-p))
2166 (defun bmkp-bmenu-mark-non-file-bookmarks () ; Bound to `B M' in bookmark list
2167 "Mark non-file bookmarks."
2169 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-non-file-bookmark-p))
2172 (defun bmkp-bmenu-mark-region-bookmarks () ; Bound to `R M' in bookmark list
2173 "Mark bookmarks that record a region."
2175 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-region-bookmark-p))
2177 (when (featurep 'bookmark+-lit)
2178 (defun bmkp-bmenu-mark-lighted-bookmarks () ; Bound to `H M' in bookmark list
2179 "Mark the highlighted bookmarks."
2181 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-lighted-p)))
2184 (defun bmkp-bmenu-mark-specific-buffer-bookmarks (&optional buffer) ; `= b M' in bookmark list
2185 "Mark bookmarks for BUFFER.
2186 Interactively, read the name of the buffer.
2187 If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it."
2188 (interactive (list (bmkp-completing-read-buffer-name)))
2189 (when buffer (setq bmkp-last-specific-buffer buffer))
2190 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-buffer-p))
2193 (defun bmkp-bmenu-mark-specific-file-bookmarks (&optional file) ; Bound to `= f M' in bookmark list
2194 "Mark bookmarks for FILE, an absolute file name.
2195 Interactively, read the file name.
2196 If FILE is non-nil, set `bmkp-last-specific-file' to it."
2197 (interactive (list (bmkp-completing-read-file-name)))
2198 (when file (setq bmkp-last-specific-file file))
2199 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-file-p))
2202 (defun bmkp-bmenu-mark-url-bookmarks () ; Bound to `M-u M-m' in bookmark list
2203 "Mark URL bookmarks."
2205 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-url-bookmark-p))
2208 (defun bmkp-bmenu-mark-w3m-bookmarks () ; Bound to `W M' in bookmark list
2209 "Mark W3M (URL) bookmarks."
2211 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-w3m-bookmark-p))
2214 (defun bmkp-bmenu-mark-bookmarks-satisfying (pred) ; Not bound
2215 "Mark bookmarks that satisfy predicate PRED.
2216 If you use this interactively, you are responsible for entering a
2217 symbol that names a unnary predicate. The function you provide is not
2218 checked - it is simply applied to each bookmark to test it."
2219 (interactive "aPredicate: ")
2220 (bmkp-bmenu-barf-if-not-in-menu-list)
2222 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2226 (setq bmk (bookmark-bmenu-bookmark))
2227 (if (not (funcall pred bmk))
2229 (bookmark-bmenu-mark)
2230 (setq count (1+ count))))
2231 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2234 (defun bmkp-bmenu-toggle-marks () ; Bound to `t' in bookmark list
2235 "Toggle marks: Unmark all marked bookmarks; mark all unmarked bookmarks.
2236 This affects only the `>' mark, not the `D' flag."
2238 (bmkp-bmenu-barf-if-not-in-menu-list)
2239 (let ((marked-count 0)
2242 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2243 (if (not (bmkp-some-marked-p bmkp-latest-bookmark-alist))
2244 (bmkp-bmenu-mark-all)
2246 (cond ((bmkp-bookmark-name-member (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)
2247 (bookmark-bmenu-unmark)
2248 (setq unmarked-count (1+ unmarked-count)))
2250 (bookmark-bmenu-mark)
2251 (setq marked-count (1+ marked-count)))))
2252 (message "Marked: %d, unmarked: %d" marked-count unmarked-count)))))
2255 (defun bmkp-bmenu-dired-marked (dirbufname) ; Bound to `M-d >' in bookmark list
2256 "Dired in another window for the marked file and directory bookmarks.
2258 Absolute file names are used for the entries in the Dired buffer.
2259 The only entries are for the marked files and directories. These can
2260 be located anywhere. (In Emacs versions prior to release 23.2, remote
2261 bookmarks are ignored, because of Emacs bug #5478.)
2263 You are prompted for the Dired buffer name. The `default-directory'
2264 of the buffer is the same as that of buffer `*Bookmark List*'."
2265 (interactive (list (read-string "Dired buffer name: ")))
2266 (bmkp-bmenu-barf-if-not-in-menu-list)
2269 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
2270 (when (or (bmkp-local-file-bookmark-p bmk)
2271 (> emacs-major-version 23)
2272 (and (= emacs-major-version 23) (> emacs-minor-version 1)))
2273 (setq file (bookmark-get-filename bmk))
2274 (unless (file-name-absolute-p file) (setq file (expand-file-name file))) ; Should not happen.
2276 (dired-other-window (cons dirbufname files))))
2279 (defun bmkp-bmenu-delete-marked () ; Bound to `D' in bookmark list
2280 "Delete all (visible) bookmarks that are marked `>', after confirmation."
2282 (bmkp-bmenu-barf-if-not-in-menu-list)
2283 (bookmark-bmenu-execute-deletions 'marked))
2286 (defun bmkp-bmenu-make-sequence-from-marked (bookmark-name &optional dont-omit-p) ; Not bound
2287 "Create or update a sequence bookmark from the visible marked bookmarks.
2288 The bookmarks that are currently marked are recorded as a sequence, in
2289 their current order in buffer `*Bookmark List*'.
2290 When you \"jump\" to the sequence bookmark, the bookmarks in the
2291 sequence are processed in order.
2293 By default, omit the marked bookmarks, after creating the sequence.
2294 With a prefix arg, do not omit them.
2296 If a bookmark with the specified name already exists, it is
2297 overwritten. If a sequence bookmark with the name already exists,
2298 then you are prompted whether to add the marked bookmarks to the
2299 beginning of the existing sequence (or simply replace it).
2301 Note that another existing sequence bookmark can be marked, and thus
2302 included in the sequence bookmark created or updated. That is, you
2303 can include other sequences within a sequence bookmark.
2305 Returns the bookmark (internal record) created or updated."
2306 (interactive "sName of sequence bookmark: \nP")
2307 (bmkp-bmenu-barf-if-not-in-menu-list)
2308 (let ((marked-bmks ())
2310 (message "Making sequence from marked bookmarks...")
2312 (with-current-buffer "*Bookmark List*"
2313 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2314 (while (re-search-forward "^>" (point-max) t)
2315 (push (bookmark-bmenu-bookmark) marked-bmks)
2316 (setq count (1+ count)))))
2317 (when (zerop count) (error "No marked bookmarks"))
2318 (let ((new-seq (nreverse marked-bmks))
2319 (bmk (bookmark-get-bookmark bookmark-name 'noerror)))
2320 (when (and bmk (bmkp-sequence-bookmark-p bmk))
2321 (if (y-or-n-p (format "ADD marked to existing sequence `%s' (otherwise, REPLACES it)? "
2323 (setq new-seq (nconc new-seq (bookmark-prop-get bmk 'sequence)))
2324 "OK, existing sequence will be replaced"))
2325 (bookmark-store bookmark-name `((filename . ,bmkp-non-file-filename)
2327 (sequence ,@new-seq)
2328 (handler . bmkp-jump-sequence))
2330 (let ((new (bookmark-get-bookmark bookmark-name 'noerror)))
2331 (unless (memq new bmkp-latest-bookmark-alist)
2332 (setq bmkp-latest-bookmark-alist (cons new bmkp-latest-bookmark-alist)))
2334 (bmkp-bmenu-omit-marked)
2335 (message "Marked bookmarks now OMITTED - use `bmkp-bmenu-show-only-omitted' to show"))
2336 (bookmark-bmenu-surreptitiously-rebuild-list)
2337 (bmkp-bmenu-goto-bookmark-named bookmark-name)
2341 ;;(@* "Omitted Bookmarks")
2342 ;; *** Omitted Bookmarks ***
2345 (defun bmkp-bmenu-omit () ; Not bound
2346 "Omit this bookmark."
2348 (bmkp-bmenu-barf-if-not-in-menu-list)
2349 (bookmark-bmenu-ensure-position)
2350 (setq bmkp-bmenu-omitted-bookmarks (cons (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks))
2351 (bookmark-bmenu-surreptitiously-rebuild-list)
2352 (message "Omitted 1 bookmark"))
2355 (defun bmkp-bmenu-omit/unomit-marked () ; Bound to `O >' in bookmark list
2356 "Omit all marked bookmarks or, if showing only omitted ones, unomit."
2358 (bmkp-bmenu-barf-if-not-in-menu-list)
2359 (if (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
2360 (bmkp-bmenu-unomit-marked)
2361 (bmkp-bmenu-omit-marked)))
2364 (defun bmkp-bmenu-omit-marked () ; Bound to `O >' in bookmark list
2365 "Omit all marked bookmarks.
2366 They will henceforth be invisible to the bookmark list.
2367 You can, however, use \\<bookmark-bmenu-mode-map>`\\[bmkp-bmenu-show-only-omitted]' to see them.
2368 You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]' to make those marked
2369 available again for the bookmark list."
2371 (bmkp-bmenu-barf-if-not-in-menu-list)
2372 (let ((o-str (and (not (looking-at "^>")) (bookmark-bmenu-bookmark)))
2375 (message "Omitting marked bookmarks...")
2376 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2377 (while (re-search-forward "^>" (point-max) t)
2378 (setq bmkp-bmenu-omitted-bookmarks (cons (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks)
2381 (message "No marked bookmarks")
2382 (bookmark-bmenu-surreptitiously-rebuild-list)
2383 (message "Omitted %d bookmarks" count))
2385 (bmkp-bmenu-goto-bookmark-named o-str)
2387 (beginning-of-line)))
2388 (when (and (fboundp 'fit-frame-if-one-window)
2389 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2390 (fit-frame-if-one-window)))
2393 (defun bmkp-bmenu-unomit-marked () ; `O >' in bookmark list when showing omitted bookmarks
2394 "Remove all marked bookmarks from the list of omitted bookmarks.
2395 They will henceforth be available for display in the bookmark list.
2396 \(In order to see and then mark omitted bookmarks you must use \\<bookmark-bmenu-mode-map>\
2397 `\\[bmkp-bmenu-show-only-omitted]'.)"
2399 (bmkp-bmenu-barf-if-not-in-menu-list)
2400 (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks to UN-omit"))
2401 (unless (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
2402 (error "You must use command `bmkp-bmenu-show-only-omitted' first"))
2404 (message "UN-omitting marked bookmarks...")
2405 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2406 (while (re-search-forward "^>" (point-max) t)
2407 (let ((bmk-name (bookmark-bmenu-bookmark)))
2408 (when (bmkp-bookmark-name-member bmk-name bmkp-bmenu-omitted-bookmarks)
2409 (setq bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list
2410 bmk-name bmkp-bmenu-omitted-bookmarks)
2411 count (1+ count)))))
2413 (message "No marked bookmarks")
2414 (setq bmkp-bmenu-filter-function nil
2415 bmkp-bmenu-title "All Bookmarks"
2416 bmkp-latest-bookmark-alist bookmark-alist)
2417 (bookmark-bmenu-surreptitiously-rebuild-list)
2418 (message "UN-omitted %d bookmarks" count)))
2419 (when (and (fboundp 'fit-frame-if-one-window)
2420 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2421 (fit-frame-if-one-window)))
2424 (defun bmkp-bmenu-show-only-omitted () ; Bound to `O S' in bookmark list to show only omitted
2425 "Show only the omitted bookmarks.
2426 You can then mark some of them and use `bmkp-bmenu-unomit-marked' to
2427 make those that are marked available again for the bookmark list."
2429 (bmkp-bmenu-barf-if-not-in-menu-list)
2430 (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks"))
2431 (setq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only
2432 bmkp-bmenu-title "Omitted Bookmarks")
2433 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2434 (setq bmkp-latest-bookmark-alist bookmark-alist)
2435 (bookmark-bmenu-list 'filteredp))
2436 (when (interactive-p)
2437 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only omitted bookmarks are shown now")))
2440 ;;(@* "Search-and-Replace Locations of Marked Bookmarks")
2441 ;; *** Search-and-Replace Locations of Marked Bookmarks ***
2443 (when (> emacs-major-version 22)
2444 (defun bmkp-bmenu-isearch-marked-bookmarks () ; Bound to `M-s a C-s' in bookmark list
2445 "Isearch the marked bookmark locations, in their current order."
2447 (bmkp-bmenu-barf-if-not-in-menu-list)
2448 (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only))))
2449 (bmkp-use-region nil)) ; Suppress region handling.
2450 (bmkp-isearch-bookmarks bookmarks))) ; Defined in `bookmark+-1.el'.
2452 (defun bmkp-bmenu-isearch-marked-bookmarks-regexp () ; Bound to `M-s a M-C-s' in bookmark list
2453 "Regexp Isearch the marked bookmark locations, in their current order."
2455 (bmkp-bmenu-barf-if-not-in-menu-list)
2456 (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only))))
2457 (bmkp-use-region nil)) ; Suppress region handling.
2458 (bmkp-isearch-bookmarks-regexp bookmarks)))) ; Defined in `bookmark+-1.el'.
2461 (defun bmkp-bmenu-search-marked-bookmarks-regexp (regexp) ; Bound to `M-s a M-s' in bookmark list
2462 "Search the marked file bookmarks, in their current order, for REGEXP.
2463 Use `\\[tags-loop-continue]' to advance among the search hits.
2464 Marked directory and non-file bookmarks are ignored."
2465 (interactive "sSearch marked file bookmarks (regexp): ")
2466 (bmkp-bmenu-barf-if-not-in-menu-list)
2467 (tags-search regexp '(let ((files ())
2469 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
2470 (setq file (bookmark-get-filename bmk))
2471 (when (and (not (equal bmkp-non-file-filename file))
2472 (not (file-directory-p file)))
2474 (setq files (nreverse files)))))
2477 (defun bmkp-bmenu-query-replace-marked-bookmarks-regexp (from to ; Bound to `M-q' in bookmark list
2478 &optional delimited)
2479 "`query-replace-regexp' FROM with TO, for all marked file bookmarks.
2480 DELIMITED (prefix arg) means replace only word-delimited matches.
2481 If you exit (`\\[keyboard-quit]', `RET' or `q'), you can use \
2482 `\\[tags-loop-continue]' to resume where
2484 (interactive (let ((common (query-replace-read-args "Query replace regexp in marked files" t t)))
2485 (list (nth 0 common) (nth 1 common) (nth 2 common))))
2486 (bmkp-bmenu-barf-if-not-in-menu-list)
2487 (tags-query-replace from to delimited
2490 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
2491 (setq file (bookmark-get-filename bmk))
2492 (let ((buffer (get-file-buffer file)))
2493 (when (and buffer (with-current-buffer buffer buffer-read-only))
2494 (error "File `%s' is visited read-only" file)))
2495 (when (and (not (equal bmkp-non-file-filename file))
2496 (not (file-directory-p file)))
2498 (setq files (nreverse files)))))
2505 (defun bmkp-bmenu-show-only-tagged () ; Bound to `T S' in bookmark list
2506 "Display (only) the bookmarks that have tags."
2508 (bmkp-bmenu-barf-if-not-in-menu-list)
2509 (setq bmkp-bmenu-filter-function 'bmkp-some-tags-alist-only
2510 bmkp-bmenu-title "Tagged Bookmarks")
2511 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2512 (setq bmkp-latest-bookmark-alist bookmark-alist)
2513 (bookmark-bmenu-list 'filteredp))
2514 (when (interactive-p)
2515 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only tagged bookmarks are shown")))
2517 ;; Not bound, but `T 0' is `bmkp-remove-all-tags'.
2519 (defun bmkp-bmenu-remove-all-tags (&optional must-confirm-p)
2520 "Remove all tags from this bookmark.
2521 Interactively, you are required to confirm."
2523 (bmkp-bmenu-barf-if-not-in-menu-list)
2524 (bookmark-bmenu-ensure-position)
2525 (let ((bookmark (bookmark-bmenu-bookmark)))
2526 (when (and must-confirm-p (null (bmkp-get-tags bookmark)))
2527 (error "Bookmark has no tags to remove"))
2528 (when (or (not must-confirm-p) (y-or-n-p "Remove all tags from this bookmark? "))
2529 (bmkp-remove-all-tags bookmark))))
2532 (defun bmkp-bmenu-add-tags () ; Only on `mouse-3' menu in bookmark list.
2533 "Add some tags to this bookmark."
2535 (bmkp-bmenu-barf-if-not-in-menu-list)
2536 (bookmark-bmenu-ensure-position)
2537 (bmkp-add-tags (bookmark-bmenu-bookmark) (bmkp-read-tags-completing)))
2540 (defun bmkp-bmenu-set-tag-value () ; Bound to `T v' in bookmark list
2541 "Set the value of one of this bookmark's tags."
2543 (bmkp-bmenu-barf-if-not-in-menu-list)
2544 (bookmark-bmenu-ensure-position)
2545 (let ((this-bmk (bookmark-bmenu-bookmark)))
2548 (bmkp-read-tag-completing "Tag: " (mapcar 'bmkp-full-tag (bmkp-get-tags this-bmk)))
2549 (read (read-string "Value: "))
2553 (defun bmkp-bmenu-set-tag-value-for-marked (tag value &optional msgp) ; `T > v' in bookmark list
2554 "Set the value of TAG to VALUE, for each of the marked bookmarks.
2555 If any of the bookmarks has no tag named TAG, then add one with VALUE."
2556 (interactive (list (bmkp-read-tag-completing) (read (read-string "Value: ")) 'msg))
2557 (bmkp-bmenu-barf-if-not-in-menu-list)
2558 (when msgp (message "Setting tag values..."))
2559 (let ((marked (bmkp-marked-bookmarks-only)))
2560 (unless marked (error "No marked bookmarks"))
2561 (when msgp (message "Setting tag values..."))
2562 (bmkp-set-tag-value-for-bookmarks marked tag value))
2563 (when (and msgp tag) (message "Setting tag values...done")))
2566 (defun bmkp-bmenu-remove-tags (&optional msgp) ; Only on `mouse-3' menu in bookmark list.
2567 "Remove some tags from this bookmark."
2569 (bmkp-bmenu-barf-if-not-in-menu-list)
2570 (bookmark-bmenu-ensure-position)
2571 (let ((bmk (bookmark-bmenu-bookmark)))
2572 (bmkp-remove-tags bmk
2573 (bmkp-read-tags-completing (mapcar 'bmkp-full-tag (bmkp-get-tags bmk)) t)
2577 (defun bmkp-bmenu-add-tags-to-marked (tags &optional msgp) ; Bound to `T > +' in bookmark list
2578 "Add TAGS to each of the marked bookmarks.
2579 TAGS is a list of strings.
2580 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
2581 You can use completion to enter each tag, but you are not limited to
2582 choosing existing tags."
2583 (interactive (list (bmkp-read-tags-completing) 'msg))
2584 (bmkp-bmenu-barf-if-not-in-menu-list)
2585 (let ((marked (bmkp-marked-bookmarks-only)))
2586 (unless marked (error "No marked bookmarks"))
2587 (when msgp (message "Adding tags..."))
2588 (dolist (bmk (mapcar #'car marked)) (bmkp-add-tags bmk tags nil 'NO-CACHE-UPDATE)))
2589 (bmkp-tags-list) ; Update the tags cache (only once, at end).
2590 (when (and msgp tags) (message "Tags added: %S" tags)))
2593 (defun bmkp-bmenu-remove-tags-from-marked (tags &optional msgp) ; Bound to `T > -' in bookmark list
2594 "Remove TAGS from each of the marked bookmarks.
2595 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
2596 You can use completion to enter each tag."
2597 (interactive (let ((cand-tags ()))
2598 (dolist (bmk (bmkp-marked-bookmarks-only))
2599 (setq cand-tags (bmkp-set-union cand-tags (bmkp-get-tags bmk))))
2600 (unless cand-tags (error "No tags to remove"))
2601 (list (bmkp-read-tags-completing cand-tags t) 'msg)))
2602 (bmkp-bmenu-barf-if-not-in-menu-list)
2603 (let ((marked (bmkp-marked-bookmarks-only)))
2604 (unless marked (error "No marked bookmarks"))
2605 (when msgp (message "Removing tags..."))
2606 (dolist (bmk (mapcar #'car marked)) (bmkp-remove-tags bmk tags nil 'NO-CACHE-UPDATE)))
2607 (bmkp-tags-list) ; Update the tags cache (only once, at end).
2608 (when (and msgp tags) (message "Tags removed: %S" tags)))
2611 (defun bmkp-bmenu-mark-bookmarks-tagged-regexp (regexp &optional notp) ; `T m %' in bookmark list
2612 "Mark bookmarks any of whose tags match REGEXP.
2613 With a prefix arg, mark all that are tagged but have no matching tags."
2614 (interactive "sRegexp: \nP")
2615 (bmkp-bmenu-barf-if-not-in-menu-list)
2617 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2621 (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark))
2622 anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag)))
2624 (if (not (and tags (if notp (not anyp) anyp)))
2626 (bookmark-bmenu-mark)
2627 (setq count (1+ count))))
2628 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2631 (defun bmkp-bmenu-mark-bookmarks-tagged-all (tags &optional none-p msgp) ; `T m *' in bookmark list
2632 "Mark all visible bookmarks that are tagged with *each* tag in TAGS.
2633 As a special case, if TAGS is empty, then mark the bookmarks that have
2634 any tags at all (i.e., at least one tag).
2636 With a prefix arg, mark all that are *not* tagged with *any* TAGS."
2637 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2638 (bmkp-bmenu-barf-if-not-in-menu-list)
2639 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags none-p nil msgp))
2642 (defun bmkp-bmenu-mark-bookmarks-tagged-none (tags &optional allp msgp) ; `T m ~ +' in bookmark list
2643 "Mark all visible bookmarks that are not tagged with *any* tag in TAGS.
2644 As a special case, if TAGS is empty, then mark the bookmarks that have
2647 With a prefix arg, mark all that are tagged with *each* tag in TAGS."
2648 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2649 (bmkp-bmenu-barf-if-not-in-menu-list)
2650 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) nil msgp))
2653 (defun bmkp-bmenu-mark-bookmarks-tagged-some (tags &optional somenotp msgp) ; `T m +' in bookmark list
2654 "Mark all visible bookmarks that are tagged with *some* tag in TAGS.
2655 As a special case, if TAGS is empty, then mark the bookmarks that have
2658 With a prefix arg, mark all that are *not* tagged with *all* TAGS.
2660 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
2661 You can use completion to enter each tag."
2662 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2663 (bmkp-bmenu-barf-if-not-in-menu-list)
2664 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp nil msgp))
2667 (defun bmkp-bmenu-mark-bookmarks-tagged-not-all (tags &optional somep msgp) ; `T m ~ *' in bmk list
2668 "Mark all visible bookmarks that are *not* tagged with *all* TAGS.
2669 As a special case, if TAGS is empty, then mark the bookmarks that have
2672 With a prefix arg, mark all that are tagged with *some* tag in TAGS."
2673 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2674 (bmkp-bmenu-barf-if-not-in-menu-list)
2675 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) nil msgp))
2678 (defun bmkp-bmenu-unmark-bookmarks-tagged-regexp (regexp &optional notp) ; `T u %' in bookmark list
2679 "Unmark bookmarks any of whose tags match REGEXP.
2680 With a prefix arg, mark all that are tagged but have no matching tags."
2681 (interactive "sRegexp: \nP")
2682 (bmkp-bmenu-barf-if-not-in-menu-list)
2684 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2688 (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark))
2689 anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag)))
2691 (if (not (and tags (if notp (not anyp) anyp)))
2693 (bookmark-bmenu-unmark)
2694 (setq count (1+ count))))
2695 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2698 (defun bmkp-bmenu-unmark-bookmarks-tagged-all (tags &optional none-p msgp) ; `T u *' in bookmark list
2699 "Unmark all visible bookmarks that are tagged with *each* tag in TAGS.
2700 As a special case, if TAGS is empty, then unmark the bookmarks that have
2703 With a prefix arg, unmark all that are *not* tagged with *any* TAGS."
2704 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2705 (bmkp-bmenu-barf-if-not-in-menu-list)
2706 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags none-p 'UNMARK msgp))
2709 (defun bmkp-bmenu-unmark-bookmarks-tagged-none (tags &optional allp msgp) ; `T u ~ +' in bookmark list
2710 "Unmark all visible bookmarks that are *not* tagged with *any* TAGS.
2711 As a special case, if TAGS is empty, then unmark the bookmarks that have
2714 With a prefix arg, unmark all that are tagged with *each* tag in TAGS."
2715 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2716 (bmkp-bmenu-barf-if-not-in-menu-list)
2717 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) 'UNMARK msgp))
2720 (defun bmkp-bmenu-unmark-bookmarks-tagged-some (tags &optional somenotp msgp) ; `T u +' in bmk list
2721 "Unmark all visible bookmarks that are tagged with *some* tag in TAGS.
2722 As a special case, if TAGS is empty, then unmark the bookmarks that have
2725 With a prefix arg, unmark all that are *not* tagged with *all* TAGS."
2726 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2727 (bmkp-bmenu-barf-if-not-in-menu-list)
2728 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp 'UNMARK msgp))
2731 (defun bmkp-bmenu-unmark-bookmarks-tagged-not-all (tags &optional somep msgp) ; `T u ~ *' in bmk list
2732 "Unmark all visible bookmarks that are *not* tagged with *all* TAGS.
2733 As a special case, if TAGS is empty, then unmark the bookmarks that have
2736 With a prefix arg, unmark all that are tagged with *some* TAGS."
2737 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'msg))
2738 (bmkp-bmenu-barf-if-not-in-menu-list)
2739 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) 'UNMARK msgp))
2741 (defun bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none (tags &optional none-p unmarkp msgp)
2742 "Mark or unmark visible bookmarks tagged with all or none of TAGS.
2743 TAGS is a list of strings, the tag names.
2744 NONEP non-nil means mark/unmark bookmarks that have none of the TAGS.
2745 UNMARKP non-nil means unmark; nil means mark.
2746 MSGP means display a status message.
2748 As a special case, if TAGS is empty, then mark or unmark the bookmarks
2749 that have any tags at all, or if NONEP is non-nil then mark or unmark
2750 those that have no tags at all."
2751 (with-current-buffer "*Bookmark List*"
2755 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2757 (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark)))
2758 (if (not (if (null tags)
2759 (if none-p (not bmktags) bmktags)
2760 (and bmktags (catch 'bmkp-b-mu-b-t-an
2762 (setq presentp (assoc-default tag bmktags nil t))
2763 (unless (if none-p (not presentp) presentp)
2764 (throw 'bmkp-b-mu-b-t-an nil)))
2767 (if unmarkp (bookmark-bmenu-unmark) (bookmark-bmenu-mark))
2768 (setq count (1+ count))))
2769 (when msgp (if (= 1 count)
2770 (message "1 bookmark matched")
2771 (message "%d bookmarks matched" count)))))))
2773 (defun bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all (tags &optional notallp unmarkp msgp)
2774 "Mark or unmark visible bookmarks tagged with any or not all of TAGS.
2775 TAGS is a list of strings, the tag names.
2776 NOTALLP non-nil means mark/unmark bookmarks that do not have all TAGS.
2777 UNMARKP non-nil means unmark; nil means mark.
2778 MSGP means display a status message.
2780 As a special case, if TAGS is empty, then mark or unmark the bookmarks
2781 that have any tags at all, or if NOTALLP is non-nil then mark or
2782 unmark those that have no tags at all."
2783 (with-current-buffer "*Bookmark List*"
2787 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2789 (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark)))
2790 (if (not (if (null tags)
2791 (if notallp (not bmktags) bmktags)
2792 (and bmktags (catch 'bmkp-b-mu-b-t-sna
2794 (setq presentp (assoc-default tag bmktags nil t))
2795 (when (if notallp (not presentp) presentp)
2796 (throw 'bmkp-b-mu-b-t-sna t)))
2799 (if unmarkp (bookmark-bmenu-unmark) (bookmark-bmenu-mark))
2800 (setq count (1+ count))))
2802 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))))
2805 (defun bmkp-bmenu-copy-tags (&optional msgp) ; `T c', `T M-w', `mouse-3' menu in bookmark list.
2806 "Copy tags from this bookmark, so you can paste them to another bookmark."
2807 (interactive (list 'MSG))
2808 (bmkp-bmenu-barf-if-not-in-menu-list)
2809 (bookmark-bmenu-ensure-position)
2810 (bmkp-copy-tags (bookmark-bmenu-bookmark) msgp))
2813 (defun bmkp-bmenu-paste-add-tags (&optional msgp) ; `T p', `T C-y', `mouse-3' menu in bookmark list.
2814 "Add tags to this bookmark that were copied from another bookmark."
2815 (interactive (list 'MSG))
2816 (bmkp-bmenu-barf-if-not-in-menu-list)
2817 (bookmark-bmenu-ensure-position)
2818 (bmkp-paste-add-tags (bookmark-bmenu-bookmark) msgp))
2821 (defun bmkp-bmenu-paste-replace-tags (&optional msgp) ; `T q', `mouse-3' menu.
2822 "Replace tags for this bookmark with those copied from another bookmark."
2823 (interactive (list 'MSG))
2824 (bmkp-bmenu-barf-if-not-in-menu-list)
2825 (bookmark-bmenu-ensure-position)
2826 (bmkp-paste-replace-tags (bookmark-bmenu-bookmark) msgp))
2829 (defun bmkp-bmenu-paste-add-tags-to-marked (&optional msgp) ; `T > p', `T > C-y'
2830 "Add tags that were copied from another bookmark to the marked bookmarks."
2831 (interactive (list 'MSG))
2832 (bmkp-bmenu-barf-if-not-in-menu-list)
2833 (let ((marked (bmkp-marked-bookmarks-only)))
2834 (unless marked (error "No marked bookmarks"))
2835 (when msgp (message "Adding tags..."))
2836 (dolist (bmk marked) (bmkp-paste-add-tags bmk nil 'NO-CACHE-UPDATE))
2837 (bmkp-tags-list) ; Update the tags cache (only once, at end).
2838 (when msgp (message "Tags added: %S" bmkp-copied-tags))))
2841 (defun bmkp-bmenu-paste-replace-tags-for-marked (&optional msgp) ; `T > q'
2842 "Replace tags for the marked bookmarks with tags copied previously."
2843 (interactive (list 'MSG))
2844 (bmkp-bmenu-barf-if-not-in-menu-list)
2845 (let ((marked (bmkp-marked-bookmarks-only)))
2846 (unless marked (error "No marked bookmarks"))
2847 (when msgp (message "Replacing tags..."))
2848 (dolist (bmk marked) (bmkp-paste-replace-tags bmk nil 'NO-CACHE-UPDATE))
2849 (bmkp-tags-list) ; Update the tags cache (only once, at end).
2850 (when msgp (message "Replacement tags: %S" bmkp-copied-tags))))
2853 ;;(@* "General Menu-List (`-*bmenu-*') Commands and Functions")
2854 ;; *** General Menu-List (`-*bmenu-*') Commands and Functions ***
2857 (defun bmkp-bmenu-w32-open () ; Bound to `M-RET' in bookmark list.
2858 "Use `w32-browser' to open this bookmark."
2859 (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-this-window)))
2862 (defun bmkp-bmenu-w32-open-with-mouse (event) ; Bound to `M-mouse-2' in bookmark list.
2863 "Use `w32-browser' to open the bookmark clicked."
2866 (with-current-buffer (window-buffer (posn-window (event-end event)))
2867 (save-excursion (goto-char (posn-point (event-end event)))
2868 (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-other-window))))))
2871 (defun bmkp-bmenu-w32-open-select () ; Bound to `M-o' in bookmark-list.
2872 "Use `w32-browser' to open this bookmark and all marked bookmarks."
2873 (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-select)))
2876 (defun bmkp-bmenu-mode-status-help () ; Bound to `C-h m' and `?' in bookmark list
2877 "`describe-mode' + current status of `*Bookmark List*' + face legend."
2879 (unless (string= (buffer-name) "*Help*") (bmkp-bmenu-barf-if-not-in-menu-list))
2880 (with-current-buffer (get-buffer-create "*Help*")
2881 (with-output-to-temp-buffer "*Help*"
2882 (let ((buffer-read-only nil)
2886 (let ((standard-output (current-buffer)))
2887 (if (> emacs-major-version 21)
2888 (describe-function-1 'bookmark-bmenu-mode)
2889 (describe-function-1 'bookmark-bmenu-mode nil t)))
2890 (help-setup-xref (list #'bmkp-bmenu-mode-status-help) (interactive-p))
2891 (goto-char (point-min))
2892 ;; This text must be the same as the last line of `bookmark-bmenu-mode' doc string.
2893 (search-forward "Each line represents an Emacs bookmark.\n\n\n" nil t)
2894 (delete-region (point-min) (point)) ; Get rid of intro from `describe-function'.
2895 (insert "*************************** Bookmark List ***************************\n\n")
2896 (insert "Major mode for editing a list of bookmarks.\n")
2897 (insert "Each line represents an Emacs bookmark.\n\n")
2899 ;; Add buttons to access help and Customize.
2900 ;; Not for Emacs 21.3 - its `help-insert-xref-button' signature is different.
2901 (when (and (> emacs-major-version 21) ; In `help-mode.el'.
2902 (condition-case nil (require 'help-mode nil t) (error nil))
2903 (fboundp 'help-insert-xref-button))
2904 (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button)
2906 (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button)
2908 (help-insert-xref-button "[Customize]" 'bmkp-customize-button)
2911 (goto-char (point-max))
2912 (insert "\nSend a Bookmark+ bug report: `\\[icicle-send-bug-report]'.\n\n")
2913 (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button)
2915 (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button)
2917 (help-insert-xref-button "[Customize]" 'bmkp-customize-button)
2919 (goto-char (point-min))
2923 "\nCurrent Status\n-------------------------------\n
2924 Sorted:\t\t%s\nFiltering:\t%s\nMarked:\t\t%d\nOmitted:\t%d\nBookmark file:\t%s\n\n\n"
2925 (if (not bmkp-sort-comparer)
2927 (format "%s%s" (bmkp-current-sort-order)
2928 ;; Code essentially the same as found in `bmkp-msg-about-sort-order'.
2929 (if (not (and (consp bmkp-sort-comparer) ; Ordinary single predicate
2930 (consp (car bmkp-sort-comparer))))
2931 (if bmkp-reverse-sort-p "; reversed" "")
2932 (if (not (cadr (car bmkp-sort-comparer)))
2934 (if (or (and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p))
2935 (and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p)))
2938 ;; In case we want to distinguish:
2939 ;; (if (and bmkp-reverse-sort-p
2940 ;; (not bmkp-reverse-multi-sort-p))
2942 ;; (if (and bmkp-reverse-multi-sort-p
2943 ;; (not bmkp-reverse-sort-p))
2947 ;; At least two PREDs.
2948 (cond ((and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p))
2950 ((and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p))
2951 "; each predicate group reversed")
2952 ((and bmkp-reverse-multi-sort-p bmkp-reverse-sort-p)
2953 "; order of predicate groups reversed")
2955 (or (and bmkp-bmenu-filter-function (downcase bmkp-bmenu-title)) "None")
2956 (length bmkp-bmenu-marked-bookmarks)
2957 (length bmkp-bmenu-omitted-bookmarks)
2958 bmkp-current-bookmark-file))
2960 (let ((gnus "Gnus\n")
2961 (info "Info node\n")
2964 (local-no-region "Local file with no region\n")
2965 (local-w-region "Local file with a region\n")
2967 (no-buf "No current buffer\n")
2968 (bad "Possibly invalid bookmark\n")
2969 (remote "Remote file or directory\n")
2970 (sudo "Remote accessed by `su' or `sudo'\n")
2971 (local-dir "Local directory\n")
2972 (bookmark-list "*Bookmark List*\n")
2973 (bookmark-file "Bookmark file\n")
2974 (desktop "Desktop\n")
2975 (sequence "Sequence\n")
2976 (variable-list "Variable list\n")
2977 (function "Function\n"))
2978 (put-text-property 0 (1- (length gnus)) 'face 'bmkp-gnus gnus)
2979 (put-text-property 0 (1- (length info)) 'face 'bmkp-info info)
2980 (put-text-property 0 (1- (length man)) 'face 'bmkp-man man)
2981 (put-text-property 0 (1- (length url)) 'face 'bmkp-url url)
2982 (put-text-property 0 (1- (length local-no-region))
2983 'face 'bmkp-local-file-without-region local-no-region)
2984 (put-text-property 0 (1- (length local-w-region))
2985 'face 'bmkp-local-file-with-region local-w-region)
2986 (put-text-property 0 (1- (length buffer)) 'face 'bmkp-buffer buffer)
2987 (put-text-property 0 (1- (length no-buf)) 'face 'bmkp-non-file no-buf)
2988 (put-text-property 0 (1- (length bad)) 'face 'bmkp-bad-bookmark bad)
2989 (put-text-property 0 (1- (length remote)) 'face 'bmkp-remote-file remote)
2990 (put-text-property 0 (1- (length sudo)) 'face 'bmkp-su-or-sudo sudo)
2991 (put-text-property 0 (1- (length local-dir))
2992 'face 'bmkp-local-directory local-dir)
2993 (put-text-property 0 (1- (length bookmark-list))
2994 'face 'bmkp-bookmark-list bookmark-list)
2995 (put-text-property 0 (1- (length bookmark-file))
2996 'face 'bmkp-bookmark-file bookmark-file)
2997 (put-text-property 0 (1- (length desktop)) 'face 'bmkp-desktop desktop)
2998 (put-text-property 0 (1- (length sequence)) 'face 'bmkp-sequence sequence)
2999 (put-text-property 0 (1- (length variable-list)) 'face 'bmkp-variable-list variable-list)
3000 (put-text-property 0 (1- (length function)) 'face 'bmkp-function function)
3001 (insert "Face Legend for Bookmark Types\n------------------------------\n\n")
3002 (insert gnus) (insert info) (insert man) (insert url) (insert local-no-region)
3003 (insert local-w-region) (insert buffer) (insert no-buf) (insert bad) (insert remote)
3004 (insert sudo) (insert local-dir) (insert bookmark-list) (insert bookmark-file)
3005 (insert desktop) (insert sequence) (insert variable-list) (insert function)
3006 (insert "\n\n")))))))
3008 (when (and (> emacs-major-version 21)
3009 (condition-case nil (require 'help-mode nil t) (error nil))
3010 (get 'help-xref 'button-category-symbol)) ; In `button.el'
3011 (define-button-type 'bmkp-help-button
3012 :supertype 'help-xref
3013 'help-function #'(lambda () (browse-url "http://www.emacswiki.org/emacs/BookmarkPlus"))
3015 (purecopy "mouse-2, RET: Bookmark+ documentation on the Emacs Wiki (requires Internet access)"))
3016 (define-button-type 'bmkp-commentary-button
3017 :supertype 'help-xref
3018 'help-function #'(lambda ()
3019 (message "Getting Bookmark+ doc from file commentary...")
3020 (finder-commentary "bookmark+-doc")
3021 (when (condition-case nil (require 'linkd nil t) (error nil)) (linkd-mode 1))
3022 (when (condition-case nil (require 'fit-frame nil t) (error nil))
3024 'help-echo (purecopy "mouse-2, RET: Bookmark+ documentation (no Internet needed)"))
3025 (define-button-type 'bmkp-customize-button
3026 :supertype 'help-xref
3027 'help-function #'(lambda () (customize-group-other-window 'bookmark-plus))
3028 'help-echo (purecopy "mouse-2, RET: Customize/Browse Bookmark+ Options & Faces")))
3031 (defun bmkp-bmenu-define-jump-marked-command () ; Bound to `M-c' in bookmark list
3032 "Define a command to jump to a bookmark that is one of those now marked.
3033 The bookmarks marked now will be those that are completion candidates
3034 for the command (but omitted bookmarks are excluded).
3035 Save the command definition in `bmkp-bmenu-commands-file'."
3037 (bmkp-bmenu-barf-if-not-in-menu-list)
3038 (let* ((cands (mapcar #'list
3039 (bmkp-remove-if #'(lambda (bmk)
3040 (bmkp-bookmark-name-member bmk
3041 bmkp-bmenu-omitted-bookmarks))
3042 bmkp-bmenu-marked-bookmarks)))
3043 (fn (intern (read-string "Define command to jump to a bookmark now marked: " nil
3044 'bmkp-bmenu-define-command-history)))
3045 (def `(defun ,fn (bookmark-name &optional use-region-p)
3046 (interactive (list (bmkp-read-bookmark-for-type nil ',cands t) current-prefix-arg))
3047 (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p))))
3049 (with-current-buffer (get-buffer-create " *User Bookmark List Commands*")
3050 (goto-char (point-min))
3051 (delete-region (point-min) (point-max))
3052 (let ((print-length nil)
3054 (pp def (current-buffer))
3057 (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append)
3058 (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file)))
3059 (kill-buffer (current-buffer))))
3060 (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file)))
3063 (defun bmkp-bmenu-define-command () ; Bound to `c' in bookmark list
3064 "Define a command to use the current sort order, filter, and omit list.
3065 Prompt for the command name. Save the command definition in
3066 `bmkp-bmenu-commands-file'.
3068 The current sort order, filter function, omit list, and title for
3069 buffer `*Bookmark List*' are encapsulated as part of the command.
3070 Use the command at any time to restore them."
3072 (let* ((fn (intern (read-string "Define sort+filter command: " nil
3073 'bmkp-bmenu-define-command-history)))
3077 bmkp-sort-comparer ',bmkp-sort-comparer
3078 bmkp-reverse-sort-p ',bmkp-reverse-sort-p
3079 bmkp-reverse-multi-sort-p ',bmkp-reverse-multi-sort-p
3080 bmkp-bmenu-filter-function ',bmkp-bmenu-filter-function
3081 bmkp-bmenu-filter-pattern ',bmkp-bmenu-filter-pattern
3082 bmkp-bmenu-omitted-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names
3083 bmkp-bmenu-omitted-bookmarks)
3084 bmkp-bmenu-title ',bmkp-bmenu-title
3085 bookmark-bmenu-toggle-filenames ',bookmark-bmenu-toggle-filenames)
3086 (bmkp-bmenu-refresh-menu-list)
3087 (when (interactive-p)
3088 (bmkp-msg-about-sort-order
3089 (car (rassoc bmkp-sort-comparer bmkp-sort-orders-alist)))))))
3091 (with-current-buffer (get-buffer-create " *User Bookmark List Commands*")
3092 (goto-char (point-min))
3093 (delete-region (point-min) (point-max))
3094 (let ((print-length nil)
3096 (pp def (current-buffer))
3099 (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append)
3100 (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file)))
3101 (kill-buffer (current-buffer))))
3102 (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file)))
3105 (defun bmkp-bmenu-define-full-snapshot-command () ; Bound to `C' in bookmark list
3106 "Define a command to restore the current bookmark-list state.
3107 Prompt for the command name. Save the command definition in
3108 `bmkp-bmenu-commands-file'.
3110 Be aware that the command definition can be quite large, since it
3111 copies the current bookmark list and accessory lists (hidden
3112 bookmarks, marked bookmarks, etc.). For a lighter weight command, use
3113 `bmkp-bmenu-define-full-snapshot-command' instead. That records only
3114 the omit list and the sort & filter information."
3116 (let* ((fn (intern (read-string "Define restore-snapshot command: " nil
3117 'bmkp-bmenu-define-command-history)))
3121 bmkp-sort-comparer ',bmkp-sort-comparer
3122 bmkp-reverse-sort-p ',bmkp-reverse-sort-p
3123 bmkp-reverse-multi-sort-p ',bmkp-reverse-multi-sort-p
3124 bmkp-latest-bookmark-alist ',(bmkp-maybe-unpropertize-bookmark-names
3125 bmkp-latest-bookmark-alist)
3126 bmkp-bmenu-omitted-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names
3127 bmkp-bmenu-omitted-bookmarks)
3128 bmkp-bmenu-marked-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names
3129 bmkp-bmenu-marked-bookmarks)
3130 bmkp-bmenu-filter-function ',bmkp-bmenu-filter-function
3131 bmkp-bmenu-filter-pattern ',bmkp-bmenu-filter-pattern
3132 bmkp-bmenu-title ',bmkp-bmenu-title
3133 bmkp-last-bmenu-bookmark ',(and (get-buffer "*Bookmark List*")
3134 (with-current-buffer
3135 (get-buffer "*Bookmark List*")
3136 (bookmark-bmenu-bookmark)))
3137 bmkp-last-specific-buffer ',bmkp-last-specific-buffer
3138 bmkp-last-specific-file ',bmkp-last-specific-file
3139 bookmark-bmenu-toggle-filenames ',bookmark-bmenu-toggle-filenames
3140 bmkp-bmenu-before-hide-marked-alist ',(bmkp-maybe-unpropertize-bookmark-names
3141 bmkp-bmenu-before-hide-marked-alist)
3142 bmkp-bmenu-before-hide-unmarked-alist ',(bmkp-maybe-unpropertize-bookmark-names
3143 bmkp-bmenu-before-hide-unmarked-alist)
3144 bmkp-last-bookmark-file ',bmkp-last-bookmark-file
3145 bmkp-current-bookmark-file ',bmkp-current-bookmark-file)
3146 ;;(bmkp-bmenu-refresh-menu-list)
3147 (let ((bookmark-alist (or bmkp-latest-bookmark-alist bookmark-alist)))
3148 (bmkp-bmenu-list-1 'filteredp nil (interactive-p)))
3149 (when bmkp-last-bmenu-bookmark
3150 (with-current-buffer (get-buffer "*Bookmark List*")
3151 (bmkp-bmenu-goto-bookmark-named bmkp-last-bmenu-bookmark)))
3152 (when (interactive-p)
3153 (bmkp-msg-about-sort-order
3154 (car (rassoc bmkp-sort-comparer bmkp-sort-orders-alist)))))))
3156 (with-current-buffer (get-buffer-create " *User Bookmark List Commands*")
3157 (goto-char (point-min))
3158 (delete-region (point-min) (point-max))
3159 (let ((print-length nil)
3162 (pp def (current-buffer))
3165 (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append)
3166 (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file)))
3167 (kill-buffer (current-buffer))))
3168 (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file)))
3170 (defun bmkp-maybe-unpropertize-bookmark-names (list)
3171 "Strip properties from the bookmark names in a copy of LIST.
3172 LIST is a bookmark alist or a list of bookmark names (strings).
3173 Return the updated copy.
3175 Note, however, that this is a shallow copy, so the names are also
3176 stripped within any alist elements of the original LIST.
3178 We do this because Emacs 20 has no `print-circle'. and otherwise
3179 property `bmkp-full-record' would make the state file unreadable.
3181 Do nothing in Emacs 21 or later or if
3182 `bmkp-propertize-bookmark-names-flag' is nil. In these cases, just
3184 (if (and (> emacs-major-version 20) ; Emacs 21+. Cannot just use (boundp 'print-circle).
3185 bmkp-propertize-bookmark-names-flag)
3187 (let ((new-list (copy-sequence list)))
3188 (dolist (bmk new-list)
3189 (when (and (consp bmk) (stringp (car bmk))) (setq bmk (car bmk)))
3190 (when (stringp bmk) (set-text-properties 0 (length bmk) nil bmk)))
3193 ;; This is a general command. It is in this file because it uses macro `bmkp-define-sort-command'
3194 ;; and it is used mainly in the bookmark list display.
3196 (defun bmkp-define-tags-sort-command (tags &optional msgp) ; Bound to `T s' in bookmark list
3197 "Define a command to sort bookmarks in the bookmark list by tags.
3198 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
3200 The new command sorts first by the first tag in TAGS, then by the
3203 Besides sorting for these specific tags, any bookmark that has a tag
3204 sorts before one that has no tags. Otherwise, sorting is by bookmark
3205 name, alphabetically.
3207 The name of the new command is `bmkp-bmenu-sort-' followed by the
3208 specified tags, in order, separated by hyphens (`-'). E.g., for TAGS
3209 \(\"alpha\" \"beta\"), the name is `bmkp-bmenu-sort-alpha-beta'."
3210 (interactive (list (bmkp-read-tags-completing) 'msg))
3211 (let ((sort-order (concat "tags-" (mapconcat #'identity tags "-")))
3212 (doc-string (read-string "Doc string for command: "))
3216 (push `(lambda (b1 b2)
3217 (let ((tags1 (bmkp-get-tags b1))
3218 (tags2 (bmkp-get-tags b2)))
3219 (cond ((and (assoc-default ,tag tags1 nil t)
3220 (assoc-default ,tag tags2 nil t)) nil)
3221 ((assoc-default ,tag tags1 nil t) '(t))
3222 ((assoc-default ,tag tags2 nil t) '(nil))
3223 ((and tags1 tags2) nil)
3228 (setq comparer (nreverse comparer)
3229 comparer (list comparer 'bmkp-alpha-p))
3230 (eval (setq def (macroexpand `(bmkp-define-sort-command ,sort-order ,comparer ,doc-string))))
3231 (with-current-buffer (get-buffer-create " *User Bookmark List Commands*")
3232 (goto-char (point-min))
3233 (delete-region (point-min) (point-max))
3234 (let ((print-length nil)
3236 (pp def (current-buffer))
3239 (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append)
3240 (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file)))
3241 (kill-buffer (current-buffer))))
3242 (when msgp (message "Defined and saved command `%s'"
3243 (concat "bmkp-bmenu-sort-" sort-order)))))
3246 (defun bmkp-bmenu-edit-bookmark (&optional internalp) ; Bound to `E' in bookmark list
3247 "Edit the bookmark under the cursor: its name and file name.
3248 With a prefix argument, edit the complete bookmark record (the
3249 internal, Lisp form)."
3251 (bmkp-bmenu-barf-if-not-in-menu-list)
3252 (bookmark-bmenu-ensure-position)
3253 (let ((bmk-name (bookmark-bmenu-bookmark)))
3255 (bmkp-edit-bookmark-record bmk-name)
3256 (let* ((new-data (bmkp-edit-bookmark bmk-name))
3257 (new-name (car new-data)))
3259 (message "No changes made")
3260 (bmkp-refresh-menu-list new-name))))))
3263 (defun bmkp-bmenu-edit-tags () ; Bound to `T e' in bookmark list
3264 "Edit the tags of the bookmark under the cursor.
3265 The edited value must be a list each of whose elements is either a
3266 string or a cons whose key is a string."
3268 (bmkp-bmenu-barf-if-not-in-menu-list)
3269 (bookmark-bmenu-ensure-position)
3270 (bmkp-edit-tags (bookmark-bmenu-bookmark)))
3272 (defun bmkp-bmenu-propertize-item (bookmark start end)
3273 "Propertize buffer from START to END, indicating bookmark types.
3274 This propertizes the name of BOOKMARK.
3275 Also give this region the property `bmkp-bookmark-name' with as value
3276 the name of BOOKMARK as a propertized string.
3278 The propertized string has property `bmkp-full-record' with value
3279 BOOKMARK, which is the full bookmark record, with the string as its
3282 Return the propertized string (the bookmark name)."
3283 (setq bookmark (bookmark-get-bookmark bookmark))
3284 (let* ((bookmark-name (bookmark-name-from-full-record bookmark))
3285 (buffp (bmkp-get-buffer-name bookmark))
3287 (filep (bookmark-get-filename bookmark))
3288 (sudop (and filep (boundp 'tramp-file-name-regexp)
3289 (string-match tramp-file-name-regexp filep)
3290 (string-match bmkp-su-or-sudo-regexp filep))))
3291 ;; Put the full bookmark itself on string `bookmark-name' as property `bmkp-full-record'.
3292 ;; Then put that string on the name in the buffer text as property `bmkp-bookmark-name'.
3293 (put-text-property 0 (length bookmark-name) 'bmkp-full-record bookmark bookmark-name)
3294 (put-text-property start end 'bmkp-bookmark-name bookmark-name)
3295 ;; Add faces, mouse face, and tooltips, to characterize the bookmark type.
3296 (add-text-properties
3298 (cond ((bmkp-sequence-bookmark-p bookmark) ; Sequence bookmark
3299 (append (bmkp-face-prop 'bmkp-sequence)
3300 '(mouse-face highlight follow-link t
3301 help-echo "mouse-2: Invoke the bookmarks in this sequence")))
3302 ((bmkp-function-bookmark-p bookmark) ; Function bookmark
3303 (append (bmkp-face-prop 'bmkp-function)
3304 '(mouse-face highlight follow-link t
3305 help-echo "mouse-2: Invoke this function bookmark")))
3306 ((bmkp-variable-list-bookmark-p bookmark) ; Variable-list bookmark
3307 (append (bmkp-face-prop 'bmkp-variable-list)
3308 '(mouse-face highlight follow-link t
3309 help-echo "mouse-2: Invoke this variable-list bookmark")))
3310 ((bmkp-bookmark-list-bookmark-p bookmark) ; Bookmark-list bookmark
3311 (append (bmkp-face-prop 'bmkp-bookmark-list)
3312 '(mouse-face highlight follow-link t
3313 help-echo "mouse-2: Invoke this bookmark-list bookmark")))
3314 ((bmkp-desktop-bookmark-p bookmark) ; Desktop bookmark
3315 (append (bmkp-face-prop 'bmkp-desktop)
3316 '(mouse-face highlight follow-link t
3317 help-echo "mouse-2: Jump to this desktop bookmark")))
3318 ((bmkp-bookmark-file-bookmark-p bookmark) ; Bookmark-file bookmark
3319 (append (bmkp-face-prop 'bmkp-bookmark-file)
3320 '(mouse-face highlight follow-link t
3321 help-echo "mouse-2: Load this bookmark's bookmark file")))
3322 ((bmkp-info-bookmark-p bookmark) ; Info bookmark
3323 (append (bmkp-face-prop 'bmkp-info)
3324 '(mouse-face highlight follow-link t
3325 help-echo "mouse-2: Jump to this Info bookmark")))
3326 ((bmkp-man-bookmark-p bookmark) ; Man bookmark
3327 (append (bmkp-face-prop 'bmkp-man)
3328 '(mouse-face highlight follow-link t
3329 help-echo (format "mouse-2 Goto `man' page"))))
3330 ((bmkp-gnus-bookmark-p bookmark) ; Gnus bookmark
3331 (append (bmkp-face-prop 'bmkp-gnus)
3332 '(mouse-face highlight follow-link t
3333 help-echo "mouse-2: Jump to this Gnus bookmark")))
3334 ((bmkp-url-bookmark-p bookmark) ; URL bookmark
3335 (append (bmkp-face-prop 'bmkp-url)
3336 `(mouse-face highlight follow-link t
3337 help-echo (format "mouse-2: Jump to URL `%s'" ,filep))))
3338 ((and sudop (not (bmkp-root-or-sudo-logged-p))) ; Root/sudo not logged in
3339 (append (bmkp-face-prop 'bmkp-su-or-sudo)
3340 `(mouse-face highlight follow-link t
3341 help-echo (format "mouse-2: Jump to (visit) file `%s'" ,filep))))
3342 ;; Test for remoteness before any other tests of the file itself
3343 ;; (e.g. `file-exists-p'), so we don't prompt for a password etc.
3344 ((and filep (bmkp-file-remote-p filep) (not sudop)) ; Remote file (ssh, ftp)
3345 (append (bmkp-face-prop 'bmkp-remote-file)
3346 `(mouse-face highlight follow-link t
3347 help-echo (format "mouse-2: Jump to (visit) remote file `%s'" ,filep))))
3348 ((and filep (file-directory-p filep)) ; Local directory
3349 (append (bmkp-face-prop 'bmkp-local-directory)
3350 `(mouse-face highlight follow-link t
3351 help-echo (format "mouse-2: Dired directory `%s'" ,filep))))
3352 ((and filep (file-exists-p filep) ; Local file with region
3353 (bmkp-region-bookmark-p bookmark))
3354 (append (bmkp-face-prop 'bmkp-local-file-with-region)
3355 `(mouse-face highlight follow-link t
3356 help-echo (format "mouse-2: Activate region in file `%s'" ,filep))))
3357 ((and filep (file-exists-p filep)) ; Local file without region
3358 (append (bmkp-face-prop 'bmkp-local-file-without-region)
3359 `(mouse-face highlight follow-link t
3360 help-echo (format "mouse-2: Jump to (visit) file `%s'" ,filep))))
3361 ((and buffp (get-buffer buffp) (equal filep bmkp-non-file-filename)) ; Buffer
3362 (append (bmkp-face-prop 'bmkp-buffer)
3363 `(mouse-face highlight follow-link t
3364 help-echo (format "mouse-2: Jump to buffer `%s'" ,buffp))))
3365 ((and buffp (or (not filep) (equal filep bmkp-non-file-filename)
3366 (not (file-exists-p filep)))) ; Buffer bookmark, but no buffer.
3367 (append (bmkp-face-prop 'bmkp-non-file)
3368 `(mouse-face highlight follow-link t
3369 help-echo (format "mouse-2: Jump to buffer `%s'" ,buffp))))
3370 (t (append (bmkp-face-prop 'bmkp-bad-bookmark)
3371 `(mouse-face highlight follow-link t
3372 help-echo (format "BAD BOOKMARK (maybe): `%s'" ,filep))))))
3376 (defun bmkp-bmenu-quit () ; Bound to `q' in bookmark list
3377 "Quit the bookmark list (aka \"menu list\").
3378 If `bmkp-bmenu-state-file' is non-nil, then save the state, to be
3379 restored the next time the bookmark list is shown. Otherwise, reset
3380 the internal lists that record menu-list markings."
3382 (bmkp-bmenu-barf-if-not-in-menu-list)
3383 (if (not bmkp-bmenu-state-file)
3384 (setq bmkp-bmenu-marked-bookmarks ()
3385 bmkp-bmenu-before-hide-marked-alist ()
3386 bmkp-bmenu-before-hide-unmarked-alist ())
3387 (bmkp-save-menu-list-state)
3388 (setq bmkp-bmenu-first-time-p t))
3391 (defun bmkp-bmenu-goto-bookmark-named (name)
3392 "Go to the first bookmark whose name matches NAME (a string).
3393 If NAME has non-nil property `bmkp-full-record' then go to the
3394 bookmark it indicates. Otherwise, just go to the first bookmark with
3396 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3397 (let ((full (get-text-property 0 'bmkp-full-record name)))
3398 (while (and (not (eobp))
3400 (equal full (get-text-property 0 'bmkp-full-record (bookmark-bmenu-bookmark)))
3401 (equal name (bookmark-bmenu-bookmark)))))
3403 (bookmark-bmenu-ensure-position)) ; Just in case we fall off the end.
3405 ;; This is a general function. It is in this file because it is used only by the bmenu code.
3406 (defun bmkp-bmenu-barf-if-not-in-menu-list ()
3407 "Raise an error if current buffer is not `*Bookmark List*'."
3408 (unless (equal (buffer-name (current-buffer)) "*Bookmark List*")
3409 (error "You can only use this command in buffer `*Bookmark List*'")))
3412 ;;(@* "Sorting - Commands")
3413 ;; *** Sorting - Commands ***
3416 (defun bmkp-bmenu-change-sort-order-repeat (arg) ; Bound to `s s'... in bookmark list
3417 "Cycle to the next sort order.
3418 With a prefix arg, reverse current sort order.
3419 This is a repeatable version of `bmkp-bmenu-change-sort-order'."
3422 (bmkp-repeat-command 'bmkp-bmenu-change-sort-order))
3425 (defun bmkp-bmenu-change-sort-order (&optional arg)
3426 "Cycle to the next sort order.
3427 With a prefix arg, reverse the current sort order."
3429 (bmkp-bmenu-barf-if-not-in-menu-list)
3430 (setq bmkp-sort-orders-for-cycling-alist (delq nil bmkp-sort-orders-for-cycling-alist))
3432 (bmkp-reverse-sort-order)
3433 (let ((current-bmk (bookmark-bmenu-bookmark))
3435 (let ((orders (mapcar #'car bmkp-sort-orders-for-cycling-alist)))
3436 (setq next-order (or (cadr (member (bmkp-current-sort-order) orders)) (car orders))
3437 bmkp-sort-comparer (cdr (assoc next-order bmkp-sort-orders-for-cycling-alist))))
3438 (message "Sorting...")
3439 (bookmark-bmenu-surreptitiously-rebuild-list)
3440 (when current-bmk ; Put cursor back on the right line.
3441 (bmkp-bmenu-goto-bookmark-named current-bmk))
3442 (when (interactive-p) (bmkp-msg-about-sort-order next-order)))))
3444 ;; This is a general command. It is in this file because it is used only by the bmenu code.
3446 (defun bmkp-reverse-sort-order () ; Bound to `s r' in bookmark list
3447 "Reverse the current bookmark sort order.
3448 If you combine this with \\<bookmark-bmenu-mode-map>\
3449 `\\[bmkp-reverse-multi-sort-order]', then see the doc for that command."
3451 (bmkp-bmenu-barf-if-not-in-menu-list)
3452 (setq bmkp-reverse-sort-p (not bmkp-reverse-sort-p))
3453 (let ((current-bmk (bookmark-bmenu-bookmark)))
3454 (bookmark-bmenu-surreptitiously-rebuild-list)
3455 (when current-bmk ; Put cursor back on the right line.
3456 (bmkp-bmenu-goto-bookmark-named current-bmk)))
3457 (when (interactive-p) (bmkp-msg-about-sort-order (bmkp-current-sort-order))))
3459 ;; This is a general command. It is in this file because it is used only by the bmenu code.
3461 (defun bmkp-reverse-multi-sort-order () ; Bound to `s C-r' in bookmark list
3462 "Reverse the application of multi-sorting predicates.
3463 These are the PRED predicates described for option
3464 `bmkp-sort-comparer'.
3466 This reverses the order in which the predicates are tried, and it
3467 also complements the truth value returned by each predicate.
3469 For example, if the list of multi-sorting predicates is (p1 p2 p3),
3470 then the predicates are tried in the order: p3, p2, p1. And if a
3471 predicate returns true, `(t)', then the effect is as if it returned
3472 false, `(nil)', and vice versa.
3474 The use of multi-sorting predicates tends to group bookmarks, with the
3475 first predicate corresponding to the first bookmark group etc.
3477 The effect of \\<bookmark-bmenu-mode-map>`\\[bmkp-reverse-multi-sort-order]' is \
3480 - without also `\\[bmkp-reverse-sort-order]', it reverses the bookmark order in each \
3483 - combined with `\\[bmkp-reverse-sort-order]', it reverses the order of the bookmark
3484 groups, but not the bookmarks within a group
3486 This is a rough description. The actual behavior can be complex,
3487 because of how each predicate is defined. If this description helps
3488 you, fine. If not, just experiment and see what happens. \;-)
3490 Remember that ordinary `\\[bmkp-reverse-sort-order]' reversal on its own is \
3492 If you find `\\[bmkp-reverse-multi-sort-order]' confusing or not helpful, then do not \
3495 (bmkp-bmenu-barf-if-not-in-menu-list)
3496 (setq bmkp-reverse-multi-sort-p (not bmkp-reverse-multi-sort-p))
3497 (let ((current-bmk (bookmark-bmenu-bookmark)))
3498 (bookmark-bmenu-surreptitiously-rebuild-list)
3499 (when current-bmk ; Put cursor back on the right line.
3500 (bmkp-bmenu-goto-bookmark-named current-bmk)))
3501 (when (interactive-p) (bmkp-msg-about-sort-order (bmkp-current-sort-order))))
3505 ;; The ORDER of the macro calls here defines the REVERSE ORDER of
3506 ;; `bmkp-sort-orders-alist'. The first here is thus also the DEFAULT sort order.
3507 ;; Entries are traversed by `s s'..., in `bmkp-sort-orders-alist' order.
3509 (bmkp-define-sort-command ; Bound to `s k' in bookmark list (`k' for "kind")
3510 "by bookmark type" ; `bmkp-bmenu-sort-by-bookmark-type'
3511 ((bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp)
3513 "Sort bookmarks by type: Info, URL, Gnus, files, other.")
3515 (bmkp-define-sort-command ; Bound to `s u' in bookmark list
3516 "by url" ; `bmkp-bmenu-sort-by-url'
3517 ((bmkp-url-cp) bmkp-alpha-p)
3518 "Sort URL bookmarks alphabetically by their URL/filename.
3519 When two bookmarks are not comparable this way, compare them by
3522 ;; $$$$$$ Not used now.
3523 ;; (bmkp-define-sort-command ; Bound to `s w' in bookmark list
3524 ;; "by w3m url" ; `bmkp-bmenu-sort-by-w3m-url'
3525 ;; ((bmkp-w3m-cp) bmkp-alpha-p)
3526 ;; "Sort W3M bookmarks alphabetically by their URL/filename.
3527 ;; When two bookmarks are not comparable this way, compare them by
3530 (bmkp-define-sort-command ; Bound to `s g' in bookmark list
3531 "by Gnus thread" ; `bmkp-bmenu-sort-by-Gnus-thread'
3532 ((bmkp-gnus-cp) bmkp-alpha-p)
3533 "Sort Gnus bookmarks by group, then by article, then by message.
3534 When two bookmarks are not comparable this way, compare them by
3537 (bmkp-define-sort-command ; Bound to `s i' in bookmark list
3538 "by Info location" ; `bmkp-bmenu-sort-by-Info-location'
3539 ((bmkp-info-cp) bmkp-alpha-p)
3540 "Sort Info bookmarks by file name, then node name, then position.
3541 When two bookmarks are not comparable this way, compare them by
3544 (bmkp-define-sort-command ; Bound to `s f u' in bookmark list
3545 "by last local file update" ; `bmkp-bmenu-sort-by-last-local-file-update'
3546 ((bmkp-local-file-updated-more-recently-cp) bmkp-alpha-p)
3547 "Sort bookmarks by last local file update time.
3548 Sort a local file before a remote file, and a remote file before other
3549 bookmarks. Otherwise, sort by bookmark name.")
3551 (bmkp-define-sort-command ; Bound to `s f t' in bookmark list
3552 "by last local file access" ; `bmkp-bmenu-sort-by-last-local-file-access'
3553 ((bmkp-local-file-accessed-more-recently-cp) bmkp-alpha-p)
3554 "Sort bookmarks by last local file access time.
3555 A local file sorts before a remote file, which sorts before other
3556 bookmarks. Otherwise, sort by bookmark name.")
3558 (bmkp-define-sort-command ; Bound to `s f s' in bookmark list
3559 "by local file size" ; `bmkp-bmenu-sort-by-local-file-size'
3560 ((bmkp-local-file-size-cp) bmkp-alpha-p)
3561 "Sort bookmarks by local file size.
3562 A local file sorts before a remote file, which sorts before other
3563 bookmarks. Otherwise, sort by bookmark name.")
3565 (bmkp-define-sort-command ; Bound to `s f n' in bookmark list
3566 "by file name" ; `bmkp-bmenu-sort-by-file-name'
3567 ((bmkp-file-alpha-cp) bmkp-alpha-p)
3568 "Sort bookmarks by file name.
3569 When two bookmarks are not comparable by file name, compare them by
3572 (bmkp-define-sort-command ; Bound to `s f d' in bookmark list (`d' for "directory")
3573 "by local file type" ; `bmkp-bmenu-sort-by-local-file-type'
3574 ((bmkp-local-file-type-cp) bmkp-alpha-p)
3575 "Sort bookmarks by local file type: file, symlink, directory.
3576 A local file sorts before a remote file, which sorts before other
3577 bookmarks. Otherwise, sort by bookmark name.")
3579 (bmkp-define-sort-command ; Bound to `s >' in bookmark list
3580 "marked before unmarked" ; `bmkp-bmenu-sort-marked-before-unmarked'
3581 ((bmkp-marked-cp) bmkp-alpha-p)
3582 "Sort bookmarks by putting marked before unmarked.
3583 Otherwise alphabetize by bookmark name.")
3585 (bmkp-define-sort-command ; Bound to `s b' in bookmark list
3586 "by last buffer or file access" ; `bmkp-bmenu-sort-by-last-buffer-or-file-access'
3587 ((bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp)
3589 "Sort bookmarks by last buffer access or last local file access.
3590 Sort a bookmark accessed more recently before one accessed less
3591 recently or not accessed. Sort a bookmark to an existing buffer
3592 before a local file bookmark. When two bookmarks are not comparable
3593 by such critera, sort them by bookmark name. (In particular, sort
3594 remote-file bookmarks by bookmark name.")
3596 (bmkp-define-sort-command ; Bound to `s v' in bookmark list
3597 "by bookmark visit frequency" ; `bmkp-bmenu-sort-by-bookmark-visit-frequency'
3598 ((bmkp-visited-more-cp) bmkp-alpha-p)
3599 "Sort bookmarks by the number of times they were visited as bookmarks.
3600 When two bookmarks are not comparable by visit frequency, compare them
3603 (bmkp-define-sort-command ; Bound to `s t' in bookmark list
3604 "by last bookmark access" ; `bmkp-bmenu-sort-by-last-bookmark-access'
3605 ((bmkp-bookmark-last-access-cp) bmkp-alpha-p)
3606 "Sort bookmarks by the time of their last visit as bookmarks.
3607 When two bookmarks are not comparable by visit time, compare them
3610 (bmkp-define-sort-command ; Bound to `s 0' in bookmark list
3611 "by creation time" ; `bmkp-bmenu-sort-by-creation-time'
3612 ((bmkp-bookmark-creation-cp) bmkp-alpha-p)
3613 "Sort bookmarks by the time of their creation.
3614 When one or both of the bookmarks does not have a `created' entry),
3615 compare them by bookmark name.")
3617 (bmkp-define-sort-command ; Bound to `s n' in bookmark list
3618 "by bookmark name" ; `bmkp-bmenu-sort-by-bookmark-name'
3620 "Sort bookmarks by bookmark name, respecting `case-fold-search'.")
3622 ;; This is a general option. It is in this file because it is used mainly by the bmenu code.
3623 ;; Its definitions MUST COME AFTER the calls to macro `bmkp-define-sort-command'.
3624 ;; Otherwise, they won't pick up a populated `bmkp-sort-orders-alist'.
3625 (when (> emacs-major-version 20)
3626 (defcustom bmkp-sort-orders-for-cycling-alist (copy-sequence bmkp-sort-orders-alist)
3627 "*Alist of sort orders used for cycling via `s s'...
3628 This is a subset of the complete list of available sort orders,
3629 `bmkp-sort-orders-alist'. This lets you cycle among fewer sort
3630 orders, if there are some that you do not use often.
3632 See the doc for `bmkp-sort-orders-alist', for the structure of
3635 :key-type (choice :tag "Sort order" string symbol)
3637 (const :tag "None (do not sort)" nil)
3638 (function :tag "Sorting Predicate")
3639 (list :tag "Sorting Multi-Predicate"
3640 (repeat (function :tag "Component Predicate"))
3642 (const :tag "None" nil)
3643 (function :tag "Final Predicate")))))
3644 :group 'bookmark-plus))
3646 (unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist.
3647 (defcustom bmkp-sort-orders-for-cycling-alist (copy-sequence bmkp-sort-orders-alist)
3648 "*Alist of sort orders used for cycling via `s s'...
3649 This is a subset of the complete list of available sort orders,
3650 `bmkp-sort-orders-alist'. This lets you cycle among fewer sort
3651 orders, if there are some that you do not use often.
3653 See the doc for `bmkp-sort-orders-alist', for the structure of this
3657 (choice :tag "Sort order" string symbol)
3659 (const :tag "None (do not sort)" nil)
3660 (function :tag "Sorting Predicate")
3661 (list :tag "Sorting Multi-Predicate"
3662 (repeat (function :tag "Component Predicate"))
3664 (const :tag "None" nil)
3665 (function :tag "Final Predicate"))))))
3666 :group 'bookmark-plus))
3669 ;;(@* "Other Bookmark+ Functions (`bmkp-*')")
3670 ;; *** Other Bookmark+ Functions (`bmkp-*') ***
3673 (defun bmkp-bmenu-describe-this+move-down (&optional defn) ; Bound to `C-down' in bookmark list
3674 "Describe bookmark of current line, then move down to the next bookmark.
3675 With a prefix argument, show the internal definition of the bookmark."
3677 (bmkp-bmenu-describe-this-bookmark) (forward-line 1))
3680 (defun bmkp-bmenu-describe-this+move-up (&optional defn) ; Bound to `C-up' in bookmark list
3681 "Describe bookmark of current line, then move down to the next bookmark.
3682 With a prefix argument, show the internal definition of the bookmark."
3684 (bmkp-bmenu-describe-this-bookmark) (forward-line -1))
3687 (defun bmkp-bmenu-describe-this-bookmark (&optional defn) ; Bound to `C-h RET' in bookmark list
3688 "Describe bookmark of current line.
3689 With a prefix argument, show the internal definition of the bookmark."
3691 (bmkp-bmenu-barf-if-not-in-menu-list)
3693 (bmkp-describe-bookmark-internals (bookmark-bmenu-bookmark))
3694 (bmkp-describe-bookmark (bookmark-bmenu-bookmark))))
3697 (defun bmkp-bmenu-describe-marked (&optional defn) ; Bound to `C-h >' in bookmark list
3698 "Describe the marked bookmarks.
3699 With a prefix argument, show the internal definitions."
3701 (bmkp-bmenu-barf-if-not-in-menu-list)
3702 (help-setup-xref (list #'bmkp-describe-bookmark-marked) (interactive-p))
3703 (with-output-to-temp-buffer "*Help*"
3704 (dolist (bmk (bmkp-marked-bookmarks-only))
3706 (let* ((bname (bookmark-name-from-full-record bmk))
3707 (help-text (format "%s\n%s\n\n%s" bname (make-string (length bname) ?-)
3708 (pp-to-string bmk))))
3709 (princ help-text) (terpri))
3710 (princ (bmkp-bookmark-description bmk)) (terpri)))))
3712 (defun bmkp-bmenu-get-marked-files ()
3713 "Return a list of the file names of the marked bookmarks.
3714 Marked bookmarks that have no associated file are ignored."
3716 (dolist (bmk bmkp-bmenu-marked-bookmarks)
3717 (when (bmkp-file-bookmark-p bmk) (push (bookmark-get-filename bmk) files)))
3721 ;;; Keymaps ----------------------------------------------------------
3723 ;; `bookmark-bmenu-mode-map'
3725 (when (< emacs-major-version 21)
3726 (define-key bookmark-bmenu-mode-map (kbd "RET") 'bookmark-bmenu-this-window))
3727 (define-key bookmark-bmenu-mode-map "." 'bmkp-bmenu-show-all)
3728 (define-key bookmark-bmenu-mode-map ">" 'bmkp-bmenu-toggle-show-only-marked)
3729 (define-key bookmark-bmenu-mode-map "<" 'bmkp-bmenu-toggle-show-only-unmarked)
3730 (define-key bookmark-bmenu-mode-map (kbd "M-<DEL>") 'bmkp-bmenu-unmark-all)
3731 (define-key bookmark-bmenu-mode-map "=" nil) ; For Emacs 20
3732 (define-key bookmark-bmenu-mode-map "=bM" 'bmkp-bmenu-mark-specific-buffer-bookmarks)
3733 (define-key bookmark-bmenu-mode-map "=fM" 'bmkp-bmenu-mark-specific-file-bookmarks)
3734 (define-key bookmark-bmenu-mode-map "=bS" 'bmkp-bmenu-show-only-specific-buffer)
3735 (define-key bookmark-bmenu-mode-map "=fS" 'bmkp-bmenu-show-only-specific-file)
3736 (define-key bookmark-bmenu-mode-map "%" nil) ; For Emacs 20
3737 (define-key bookmark-bmenu-mode-map "%m" 'bmkp-bmenu-regexp-mark)
3738 (define-key bookmark-bmenu-mode-map "*" nil) ; For Emacs 20
3739 (when (< emacs-major-version 21)
3740 (define-key bookmark-bmenu-mode-map "*m" 'bookmark-bmenu-mark))
3741 (define-key bookmark-bmenu-mode-map "#" nil) ; For Emacs 20
3742 (define-key bookmark-bmenu-mode-map "#S" 'bmkp-bmenu-show-only-autonamed)
3743 ;; `A' is `bookmark-bmenu-show-all-annotations' in vanilla Emacs.
3744 (define-key bookmark-bmenu-mode-map "\M-a" 'bookmark-bmenu-show-all-annotations)
3745 (define-key bookmark-bmenu-mode-map "A" nil) ; For Emacs 20
3746 (define-key bookmark-bmenu-mode-map "AM" 'bmkp-bmenu-mark-autofile-bookmarks)
3747 (define-key bookmark-bmenu-mode-map "AS" 'bmkp-bmenu-show-only-autofiles)
3748 (define-key bookmark-bmenu-mode-map "B" nil) ; For Emacs 20
3749 (define-key bookmark-bmenu-mode-map "BM" 'bmkp-bmenu-mark-non-file-bookmarks)
3750 (define-key bookmark-bmenu-mode-map "BS" 'bmkp-bmenu-show-only-non-files)
3751 (define-key bookmark-bmenu-mode-map "c" 'bmkp-bmenu-define-command)
3752 (define-key bookmark-bmenu-mode-map "C" 'bmkp-bmenu-define-full-snapshot-command)
3753 (define-key bookmark-bmenu-mode-map "\M-c" 'bmkp-bmenu-define-jump-marked-command)
3754 (define-key bookmark-bmenu-mode-map "D" 'bmkp-bmenu-delete-marked)
3755 (define-key bookmark-bmenu-mode-map "\M-d" nil) ; For Emacs 20
3756 (define-key bookmark-bmenu-mode-map "\M-d>" 'bmkp-bmenu-dired-marked)
3757 (define-key bookmark-bmenu-mode-map "\M-d\M-m" 'bmkp-bmenu-mark-dired-bookmarks)
3758 (define-key bookmark-bmenu-mode-map "\M-d\M-s" 'bmkp-bmenu-show-only-dired)
3759 (define-key bookmark-bmenu-mode-map "E" 'bmkp-bmenu-edit-bookmark)
3760 (define-key bookmark-bmenu-mode-map "F" nil) ; For Emacs 20
3761 (define-key bookmark-bmenu-mode-map "FM" 'bmkp-bmenu-mark-file-bookmarks)
3762 (define-key bookmark-bmenu-mode-map "FS" 'bmkp-bmenu-show-only-files)
3763 (define-key bookmark-bmenu-mode-map "g" 'bmkp-bmenu-refresh-menu-list)
3764 (define-key bookmark-bmenu-mode-map "G" nil) ; For Emacs 20
3765 (define-key bookmark-bmenu-mode-map "GM" 'bmkp-bmenu-mark-gnus-bookmarks)
3766 (define-key bookmark-bmenu-mode-map "GS" 'bmkp-bmenu-show-only-gnus)
3767 (if (fboundp 'command-remapping)
3768 (define-key bookmark-bmenu-mode-map [remap describe-mode] 'bmkp-bmenu-mode-status-help)
3769 ;; In Emacs < 22, the `substitute-...' affects only `?', not `C-h m', so we add it separately.
3770 (substitute-key-definition 'describe-mode 'bmkp-bmenu-mode-status-help bookmark-bmenu-mode-map)
3771 (define-key bookmark-bmenu-mode-map "\C-hm" 'bmkp-bmenu-mode-status-help))
3772 (define-key bookmark-bmenu-mode-map (kbd "C-h >") 'bmkp-bmenu-describe-marked)
3773 (define-key bookmark-bmenu-mode-map (kbd "C-h RET") 'bmkp-bmenu-describe-this-bookmark)
3774 (define-key bookmark-bmenu-mode-map (kbd "C-h C-<return>") 'bmkp-bmenu-describe-this-bookmark)
3775 (define-key bookmark-bmenu-mode-map (kbd "C-<down>") 'bmkp-bmenu-describe-this+move-down)
3776 (define-key bookmark-bmenu-mode-map (kbd "C-<up>") 'bmkp-bmenu-describe-this+move-up)
3777 (define-key bookmark-bmenu-mode-map (kbd "M-<return>") 'bmkp-bmenu-w32-open)
3778 (define-key bookmark-bmenu-mode-map [M-mouse-2] 'bmkp-bmenu-w32-open-with-mouse)
3779 (when (featurep 'bookmark+-lit)
3780 (define-key bookmark-bmenu-mode-map "H" nil) ; For Emacs 20
3781 (define-key bookmark-bmenu-mode-map "H+" 'bmkp-bmenu-set-lighting)
3782 (define-key bookmark-bmenu-mode-map "H>+" 'bmkp-bmenu-set-lighting-for-marked)
3783 (define-key bookmark-bmenu-mode-map "H>H" 'bmkp-bmenu-light-marked)
3784 (define-key bookmark-bmenu-mode-map "HH" 'bmkp-bmenu-light)
3785 (define-key bookmark-bmenu-mode-map "HM" 'bmkp-bmenu-mark-lighted-bookmarks)
3786 (define-key bookmark-bmenu-mode-map "HS" 'bmkp-bmenu-show-only-lighted)
3787 (define-key bookmark-bmenu-mode-map "H>U" 'bmkp-bmenu-unlight-marked)
3788 (define-key bookmark-bmenu-mode-map "HU" 'bmkp-bmenu-unlight))
3789 (define-key bookmark-bmenu-mode-map "I" nil) ; For Emacs 20
3790 (define-key bookmark-bmenu-mode-map "IM" 'bmkp-bmenu-mark-info-bookmarks)
3791 (define-key bookmark-bmenu-mode-map "IS" 'bmkp-bmenu-show-only-info-nodes)
3792 (define-key bookmark-bmenu-mode-map "K" nil) ; For Emacs 20
3793 (define-key bookmark-bmenu-mode-map "KM" 'bmkp-bmenu-mark-desktop-bookmarks)
3794 (define-key bookmark-bmenu-mode-map "KS" 'bmkp-bmenu-show-only-desktops)
3795 (define-key bookmark-bmenu-mode-map "L" 'bmkp-switch-bookmark-file)
3796 (define-key bookmark-bmenu-mode-map "M" nil) ; For Emacs 20
3797 (define-key bookmark-bmenu-mode-map "MM" 'bmkp-bmenu-mark-man-bookmarks)
3798 (define-key bookmark-bmenu-mode-map "MS" 'bmkp-bmenu-show-only-man-pages)
3799 (define-key bookmark-bmenu-mode-map "\M-m" 'bmkp-bmenu-mark-all)
3800 (define-key bookmark-bmenu-mode-map "O" nil) ; For Emacs 20
3801 (define-key bookmark-bmenu-mode-map "O>" 'bmkp-bmenu-omit/unomit-marked)
3802 (define-key bookmark-bmenu-mode-map "OS" 'bmkp-bmenu-show-only-omitted)
3803 (define-key bookmark-bmenu-mode-map "OU" 'bmkp-unomit-all)
3804 (define-key bookmark-bmenu-mode-map "P" nil) ; For Emacs 20
3805 (define-key bookmark-bmenu-mode-map "PA" 'bmkp-bmenu-filter-annotation-incrementally)
3806 (define-key bookmark-bmenu-mode-map "PB" 'bmkp-bmenu-filter-bookmark-name-incrementally)
3807 (define-key bookmark-bmenu-mode-map "PF" 'bmkp-bmenu-filter-file-name-incrementally)
3808 (define-key bookmark-bmenu-mode-map "PT" 'bmkp-bmenu-filter-tags-incrementally)
3809 (define-key bookmark-bmenu-mode-map "q" 'bmkp-bmenu-quit)
3810 (define-key bookmark-bmenu-mode-map "\M-q" 'bmkp-bmenu-query-replace-marked-bookmarks-regexp)
3811 (define-key bookmark-bmenu-mode-map "R" nil) ; For Emacs 20
3812 (define-key bookmark-bmenu-mode-map "RM" 'bmkp-bmenu-mark-region-bookmarks)
3813 (define-key bookmark-bmenu-mode-map "RS" 'bmkp-bmenu-show-only-regions)
3814 (define-key bookmark-bmenu-mode-map "\M-r" 'bookmark-bmenu-relocate) ; `R' in Emacs
3815 (define-key bookmark-bmenu-mode-map "S" 'bookmark-bmenu-save) ; `s' in Emacs
3816 (define-key bookmark-bmenu-mode-map "s" nil) ; For Emacs 20
3817 (define-key bookmark-bmenu-mode-map "s>" 'bmkp-bmenu-sort-marked-before-unmarked)
3818 (define-key bookmark-bmenu-mode-map "s0" 'bmkp-bmenu-sort-by-creation-time)
3819 (define-key bookmark-bmenu-mode-map "sb" 'bmkp-bmenu-sort-by-last-buffer-or-file-access)
3820 (define-key bookmark-bmenu-mode-map "sfd" 'bmkp-bmenu-sort-by-local-file-type)
3821 (define-key bookmark-bmenu-mode-map "sfn" 'bmkp-bmenu-sort-by-file-name)
3822 (define-key bookmark-bmenu-mode-map "sfs" 'bmkp-bmenu-sort-by-local-file-size)
3823 (define-key bookmark-bmenu-mode-map "sft" 'bmkp-bmenu-sort-by-last-local-file-access)
3824 (define-key bookmark-bmenu-mode-map "sfu" 'bmkp-bmenu-sort-by-last-local-file-update)
3825 (define-key bookmark-bmenu-mode-map "sg" 'bmkp-bmenu-sort-by-Gnus-thread)
3826 (define-key bookmark-bmenu-mode-map "si" 'bmkp-bmenu-sort-by-Info-location)
3827 (define-key bookmark-bmenu-mode-map "sk" 'bmkp-bmenu-sort-by-bookmark-type)
3828 (define-key bookmark-bmenu-mode-map "sn" 'bmkp-bmenu-sort-by-bookmark-name)
3829 (define-key bookmark-bmenu-mode-map "sr" 'bmkp-reverse-sort-order)
3830 (define-key bookmark-bmenu-mode-map "s\C-r" 'bmkp-reverse-multi-sort-order)
3831 (define-key bookmark-bmenu-mode-map "ss" 'bmkp-bmenu-change-sort-order-repeat)
3832 (define-key bookmark-bmenu-mode-map "st" 'bmkp-bmenu-sort-by-last-bookmark-access)
3833 (define-key bookmark-bmenu-mode-map "su" 'bmkp-bmenu-sort-by-url)
3834 (define-key bookmark-bmenu-mode-map "sv" 'bmkp-bmenu-sort-by-bookmark-visit-frequency)
3835 ;; ;; (define-key bookmark-bmenu-mode-map "sw" 'bmkp-bmenu-sort-by-w3m-url)
3836 (when (> emacs-major-version 22) ; Emacs 23+
3837 (define-key bookmark-bmenu-mode-map (kbd "M-s a C-s") 'bmkp-bmenu-isearch-marked-bookmarks)
3838 (define-key bookmark-bmenu-mode-map (kbd "M-s a M-C-s") 'bmkp-bmenu-isearch-marked-bookmarks-regexp))
3839 (define-key bookmark-bmenu-mode-map (kbd "M-s a M-s") 'bmkp-bmenu-search-marked-bookmarks-regexp)
3840 (define-key bookmark-bmenu-mode-map "T" nil) ; For Emacs20
3841 (define-key bookmark-bmenu-mode-map "T>+" 'bmkp-bmenu-add-tags-to-marked)
3842 (define-key bookmark-bmenu-mode-map "T>-" 'bmkp-bmenu-remove-tags-from-marked)
3843 (define-key bookmark-bmenu-mode-map "T>p" 'bmkp-bmenu-paste-add-tags-to-marked)
3844 (define-key bookmark-bmenu-mode-map "T>q" 'bmkp-bmenu-paste-replace-tags-for-marked)
3845 (define-key bookmark-bmenu-mode-map "T>v" 'bmkp-bmenu-set-tag-value-for-marked)
3846 (define-key bookmark-bmenu-mode-map "T>\C-y" 'bmkp-bmenu-paste-add-tags-to-marked)
3847 (define-key bookmark-bmenu-mode-map "T0" 'bmkp-remove-all-tags)
3848 (define-key bookmark-bmenu-mode-map "T+" 'bmkp-add-tags)
3849 (define-key bookmark-bmenu-mode-map "T-" 'bmkp-remove-tags)
3850 (define-key bookmark-bmenu-mode-map "Tc" 'bmkp-bmenu-copy-tags)
3851 (define-key bookmark-bmenu-mode-map "Td" 'bmkp-remove-tags-from-all)
3852 (define-key bookmark-bmenu-mode-map "Te" 'bmkp-bmenu-edit-tags)
3853 (define-key bookmark-bmenu-mode-map "Tl" 'bmkp-list-all-tags)
3854 (define-key bookmark-bmenu-mode-map "Tm*" 'bmkp-bmenu-mark-bookmarks-tagged-all)
3855 (define-key bookmark-bmenu-mode-map "Tm%" 'bmkp-bmenu-mark-bookmarks-tagged-regexp)
3856 (define-key bookmark-bmenu-mode-map "Tm+" 'bmkp-bmenu-mark-bookmarks-tagged-some)
3857 (define-key bookmark-bmenu-mode-map "Tm~*" 'bmkp-bmenu-mark-bookmarks-tagged-not-all)
3858 (define-key bookmark-bmenu-mode-map "Tm~+" 'bmkp-bmenu-mark-bookmarks-tagged-none)
3859 (define-key bookmark-bmenu-mode-map "Tp" 'bmkp-bmenu-paste-add-tags)
3860 (define-key bookmark-bmenu-mode-map "Tq" 'bmkp-bmenu-paste-replace-tags)
3861 (define-key bookmark-bmenu-mode-map "Tr" 'bmkp-rename-tag)
3862 (define-key bookmark-bmenu-mode-map "Ts" 'bmkp-define-tags-sort-command)
3863 (define-key bookmark-bmenu-mode-map "TS" 'bmkp-bmenu-show-only-tagged)
3864 (define-key bookmark-bmenu-mode-map "Tu*" 'bmkp-bmenu-unmark-bookmarks-tagged-all)
3865 (define-key bookmark-bmenu-mode-map "Tu%" 'bmkp-bmenu-unmark-bookmarks-tagged-regexp)
3866 (define-key bookmark-bmenu-mode-map "Tu+" 'bmkp-bmenu-unmark-bookmarks-tagged-some)
3867 (define-key bookmark-bmenu-mode-map "Tu~*" 'bmkp-bmenu-unmark-bookmarks-tagged-not-all)
3868 (define-key bookmark-bmenu-mode-map "Tu~+" 'bmkp-bmenu-unmark-bookmarks-tagged-none)
3869 (define-key bookmark-bmenu-mode-map "Tv" 'bmkp-bmenu-set-tag-value)
3870 (define-key bookmark-bmenu-mode-map "T\M-w" 'bmkp-bmenu-copy-tags)
3871 (define-key bookmark-bmenu-mode-map "T\C-y" 'bmkp-bmenu-paste-add-tags)
3872 (define-key bookmark-bmenu-mode-map "\M-l" 'bmkp-toggle-saving-menu-list-state)
3873 (define-key bookmark-bmenu-mode-map "\M-~" 'bmkp-toggle-saving-bookmark-file)
3874 (define-key bookmark-bmenu-mode-map "\M-t" 'bookmark-bmenu-toggle-filenames) ; `t' in Emacs
3875 (define-key bookmark-bmenu-mode-map "t" 'bmkp-bmenu-toggle-marks)
3876 (define-key bookmark-bmenu-mode-map "U" 'bmkp-bmenu-unmark-all)
3877 (define-key bookmark-bmenu-mode-map "\M-u" nil) ; For Emacs 20
3878 (define-key bookmark-bmenu-mode-map "\M-u\M-m" 'bmkp-bmenu-mark-url-bookmarks)
3879 (define-key bookmark-bmenu-mode-map "\M-u\M-s" 'bmkp-bmenu-show-only-urls)
3880 (define-key bookmark-bmenu-mode-map "V" nil) ; For Emacs20
3881 (define-key bookmark-bmenu-mode-map "VS" 'bmkp-bmenu-show-only-variable-lists)
3882 (define-key bookmark-bmenu-mode-map "\M-o" 'bmkp-bmenu-w32-open-select)
3883 (define-key bookmark-bmenu-mode-map "W" nil) ; For Emacs 20
3884 (define-key bookmark-bmenu-mode-map "WM" 'bmkp-bmenu-mark-w3m-bookmarks)
3885 (define-key bookmark-bmenu-mode-map "WS" 'bmkp-bmenu-show-only-w3m-urls)
3886 (define-key bookmark-bmenu-mode-map "X" nil) ; For Emacs 20
3887 (define-key bookmark-bmenu-mode-map "XM" 'bmkp-bmenu-mark-bookmark-file-bookmarks)
3888 (define-key bookmark-bmenu-mode-map "XS" 'bmkp-bmenu-show-only-bookmark-files)
3891 ;;; `Bookmark+' menu-bar menu in `*Bookmark List*'
3893 (defvar bmkp-bmenu-menubar-menu (make-sparse-keymap "Bookmark+") "`Boomark+' menu-bar menu.")
3894 (define-key bookmark-bmenu-mode-map [menu-bar bmkp]
3895 (cons "Bookmark+" bmkp-bmenu-menubar-menu))
3898 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-quit]
3899 '(menu-item "Quit" bmkp-bmenu-quit
3900 :help "Quit the bookmark list, saving its state and the current set of bookmarks"))
3901 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-describe-marked]
3902 '(menu-item "Describe Marked Bookmarks" bmkp-bmenu-describe-marked
3903 :help "Describe the marked bookmarks. With `C-u' show internal format."))
3904 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-describe-this-bookmark]
3905 '(menu-item "Describe This Bookmark" bmkp-bmenu-describe-this-bookmark
3906 :help "Describe this line's bookmark. With `C-u' show internal format."))
3907 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-mode-status-help]
3908 '(menu-item "Current Status, Mode Help" bmkp-bmenu-mode-status-help :keys "?"
3909 :help "Describe `*Bookmark List*' and show its current status"))
3910 (define-key bmkp-bmenu-menubar-menu [top-sep2] '("--"))
3911 (define-key bmkp-bmenu-menubar-menu [bmkp-toggle-saving-menu-list-state]
3912 '(menu-item "Toggle Autosaving Display State" bmkp-toggle-saving-menu-list-state
3913 :help "Toggle the value of option `bmkp-bmenu-state-file'"))
3914 (define-key bmkp-bmenu-menubar-menu [bmkp-toggle-saving-bookmark-file]
3915 '(menu-item "Toggle Autosaving Bookmark File" bmkp-toggle-saving-bookmark-file
3916 :help "Toggle the value of option `bookmark-save-flag'"))
3917 (define-key bmkp-bmenu-menubar-menu [bmkp-switch-bookmark-file]
3918 '(menu-item "Switch to Bookmark File..." bmkp-switch-bookmark-file
3919 :help "Switch to a different bookmark file, *replacing* the current set of bookmarks"))
3920 (define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-load]
3921 '(menu-item "Add Bookmarks from File..." bookmark-bmenu-load
3922 :help "Load additional bookmarks from a bookmark file"))
3923 (define-key bmkp-bmenu-menubar-menu [bmkp-empty-file]
3924 '(menu-item "New (Empty) Bookmark File..." bmkp-empty-file
3925 :help "Create a new, empty bookmark file, or empty an existing bookmark file"))
3926 (define-key bmkp-bmenu-menubar-menu [bookmark-write]
3927 '(menu-item "Save As..." bookmark-write
3928 :help "Write the current set of bookmarks to a file whose name you enter"))
3929 (define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-save]
3930 '(menu-item "Save" bookmark-bmenu-save
3931 :help "Save the current set of bookmarks to the current bookmark file"))
3932 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-refresh-menu-list]
3933 '(menu-item "Refresh (Revert)" bmkp-bmenu-refresh-menu-list
3934 :help "Update the displayed bookmark list to reflect the currently defined bookmarks"))
3935 (define-key bmkp-bmenu-menubar-menu [top-sep1] '("--"))
3937 (define-key bmkp-bmenu-menubar-menu [bmkp-make-function-bookmark]
3938 '(menu-item "New Function Bookmark..." bmkp-make-function-bookmark
3939 :help "Create a bookmark that will invoke FUNCTION when \"jumped\" to"))
3940 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-make-sequence-from-marked]
3941 '(menu-item "New Sequence Bookmark from Marked..." bmkp-bmenu-make-sequence-from-marked
3942 :help "Create or update a sequence bookmark from the visible marked bookmarks"))
3943 (define-key bmkp-bmenu-menubar-menu [bmkp-choose-navlist-from-bookmark-list]
3944 '(menu-item "Set Navlist from Bookmark-List Bookmark..." bmkp-choose-navlist-from-bookmark-list
3945 :help "Set the navigation list from a bookmark-list bookmark"))
3946 (define-key bmkp-bmenu-menubar-menu [bmkp-choose-navlist-of-type]
3947 '(menu-item "Set Navlist to Bookmarks of Type..." bmkp-choose-navlist-of-type
3948 :help "Set the navigation list to the bookmarks of a certain type"))
3949 (define-key bmkp-bmenu-menubar-menu [bmkp-list-defuns-in-commands-file]
3950 '(menu-item "List User-Defined Bookmark Commands" bmkp-list-defuns-in-commands-file
3951 :help "List the functions defined in `bmkp-bmenu-commands-file'"))
3953 (defvar bmkp-bmenu-define-command-menu (make-sparse-keymap "Define Command")
3954 "`Define Command' submenu for menu-bar `Bookmark+' menu.")
3955 (define-key bmkp-bmenu-menubar-menu [define-command]
3956 (cons "Define Command" bmkp-bmenu-define-command-menu))
3958 (define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-full-snapshot-command]
3959 '(menu-item "To Restore Full Bookmark-List State..." bmkp-bmenu-define-full-snapshot-command
3960 :help "Define a command to restore the current bookmark-list state"))
3961 (define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-command]
3962 '(menu-item "To Restore Current Order and Filter..." bmkp-bmenu-define-command
3963 :help "Define a command to use the current sort order, filter, and omit list"))
3964 (define-key bmkp-bmenu-define-command-menu [bmkp-define-tags-sort-command]
3965 '(menu-item "To Sort by Specific Tags..." bmkp-define-tags-sort-command
3966 :help "Define a command to sort bookmarks in the bookmark list by certain tags"))
3967 (define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-jump-marked-command]
3968 '(menu-item "To Jump to a Bookmark Now Marked..." bmkp-bmenu-define-jump-marked-command
3969 :help "Define a command to jump to one of the bookmarks that is now marked"
3970 :enable bmkp-bmenu-marked-bookmarks))
3972 (when (featurep 'bookmark+-lit)
3973 (defvar bmkp-bmenu-highlight-menu (make-sparse-keymap "Highlight")
3974 "`Highlight' submenu for menu-bar `Bookmark+' menu.")
3975 (define-key bmkp-bmenu-menubar-menu [highlight] (cons "Highlight" bmkp-bmenu-highlight-menu))
3977 (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-show-only-lighted]
3978 '(menu-item "Show Only Highlighted" bmkp-bmenu-show-only-lighted
3979 :help "Display (only) highlighted bookmarks"))
3980 (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-set-lighting-for-marked]
3981 '(menu-item "Set Highlighting for Marked" bmkp-bmenu-set-lighting-for-marked
3982 :help "Set specific highlighting for the marked bookmarks"
3983 :enable bmkp-bmenu-marked-bookmarks))
3984 (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-unlight-marked]
3985 '(menu-item "Unhighlight Marked" bmkp-bmenu-unlight-marked
3986 :help "Unhighlight the marked bookmarks"
3987 :enable bmkp-bmenu-marked-bookmarks))
3988 (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-light-marked]
3989 '(menu-item "Highlight Marked" bmkp-bmenu-light-marked
3990 :help "Highlight the marked bookmarks"
3991 :enable bmkp-bmenu-marked-bookmarks)))
3993 (defvar bmkp-bmenu-tags-menu (make-sparse-keymap "Tags")
3994 "`Tags' submenu for menu-bar `Bookmark+' menu.")
3995 (define-key bmkp-bmenu-menubar-menu [tags] (cons "Tags" bmkp-bmenu-tags-menu))
3997 (define-key bmkp-bmenu-tags-menu [bmkp-list-all-tags]
3998 '(menu-item "List All Tags" bmkp-list-all-tags :help "List all tags used for any bookmarks"))
3999 (define-key bmkp-bmenu-tags-menu [bmkp-purge-notags-autofiles]
4000 '(menu-item "Purge Autofiles with No Tags..." bmkp-purge-notags-autofiles
4001 :help "Delete all autofile bookmarks that have no tags"))
4002 (define-key bmkp-bmenu-tags-menu [bmkp-untag-a-file]
4003 '(menu-item "Untag a File (Remove Some)..." bmkp-untag-a-file
4004 :help "Remove some tags from autofile bookmark for a file"))
4005 (define-key bmkp-bmenu-tags-menu [bmkp-tag-a-file]
4006 '(menu-item "Tag a File (Add Some)..." bmkp-tag-a-file
4007 :help "Add some tags to the autofile bookmark for a file"))
4008 (define-key bmkp-bmenu-tags-menu [bmkp-rename-tag]
4009 '(menu-item "Rename Tag..." bmkp-rename-tag
4010 :help "Rename a tag in all bookmarks, even those not showing"))
4011 (define-key bmkp-bmenu-tags-menu [bmkp-bmenu-set-tag-value-for-marked]
4012 '(menu-item "Set Tag Value for Marked..." bmkp-bmenu-set-tag-value-for-marked
4013 :help "Set the value of a tag, for each of the marked bookmarks"))
4014 (define-key bmkp-bmenu-tags-menu [bmkp-remove-tags-from-all]
4015 '(menu-item "Remove Some Tags from All..." bmkp-remove-tags-from-all
4016 :help "Remove a set of tags from all bookmarks"))
4017 (define-key bmkp-bmenu-tags-menu [bmkp-bmenu-remove-tags-from-marked]
4018 '(menu-item "Remove Some Tags from Marked..." bmkp-bmenu-remove-tags-from-marked
4019 :help "Remove a set of tags from each of the marked bookmarks"))
4020 (define-key bmkp-bmenu-tags-menu [bmkp-bmenu-add-tags-to-marked]
4021 '(menu-item "Add Some Tags to Marked..." bmkp-bmenu-add-tags-to-marked
4022 :help "Add a set of tags to each of the marked bookmarks"))
4023 (define-key bmkp-bmenu-tags-menu [bmkp-bmenu-paste-replace-tags-for-marked]
4024 '(menu-item "Paste Tags to Marked (Replace)..." bmkp-bmenu-paste-replace-tags-for-marked
4025 :help "Replace tags for the marked bookmarks with tags copied previously"))
4026 (define-key bmkp-bmenu-tags-menu [bmkp-bmenu-paste-add-tags-to-marked]
4027 '(menu-item "Paste Tags to Marked (Add)..." bmkp-bmenu-paste-add-tags-to-marked
4028 :help "Add tags copied from another bookmark to the marked bookmarks"))
4030 (defvar bmkp-bmenu-sort-menu (make-sparse-keymap "Sort")
4031 "`Sort' submenu for menu-bar `Bookmark+' menu.")
4032 (define-key bmkp-bmenu-menubar-menu [sort] (cons "Sort" bmkp-bmenu-sort-menu))
4034 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-url]
4035 '(menu-item "By URL" bmkp-bmenu-sort-by-url
4036 :help "Sort URL bookmarks alphabetically by their URL/filename"))
4037 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-Gnus-thread]
4038 '(menu-item "By Gnus Thread" bmkp-bmenu-sort-by-Gnus-thread
4039 :help "Sort Gnus bookmarks by group, then by article, then by message"))
4040 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-Info-location]
4041 '(menu-item "By Info Node" bmkp-bmenu-sort-by-Info-location
4042 :help "Sort Info bookmarks by file name, then node name, then position"))
4043 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-local-file-update]
4044 '(menu-item "By Last Local File Update" bmkp-bmenu-sort-by-last-local-file-update
4045 :help "Sort bookmarks by last local file update time"))
4046 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-buffer-or-file-access]
4047 '(menu-item "By Last Buffer/File Access" bmkp-bmenu-sort-by-last-buffer-or-file-access
4048 :help "Sort bookmarks by time of last buffer access or local-file access"))
4049 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-local-file-size]
4050 '(menu-item "By Local File Size" bmkp-bmenu-sort-by-local-file-size
4051 :help "Sort bookmarks by local file size"))
4052 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-local-file-type]
4053 '(menu-item "By Local File Type" bmkp-bmenu-sort-by-local-file-type
4054 :help "Sort bookmarks by local file type: file, symlink, directory"))
4055 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-type]
4056 '(menu-item "By Type" bmkp-bmenu-sort-by-bookmark-type
4057 :help "Sort bookmarks by type: Info, URL, Gnus, files, other"))
4058 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-file-name]
4059 '(menu-item "By File Name" bmkp-bmenu-sort-by-file-name :help "Sort bookmarks by file name"))
4060 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-name]
4061 '(menu-item "By Bookmark Name" bmkp-bmenu-sort-by-bookmark-name
4062 :help "Sort bookmarks by bookmark name, respecting `case-fold-search'"))
4063 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-creation-time]
4064 '(menu-item "By Creation Time" bmkp-bmenu-sort-by-creation-time
4065 :help "Sort bookmarks by the time of their creation"))
4066 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-bookmark-access]
4067 '(menu-item "By Last Bookmark Access" bmkp-bmenu-sort-by-last-bookmark-access
4068 :help "Sort bookmarks by the time of their last visit as bookmarks"))
4069 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-visit-frequency]
4070 '(menu-item "By Bookmark Use" bmkp-bmenu-sort-by-bookmark-visit-frequency
4071 :help "Sort bookmarks by the number of times they were visited as bookmarks"))
4072 (define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-marked-before-unmarked]
4073 '(menu-item "Marked Before Unmarked" bmkp-bmenu-sort-marked-before-unmarked
4074 :help "Sort bookmarks by putting marked before unmarked"))
4075 (define-key bmkp-bmenu-sort-menu [bmkp-reverse-sort-order]
4076 '(menu-item "Reverse" bmkp-reverse-sort-order :help "Reverse the current bookmark sort order"))
4078 (defvar bmkp-bmenu-show-menu (make-sparse-keymap "Show")
4079 "`Show' submenu for menu-bar `Bookmark+' menu.")
4080 (define-key bmkp-bmenu-menubar-menu [show] (cons "Show" bmkp-bmenu-show-menu))
4082 (define-key bmkp-bmenu-show-menu [bookmark-bmenu-show-all-annotations]
4083 '(menu-item "Show Annotations" bookmark-bmenu-show-all-annotations
4084 :help "Show the annotations for all bookmarks (in another window)"))
4085 (define-key bmkp-bmenu-show-menu [bookmark-bmenu-toggle-filenames]
4086 '(menu-item "Show/Hide File Names" bookmark-bmenu-toggle-filenames
4087 :help "Toggle whether filenames are shown in the bookmark list"))
4088 (define-key bmkp-bmenu-show-menu [show-sep1] '("--"))
4089 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-all]
4090 '(menu-item "Show All" bmkp-bmenu-show-all
4091 :help "Show all bookmarks currently known to the bookmark list"))
4092 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-tags-incrementally]
4093 '(menu-item "Show Only Tag Matches..." bmkp-bmenu-filter-tags-incrementally
4094 :help "Incrementally filter bookmarks by tags using a regexp"))
4095 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-annotation-incrementally]
4096 '(menu-item "Show Only Annotation Matches..." bmkp-bmenu-filter-annotation-incrementally
4097 :help "Incrementally filter bookmarks by annotation using a regexp"))
4098 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-file-name-incrementally]
4099 '(menu-item "Show Only File Name Matches..." bmkp-bmenu-filter-file-name-incrementally
4100 :help "Incrementally filter bookmarks by file name using a regexp"))
4101 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-bookmark-name-incrementally]
4102 '(menu-item "Show Only Name Matches..." bmkp-bmenu-filter-bookmark-name-incrementally
4103 :help "Incrementally filter bookmarks by bookmark name using a regexp"))
4104 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-specific-file]
4105 '(menu-item "Show Only for Specific File" bmkp-bmenu-show-only-specific-file
4106 :help "Display (only) the bookmarks for a specific file"))
4107 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-specific-buffer]
4108 '(menu-item "Show Only for Specific Buffer" bmkp-bmenu-show-only-specific-buffer
4109 :help "Display (only) the bookmarks for a specific buffer"))
4110 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-urls]
4111 '(menu-item "Show Only URLs" bmkp-bmenu-show-only-urls
4112 :help "Display (only) the URL bookmarks"))
4113 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-gnus]
4114 '(menu-item "Show Only Gnus Messages" bmkp-bmenu-show-only-gnus
4115 :help "Display (only) the Gnus bookmarks"))
4116 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-man-pages]
4117 '(menu-item "Show Only UNIX Manual Pages" bmkp-bmenu-show-only-man-pages
4118 :help "Display (only) the `man' page bookmarks"))
4119 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-info-nodes]
4120 '(menu-item "Show Only Info Nodes" bmkp-bmenu-show-only-info-nodes
4121 :help "Display (only) the Info bookmarks"))
4122 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-dired]
4123 '(menu-item "Show Only Dired Buffers" bmkp-bmenu-show-only-dired
4124 :help "Display (only) the Dired bookmarks"))
4125 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-bookmark-files]
4126 '(menu-item "Show Only Bookmark Files" bmkp-bmenu-show-only-bookmark-files
4127 :help "Display (only) the bookmark-file bookmarks"))
4128 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-desktops]
4129 '(menu-item "Show Only Desktops" bmkp-bmenu-show-only-desktops
4130 :help "Display (only) the desktop bookmarks"))
4131 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-regions]
4132 '(menu-item "Show Only Regions" bmkp-bmenu-show-only-regions
4133 :help "Display (only) the bookmarks that record a region"))
4134 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-non-files]
4135 '(menu-item "Show Only Non-Files (Buffers)" bmkp-bmenu-show-only-non-files
4136 :help "Display (only) the non-file bookmarks"))
4137 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-files]
4138 '(menu-item "Show Only Files" bmkp-bmenu-show-only-files
4139 :help "Display (only) the file and directory bookmarks"))
4140 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-autofiles]
4141 '(menu-item "Show Only Autofiles" bmkp-bmenu-show-only-autofiles
4142 :help "Display (only) the autofile bookmarks: those named the same as their files"))
4143 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-autonamed]
4144 '(menu-item "Show Only Autonamed" bmkp-bmenu-show-only-autonamed
4145 :help "Display (only) the autonamed bookmarks"))
4146 (when (featurep 'bookmark+-lit)
4147 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-lighted]
4148 '(menu-item "Show Only Highlighted" bmkp-bmenu-show-only-lighted
4149 :help "Display (only) highlighted bookmarks")))
4150 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-toggle-show-only-unmarked]
4151 '(menu-item "Show Only Unmarked" bmkp-bmenu-toggle-show-only-unmarked
4152 :help "Hide all marked bookmarks. Repeat to toggle, showing all"))
4153 (define-key bmkp-bmenu-show-menu [bmkp-bmenu-toggle-show-only-marked]
4154 '(menu-item "Show Only Marked" bmkp-bmenu-toggle-show-only-marked
4155 :help "Hide all unmarked bookmarks. Repeat to toggle, showing all"))
4157 (defvar bmkp-bmenu-omit-menu (make-sparse-keymap "Omit")
4158 "`Omit' submenu for menu-bar `Bookmark+' menu.")
4159 (define-key bmkp-bmenu-menubar-menu [omitting] (cons "Omit" bmkp-bmenu-omit-menu))
4161 (define-key bmkp-bmenu-omit-menu [bmkp-bmenu-show-all]
4162 '(menu-item "Show All" bmkp-bmenu-show-all
4163 :visible (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
4164 :help "Show all bookmarks (except omitted)"))
4165 (define-key bmkp-bmenu-omit-menu [bmkp-bmenu-show-only-omitted]
4166 '(menu-item "Show Only Omitted" bmkp-bmenu-show-only-omitted
4167 :visible (not (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only))
4168 :enable bmkp-bmenu-omitted-bookmarks :help "Show only the omitted bookmarks"))
4169 (define-key bmkp-bmenu-omit-menu [bmkp-unomit-all]
4170 '(menu-item "Un-Omit All" bmkp-unomit-all
4171 :visible bmkp-bmenu-omitted-bookmarks :help "Un-omit all omitted bookmarks"))
4172 (define-key bmkp-bmenu-omit-menu [bmkp-bmenu-unomit-marked]
4173 '(menu-item "Un-Omit Marked" bmkp-bmenu-unomit-marked
4174 :visible (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
4175 :enable (and bmkp-bmenu-omitted-bookmarks
4176 (save-excursion (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
4177 (re-search-forward "^>" (point-max) t)))
4178 :help "Un-omit the marked bookmarks" :keys "\\[bmkp-bmenu-omit/unomit-marked]"))
4179 (define-key bmkp-bmenu-omit-menu [bmkp-bmenu-omit-marked]
4180 '(menu-item "Omit Marked" bmkp-bmenu-omit-marked
4181 :visible (not (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only))
4182 :enable (and (save-excursion (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
4183 (re-search-forward "^>" (point-max) t)))
4184 :help "Omit the marked bookmarks" :keys "\\[bmkp-bmenu-omit/unomit-marked]"))
4186 (defvar bmkp-bmenu-mark-menu (make-sparse-keymap "Mark")
4187 "`Mark' submenu for menu-bar `Bookmark+' menu.")
4188 (define-key bmkp-bmenu-menubar-menu [marking] (cons "Mark" bmkp-bmenu-mark-menu))
4190 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-not-all]
4191 '(menu-item "Unmark If Not Tagged with All..." bmkp-bmenu-unmark-bookmarks-tagged-not-all
4192 :help "Unmark all visible bookmarks that are tagged with *some* tag in a set you specify"))
4193 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-none]
4194 '(menu-item "Unmark If Tagged with None..." bmkp-bmenu-unmark-bookmarks-tagged-none
4195 :help "Unmark all visible bookmarks that are *not* tagged with *any* tag you specify"))
4196 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-all]
4197 '(menu-item "Unmark If Tagged with All..." bmkp-bmenu-unmark-bookmarks-tagged-all
4198 :help "Unmark all visible bookmarks that are tagged with *each* tag you specify"))
4199 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-some]
4200 '(menu-item "Unmark If Tagged with Some..." bmkp-bmenu-unmark-bookmarks-tagged-some
4201 :help "Unmark all visible bookmarks that are tagged with *some* tag in a set you specify"))
4202 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-regexp]
4203 '(menu-item "Unmark If Tagged Matching Regexp..." bmkp-bmenu-unmark-bookmarks-tagged-regexp
4204 :help "Unmark bookmarks any of whose tags match a regexp you enter"))
4205 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-not-all]
4206 '(menu-item "Mark If Not Tagged with All..." bmkp-bmenu-mark-bookmarks-tagged-not-all
4207 :help "Mark all visible bookmarks that are *not* tagged with *all* tags you specify"))
4208 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-none]
4209 '(menu-item "Mark If Tagged with None..." bmkp-bmenu-mark-bookmarks-tagged-none
4210 :help "Mark all visible bookmarks that are not tagged with *any* tag you specify"))
4211 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-all]
4212 '(menu-item "Mark If Tagged with All..." bmkp-bmenu-mark-bookmarks-tagged-all
4213 :help "Mark all visible bookmarks that are tagged with *each* tag you specify"))
4214 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-some]
4215 '(menu-item "Mark If Tagged with Some..." bmkp-bmenu-mark-bookmarks-tagged-some
4216 :help "Mark all visible bookmarks that are tagged with *some* tag in a set you specify"))
4217 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-regexp]
4218 '(menu-item "Mark If Tagged Matching Regexp..." bmkp-bmenu-mark-bookmarks-tagged-regexp
4219 :help "Mark bookmarks any of whose tags match a regexp you enter"))
4220 (define-key bmkp-bmenu-mark-menu [mark-sep1] '("--"))
4221 (when (featurep 'bookmark+-lit)
4222 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-lighted-bookmarks]
4223 '(menu-item "Mark Highlighted" bmkp-bmenu-mark-lighted-bookmarks
4224 :help "Mark highlighted bookmarks")))
4225 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-specific-file-bookmarks]
4226 '(menu-item "Mark for Specific File" bmkp-bmenu-mark-specific-file-bookmarks
4227 :help "Mark bookmarks for a specific file"))
4228 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-specific-buffer-bookmarks]
4229 '(menu-item "Mark for Specific Buffer" bmkp-bmenu-mark-specific-buffer-bookmarks
4230 :help "Mark bookmarks for a specific buffer"))
4231 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-url-bookmarks]
4232 '(menu-item "Mark URLs" bmkp-bmenu-mark-url-bookmarks :help "Mark URL bookmarks"))
4233 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-gnus-bookmarks]
4234 '(menu-item "Mark Gnus Messages" bmkp-bmenu-mark-gnus-bookmarks :help "Mark Gnus bookmarks"))
4235 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-man-bookmarks]
4236 '(menu-item "Mark UNIX Manual Pages" bmkp-bmenu-mark-man-bookmarks
4237 :help "Mark `man' page bookmarks"))
4238 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-info-bookmarks]
4239 '(menu-item "Mark Info Nodes" bmkp-bmenu-mark-info-bookmarks :help "Mark Info bookmarks"))
4240 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-dired-bookmarks]
4241 '(menu-item "Mark Dired Buffers" bmkp-bmenu-mark-dired-bookmarks :help "Mark Dired bookmarks"))
4242 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmark-file-bookmarks]
4243 '(menu-item "Mark Bookmark Files" bmkp-bmenu-mark-bookmark-file-bookmarks
4244 :help "Mark the bookmark-file bookmarks"))
4245 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-desktop-bookmarks]
4246 '(menu-item "Mark Desktops" bmkp-bmenu-mark-desktop-bookmarks
4247 :help "Mark desktop bookmarks"))
4248 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-region-bookmarks]
4249 '(menu-item "Mark Regions" bmkp-bmenu-mark-region-bookmarks
4250 :help "Mark bookmarks that record a region"))
4251 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-non-file-bookmarks]
4252 '(menu-item "Mark Non-Files (Buffers)" bmkp-bmenu-mark-non-file-bookmarks
4253 :help "Mark non-file bookmarks"))
4254 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-autofile-bookmarks]
4255 '(menu-item "Mark Autofiles" bmkp-bmenu-mark-autofile-bookmarks
4256 :help "Mark autofile bookmarks: those whose names are the same as their files"))
4257 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-file-bookmarks]
4258 '(menu-item "Mark Files" bmkp-bmenu-mark-file-bookmarks :help "Mark file bookmarks"))
4259 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-all]
4260 '(menu-item "Unmark All" bmkp-bmenu-unmark-all
4261 :help "Remove a mark you specify (> or D) from each bookmark (RET to remove both kinds)"))
4262 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-all]
4263 '(menu-item "Mark All" bmkp-bmenu-mark-all :help "Mark all bookmarks, using mark `>'"))
4264 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-toggle-marks]
4265 '(menu-item "Toggle Marked/Unmarked" bmkp-bmenu-toggle-marks
4266 :help "Unmark all marked bookmarks; mark all unmarked bookmarks"))
4267 (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-regexp-mark]
4268 '(menu-item "Mark Regexp Matches..." bmkp-bmenu-regexp-mark
4269 :help "Mark bookmarks that match a regexp that you enter"))
4271 (define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-execute-deletions]
4272 '(menu-item "Delete Flagged (D)" bookmark-bmenu-execute-deletions
4273 :help "Delete the (visible) bookmarks flagged `D'"))
4274 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-delete-marked]
4275 '(menu-item "Delete Marked (>)" bmkp-bmenu-delete-marked
4276 :help "Delete all (visible) bookmarks marked `>', after confirmation"))
4277 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-query-replace-marked-bookmarks-regexp]
4278 '(menu-item "Query-Replace Marked..." bmkp-bmenu-query-replace-marked-bookmarks-regexp
4279 :help "`query-replace-regexp' over all files whose bookmarks are marked"))
4280 (when (fboundp 'bmkp-bmenu-isearch-marked-bookmarks)
4281 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-isearch-marked-bookmarks-regexp]
4282 '(menu-item "Regexp-Isearch Marked..." bmkp-bmenu-isearch-marked-bookmarks-regexp
4283 :help "Regexp Isearch the marked bookmark locations, in their current order"))
4284 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-isearch-marked-bookmarks]
4285 '(menu-item "Isearch Marked..." bmkp-bmenu-isearch-marked-bookmarks
4286 :help "Isearch the marked bookmark locations, in their current order")))
4287 (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-search-marked-bookmarks-regexp]
4288 '(menu-item "Search Marked..." bmkp-bmenu-search-marked-bookmarks-regexp
4289 :help "Regexp-search the files whose bookmarks are marked, in their current order"))
4290 (define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-select]
4291 '(menu-item "Jump to Marked" bookmark-bmenu-select
4292 :help "Jump to this line's bookmark. Also visit each bookmark marked with `>'"))
4296 ;;; Mouse-3 menu binding.
4298 (defvar bmkp-bmenu-line-overlay nil
4299 "Overlay to highlight the current line for `bmkp-bmenu-mouse-3-menu'.")
4300 (define-key bookmark-bmenu-mode-map [mouse-3] 'bmkp-bmenu-mouse-3-menu)
4303 (defun bmkp-bmenu-mouse-3-menu (event)
4304 "Pop-up menu on `mouse-3' for a bookmark listed in `*Bookmark List*'."
4306 (let* ((mouse-pos (event-start event))
4307 (inhibit-field-text-motion t) ; Just in case.
4309 (bmk-name (save-excursion
4310 (with-current-buffer (window-buffer (posn-window mouse-pos))
4312 (goto-char (posn-point mouse-pos))
4314 (setq bol (progn (beginning-of-line) (point))
4315 eol (progn (end-of-line) (point))))
4316 (if bmkp-bmenu-line-overlay ; Don't recreate.
4317 (move-overlay bmkp-bmenu-line-overlay bol eol
4319 (setq bmkp-bmenu-line-overlay (make-overlay bol eol))
4320 (overlay-put bmkp-bmenu-line-overlay 'face 'region))
4321 (bookmark-bmenu-bookmark))))))
4325 (list "This Bookmark"
4328 (if (bmkp-bookmark-name-member bmk-name
4329 bmkp-bmenu-marked-bookmarks)
4330 '("Unmark" . bookmark-bmenu-unmark)
4331 '("Mark" . bookmark-bmenu-mark))
4333 (goto-char (posn-point mouse-pos))
4335 (if (looking-at "^D")
4336 '("Unmark" . bookmark-bmenu-unmark)
4337 '("Flag for Deletion" . bookmark-bmenu-delete)))
4338 '("Omit" . bmkp-bmenu-omit)
4339 '("--") ; ----------------------------------------
4340 '("Jump To" . bookmark-bmenu-this-window)
4341 '("Jump To in Other Window" . bookmark-bmenu-other-window)
4342 '("--") ; ----------------------------------------
4343 '("Copy Tags" . bmkp-bmenu-copy-tags)
4344 '("Paste Tags (Add)" . bmkp-bmenu-paste-add-tags)
4345 '("Paste Tags (Replace)" . bmkp-bmenu-paste-replace-tags)
4346 '("Add Some Tags..." . bmkp-bmenu-add-tags)
4347 '("Remove Some Tags..." . bmkp-bmenu-remove-tags)
4348 '("Remove All Tags..." . bmkp-bmenu-remove-all-tags)
4349 '("Rename..." . bmkp-rename-tag)
4350 '("Set Tag Value..." . bmkp-bmenu-set-tag-value)
4351 (and (featurep 'bookmark+-lit)
4352 '("--")) ; ----------------------------------------
4353 (and (featurep 'bookmark+-lit)
4354 '("Highlight" . bmkp-bmenu-light))
4355 (and (featurep 'bookmark+-lit)
4356 '("Unhighlight" . bmkp-bmenu-unlight))
4357 (and (featurep 'bookmark+-lit)
4358 '("Set Lighting" . bmkp-bmenu-set-lighting))
4359 '("--") ; ----------------------------------------
4360 '("Show Annotation" . bookmark-bmenu-show-annotation)
4361 '("Edit Annotation..." . bookmark-bmenu-edit-annotation)
4362 '("Edit Name, File Name..." . bmkp-bmenu-edit-bookmark)
4363 '("Rename..." . bookmark-bmenu-rename)
4364 '("Relocate..." . bookmark-bmenu-relocate)
4365 '("--") ; ----------------------------------------
4366 '("Describe" . bmkp-bmenu-describe-this-bookmark))
4367 '("" (""))))))) ; No menu: not on a bookmark line.
4368 (when bmkp-bmenu-line-overlay (delete-overlay bmkp-bmenu-line-overlay))
4369 (and menu-choice (save-excursion (goto-char (posn-point mouse-pos))
4370 (call-interactively menu-choice))))))
4372 ;;;;;;;;;;;;;;;;;;;;;
4374 (provide 'bookmark+-bmu)
4376 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4377 ;;; bookmark+-bmu.el ends here