New org capture template
[emacs.git] / .emacs.d / elisp / icicle / bookmark+-bmu.el
1 ;;; bookmark+-bmu.el --- Bookmark+ code for the `*Bookmark List*' (bmenu).
2 ;;
3 ;; Filename: bookmark+-bmu.el
4 ;; Description: Bookmark+ code for the `*Bookmark List*' (bmenu).
5 ;; Author: Drew Adams, Thierry Volpiatto
6 ;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com")
7 ;; Copyright (C) 2000-2012, Drew Adams, all rights reserved.
8 ;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved.
9 ;; Created: Mon Jul 12 09:05:21 2010 (-0700)
10 ;; Last-Updated: Sat May 5 14:55:00 2012 (-0700)
11 ;; By: dradams
12 ;; Update #: 2047
13 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-bmu.el
14 ;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, info, url, w3m, gnus
15 ;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x
16 ;;
17 ;; Features that might be required by this library:
18 ;;
19 ;; `bookmark', `bookmark+-mac', `pp'.
20 ;;
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 ;;
23 ;;; Commentary:
24 ;;
25 ;; This library contains code for buffer `*Bookmark List*' (mode
26 ;; `bookmark-bmenu-mode').
27 ;;
28 ;; The Bookmark+ libraries are these:
29 ;;
30 ;; `bookmark+.el' - main (driver) library
31 ;; `bookmark+-mac.el' - Lisp macros
32 ;; `bookmark+-lit.el' - (optional) code for highlighting bookmarks
33 ;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (this file)
34 ;; `bookmark+-1.el' - other required code (non-bmenu)
35 ;; `bookmark+-key.el' - key and menu bindings
36 ;;
37 ;; `bookmark+-doc.el' - documentation (comment-only file)
38 ;; `bookmark+-chg.el' - change log (comment-only file)
39 ;;
40 ;; The documentation (in `bookmark+-doc.el') includes how to
41 ;; byte-compile and install Bookmark+. The documentation is also
42 ;; available in these ways:
43 ;;
44 ;; 1. From the bookmark list (`C-x r l'):
45 ;; Use `?' to show the current bookmark-list status and general
46 ;; help, then click link `Doc in Commentary' or link `Doc on the
47 ;; Web'.
48 ;;
49 ;; 2. From the Emacs-Wiki Web site:
50 ;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus.
51 ;;
52 ;; 3. From the Bookmark+ group customization buffer:
53 ;; `M-x customize-group bookmark-plus', then click link
54 ;; `Commentary'.
55 ;;
56 ;; (The commentary links in #1 and #3 work only if you have library
57 ;; `bookmark+-doc.el' in your `load-path'.)
58
59 ;;(@> "Index")
60 ;;
61 ;; Index
62 ;; -----
63 ;;
64 ;; If you have library `linkd.el' and Emacs 22 or later, load
65 ;; `linkd.el' and turn on `linkd-mode' now. It lets you easily
66 ;; navigate around the sections of this doc. Linkd mode will
67 ;; highlight this Index, as well as the cross-references and section
68 ;; headings throughout this file. You can get `linkd.el' here:
69 ;; http://dto.freeshell.org/notebook/Linkd.html.
70 ;;
71 ;; (@> "Things Defined Here")
72 ;; (@> "Faces (Customizable)")
73 ;; (@> "User Options (Customizable)")
74 ;; (@> "Internal Variables")
75 ;; (@> "Compatibility Code for Older Emacs Versions")
76 ;; (@> "Menu List Replacements (`bookmark-bmenu-*')")
77 ;; (@> "Bookmark+ Functions (`bmkp-*')")
78 ;; (@> "Menu-List (`*-bmenu-*') Filter Commands")
79 ;; (@> "Menu-List (`*-bmenu-*') Commands Involving Marks")
80 ;; (@> "Omitted Bookmarks")
81 ;; (@> "Search-and-Replace Locations of Marked Bookmarks")
82 ;; (@> "Tags")
83 ;; (@> "General Menu-List (`-*bmenu-*') Commands and Functions")
84 ;; (@> "Sorting - Commands")
85 ;; (@> "Other Bookmark+ Functions (`bmkp-*')")
86 ;; (@> "Keymaps")
87
88 ;;(@* "Things Defined Here")
89 ;;
90 ;; Things Defined Here
91 ;; -------------------
92 ;;
93 ;; Commands defined here:
94 ;;
95 ;; `bmkp-bmenu-add-tags', `bmkp-bmenu-add-tags-to-marked',
96 ;; `bmkp-bmenu-change-sort-order',
97 ;; `bmkp-bmenu-change-sort-order-repeat', `bmkp-bmenu-copy-tags',
98 ;; `bmkp-bmenu-define-command',
99 ;; `bmkp-bmenu-define-full-snapshot-command',
100 ;; `bmkp-bmenu-define-jump-marked-command',
101 ;; `bmkp-bmenu-delete-marked', `bmkp-bmenu-describe-marked',
102 ;; `bmkp-bmenu-describe-this+move-down',
103 ;; `bmkp-bmenu-describe-this+move-up',
104 ;; `bmkp-bmenu-describe-this-bookmark',`bmkp-bmenu-dired-marked',
105 ;; `bmkp-bmenu-edit-bookmark-name-and-file', `bmkp-edit-tags-send',
106 ;; `bmkp-bmenu-filter-annotation-incrementally',
107 ;; `bmkp-bmenu-filter-bookmark-name-incrementally',
108 ;; `bmkp-bmenu-filter-file-name-incrementally',
109 ;; `bmkp-bmenu-filter-tags-incrementally',
110 ;; `bmkp-bmenu-flag-for-deletion',
111 ;; `bmkp-bmenu-flag-for-deletion-backwards',
112 ;; `bmkp-bmenu-isearch-marked-bookmarks' (Emacs 23+),
113 ;; `bmkp-bmenu-isearch-marked-bookmarks-regexp' (Emacs 23+),
114 ;; `bmkp-bmenu-make-sequence-from-marked', `bmkp-bmenu-mark-all',
115 ;; `bmkp-bmenu-mark-autofile-bookmarks',
116 ;; `bmkp-bmenu-mark-bookmark-file-bookmarks',
117 ;; `bmkp-bmenu-mark-bookmarks-satisfying',
118 ;; `bmkp-bmenu-mark-bookmarks-tagged-all',
119 ;; `bmkp-bmenu-mark-bookmarks-tagged-none',
120 ;; `bmkp-bmenu-mark-bookmarks-tagged-not-all',
121 ;; `bmkp-bmenu-mark-bookmarks-tagged-regexp',
122 ;; `bmkp-bmenu-mark-bookmarks-tagged-some',
123 ;; `bmkp-bmenu-mark-desktop-bookmarks',
124 ;; `bmkp-bmenu-mark-dired-bookmarks',
125 ;; `bmkp-bmenu-mark-file-bookmarks',
126 ;; `bmkp-bmenu-mark-gnus-bookmarks',
127 ;; `bmkp-bmenu-mark-image-bookmarks',
128 ;; `bmkp-bmenu-mark-info-bookmarks',
129 ;; `bmkp-bmenu-mark-lighted-bookmarks',
130 ;; `bmkp-bmenu-mark-man-bookmarks',
131 ;; `bmkp-bmenu-mark-non-file-bookmarks',
132 ;; `bmkp-bmenu-mark-orphaned-local-file-bookmarks',
133 ;; `bmkp-bmenu-mark-region-bookmarks',
134 ;; `bmkp-bmenu-mark-specific-buffer-bookmarks',
135 ;; `bmkp-bmenu-mark-specific-file-bookmarks',
136 ;; `bmkp-bmenu-mark-url-bookmarks',
137 ;; `bmkp-bmenu-mark-variable-list-bookmarks',
138 ;; `bmkp-bmenu-mark-w3m-bookmarks', `bmkp-bmenu-mouse-3-menu',
139 ;; `bmkp-bmenu-mode-status-help', `bmkp-bmenu-omit',
140 ;; `bmkp-bmenu-omit-marked', `bmkp-bmenu-omit/unomit-marked',
141 ;; `bmkp-bmenu-paste-add-tags',
142 ;; `bmkp-bmenu-paste-add-tags-to-marked',
143 ;; `bmkp-bmenu-paste-replace-tags',
144 ;; `bmkp-bmenu-paste-replace-tags-for-marked',
145 ;; `bmkp-bmenu-query-replace-marked-bookmarks-regexp',
146 ;; `bmkp-bmenu-quit', `bmkp-bmenu-refresh-menu-list',
147 ;; `bmkp-bmenu-regexp-mark', `bookmark-bmenu-relocate' (Emacs 20,
148 ;; 21), `bmkp-bmenu-remove-all-tags', `bmkp-bmenu-remove-tags',
149 ;; `bmkp-bmenu-remove-tags-from-marked',
150 ;; `bmkp-bmenu-search-marked-bookmarks-regexp',
151 ;; `bmkp-bmenu-set-tag-value',
152 ;; `bmkp-bmenu-set-tag-value-for-marked', `bmkp-bmenu-show-all',
153 ;; `bmkp-bmenu-show-only-autofiles',
154 ;; `bmkp-bmenu-show-only-autonamed.',
155 ;; `bmkp-bmenu-show-only-bookmark-files',
156 ;; `bmkp-bmenu-show-only-desktops', `bmkp-bmenu-show-only-dired',
157 ;; `bmkp-bmenu-show-only-files', `bmkp-bmenu-show-only-gnus',
158 ;; `bmkp-bmenu-show-only-image-files',
159 ;; `bmkp-bmenu-show-only-info-nodes',
160 ;; `bmkp-bmenu-show-only-man-pages',
161 ;; `bmkp-bmenu-show-only-non-files',
162 ;; `bmkp-bmenu-show-only-omitted',
163 ;; `bmkp-bmenu-show-only-orphaned-local-files',
164 ;; `bmkp-bmenu-show-only-regions',
165 ;; `bmkp-bmenu-show-only-specific-buffer',
166 ;; `bmkp-bmenu-show-only-specific-file',
167 ;; `bmkp-bmenu-show-only-tagged', `bmkp-bmenu-show-only-urls',
168 ;; `bmkp-bmenu-show-only-variable-lists',
169 ;; `bmkp-bmenu-show-only-w3m-urls',
170 ;; `bmkp-bmenu-sort-by-bookmark-name',
171 ;; `bmkp-bmenu-sort-by-bookmark-visit-frequency',
172 ;; `bmkp-bmenu-sort-by-bookmark-type',
173 ;; `bmkp-bmenu-sort-by-creation-time',
174 ;; `bmkp-bmenu-sort-by-file-name',
175 ;; `bmkp-bmenu-sort-by-Gnus-thread',
176 ;; `bmkp-bmenu-sort-by-Info-location',
177 ;; `bmkp-bmenu-sort-by-last-bookmark-access',
178 ;; `bmkp-bmenu-sort-by-last-buffer-or-file-access',
179 ;; `bmkp-bmenu-sort-by-last-local-file-access',
180 ;; `bmkp-bmenu-sort-by-last-local-file-update',
181 ;; `bmkp-bmenu-sort-by-local-file-size',
182 ;; `bmkp-bmenu-sort-by-local-file-type', `bmkp-bmenu-sort-by-url',
183 ;; `bmkp-bmenu-sort-flagged-before-unflagged',
184 ;; `bmkp-bmenu-sort-marked-before-unmarked',
185 ;; `bmkp-bmenu-sort-modified-before-unmodified',
186 ;; `bmkp-bmenu-sort-tagged-before-untagged',
187 ;; `bmkp-bmenu-toggle-marked-temporary/savable',
188 ;; `bmkp-bmenu-toggle-marks', `bmkp-bmenu-toggle-show-only-marked',
189 ;; `bmkp-bmenu-toggle-show-only-unmarked',
190 ;; `bmkp-bmenu-toggle-temporary', `bmkp-bmenu-unmark-all',
191 ;; `bmkp-bmenu-unmark-bookmarks-tagged-all',
192 ;; `bmkp-bmenu-unmark-bookmarks-tagged-none',
193 ;; `bmkp-bmenu-unmark-bookmarks-tagged-not-all',
194 ;; `bmkp-bmenu-unmark-bookmarks-tagged-regexp',
195 ;; `bmkp-bmenu-unmark-bookmarks-tagged-some',
196 ;; `bmkp-bmenu-unomit-marked', `bmkp-bmenu-w32-open',
197 ;; `bmkp-bmenu-w32-open-select', `bmkp-bmenu-w32-open-with-mouse',
198 ;; `bmkp-define-tags-sort-command'.
199 ;;
200 ;; Faces defined here:
201 ;;
202 ;; `bmkp-*-mark', `bmkp->-mark', `bmkp-a-mark',
203 ;; `bmkp-bad-bookmark', `bmkp-bookmark-file', `bmkp-bookmark-list',
204 ;; `bmkp-buffer', `bmkp-D-mark', `bmkp-desktop',
205 ;; `bmkp-file-handler', `bmkp-function', `bmkp-gnus',
206 ;; `bmkp-heading', `bmkp-info', `bmkp-local-directory',
207 ;; `bmkp-local-file-with-region', `bmkp-local-file-without-region',
208 ;; `bmkp-man', `bmkp-non-file', `bmkp-remote-file',
209 ;; `bmkp-sequence', `bmkp-su-or-sudo', `bmkp-t-mark', `bmkp-url',
210 ;; `bmkp-variable-list', `bmkp-X-mark'.
211 ;;
212 ;; User options defined here:
213 ;;
214 ;; `bmkp-bmenu-commands-file',
215 ;; `bmkp-bmenu-image-bookmark-icon-file',
216 ;; `bmkp-bmenu-omitted-bookmarks', `bmkp-bmenu-state-file',
217 ;; `bmkp-propertize-bookmark-names-flag', `bmkp-sort-orders-alist',
218 ;; `bmkp-sort-orders-for-cycling-alist'.
219 ;;
220 ;; Non-interactive functions defined here:
221 ;;
222 ;; `bmkp-bmenu-barf-if-not-in-menu-list',
223 ;; `bmkp-bmenu-cancel-incremental-filtering',
224 ;; `bmkp-bmenu-filter-alist-by-annotation-regexp',
225 ;; `bmkp-bmenu-filter-alist-by-bookmark-name-regexp',
226 ;; `bmkp-bmenu-filter-alist-by-file-name-regexp',
227 ;; `bmkp-bmenu-filter-alist-by-tags-regexp',
228 ;; `bmkp-bmenu-get-marked-files', `bmkp-bmenu-goto-bookmark-named',
229 ;; `bmkp-bmenu-list-1',
230 ;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none',
231 ;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all',
232 ;; `bmkp-bmenu-propertize-item', `bmkp-bmenu-read-filter-input',
233 ;; `bmkp-face-prop', `bmkp-maybe-unpropertize-bookmark-names',
234 ;; `bmkp-reverse-multi-sort-order', `bmkp-reverse-sort-order'.
235 ;;
236 ;; Internal variables defined here:
237 ;;
238 ;; `bmkp-bmenu-before-hide-marked-alist',
239 ;; `bmkp-bmenu-before-hide-unmarked-alist',
240 ;; `bmkp-bmenu-define-command-menu', `bmkp-bmenu-filter-function',
241 ;; `bmkp-bmenu-filter-pattern', `bmkp-bmenu-filter-prompt',
242 ;; `bmkp-bmenu-filter-timer', `bmkp-bmenu-first-time-p',
243 ;; `bmkp-flagged-bookmarks', `bmkp-bmenu-header-lines',
244 ;; `bmkp-bmenu-highlight-menu', `bmkp-bmenu-line-overlay',
245 ;; `bmkp-bmenu-mark-menu', `bmkp-bmenu-marked-bookmarks',
246 ;; `bmkp-bmenu-marks-width', `bmkp-bmenu-menubar-menu',
247 ;; `bmkp-bmenu-omit-menu', `bmkp-bmenu-show-menu',
248 ;; `bmkp-bmenu-sort-menu', `bmkp-bmenu-tags-menu',
249 ;; `bmkp-bmenu-title', `bmkp-last-bmenu-bookmark'.
250 ;;
251 ;;
252 ;; ***** NOTE: The following commands defined in `bookmark.el'
253 ;; have been REDEFINED HERE:
254 ;;
255 ;; `bookmark-bmenu-execute-deletions', `bookmark-bmenu-list',
256 ;; `bookmark-bmenu-mark', `bookmark-bmenu-1-window',
257 ;; `bookmark-bmenu-2-window', `bookmark-bmenu-other-window',
258 ;; `bookmark-bmenu-other-window-with-mouse',
259 ;; `bookmark-bmenu-rename', `bookmark-bmenu-show-annotation',
260 ;; `bookmark-bmenu-switch-other-window',
261 ;; `bookmark-bmenu-this-window', `bookmark-bmenu-toggle-filenames',
262 ;; `bookmark-bmenu-unmark'.
263 ;;
264 ;;
265 ;; ***** NOTE: The following non-interactive functions and macros
266 ;; defined in `bookmark.el' have been REDEFINED HERE:
267 ;;
268 ;; `bookmark-bmenu-bookmark', `bookmark-bmenu-check-position',
269 ;; `bookmark-bmenu-delete', `bookmark-bmenu-delete-backwards',
270 ;; `bookmark-bmenu-ensure-position' (Emacs 23.2+),
271 ;; `bookmark-bmenu-hide-filenames', `bookmark-bmenu-mode',
272 ;; `bookmark-bmenu-show-filenames',
273 ;; `bookmark-bmenu-surreptitiously-rebuild-list',
274 ;; `bookmark-bmenu-switch-other-window',
275 ;; `with-buffer-modified-unmodified' (Emacs < 23.2).
276 ;;
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
278 ;;
279 ;; This program is free software; you can redistribute it and/or
280 ;; modify it under the terms of the GNU General Public License as
281 ;; published by the Free Software Foundation; either version 3, or
282 ;; (at your option) any later version.
283 ;;
284 ;; This program is distributed in the hope that it will be useful,
285 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
286 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
287 ;; General Public License for more details.
288 ;;
289 ;; You should have received a copy of the GNU General Public License
290 ;; along with this program; see the file COPYING. If not, write to
291 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
292 ;; Floor, Boston, MA 02110-1301, USA.
293 ;;
294 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
295 ;;
296 ;;; Code:
297
298 ;;;;;;;;;;;;;;;;;;;;;;;
299
300 (eval-when-compile (require 'cl)) ;; case (plus, for Emacs 20: dolist)
301 (eval-when-compile (require 'easymenu)) ;; easy-menu-create-menu
302
303 (require 'bookmark)
304 ;; bookmark-alist, bookmark-bmenu-file-column,
305 ;; bookmark-bmenu-hidden-bookmarks, bookmark-bmenu-mode-map,
306 ;; bookmark-bmenu-select, bookmark-get-annotation,
307 ;; bookmark-get-filename, bookmark-get-handler, bookmark-kill-line,
308 ;; bookmark-maybe-load-default-file, bookmark-name-from-full-record,
309 ;; bookmark-name-from-record, bookmark-prop-get
310
311
312 ;; Some general Renamings.
313 ;;
314 ;; 1. Fix incompatibility introduced by gratuitous Emacs name change.
315 ;;
316 (cond ((and (fboundp 'bookmark-name-from-record) (not (fboundp 'bookmark-name-from-full-record)))
317 (defalias 'bookmark-name-from-full-record 'bookmark-name-from-record))
318 ((and (fboundp 'bookmark-name-from-full-record) (not (fboundp 'bookmark-name-from-record)))
319 (defalias 'bookmark-name-from-record 'bookmark-name-from-full-record)))
320
321 ;; 2. The vanilla name of the first is misleading, as it returns only the cdr of the record.
322 ;; The second is for consistency.
323 ;;
324 (defalias 'bmkp-bookmark-data-from-record 'bookmark-get-bookmark-record)
325 (defalias 'bmkp-bookmark-name-from-record 'bookmark-name-from-full-record)
326
327
328 (require 'bookmark+-mac) ;; bmkp-define-sort-command, bmkp-with-output-to-plain-temp-buffer
329
330 (put 'bmkp-with-output-to-plain-temp-buffer 'common-lisp-indent-function '(4 &body))
331
332 ;; (eval-when-compile (require 'bookmark+-1))
333 ;; bmkp-add-tags, bmkp-alpha-p, bmkp-bookmark-creation-cp,
334 ;; bmkp-bookmark-description, bmkp-bookmark-file-bookmark-p,
335 ;; bmkp-bookmark-last-access-cp, bmkp-bookmark-list-bookmark-p,
336 ;; bmkp-buffer-last-access-cp, bmkp-completing-read-buffer-name,
337 ;; bmkp-completing-read-file-name, bmkp-current-bookmark-file,
338 ;; bmkp-current-sort-order, bmkp-describe-bookmark,
339 ;; bmkp-describe-bookmark-internals, bmkp-desktop-bookmark-p,
340 ;; bmkp-edit-bookmark-name-and-file, bmkp-file-alpha-cp,
341 ;; bmkp-file-remote-p, bmkp-function-bookmark-p,
342 ;; bookmark-get-bookmark, bmkp-get-buffer-name, bmkp-get-tags,
343 ;; bmkp-gnus-bookmark-p, bmkp-gnus-cp, bmkp-handler-cp,
344 ;; bmkp-incremental-filter-delay, bmkp-image-bookmark-p,
345 ;; bmkp-info-bookmark-p, bmkp-info-cp, bmkp-isearch-bookmarks,
346 ;; bmkp-isearch-bookmarks-regexp, bmkp-jump-1,
347 ;; bmkp-last-bookmark-file, bmkp-last-specific-buffer,
348 ;; bmkp-last-specific-file, bmkp-latest-bookmark-alist,
349 ;; bmkp-local-file-bookmark-p, bmkp-local-file-type-cp,
350 ;; bmkp-local-file-accessed-more-recently-cp,
351 ;; bmkp-local-file-updated-more-recently-cp, bmkp-man-bookmark-p,
352 ;; bmkp-marked-bookmark-p, bmkp-marked-bookmarks-only, bmkp-marked-cp,
353 ;; bmkp-msg-about-sort-order, bmkp-non-file-filename,
354 ;; bmkp-read-tag-completing, bmkp-read-tags-completing,
355 ;; bmkp-refresh-menu-list, bmkp-region-bookmark-p,
356 ;; bmkp-remove-all-tags, bmkp-remove-if, bmkp-remove-tags,
357 ;; bmkp-repeat-command, bmkp-reverse-multi-sort-p,
358 ;; bmkp-reverse-sort-p, bmkp-root-or-sudo-logged-p, bmkp-same-file-p,
359 ;; bmkp-save-menu-list-state, bmkp-sequence-bookmark-p,
360 ;; bmkp-set-tag-value, bmkp-set-tag-value-for-bookmarks,
361 ;; bmkp-set-union, bmkp-some, bmkp-some-marked-p,
362 ;; bmkp-some-unmarked-p, bmkp-sort-omit, bmkp-sort-comparer,
363 ;; bmkp-sorted-alist, bmkp-su-or-sudo-regexp, bmkp-tag-name,
364 ;; bmkp-tags-list, bmkp-url-bookmark-p, bmkp-url-cp,
365 ;; bmkp-unmarked-bookmarks-only, bmkp-variable-list-bookmark-p,
366 ;; bmkp-visited-more-cp, bookmark-store
367
368 ;; (eval-when-compile (require 'bookmark+-lit nil t))
369 ;; bmkp-get-lighting
370
371 ;;;;;;;;;;;;;;;;;;;;;;;
372
373 ;; Quiet the byte-compiler
374 (defvar dired-re-mark) ; In `dired.el'.
375 (defvar tramp-file-name-regexp) ; In `tramp.el'.
376
377 (defvar bmkp-edit-bookmark-orig-record) ; In `bookmark+-1.el'.
378 (defvar bmkp-edit-bookmark-records-number) ; In `bookmark+-1.el'.
379 (defvar bmkp-temporary-bookmarking-mode) ; In `bookmark+-1.el'.
380
381
382 ;;(@* "Faces (Customizable)")
383 ;;; Faces (Customizable) ---------------------------------------------
384
385 (defgroup bookmark-plus nil
386 "Bookmark enhancements."
387 :prefix "bmkp-" :group 'bookmark
388 :link `(url-link :tag "Send Bug Report"
389 ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\
390 Bookmark+ bug: \
391 &body=Describe bug here, starting with `emacs -Q'. \
392 Don't forget to mention your Emacs and library versions."))
393 :link '(url-link :tag "Download" "http://www.emacswiki.org/bookmark+.el")
394 :link '(url-link :tag "Description" "http://www.emacswiki.org/BookmarkPlus")
395 :link '(emacs-commentary-link :tag "Commentary" "bookmark+"))
396
397 (defface bmkp->-mark '((((background dark)) (:foreground "Yellow"))
398 (t (:foreground "Blue")))
399 ;; (:foreground "Magenta2" :box (:line-width 1 :style pressed-button))))
400 "*Face used for a `>' mark in the bookmark list."
401 :group 'bookmark-plus :group 'faces)
402
403 (defface bmkp-a-mark '((((background dark)) (:background "SaddleBrown"))
404 (t (:background "SkyBlue")))
405 "*Face used for an annotation indicator (`a') in the bookmark list."
406 :group 'bookmark-plus :group 'faces)
407
408 (defface bmkp-bad-bookmark '((t (:foreground "Red" :background "Chartreuse1")))
409 "*Face used for a bookmark that seems to be bad: e.g., nonexistent file."
410 :group 'bookmark-plus :group 'faces)
411
412 (defface bmkp-bookmark-file
413 '((((background dark))
414 (:foreground "#00005A5AFFFF" :background "#FFFF9B9BFFFF")) ; ~ blue, ~ pink
415 (t (:foreground "Orange" :background "DarkGreen")))
416 "*Face used for a bookmark-file bookmark."
417 :group 'bookmark-plus :group 'faces)
418
419 (defface bmkp-bookmark-list
420 '((((background dark)) (:foreground "#7474FFFFFFFF" :background "DimGray")) ; ~ cyan
421 (t (:foreground "DarkRed" :background "LightGray")))
422 "*Face used for a bookmark-list bookmark."
423 :group 'bookmark-plus :group 'faces)
424
425 (defface bmkp-buffer
426 '((((background dark)) (:foreground "#FFFF9B9BFFFF")) ; ~ pink
427 (t (:foreground "DarkGreen")))
428 "*Face used for a bookmarked existing buffer not associated with a file."
429 :group 'bookmark-plus :group 'faces)
430
431 (defface bmkp-D-mark '((t (:foreground "Yellow" :background "Red")))
432 "*Face used for a deletion mark (`D') in the bookmark list."
433 :group 'bookmark-plus :group 'faces)
434
435 (defface bmkp-desktop
436 '((((background dark)) (:foreground "Orange" :background "DarkSlateBlue"))
437 (t (:foreground "DarkBlue" :background "PaleGoldenrod")))
438 "*Face used for a bookmarked desktop."
439 :group 'bookmark-plus :group 'faces)
440
441 (defface bmkp-file-handler
442 '((((background dark)) (:background "#272740402727")) ; ~ dark green
443 (t (:background "Thistle")))
444 "*Face used for a bookmark that has a `file-handler' attribute."
445 :group 'bookmark-plus :group 'faces)
446
447 (defface bmkp-function
448 '((((background dark)) (:foreground "#0000EBEB6C6C")) ; ~ green
449 (t (:foreground "DeepPink1")))
450 "*Face used for a function bookmark: a bookmark that invokes a function."
451 :group 'bookmark-plus :group 'faces)
452
453 (defface bmkp-gnus
454 '((((background dark)) (:foreground "Gold"))
455 (t (:foreground "DarkBlue")))
456 "*Face used for a Gnus bookmark."
457 :group 'bookmark-plus :group 'faces)
458
459 (defface bmkp-info
460 '((((background dark)) (:foreground "#7474FFFFFFFF")) ; ~ light cyan
461 (t (:foreground "DarkRed")))
462 "*Face used for a bookmarked Info node."
463 :group 'bookmark-plus :group 'faces)
464
465 (defface bmkp-local-directory
466 '((((background dark))
467 (:foreground "Pink" :background "DarkBlue"))
468 (t (:foreground "DarkBlue" :background "HoneyDew2")))
469 "*Face used for a bookmarked local directory."
470 :group 'bookmark-plus :group 'faces)
471
472 (defface bmkp-local-file-without-region
473 '((((background dark)) (:foreground "White"))
474 (t (:foreground "Black")))
475 "*Face used for a bookmarked local file (without a region)."
476 :group 'bookmark-plus :group 'faces)
477
478 (defface bmkp-local-file-with-region
479 '((((background dark)) (:foreground "Yellow"))
480 (t (:foreground "Blue")))
481 "*Face used for a region bookmark in a local file."
482 :group 'bookmark-plus :group 'faces)
483
484 (defface bmkp-man
485 '((((background dark)) (:foreground "Orchid"))
486 (t (:foreground "Orange4")))
487 "*Face used for a `man' page bookmark."
488 :group 'bookmark-plus :group 'faces)
489
490 (defface bmkp-*-mark '((t (:foreground "Red" :background "Yellow")))
491 "*Face used for a modification mark (`*') in the bookmark list."
492 :group 'bookmark-plus :group 'faces)
493
494 (defface bmkp-non-file
495 '((t (:foreground "gray60")))
496 "*Face used for a bookmark not associated with an existing file or buffer."
497 :group 'bookmark-plus :group 'faces)
498
499 (defface bmkp-remote-file
500 '((((background dark)) (:foreground "#6B6BFFFF2C2C")) ; ~ green
501 (t (:foreground "DarkViolet")))
502 "*Face used for a bookmarked tramp remote file (/ssh:)."
503 :group 'bookmark-plus :group 'faces)
504
505 (defface bmkp-sequence
506 '((((background dark)) (:foreground "DeepSkyBlue"))
507 (t (:foreground "DarkOrange2")))
508 "*Face used for a sequence bookmark: one composed of other bookmarks."
509 :group 'bookmark-plus :group 'faces)
510
511 (defface bmkp-su-or-sudo '((t (:foreground "Red")))
512 "*Face used for a bookmarked tramp file (/su: or /sudo:)."
513 :group 'bookmark-plus :group 'faces)
514
515 (defface bmkp-t-mark '((((background dark)) (:foreground "Magenta"))
516 (t (:foreground "#000093F402A2"))) ; a medium green
517 "*Face used for a tags mark (`t') in the bookmark list."
518 :group 'bookmark-plus :group 'faces)
519
520 (defface bmkp-url
521 '((((background dark)) (:foreground "#7474FFFF7474")) ; ~ green
522 (t (:foreground "DarkMagenta")))
523 "*Face used for a bookmarked URL."
524 :group 'bookmark-plus :group 'faces)
525
526 (defface bmkp-variable-list
527 '((((background dark)) (:foreground "#FFFF74747474")) ; ~ salmon
528 (t (:foreground "DarkCyan")))
529 "*Face used for a bookmarked list of variables."
530 :group 'bookmark-plus :group 'faces)
531
532 (defface bmkp-X-mark '((t (:foreground "Red")))
533 "*Face used for a temporary-bookmark indicator (`X') in the bookmark list."
534 :group 'bookmark-plus :group 'faces)
535
536 ;; $$$$$$ Not used now - using `bmkp-url' instead.
537 ;; (defface bmkp-w3m
538 ;; '((((background dark)) (:foreground "yellow"))
539 ;; (t (:foreground "DarkMagenta")))
540 ;; "*Face used for a bookmarked w3m url."
541 ;; :group 'bookmark-plus :group 'faces)
542
543 ;; Instead of vanilla `bookmark-menu-heading' (defined in Emacs 22+), to use a better default.
544 (defface bmkp-heading '((((background dark)) (:foreground "Yellow"))
545 (t (:foreground "Blue")))
546 "*Face used to highlight the headings in various Bookmark+ buffers."
547 :group 'bookmark-plus :version "22.1" :group 'faces)
548
549 ;;(@* "User Options (Customizable)")
550 ;;; User Options (Customizable) --------------------------------------
551
552 ;;;###autoload
553 (defcustom bmkp-bmenu-omitted-bookmarks ()
554 "*List of names of omitted bookmarks.
555 They are generally not available for display in the bookmark list.
556 You can, however, use \\<bookmark-bmenu-mode-map>\
557 `\\[bmkp-bmenu-show-only-omitted]' to see them.
558 You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]'
559 to make those that are marked available again for the bookmark list."
560 ;; $$$$$$ TODO: Create a customize :type `bookmark-name'
561 ;; and provide completion for filling out the field.
562 :type '(repeat (string :tag "Bookmark name")) :group 'bookmark-plus)
563
564 ;;;###autoload
565 (defcustom bmkp-bmenu-commands-file (convert-standard-filename "~/.emacs-bmk-bmenu-commands.el")
566 "*File for saving user-defined bookmark-list commands.
567 This must be an absolute file name (possibly containing `~') or nil
568 \(it is not expanded).
569
570 You can use `\\[bmkp-list-defuns-in-commands-file]' to list the
571 commands defined in the file and how many times each is defined.
572
573 NOTE: Each time you define a command using \\<bookmark-bmenu-mode-map>\
574 `\\[bmkp-bmenu-define-command]', `\\[bmkp-bmenu-define-full-snapshot-command]', \
575 `\\[bmkp-bmenu-define-jump-marked-command], or `\\[bmkp-define-tags-sort-command]',
576 it is saved in the file. The new definition is simply appended to the
577 file - old definitions of the same command are not overwritten. So
578 you might want to clean up the file occasionally, to remove any old,
579 unused definitions. This is especially advisable if you used \
580 `\\[bmkp-bmenu-define-full-snapshot-command]',
581 because such command definitions can be very large."
582 :type '(file :tag "File for saving menu-list state") :group 'bookmark-plus)
583
584 ;;;###autoload
585 (defcustom bmkp-bmenu-state-file (convert-standard-filename "~/.emacs-bmk-bmenu-state.el")
586 "*File for saving `*Bookmark List*' state when you quit bookmark list.
587 This must be an absolute file name (possibly containing `~') or nil
588 \(it is not expanded).
589
590 The state is also saved when you quit Emacs, even if you don't quit
591 the bookmark list first (using \\<bookmark-bmenu-mode-map>`\\[bmkp-bmenu-quit]').
592
593 Set this to nil if you do not want to restore the bookmark list as it
594 was the last time you used it."
595 :type '(choice
596 (const :tag "Do not save and restore menu-list state" nil)
597 (file :tag "File for saving menu-list state"))
598 :group 'bookmark-plus)
599
600 ;;;###autoload
601 (defcustom bmkp-bmenu-image-bookmark-icon-file
602 (and (fboundp 'display-images-p) (display-images-p)
603 (let ((bmk-img (convert-standard-filename "~/.emacs-bmk-bmenu-image-file-icon.png"))
604 (emacs-img (convert-standard-filename
605 (concat data-directory "images/gnus/exit-gnus.xpm"))))
606 (or (and (file-readable-p bmk-img) bmk-img)
607 (and (file-readable-p emacs-img) emacs-img))))
608 "*Iconic image file to show next to image-file bookmarks.
609 If nil, show no image. Otherwise, this is an absolute file name,
610 possibly containing `~', (the value is not expanded).
611
612 Use any image file that Emacs can display, but you probably want to
613 use a small, iconic image - say 16x16 pixels.
614
615 The default image, which you are sure to have in any Emacs version
616 that supports images, is 24x24 pixels. That wastes vertical space, so
617 you probably want to use something smaller.
618
619 If you don't have another image that you prefer, try this one (16x16):
620 http://www.emacswiki.org/emacs/BookmarkPlusImageFileDefaultIcon"
621 :type '(choice
622 (file :tag "Use iconic image file")
623 (const :tag "Show no image"))
624 :group 'bookmark-plus)
625
626 ;; This is a general option. It is in this file because it is used mainly by the bmenu code.
627 (when (> emacs-major-version 20)
628 (defcustom bmkp-sort-orders-alist ()
629 "*Alist of all available sort functions.
630 This is a pseudo option - you probably do NOT want to customize this.
631 Instead:
632
633 * To add a new sort function to this list, use macro
634 `bmkp-define-sort-command'. It defines a new sort function
635 and automatically adds it to this list.
636
637 * To have fewer sort orders available for cycling by \\<bookmark-bmenu-mode-map>\
638 `\\[bmkp-bmenu-change-sort-order-repeat]'...,
639 customize option `bmkp-sort-orders-for-cycling-alist'.
640
641 Each alist element has the form (SORT-ORDER . COMPARER):
642
643 SORT-ORDER is a short string or symbol describing the sort order.
644 Examples: \"by last access time\", \"by bookmark name\".
645
646 COMPARER compares two bookmarks. It must be acceptable as a value of
647 `bmkp-sort-comparer'."
648 :type '(alist
649 :key-type (choice :tag "Sort order" string symbol)
650 :value-type (choice
651 (const :tag "None (do not sort)" nil)
652 (function :tag "Sorting Predicate")
653 (list :tag "Sorting Multi-Predicate"
654 (repeat (function :tag "Component Predicate"))
655 (choice
656 (const :tag "None" nil)
657 (function :tag "Final Predicate")))))
658 :group 'bookmark-plus))
659
660 (unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist.
661 (defcustom bmkp-sort-orders-alist ()
662 "*Alist of all available sort functions.
663 This is a pseudo option - you probably do NOT want to customize this.
664 Instead:
665
666 * To add a new sort function to this list, use macro
667 `bmkp-define-sort-command'. It defines a new sort function
668 and automatically adds it to this list.
669
670 * To have fewer sort orders available for cycling by \\<bookmark-bmenu-mode-map>\
671 `\\[bmkp-bmenu-change-sort-order-repeat]'...,
672 customize option `bmkp-sort-orders-for-cycling-alist'.
673
674 Each alist element has the form (SORT-ORDER . COMPARER):
675
676 SORT-ORDER is a short string or symbol describing the sort order.
677 Examples: \"by last access time\", \"by bookmark name\".
678
679 COMPARER compares two bookmarks. It must be acceptable as a value of
680 `bmkp-sort-comparer'."
681 :type '(repeat
682 (cons
683 (choice :tag "Sort order" string symbol)
684 (choice
685 (const :tag "None (do not sort)" nil)
686 (function :tag "Sorting Predicate")
687 (list :tag "Sorting Multi-Predicate"
688 (repeat (function :tag "Component Predicate"))
689 (choice
690 (const :tag "None" nil)
691 (function :tag "Final Predicate"))))))
692 :group 'bookmark-plus))
693
694 (defcustom bmkp-propertize-bookmark-names-flag (> emacs-major-version 20)
695 "*Non-nil means to propertize bookmark names to hold full bookmark data.
696 This means that you can effectively have more than one bookmark with
697 the same name.
698
699 Emacs 20 users: If you need to use your bookmarks with Emacs 20 then
700 set this to nil. In particular, if your bookmark file was written
701 with this as non-nil, then it contains propertized strings which are
702 unreadable by Emacs 20. To convert the file to be usable with Emacs
703 20 you must, in Emacs 21 or later, set this to nil and then do `M-x
704 bookmark-save'."
705 :type 'boolean :group 'bookmark-plus)
706
707 ;;(@* "Internal Variables")
708 ;;; Internal Variables -----------------------------------------------
709
710 (defconst bmkp-bmenu-header-lines 5
711 "Number of lines used for the `*Bookmark List*' header.")
712
713 (defconst bmkp-bmenu-marks-width 4
714 "Number of columns (chars) used for the `*Bookmark List*' marks columns.
715 Bookmark names thus begin in this column number (since zero-based).")
716
717
718 (defvar bmkp-bmenu-before-hide-marked-alist ()
719 "Copy of `bookmark-alist' made before hiding marked bookmarks.")
720
721 (defvar bmkp-bmenu-before-hide-unmarked-alist ()
722 "Copy of `bookmark-alist' made before hiding unmarked bookmarks.")
723
724 (defvar bmkp-bmenu-filter-function nil "Latest filtering function for `*Bookmark List*' display.")
725
726 (defvar bmkp-bmenu-filter-pattern "" "Regexp for incremental filtering.")
727
728 (defvar bmkp-bmenu-filter-prompt "Pattern: " "Prompt for `bmkp-bmenu-filter-incrementally'.")
729
730 (defvar bmkp-bmenu-filter-timer nil "Timer used for incremental filtering.")
731
732 (defvar bmkp-bmenu-first-time-p t
733 "Non-nil means bookmark list has not yet been shown after quitting it.
734 Quitting the list or the Emacs session resets this to t.
735 The first time the list is displayed, it is set to nil.")
736
737 (defvar bmkp-flagged-bookmarks ()
738 "Alist of bookmarks that are flagged for deletion in `*Bookmark List*'.")
739
740 (defvar bmkp-bmenu-marked-bookmarks ()
741 "Names of the marked bookmarks.
742 This includes possibly omitted bookmarks, that is, bookmarks listed in
743 `bmkp-bmenu-omitted-bookmarks'.")
744
745 (defvar bmkp-bmenu-title "" "Latest title for `*Bookmark List*' display.")
746
747 ;; This is a general variable. It is in this file because it is used only in the bmenu code.
748 (defvar bmkp-last-bmenu-bookmark nil "The name of the last bookmark current in the bookmark list.")
749
750 ;;(@* "Compatibility Code for Older Emacs Versions")
751 ;;; Compatibility Code for Older Emacs Versions ----------------------
752
753 (when (or (< emacs-major-version 23) (and (= emacs-major-version 23) (= emacs-minor-version 1)))
754 (defmacro with-buffer-modified-unmodified (&rest body)
755 "Save and restore `buffer-modified-p' state around BODY."
756 (let ((was-modified (make-symbol "was-modified")))
757 `(let ((,was-modified (buffer-modified-p)))
758 (unwind-protect (progn ,@body)
759 (set-buffer-modified-p ,was-modified))))))
760
761 (when (< emacs-major-version 22)
762 (defun bookmark-bmenu-relocate ()
763 "Change the file path of the bookmark on the current line,
764 prompting with completion for the new path."
765 (interactive)
766 (let ((bmk (bookmark-bmenu-bookmark))
767 (thispoint (point)))
768 (bookmark-relocate bmk)
769 (goto-char thispoint))))
770
771 ;;(@* "Menu List Replacements (`bookmark-bmenu-*')")
772 ;;; Menu List Replacements (`bookmark-bmenu-*') ----------------------
773
774
775
776 ;; REPLACES ORIGINAL in `bookmark.el'.
777 ;;
778 ;; 1. Return t. Value doesn't mean anything (didn't anyway), but must be non-nil for vanilla Emacs.
779 ;; 2. Do not count lines. Just make sure we're on a bookmark line.
780 ;;
781 (defalias 'bookmark-bmenu-check-position 'bookmark-bmenu-ensure-position)
782 (defun bookmark-bmenu-ensure-position ()
783 "Move to the beginning of the nearest bookmark line."
784 (beginning-of-line)
785 (unless (bookmark-bmenu-bookmark)
786 (if (and (bolp) (eobp))
787 (beginning-of-line 0)
788 (goto-char (point-min))
789 (forward-line bmkp-bmenu-header-lines)))
790 t) ; Older vanilla bookmark code depends on non-nil value.
791
792
793 ;; REPLACES ORIGINAL in `bookmark.el'.
794 ;;
795 ;; 1. Add bookmark to `bmkp-bmenu-marked-bookmarks'. Delete it from `bmkp-flagged-bookmarks'.
796 ;; 2. Don't call `bookmark-bmenu-ensure-position' again at end.
797 ;; 3. Raise error if not in `*Bookmark List*'.
798 ;; 4. Narrower scope for `with-buffer-modified-unmodified' and `let'.
799 ;; 5. If current sort is `s >' (marked first or last), and it was unmarked before, then re-sort.
800 ;; 6. Added optional arg NO-RE-SORT-P to inhibit #5.
801 ;; 7. Added optional arg MSG-P.
802 ;;
803 ;;;###autoload
804 (defun bookmark-bmenu-mark (&optional no-re-sort-p msg-p) ; Bound to `m' in bookmark list
805 "Mark the bookmark on this line, using mark `>'.
806 Add its name to `bmkp-bmenu-marked-bookmarks', after propertizing it
807 with the full bookmark as `bmkp-full-record'.
808
809 If the bookmark was unmarked before, and if the sort order is marked
810 first or last (`s >'), then re-sort.
811
812 Non-interactively:
813 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
814 * Non-nil optional arg MSG-P means display a status message."
815 (interactive (list nil 'MSG-P))
816 (bmkp-bmenu-barf-if-not-in-menu-list)
817 (bookmark-bmenu-ensure-position)
818 (beginning-of-line)
819 (with-buffer-modified-unmodified
820 (let ((inhibit-read-only t))
821 (delete-char 1) (insert ?>) (put-text-property (1- (point)) (point) 'face 'bmkp->-mark)))
822 (let* ((bname (bookmark-bmenu-bookmark))
823 (bmk (bmkp-bookmark-record-from-name bname))
824 (was-unmarked-p nil))
825 ;; Put full bookmark on BNAME as property `bmkp-full-record'.
826 (put-text-property 0 (length bname) 'bmkp-full-record bmk bname)
827 ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21).
828 (unless (memq bname bmkp-bmenu-marked-bookmarks)
829 (setq bmkp-bmenu-marked-bookmarks (cons bname bmkp-bmenu-marked-bookmarks)
830 was-unmarked-p t))
831 (setq bmkp-flagged-bookmarks (delq bmk bmkp-flagged-bookmarks))
832 (unless no-re-sort-p
833 ;; If it was unmarked but now is marked, and if sort order is `s >', then re-sort.
834 (when (and was-unmarked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)))
835 (let ((current-bmk (bookmark-bmenu-bookmark)))
836 (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p))
837 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))))
838 (forward-line 1))
839
840
841 ;; REPLACES ORIGINAL in `bookmark.el'.
842 ;;
843 ;; 1. Remove bookmark from `bmkp-bmenu-marked-bookmarks' and `bmkp-flagged-bookmarks'.
844 ;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'.
845 ;; 3. Don't call `bookmark-bmenu-ensure-position' again at end.
846 ;; 4. Raise error if not in `*Bookmark List*'.
847 ;; 5. Narrower scope for `with-buffer-modified-unmodified' and `let'.
848 ;; 6. If current sort is `s >' (marked first or last), and it was marked before, then re-sort.
849 ;; 7. Added optional arg NO-RE-SORT-P to inhibit #6.
850 ;; 8. Added optional arg MSG-P.
851 ;;
852 ;;;###autoload
853 (defun bookmark-bmenu-unmark (&optional backup no-re-sort-p msg-p) ; Bound to `u' in bookmark list
854 "Unmark the bookmark on this line, then move down to the next.
855 With a prefix argument, move up instead.
856
857 If the bookmark was marked before, and if the sort order is marked
858 first or last (`s >'), then re-sort.
859
860 Non-interactively:
861 * Non-nil optional arg BACKUP (prefix arg) means move up.
862 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
863 * Non-nil optional arg MSG-P means display a status message."
864 (interactive (list current-prefix-arg nil 'MSG-P))
865 (bmkp-bmenu-barf-if-not-in-menu-list)
866 (bookmark-bmenu-ensure-position)
867 (beginning-of-line)
868 (with-buffer-modified-unmodified
869 (let ((inhibit-read-only t))
870 (delete-char 1) (insert " ")))
871 (let ((was-marked-p (memq (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)))
872 (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list
873 (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)
874 bmkp-flagged-bookmarks (delq (bmkp-bookmark-record-from-name (bookmark-bmenu-bookmark))
875 bmkp-flagged-bookmarks))
876 (unless no-re-sort-p
877 ;; If it was marked but now is unmarked, and if sort order is `s >', then re-sort.
878 (when (and was-marked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)))
879 (let ((current-bmk (bookmark-bmenu-bookmark)))
880 (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p))
881 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))))
882 (forward-line (if backup -1 1)))
883
884
885 ;; REPLACES ORIGINAL in `bookmark.el'.
886 ;;
887 ;; 1. Do not use `bookmark-bmenu-ensure-position' as a test - it always returns non-nil anyway.
888 ;; And don't call it again the end.
889 ;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'.
890 ;; 3. Use face `bmkp-D-mark' on the `D' flag.
891 ;; 4. Raise error if not in buffer `*Bookmark List*'.
892 ;; 5. Remove bookmark from `bmkp-bmenu-marked-bookmarks'. Add it to `bmkp-flagged-bookmarks'.
893 ;;
894 ;;;###autoload
895 (defalias 'bmkp-bmenu-flag-for-deletion 'bookmark-bmenu-delete) ; A better name.
896 ;;;###autoload
897 (defun bookmark-bmenu-delete () ; Bound to `d', `k' in bookmark list
898 "Flag this bookmark for deletion, using mark `D'.
899 Use `\\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]' to carry out \
900 the deletions."
901 (interactive)
902 (bmkp-bmenu-barf-if-not-in-menu-list)
903 (beginning-of-line)
904 (bookmark-bmenu-ensure-position)
905 (with-buffer-modified-unmodified
906 (let ((inhibit-read-only t))
907 (delete-char 1) (insert ?D) (put-text-property (1- (point)) (point) 'face 'bmkp-D-mark)))
908 (when (bookmark-bmenu-bookmark) ; Should never be nil, but just to be safe.
909 (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list
910 (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks))
911 ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21).
912 (let ((bmk (bmkp-bookmark-record-from-name (bookmark-bmenu-bookmark))))
913 (unless (memq bmk bmkp-flagged-bookmarks)
914 (setq bmkp-flagged-bookmarks (cons bmk bmkp-flagged-bookmarks)))))
915 (forward-line 1))
916
917
918 ;; REPLACES ORIGINAL in `bookmark.el'.
919 ;;
920 ;; Do not move forward another line at end. Leave point above flagged bookmark.
921 ;;
922 ;;;###autoload
923 (defalias 'bmkp-bmenu-flag-for-deletion-backwards 'bookmark-bmenu-delete-backwards) ; A better name.
924 ;;;###autoload
925 (defun bookmark-bmenu-delete-backwards ()
926 "Mark bookmark on this line to be deleted, then move up one line.
927 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\
928 \\[bookmark-bmenu-execute-deletions]."
929 (interactive)
930 (bookmark-bmenu-delete)
931 (forward-line -2)
932 (bookmark-bmenu-ensure-position))
933
934 ;; REPLACES ORIGINAL in `bookmark.el'.
935 ;;
936 ;; 1. Added optional arg NO-MSG-P.
937 ;; 2. Rebuild the menu list using the last filtered alist in use, `bmkp-latest-bookmark-alist'.
938 ;; 3. Update the menu-list title.
939 ;;
940 (defun bookmark-bmenu-surreptitiously-rebuild-list (&optional no-msg-p)
941 "Rebuild the bookmark list, if it exists.
942 Non-nil optional arg NO-MSG-P means do not show progress messages."
943 (when (get-buffer "*Bookmark List*")
944 (unless no-msg-p (message "Updating bookmark-list display..."))
945 (save-excursion (save-window-excursion (let ((bookmark-alist bmkp-latest-bookmark-alist))
946 (bookmark-bmenu-list 'filteredp))))
947 (unless no-msg-p (message "Updating bookmark-list display...done"))))
948
949
950 ;; REPLACES ORIGINAL in `bookmark.el'.
951 ;;
952 ;; 1. Added arg FILTEREDP.
953 ;; 2. Handles also region bookmarks and buffer (non-file) bookmarks.
954 ;; 3. Uses `pop-to-buffer', not `switch-to-buffer', so we respect `special-display-*'
955 ;; (but keep `one-window-p' if that's the case).
956 ;; 4. If option `bmkp-bmenu-state-file' is non-nil, then the first time since the last quit
957 ;; (or the last Emacs session) restores the last menu-list state.
958 ;; 5. If option `bmkp-bmenu-commands-file' is non-nil, then read that file, which contains
959 ;; user-defined `*Bookmark List*' commands.
960 ;; 6. Many differences in the display itself - see the doc.
961 ;;
962 ;;;###autoload
963 (defalias 'list-bookmarks 'bookmark-bmenu-list)
964 ;;;###autoload
965 (defun bookmark-bmenu-list (&optional filteredp msg-p) ; Bound to `C-x p e', `C-x r l'
966 "Display a list of existing bookmarks, in buffer `*Bookmark List*'.
967 The leftmost column of a bookmark entry shows `D' if the bookmark is
968 flagged for deletion, or `>' if it is marked normally.
969 The second column shows `t' if the bookmark has tags.
970 The third column shows `a' if the bookmark has an annotation.
971
972 The following faces are used for the list entries.
973 Use `customize-face' if you want to change the appearance.
974
975 `bmkp-bad-bookmark', `bmkp-bookmark-list', `bmkp-buffer',
976 `bmkp-desktop', `bmkp-file-handler', `bmkp-function', `bmkp-gnus',
977 `bmkp-info', `bmkp-local-directory',
978 `bmkp-local-file-without-region', `bmkp-local-file-with-region',
979 `bmkp-man', `bmkp-non-file', `bmkp-remote-file', `bmkp-sequence',
980 `bmkp-su-or-sudo', `bmkp-url', `bmkp-variable-list'.
981
982 If option `bmkp-bmenu-state-file' is non-nil then the state of the
983 displayed bookmark-list is saved when you quit it, and it is restored
984 when you next use this command. That saved state is not restored,
985 however, if it represents a different file from the current bookmark
986 file.
987
988 If you call this interactively when buffer `*Bookmark List*' exists,
989 that buffer is refreshed to show all current bookmarks, and any
990 markings are removed. If you instead want to show the buffer in its
991 latest state then just do that: use `C-x b' or similar. If you want
992 to refresh the displayed buffer, to show the latest state, reflecting
993 any additions, deletions, renamings, and so on, use \\<bookmark-bmenu-mode-map>\
994 `\\[bmkp-bmenu-refresh-menu-list]'.
995
996
997 Non-interactively:
998
999 - Non-nil optional argument FILTEREDP means the bookmark list has
1000 been filtered, which means:
1001
1002 * Use `bmkp-bmenu-title' not the default menu-list title.
1003 * Do not reset `bmkp-latest-bookmark-alist' to `bookmark-alist'.
1004
1005 - Non-nil optional arg MSG-P means display progress messages.
1006
1007 In Lisp code, non-nil optional argument FILTEREDP means the bookmark
1008 list has been filtered, which means:
1009 * Use `bmkp-bmenu-title' not the default menu-list title.
1010 * Do not reset `bmkp-latest-bookmark-alist' to `bookmark-alist'."
1011 (interactive "i\np")
1012 (bookmark-maybe-load-default-file)
1013 (when msg-p (message "Gathering bookmarks to display..."))
1014 (when (and bmkp-bmenu-first-time-p bmkp-bmenu-commands-file
1015 (file-readable-p bmkp-bmenu-commands-file))
1016 (with-current-buffer (let ((enable-local-variables ())
1017 (emacs-lisp-mode-hook nil))
1018 (find-file-noselect bmkp-bmenu-commands-file))
1019 (goto-char (point-min))
1020 (while (not (eobp)) (condition-case nil (eval (read (current-buffer))) (error nil)))
1021 (kill-buffer (current-buffer))))
1022 (cond ((and bmkp-bmenu-first-time-p bmkp-bmenu-state-file ; Restore from state file.
1023 (file-readable-p bmkp-bmenu-state-file))
1024 (let ((state ()))
1025 (with-current-buffer (let ((enable-local-variables nil)
1026 (emacs-lisp-mode-hook nil))
1027 (find-file-noselect bmkp-bmenu-state-file))
1028 (goto-char (point-min))
1029 (setq state (condition-case nil (read (current-buffer)) (error nil)))
1030 (kill-buffer (current-buffer)))
1031 (let ((last-bookmark-file-from-state (cdr (assq 'last-bookmark-file state))))
1032 (when (and (consp state)
1033 ;; If bookmark file has changed, then do not use state saved from other file.
1034 (or (not last-bookmark-file-from-state)
1035 (bmkp-same-file-p last-bookmark-file-from-state
1036 bmkp-current-bookmark-file)))
1037 (setq bmkp-sort-comparer (cdr (assq 'last-sort-comparer state))
1038 bmkp-reverse-sort-p (cdr (assq 'last-reverse-sort-p state))
1039 bmkp-reverse-multi-sort-p (cdr (assq 'last-reverse-multi-sort-p state))
1040 bmkp-latest-bookmark-alist (cdr (assq 'last-latest-bookmark-alist state))
1041 bmkp-bmenu-omitted-bookmarks (cdr (assq 'last-bmenu-omitted-bookmarks state))
1042 bmkp-bmenu-marked-bookmarks (cdr (assq 'last-bmenu-marked-bookmarks state))
1043 bmkp-bmenu-filter-function (cdr (assq 'last-bmenu-filter-function state))
1044 bmkp-bmenu-filter-pattern
1045 (or (cdr (assq 'last-bmenu-filter-pattern state)) "")
1046 bmkp-bmenu-title (cdr (assq 'last-bmenu-title state))
1047 bmkp-last-bmenu-bookmark (cdr (assq 'last-bmenu-bookmark state))
1048 bmkp-last-specific-buffer (cdr (assq 'last-specific-buffer state))
1049 bmkp-last-specific-file (cdr (assq 'last-specific-file state))
1050 bookmark-bmenu-toggle-filenames (cdr (assq 'last-bmenu-toggle-filenames state))
1051 bmkp-last-bookmark-file bmkp-current-bookmark-file
1052 bmkp-current-bookmark-file last-bookmark-file-from-state
1053 bmkp-bmenu-before-hide-marked-alist
1054 (cdr (assq 'last-bmenu-before-hide-marked-alist state))
1055 bmkp-bmenu-before-hide-unmarked-alist
1056 (cdr (assq 'last-bmenu-before-hide-unmarked-alist state))))))
1057 (setq bmkp-bmenu-first-time-p nil)
1058 (let ((bookmark-alist (or bmkp-latest-bookmark-alist bookmark-alist)))
1059 (bmkp-bmenu-list-1 'filteredp nil msg-p))
1060 ;; Propertize bookmark names if not already propertized (lists saved with Emacs 20 or
1061 ;; not `bmkp-propertize-bookmark-names-flag'). Check only the first to guess propertized.
1062 (when (and (consp bmkp-bmenu-marked-bookmarks)
1063 (not (get-text-property 0 'bmkp-full-record (car bmkp-bmenu-marked-bookmarks))))
1064 (setq bmkp-bmenu-marked-bookmarks
1065 (condition-case nil
1066 (mapcar (lambda (bname)
1067 (if (get-text-property 0 'bmkp-full-record bname)
1068 bname
1069 (put-text-property 0 (length bname) 'bmkp-full-record
1070 (bmkp-bookmark-record-from-name bname) bname)
1071 bname))
1072 bmkp-bmenu-marked-bookmarks)
1073 (error ())))) ; Reset to () if any name is not a current bookmark.
1074 (when (and (consp bmkp-bmenu-omitted-bookmarks)
1075 (not (get-text-property 0 'bmkp-full-record (car bmkp-bmenu-omitted-bookmarks))))
1076 (setq bmkp-bmenu-omitted-bookmarks
1077 (condition-case nil
1078 (mapcar (lambda (bname)
1079 (if (get-text-property 0 'bmkp-full-record bname)
1080 bname
1081 (put-text-property 0 (length bname) 'bmkp-full-record
1082 (bmkp-bookmark-record-from-name bname) bname)
1083 bname))
1084 bmkp-bmenu-omitted-bookmarks)
1085 (error ())))) ; Reset to () if any name is not a current bookmark.
1086 (when bmkp-last-bmenu-bookmark
1087 (with-current-buffer (get-buffer "*Bookmark List*")
1088 (bmkp-bmenu-goto-bookmark-named bmkp-last-bmenu-bookmark))))
1089 (t
1090 (setq bmkp-bmenu-first-time-p nil)
1091 (bmkp-bmenu-list-1 filteredp (or msg-p (not (get-buffer "*Bookmark List*"))) msg-p))))
1092
1093 (defun bmkp-bmenu-list-1 (filteredp reset-p interactivep)
1094 "Helper for `bookmark-bmenu-list'.
1095 See `bookmark-bmenu-list' for the description of FILTEREDP.
1096 Reset `bmkp-modified-bookmarks' and `bmkp-flagged-bookmarks'.
1097 Non-nil RESET-P means reset `bmkp-bmenu-marked-bookmarks' also.
1098 Non-nil INTERACTIVEP means `bookmark-bmenu-list' was called
1099 interactively, so pop to the bookmark list and communicate the sort
1100 order."
1101 (setq bmkp-modified-bookmarks ()
1102 bmkp-flagged-bookmarks ())
1103 (when reset-p (setq bmkp-bmenu-marked-bookmarks ()))
1104 (unless filteredp (setq bmkp-latest-bookmark-alist bookmark-alist))
1105 (if interactivep
1106 (let ((one-win-p (one-window-p)))
1107 (pop-to-buffer (get-buffer-create "*Bookmark List*"))
1108 (when one-win-p (delete-other-windows)))
1109 (set-buffer (get-buffer-create "*Bookmark List*")))
1110 (let* ((inhibit-read-only t)
1111 (title (if (and filteredp bmkp-bmenu-title (not (equal "" bmkp-bmenu-title)))
1112 bmkp-bmenu-title
1113 "All Bookmarks"))
1114 (show-image-file-icon-p (and (fboundp 'display-images-p) (display-images-p)
1115 bmkp-bmenu-image-bookmark-icon-file
1116 (file-readable-p bmkp-bmenu-image-bookmark-icon-file))))
1117 (erase-buffer)
1118 (when (fboundp 'remove-images) (remove-images (point-min) (point-max)))
1119 (insert (format "%s\n%s\n" title (make-string (length title) ?-)))
1120 (add-text-properties (point-min) (point) (bmkp-face-prop 'bmkp-heading))
1121 (goto-char (point-min))
1122 (insert (format "Bookmark file:\n%s\n\n" bmkp-current-bookmark-file))
1123 (forward-line bmkp-bmenu-header-lines)
1124 (let ((max-width 0)
1125 name markedp flaggedp tags annotation temporaryp start)
1126 (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist
1127 (and (not (eq bmkp-bmenu-filter-function
1128 'bmkp-omitted-alist-only))
1129 bmkp-bmenu-omitted-bookmarks)))
1130 (dolist (bmk bmkp-sorted-alist)
1131 (setq max-width (max max-width (length (bmkp-bookmark-name-from-record bmk)))))
1132 (setq max-width (+ max-width bmkp-bmenu-marks-width))
1133 (dolist (bmk bmkp-sorted-alist)
1134 (setq name (bmkp-bookmark-name-from-record bmk)
1135 markedp (bmkp-marked-bookmark-p bmk)
1136 flaggedp (bmkp-flagged-bookmark-p bmk)
1137 tags (bmkp-get-tags bmk)
1138 annotation (bookmark-get-annotation bmk)
1139 start (+ bmkp-bmenu-marks-width (point)))
1140 (cond (flaggedp
1141 (insert "D") (put-text-property (1- (point)) (point) 'face 'bmkp-D-mark))
1142 (markedp
1143 (insert ">") (put-text-property (1- (point)) (point) 'face 'bmkp->-mark))
1144 (t (insert " ")))
1145 (if (null tags)
1146 (insert " ")
1147 (insert "t") (put-text-property (1- (point)) (point) 'face 'bmkp-t-mark))
1148 (cond ((bmkp-temporary-bookmark-p bmk)
1149 (insert "X") (put-text-property (1- (point)) (point) 'face 'bmkp-X-mark))
1150 ((and annotation (not (string-equal annotation "")))
1151 (insert "a") (put-text-property (1- (point)) (point) 'face 'bmkp-a-mark))
1152 (t (insert " ")))
1153 (if (not (memq bmk bmkp-modified-bookmarks))
1154 (insert " ")
1155 (insert "*")
1156 (put-text-property (1- (point)) (point) 'face 'bmkp-*-mark))
1157 (when (and (featurep 'bookmark+-lit) (bmkp-get-lighting bmk)) ; Highlight highlight overrides.
1158 (put-text-property (1- (point)) (point) 'face 'bmkp-light-mark))
1159 (when (and (bmkp-image-bookmark-p bmk) show-image-file-icon-p)
1160 (let ((image (create-image bmkp-bmenu-image-bookmark-icon-file nil nil :ascent 95)))
1161 (put-image image (point))))
1162 (insert name)
1163 (move-to-column max-width t)
1164 (bmkp-bmenu-propertize-item bmk start (point))
1165 (insert "\n")))
1166 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1167 (bookmark-bmenu-mode)
1168 (when bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t))
1169 (when (and (fboundp 'fit-frame-if-one-window)
1170 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
1171 (fit-frame-if-one-window)))
1172 (when (and interactivep bmkp-sort-comparer)
1173 (bmkp-msg-about-sort-order (bmkp-current-sort-order))))
1174
1175
1176 ;; REPLACES ORIGINAL in `bookmark.el'.
1177 ;;
1178 ;; Redefined.
1179 ;; 1. Get name of the current bookmark from text property `bmkp-bookmark-name'.
1180 ;; 2. Added optional arg FULL, to return full bookmark record.
1181 ;; 3. Use `condition-case' in case we're at eob (so cannot advance).
1182 ;;
1183 (defun bookmark-bmenu-bookmark (&optional full)
1184 "Return the name of the bookmark on this line.
1185 Normally, the string returned is propertized with property
1186 `bmkp-full-record', which records the full bookmark record.
1187 Non-nil optional FULL means return the bookmark record, not the name."
1188 (condition-case nil
1189 (let ((name (save-excursion (forward-line 0) (forward-char (1+ bmkp-bmenu-marks-width))
1190 (get-text-property (point) 'bmkp-bookmark-name))))
1191 (if full
1192 (get-text-property 0 'bmkp-full-record name)
1193 name))
1194 (error nil)))
1195
1196
1197 ;; REPLACES ORIGINAL in `bookmark.el'.
1198 ;;
1199 ;; 1. Mode-line major-mode name is different, and indicates whether in temporary bookmarking minor mode.
1200 ;; 2. Doc string is different.
1201 ;;
1202 (defun bookmark-bmenu-mode ()
1203 "Major mode for editing a list of bookmarks.
1204
1205 More bookmarking help below. Each line represents an Emacs bookmark.
1206 Keys without prefix `C-x' are available only in `*Bookmark List*'.
1207 Other keys are available everywhere.
1208
1209
1210 Help - Bookmark Info
1211 --------------------
1212
1213 \\<bookmark-bmenu-mode-map>\
1214 \\[bookmark-bmenu-toggle-filenames]\t- Toggle showing filenames next to bookmarks
1215 \\[bmkp-bmenu-describe-this-bookmark]\t- Show information about bookmark (`C-u': internal form)
1216 \\[bmkp-bmenu-describe-this+move-down]\t- Show the info, then move to next bookmark
1217 \\[bmkp-bmenu-describe-this+move-up]\t- Show the info, then move to previous bookmark
1218 \\[bmkp-bmenu-describe-marked]\t- Show info about the marked bookmarks (`C-u': internal form)
1219 \\[bookmark-bmenu-locate]\t- Show location of bookmark (in minibuffer)
1220 \\[bookmark-bmenu-show-annotation]\t- Show bookmark's annotation
1221 \\[bookmark-bmenu-show-all-annotations]\t- Show the annotations of all annotated bookmarks
1222
1223 \\[bmkp-list-defuns-in-commands-file]
1224 \t- List the commands defined in `bmkp-bmenu-commands-file'
1225
1226
1227 Bookmark-List Display (`*Bookmark List*')
1228 -----------------------------------------
1229
1230 \\[bmkp-toggle-saving-menu-list-state]\t- Toggle autosaving bookmark-list display state
1231 \\[bmkp-save-menu-list-state]\t- Save bookmark-list display state
1232
1233 \\[bmkp-bmenu-refresh-menu-list]\t- Refresh display to current bookmark list (`C-u': from file)
1234 \\[bmkp-bmenu-show-all]\t- Show all bookmarks
1235 \\[bmkp-toggle-bookmark-set-refreshes]
1236 \t- Toggle whether `bookmark-set' refreshes the bookmark list
1237 \\[bmkp-bmenu-mode-status-help]\t- Show this help
1238 \\[bmkp-bmenu-quit]\t- Quit (`*Bookmark List*')
1239
1240
1241 Bookmark Files
1242 --------------
1243
1244 \\[bmkp-toggle-saving-bookmark-file]\t- Toggle autosaving to the current bookmark file
1245 \\[bookmark-bmenu-save]\t- Save bookmarks now (`C-u': Save As... - prompt for file)
1246
1247 C-u \\[bmkp-bmenu-refresh-menu-list]\t- Revert to bookmarks in the bookmark file (overwrite load)
1248 \\[bmkp-switch-bookmark-file-create]\t- Switch to a different bookmark file (overwrite load)
1249 C-u \\[bmkp-switch-bookmark-file-create]\t- Switch back to the previous bookmark file (overwrite load)
1250
1251 \\[bookmark-bmenu-load]\t- Add bookmarks from a different bookmark file (extra load)
1252 \\[bmkp-bmenu-load-marked-bookmark-file-bookmarks]\t- Load marked bookmark-file bookmarks \
1253 \(extra load)
1254
1255
1256 General
1257 -------
1258
1259 Here:
1260
1261 \\[bmkp-bmenu-dired-marked]\t- Open Dired for the marked file and directory bookmarks
1262 \\[bmkp-bmenu-make-sequence-from-marked]
1263 \t- Create a sequence bookmark from the marked bookmarks
1264 \\[bmkp-temporary-bookmarking-mode]\t- Toggle temporary-only bookmarking (new, empty bookmark file)
1265
1266 Anywhere:
1267
1268 \\[bmkp-toggle-autotemp-on-set]\t- Toggle making bookmarks temporary when setting them
1269 \\[bmkp-set-bookmark-file-bookmark]\t- Create a bookmark to a bookmark file \
1270 \(`\\[bmkp-bookmark-file-jump]' to load)
1271 \\[bmkp-delete-bookmarks]\t- Delete some bookmarks at point or all in buffer
1272 \\[bmkp-make-function-bookmark]\t- Create a function bookmark
1273 \\[bmkp-choose-navlist-of-type]\t- Set the navlist to the bookmarks of a type you choose
1274 \\[bmkp-choose-navlist-from-bookmark-list]\t- Set the navlist to the bookmarks of a \
1275 bookmark-list bookmark
1276 \\[bmkp-navlist-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in navlist
1277 \\[bmkp-this-file/buffer-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in current file/buffer
1278
1279
1280 Create/Set Bookmarks (anywhere)
1281 --------------------
1282
1283 \\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Set/delete an autonamed bookmark here
1284 \\[bmkp-autofile-set]\t- Set and autoname a bookmark for a file
1285 \\[bmkp-file-target-set]\t- Set a bookmark for a file
1286 \\[bmkp-url-target-set]\t- Set a bookmark for a URL
1287 \\[bookmark-set]\t\t- Set a bookmark here
1288 \\[bmkp-set-desktop-bookmark]\t\t- Set a bookmark for the current desktop
1289 \\[bmkp-set-bookmark-file-bookmark]\t\t- Set a bookmark for a bookmark file
1290
1291
1292 Jump to (Visit) Bookmarks
1293 -------------------------
1294
1295 Here:
1296
1297 \\[bookmark-bmenu-select]\t- This bookmark and also visit bookmarks marked `>'
1298 \\[bookmark-bmenu-this-window]\t- Bookmark in the same window
1299 \\[bookmark-bmenu-other-window]\t- Bookmark in another window
1300 \\[bookmark-bmenu-switch-other-window]\t- Bookmark in other window, without selecting it
1301 \\[bookmark-bmenu-1-window]\t- Bookmark in a full-frame window
1302 \\[bookmark-bmenu-2-window]\t- This bookmark and last-visited bookmark
1303
1304 Anywhere:
1305
1306 \\[bookmark-jump]\t- Bookmark by name
1307 \\[bmkp-jump-to-type]\t- Bookmark by type
1308 \\[bmkp-jump-in-navlist]\t- Bookmark in the navigation list
1309 \\[bmkp-lighted-jump]\t- Highlighted bookmark
1310 \\[bmkp-autofile-jump]\t- Autofile bookmark
1311 \\[bmkp-autonamed-jump]\t- Autonamed bookmark
1312 \\[bmkp-autonamed-this-buffer-jump]\t- Autonamed bookmark in buffer
1313 \\[bmkp-temporary-jump]\t- Temporary bookmark
1314 \\[bmkp-desktop-jump]\t- Desktop bookmark
1315 \\[bmkp-bookmark-list-jump]\t- Bookmark-list bookmark
1316 \\[bmkp-bookmark-file-jump]\t- Bookmark-file bookmark
1317 \\[bmkp-dired-jump]\t- Dired bookmark
1318 \\[bmkp-file-jump]\t- File or directory bookmark
1319 \\[bmkp-dired-this-dir-jump]\t- Dired bookmark for this dir
1320 \\[bmkp-file-this-dir-jump]\t- Bookmark for a file or subdir in this dir
1321 \\[bmkp-local-file-jump]\t- Local-file bookmark
1322 \\[bmkp-remote-file-jump]\t- Remote-file bookmark
1323 \\[bmkp-region-jump]\t- Region bookmark
1324 \\[bmkp-image-jump]\t- Image-file bookmark
1325 \\[bmkp-info-jump]\t- Info bookmark
1326 \\[bmkp-man-jump]\t- `man'-page bookmark
1327 \\[bmkp-non-file-jump]\t- Non-file (buffer) bookmark
1328 \\[bmkp-gnus-jump]\t- Gnus bookmark
1329 \\[bmkp-url-jump]\t- URL bookmark
1330 \\[bmkp-variable-list-jump]\t- Variable-list bookmark
1331 \\[bmkp-some-tags-jump]\t- Bookmark having some tags you specify
1332 \\[bmkp-all-tags-jump]\t- Bookmark having each tag you specify
1333 \\[bmkp-some-tags-regexp-jump]\t- Bookmark having a tag that matches a regexp
1334 \\[bmkp-all-tags-regexp-jump]\t- Bookmark having all its tags match a regexp
1335 \\[bmkp-file-some-tags-jump]\t- File bookmark having some tags you specify
1336 \\[bmkp-file-all-tags-jump]\t- File bookmark having each tag you specify
1337 \\[bmkp-file-some-tags-regexp-jump]\t- File bookmark having a tag that matches a regexp
1338 \\[bmkp-file-all-tags-regexp-jump]\t- File bookmark having all its tags match a regexp
1339 \\[bmkp-file-this-dir-some-tags-jump]\t- File in this dir having some tags you specify
1340 \\[bmkp-file-this-dir-all-tags-jump]\t- File in this dir having each tag you specify
1341 \\[bmkp-file-this-dir-some-tags-regexp-jump]\t- File in this dir having a tag that matches a regexp
1342 \\[bmkp-file-this-dir-all-tags-regexp-jump]\t- File in this dir having all its tags match a regexp
1343
1344
1345 Autonamed Bookmarks (anywhere)
1346 -------------------
1347
1348 \\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Create/delete autonamed bookmark at point
1349 \\[bmkp-autonamed-jump]\t- Jump to an autonamed bookmark
1350 \\[bmkp-autonamed-this-buffer-jump]\t- Jump to an autonamed bookmark in a given buffer
1351 \\[bmkp-delete-all-autonamed-for-this-buffer]
1352 \t- Delete all autonamed bookmarks in current buffer
1353
1354
1355 Cycle Bookmarks (anywhere)
1356 ---------------
1357
1358 C-x p n n ...\t- Next bookmark in buffer (C-x p C-n, C-x p down)
1359 C-x p p p ...\t- Prev bookmark in buffer (C-x p C-p, C-x p up)
1360 C-x p f f ...\t- Next bookmark in navlist (C-x p C-f, C-x p right)
1361 C-x p b b ...\t- Prev bookmark in navlist (C-x p C-b, C-x p left)
1362 C-x p next ...\t- MS Windows `Open' next bookmark in navlist
1363 C-x p prior ...\t- MS Windows `Open' previous bookmark in navlist
1364 C-x C-down ...\t- Next highlighted bookmark in buffer
1365 C-x C-up ...\t- Prev highlighted bookmark in buffer
1366
1367
1368 Search-and-Replace in Bookmark Targets (here, in sort order)
1369 --------------------------------------
1370
1371 M-s a C-s\t- Isearch the marked bookmarks (Emacs 23+)
1372 M-s a C-M-s\t- Regexp-isearch the marked bookmarks (Emacs 23+)
1373 \\[bmkp-bmenu-search-marked-bookmarks-regexp]\t- Regexp-search the marked file bookmarks
1374 \\[bmkp-bmenu-query-replace-marked-bookmarks-regexp]\t\t- Query-replace the marked file \
1375 bookmarks
1376
1377
1378 Mark/Unmark Bookmarks
1379 ---------------------
1380
1381 \(Mark means `>'. Flag means `D'. See also `Tags', below.)
1382
1383 \\[bookmark-bmenu-delete]\t- Flag bookmark `D' for deletion, then move down
1384 \\[bookmark-bmenu-delete-backwards]\t- Flag bookmark `D' for deletion, then move up
1385
1386 \\[bookmark-bmenu-mark]\t- Mark bookmark
1387 \\[bookmark-bmenu-unmark]\t- Unmark bookmark (`C-u': move up one line)
1388 \\[bookmark-bmenu-backup-unmark]\t- Unmark previous bookmark (move up, then unmark)
1389
1390 \\[bmkp-bmenu-mark-all]\t- Mark all bookmarks
1391 \\[bmkp-bmenu-regexp-mark]\t- Mark all bookmarks whose names match a regexp
1392 \\[bmkp-bmenu-unmark-all]\t- Unmark all bookmarks (`C-u': interactive query)
1393 \\[bmkp-bmenu-toggle-marks]\t- Toggle marks: unmark the marked and mark the unmarked
1394
1395 \\[bmkp-bmenu-mark-autofile-bookmarks]\t- Mark autofile bookmarks
1396 \\[bmkp-bmenu-mark-autonamed-bookmarks]\t- Mark autonamed bookmarks
1397 \\[bmkp-bmenu-mark-temporary-bookmarks]\t- Mark temporary bookmarks
1398 \\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark highlighted bookmarks (requires `bookmark+-lit.el)
1399 \\[bmkp-bmenu-mark-dired-bookmarks]\t- Mark Dired bookmarks
1400 \\[bmkp-bmenu-mark-file-bookmarks]\t- Mark file & directory bookmarks (`C-u': local only)
1401 \\[bmkp-bmenu-mark-image-bookmarks]\t- Mark image-file bookmarks
1402 \\[bmkp-bmenu-mark-orphaned-local-file-bookmarks]\t- Mark orphaned local file/dir bookmarks (`C-u': \
1403 remote also)
1404 \\[bmkp-bmenu-mark-non-file-bookmarks]\t- Mark non-file (i.e. buffer) bookmarks
1405 \\[bmkp-bmenu-mark-region-bookmarks]\t- Mark region bookmarks
1406 \\[bmkp-bmenu-mark-bookmark-file-bookmarks]\t- Mark bookmark-file bookmarks
1407 \\[bmkp-bmenu-mark-variable-list-bookmarks]\t- Mark variable-list bookmarks
1408 \\[bmkp-bmenu-mark-desktop-bookmarks]\t- Mark desktop bookmarks
1409 \\[bmkp-bmenu-mark-info-bookmarks]\t- Mark Info bookmarks
1410 \\[bmkp-bmenu-mark-man-bookmarks]\t- Mark `man' page bookmarks (that's `M' twice, not Meta-M)
1411 \\[bmkp-bmenu-mark-gnus-bookmarks]\t- Mark Gnus bookmarks
1412 \\[bmkp-bmenu-mark-url-bookmarks]\t- Mark URL bookmarks
1413 \\[bmkp-bmenu-mark-w3m-bookmarks]\t- Mark W3M (URL) bookmarks
1414
1415
1416 Modify, Delete Bookmarks
1417 ------------------------
1418
1419 \(See also `Tags', next.)
1420
1421 \\[bmkp-bmenu-edit-bookmark-name-and-file]\t- Rename or relocate bookmark
1422 \\[bmkp-bmenu-edit-tags]\t- Edit bookmark's tags
1423 \\[bookmark-bmenu-edit-annotation]\t- Edit bookmark's annotation
1424 \\[bmkp-bmenu-edit-bookmark-record]\t- Edit internal record for bookmark (Lisp)
1425 \\[bmkp-bmenu-edit-marked]\t- Edit internal records of marked bookmarks (Lisp)
1426 \\[bmkp-bmenu-toggle-temporary]\t- Toggle temporary/savable status of bookmark
1427 \\[bmkp-bmenu-toggle-marked-temporary/savable]\t- Toggle temporary/savable status of marked bookmarks
1428 \\[bmkp-delete-all-temporary-bookmarks]\t- Delete all temp bookmarks
1429 \\[bookmark-bmenu-execute-deletions]\t- Delete (visible) bookmarks flagged `D'
1430 \\[bmkp-bmenu-delete-marked]\t- Delete (visible) bookmarks marked `>'
1431
1432
1433 Bookmark Tags
1434 -------------
1435
1436 \\[bmkp-add-tags]\t- Add some tags to a bookmark
1437 \\[bmkp-remove-tags]\t- Remove some tags from a bookmark
1438 \\[bmkp-remove-all-tags]\t- Remove all tags from a bookmark
1439 \\[bmkp-remove-tags-from-all]\t- Remove some tags from all bookmarks
1440 \\[bmkp-rename-tag]\t- Rename a tag in all bookmarks
1441 \\[bmkp-list-all-tags]\t- List all tags used in any bookmarks (`C-u': show tag values)
1442 \\[bmkp-bmenu-edit-tags]\t- Edit bookmark's tags
1443 \\[bmkp-bmenu-set-tag-value]\t- Set the value of a tag (as attribute)
1444
1445 \\[bmkp-bmenu-add-tags-to-marked]\t- Add some tags to the marked bookmarks
1446 \\[bmkp-bmenu-remove-tags-from-marked]\t- Remove some tags from the marked bookmarks
1447
1448 \\[bmkp-bmenu-mark-bookmarks-tagged-regexp]\t- Mark bookmarks having at least one \
1449 tag that matches a regexp
1450 \\[bmkp-bmenu-mark-bookmarks-tagged-some]\t- Mark bookmarks having at least one tag \
1451 in a set (OR)
1452 \\[bmkp-bmenu-mark-bookmarks-tagged-all]\t- Mark bookmarks having all of the tags \
1453 in a set (AND)
1454 \\[bmkp-bmenu-mark-bookmarks-tagged-none]\t- Mark bookmarks not having any of the tags \
1455 in a set (NOT OR)
1456 \\[bmkp-bmenu-mark-bookmarks-tagged-not-all]\t- Mark bookmarks not having all of the \
1457 tags in a set (NOT AND)
1458
1459 \\[bmkp-bmenu-unmark-bookmarks-tagged-regexp]\t- Unmark bookmarks having a \
1460 tag that matches a regexp
1461 \\[bmkp-bmenu-unmark-bookmarks-tagged-some]\t- Unmark bookmarks having at least one \
1462 tag in a set (OR)
1463 \\[bmkp-bmenu-unmark-bookmarks-tagged-all]\t- Unmark bookmarks having all of the tags \
1464 in a set (AND)
1465 \\[bmkp-bmenu-unmark-bookmarks-tagged-none]\t- Unmark bookmarks not having any tags \
1466 in a set (NOT OR)
1467 \\[bmkp-bmenu-unmark-bookmarks-tagged-not-all]\t- Unmark bookmarks not having all tags \
1468 in a set (NOT AND)
1469
1470
1471 Bookmark Highlighting
1472 ---------------------
1473
1474 \\[bmkp-bmenu-show-only-lighted]\t- Show only the highlighted bookmarks
1475 \\[bmkp-bmenu-set-lighting]\t- Set highlighting for bookmark
1476 \\[bmkp-bmenu-set-lighting-for-marked]\t- Set highlighting for marked bookmarks
1477 \\[bmkp-bmenu-light]\t- Highlight bookmark
1478 \\[bmkp-bmenu-unlight]\t- Unhighlight bookmark
1479 \\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark the highlighted bookmarks
1480 \\[bmkp-bmenu-light-marked]\t- Highlight the marked bookmarks
1481 \\[bmkp-bmenu-unlight-marked]\t- Unhighlight the marked bookmarks
1482 \\[bmkp-light-bookmark-this-buffer]\t- Highlight a bookmark in current buffer
1483 \\[bmkp-unlight-bookmark-this-buffer]\t- Unhighlight a bookmark in current buffer
1484 \\[bmkp-light-bookmarks]\t- Highlight bookmarks (see prefix arg)
1485 \\[bmkp-unlight-bookmarks]\t- Unhighlight bookmarks (see prefix arg)
1486 \\[bmkp-bookmarks-lighted-at-point]\t- List bookmarks highlighted at point
1487 \\[bmkp-unlight-bookmark-here]\t- Unhighlight a bookmark at point or on same line
1488
1489
1490 Sort `*Bookmark List*'
1491 ----------------------
1492
1493 \(Repeat to cycle normal/reversed/off, except as noted.)
1494
1495 \\[bmkp-reverse-sort-order]\t- Reverse current sort direction (repeat to toggle)
1496 \\[bmkp-reverse-multi-sort-order]\t- Complement sort predicate decisions (repeat \
1497 to toggle)
1498 \\[bmkp-bmenu-change-sort-order-repeat]\t- Cycle sort orders (repeat \
1499 to cycle)
1500
1501 \\[bmkp-bmenu-sort-marked-before-unmarked]\t- Sort marked (`>') bookmarks first
1502 \\[bmkp-bmenu-sort-flagged-before-unflagged]\t- Sort flagged (`D') bookmarks first
1503 \\[bmkp-bmenu-sort-modified-before-unmodified]\t- Sort modified (`*') bookmarks first
1504 \\[bmkp-bmenu-sort-tagged-before-untagged]\t- Sort tagged (`t') bookmarks first
1505
1506 \\[bmkp-bmenu-sort-by-last-buffer-or-file-access]\t- Sort by last buffer or file \
1507 access
1508 \\[bmkp-bmenu-sort-by-Gnus-thread]\t- Sort by Gnus thread: group, article, message
1509 \\[bmkp-bmenu-sort-by-Info-location]\t- Sort by Info manual, node, position
1510 \\[bmkp-bmenu-sort-by-bookmark-type]\t- Sort by bookmark type
1511 \\[bmkp-bmenu-sort-by-bookmark-name]\t- Sort by bookmark name
1512 \\[bmkp-bmenu-sort-by-creation-time]\t- Sort by bookmark creation time
1513 \\[bmkp-bmenu-sort-by-last-bookmark-access]\t- Sort by last bookmark access time
1514 \\[bmkp-bmenu-sort-by-bookmark-visit-frequency]\t- Sort by bookmark visit frequency
1515 \\[bmkp-bmenu-sort-by-url]\t- Sort by URL
1516
1517 \\[bmkp-bmenu-sort-by-local-file-type]\t- Sort by local file type: file, symlink, dir
1518 \\[bmkp-bmenu-sort-by-file-name]\t- Sort by file name
1519 \\[bmkp-bmenu-sort-by-local-file-size]\t- Sort by local file size
1520 \\[bmkp-bmenu-sort-by-last-local-file-access]\t- Sort by last local file access
1521 \\[bmkp-bmenu-sort-by-last-local-file-update]\t- Sort by last local file update (edit)
1522
1523
1524 Hide/Show (`*Bookmark List*')
1525 -----------------------------
1526
1527 \\[bmkp-bmenu-show-all]\t- Show all bookmarks
1528 \\[bmkp-bmenu-toggle-show-only-marked]\t- Toggle showing only marked bookmarks
1529 \\[bmkp-bmenu-toggle-show-only-unmarked]\t- Toggle showing only unmarked bookmarks
1530 \\[bmkp-bmenu-show-only-autofiles]\t- Show only autofile bookmarks
1531 \\[bmkp-bmenu-show-only-autonamed]\t- Show only autonamed bookmarks
1532 \\[bmkp-bmenu-show-only-temporary]\t- Show only temporary bookmarks
1533 \\[bmkp-bmenu-show-only-dired]\t- Show only Dired bookmarks
1534 \\[bmkp-bmenu-show-only-files]\t- Show only file & directory bookmarks (`C-u': local only)
1535 \\[bmkp-bmenu-show-only-image-files]\t- Show only image-file bookmarks
1536 \\[bmkp-bmenu-show-only-orphaned-local-files]\t- Show only orphaned local file bookmarks (`C-u': \
1537 remote also)
1538 \\[bmkp-bmenu-show-only-non-files]\t- Show only non-file (i.e. buffer) bookmarks
1539 \\[bmkp-bmenu-show-only-regions]\t- Show only region bookmarks
1540 \\[bmkp-bmenu-show-only-bookmark-files]\t- Show only bookmark-file bookmarks
1541 \\[bmkp-bmenu-show-only-variable-lists]\t- Show only variable-list bookmarks
1542 \\[bmkp-bmenu-show-only-desktops]\t- Show only desktop bookmarks
1543 \\[bmkp-bmenu-show-only-info-nodes]\t- Show only Info bookmarks
1544 \\[bmkp-bmenu-show-only-man-pages]\t- Show only `man' page bookmarks
1545 \\[bmkp-bmenu-show-only-gnus]\t- Show only Gnus bookmarks
1546 \\[bmkp-bmenu-show-only-urls]\t- Show only URL bookmarks
1547 \\[bmkp-bmenu-show-only-w3m-urls]\t- Show only W3M (URL) bookmarks
1548 \\[bmkp-bmenu-filter-bookmark-name-incrementally]\t- Incrementally show only bookmarks \
1549 whose names match a regexp
1550 \\[bmkp-bmenu-filter-file-name-incrementally]\t- Incrementally show only bookmarks whose \
1551 files match a regexp
1552 \\[bmkp-bmenu-filter-annotation-incrementally]\t- Incrementally show bookmarks whose \
1553 annotations match regexp
1554 \\[bmkp-bmenu-filter-tags-incrementally]\t- Incrementally show only bookmarks whose tags \
1555 match a regexp
1556 \\[bmkp-bmenu-show-only-tagged]\t- Show only bookmarks that have tags
1557
1558
1559 Omit/Un-omit (`*Bookmark List*')
1560 --------------------------------
1561
1562 \\[bmkp-bmenu-show-only-omitted]\t- Show (only) the omitted bookmarks
1563 \\[bmkp-bmenu-show-all]\t- Show the un-omitted bookmarks (all)
1564 \\[bmkp-bmenu-omit/unomit-marked]\t- Omit the marked bookmarks; un-omit them if after \
1565 `\\[bmkp-bmenu-show-only-omitted]'
1566 \\[bmkp-unomit-all]\t- Un-omit all omitted bookmarks
1567
1568
1569 Define Commands for `*Bookmark List*'
1570 -------------------------------------
1571
1572 \\[bmkp-bmenu-define-command]\t- Define a command to restore the current sort order & filter
1573 \\[bmkp-bmenu-define-full-snapshot-command]\t- Define a command to restore the current \
1574 bookmark-list state
1575 \\[bmkp-define-tags-sort-command]\t- Define a command to sort bookmarks by tags
1576 \\[bmkp-bmenu-define-jump-marked-command]\t- Define a command to jump to a bookmark that is \
1577 now marked
1578
1579
1580 Options for `*Bookmark List*'
1581 -----------------------------
1582
1583 bookmark-bmenu-file-column - Bookmark width if files are shown
1584 bookmark-bmenu-toggle-filenames - Show filenames initially?
1585
1586 bmkp-bmenu-omitted-bookmarks - List of omitted bookmarks
1587 bmkp-bmenu-state-file - File to save bookmark-list state
1588 (\"home\") nil: do not save/restore
1589 bmkp-sort-comparer - Initial sort
1590 bmkp-sort-orders-for-cycling-alist
1591 \t - Sort orders that `\\[bmkp-bmenu-change-sort-order-repeat]'... cycles
1592
1593
1594 Other Options
1595 -------------
1596
1597 bookmark-automatically-show-annotations - Show annotation when visit?
1598 bookmark-completion-ignore-case - Case-sensitive completion?
1599 bookmark-default-file - File to save bookmarks in
1600 bookmark-menu-length - Max size of bookmark-name menu item
1601 bookmark-save-flag - Whether and when to save
1602 bookmark-use-annotations - Query for annotation when saving?
1603 bookmark-version-control - Numbered backups of bookmark file?
1604
1605 bmkp-autoname-format - Format of autonamed bookmark name
1606 bmkp-last-as-first-bookmark-file - Whether to start with last b. file
1607 bmkp-crosshairs-flag - Highlight position when visit?
1608 bmkp-menu-popup-max-length - Use menus to choose bookmarks?
1609 bmkp-save-new-location-flag - Save if bookmark relocated?
1610 bmkp-sequence-jump-display-function - How to display a sequence
1611 bmkp-sort-comparer - Predicates for sorting bookmarks
1612 bmkp-su-or-sudo-regexp - Bounce-show each end of region?
1613 bmkp-this-file/buffer-cycle-sort-comparer - cycling sort for here
1614 bmkp-use-region - Activate saved region when visit?"
1615 (kill-all-local-variables)
1616 (use-local-map bookmark-bmenu-mode-map)
1617 (setq truncate-lines t
1618 buffer-read-only t
1619 major-mode 'bookmark-bmenu-mode
1620 mode-name (if bmkp-temporary-bookmarking-mode "TEMPORARY Bookmarking" "Bookmarks"))
1621 (if (fboundp 'run-mode-hooks)
1622 (run-mode-hooks 'bookmark-bmenu-mode-hook)
1623 (run-hooks 'bookmark-bmenu-mode-hook)))
1624
1625
1626 ;; REPLACES ORIGINAL in `bookmark.el'.
1627 ;;
1628 ;; 1. Corrected (rewrote). Toggle var first (unless SHOW). Call fn according to the var (& to SHOW).
1629 ;; 2. Added optional arg NO-MSG-P.
1630 ;;
1631 (defun bookmark-bmenu-toggle-filenames (&optional show no-msg-p)
1632 "Toggle whether filenames are shown in the bookmark list.
1633 Toggle the value of `bookmark-bmenu-toggle-filenames', unless SHOW is
1634 non-nil.
1635 Optional argument SHOW means show them unconditionally.
1636
1637 Non-nil optional arg NO-MSG-P means do not show progress messages."
1638 (interactive)
1639 (unless show (setq bookmark-bmenu-toggle-filenames (not bookmark-bmenu-toggle-filenames)))
1640 (let ((bookmark-bmenu-toggle-filenames (or show bookmark-bmenu-toggle-filenames)))
1641 (if bookmark-bmenu-toggle-filenames
1642 (bookmark-bmenu-show-filenames no-msg-p)
1643 (bookmark-bmenu-hide-filenames no-msg-p))))
1644
1645
1646 ;; REPLACES ORIGINAL in `bookmark.el'.
1647 ;;
1648 ;; 1. Put `mouse-face' on whole line, with the same help-echo as for the bookmark name.
1649 ;; 2. Correct FORCE behavior.
1650 ;; 3. Correct doc string.
1651 ;; 4. Added optional arg NO-MSG-P and progress message.
1652 ;; 5. Fit one-window frame.
1653 ;;
1654 (defun bookmark-bmenu-show-filenames (&optional force no-msg-p)
1655 "Show file names if `bookmark-bmenu-toggle-filenames' is non-nil.
1656 Otherwise do nothing, except non-nil optional argument FORCE has the
1657 same effect as non-nil `bookmark-bmenu-toggle-filenames'. FORCE is
1658 mainly for debugging.
1659 Non-nil optional arg NO-MSG-P means do not show progress messages."
1660 (when (or force bookmark-bmenu-toggle-filenames)
1661 (unless no-msg-p (message "Showing file names..."))
1662 (with-buffer-modified-unmodified
1663 (save-excursion
1664 (save-window-excursion
1665 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1666 (setq bookmark-bmenu-hidden-bookmarks ())
1667 (let ((inhibit-read-only t))
1668 (while (< (point) (point-max))
1669 (let ((bmk (bookmark-bmenu-bookmark)))
1670 (setq bookmark-bmenu-hidden-bookmarks (cons bmk bookmark-bmenu-hidden-bookmarks))
1671 (move-to-column bookmark-bmenu-file-column t)
1672 (delete-region (point) (line-end-position))
1673 (insert " ")
1674 (bookmark-insert-location bmk t) ; Pass the NO-HISTORY arg.
1675 (when (if (fboundp 'display-color-p) ; Emacs 21+.
1676 (and (display-color-p) (display-mouse-p))
1677 window-system)
1678 (let ((help (get-text-property (+ bmkp-bmenu-marks-width
1679 (line-beginning-position)) 'help-echo)))
1680 (put-text-property (+ bmkp-bmenu-marks-width (line-beginning-position))
1681 (point) 'mouse-face 'highlight)
1682 (when help (put-text-property (+ bmkp-bmenu-marks-width
1683 (line-beginning-position))
1684 (point) 'help-echo help))))
1685 (forward-line 1)))))))
1686 (unless no-msg-p (message "Showing file names...done"))
1687 (when (and (fboundp 'fit-frame-if-one-window)
1688 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
1689 (fit-frame-if-one-window))))
1690
1691
1692 ;; REPLACES ORIGINAL in `bookmark.el'.
1693 ;;
1694 ;; 1. Add text properties when hiding filenames.
1695 ;; 2. Do not set or use `bookmark-bmenu-bookmark-column' - use `bmkp-bmenu-marks-width' always.
1696 ;; 3. Correct FORCE behavior.
1697 ;; 4. Correct doc string.
1698 ;; 5. Added optional arg NO-MSG-P and progress message.
1699 ;; 6. Fit one-window frame.
1700 ;;
1701 (defun bookmark-bmenu-hide-filenames (&optional force no-msg-p)
1702 "Hide filenames if `bookmark-bmenu-toggle-filenames' is nil.
1703 Otherwise do nothing, except non-nil optional argument FORCE has the
1704 same effect as nil `bookmark-bmenu-toggle-filenames'. FORCE is mainly
1705 for debugging.
1706 Non-nil optional arg NO-MSG-P means do not show progress messages."
1707 (when (or force (not bookmark-bmenu-toggle-filenames))
1708 (unless no-msg-p (message "Hiding file names..."))
1709 (with-buffer-modified-unmodified
1710 (save-excursion
1711 (save-window-excursion
1712 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1713 (setq bookmark-bmenu-hidden-bookmarks (nreverse bookmark-bmenu-hidden-bookmarks))
1714 (let ((max-width 0))
1715 (dolist (name bookmark-bmenu-hidden-bookmarks)
1716 (setq max-width (max max-width (length name))))
1717 (setq max-width (+ max-width bmkp-bmenu-marks-width))
1718 (save-excursion
1719 (let ((inhibit-read-only t))
1720 (while bookmark-bmenu-hidden-bookmarks
1721 (move-to-column bmkp-bmenu-marks-width t)
1722 (bookmark-kill-line)
1723 (let ((name (car bookmark-bmenu-hidden-bookmarks))
1724 (start (point))
1725 end)
1726 (insert name)
1727 (move-to-column max-width t)
1728 (setq end (point))
1729 (bmkp-bmenu-propertize-item name start end))
1730 (setq bookmark-bmenu-hidden-bookmarks (cdr bookmark-bmenu-hidden-bookmarks))
1731 (forward-line 1))))))))
1732 (unless no-msg-p (message "Hiding file names...done"))
1733 (when (and (fboundp 'fit-frame-if-one-window)
1734 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
1735 (fit-frame-if-one-window))))
1736
1737
1738 ;; REPLACES ORIGINAL in `bookmark.el'.
1739 ;;
1740 ;; 1. Prefix arg reverses `bmkp-use-region'.
1741 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1742 ;;
1743 ;;;###autoload
1744 (defun bookmark-bmenu-1-window (&optional use-region-p) ; Bound to `1' in bookmark list
1745 "Select this line's bookmark, alone, in full frame.
1746 See `bookmark-jump' for info about the prefix arg."
1747 (interactive "P")
1748 (bmkp-bmenu-barf-if-not-in-menu-list)
1749 (bookmark-bmenu-ensure-position)
1750 (bmkp-jump-1 (bookmark-bmenu-bookmark) 'pop-to-buffer use-region-p)
1751 (bury-buffer (other-buffer))
1752 (delete-other-windows))
1753
1754
1755 ;; REPLACES ORIGINAL in `bookmark.el'.
1756 ;;
1757 ;; 1. Prefix arg reverses `bmkp-use-region'.
1758 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1759 ;;
1760 ;;;###autoload
1761 (defun bookmark-bmenu-2-window (&optional use-region-p) ; Bound to `2' in bookmark list
1762 "Select this line's bookmark, with previous buffer in second window.
1763 See `bookmark-jump' for info about the prefix arg."
1764 (interactive "P")
1765 (bmkp-bmenu-barf-if-not-in-menu-list)
1766 (bookmark-bmenu-ensure-position)
1767 (let ((bookmark-name (bookmark-bmenu-bookmark))
1768 (menu (current-buffer))
1769 (pop-up-windows t))
1770 (delete-other-windows)
1771 (switch-to-buffer (other-buffer))
1772 ;; (let ((bookmark-automatically-show-annotations nil)) ; $$$$$$ Needed?
1773 (bmkp-jump-1 bookmark-name 'pop-to-buffer use-region-p)
1774 (bury-buffer menu)))
1775
1776
1777 ;; REPLACES ORIGINAL in `bookmark.el'.
1778 ;;
1779 ;; 1. Prefix arg reverses `bmkp-use-region'.
1780 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1781 ;;
1782 ;;;###autoload
1783 (defun bookmark-bmenu-this-window (&optional use-region-p) ; Bound to `RET' in bookmark list
1784 "Select this line's bookmark in this window.
1785 See `bookmark-jump' for info about the prefix arg."
1786 (interactive "P")
1787 (bmkp-bmenu-barf-if-not-in-menu-list)
1788 (bookmark-bmenu-ensure-position)
1789 (let ((bookmark-name (bookmark-bmenu-bookmark)))
1790 (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)))
1791
1792
1793 ;; REPLACES ORIGINAL in `bookmark.el'.
1794 ;;
1795 ;; 1. Use `pop-to-buffer', not `switch-to-buffer-other-window'.
1796 ;; 2. Prefix arg reverses `bmkp-use-region'.
1797 ;; 3. Raise error if not in buffer `*Bookmark List*'.
1798 ;;
1799 ;;;###autoload
1800 (defun bookmark-bmenu-other-window (&optional use-region-p) ; Bound to `o' in bookmark list
1801 "Select this line's bookmark in other window. Show `*Bookmark List*' still.
1802 See `bookmark-jump' for info about the prefix arg."
1803 (interactive "P")
1804 (bmkp-bmenu-barf-if-not-in-menu-list)
1805 (bookmark-bmenu-ensure-position)
1806 (let ((bookmark-name (bookmark-bmenu-bookmark)))
1807 ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed?
1808 (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)))
1809
1810
1811 ;; REPLACES ORIGINAL in `bookmark.el'.
1812 ;;
1813 ;; 1. Prefix arg reverses `bmkp-use-region'.
1814 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1815 ;;
1816 ;;;###autoload
1817 (defun bookmark-bmenu-switch-other-window (&optional use-region-p) ; Bound to `C-o' in bookmark list
1818 "Make the other window select this line's bookmark.
1819 The current window remains selected.
1820 See `bookmark-jump' for info about the prefix arg."
1821 (interactive "P")
1822 (bmkp-bmenu-barf-if-not-in-menu-list)
1823 (bookmark-bmenu-ensure-position)
1824 (let ((bookmark-name (bookmark-bmenu-bookmark))
1825 (pop-up-windows t)
1826 (same-window-buffer-names ())
1827 (same-window-regexps ()))
1828 ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed?
1829 (bmkp-jump-1 bookmark-name 'display-buffer use-region-p)))
1830
1831
1832 ;; REPLACES ORIGINAL in `bookmark.el'.
1833 ;;
1834 ;; 1. Prefix arg reverses `bmkp-use-region'.
1835 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1836 ;;
1837 ;;;###autoload
1838 (defun bookmark-bmenu-other-window-with-mouse (event &optional use-region-p)
1839 "Select clicked bookmark in other window. Show `*Bookmark List*' still."
1840 (interactive "e\nP")
1841 (with-current-buffer (window-buffer (posn-window (event-end event)))
1842 (save-excursion (goto-char (posn-point (event-end event)))
1843 (bookmark-bmenu-other-window use-region-p))))
1844
1845
1846 ;; REPLACES ORIGINAL in `bookmark.el'.
1847 ;;
1848 ;; 1. Added optional arg MSG-P.
1849 ;; 2. Call `bookmark-show-annotation' with arg MSG-P.
1850 ;; 3. Raise error if not in buffer `*Bookmark List*'.
1851 ;;
1852 ;;;###autoload
1853 (defun bookmark-bmenu-show-annotation (msg-p)
1854 "Show the annotation for the current bookmark in another window."
1855 (interactive "p")
1856 (bmkp-bmenu-barf-if-not-in-menu-list)
1857 (bookmark-bmenu-ensure-position)
1858 (let ((bookmark (bookmark-bmenu-bookmark)))
1859 (bookmark-show-annotation bookmark msg-p)))
1860
1861
1862 ;; REPLACES ORIGINAL in `bookmark.el'.
1863 ;;
1864 ;; 1. Added optional arg MARKEDP: handle bookmarks marked `>', not just those flagged `D'.
1865 ;; 2. Use `bookmark-bmenu-surreptitiously-rebuild-list', instead of using
1866 ;; `bookmark-bmenu-list', updating the modification count, and saving.
1867 ;; 3. Update `bmkp-latest-bookmark-alist' to reflect the deletions.
1868 ;; 4. Pass full bookmark, not name, to `delete' (and do not use `assoc').
1869 ;; 5. Use `bmkp-bmenu-goto-bookmark-named'.
1870 ;; 6. Added status messages.
1871 ;; 7. Raise error if not in buffer `*Bookmark List*'.
1872 ;;
1873 ;;;###autoload
1874 (defun bookmark-bmenu-execute-deletions (&optional markedp) ; Bound to `x' in bookmark list
1875 "Delete (visible) bookmarks flagged `D'.
1876 With a prefix argument, delete the bookmarks marked `>' instead, after
1877 confirmation."
1878 (interactive "P")
1879 (bmkp-bmenu-barf-if-not-in-menu-list)
1880 (if (or (not markedp) (yes-or-no-p "Delete bookmarks marked `>' (not `D') "))
1881 (let* ((mark-type (if markedp "^>" "^D"))
1882 (o-str (and (not (looking-at mark-type)) (bookmark-bmenu-bookmark)))
1883 (o-point (point))
1884 (count 0))
1885 (message "Deleting bookmarks...")
1886 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
1887 (while (re-search-forward mark-type (point-max) t)
1888 (let* ((bmk-name (bookmark-bmenu-bookmark))
1889 (bmk (bookmark-get-bookmark bmk-name)))
1890 (bookmark-delete bmk-name 'BATCHP)
1891 ;; Count is misleading if the bookmark is not really in `bookmark-alist'.
1892 (setq count (1+ count)
1893 bmkp-latest-bookmark-alist (delete bmk bmkp-latest-bookmark-alist))))
1894 (if (<= count 0)
1895 (message (if markedp "No marked bookmarks" "No bookmarks flagged for deletion"))
1896 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
1897 (message "Deleted %d bookmarks" count))
1898 (if o-str
1899 (bmkp-bmenu-goto-bookmark-named o-str)
1900 (goto-char o-point)
1901 (beginning-of-line)))
1902 (message "OK, nothing deleted")))
1903
1904
1905 ;; REPLACES ORIGINAL in `bookmark.el'.
1906 ;;
1907 ;; 1. Do not call `bookmark-bmenu-list' (it was already called).
1908 ;; 2. Raise error if not in buffer `*Bookmark List*'.
1909 ;; 3. Use `bmkp-bmenu-goto-bookmark-named' instead of just searching for name.
1910 ;;
1911 ;;;###autoload
1912 (defun bookmark-bmenu-rename () ; Bound to `r' in bookmark list
1913 "Rename bookmark on current line. Prompts for a new name."
1914 (interactive)
1915 (bmkp-bmenu-barf-if-not-in-menu-list)
1916 (bookmark-bmenu-ensure-position)
1917 (let ((newname (bookmark-rename (bookmark-bmenu-bookmark))))
1918 (bmkp-bmenu-goto-bookmark-named newname)))
1919
1920 ;;(@* "Bookmark+ Functions (`bmkp-*')")
1921 ;;; Bookmark+ Functions (`bmkp-*') -----------------------------------
1922
1923
1924 ;;(@* "Menu-List (`*-bmenu-*') Filter Commands")
1925 ;; *** Menu-List (`*-bmenu-*') Filter Commands ***
1926
1927 ;;;###autoload
1928 (defun bmkp-bmenu-show-only-autofiles (&optional arg) ; Bound to `A S' in bookmark list
1929 "Display (only) the autofile bookmarks.
1930 This means bookmarks whose names are the same as their (non-directory)
1931 file names. But with a prefix arg you are prompted for a prefix that
1932 each bookmark name must have."
1933 (interactive "P")
1934 (bmkp-bmenu-barf-if-not-in-menu-list)
1935 (setq bmkp-bmenu-filter-function (if (not arg)
1936 'bmkp-autofile-alist-only
1937 (let ((prefix (read-string "Prefix for bookmark names: "
1938 nil nil "")))
1939 `(lambda () (bmkp-autofile-alist-only ,prefix))))
1940 bmkp-bmenu-title "Autofile Bookmarks")
1941 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1942 (setq bmkp-latest-bookmark-alist bookmark-alist)
1943 (bookmark-bmenu-list 'filteredp))
1944 (when (interactive-p)
1945 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autofile bookmarks are shown")))
1946
1947 ;;;###autoload
1948 (defun bmkp-bmenu-show-only-autonamed () ; Bound to `# S' in bookmark list
1949 "Display (only) the autonamed bookmarks."
1950 (interactive)
1951 (bmkp-bmenu-barf-if-not-in-menu-list)
1952 (setq bmkp-bmenu-filter-function 'bmkp-autonamed-alist-only
1953 bmkp-bmenu-title "Autonamed Bookmarks")
1954 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1955 (setq bmkp-latest-bookmark-alist bookmark-alist)
1956 (bookmark-bmenu-list 'filteredp))
1957 (when (interactive-p)
1958 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autonamed bookmarks are shown")))
1959
1960 ;;;###autoload
1961 (defun bmkp-bmenu-show-only-bookmark-files () ; Bound to `Y S' in bookmark list
1962 "Display (only) the bookmark-file bookmarks."
1963 (interactive)
1964 (bmkp-bmenu-barf-if-not-in-menu-list)
1965 (setq bmkp-bmenu-filter-function 'bmkp-bookmark-file-alist-only
1966 bmkp-bmenu-title "Bookmark-File Bookmarks")
1967 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1968 (setq bmkp-latest-bookmark-alist bookmark-alist)
1969 (bookmark-bmenu-list 'filteredp))
1970 (when (interactive-p)
1971 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmark-file bookmarks are shown")))
1972
1973 ;;;###autoload
1974 (defun bmkp-bmenu-show-only-desktops () ; Bound to `K S' in bookmark list
1975 "Display (only) the desktop bookmarks."
1976 (interactive)
1977 (bmkp-bmenu-barf-if-not-in-menu-list)
1978 (setq bmkp-bmenu-filter-function 'bmkp-desktop-alist-only
1979 bmkp-bmenu-title "Desktop Bookmarks")
1980 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1981 (setq bmkp-latest-bookmark-alist bookmark-alist)
1982 (bookmark-bmenu-list 'filteredp))
1983 (when (interactive-p)
1984 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only desktop bookmarks are shown")))
1985
1986 ;;;###autoload
1987 (defun bmkp-bmenu-show-only-dired () ; Bound to `M-d M-s' in bookmark list
1988 "Display (only) the Dired bookmarks."
1989 (interactive)
1990 (bmkp-bmenu-barf-if-not-in-menu-list)
1991 (setq bmkp-bmenu-filter-function 'bmkp-dired-alist-only
1992 bmkp-bmenu-title "Dired Bookmarks")
1993 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
1994 (setq bmkp-latest-bookmark-alist bookmark-alist)
1995 (bookmark-bmenu-list 'filteredp))
1996 (when (interactive-p)
1997 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Dired bookmarks are shown")))
1998
1999 ;;;###autoload
2000 (defun bmkp-bmenu-show-only-files (arg) ; Bound to `F S' in bookmark list
2001 "Display a list of file and directory bookmarks (only).
2002 With a prefix argument, do not include remote files or directories."
2003 (interactive "P")
2004 (bmkp-bmenu-barf-if-not-in-menu-list)
2005 (setq bmkp-bmenu-filter-function (if arg 'bmkp-local-file-alist-only 'bmkp-file-alist-only)
2006 bmkp-bmenu-title (if arg
2007 "Local File and Directory Bookmarks"
2008 "File and Directory Bookmarks"))
2009 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2010 (setq bmkp-latest-bookmark-alist bookmark-alist)
2011 (bookmark-bmenu-list 'filteredp))
2012 (when (interactive-p)
2013 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only file bookmarks are shown")))
2014
2015 ;;;###autoload
2016 (defun bmkp-bmenu-show-only-orphaned-local-files (arg) ; Bound to `O S' in bookmark list
2017 "Display a list of orphaned local file and directory bookmarks (only).
2018 With a prefix argument, include remote orphans as well."
2019 (interactive "P")
2020 (bmkp-bmenu-barf-if-not-in-menu-list)
2021 (setq bmkp-bmenu-filter-function (if arg
2022 'bmkp-orphaned-file-alist-only
2023 'bmkp-orphaned-local-file-alist-only)
2024 bmkp-bmenu-title (if arg
2025 "Orphaned File and Directory Bookmarks"
2026 "Local Orphaned File and Directory Bookmarks"))
2027 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2028 (setq bmkp-latest-bookmark-alist bookmark-alist)
2029 (bookmark-bmenu-list 'filteredp))
2030 (when (interactive-p)
2031 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only orphaned file bookmarks are shown")))
2032
2033 ;;;###autoload
2034 (defun bmkp-bmenu-show-only-non-files () ; Bound to `B S' in bookmark list
2035 "Display (only) the non-file bookmarks."
2036 (interactive)
2037 (bmkp-bmenu-barf-if-not-in-menu-list)
2038 (setq bmkp-bmenu-filter-function 'bmkp-non-file-alist-only
2039 bmkp-bmenu-title "Non-File Bookmarks")
2040 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2041 (setq bmkp-latest-bookmark-alist bookmark-alist)
2042 (bookmark-bmenu-list 'filteredp))
2043 (when (interactive-p)
2044 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only non-file bookmarks are shown")))
2045
2046 ;;;###autoload
2047 (defun bmkp-bmenu-show-only-gnus () ; Bound to `G S' in bookmark list
2048 "Display (only) the Gnus bookmarks."
2049 (interactive)
2050 (bmkp-bmenu-barf-if-not-in-menu-list)
2051 (setq bmkp-bmenu-filter-function 'bmkp-gnus-alist-only
2052 bmkp-bmenu-title "Gnus Bookmarks")
2053 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2054 (setq bmkp-latest-bookmark-alist bookmark-alist)
2055 (bookmark-bmenu-list 'filteredp))
2056 (when (interactive-p)
2057 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Gnus bookmarks are shown")))
2058
2059 ;;;###autoload
2060 (defun bmkp-bmenu-show-only-image-files () ; Bound to `M-i S' in bookmark list
2061 "Display (only) the image-file bookmarks."
2062 (interactive)
2063 (bmkp-bmenu-barf-if-not-in-menu-list)
2064 (setq bmkp-bmenu-filter-function 'bmkp-image-alist-only
2065 bmkp-bmenu-title "Image-File Bookmarks")
2066 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2067 (setq bmkp-latest-bookmark-alist bookmark-alist)
2068 (bookmark-bmenu-list 'filteredp))
2069 (when (interactive-p)
2070 (bmkp-msg-about-sort-order (bmkp-current-sort-order)
2071 "Only image-file bookmarks are shown")))
2072
2073 ;;;###autoload
2074 (defun bmkp-bmenu-show-only-info-nodes () ; Bound to `I S' in bookmark list
2075 "Display (only) the Info bookmarks."
2076 (interactive)
2077 (bmkp-bmenu-barf-if-not-in-menu-list)
2078 (setq bmkp-bmenu-filter-function 'bmkp-info-alist-only
2079 bmkp-bmenu-title "Info Bookmarks")
2080 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2081 (setq bmkp-latest-bookmark-alist bookmark-alist)
2082 (bookmark-bmenu-list 'filteredp))
2083 (when (interactive-p)
2084 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Info bookmarks are shown")))
2085
2086 ;;;###autoload
2087 (defun bmkp-bmenu-show-only-man-pages () ; Bound to `M S' in bookmark list
2088 "Display (only) the `man' page bookmarks."
2089 (interactive)
2090 (bmkp-bmenu-barf-if-not-in-menu-list)
2091 (setq bmkp-bmenu-filter-function 'bmkp-man-alist-only
2092 bmkp-bmenu-title "`man' Page Bookmarks")
2093 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2094 (setq bmkp-latest-bookmark-alist bookmark-alist)
2095 (bookmark-bmenu-list 'filteredp))
2096 (when (interactive-p)
2097 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only `man' page bookmarks are shown")))
2098
2099 ;;;###autoload
2100 (defun bmkp-bmenu-show-only-regions () ; Bound to `R S' in bookmark list
2101 "Display (only) the bookmarks that record a region."
2102 (interactive)
2103 (bmkp-bmenu-barf-if-not-in-menu-list)
2104 (setq bmkp-bmenu-filter-function 'bmkp-region-alist-only
2105 bmkp-bmenu-title "Region Bookmarks")
2106 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2107 (setq bmkp-latest-bookmark-alist bookmark-alist)
2108 (bookmark-bmenu-list 'filteredp))
2109 (when (interactive-p)
2110 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmarks with regions are shown")))
2111
2112 ;;;###autoload
2113 (defun bmkp-bmenu-show-only-temporary () ; Bound to `X S' in bookmark list
2114 "Display (only) the temporary bookmarks."
2115 (interactive)
2116 (bmkp-bmenu-barf-if-not-in-menu-list)
2117 (setq bmkp-bmenu-filter-function 'bmkp-temporary-alist-only
2118 bmkp-bmenu-title "TEMPORARY ONLY")
2119 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2120 (setq bmkp-latest-bookmark-alist bookmark-alist)
2121 (bookmark-bmenu-list 'filteredp))
2122 (when (interactive-p)
2123 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only temporary bookmarks are shown")))
2124
2125 ;;;###autoload
2126 (defun bmkp-bmenu-show-only-variable-lists () ; Bound to `V S' in bookmark list
2127 "Display (only) the variable-list bookmarks."
2128 (interactive)
2129 (bmkp-bmenu-barf-if-not-in-menu-list)
2130 (setq bmkp-bmenu-filter-function 'bmkp-variable-list-alist-only
2131 bmkp-bmenu-title "Variable-List Bookmarks")
2132 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2133 (setq bmkp-latest-bookmark-alist bookmark-alist)
2134 (bookmark-bmenu-list 'filteredp))
2135 (when (interactive-p)
2136 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only variable-list bookmarks are shown")))
2137
2138 ;;;###autoload
2139 (defun bmkp-bmenu-show-only-specific-buffer (&optional buffer) ; Bound to `= b S' in bookmark list
2140 "Display (only) the bookmarks for BUFFER.
2141 Interactively, read the BUFFER name.
2142 If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it."
2143 (interactive (list (bmkp-completing-read-buffer-name)))
2144 (bmkp-bmenu-barf-if-not-in-menu-list)
2145 (when buffer (setq bmkp-last-specific-buffer buffer))
2146 (setq bmkp-bmenu-filter-function 'bmkp-last-specific-buffer-alist-only
2147 bmkp-bmenu-title (format "Buffer `%s' Bookmarks" bmkp-last-specific-buffer))
2148 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2149 (setq bmkp-latest-bookmark-alist bookmark-alist)
2150 (bookmark-bmenu-list 'filteredp))
2151 (when (interactive-p)
2152 (bmkp-msg-about-sort-order (bmkp-current-sort-order)
2153 (format "Only bookmarks for buffer `%s' are shown"
2154 bmkp-last-specific-buffer))))
2155
2156 ;;;###autoload
2157 (defun bmkp-bmenu-show-only-specific-file (&optional file) ; Bound to `= f S' in bookmark list
2158 "Display (only) the bookmarks for FILE, an absolute file name.
2159 Interactively, read the FILE name.
2160 If FILE is non-nil, set `bmkp-last-specific-file' to it."
2161 (interactive (list (bmkp-completing-read-file-name)))
2162 (bmkp-bmenu-barf-if-not-in-menu-list)
2163 (when file (setq bmkp-last-specific-file file))
2164 (setq bmkp-bmenu-filter-function 'bmkp-last-specific-file-alist-only
2165 bmkp-bmenu-title (format "File `%s' Bookmarks" bmkp-last-specific-file))
2166 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2167 (setq bmkp-latest-bookmark-alist bookmark-alist)
2168 (bookmark-bmenu-list 'filteredp))
2169 (when (interactive-p)
2170 (bmkp-msg-about-sort-order (bmkp-current-sort-order)
2171 (format "Only bookmarks for file `%s' are shown"
2172 bmkp-last-specific-file))))
2173
2174 ;;;###autoload
2175 (defun bmkp-bmenu-show-only-urls () ; Bound to `M-u M-s' in bookmark list
2176 "Display (only) the URL bookmarks."
2177 (interactive)
2178 (bmkp-bmenu-barf-if-not-in-menu-list)
2179 (setq bmkp-bmenu-filter-function 'bmkp-url-alist-only
2180 bmkp-bmenu-title "URL Bookmarks")
2181 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2182 (setq bmkp-latest-bookmark-alist bookmark-alist)
2183 (bookmark-bmenu-list 'filteredp))
2184 (when (interactive-p)
2185 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only URL bookmarks are shown")))
2186
2187 ;;;###autoload
2188 (defun bmkp-bmenu-show-only-w3m-urls () ; Bound to `W S' in bookmark list
2189 "Display (only) the W3M URL bookmarks."
2190 (interactive)
2191 (bmkp-bmenu-barf-if-not-in-menu-list)
2192 (setq bmkp-bmenu-filter-function 'bmkp-w3m-alist-only
2193 bmkp-bmenu-title "W3M Bookmarks")
2194 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2195 (setq bmkp-latest-bookmark-alist bookmark-alist)
2196 (bookmark-bmenu-list 'filteredp))
2197 (when (interactive-p)
2198 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only W3M bookmarks are shown")))
2199
2200 ;;;###autoload
2201 (defun bmkp-bmenu-show-all () ; Bound to `.' in bookmark list
2202 "Show all bookmarks known to the bookmark list (aka \"menu list\").
2203 Omitted bookmarks are not shown, however.
2204 Also, this does not revert the bookmark list, to bring it up to date.
2205 To revert the list, use `\\<bookmark-bmenu-mode-map>\\[bmkp-bmenu-refresh-menu-list]'."
2206 (interactive)
2207 (bmkp-bmenu-barf-if-not-in-menu-list)
2208 (setq bmkp-bmenu-filter-function nil
2209 bmkp-bmenu-title "All Bookmarks"
2210 bmkp-latest-bookmark-alist bookmark-alist)
2211 (bookmark-bmenu-list)
2212 (when (interactive-p)
2213 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "All bookmarks are shown")))
2214
2215 ;;;###autoload
2216 (defun bmkp-bmenu-refresh-menu-list (&optional arg msg-p) ; Bound to `g' in bookmark list
2217 "Refresh (revert) the bookmark list display (aka \"menu list\").
2218 This brings the displayed list up to date with respect to the current
2219 bookmark list. It does not change the filtering or sorting of the
2220 displayed list.
2221
2222 With a prefix argument and upon confirmation, refresh the bookmark
2223 list and its display from the current bookmark file. IOW, it reloads
2224 the file, overwriting the current bookmark list. This also removes
2225 any markings and omissions.
2226
2227 You can use command `bmkp-toggle-bookmark-set-refreshes' to toggle
2228 whether setting a bookmark in any way should automatically refresh the
2229 list.
2230
2231 From Lisp, non-nil optional arg MSG-P means show progress messages."
2232 (interactive "P\np")
2233 (bmkp-bmenu-barf-if-not-in-menu-list)
2234 (let ((msg "Refreshing from bookmark "))
2235 (cond ((and arg (yes-or-no-p (format "Revert to bookmarks saved in file `%s'? "
2236 bmkp-current-bookmark-file)))
2237 (when msg-p (message (setq msg (concat msg "file..."))))
2238 (bookmark-load bmkp-current-bookmark-file 'OVERWRITE 'NO-MSG-P)
2239 (setq bmkp-bmenu-marked-bookmarks () ; Start from scratch.
2240 bmkp-modified-bookmarks ()
2241 bmkp-flagged-bookmarks ()
2242 bmkp-bmenu-omitted-bookmarks (condition-case nil
2243 (eval (car (get 'bmkp-bmenu-omitted-bookmarks
2244 'saved-value)))
2245 (error nil)))
2246 (let ((bmkp-bmenu-filter-function nil)) ; Remove any filtering.
2247 (bmkp-refresh-menu-list (bookmark-bmenu-bookmark) (not msg-p))))
2248 (t
2249 (when msg-p (message (setq msg (concat msg "list in memory..."))))
2250 (bmkp-refresh-menu-list (bookmark-bmenu-bookmark) (not msg-p))))
2251 (when msg-p (message (concat msg "done")))))
2252
2253 ;;;###autoload
2254 (defun bmkp-bmenu-filter-bookmark-name-incrementally () ; Bound to `P B' in bookmark list
2255 "Incrementally filter bookmarks by bookmark name using a regexp."
2256 (interactive)
2257 (bmkp-bmenu-barf-if-not-in-menu-list)
2258 (unwind-protect
2259 (progn (setq bmkp-bmenu-filter-timer
2260 (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT
2261 #'bmkp-bmenu-filter-alist-by-bookmark-name-regexp))
2262 (bmkp-bmenu-read-filter-input))
2263 (bmkp-bmenu-cancel-incremental-filtering)))
2264
2265 (defun bmkp-bmenu-filter-alist-by-bookmark-name-regexp ()
2266 "Filter bookmarks by bookmark name, then refresh the bookmark list."
2267 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-bookmark-name-alist-only
2268 bmkp-bmenu-title (format "Bookmarks with Names Matching Regexp `%s'"
2269 bmkp-bmenu-filter-pattern))
2270 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2271 (setq bmkp-latest-bookmark-alist bookmark-alist)
2272 (bookmark-bmenu-list 'filteredp)))
2273
2274 ;;;###autoload
2275 (defun bmkp-bmenu-filter-file-name-incrementally () ; Bound to `P F' in bookmark list
2276 "Incrementally filter bookmarks by file name using a regexp."
2277 (interactive)
2278 (bmkp-bmenu-barf-if-not-in-menu-list)
2279 (unwind-protect
2280 (progn (setq bmkp-bmenu-filter-timer
2281 (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT
2282 #'bmkp-bmenu-filter-alist-by-file-name-regexp))
2283 (bmkp-bmenu-read-filter-input))
2284 (bmkp-bmenu-cancel-incremental-filtering)))
2285
2286 (defun bmkp-bmenu-filter-alist-by-file-name-regexp ()
2287 "Filter bookmarks by file name, then refresh the bookmark list."
2288 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-file-name-alist-only
2289 bmkp-bmenu-title (format "Bookmarks with File Names Matching Regexp `%s'"
2290 bmkp-bmenu-filter-pattern))
2291 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2292 (setq bmkp-latest-bookmark-alist bookmark-alist)
2293 (bookmark-bmenu-list 'filteredp)))
2294
2295 ;;;###autoload
2296 (defun bmkp-bmenu-filter-annotation-incrementally () ; Bound to `P A' in bookmark list
2297 "Incrementally filter bookmarks by their annotations using a regexp."
2298 (interactive)
2299 (bmkp-bmenu-barf-if-not-in-menu-list)
2300 (unwind-protect
2301 (progn (setq bmkp-bmenu-filter-timer
2302 (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT
2303 #'bmkp-bmenu-filter-alist-by-annotation-regexp))
2304 (bmkp-bmenu-read-filter-input))
2305 (bmkp-bmenu-cancel-incremental-filtering)))
2306
2307 (defun bmkp-bmenu-filter-alist-by-annotation-regexp ()
2308 "Filter bookmarks by annoation, then refresh the bookmark list."
2309 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-annotation-alist-only
2310 bmkp-bmenu-title (format "Bookmarks with Annotations Matching Regexp `%s'"
2311 bmkp-bmenu-filter-pattern))
2312 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2313 (setq bmkp-latest-bookmark-alist bookmark-alist)
2314 (bookmark-bmenu-list 'filteredp)))
2315
2316 ;;;###autoload
2317 (defun bmkp-bmenu-filter-tags-incrementally () ; Bound to `P T' in bookmark list
2318 "Incrementally filter bookmarks by tags using a regexp."
2319 (interactive)
2320 (bmkp-bmenu-barf-if-not-in-menu-list)
2321 (unwind-protect
2322 (progn (setq bmkp-bmenu-filter-timer
2323 (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT
2324 #'bmkp-bmenu-filter-alist-by-tags-regexp))
2325 (bmkp-bmenu-read-filter-input))
2326 (bmkp-bmenu-cancel-incremental-filtering)))
2327
2328 (defun bmkp-bmenu-filter-alist-by-tags-regexp ()
2329 "Filter bookmarks by tags, then refresh the bookmark list."
2330 (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-tags-alist-only
2331 bmkp-bmenu-title (format "Bookmarks with Tags Matching Regexp `%s'"
2332 bmkp-bmenu-filter-pattern))
2333 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
2334 (setq bmkp-latest-bookmark-alist bookmark-alist)
2335 (bookmark-bmenu-list 'filteredp)))
2336
2337 (defun bmkp-bmenu-read-filter-input ()
2338 "Read input and add it to `bmkp-bmenu-filter-pattern'."
2339 (setq bmkp-bmenu-filter-pattern "")
2340 (let ((curr-bmk (bookmark-bmenu-bookmark)))
2341 (when (eq 'QUIT
2342 (let ((tmp-list ())
2343 (bmkp-bmenu-title bmkp-bmenu-title)
2344 (bmkp-bmenu-filter-function bmkp-bmenu-filter-function)
2345 (inhibit-quit t)
2346 char)
2347 (catch 'bmkp-bmenu-read-filter-input
2348 (while (condition-case nil
2349 (setq char (read-char (concat bmkp-bmenu-filter-prompt
2350 bmkp-bmenu-filter-pattern)))
2351 ;; `read-char' raises an error for non-char event.
2352 (error (throw 'bmkp-bmenu-read-filter-input nil)))
2353 (case char
2354 ((?\e ?\r) (throw 'bmkp-bmenu-read-filter-input nil)) ; Break and exit.
2355 (?\C-g (setq inhibit-quit nil)
2356 (throw 'bmkp-bmenu-read-filter-input 'QUIT)) ; Quit.
2357 (?\d (or (null tmp-list) ; No-op if no chars to delete.
2358 (pop tmp-list) t)) ; Delete last char of `*-filter-pattern'.
2359 (t (push (text-char-description char) tmp-list))) ; Accumulate CHAR.
2360 (setq bmkp-bmenu-filter-pattern (mapconcat #'identity (reverse tmp-list) ""))))))
2361 (message "Restoring display prior to incremental filtering...")
2362 (bookmark-bmenu-list 'FILTEREDP)
2363 (bmkp-bmenu-goto-bookmark-named curr-bmk)
2364 (message "Restoring display prior to incremental filtering...done"))))
2365
2366 (defun bmkp-bmenu-cancel-incremental-filtering ()
2367 "Cancel timer used for incrementally filtering bookmarks."
2368 (cancel-timer bmkp-bmenu-filter-timer)
2369 (setq bmkp-bmenu-filter-timer nil))
2370
2371 ;;;###autoload
2372 (defun bmkp-bmenu-toggle-show-only-unmarked () ; Bound to `<' in bookmark list
2373 "Hide all marked bookmarks. Repeat to toggle, showing all."
2374 (interactive)
2375 (bmkp-bmenu-barf-if-not-in-menu-list)
2376 ;; Save display, to be sure `bmkp-bmenu-before-hide-marked-alist' is up-to-date.
2377 (bmkp-save-menu-list-state)
2378 (if (or (bmkp-some-marked-p bmkp-latest-bookmark-alist)
2379 (bmkp-some-marked-p bmkp-bmenu-before-hide-marked-alist))
2380 (let ((bookmark-alist bmkp-latest-bookmark-alist)
2381 status)
2382 (if bmkp-bmenu-before-hide-marked-alist
2383 (setq bookmark-alist bmkp-bmenu-before-hide-marked-alist
2384 bmkp-bmenu-before-hide-marked-alist ()
2385 bmkp-latest-bookmark-alist bookmark-alist
2386 status 'shown)
2387 (setq bmkp-bmenu-before-hide-marked-alist bmkp-latest-bookmark-alist
2388 bookmark-alist (bmkp-unmarked-bookmarks-only)
2389 bmkp-latest-bookmark-alist bookmark-alist
2390 status 'hidden))
2391 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2392 (cond ((eq status 'hidden)
2393 (bookmark-bmenu-ensure-position)
2394 (message "Marked bookmarks are now hidden"))
2395 (t
2396 (goto-char (point-min))
2397 (when (re-search-forward "^>" (point-max) t) (forward-line 0))
2398 (message "Marked bookmarks no longer hidden"))))
2399 (message "No marked bookmarks to hide"))
2400 (when (and (fboundp 'fit-frame-if-one-window)
2401 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2402 (fit-frame-if-one-window)))
2403
2404 ;;;###autoload
2405 (defun bmkp-bmenu-toggle-show-only-marked () ; Bound to `>' in bookmark list
2406 "Hide all unmarked bookmarks. Repeat to toggle, showing all."
2407 (interactive)
2408 (bmkp-bmenu-barf-if-not-in-menu-list)
2409 ;; Save display, to be sure `bmkp-bmenu-before-hide-unmarked-alist' is up-to-date.
2410 (bmkp-save-menu-list-state)
2411 (if (or (bmkp-some-unmarked-p bmkp-latest-bookmark-alist)
2412 (bmkp-some-unmarked-p bmkp-bmenu-before-hide-unmarked-alist))
2413 (let ((bookmark-alist bmkp-latest-bookmark-alist)
2414 status)
2415 (if bmkp-bmenu-before-hide-unmarked-alist
2416 (setq bookmark-alist bmkp-bmenu-before-hide-unmarked-alist
2417 bmkp-bmenu-before-hide-unmarked-alist ()
2418 bmkp-latest-bookmark-alist bookmark-alist
2419 status 'shown)
2420 (setq bmkp-bmenu-before-hide-unmarked-alist bmkp-latest-bookmark-alist
2421 bookmark-alist (bmkp-marked-bookmarks-only)
2422 bmkp-latest-bookmark-alist bookmark-alist
2423 status 'hidden))
2424 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2425 (cond ((eq status 'hidden)
2426 (bookmark-bmenu-ensure-position)
2427 (message "Unmarked bookmarks are now hidden"))
2428 (t
2429 (goto-char (point-min))
2430 (when (re-search-forward "^>" (point-max) t) (forward-line 0))
2431 (message "Unmarked bookmarks no longer hidden"))))
2432 (message "No unmarked bookmarks to hide"))
2433 (when (and (fboundp 'fit-frame-if-one-window)
2434 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2435 (fit-frame-if-one-window)))
2436
2437
2438 ;;(@* "Menu-List (`*-bmenu-*') Commands Involving Marks")
2439 ;; *** Menu-List (`*-bmenu-*') Commands Involving Marks ***
2440
2441 ;;;###autoload
2442 (defun bmkp-bmenu-mark-all (&optional no-re-sort-p msg-p) ; Bound to `M-m' in bookmark list
2443 "Mark all bookmarks, using mark `>'.
2444 If any bookmark was unmarked before, and if the sort order is marked
2445 first or last (`s >'), then re-sort.
2446
2447 Non-interactively:
2448 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
2449 * Non-nil optional arg MSG-P meands display a status message."
2450 (interactive "i\np")
2451 (bmkp-bmenu-barf-if-not-in-menu-list)
2452 (let ((count 0)
2453 (nb-marked (length bmkp-bmenu-marked-bookmarks)))
2454 (save-excursion
2455 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2456 (when msg-p (message "Updating bookmark-list display..."))
2457 (while (not (eobp)) (bookmark-bmenu-mark 'NO-RE-SORT-P) (setq count (1+ count))))
2458 (unless no-re-sort-p
2459 ;; If some were unmarked before, and if sort order is `s >' then re-sort.
2460 (when (and (/= nb-marked count) (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)))
2461 (let ((current-bmk (bookmark-bmenu-bookmark)))
2462 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2463 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
2464 (when msg-p (message "Marked: %d" count))))
2465
2466 ;; This is similar to `dired-unmark-all-files'.
2467 ;;;###autoload
2468 (defun bmkp-bmenu-unmark-all (mark &optional arg no-re-sort-p msg-p) ; Bound to `M-DEL', `U' in bmk list
2469 "Remove a mark from each bookmark.
2470 Hit the mark character (`>' or `D') to remove those marks,
2471 or hit `RET' to remove all marks (both `>' and `D').
2472 With a prefix arg, you are queried to unmark each marked bookmark.
2473 Use `\\[help-command]' during querying for help.
2474
2475 If any bookmark was marked before, and if the sort order is marked
2476 first or last (`s >'), then re-sort.
2477
2478 Non-interactively:
2479 * MARK is the mark character or a carriage-return character (`?\r').
2480 * Non-nil ARG (prefix arg) means query.
2481 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
2482 * Non-nil optional arg MSG-P meands display a status message."
2483 (interactive "cRemove marks (RET means all): \nP\ni\np")
2484 (bmkp-bmenu-barf-if-not-in-menu-list)
2485 (require 'dired-aux)
2486 (let* ((count 0)
2487 (some-marked-p bmkp-bmenu-marked-bookmarks)
2488 (inhibit-read-only t)
2489 (case-fold-search nil)
2490 (query nil)
2491 (string (format "\n%c" mark))
2492 (help-form "Type SPC or `y' to unmark one bookmark, DEL or `n' to skip to next,
2493 `!' to unmark all remaining bookmarks with no more questions."))
2494 (save-excursion
2495 (goto-char (point-min))
2496 (forward-line (if (eq mark ?\r)
2497 bmkp-bmenu-header-lines
2498 (1- bmkp-bmenu-header-lines))) ; Because STRING starts with a newline.
2499 (while (and (not (eobp))
2500 (if (eq mark ?\r)
2501 (re-search-forward dired-re-mark nil t)
2502 (let ((case-fold-search t)) ; Treat `d' the same as `D'.
2503 (search-forward string nil t))))
2504 (when (or (prog1 (not arg) (when msg-p (message "Updating bookmark-list display...")))
2505 (let ((bmk (bookmark-bmenu-bookmark)))
2506 (and bmk (dired-query 'query "Unmark bookmark `%s'? " bmk))))
2507 (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (forward-line -1)
2508 (setq count (1+ count)))))
2509 (unless no-re-sort-p
2510 ;; If some were marked before, and if sort order is `s >', then re-sort.
2511 (when (and some-marked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)))
2512 (let ((current-bmk (bookmark-bmenu-bookmark)))
2513 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2514 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
2515 (when msg-p (if (= 1 count) (message "1 mark removed") (message "%d marks removed" count)))))
2516
2517 ;;;###autoload
2518 (defun bmkp-bmenu-regexp-mark (regexp &optional no-re-sort-p msg-p) ; Bound to `% m' in bookmark list
2519 "Mark bookmarks that match REGEXP.
2520 The entire bookmark line is tested: bookmark name and possibly file name.
2521 Note too that if file names are not shown currently then the bookmark
2522 name is padded at the right with spaces.
2523
2524 If any bookmark was unmarked before, and if the sort order is marked
2525 first or last (`s >'), then re-sort.
2526
2527 Non-interactively:
2528 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
2529 * Non-nil optional arg MSG-P means display a status message."
2530 (interactive "sRegexp: \np")
2531 (bmkp-bmenu-barf-if-not-in-menu-list)
2532 (let ((count 0)
2533 (nb-marked (length bmkp-bmenu-marked-bookmarks)))
2534 (save-excursion
2535 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2536 (when msg-p (message "Updating bookmark-list display..."))
2537 (while (and (not (eobp)) (re-search-forward regexp (point-max) t))
2538 (bookmark-bmenu-mark 'NO-RE-SORT-P)
2539 (setq count (1+ count))))
2540 (unless no-re-sort-p
2541 ;; If some were unmarked before, and if sort order is `s >', then re-sort.
2542 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
2543 (< nb-marked (length bmkp-bmenu-marked-bookmarks)))
2544 (let ((current-bmk (bookmark-bmenu-bookmark)))
2545 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2546 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
2547 (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2548
2549 ;;;###autoload
2550 (defun bmkp-bmenu-mark-autofile-bookmarks (&optional arg) ; Bound to `A M' in bookmark list
2551 "Mark autofile bookmarks: those whose names are the same as their files.
2552 With a prefix arg you are prompted for a prefix that each bookmark
2553 name must have."
2554 (interactive "P")
2555 (if (not arg)
2556 (bmkp-bmenu-mark-bookmarks-satisfying #'bmkp-autofile-bookmark-p)
2557 (let ((prefix (read-string "Prefix for bookmark names: " nil nil "")))
2558 (bmkp-bmenu-mark-bookmarks-satisfying #'(lambda (bb) (bmkp-autofile-bookmark-p bb prefix))))))
2559
2560 ;;;###autoload
2561 (defun bmkp-bmenu-mark-autonamed-bookmarks () ; Bound to `# M' in bookmark list
2562 "Mark autonamed bookmarks."
2563 (interactive)
2564 (bmkp-bmenu-mark-bookmarks-satisfying #'bmkp-autonamed-bookmark-p))
2565
2566 ;;;###autoload
2567 (defun bmkp-bmenu-mark-bookmark-file-bookmarks () ; Bound to `Y M' in bookmark list
2568 "Mark bookmark-file bookmarks."
2569 (interactive)
2570 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-bookmark-file-bookmark-p))
2571
2572 ;;;###autoload
2573 (defun bmkp-bmenu-mark-desktop-bookmarks () ; Bound to `K M' in bookmark list
2574 "Mark desktop bookmarks."
2575 (interactive)
2576 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-desktop-bookmark-p))
2577
2578 ;;;###autoload
2579 (defun bmkp-bmenu-mark-dired-bookmarks () ; Bound to `M-d M-m' in bookmark list
2580 "Mark Dired bookmarks."
2581 (interactive)
2582 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-dired-bookmark-p))
2583
2584 ;;;###autoload
2585 (defun bmkp-bmenu-mark-file-bookmarks (arg) ; Bound to `F M' in bookmark list
2586 "Mark file bookmarks.
2587 With a prefix argument, do not mark remote files or directories."
2588 (interactive "P")
2589 (bmkp-bmenu-mark-bookmarks-satisfying
2590 (if arg 'bmkp-local-file-bookmark-p 'bmkp-file-bookmark-p)))
2591
2592 ;;;###autoload
2593 (defun bmkp-bmenu-mark-gnus-bookmarks () ; Bound to `G M' in bookmark list
2594 "Mark Gnus bookmarks."
2595 (interactive)
2596 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-gnus-bookmark-p))
2597
2598 ;;;###autoload
2599 (defun bmkp-bmenu-mark-image-bookmarks () ; Bound to `M-i M' in bookmark list
2600 "Mark image-file bookmarks."
2601 (interactive)
2602 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-image-bookmark-p))
2603
2604 ;;;###autoload
2605 (defun bmkp-bmenu-mark-info-bookmarks () ; Bound to `I M' in bookmark list
2606 "Mark Info bookmarks."
2607 (interactive)
2608 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-info-bookmark-p))
2609
2610 ;;;###autoload
2611 (defun bmkp-bmenu-mark-man-bookmarks () ; Bound to `M M' in bookmark list
2612 "Mark `man' page bookmarks."
2613 (interactive)
2614 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-man-bookmark-p))
2615
2616 ;;;###autoload
2617 (defun bmkp-bmenu-mark-non-file-bookmarks () ; Bound to `B M' in bookmark list
2618 "Mark non-file bookmarks."
2619 (interactive)
2620 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-non-file-bookmark-p))
2621
2622 ;;;###autoload
2623 (defun bmkp-bmenu-mark-orphaned-local-file-bookmarks (arg) ; Bound to `O M' in bookmark list
2624 "Mark orphaned local-file bookmarks (their recorded files are not readable).
2625 With a prefix argument, mark also remote orphaned files or directories."
2626 (interactive "P")
2627 (bmkp-bmenu-mark-bookmarks-satisfying
2628 (if arg 'bmkp-orphaned-file-bookmark-p 'bmkp-orphaned-local-file-bookmark-p)))
2629
2630 ;;;###autoload
2631 (defun bmkp-bmenu-mark-region-bookmarks () ; Bound to `R M' in bookmark list
2632 "Mark bookmarks that record a region."
2633 (interactive)
2634 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-region-bookmark-p))
2635
2636 (when (featurep 'bookmark+-lit)
2637 (defun bmkp-bmenu-mark-lighted-bookmarks () ; Bound to `H M' in bookmark list
2638 "Mark the highlighted bookmarks."
2639 (interactive)
2640 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-lighted-p)))
2641
2642 ;;;###autoload
2643 (defun bmkp-bmenu-mark-specific-buffer-bookmarks (&optional buffer) ; `= b M' in bookmark list
2644 "Mark bookmarks for BUFFER.
2645 Interactively, read the name of the buffer.
2646 If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it."
2647 (interactive (list (bmkp-completing-read-buffer-name)))
2648 (when buffer (setq bmkp-last-specific-buffer buffer))
2649 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-buffer-p))
2650
2651 ;;;###autoload
2652 (defun bmkp-bmenu-mark-specific-file-bookmarks (&optional file) ; Bound to `= f M' in bookmark list
2653 "Mark bookmarks for FILE, an absolute file name.
2654 Interactively, read the file name.
2655 If FILE is non-nil, set `bmkp-last-specific-file' to it."
2656 (interactive (list (bmkp-completing-read-file-name)))
2657 (when file (setq bmkp-last-specific-file file))
2658 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-file-p))
2659
2660 ;;;###autoload
2661 (defun bmkp-bmenu-mark-temporary-bookmarks () ; Bound to `X M' in bookmark list
2662 "Mark temporary bookmarks."
2663 (interactive)
2664 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-temporary-bookmark-p))
2665
2666 ;;;###autoload
2667 (defun bmkp-bmenu-mark-variable-list-bookmarks () ; Bound to `V M' in bookmark list
2668 "Mark variable-list bookmarks."
2669 (interactive)
2670 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-variable-list-bookmark-p))
2671
2672 ;;;###autoload
2673 (defun bmkp-bmenu-mark-url-bookmarks () ; Bound to `M-u M-m' in bookmark list
2674 "Mark URL bookmarks."
2675 (interactive)
2676 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-url-bookmark-p))
2677
2678 ;;;###autoload
2679 (defun bmkp-bmenu-mark-w3m-bookmarks () ; Bound to `W M' in bookmark list
2680 "Mark W3M (URL) bookmarks."
2681 (interactive)
2682 (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-w3m-bookmark-p))
2683
2684 ;;;###autoload
2685 (defun bmkp-bmenu-mark-bookmarks-satisfying (pred &optional no-re-sort-p msg-p) ; Not bound
2686 "Mark bookmarks that satisfy predicate PRED.
2687 If you use this interactively, you are responsible for entering a
2688 symbol that names a unnary predicate. The function you provide is not
2689 checked - it is simply applied to each bookmark to test it.
2690
2691 If any bookmark was unmarked before, and if the sort order is marked
2692 first or last (`s >'), then re-sort.
2693
2694 Non-interactively:
2695 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
2696 * Non-nil optional arg MSG-P means display a status message."
2697 (interactive "aPredicate: \np")
2698 (bmkp-bmenu-barf-if-not-in-menu-list)
2699 (let ((count 0)
2700 (nb-marked (length bmkp-bmenu-marked-bookmarks))
2701 bmk)
2702 (save-excursion
2703 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2704 (when msg-p (message "Updating bookmark-list display..."))
2705 (while (not (eobp))
2706 (setq bmk (bookmark-bmenu-bookmark))
2707 (if (not (funcall pred bmk))
2708 (forward-line 1)
2709 (bookmark-bmenu-mark 'NO-RE-SORT-P)
2710 (setq count (1+ count)))))
2711 (unless no-re-sort-p
2712 ;; If some were unmarked before, and if sort order is `s >', then re-sort.
2713 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
2714 (< nb-marked (length bmkp-bmenu-marked-bookmarks)))
2715 (let ((current-bmk (bookmark-bmenu-bookmark)))
2716 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2717 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
2718 (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
2719
2720 ;;;###autoload
2721 (defun bmkp-bmenu-toggle-marks (&optional backup no-re-sort-p msg-p) ; Bound to `t' in bookmark list
2722 "Toggle marks: Unmark all marked bookmarks; mark all unmarked bookmarks.
2723 This affects only the `>' mark, not the `D' flag.
2724
2725 Interactively or with nil optional arg NO-RE-SORT-P, if the current
2726 sort order is marked first or last (`s >'), then re-sort.
2727
2728 Non-interactively, non-nil optional arg MSG-P means display a status
2729 message."
2730 (interactive)
2731 (bmkp-bmenu-barf-if-not-in-menu-list)
2732 (bookmark-bmenu-ensure-position)
2733 (let ((marked-count 0)
2734 (unmarked-count 0))
2735 (save-excursion
2736 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2737 (if (not (bmkp-some-marked-p bmkp-latest-bookmark-alist))
2738 (bmkp-bmenu-mark-all no-re-sort-p)
2739 (when msg-p (message "Updating bookmark-list display..."))
2740 (while (not (eobp))
2741 (cond ((bmkp-bookmark-name-member (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)
2742 (bookmark-bmenu-unmark nil 'NO-RE-SORT-P)
2743 (setq unmarked-count (1+ unmarked-count)))
2744 (t
2745 (bookmark-bmenu-mark 'NO-RE-SORT-P)
2746 (setq marked-count (1+ marked-count)))))))
2747 ;; If sort order is `s >' then re-sort.
2748 (when (and (not no-re-sort-p) (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)))
2749 (let ((current-bmk (bookmark-bmenu-bookmark)))
2750 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2751 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))
2752 (when msg-p (message "Marked: %d, unmarked: %d" marked-count unmarked-count))))
2753
2754 ;;;###autoload
2755 (defun bmkp-bmenu-toggle-marked-temporary/savable () ; Bound to `M-X' in bookmark list
2756 "Toggle the temporary/savable status of each marked bookmark.
2757 If none are marked, toggle status of the bookmark of the current line."
2758 (interactive)
2759 (bmkp-bmenu-barf-if-not-in-menu-list)
2760 (let ((o-str (and (not (looking-at "^>")) (bookmark-bmenu-bookmark)))
2761 (o-point (point))
2762 (count-temp 0)
2763 (count-save 0)
2764 bmk)
2765 (message "Toggling temporary status of marked bookmarks...")
2766 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2767 (while (re-search-forward "^>" (point-max) t)
2768 (bmkp-toggle-temporary-bookmark (setq bmk (bookmark-bmenu-bookmark)))
2769 (if (bmkp-temporary-bookmark-p bmk)
2770 (setq count-temp (1+ count-temp))
2771 (setq count-save (1+ count-save))))
2772 (cond ((and (<= count-temp 0) (<= count-save 0))
2773 (if o-str
2774 (bmkp-bmenu-goto-bookmark-named o-str)
2775 (goto-char o-point)
2776 (beginning-of-line))
2777 (bmkp-toggle-temporary-bookmark (bookmark-bmenu-bookmark) 'MSG)
2778 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P))
2779 (t
2780 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2781 (message "%d made temporary; %d made savable" count-temp count-save)))
2782 (if o-str
2783 (bmkp-bmenu-goto-bookmark-named o-str)
2784 (goto-char o-point)
2785 (beginning-of-line)))
2786 (when (and (fboundp 'fit-frame-if-one-window)
2787 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2788 (fit-frame-if-one-window)))
2789
2790 ;;;###autoload
2791 (defun bmkp-bmenu-toggle-temporary () ; Bound to `C-M-X' in bookmark list
2792 "Toggle whether bookmark of current line is temporary (not saved to disk)."
2793 (interactive)
2794 (bmkp-bmenu-barf-if-not-in-menu-list)
2795 (let ((o-str (bookmark-bmenu-bookmark))
2796 (o-point (point)))
2797 (bmkp-toggle-temporary-bookmark (bookmark-bmenu-bookmark) 'MSG)
2798 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2799 (if o-str
2800 (bmkp-bmenu-goto-bookmark-named o-str)
2801 (goto-char o-point)
2802 (beginning-of-line))))
2803
2804 ;;;###autoload
2805 (defun bmkp-bmenu-dired-marked (dirbufname) ; Bound to `M-d >' in bookmark list
2806 "Dired in another window for the marked file and directory bookmarks.
2807
2808 Absolute file names are used for the entries in the Dired buffer.
2809 The only entries are for the marked files and directories. These can
2810 be located anywhere. (In Emacs versions prior to release 23.2, remote
2811 bookmarks are ignored, because of Emacs bug #5478.)
2812
2813 You are prompted for the Dired buffer name. The `default-directory'
2814 of the buffer is the same as that of buffer `*Bookmark List*'."
2815 (interactive (list (read-string "Dired buffer name: ")))
2816 (bmkp-bmenu-barf-if-not-in-menu-list)
2817 (let ((files ())
2818 file)
2819 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
2820 (when (or (bmkp-local-file-bookmark-p bmk)
2821 (> emacs-major-version 23)
2822 (and (= emacs-major-version 23) (> emacs-minor-version 1)))
2823 (setq file (bookmark-get-filename bmk))
2824 (unless (file-name-absolute-p file) (setq file (expand-file-name file))) ; Should not happen.
2825 (push file files)))
2826 (dired-other-window (cons dirbufname files))))
2827
2828 ;;;###autoload
2829 (defun bmkp-bmenu-delete-marked () ; Bound to `D' in bookmark list
2830 "Delete all (visible) bookmarks that are marked `>', after confirmation."
2831 (interactive)
2832 (bmkp-bmenu-barf-if-not-in-menu-list)
2833 (bookmark-bmenu-execute-deletions 'marked))
2834
2835 ;;;###autoload
2836 (defun bmkp-bmenu-load-marked-bookmark-file-bookmarks (&optional msg-p) ; Bound to `M-l' in bookmark list
2837 "Load the bookmark-file bookmarks that are marked, in display order.
2838 Non bookmark-file bookmarks that are marked are ignored.
2839 You can sort the bookmark-list display to change the load order.
2840
2841 NOTE: Automatically saving the current bookmark list is turned OFF
2842 before loading, and it remains turned off until you explicitly turn it
2843 back on. Bookmark+ does not assume that you want to automatically
2844 save all of the newly loaded bookmarks in the same bookmark file. If
2845 you do, just use \\<bookmark-bmenu-mode-map>`\\[bmkp-toggle-saving-bookmark-file]' \
2846 to turn saving back on."
2847 (interactive "p")
2848 (bmkp-bmenu-barf-if-not-in-menu-list)
2849 (let ((bmks (bmkp-remove-if-not #'bmkp-bookmark-file-bookmark-p
2850 (bmkp-remove-if-not 'bmkp-marked-bookmark-p bmkp-sorted-alist)))
2851 (bmk (bookmark-bmenu-bookmark)))
2852 (unless bmks (error "No marked bookmark-file bookmarks"))
2853 ;; Maybe save bookmarks first.
2854 (when (or (not msg-p)
2855 (and (> bookmark-alist-modification-count 0)
2856 (condition-case err
2857 (yes-or-no-p "Save current bookmarks? (`C-g': cancel load too) ")
2858 (quit (error "OK - canceled"))
2859 (error (error (error-message-string err))))))
2860 (bookmark-save))
2861 (when (or (not msg-p)
2862 (yes-or-no-p "Load the marked bookmark-file bookmarks? ")
2863 (error "OK - canceled"))
2864 (when bookmark-save-flag ; Turn off autosaving.
2865 (bmkp-toggle-saving-bookmark-file) ; No MSG-P arg - issue message below.
2866 (when bookmark-save-flag (setq bookmark-save-flag nil)) ; Be sure it's off.
2867 (when msg-p (message "Autosaving of current bookmark file is now OFF")))
2868 (when msg-p (message "Loading marked bookmark files..."))
2869
2870 (dolist (bmk bmks) ; Load.
2871 ;; USE BATCHP: Do not refresh list or display messages here - do that after iterate.
2872 (bookmark-load (bookmark-get-filename bmk) nil 'BATCHP))
2873
2874 ;; $$$$$$ Should we do (bmkp-tags-list) here to update the tags cache?
2875
2876 (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate.
2877 (when msg-p (message "Autosaving is now OFF. Loaded: %s"
2878 (mapconcat (lambda (bmk) (format "`%s'" (bmkp-bookmark-name-from-record bmk)))
2879 bmks
2880 ", "))))))
2881
2882 ;;;###autoload
2883 (defun bmkp-bmenu-make-sequence-from-marked (bookmark-name &optional dont-omit-p) ; Not bound
2884 "Create or update a sequence bookmark from the visible marked bookmarks.
2885 The bookmarks that are currently marked are recorded as a sequence, in
2886 their current order in buffer `*Bookmark List*'.
2887 When you \"jump\" to the sequence bookmark, the bookmarks in the
2888 sequence are processed in order.
2889
2890 By default, omit the marked bookmarks, after creating the sequence.
2891 With a prefix arg, do not omit them.
2892
2893 If a bookmark with the specified name already exists, it is
2894 overwritten. If a sequence bookmark with the name already exists,
2895 then you are prompted whether to add the marked bookmarks to the
2896 beginning of the existing sequence (or simply replace it).
2897
2898 Note that another existing sequence bookmark can be marked, and thus
2899 included in the sequence bookmark created or updated. That is, you
2900 can include other sequences within a sequence bookmark.
2901
2902 Returns the bookmark (internal record) created or updated."
2903 (interactive "sName of sequence bookmark: \nP")
2904 (bmkp-bmenu-barf-if-not-in-menu-list)
2905 (let ((marked-bmks ())
2906 (count 0))
2907 (message "Making sequence from marked bookmarks...")
2908 (save-excursion
2909 (with-current-buffer "*Bookmark List*"
2910 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2911 (while (re-search-forward "^>" (point-max) t)
2912 (push (bookmark-bmenu-bookmark) marked-bmks)
2913 (setq count (1+ count)))))
2914 (when (zerop count) (error "No marked bookmarks"))
2915 (let ((new-seq (nreverse marked-bmks))
2916 (bmk (bmkp-get-bookmark-in-alist bookmark-name 'NOERROR)))
2917 (when (and bmk (bmkp-sequence-bookmark-p bmk))
2918 (if (y-or-n-p (format "ADD marked to existing sequence `%s' (otherwise, REPLACES it)? "
2919 bookmark-name))
2920 (setq new-seq (nconc new-seq (bookmark-prop-get bmk 'sequence)))
2921 "OK, existing sequence will be replaced"))
2922 (bookmark-store bookmark-name `((filename . ,bmkp-non-file-filename)
2923 (position . 0)
2924 (sequence ,@new-seq)
2925 (handler . bmkp-jump-sequence))
2926 nil)))
2927 (let ((new (bookmark-get-bookmark bookmark-name 'NOERROR)))
2928 (unless (memq new bmkp-latest-bookmark-alist)
2929 (setq bmkp-latest-bookmark-alist (cons new bmkp-latest-bookmark-alist)))
2930 (unless dont-omit-p
2931 (bmkp-bmenu-omit-marked)
2932 (message "Marked bookmarks now OMITTED - use `bmkp-bmenu-show-only-omitted' to show"))
2933 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2934 (bmkp-bmenu-goto-bookmark-named bookmark-name)
2935 new))
2936
2937
2938 ;;(@* "Omitted Bookmarks")
2939 ;; *** Omitted Bookmarks ***
2940
2941 ;;;###autoload
2942 (defun bmkp-bmenu-omit () ; Not bound
2943 "Omit this bookmark."
2944 (interactive)
2945 (bmkp-bmenu-barf-if-not-in-menu-list)
2946 (bookmark-bmenu-ensure-position)
2947 (push (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks)
2948 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2949 (message "Omitted 1 bookmark"))
2950
2951 ;;;###autoload
2952 (defun bmkp-bmenu-omit/unomit-marked () ; Bound to `- >' in bookmark list
2953 "Omit all marked bookmarks or, if showing only omitted ones, unomit."
2954 (interactive)
2955 (bmkp-bmenu-barf-if-not-in-menu-list)
2956 (if (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
2957 (bmkp-bmenu-unomit-marked)
2958 (bmkp-bmenu-omit-marked)))
2959
2960 ;;;###autoload
2961 (defun bmkp-bmenu-omit-marked () ; Bound to `- >' in bookmark list
2962 "Omit all marked bookmarks.
2963 They will henceforth be invisible to the bookmark list.
2964 You can, however, use \\<bookmark-bmenu-mode-map>`\\[bmkp-bmenu-show-only-omitted]' to see them.
2965 You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]' to make those marked
2966 available again for the bookmark list."
2967 (interactive)
2968 (bmkp-bmenu-barf-if-not-in-menu-list)
2969 (let ((o-str (and (not (looking-at "^>")) (bookmark-bmenu-bookmark)))
2970 (o-point (point))
2971 (count 0))
2972 (message "Omitting marked bookmarks...")
2973 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
2974 (while (re-search-forward "^>" (point-max) t)
2975 (setq bmkp-bmenu-omitted-bookmarks (cons (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks)
2976 count (1+ count)))
2977 (if (<= count 0)
2978 (message "No marked bookmarks")
2979 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
2980 (message "Omitted %d bookmarks" count))
2981 (if o-str
2982 (bmkp-bmenu-goto-bookmark-named o-str)
2983 (goto-char o-point)
2984 (beginning-of-line)))
2985 (when (and (fboundp 'fit-frame-if-one-window)
2986 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
2987 (fit-frame-if-one-window)))
2988
2989 ;;;###autoload
2990 (defun bmkp-bmenu-unomit-marked () ; `- >' in bookmark list when showing omitted bookmarks
2991 "Remove all marked bookmarks from the list of omitted bookmarks.
2992 They will henceforth be available for display in the bookmark list.
2993 \(In order to see and then mark omitted bookmarks you must use \\<bookmark-bmenu-mode-map>\
2994 `\\[bmkp-bmenu-show-only-omitted]'.)"
2995 (interactive)
2996 (bmkp-bmenu-barf-if-not-in-menu-list)
2997 (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks to UN-omit"))
2998 (unless (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)
2999 (error "You must use command `bmkp-bmenu-show-only-omitted' first"))
3000 (let ((count 0))
3001 (message "UN-omitting marked bookmarks...")
3002 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3003 (while (re-search-forward "^>" (point-max) t)
3004 (let ((bmk-name (bookmark-bmenu-bookmark)))
3005 (when (bmkp-bookmark-name-member bmk-name bmkp-bmenu-omitted-bookmarks)
3006 (setq bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list
3007 bmk-name bmkp-bmenu-omitted-bookmarks)
3008 count (1+ count)))))
3009 (if (<= count 0)
3010 (message "No marked bookmarks")
3011 (setq bmkp-bmenu-filter-function nil
3012 bmkp-bmenu-title "All Bookmarks"
3013 bmkp-latest-bookmark-alist bookmark-alist)
3014 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
3015 (message "UN-omitted %d bookmarks" count)))
3016 (when (and (fboundp 'fit-frame-if-one-window)
3017 (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0)))
3018 (fit-frame-if-one-window)))
3019
3020 ;;;###autoload
3021 (defun bmkp-bmenu-show-only-omitted () ; Bound to `- S' in bookmark list to show only omitted
3022 "Show only the omitted bookmarks.
3023 You can then mark some of them and use `bmkp-bmenu-unomit-marked' to
3024 make those that are marked available again for the bookmark list."
3025 (interactive)
3026 (bmkp-bmenu-barf-if-not-in-menu-list)
3027 (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks"))
3028 (setq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only
3029 bmkp-bmenu-title "Omitted Bookmarks")
3030 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
3031 (setq bmkp-latest-bookmark-alist bookmark-alist)
3032 (bookmark-bmenu-list 'filteredp))
3033 (when (interactive-p)
3034 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only omitted bookmarks are shown now")))
3035
3036
3037 ;;(@* "Search-and-Replace Locations of Marked Bookmarks")
3038 ;; *** Search-and-Replace Locations of Marked Bookmarks ***
3039
3040 (when (> emacs-major-version 22)
3041 (defun bmkp-bmenu-isearch-marked-bookmarks () ; Bound to `M-s a C-s' in bookmark list
3042 "Isearch the marked bookmark locations, in their current order."
3043 (interactive)
3044 (bmkp-bmenu-barf-if-not-in-menu-list)
3045 (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only))))
3046 (bmkp-use-region nil)) ; Suppress region handling.
3047 (bmkp-isearch-bookmarks bookmarks))) ; Defined in `bookmark+-1.el'.
3048
3049 (defun bmkp-bmenu-isearch-marked-bookmarks-regexp () ; Bound to `M-s a M-C-s' in bookmark list
3050 "Regexp Isearch the marked bookmark locations, in their current order."
3051 (interactive)
3052 (bmkp-bmenu-barf-if-not-in-menu-list)
3053 (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only))))
3054 (bmkp-use-region nil)) ; Suppress region handling.
3055 (bmkp-isearch-bookmarks-regexp bookmarks)))) ; Defined in `bookmark+-1.el'.
3056
3057 ;;;###autoload
3058 (defun bmkp-bmenu-search-marked-bookmarks-regexp (regexp) ; Bound to `M-s a M-s' in bookmark list
3059 "Search the marked file bookmarks, in their current order, for REGEXP.
3060 Use `\\[tags-loop-continue]' to advance among the search hits.
3061 Marked directory and non-file bookmarks are ignored."
3062 (interactive "sSearch marked file bookmarks (regexp): ")
3063 (bmkp-bmenu-barf-if-not-in-menu-list)
3064 (tags-search regexp '(let ((files ())
3065 file)
3066 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
3067 (setq file (bookmark-get-filename bmk))
3068 (when (and (not (equal bmkp-non-file-filename file))
3069 (not (file-directory-p file)))
3070 (push file files)))
3071 (setq files (nreverse files)))))
3072
3073 ;;;###autoload
3074 (defun bmkp-bmenu-query-replace-marked-bookmarks-regexp (from to ; Bound to `M-q' in bookmark list
3075 &optional delimited)
3076 "`query-replace-regexp' FROM with TO, for all marked file bookmarks.
3077 DELIMITED (prefix arg) means replace only word-delimited matches.
3078 If you exit (`\\[keyboard-quit]', `RET' or `q'), you can use \
3079 `\\[tags-loop-continue]' to resume where
3080 you left off."
3081 (interactive (let ((common (query-replace-read-args "Query replace regexp in marked files" t t)))
3082 (list (nth 0 common) (nth 1 common) (nth 2 common))))
3083 (bmkp-bmenu-barf-if-not-in-menu-list)
3084 (tags-query-replace from to delimited
3085 '(let ((files ())
3086 file)
3087 (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only)))
3088 (setq file (bookmark-get-filename bmk))
3089 (let ((buffer (get-file-buffer file)))
3090 (when (and buffer (with-current-buffer buffer buffer-read-only))
3091 (error "File `%s' is visited read-only" file)))
3092 (when (and (not (equal bmkp-non-file-filename file))
3093 (not (file-directory-p file)))
3094 (push file files)))
3095 (setq files (nreverse files)))))
3096
3097
3098 ;;(@* "Tags")
3099 ;; *** Tags ***
3100
3101 ;;;###autoload
3102 (defun bmkp-bmenu-show-only-tagged () ; Bound to `T S' in bookmark list
3103 "Display (only) the bookmarks that have tags."
3104 (interactive)
3105 (bmkp-bmenu-barf-if-not-in-menu-list)
3106 (setq bmkp-bmenu-filter-function 'bmkp-some-tags-alist-only
3107 bmkp-bmenu-title "Tagged Bookmarks")
3108 (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)))
3109 (setq bmkp-latest-bookmark-alist bookmark-alist)
3110 (bookmark-bmenu-list 'filteredp))
3111 (when (interactive-p)
3112 (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only tagged bookmarks are shown")))
3113
3114 ;; Not bound, but `T 0' is `bmkp-remove-all-tags'.
3115 ;;;###autoload
3116 (defun bmkp-bmenu-remove-all-tags (&optional must-confirm-p)
3117 "Remove all tags from this bookmark.
3118 Interactively, you are required to confirm."
3119 (interactive "p")
3120 (bmkp-bmenu-barf-if-not-in-menu-list)
3121 (bookmark-bmenu-ensure-position)
3122 (let ((bookmark (bookmark-bmenu-bookmark)))
3123 (when (and must-confirm-p (null (bmkp-get-tags bookmark)))
3124 (error "Bookmark has no tags to remove"))
3125 (when (or (not must-confirm-p) (y-or-n-p "Remove all tags from this bookmark? "))
3126 (bmkp-remove-all-tags bookmark))))
3127
3128 ;;;###autoload
3129 (defun bmkp-bmenu-add-tags () ; Only on `mouse-3' menu in bookmark list.
3130 "Add some tags to this bookmark."
3131 (interactive)
3132 (bmkp-bmenu-barf-if-not-in-menu-list)
3133 (bookmark-bmenu-ensure-position)
3134 (let ((nb-added (bmkp-add-tags (bookmark-bmenu-bookmark) (bmkp-read-tags-completing))))
3135 (when (and (< nb-added 0) ; It was untagged but is now tagged. If `s t' then re-sort.
3136 (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) ; Hardcoded value, for now.
3137 (bmkp-bmenu-sort-tagged-before-untagged))
3138 nb-added))
3139
3140 ;;;###autoload
3141 (defun bmkp-bmenu-set-tag-value () ; Bound to `T v' in bookmark list
3142 "Set the value of one of this bookmark's tags."
3143 (interactive)
3144 (bmkp-bmenu-barf-if-not-in-menu-list)
3145 (bookmark-bmenu-ensure-position)
3146 (let ((this-bmk (bookmark-bmenu-bookmark)))
3147 (bmkp-set-tag-value
3148 this-bmk
3149 (bmkp-read-tag-completing "Tag: " (mapcar 'bmkp-full-tag (bmkp-get-tags this-bmk)))
3150 (read (read-string "Value: "))
3151 nil
3152 'MSG)))
3153
3154 ;;;###autoload
3155 (defun bmkp-bmenu-set-tag-value-for-marked (tag value &optional msg-p) ; `T > v' in bookmark list
3156 "Set the value of TAG to VALUE, for each of the marked bookmarks.
3157 If any of the bookmarks has no tag named TAG, then add one with VALUE."
3158 (interactive (list (bmkp-read-tag-completing) (read (read-string "Value: ")) 'MSG))
3159 (bmkp-bmenu-barf-if-not-in-menu-list)
3160 (when msg-p (message "Setting tag values..."))
3161 (let ((marked (bmkp-marked-bookmarks-only)))
3162 (unless marked (error "No marked bookmarks"))
3163 (when msg-p (message "Setting tag values..."))
3164 (bmkp-set-tag-value-for-bookmarks marked tag value))
3165 (when (and msg-p tag) (message "Setting tag values...done")))
3166
3167 ;;;###autoload
3168 (defun bmkp-bmenu-remove-tags (&optional msg-p) ; Only on `mouse-3' menu in bookmark list.
3169 "Remove some tags from this bookmark."
3170 (interactive "p")
3171 (bmkp-bmenu-barf-if-not-in-menu-list)
3172 (bookmark-bmenu-ensure-position)
3173 (let* ((bmk (bookmark-bmenu-bookmark))
3174 (nb-removed (bmkp-remove-tags bmk
3175 (bmkp-read-tags-completing
3176 (mapcar 'bmkp-full-tag (bmkp-get-tags bmk)) t)
3177 nil
3178 msg-p)))
3179 (when (and (< nb-removed 0) ; It was tagged but is now untagged. If `s t' then re-sort.
3180 (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) ; Hardcoded value, for now.
3181 (bmkp-bmenu-sort-tagged-before-untagged))
3182 nb-removed))
3183
3184 ;;;###autoload
3185 (defun bmkp-bmenu-add-tags-to-marked (tags &optional msg-p) ; Bound to `T > +' in bookmark list
3186 "Add TAGS to each of the marked bookmarks.
3187 TAGS is a list of strings.
3188 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
3189 You can use completion to enter each tag, but you are not limited to
3190 choosing existing tags."
3191 (interactive (list (bmkp-read-tags-completing) 'MSG))
3192 (bmkp-bmenu-barf-if-not-in-menu-list)
3193 (let ((marked (bmkp-marked-bookmarks-only))
3194 (bmk (bookmark-bmenu-bookmark))
3195 (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag)
3196 bookmark-save-flag)) ; Save at most once, after `dolist'.
3197 (some-were-untagged-p nil))
3198 (unless marked (error "No marked bookmarks"))
3199 (when msg-p (message "Adding tags..."))
3200 (dolist (bmk (mapcar #'car marked))
3201 (when (< (bmkp-add-tags bmk tags 'NO-UPDATE-P) 0) (setq some-were-untagged-p t)))
3202 (bmkp-tags-list) ; Update the tags cache now, after iterate.
3203 (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate.
3204 (when (and some-were-untagged-p (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p)))
3205 (bmkp-bmenu-sort-tagged-before-untagged))
3206 (when (and msg-p tags) (message "Tags added: %S" tags))))
3207
3208 ;;;###autoload
3209 (defun bmkp-bmenu-remove-tags-from-marked (tags &optional msg-p) ; Bound to `T > -' in bookmark list
3210 "Remove TAGS from each of the marked bookmarks.
3211 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
3212 You can use completion to enter each tag."
3213 (interactive (let ((cand-tags ()))
3214 (dolist (bmk (bmkp-marked-bookmarks-only))
3215 (setq cand-tags (bmkp-set-union cand-tags (bmkp-get-tags bmk))))
3216 (unless cand-tags (error "No tags to remove"))
3217 (list (bmkp-read-tags-completing cand-tags t) 'MSG)))
3218 (bmkp-bmenu-barf-if-not-in-menu-list)
3219 (let ((marked (bmkp-marked-bookmarks-only))
3220 (bmk (bookmark-bmenu-bookmark))
3221 (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag)
3222 bookmark-save-flag)) ; Save at most once, after `dolist'.
3223 (some-are-now-untagged-p nil))
3224 (unless marked (error "No marked bookmarks"))
3225 (when msg-p (message "Removing tags..."))
3226 (dolist (bmk (mapcar #'car marked))
3227 (when (< (bmkp-remove-tags bmk tags 'NO-UPDATE-P) 0) (setq some-are-now-untagged-p t)))
3228 (bmkp-tags-list) ; Update the tags cache now, after iterate.
3229 (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate.
3230 (when (and some-are-now-untagged-p (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p)))
3231 (bmkp-bmenu-sort-tagged-before-untagged))
3232 (when (and msg-p tags) (message "Tags removed: %S" tags))))
3233
3234 ;;;###autoload
3235 (defun bmkp-bmenu-mark-bookmarks-tagged-regexp (regexp &optional notp no-re-sort-p msg-p)
3236 ; `T m %' in bookmark list
3237 "Mark bookmarks any of whose tags match REGEXP.
3238 With a prefix arg, mark all that are tagged but have no matching tags.
3239
3240 If any bookmark was unmarked before, and if the sort order is marked
3241 first or last (`s >'), then re-sort.
3242
3243 Non-interactively:
3244 * Non-nil NOTP: see prefix arg, above.
3245 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
3246 * Non-nil optional arg MSG-P means display a status message."
3247 (interactive "sRegexp: \nP\ni\p")
3248 (bmkp-bmenu-barf-if-not-in-menu-list)
3249 (let ((count 0)
3250 (nb-marked (length bmkp-bmenu-marked-bookmarks))
3251 tags anyp)
3252 (save-excursion
3253 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3254 (when msg-p (message "Updating bookmark-list display..."))
3255 (while (not (eobp))
3256 (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark))
3257 anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag)))
3258 tags)))
3259 (if (not (and tags (if notp (not anyp) anyp)))
3260 (forward-line 1)
3261 (bookmark-bmenu-mark 'NO-RE-SORT-P)
3262 (setq count (1+ count)))))
3263 (unless no-re-sort-p
3264 ;; If some were unmarked before, and if sort order is `s >', then re-sort.
3265 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
3266 (/= nb-marked (length bmkp-bmenu-marked-bookmarks)))
3267 (let ((current-bmk (bookmark-bmenu-bookmark)))
3268 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
3269 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
3270 (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
3271
3272 ;;;###autoload
3273 (defun bmkp-bmenu-mark-bookmarks-tagged-all (tags &optional nonep msg-p) ; `T m *' in bookmark list
3274 "Mark all visible bookmarks that are tagged with *each* tag in TAGS.
3275 As a special case, if TAGS is empty, then mark the bookmarks that have
3276 any tags at all (i.e., at least one tag).
3277
3278 With a prefix arg, mark all that are *not* tagged with *any* TAGS."
3279 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3280 (bmkp-bmenu-barf-if-not-in-menu-list)
3281 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags nonep nil nil msg-p))
3282
3283 ;;;###autoload
3284 (defun bmkp-bmenu-mark-bookmarks-tagged-none (tags &optional allp msg-p) ; `T m ~ +' in bookmark list
3285 "Mark all visible bookmarks that are not tagged with *any* tag in TAGS.
3286 As a special case, if TAGS is empty, then mark the bookmarks that have
3287 no tags at all.
3288
3289 With a prefix arg, mark all that are tagged with *each* tag in TAGS."
3290 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3291 (bmkp-bmenu-barf-if-not-in-menu-list)
3292 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) nil nil msg-p))
3293
3294 ;;;###autoload
3295 (defun bmkp-bmenu-mark-bookmarks-tagged-some (tags &optional somenotp msg-p) ; `T m +' in bookmark list
3296 "Mark all visible bookmarks that are tagged with *some* tag in TAGS.
3297 As a special case, if TAGS is empty, then mark the bookmarks that have
3298 any tags at all.
3299
3300 With a prefix arg, mark all that are *not* tagged with *all* TAGS.
3301
3302 Hit `RET' to enter each tag, then hit `RET' again after the last tag.
3303 You can use completion to enter each tag."
3304 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3305 (bmkp-bmenu-barf-if-not-in-menu-list)
3306 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp nil nil msg-p))
3307
3308 ;;;###autoload
3309 (defun bmkp-bmenu-mark-bookmarks-tagged-not-all (tags &optional somep msg-p) ; `T m ~ *' in bmk list
3310 "Mark all visible bookmarks that are *not* tagged with *all* TAGS.
3311 As a special case, if TAGS is empty, then mark the bookmarks that have
3312 no tags at all.
3313
3314 With a prefix arg, mark all that are tagged with *some* tag in TAGS."
3315 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3316 (bmkp-bmenu-barf-if-not-in-menu-list)
3317 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) nil nil msg-p))
3318
3319 ;;;###autoload
3320 (defun bmkp-bmenu-unmark-bookmarks-tagged-regexp (regexp &optional notp no-re-sort-p msg-p)
3321 ; `T u %' in bookmark list
3322 "Unmark bookmarks any of whose tags match REGEXP.
3323 With a prefix arg, mark all that are tagged but have no matching tags.
3324
3325 If any bookmark was marked before, and if the sort order is marked
3326 first or last (`s >'), then re-sort.
3327
3328 Non-interactively:
3329 * Non-nil NOTP: see prefix arg, above.
3330 * Non-nil optional arg NO-RE-SORT-P inhibits re-sorting.
3331 * Non-nil optional arg MSG-P means display a status message."
3332 (interactive "sRegexp: \nP\ni\np")
3333 (bmkp-bmenu-barf-if-not-in-menu-list)
3334 (let ((count 0)
3335 (nb-marked (length bmkp-bmenu-marked-bookmarks))
3336 tags anyp)
3337 (save-excursion
3338 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3339 (when msg-p (message "Updating bookmark-list display..."))
3340 (while (not (eobp))
3341 (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark))
3342 anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag)))
3343 tags)))
3344 (if (not (and tags (if notp (not anyp) anyp)))
3345 (forward-line 1)
3346 (bookmark-bmenu-unmark nil 'NO-RE-SORT-P)
3347 (setq count (1+ count)))))
3348 (unless no-re-sort-p
3349 ;; If some were marked before, and if sort order is `s >', then re-sort.
3350 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
3351 (/= nb-marked (length bmkp-bmenu-marked-bookmarks)))
3352 (let ((current-bmk (bookmark-bmenu-bookmark)))
3353 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
3354 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
3355 (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))
3356
3357 ;;;###autoload
3358 (defun bmkp-bmenu-unmark-bookmarks-tagged-all (tags &optional nonep msg-p) ; `T u *' in bookmark list
3359 "Unmark all visible bookmarks that are tagged with *each* tag in TAGS.
3360 As a special case, if TAGS is empty, then unmark the bookmarks that have
3361 any tags at all.
3362
3363 With a prefix arg, unmark all that are *not* tagged with *any* TAGS."
3364 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3365 (bmkp-bmenu-barf-if-not-in-menu-list)
3366 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags nonep 'UNMARK nil msg-p))
3367
3368 ;;;###autoload
3369 (defun bmkp-bmenu-unmark-bookmarks-tagged-none (tags &optional allp msg-p) ; `T u ~ +' in bookmark list
3370 "Unmark all visible bookmarks that are *not* tagged with *any* TAGS.
3371 As a special case, if TAGS is empty, then unmark the bookmarks that have
3372 no tags at all.
3373
3374 With a prefix arg, unmark all that are tagged with *each* tag in TAGS."
3375 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3376 (bmkp-bmenu-barf-if-not-in-menu-list)
3377 (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) 'UNMARK nil msg-p))
3378
3379 ;;;###autoload
3380 (defun bmkp-bmenu-unmark-bookmarks-tagged-some (tags &optional somenotp msg-p) ; `T u +' in bmk list
3381 "Unmark all visible bookmarks that are tagged with *some* tag in TAGS.
3382 As a special case, if TAGS is empty, then unmark the bookmarks that have
3383 any tags at all.
3384
3385 With a prefix arg, unmark all that are *not* tagged with *all* TAGS."
3386 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3387 (bmkp-bmenu-barf-if-not-in-menu-list)
3388 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp 'UNMARK nil msg-p))
3389
3390 ;;;###autoload
3391 (defun bmkp-bmenu-unmark-bookmarks-tagged-not-all (tags &optional somep msg-p) ; `T u ~ *' in bmk list
3392 "Unmark all visible bookmarks that are *not* tagged with *all* TAGS.
3393 As a special case, if TAGS is empty, then unmark the bookmarks that have
3394 no tags at all.
3395
3396 With a prefix arg, unmark all that are tagged with *some* TAGS."
3397 (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG))
3398 (bmkp-bmenu-barf-if-not-in-menu-list)
3399 (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) 'UNMARK nil msg-p))
3400
3401 (defun bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none (tags &optional nonep unmarkp no-re-sort-p msg-p)
3402 "Mark or unmark visible bookmarks tagged with all or none of TAGS.
3403 TAGS is a list of strings, the tag names.
3404 Non-nil NONEP means mark/unmark bookmarks that have none of the TAGS.
3405 Non-nil UNMARKP means unmark; nil means mark.
3406 Non-nil NO-RE-SORT-P inhibits re-sorting.
3407 Non-nil MSG-P means display a status message.
3408
3409 As a special case, if TAGS is empty, then mark or unmark the bookmarks
3410 that have any tags at all, or if NONEP is non-nil then mark or unmark
3411 those that have no tags at all.
3412
3413 If any bookmark was (un)marked before but is not afterward, and if the
3414 sort order is marked first or last (`s >'), then re-sort."
3415 (with-current-buffer "*Bookmark List*"
3416 (let ((count 0)
3417 (nb-marked (length bmkp-bmenu-marked-bookmarks))
3418 bmktags presentp)
3419 (save-excursion
3420 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3421 (when msg-p (message "Updating bookmark-list display..."))
3422 (while (not (eobp))
3423 (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark)))
3424 (if (not (if (null tags)
3425 (if nonep (not bmktags) bmktags)
3426 (and bmktags (catch 'bmkp-b-mu-b-t-an
3427 (dolist (tag tags)
3428 (setq presentp (assoc-default tag bmktags nil t))
3429 (unless (if nonep (not presentp) presentp)
3430 (throw 'bmkp-b-mu-b-t-an nil)))
3431 t))))
3432 (forward-line 1)
3433 (if unmarkp (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (bookmark-bmenu-mark 'NO-RE-SORT-P))
3434 (setq count (1+ count)))))
3435 (unless no-re-sort-p
3436 ;; If some were (un)marked before but not afterward, and if sort order is `s >', then re-sort.
3437 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
3438 (/= nb-marked (length bmkp-bmenu-marked-bookmarks)))
3439 (let ((current-bmk (bookmark-bmenu-bookmark)))
3440 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
3441 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
3442 (when msg-p (if (= 1 count)
3443 (message "1 bookmark matched")
3444 (message "%d bookmarks matched" count))))))
3445
3446 (defun bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all (tags &optional notallp unmarkp
3447 no-re-sort-p msg-p)
3448 "Mark or unmark visible bookmarks tagged with any or not all of TAGS.
3449 TAGS is a list of strings, the tag names.
3450 Non-nil NOTALLP means mark/unmark bookmarks that do not have all TAGS.
3451 Non-nil UNMARKP means unmark; nil means mark.
3452 Non-nil NO-RE-SORT-P inhibits re-sorting.
3453 Non-nil MSG-P means display a status message.
3454
3455 As a special case, if TAGS is empty, then mark or unmark the bookmarks
3456 that have any tags at all, or if NOTALLP is non-nil then mark or
3457 unmark those that have no tags at all.
3458
3459 If any bookmark was (un)marked before but is not afterward, and if the
3460 sort order is marked first or last (`s >'), then re-sort."
3461 (with-current-buffer "*Bookmark List*"
3462 (let ((count 0)
3463 (nb-marked (length bmkp-bmenu-marked-bookmarks))
3464 bmktags presentp)
3465 (save-excursion
3466 (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines)
3467 (when msg-p (message "Updating bookmark-list display..."))
3468 (while (not (eobp))
3469 (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark)))
3470 (if (not (if (null tags)
3471 (if notallp (not bmktags) bmktags)
3472 (and bmktags (catch 'bmkp-b-mu-b-t-sna
3473 (dolist (tag tags)
3474 (setq presentp (assoc-default tag bmktags nil t))
3475 (when (if notallp (not presentp) presentp)
3476 (throw 'bmkp-b-mu-b-t-sna t)))
3477 nil))))
3478 (forward-line 1)
3479 (if unmarkp (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (bookmark-bmenu-mark 'NO-RE-SORT-P))
3480 (setq count (1+ count)))))
3481 (unless no-re-sort-p
3482 ;; If some were (un)marked before but not afterward, and if sort order is `s >', then re-sort.
3483 (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))
3484 (/= nb-marked (length bmkp-bmenu-marked-bookmarks)))
3485 (let ((current-bmk (bookmark-bmenu-bookmark)))
3486 (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)
3487 (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))
3488 (when msg-p
3489 (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count))))))
3490
3491 ;;;###autoload
3492 (defun bmkp-bmenu-copy-tags (&optional msg-p) ; `T c', `T M-w', `mouse-3' menu in bookmark list.
3493 "Copy tags from this bookmark, so you can paste them to another bookmark."
3494 (interactive (list 'MSG))
3495 (bmkp-bmenu-barf-if-not-in-menu-list)
3496 (bookmark-bmenu-ensure-position)
3497 (bmkp-copy-tags (bookmark-bmenu-bookmark) msg-p))
3498
3499 ;;;###autoload
3500 (defun bmkp-bmenu-paste-add-tags (&optional msg-p) ; `T p', `T C-y', `mouse-3' menu in bookmark list.
3501 "Add tags to this bookmark that were copied from another bookmark."
3502 (interactive (list 'MSG))
3503 (bmkp-bmenu-barf-if-not-in-menu-list)
3504 (bookmark-bmenu-ensure-position)
3505 (bmkp-paste-add-tags (bookmark-bmenu-bookmark) nil msg-p))
3506
3507 ;;;###autoload
3508 (defun bmkp-bmenu-paste-replace-tags (&optional msg-p) ; `T q', `mouse-3' menu.
3509 "Replace tags for this bookmark with those copied from another bookmark."
3510 (interactive (list 'MSG))
3511 (bmkp-bmenu-barf-if-not-in-menu-list)
3512 (bookmark-bmenu-ensure-position)
3513 (bmkp-paste-replace-tags (bookmark-bmenu-bookmark) nil msg-p))
3514
3515 ;;;###autoload
3516 (defun bmkp-bmenu-paste-add-tags-to-marked (&optional msg-p) ; `T > p', `T > C-y'
3517 "Add tags that were copied from another bookmark to the marked bookmarks."
3518 (interactive (list 'MSG))
3519 (bmkp-bmenu-barf-if-not-in-menu-list)
3520 (let ((marked (bmkp-marked-bookmarks-only))
3521 (bmk (bookmark-bmenu-bookmark))
3522 (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag)
3523 bookmark-save-flag))) ; Save at most once, after `dolist'.
3524 (unless marked (error "No marked bookmarks"))
3525 (when msg-p (message "Adding tags..."))
3526 (dolist (bmk marked) (bmkp-paste-add-tags bmk 'NO-UPDATE-P))
3527 (bmkp-tags-list) ; Update the tags cache now, after iterate.
3528 (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate.
3529 (when msg-p (message "Tags added: %S" bmkp-copied-tags))))
3530
3531 ;;;###autoload
3532 (defun bmkp-bmenu-paste-replace-tags-for-marked (&optional msg-p) ; `T > q'
3533 "Replace tags for the marked bookmarks with tags copied previously."
3534 (interactive (list 'MSG))
3535 (bmkp-bmenu-barf-if-not-in-menu-list)
3536 (let ((marked (bmkp-marked-bookmarks-only))
3537 (bmk (bookmark-bmenu-bookmark))
3538 (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag)
3539 bookmark-save-flag))) ; Save at most once, after `dolist'.
3540 (unless marked (error "No marked bookmarks"))
3541 (when msg-p (message "Replacing tags..."))
3542 (dolist (bmk marked) (bmkp-paste-replace-tags bmk 'NO-UPDATE-P))
3543 (bmkp-tags-list) ; Update the tags cache now, after iterate.
3544 (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate.
3545 (when msg-p (message "Replacement tags: %S" bmkp-copied-tags))))
3546
3547
3548 ;;(@* "General Menu-List (`-*bmenu-*') Commands and Functions")
3549 ;; *** General Menu-List (`-*bmenu-*') Commands and Functions ***
3550
3551 ;;;###autoload
3552 (defun bmkp-bmenu-show-or-edit-annotation (editp msg-p)
3553 "Show annotation for current buffer in another window. `C-u': Edit.
3554 With no prefix arg, show the annotation. With a prefix arg, edit it."
3555 (interactive "P\np")
3556 (if editp
3557 (bookmark-bmenu-edit-annotation)
3558 (bookmark-bmenu-show-annotation msg-p)))
3559
3560 ;;;###autoload
3561 (defun bmkp-bmenu-w32-open () ; Bound to `M-RET' in bookmark list.
3562 "Use `w32-browser' to open this bookmark."
3563 (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-this-window)))
3564
3565 ;;;###autoload
3566 (defun bmkp-bmenu-w32-open-with-mouse (event) ; Bound to `M-mouse-2' in bookmark list.
3567 "Use `w32-browser' to open the bookmark clicked."
3568 (interactive "e")
3569 (save-excursion
3570 (with-current-buffer (window-buffer (posn-window (event-end event)))
3571 (save-excursion (goto-char (posn-point (event-end event)))
3572 (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-other-window))))))
3573
3574 ;;;###autoload
3575 (defun bmkp-bmenu-w32-open-select () ; Bound to `M-o' in bookmark-list.
3576 "Use `w32-browser' to open this bookmark and all marked bookmarks."
3577 (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-select)))
3578
3579 ;;;###autoload
3580 (defun bmkp-bmenu-mode-status-help () ; Bound to `C-h m' and `?' in bookmark list
3581 "`describe-mode' + current status of `*Bookmark List*' + face legend."
3582 (interactive)
3583 (unless (string= (buffer-name) "*Help*") (bmkp-bmenu-barf-if-not-in-menu-list))
3584 (with-current-buffer (get-buffer-create "*Help*")
3585 (with-output-to-temp-buffer "*Help*"
3586 (let ((buffer-read-only nil)
3587 top)
3588 (erase-buffer)
3589 (save-excursion
3590 (let ((standard-output (current-buffer)))
3591 (if (> emacs-major-version 21)
3592 (describe-function-1 'bookmark-bmenu-mode)
3593 (describe-function-1 'bookmark-bmenu-mode nil t)))
3594 (help-setup-xref (list #'bmkp-bmenu-mode-status-help) (interactive-p))
3595 (goto-char (point-min))
3596 (search-forward ; This depends on the text written by `bookmark-bmenu-mode'.
3597 "Other keys are available everywhere." nil t)
3598 (delete-region (point-min) (point)) ; Get rid of intro from `describe-function'.
3599 (insert "*************************** Bookmark List ***************************\n\n")
3600 (insert "Major mode for editing a list of bookmarks.\n")
3601 (setq top (copy-marker (point)))
3602 ;; Add buttons to access help and Customize.
3603 ;; Not for Emacs 21.3 - its `help-insert-xref-button' signature is different.
3604 (when (and (> emacs-major-version 21) ; In `help-mode.el'.
3605 (condition-case nil (require 'help-mode nil t) (error nil))
3606 (fboundp 'help-insert-xref-button))
3607 (goto-char (point-min))
3608 (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button)
3609 (insert " ")
3610 (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button)
3611 (insert " ")
3612 (help-insert-xref-button "[Customize]" 'bmkp-customize-button)
3613 (insert "\n\n")
3614 (goto-char (point-max))
3615 (insert "\nSend a Bookmark+ bug report: `\\[icicle-send-bug-report]'.\n\n")
3616 (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button)
3617 (insert " ")
3618 (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button)
3619 (insert " ")
3620 (help-insert-xref-button "[Customize]" 'bmkp-customize-button)
3621 (insert "\n\n")
3622 (goto-char (point-min))
3623 (forward-line 2))
3624 (goto-char top)
3625 (insert (format
3626 "\n\nCurrent Status\n--------------\n
3627 Bookmark file:\t%s\nSorted:\t\t\t%s\nFiltering:\t\t%s\nMarked:\t\t\t%d\nOmitted:\t\t%d\n\
3628 Autosave bookmarks:\t%s\nAutosave list display:\t%s\n\n\n"
3629 bmkp-current-bookmark-file
3630 (if (not bmkp-sort-comparer)
3631 "no"
3632 (format "%s%s" (bmkp-current-sort-order)
3633 ;; Code essentially the same as found in `bmkp-msg-about-sort-order'.
3634 (if (not (and (consp bmkp-sort-comparer) ; Ordinary single predicate
3635 (consp (car bmkp-sort-comparer))))
3636 (if bmkp-reverse-sort-p "; reversed" "")
3637 (if (not (cadr (car bmkp-sort-comparer)))
3638 ;; Single PRED.
3639 (if (or (and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p))
3640 (and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p)))
3641 "; reversed"
3642 "")
3643 ;; In case we want to distinguish:
3644 ;; (if (and bmkp-reverse-sort-p
3645 ;; (not bmkp-reverse-multi-sort-p))
3646 ;; "; reversed"
3647 ;; (if (and bmkp-reverse-multi-sort-p
3648 ;; (not bmkp-reverse-sort-p))
3649 ;; "; reversed +"
3650 ;; ""))
3651
3652 ;; At least two PREDs.
3653 (cond ((and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p))
3654 "; reversed")
3655 ((and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p))
3656 "; each predicate group reversed")
3657 ((and bmkp-reverse-multi-sort-p bmkp-reverse-sort-p)
3658 "; order of predicate groups reversed")
3659 (t ""))))))
3660 (or (and bmkp-bmenu-filter-function (downcase bmkp-bmenu-title)) "none")
3661 (length bmkp-bmenu-marked-bookmarks)
3662 (length bmkp-bmenu-omitted-bookmarks)
3663 (if bookmark-save-flag "yes" "no")
3664 (if bmkp-bmenu-state-file "yes" "no")))
3665
3666 ;; Add markings legend.
3667 (let ((mm ">")
3668 (DD "D")
3669 (tt "t")
3670 (aa "a")
3671 (XX "X")
3672 (mod "*"))
3673 (put-text-property 0 1 'face 'bmkp-D-mark DD)
3674 (put-text-property 0 1 'face 'bmkp-t-mark tt)
3675 (put-text-property 0 1 'face 'bmkp-a-mark aa)
3676 (put-text-property 0 1 'face 'bmkp-X-mark XX)
3677 (put-text-property 0 1 'face 'bmkp-*-mark mod)
3678 (insert "Legend for Markings\n-------------------\n")
3679 (insert (concat mm "\t- marked\n"))
3680 (insert (concat DD "\t- flagged for deletion (`x' to delete all such)\n"))
3681 (insert (concat tt "\t- tagged (`C-h C-RET' to see)\n"))
3682 (insert (concat aa "\t- annotated (`C-h C-RET' to see)\n"))
3683 (insert (concat mod "\t- modified (not saved)\n"))
3684 (insert (concat XX "\t- temporary (will not be saved)\n"))
3685 (insert "\n\n"))
3686
3687 ;; Add face legend.
3688 (let ((gnus "Gnus\n")
3689 (info "Info node\n")
3690 (man "Man page\n")
3691 (url "URL\n")
3692 (local-no-region "Local file with no region\n")
3693 (local-w-region "Local file with a region\n")
3694 (buffer "Buffer\n")
3695 (no-buf "No current buffer\n")
3696 (bad "Possibly invalid bookmark\n")
3697 (remote "Remote file/directory or Dired buffer (could have wildcards)\n")
3698 (sudo "Remote accessed by `su' or `sudo'\n")
3699 (local-dir "Local directory or Dired buffer (could have wildcards)\n")
3700 (file-handler "Bookmark with property `file-handler'\n")
3701 (bookmark-list "*Bookmark List*\n")
3702 (bookmark-file "Bookmark file\n")
3703 (desktop "Desktop\n")
3704 (sequence "Sequence\n")
3705 (variable-list "Variable list\n")
3706 (function "Function\n"))
3707 (put-text-property 0 (1- (length gnus)) 'face 'bmkp-gnus gnus)
3708 (put-text-property 0 (1- (length info)) 'face 'bmkp-info info)
3709 (put-text-property 0 (1- (length man)) 'face 'bmkp-man man)
3710 (put-text-property 0 (1- (length url)) 'face 'bmkp-url url)
3711 (put-text-property 0 (1- (length local-no-region))
3712 'face 'bmkp-local-file-without-region local-no-region)
3713 (put-text-property 0 (1- (length local-w-region))
3714 'face 'bmkp-local-file-with-region local-w-region)
3715 (put-text-property 0 (1- (length buffer)) 'face 'bmkp-buffer buffer)
3716 (put-text-property 0 (1- (length no-buf)) 'face 'bmkp-non-file no-buf)
3717 (put-text-property 0 (1- (length bad)) 'face 'bmkp-bad-bookmark bad)
3718 (put-text-property 0 (1- (length remote)) 'face 'bmkp-remote-file remote)
3719 (put-text-property 0 (1- (length sudo)) 'face 'bmkp-su-or-sudo sudo)
3720 (put-text-property 0 (1- (length local-dir))
3721 'face 'bmkp-local-directory local-dir)
3722 (put-text-property 0 (1- (length file-handler)) 'face 'bmkp-file-handler file-handler)
3723 (put-text-property 0 (1- (length bookmark-list))
3724 'face 'bmkp-bookmark-list bookmark-list)
3725 (put-text-property 0 (1- (length bookmark-file))
3726 'face 'bmkp-bookmark-file bookmark-file)
3727 (put-text-property 0 (1- (length desktop)) 'face 'bmkp-desktop desktop)
3728 (put-text-property 0 (1- (length sequence)) 'face 'bmkp-sequence sequence)
3729 (put-text-property 0 (1- (length variable-list)) 'face 'bmkp-variable-list variable-list)
3730 (put-text-property 0 (1- (length function)) 'face 'bmkp-function function)
3731 (insert "Legend for Bookmark Types\n-------------------------\n")
3732 (when (and (fboundp 'display-images-p) (display-images-p)
3733 bmkp-bmenu-image-bookmark-icon-file
3734 (file-readable-p bmkp-bmenu-image-bookmark-icon-file))
3735 (insert-image (create-image bmkp-bmenu-image-bookmark-icon-file nil nil :ascent 95))
3736 (insert "Image file\n"))
3737 (insert gnus) (insert info) (insert man) (insert url) (insert local-no-region)
3738 (insert local-w-region) (insert buffer) (insert no-buf) (insert remote)
3739 (insert sudo) (insert local-dir) (insert file-handler) (insert bookmark-list)
3740 (insert bookmark-file) (insert desktop) (insert sequence) (insert variable-list)
3741 (insert function) (insert bad)
3742 (insert "\n\n")
3743 (insert "More bookmarking help below. Each line represents an Emacs bookmark.\n")
3744 (insert "Keys without prefix `C-x' are available only in `*Bookmark List*'.\n")
3745 (insert "Other keys are available everywhere.")))))))
3746
3747 (when (and (> emacs-major-version 21)
3748 (condition-case nil (require 'help-mode nil t) (error nil))
3749 (get 'help-xref 'button-category-symbol)) ; In `button.el'
3750 (define-button-type 'bmkp-help-button
3751 :supertype 'help-xref
3752 'help-function #'(lambda () (browse-url "http://www.emacswiki.org/emacs/BookmarkPlus"))
3753 'help-echo
3754 (purecopy "mouse-2, RET: Bookmark+ documentation on the Emacs Wiki (requires Internet access)"))
3755 (define-button-type 'bmkp-commentary-button
3756 :supertype 'help-xref
3757 'help-function #'(lambda ()
3758 (message "Getting Bookmark+ doc from file commentary...")
3759 (finder-commentary "bookmark+-doc")
3760 (when (condition-case nil (require 'linkd nil t) (error nil)) (linkd-mode 1))
3761 (when (condition-case nil (require 'fit-frame nil t) (error nil))
3762 (fit-frame)))
3763 'help-echo (purecopy "mouse-2, RET: Bookmark+ documentation (no Internet needed)"))
3764 (define-button-type 'bmkp-customize-button
3765 :supertype 'help-xref
3766 'help-function #'(lambda () (customize-group-other-window 'bookmark-plus))
3767 'help-echo (purecopy "mouse-2, RET: Customize/Browse Bookmark+ Options & Faces")))
3768
3769 ;;;###autoload
3770 (defun bmkp-bmenu-define-jump-marked-command () ; Bound to `M-c' in bookmark list
3771 "Define a command to jump to a bookmark that is one of those now marked.
3772 The bookmarks marked now will be those that are completion candidates
3773 for the command (but omitted bookmarks are excluded).
3774 Save the command definition in `bmkp-bmenu-commands-file'."
3775 (interactive)
3776 (bmkp-bmenu-barf-if-not-in-menu-list)
3777 (let* ((cands (mapcar #'list
3778 (bmkp-remove-if #&ap