From: Joerg Jaspert Date: Mon, 12 May 2014 12:49:31 +0000 (+0200) Subject: icicle update X-Git-Url: https://git.ganneff.de//index.cgi?p=emacs.git;a=commitdiff_plain;h=e83fe99fa4b1c7ca3c952b8253cb3e1f38af83e8 icicle update --- diff --git a/.emacs.d/elisp/icicle/apropos-fn+var.el b/.emacs.d/elisp/icicle/apropos-fn+var.el deleted file mode 100644 index d92c4f1..0000000 --- a/.emacs.d/elisp/icicle/apropos-fn+var.el +++ /dev/null @@ -1,638 +0,0 @@ -;;; apropos-fn+var.el --- Apropos for functions and variables -;; -;; Filename: apropos-fn.el -;; Description: Apropos for functions and variables -;; Author: Drew Adams -;; Maintainer: Drew Adams -;; Copyright (C) 1996-2012, Drew Adams, all rights reserved. -;; Created: Mon Nov 28 15:41:09 2005 -;; Version: -;; Last-Updated: Fri May 11 16:27:59 2012 (-0700) -;; By: dradams -;; Update #: 177 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/apropos-fn+var.el -;; Keywords: apropos -;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x -;; -;; Features that might be required by this library: -;; -;; `apropos', `naked'. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; Standard `apropos' commands `apropos-variable' and -;; `apropos-command' do not distinguish, by command name, between the -;; different types of target object (but you can do that via `C-u'). -;; This library provides individual `apropos' commands for user -;; options, variables in general (not just options), and functions in -;; general (not just commands). These commands are defined here: -;; -;; `apropos-option' - Apropos a user option -;; `apropos-variable' - Apropos any variable, not just user option -;; `apropos-function' - Apropos any function, not just command -;; -;; -;; ***** NOTE: The following functions defined in `apropos.el' have -;; been REDEFINED HERE: -;; -;; `apropos-variable' - See above (the standard command does what -;; `apropos-option' does here). -;; `apropos-print' - Identifies user options with label `Option'. -;; -;; -;; Slightly different versions of `apropos-function' and -;; `apropos-variable' were posted by Kevin Rodgers to bug-gnu-emacs, -;; Tue, 06 Sep 2005 14:34:54 -0600. Kevin didn't actually redefine -;; `apropos-variable' (he would never do that ;-)), but he provided -;; the new definition. I redefined `apropos-print' and added button -;; type `apropos-option'. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Change Log: -;; -;; 2012/05/11 dadams -;; apropos-print: Updated for Emacs 24. -;; 2012/03/31 dadams -;; Button apropos-option: Added properties face and apropos-short-label (same as var). -;; 2011/10/07 dadams -;; Added soft require of naked.el. -;; apropos-print: Use naked-key-description if available. -;; 2011/03/31 dadams -;; apropos-print: Added Emacs 24+ version. -;; 2006/03/03 dadams -;; Updated to latest Emacs 22 CVS version: -;; apropos-orig-regexp was renamed to apropos-pattern. -;; apropos-print now has an additional optional arg. -;; 2006/02/25 dadams -;; apropos-variable: Added ignored optional arg, for compatibility. -;; 2005/11/29 dadams -;; Added redefinition of apropos-print and button type apropos-option. -;; Made arg to apropos-function and apropos-variable mandatory. -;; 2005/11/28 dadams -;; Redefined apropos-variable. Defined apropos-option as old version. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 2, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -(require 'apropos) - -(require 'naked nil t) ;; (no error if not found): naked-key-description - -;; Quiet byte compiler -(defvar apropos-compact-layout) -(defvar apropos-multi-type) -(defvar apropos-pattern) -(defvar apropos-sort-by-scores) - -;;;;;;;;;;;;;;;;;;;;;;;; - -(if (< emacs-major-version 22) - (defun apropos-function (pattern) - "Show functions that match PATTERN (a regular expression). -This includes functions that are not commands." - (interactive "i") ; Ignored when interactive - (if (interactive-p) - (let ((apropos-do-all t)) - (call-interactively 'apropos-command)) - (apropos-command pattern t))) - (defun apropos-function (pattern) - "Show functions that match PATTERN. -This includes functions that are not commands. -PATTERN can be a word, a list of words (separated by spaces), -or a regexp (using some regexp special characters). If it is a word, -search for matches for that word as a substring. If it is a list of words, -search for matches for any two (or more) of those words. - -When called from a Lisp program, a string PATTERN is used as a regexp, -while a list of strings is used as a word list." - (interactive "i") ; Ignored when interactive - (if (interactive-p) - (let ((apropos-do-all t)) - (call-interactively 'apropos-command)) - (apropos-command pattern t)))) - - -;;; REPLACE ORIGINAL defined in `apropos.el'. -;;; Allow for non user-option variables too. -;;; Rename original command as `apropos-option'. -;;; -(or (fboundp 'apropos-option) -(fset 'apropos-option (symbol-function 'apropos-variable))) - -(if (< emacs-major-version 22) - (defun apropos-variable (pattern &optional ignore) - "Show variables that match PATTERN (a regular expression). -This includes variables that are not user options." - (interactive "i") ; Ignored when interactive - (if (interactive-p) - (let ((apropos-do-all t)) - (call-interactively 'apropos-option)) - (apropos-option pattern t))) - (defun apropos-variable (pattern &optional ignore) - "Show variables that match PATTERN. -This includes variables that are not user options. -PATTERN can be a word, a list of words (separated by spaces), -or a regexp (using some regexp special characters). If it is a word, -search for matches for that word as a substring. If it is a list of -words, search for matches for any two (or more) of those words." - (interactive "i") ; Ignored when interactive - (if (interactive-p) - (let ((apropos-do-all t)) - (call-interactively 'apropos-option)) - (apropos-option pattern t)))) - - -;;; REPLACE ORIGINAL defined in `apropos.el'. -;;; Use label "Option" for user options. -;;; -(cond ((< emacs-major-version 22) ; Emacs 20 and 21. - (defun apropos-print (do-keys spacing) - "Output result of apropos searching into buffer `*Apropos*'. -The value of `apropos-accumulator' is the list of items to output. -Each element should have the format (SYMBOL FN-DOC VAR-DOC [PLIST-DOC]). -The return value is the list that was in `apropos-accumulator', sorted -alphabetically by symbol name; but this function also sets -`apropos-accumulator' to nil before returning." - (if (null apropos-accumulator) - (message "No apropos matches for `%s'" apropos-regexp) - (setq apropos-accumulator - (sort apropos-accumulator (lambda (a b) - (string-lessp (car a) (car b))))) - (and apropos-label-face - (symbolp apropos-label-face) - (setq apropos-label-face `(face ,apropos-label-face - mouse-face highlight))) - (with-output-to-temp-buffer "*Apropos*" - (let ((p apropos-accumulator) - (old-buffer (current-buffer)) - symbol item point1 point2) - (set-buffer standard-output) - (apropos-mode) - (if window-system - (insert "If you move the mouse over text that changes color,\n" - (substitute-command-keys - "you can click \\[apropos-mouse-follow] to get more information.\n"))) - (insert (substitute-command-keys - "In this buffer, type \\[apropos-follow] to get full documentation.\n\n")) - (while (consp p) - (or (not spacing) (bobp) (terpri)) - (setq apropos-item (car p) - symbol (car apropos-item) - p (cdr p) - point1 (point)) - (princ symbol) ; print symbol name - (setq point2 (point)) - ;; Calculate key-bindings if we want them. - (and do-keys - (commandp symbol) - (indent-to 30 1) - (if (let ((keys - (save-excursion - (set-buffer old-buffer) - (where-is-internal symbol))) - filtered) - ;; Copy over the list of key sequences, - ;; omitting any that contain a buffer or a frame. - (while keys - (let ((key (car keys)) - (i 0) - loser) - (while (< i (length key)) - (if (or (framep (aref key i)) - (bufferp (aref key i))) - (setq loser t)) - (setq i (1+ i))) - (or loser - (setq filtered (cons key filtered)))) - (setq keys (cdr keys))) - (setq item filtered)) - ;; Convert the remaining keys to a string and insert. - (insert - (mapconcat - (lambda (key) - (setq key (condition-case () - (if (fboundp 'naked-key-description) - (naked-key-description key) - (key-description key)) - (error))) - (if apropos-keybinding-face - (put-text-property 0 (length key) - 'face apropos-keybinding-face - key)) - key) - item ", ")) - (insert "M-x") - (put-text-property (- (point) 3) (point) - 'face apropos-keybinding-face) - (insert " " (symbol-name symbol) " ") - (insert "RET") - (put-text-property (- (point) 3) (point) - 'face apropos-keybinding-face))) - (terpri) - ;; only now so we don't propagate text attributes all over - (put-text-property point1 point2 'item - (if (eval `(or ,@(cdr apropos-item))) - (car apropos-item) - apropos-item)) - (if apropos-symbol-face - (put-text-property point1 point2 'face apropos-symbol-face)) - (apropos-print-doc 'describe-function 1 (if (commandp symbol) - "Command" - (if (apropos-macrop symbol) - "Macro" - "Function")) - t) - ;; We used to use customize-variable-other-window instead - ;; for a customizable variable, but that is slow. - ;; It is better to show an ordinary help buffer - ;; and let the user click on the customization button - ;; in that buffer, if he wants to. - ;; Likewise for `customize-face-other-window'. - (apropos-print-doc 'describe-variable 2 (if (user-variable-p symbol) - "Option" - "Variable") - t) - (apropos-print-doc 'customize-group-other-window 6 "Group" t) - (apropos-print-doc 'describe-face 5 "Face" t) - (apropos-print-doc 'widget-browse-other-window 4 "Widget" t) - (apropos-print-doc 'apropos-describe-plist 3 "Plist" nil)) - (setq buffer-read-only t)))) - (prog1 apropos-accumulator - (setq apropos-accumulator ())))) - ((< emacs-major-version 24) ; Emacs 22 and 23. - (defun apropos-print (do-keys spacing &optional text nosubst) - "Output result of apropos searching into buffer `*Apropos*'. -The value of `apropos-accumulator' is the list of items to output. -Each element should have the format - (SYMBOL SCORE FN-DOC VAR-DOC [PLIST-DOC WIDGET-DOC FACE-DOC GROUP-DOC]). -The return value is the list that was in `apropos-accumulator', sorted -alphabetically by symbol name; but this function also sets -`apropos-accumulator' to nil before returning. - -If SPACING is non-nil, it should be a string; separate items with that string. -If non-nil TEXT is a string that will be printed as a heading." - (if (null apropos-accumulator) - (message "No apropos matches for `%s'" apropos-pattern) - (setq apropos-accumulator - (sort apropos-accumulator - (lambda (a b) - ;; Don't sort by score if user can't see the score. - ;; It would be confusing. -- rms. - (if (and (boundp 'apropos-sort-by-scores) - apropos-sort-by-scores) - (or (> (cadr a) (cadr b)) - (and (= (cadr a) (cadr b)) - (string-lessp (car a) (car b)))) - (string-lessp (car a) (car b)))))) - (with-output-to-temp-buffer "*Apropos*" - (let ((p apropos-accumulator) - (old-buffer (current-buffer)) - symbol item) - (set-buffer standard-output) - (apropos-mode) - (if (display-mouse-p) - (insert - "If moving the mouse over text changes the text's color, " - "you can click\n" - "mouse-2 (second button from right) on that text to " - "get more information.\n")) - (insert "In this buffer, go to the name of the command, function, or variable,\n" - (substitute-command-keys - "and type \\[apropos-follow] to get full documentation.\n\n")) - (if text (insert text "\n\n")) - (while (consp p) - (when (and spacing (not (bobp))) - (princ spacing)) - (setq apropos-item (car p) - symbol (car apropos-item) - p (cdr p)) - ;; Insert dummy score element for backwards compatibility with 21.x - ;; apropos-item format. - (if (not (numberp (cadr apropos-item))) - (setq apropos-item - (cons (car apropos-item) - (cons nil (cdr apropos-item))))) - (insert-text-button (symbol-name symbol) - 'type 'apropos-symbol - ;; Can't use default, since user may have - ;; changed the variable! - ;; Just say `no' to variables containing faces! - 'face apropos-symbol-face) - (if (and (eq apropos-sort-by-scores 'verbose) - (cadr apropos-item)) - (insert " (" (number-to-string (cadr apropos-item)) ") ")) - ;; Calculate key-bindings if we want them. - (and do-keys - (commandp symbol) - (indent-to 30 1) - (if (let ((keys - (save-excursion - (set-buffer old-buffer) - (where-is-internal symbol))) - filtered) - ;; Copy over the list of key sequences, - ;; omitting any that contain a buffer or a frame. - (while keys - (let ((key (car keys)) - (i 0) - loser) - (while (< i (length key)) - (if (or (framep (aref key i)) - (bufferp (aref key i))) - (setq loser t)) - (setq i (1+ i))) - (or loser - (setq filtered (cons key filtered)))) - (setq keys (cdr keys))) - (setq item filtered)) - ;; Convert the remaining keys to a string and insert. - (insert - (mapconcat - (lambda (key) - (setq key (condition-case () - (if (fboundp 'naked-key-description) - (naked-key-description key) - (key-description key)) - (error))) - (if apropos-keybinding-face - (put-text-property 0 (length key) - 'face apropos-keybinding-face - key)) - key) - item ", ")) - (insert "M-x ... RET") - (when apropos-keybinding-face - (put-text-property (- (point) 11) (- (point) 8) - 'face apropos-keybinding-face) - (put-text-property (- (point) 3) (point) - 'face apropos-keybinding-face)))) - (terpri) - (apropos-print-doc 2 (if (commandp symbol) - 'apropos-command - (if (apropos-macrop symbol) - 'apropos-macro - 'apropos-function)) - (not nosubst)) - (apropos-print-doc 3 (if (user-variable-p symbol) - 'apropos-option - 'apropos-variable) - (not nosubst)) - (apropos-print-doc 7 'apropos-group t) - (apropos-print-doc 6 'apropos-face t) - (apropos-print-doc 5 'apropos-widget t) - (apropos-print-doc 4 'apropos-plist nil)) - (setq buffer-read-only t)))) - (prog1 apropos-accumulator - (setq apropos-accumulator ())))) ; permit gc - (t ; Emacs 24+. - (defun apropos-print (do-keys spacing &optional text nosubst) - "Output result of apropos searching into buffer `*Apropos*'. -The value of `apropos-accumulator' is the list of items to output. -Each element should have the format - (SYMBOL SCORE FN-DOC VAR-DOC [PLIST-DOC WIDGET-DOC FACE-DOC GROUP-DOC]). -The return value is the list that was in `apropos-accumulator', sorted -alphabetically by symbol name; but this function also sets -`apropos-accumulator' to nil before returning. - -If SPACING is non-nil, it should be a string; separate items with that string. -If non-nil TEXT is a string that will be printed as a heading." - (if (null apropos-accumulator) - (message "No apropos matches for `%s'" apropos-pattern) - (setq apropos-accumulator - (sort apropos-accumulator - (lambda (a b) - ;; Don't sort by score if user can't see the score. - ;; It would be confusing. -- rms. - (if apropos-sort-by-scores - (or (> (cadr a) (cadr b)) - (and (= (cadr a) (cadr b)) - (string-lessp (car a) (car b)))) - (string-lessp (car a) (car b)))))) - (with-output-to-temp-buffer "*Apropos*" - (let ((p apropos-accumulator) - (old-buffer (current-buffer)) - (inhibit-read-only t) - symbol item) - (set-buffer standard-output) - (apropos-mode) - (insert (substitute-command-keys "Type \\[apropos-follow] on ") - (if apropos-multi-type "a type label" "an entry") - " to view its full documentation.\n\n") - (if text (insert text "\n\n")) - (dolist (apropos-item p) - (when (and spacing (not (bobp))) - (princ spacing)) - (setq symbol (car apropos-item)) - ;; Insert dummy score element for backwards compatibility with 21.x - ;; apropos-item format. - (if (not (numberp (cadr apropos-item))) - (setq apropos-item - (cons (car apropos-item) - (cons nil (cdr apropos-item))))) - (insert-text-button (symbol-name symbol) - 'type 'apropos-symbol - 'skip apropos-multi-type - 'face (if (boundp 'apropos-symbol-face) - apropos-symbol-face - 'apropos-symbol)) - (if (and (eq apropos-sort-by-scores 'verbose) - (cadr apropos-item)) - (insert " (" (number-to-string (cadr apropos-item)) ") ")) - ;; Calculate key-bindings if we want them. - (unless apropos-compact-layout - (and do-keys - (commandp symbol) - (not (eq symbol 'self-insert-command)) - (indent-to 30 1) - (if (let ((keys - (with-current-buffer old-buffer - (where-is-internal symbol))) - filtered) - ;; Copy over the list of key sequences, - ;; omitting any that contain a buffer or a frame. - ;; FIXME: Why omit keys that contain buffers and - ;; frames? This looks like a bad workaround rather - ;; than a proper fix. Does anybody know what problem - ;; this is trying to address? --Stef - (dolist (key keys) - (let ((i 0) - loser) - (while (< i (length key)) - (if (or (framep (aref key i)) - (bufferp (aref key i))) - (setq loser t)) - (setq i (1+ i))) - (or loser - (push key filtered)))) - (setq item filtered)) - ;; Convert the remaining keys to a string and insert. - (insert - (mapconcat - (lambda (key) - (setq key (condition-case () - (if (fboundp 'naked-key-description) - (naked-key-description key) - (key-description key)) - (error))) - (put-text-property 0 (length key) - 'face (if (boundp 'apropos-keybinding-face) - apropos-keybinding-face - 'apropos-keybinding) - key) - key) - item ", ")) - (insert "M-x ... RET") - (put-text-property (- (point) 11) (- (point) 8) - 'face (if (boundp 'apropos-keybinding-face) - apropos-keybinding-face - 'apropos-keybinding)) - (put-text-property (- (point) 3) (point) - 'face (if (boundp 'apropos-keybinding-face) - apropos-keybinding-face - 'apropos-keybinding)))) - (terpri)) - (apropos-print-doc 2 (if (commandp symbol) - 'apropos-command - (if (apropos-macrop symbol) - 'apropos-macro - 'apropos-function)) - (not nosubst)) - (apropos-print-doc 3 (if (user-variable-p symbol) - 'apropos-option - 'apropos-variable) - (not nosubst)) - (apropos-print-doc 7 'apropos-group t) - (apropos-print-doc 6 'apropos-face t) - (apropos-print-doc 5 'apropos-widget t) - (apropos-print-doc 4 'apropos-plist nil)) - (set (make-local-variable 'truncate-partial-width-windows) t) - (set (make-local-variable 'truncate-lines) t)))) - (prog1 apropos-accumulator - (setq apropos-accumulator ()))))) ; permit gc - -(when (>= emacs-major-version 22) - (defface apropos-option '((t (:inherit font-lock-variable-name-face))) - "Face used for option names in Apropos buffers." - :group 'apropos) - - (define-button-type 'apropos-option - 'apropos-label "Option" - 'apropos-short-label "v" ; Same as variable - 'face '(apropos-option button) - 'help-echo "mouse-2, RET: Display more help on this user option (variable)" - 'follow-link t - 'action (lambda (button) - (describe-variable (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-function -;;; 'apropos-label "Function" -;;; 'apropos-short-label "f" -;;; 'face '(font-lock-function-name-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this function" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (describe-function (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-macro -;;; 'apropos-label "Macro" -;;; 'apropos-short-label "m" -;;; 'face '(font-lock-function-name-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this macro" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (describe-function (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-command -;;; 'apropos-label "Command" -;;; 'apropos-short-label "c" -;;; 'face '(font-lock-function-name-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this command" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (describe-function (button-get button 'apropos-symbol)))) - -;;; ;; We used to use `customize-variable-other-window' instead for a -;;; ;; customizable variable, but that is slow. It is better to show an -;;; ;; ordinary help buffer and let the user click on the customization -;;; ;; button in that buffer, if he wants to. -;;; ;; Likewise for `customize-face-other-window'. -;;; (define-button-type 'apropos-variable -;;; 'apropos-label "Variable" -;;; 'apropos-short-label "v" -;;; 'face '(font-lock-variable-name-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this variable" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (describe-variable (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-face -;;; 'apropos-label "Face" -;;; 'apropos-short-label "F" -;;; 'face '(font-lock-variable-name-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this face" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (describe-face (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-group -;;; 'apropos-label "Group" -;;; 'apropos-short-label "g" -;;; 'face '(font-lock-builtin-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this group" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (customize-group-other-window -;;; (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-widget -;;; 'apropos-label "Widget" -;;; 'apropos-short-label "w" -;;; 'face '(font-lock-builtin-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this widget" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (widget-browse-other-window (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-plist -;;; 'apropos-label "Properties" -;;; 'apropos-short-label "p" -;;; 'face '(font-lock-keyword-face button) -;;; 'help-echo "mouse-2, RET: Display more help on this plist" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (apropos-describe-plist (button-get button 'apropos-symbol)))) - -;;; (define-button-type 'apropos-library -;;; 'help-echo "mouse-2, RET: Display more help on this library" -;;; 'follow-link t -;;; 'action (lambda (button) -;;; (apropos-library (button-get button 'apropos-symbol)))) - ) - -;;;;;;;;;;;;;;;;;;;; - -(provide 'apropos-fn+var) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; apropos-fn.el ends here diff --git a/.emacs.d/elisp/icicle/bookmark+-1.el b/.emacs.d/elisp/icicle/bookmark+-1.el deleted file mode 100644 index 989319c..0000000 --- a/.emacs.d/elisp/icicle/bookmark+-1.el +++ /dev/null @@ -1,10332 +0,0 @@ -;;; bookmark+-1.el - First part of package Bookmark+. -;; -;; Filename: bookmark+-1.el -;; Description: First part of package Bookmark+. -;; Author: Drew Adams, Thierry Volpiatto -;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") -;; Copyright (C) 2000-2012, Drew Adams, all rights reserved. -;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved. -;; Created: Mon Jul 12 13:43:55 2010 (-0700) -;; Last-Updated: Wed May 16 08:20:58 2012 (-0700) -;; By: dradams -;; Update #: 5559 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-1.el -;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, info, url, w3m, gnus -;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x -;; -;; Features that might be required by this library: -;; -;; `bookmark', `bookmark+-1', `bookmark+-mac', `cl', `dired', -;; `dired-aux', `dired-x', `ffap', `pp', `thingatpt', `thingatpt+'. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; The Bookmark+ libraries are these: -;; -;; `bookmark+.el' - main (driver) library -;; `bookmark+-mac.el' - Lisp macros -;; `bookmark+-lit.el' - (optional) code for highlighting bookmarks -;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (bmenu) -;; `bookmark+-1.el' - other (non-bmenu) required code (this file) -;; `bookmark+-key.el' - key and menu bindings -;; -;; `bookmark+-doc.el' - documentation (comment-only file) -;; `bookmark+-chg.el' - change log (comment-only file) -;; -;; The documentation (in `bookmark+-doc.el') includes how to -;; byte-compile and install Bookmark+. The documentation is also -;; available in these ways: -;; -;; 1. From the bookmark list (`C-x r l'): -;; Use `?' to show the current bookmark-list status and general -;; help, then click link `Doc in Commentary' or link `Doc on the -;; Web'. -;; -;; 2. From the Emacs-Wiki Web site: -;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus. -;; -;; 3. From the Bookmark+ group customization buffer: -;; `M-x customize-group bookmark-plus', then click link -;; `Commentary'. -;; -;; (The commentary links in #1 and #3 work only if you have library -;; `bookmark+-doc.el' in your `load-path'.) - -;;(@> "Index") -;; -;; Index -;; ----- -;; -;; If you have library `linkd.el' and Emacs 22 or later, load -;; `linkd.el' and turn on `linkd-mode' now. It lets you easily -;; navigate around the sections of this doc. Linkd mode will -;; highlight this Index, as well as the cross-references and section -;; headings throughout this file. You can get `linkd.el' here: -;; http://dto.freeshell.org/notebook/Linkd.html. -;; -;; (@> "Things Defined Here") -;; (@> "User Options (Customizable)") -;; (@> "Internal Variables") -;; (@> "Compatibility Code for Older Emacs Versions") -;; (@> "Core Replacements (`bookmark-*' except `bookmark-bmenu-*')") -;; (@> "Bookmark+ Functions (`bmkp-*')") -;; (@> "Search-and-Replace Locations of Marked Bookmarks") -;; (@> "Tags") -;; (@> "Bookmark Predicates") -;; (@> "Filter Functions") -;; (@> "General Utility Functions") -;; (@> "Bookmark Entry Access Functions") -;; (@> "Sorting - General Functions") -;; (@> "Sorting - Commands") -;; (@> "Sorting - General Predicates") -;; (@> "Sorting - File-Name Predicates") -;; (@> "Indirect Bookmarking Functions") -;; (@> "Other Bookmark+ Functions (`bmkp-*')") -;; (@> "Keymaps") - -;;(@* "Things Defined Here") -;; -;; Things Defined Here -;; ------------------- -;; -;; Commands defined here: -;; -;; `bmkp-add-tags', `bmkp-all-tags-jump', -;; `bmkp-all-tags-jump-other-window', `bmkp-all-tags-regexp-jump', -;; `bmkp-all-tags-regexp-jump-other-window', -;; `bmkp-autofile-add-tags', `bmkp-autofile-all-tags-jump', -;; `bmkp-autofile-all-tags-jump-other-window', -;; `bmkp-autofile-all-tags-regexp-jump', -;; `bmkp-autofile-all-tags-regexp-jump-other-window', -;; `bmkp-autofile-jump', `bmkp-autofile-jump-other-window', -;; `bmkp-autofile-remove-tags', `bmkp-autofile-set', -;; `bmkp-autofile-some-tags-jump', -;; `bmkp-autofile-some-tags-jump-other-window', -;; `bmkp-autofile-some-tags-regexp-jump', -;; `bmkp-autofile-some-tags-regexp-jump-other-window', -;; `bmkp-auto-idle-bookmark-mode', `bmkp-autonamed-jump', -;; `bmkp-autonamed-jump-other-window', -;; `bmkp-autonamed-this-buffer-jump', -;; `bmkp-autonamed-this-buffer-jump-other-window', -;; `bmkp-bookmark-a-file' `bmkp-bookmark-file-jump', -;; `bmkp-bookmark-list-jump', -;; `bmkp-choose-navlist-from-bookmark-list', -;; `bmkp-choose-navlist-of-type', `bmkp-compilation-target-set', -;; `bmkp-compilation-target-set-all', `bmkp-copy-tags', -;; `bmkp-crosshairs-highlight', `bmkp-cycle', -;; `bmkp-cycle-autonamed', `bmkp-cycle-autonamed-other-window', -;; `bmkp-cycle-bookmark-list', -;; `bmkp-cycle-bookmark-list-other-window', `bmkp-cycle-desktop', -;; `bmkp-cycle-dired', `bmkp-cycle-dired-other-window', -;; `bmkp-cycle-file', `bmkp-cycle-file-other-window', -;; `bmkp-cycle-gnus', `bmkp-cycle-gnus-other-window', -;; `bmkp-cycle-info', `bmkp-cycle-info-other-window', -;; `bmkp-cycle-lighted', `bmkp-cycle-lighted-other-window', -;; `bmkp-cycle-local-file', `bmkp-cycle-local-file-other-window', -;; `bmkp-cycle-man', `bmkp-cycle-man-other-window', -;; `bmkp-cycle-non-file', `bmkp-cycle-non-file-other-window', -;; `bmkp-cycle-other-window', `bmkp-cycle-remote-file', -;; `bmkp-cycle-remote-file-other-window', -;; `bmkp-cycle-specific-buffers', -;; `bmkp-cycle-specific-buffers-other-window', -;; `bmkp-cycle-specific-files', -;; `bmkp-cycle-specific-files-other-window', -;; `bmkp-cycle-this-buffer', `bmkp-cycle-this-buffer-other-window', -;; `bmkp-cycle-this-file', `bmkp-cycle-this-file/buffer', -;; `bmkp-cycle-this-file/buffer-other-window', -;; `bmkp-cycle-this-file-other-window', `bmkp-cycle-variable-list', -;; `bmkp-cycle-url', `bmkp-cycle-url-other-window', -;; `bmkp-delete-all-autonamed-for-this-buffer', -;; `bmkp-delete-all-temporary-bookmarks', `bmkp-delete-bookmarks', -;; `bmkp-describe-bookmark', `bmkp-describe-bookmark-internals', -;; `bmkp-desktop-change-dir', `bmkp-desktop-delete', -;; `bmkp-desktop-jump', `bmkp-desktop-read', `bmkp-dired-jump', -;; `bmkp-dired-jump-other-window', `bmkp-dired-this-dir-jump', -;; `bmkp-dired-this-dir-jump-other-window', -;; `bmkp-edit-bookmark-name-and-file', `bmkp-edit-bookmark-record', -;; `bmkp-edit-bookmark-record-send', -;; `bmkp-edit-bookmark-records-send', `bmkp-edit-tags', -;; `bmkp-edit-tags-send', `bmkp-empty-file', -;; `bmkp-file-target-set', `bmkp-file-all-tags-jump', -;; `bmkp-file-all-tags-jump-other-window', -;; `bmkp-file-all-tags-regexp-jump', -;; `bmkp-file-all-tags-regexp-jump-other-window', `bmkp-file-jump', -;; `bmkp-file-jump-other-window', `bmkp-file-some-tags-jump', -;; `bmkp-file-some-tags-jump-other-window', -;; `bmkp-file-some-tags-regexp-jump', -;; `bmkp-file-some-tags-regexp-jump-other-window', -;; `bmkp-file-this-dir-all-tags-jump', -;; `bmkp-file-this-dir-all-tags-jump-other-window', -;; `bmkp-file-this-dir-all-tags-regexp-jump', -;; `bmkp-file-this-dir-all-tags-regexp-jump-other-window', -;; `bmkp-file-this-dir-jump', -;; `bmkp-file-this-dir-jump-other-window', -;; `bmkp-file-this-dir-some-tags-jump', -;; `bmkp-file-this-dir-some-tags-jump-other-window', -;; `bmkp-file-this-dir-some-tags-regexp-jump', -;; `bmkp-file-this-dir-some-tags-regexp-jump-other-window', -;; `bmkp-find-file', `bmkp-find-file-other-window', -;; `bmkp-find-file-all-tags', -;; `bmkp-find-file-all-tags-other-window', -;; `bmkp-find-file-all-tags-regexp', -;; `bmkp-find-file-all-tags-regexp-other-window', -;; `bmkp-find-file-some-tags', -;; `bmkp-find-file-some-tags-other-window', -;; `bmkp-find-file-some-tags-regexp', -;; `bmkp-find-file-some-tags-regexp-other-window', -;; `bmkp-global-auto-idle-bookmark-mode' (Emacs 21+), -;; `bmkp-gnus-jump', `bmkp-gnus-jump-other-window', -;; `bmkp-image-jump', `bmkp-image-jump-other-window', -;; `bmkp-info-jump', `bmkp-info-jump-other-window', -;; `bmkp-jump-in-navlist', `bmkp-jump-in-navlist-other-window', -;; `bmkp-jump-to-type', `bmkp-jump-to-type-other-window', -;; `bmkp-list-all-tags', `bmkp-list-defuns-in-commands-file', -;; `bmkp-local-file-jump', `bmkp-local-file-jump-other-window', -;; `bmkp-make-bookmark-savable', `bmkp-make-bookmark-temporary', -;; `bmkp-make-function-bookmark', `bmkp-man-jump', -;; `bmkp-man-jump-other-window', `bmkp-menu-jump-other-window' -;; (Emacs 20, 21), `bmkp-navlist-bmenu-list', -;; `bmkp-next-autonamed-bookmark', -;; `bmkp-next-autonamed-bookmark-repeat', `bmkp-next-bookmark', -;; `bmkp-next-bookmark-list-bookmark', -;; `bmkp-next-bookmark-list-bookmark-repeat', -;; `bmkp-next-bookmark-repeat', `bmkp-next-bookmark-this-buffer', -;; `bmkp-next-bookmark-this-buffer-repeat', -;; `bmkp-next-bookmark-this-file', -;; `bmkp-next-bookmark-this-file/buffer', -;; `bmkp-next-bookmark-this-file/buffer-repeat', -;; `bmkp-next-bookmark-this-file-repeat', `bmkp-next-bookmark-w32', -;; `bmkp-next-bookmark-w32-repeat', `bmkp-next-desktop-bookmark', -;; `bmkp-next-desktop-bookmark-repeat', `bmkp-next-dired-bookmark', -;; `bmkp-next-dired-bookmark-repeat', `bmkp-next-file-bookmark', -;; `bmkp-next-file-bookmark-repeat', `bmkp-next-gnus-bookmark', -;; `bmkp-next-gnus-bookmark-repeat', `bmkp-next-info-bookmark', -;; `bmkp-next-info-bookmark-repeat', `bmkp-next-lighted-bookmark', -;; `bmkp-next-lighted-bookmark-repeat', -;; `bmkp-next-local-file-bookmark', -;; `bmkp-next-local-file-bookmark-repeat', -;; `bmkp-next-man-bookmark', `bmkp-next-man-bookmark-repeat', -;; `bmkp-next-non-file-bookmark', -;; `bmkp-next-non-file-bookmark-repeat', -;; `bmkp-next-remote-file-bookmark', -;; `bmkp-next-remote-file-bookmark-repeat', -;; `bmkp-next-specific-buffers-bookmark', -;; `bmkp-next-specific-buffers-bookmark-repeat', -;; `bmkp-next-specific-files-bookmark', -;; `bmkp-next-specific-files-bookmark-repeat', -;; `bmkp-next-variable-list-bookmark', -;; `bmkp-next-variable-list-bookmark-repeat', -;; `bmkp-next-url-bookmark', `bmkp-next-url-bookmark-repeat', -;; `bmkp-non-file-jump', `bmkp-non-file-jump-other-window', -;; `bmkp-occur-create-autonamed-bookmarks', -;; `bmkp-occur-target-set', `bmkp-occur-target-set-all', -;; `bmkp-paste-add-tags', `bmkp-paste-replace-tags', -;; `bmkp-previous-bookmark', `bmkp-previous-bookmark-repeat', -;; `bmkp-previous-bookmark-this-buffer', -;; `bmkp-previous-bookmark-this-buffer-repeat', -;; `bmkp-previous-bookmark-this-file', -;; `bmkp-previous-bookmark-this-file/buffer', -;; `bmkp-previous-bookmark-this-file/buffer-repeat', -;; `bmkp-previous-bookmark-this-file-repeat', -;; `bmkp-previous-bookmark-w32', -;; `bmkp-previous-bookmark-w32-repeat', -;; `bmkp-purge-notags-autofiles', `bmkp-read-bookmark-for-type', -;; `bmkp-region-jump', `bmkp-region-jump-other-window', -;; `bmkp-remote-file-jump', `bmkp-remote-file-jump-other-window', -;; `bmkp-remove-all-tags', `bmkp-remove-tags', -;; `bmkp-remove-tags-from-all', `bmkp-rename-tag', -;; `bmkp-revert-bookmark-file', `bmkp-save-menu-list-state', -;; `bmkp-send-bug-report', `bmkp-set-autonamed-bookmark', -;; `bmkp-set-autonamed-bookmark-at-line', -;; `bmkp-set-autonamed-regexp-buffer', -;; `bmkp-set-autonamed-regexp-region', -;; `bmkp-set-bookmark-file-bookmark', `bmkp-set-desktop-bookmark', -;; `bmkp-set-restrictions-bookmark', `bmkp-set-tag-value', -;; `bmkp-set-tag-value-for-navlist', -;; `bmkp-set-variable-list-bookmark', `bmkp-some-tags-jump', -;; `bmkp-some-tags-jump-other-window', -;; `bmkp-some-tags-regexp-jump', -;; `bmkp-some-tags-regexp-jump-other-window', -;; `bmkp-specific-buffers-jump', -;; `bmkp-specific-buffers-jump-other-window', -;; `bmkp-specific-files-jump', -;; `bmkp-specific-files-jump-other-window', -;; `bmkp-switch-bookmark-file', `bmkp-switch-bookmark-file-create', -;; `bmkp-switch-to-last-bookmark-file', `bmkp-tag-a-file', -;; `bmkp-temporary-bookmarking-mode', `bmkp-temporary-jump', -;; `bmkp-temporary-jump-other-window', -;; `bmkp-this-buffer-bmenu-list', `bmkp-this-buffer-jump', -;; `bmkp-this-buffer-jump-other-window', -;; `bmkp-this-file-bmenu-list', `bmkp-this-file/buffer-bmenu-list', -;; `bmkp-toggle-autonamed-bookmark-set/delete', -;; `bmkp-toggle-autotemp-on-set', -;; `bmkp-toggle-bookmark-set-refreshes', -;; `bmkp-toggle-saving-bookmark-file', -;; `bmkp-toggle-saving-menu-list-state', -;; `bmkp-toggle-temporary-bookmark', -;; `bmkp-turn-on-auto-idle-bookmark-mode' (Emacs 21+), -;; `bmkp-unomit-all', `bmkp-untag-a-file', `bmkp-url-target-set', -;; `bmkp-url-jump', `bmkp-url-jump-other-window', -;; `bmkp-variable-list-jump', `bmkp-version', -;; `bmkp-w32-browser-jump', `bmkp-w3m-jump', -;; `bmkp-w3m-jump-other-window', `old-bookmark-insert'. -;; -;; User options defined here: -;; -;; `bmkp-auto-idle-bookmark-min-distance', -;; `bmkp-auto-idle-bookmark-mode-delay', -;; `bmkp-auto-idle-bookmark-mode-lighter', -;; `bmkp-auto-idle-bookmark-mode-set-function', -;; `bmkp-autoname-bookmark-function', `bmkp-autoname-format', -;; `bmkp-autotemp-bookmark-predicates', -;; `bmkp-bookmark-name-length-max', -;; `bmkp-count-multi-mods-as-one-flag', `bmkp-crosshairs-flag', -;; `bmkp-default-bookmark-name', -;; `bmkp-default-handlers-for-file-types', -;; `bmkp-desktop-no-save-vars', -;; `bmkp-guess-default-handler-for-file-flag', -;; `bmkp-handle-region-function', `bmkp-incremental-filter-delay', -;; `bmkp-last-as-first-bookmark-file', -;; `bmkp-menu-popup-max-length', `bmkp-other-window-pop-to-flag', -;; `bmkp-prompt-for-tags-flag', `bmkp-region-search-size', -;; `bmkp-save-new-location-flag', -;; `bmkp-sequence-jump-display-function', -;; `bmkp-show-end-of-region', `bmkp-sort-comparer', -;; `bmkp-su-or-sudo-regexp', `bmkp-tags-for-completion', -;; `bmkp-temporary-bookmarking-mode', -;; `bmkp-temporary-bookmarking-mode-hook', -;; `bmkp-temporary-bookmarking-mode-lighter', -;; `bmkp-this-file/buffer-cycle-sort-comparer', `bmkp-use-region', -;; `bmkp-w3m-allow-multi-tabs'. -;; -;; Non-interactive functions defined here: -;; -;; `bmkext-jump-gnus', `bmkext-jump-man', `bmkext-jump-w3m', -;; `bmkext-jump-woman', `bmkp-all-exif-data', -;; `bmkp-all-tags-alist-only', `bmkp-all-tags-regexp-alist-only', -;; `bmkp-alpha-cp', `bmkp-alpha-p', `bmkp-annotated-alist-only', -;; `bmkp-autofile-alist-only', `bmkp-autofile-all-tags-alist-only', -;; `bmkp-autofile-all-tags-regexp-alist-only', -;; `bmkp-autofile-bookmark-p', -;; `bmkp-autofile-some-tags-alist-only', -;; `bmkp-autofile-some-tags-regexp-alist-only', -;; `bmkp-autoname-bookmark-function-default', -;; `bmkp-autonamed-alist-only', -;; `bmkp-autonamed-bookmark-for-buffer-p', -;; `bmkp-autonamed-bookmark-p', -;; `bmkp-autonamed-this-buffer-alist-only', -;; `bmkp-autonamed-this-buffer-bookmark-p', -;; `bmkp-bookmark-creation-cp', `bmkp-bookmark-data-from-record', -;; `bmkp-bookmark-description', `bmkp-bookmark-last-access-cp', -;; `bmkp-bookmark-file-alist-only', -;; `bmkp-bookmark-list-alist-only', -;; `bmkp-bookmark-file-bookmark-p', -;; `bmkp-bookmark-list-bookmark-p', `bmkp-bookmark-name-member', -;; `bmkp-bookmark-record-from-name', `bmkp-bookmark-type', -;; `bmkp-buffer-last-access-cp', `bmkp-buffer-names', -;; `bmkp-compilation-file+line-at', `bmkp-completing-read-1', -;; `bmkp-completing-read-buffer-name', -;; `bmkp-completing-read-file-name', `bmkp-completing-read-lax', -;; `bmkp-cp-not', `bmkp-create-variable-list-bookmark', -;; `bmkp-current-bookmark-list-state', `bmkp-current-sort-order', -;; `bmkp-cycle-1', `bmkp-default-bookmark-file', -;; `bmkp-default-bookmark-name', `bmkp-default-handler-for-file', -;; `bmkp-default-handler-user', `bmkp-delete-autonamed-no-confirm', -;; `bmkp-delete-autonamed-this-buffer-no-confirm', -;; `bmkp-delete-bookmark-name-from-list', -;; `bmkp-delete-temporary-no-confirm', `bmkp-desktop-alist-only', -;; `bmkp-desktop-bookmark-p', `bmkp-desktop-kill', -;; `bmkp-dired-alist-only', `bmkp-dired-bookmark-p', -;; `bmkp-dired-subdirs', `bmkp-dired-this-dir-alist-only', -;; `bmkp-dired-this-dir-bookmark-p', -;; `bmkp-dired-wildcards-bookmark-p', -;; `bmkp-edit-bookmark-record-mode', -;; `bmkp-edit-bookmark-records-mode', `bmkp-edit-tags-mode', -;; `bmkp-end-position-post-context', -;; `bmkp-end-position-pre-context', `bmkp-every', -;; `bmkp-file-alist-only', `bmkp-file-all-tags-alist-only', -;; `bmkp-file-all-tags-regexp-alist-only', `bmkp-file-alpha-cp', -;; `bmkp-file-attribute-0-cp', `bmkp-file-attribute-1-cp', -;; `bmkp-file-attribute-2-cp', `bmkp-file-attribute-3-cp', -;; `bmkp-file-attribute-4-cp', `bmkp-file-attribute-5-cp', -;; `bmkp-file-attribute-6-cp', `bmkp-file-attribute-7-cp', -;; `bmkp-file-attribute-8-cp', `bmkp-file-attribute-9-cp', -;; `bmkp-file-attribute-10-cp', `bmkp-file-attribute-11-cp', -;; `bmkp-file-bookmark-p', `bmkp-file-names', `bmkp-file-remote-p', -;; `bmkp-file-some-tags-alist-only', -;; `bmkp-file-some-tags-regexp-alist-only', -;; `bmkp-file-this-dir-alist-only', -;; `bmkp-file-this-dir-all-tags-alist-only', -;; `bmkp-file-this-dir-all-tags-regexp-alist-only', -;; `bmkp-file-this-dir-bookmark-p', -;; `bmkp-file-this-dir-some-tags-alist-only', -;; `bmkp-file-this-dir-some-tags-regexp-alist-only', -;; `bmkp-flagged-bookmark-p', `bmkp-flagged-cp', `bmkp-float-time', -;; `bmkp-full-tag', `bmkp-function-bookmark-p', -;; `bmkp-get-autofile-bookmark', `bmkp-get-bookmark-in-alist', -;; `bmkp-get-buffer-name', `bmkp-get-end-position', -;; `bmkp-get-tag-value', `bmkp-get-tags', `bmkp-get-visit-time', -;; `bmkp-get-visits-count', `bmkp-gnus-alist-only', -;; `bmkp-gnus-bookmark-p', `bmkp-gnus-cp', `bmkp-goto-position', -;; `bmkp-handle-region-default', `bmkp-handler-cp', -;; `bmkp-handler-pred', `bmkp-has-tag-p', `bmkp-image-alist-only', -;; `bmkp-image-bookmark-p', `bmkp-info-alist-only', -;; `bmkp-info-bookmark-p', `bmkp-info-cp', `bmkp-isearch-bookmarks' -;; (Emacs 23+), `bmkp-isearch-bookmarks-regexp' (Emacs 23+), -;; `bmkp-isearch-next-bookmark-buffer' (Emacs 23+), `bmkp-jump-1', -;; `bmkp-jump-bookmark-file', `bmkp-jump-bookmark-list', -;; `bmkp-jump-desktop', `bmkp-jump-dired', `bmkp-jump-function', -;; `bmkp-jump-gnus', `bmkp-jump-man', `bmkp-jump-sequence', -;; `bmkp-jump-url-browse', `bmkp-jump-variable-list', -;; `bmkp-jump-w3m', `bmkp-jump-w3m-new-session', -;; `bmkp-jump-w3m-only-one-tab', `bmkp-jump-woman', -;; `bmkp-last-specific-buffer-alist-only', -;; `bmkp-last-specific-buffer-p', -;; `bmkp-last-specific-file-alist-only', -;; `bmkp-last-specific-file-p', `bmkp-line-number-at-pos', -;; `bmkp-list-position', `bmkp-local-directory-bookmark-p', -;; `bmkp-local-file-accessed-more-recently-cp', -;; `bmkp-local-file-alist-only', `bmkp-local-file-bookmark-p', -;; `bmkp-local-file-size-cp', `bmkp-local-file-type-cp', -;; `bmkp-local-file-updated-more-recently-cp', -;; `bmkp-make-bookmark-file-record', -;; `bmkp-make-bookmark-list-record', `bmkp-make-desktop-record', -;; `bmkp-make-dired-record', `bmkp-make-gnus-record', -;; `bmkp-make-man-record', `bmkp-make-plain-predicate', -;; `bmkp-make-record-for-target-file', -;; `bmkp-make-url-browse-record', `bmkp-make-variable-list-record', -;; `bmkp-make-w3m-record', `bmkp-make-woman-record' (Emacs 21+), -;; `bmkp-man-alist-only', `bmkp-man-bookmark-p', -;; `bmkp-marked-bookmark-p', `bmkp-marked-bookmarks-only', -;; `bmkp-marked-cp', `bmkp-maybe-save-bookmarks', -;; `bmkp-modified-bookmark-p', `bmkp-modified-cp', -;; `bmkp-msg-about-sort-order', `bmkp-multi-sort', -;; `bmkp-names-same-bookmark-p', `bmkp-non-autonamed-alist-only', -;; `bmkp-non-file-alist-only', `bmkp-non-file-bookmark-p', -;; `bmkp-not-near-other-auto-idle-bmks', `bmkp-omitted-alist-only', -;; `bmkp-orphaned-file-alist-only', -;; `bmkp-orphaned-file-bookmark-p', -;; `bmkp-orphaned-local-file-alist-only', -;; `bmkp-orphaned-local-file-bookmark-p', -;; `bmkp-orphaned-remote-file-alist-only', -;; `bmkp-orphaned-remote-file-bookmark-p', -;; `bmkp-position-after-whitespace', -;; `bmkp-position-before-whitespace', `bmkp-position-cp', -;; `bmkp-position-post-context', -;; `bmkp-position-post-context-region', -;; `bmkp-position-pre-context', `bmkp-position-pre-context-region', -;; `bmkp-printable-p', `bmkp-printable-vars+vals', -;; `bmkp-read-bookmark-file-name', `bmkp-read-tag-completing', -;; `bmkp-read-tags', `bmkp-read-tags-completing', -;; `bmkp-read-variable', `bmkp-read-variables-completing', -;; `bmkp-record-visit', `bmkp-refresh-latest-bookmark-list', -;; `bmkp-refresh-menu-list', `bmkp-refresh/rebuild-menu-list.', -;; `bmkp-regexp-filtered-annotation-alist-only', -;; `bmkp-regexp-filtered-bookmark-name-alist-only', -;; `bmkp-regexp-filtered-file-name-alist-only', -;; `bmkp-regexp-filtered-tags-alist-only', -;; `bmkp-region-alist-only', `bmkp-region-bookmark-p', -;; `bmkp-remote-file-alist-only', `bmkp-remote-file-bookmark-p', -;; `bmkp-remove-dups', `bmkp-remove-if', `bmkp-remove-if-not', -;; `bmkp-remove-omitted', -;; `bmkp-rename-for-marked-and-omitted-lists', -;; `bmkp-repeat-command', `bmkp-replace-existing-bookmark', -;; `bmkp-root-or-sudo-logged-p', `bmkp-same-creation-time-p', -;; `bmkp-same-file-p', `bmkp-save-new-region-location', -;; `bmkp-select-buffer-other-window', `bmkp-sequence-bookmark-p', -;; `bmkp-set-tag-value-for-bookmarks', `bmkp-set-union', -;; `bmkp-some', `bmkp-some-marked-p', `bmkp-some-tags-alist-only', -;; `bmkp-some-tags-regexp-alist-only', `bmkp-some-unmarked-p' -;; `bmkp-sort-omit', `bmkp-sound-jump', -;; `bmkp-specific-buffers-alist-only', -;; `bmkp-specific-files-alist-only', -;; `bmkp-string-less-case-fold-p', `bmkp-tagged-bookmark-p', -;; `bmkp-tagged-cp', `bmkp-tag-name', `bmkp-tags-in-bookmark-file', -;; `bmkp-tags-list', `bmkp-temporary-alist-only', -;; `bmkp-temporary-bookmark-p', `bmkp-this-buffer-alist-only', -;; `bmkp-this-buffer-p', `bmkp-this-file-alist-only', -;; `bmkp-this-file/buffer-alist-only', `bmkp-this-file-p', -;; `bmkp-unmarked-bookmarks-only', `bmkp-upcase', -;; `bmkp-update-autonamed-bookmark', `bmkp-url-alist-only', -;; `bmkp-url-bookmark-p', `bmkp-url-browse-alist-only', -;; `bmkp-url-browse-bookmark-p', `bmkp-url-cp', -;; `bmkp-variable-list-alist-only', -;; `bmkp-variable-list-bookmark-p', `bmkp-visited-more-cp', -;; `bmkp-w3m-alist-only', `bmkp-w3m-bookmark-p', `bmkp-w3m-cp', -;; `bmkp-w3m-set-new-buffer-name'. -;; -;; Internal variables defined here: -;; -;; `bmkp-after-set-hook', `bmkp-autofile-history', -;; `bmkp-auto-idle-bookmark-mode-timer', -;; `bmkp-auto-idle-bookmarks', `bmkp-autonamed-history', -;; `bmkp-autotemp-all-when-set-p', `bmkp-bookmark-file-history', -;; `bmkp-bookmark-list-history', `bmkp-current-bookmark-file', -;; `bmkp-current-nav-bookmark', `bmkp-desktop-history', -;; `bmkp-dired-history', `bmkp-edit-bookmark-record-mode-map', -;; `bmkp-edit-bookmark-records-mode-map', -;; `bmkp-edit-bookmark-records-number', `bmkp-edit-tags-mode-map', -;; `bmkp-file-bookmark-handlers', `bmkp-file-history', -;; `bmkp-gnus-history', `bmkp-image-history', `bmkp-info-history', -;; `bmkp-isearch-bookmarks' (Emacs 23+), -;; `bmkp-jump-display-function', `bmkp-jump-other-window-map', -;; `bmkp-last-bmenu-state-file', `bmkp-last-bookmark-file', -;; `bmkp-last-save-flag-value', `bmkp-last-specific-buffer', -;; `bmkp-last-specific-file', `bmkp-latest-bookmark-alist', -;; `bmkp-local-file-history', `bmkp-man-history', -;; `bmkp-modified-bookmarks', `bmkp-nav-alist', -;; `bmkp-non-file-filename', `bmkp-non-file-history', -;; `bmkp-region-history', `bmkp-remote-file-history', -;; `bmkp-return-buffer', `bmkp-reverse-multi-sort-p', -;; `bmkp-reverse-sort-p', `bmkp-sorted-alist', -;; `bmkp-specific-buffers-history', `bmkp-specific-files-history', -;; `bmkp-tag-history', `bmkp-tags-alist', `bmkp-temporary-history', -;; `bmkp-types-alist', `bmkp-url-history', -;; `bmkp-use-w32-browser-p', `bmkp-variable-list-history', -;; `bmkp-version-number', `bmkp-w3m-history'. -;; -;; -;; ***** NOTE: The following commands defined in `bookmark.el' -;; have been REDEFINED HERE: -;; -;; `bookmark-delete', `bookmark-edit-annotation', -;; `bookmark-edit-annotation-mode', `bookmark-insert', -;; `bookmark-insert-location', `bookmark-jump', -;; `bookmark-jump-other-window', `bookmark-load', -;; `bookmark-relocate', `bookmark-rename', `bookmark-save', -;; `bookmark-send-edited-annotation', `bookmark-set', -;; `bookmark-set-name', `bookmark-yank-word'. -;; -;; -;; ***** NOTE: The following non-interactive functions defined in -;; `bookmark.el' have been REDEFINED HERE: -;; -;; `bookmark--jump-via', `bookmark-alist-from-buffer', -;; `bookmark-all-names', `bookmark-completing-read', -;; `bookmark-default-handler', `bookmark-exit-hook-internal', -;; `bookmark-get-bookmark', `bookmark-get-bookmark-record' (Emacs -;; 20-22), `bookmark-get-handler' (Emacs 20-22), -;; `bookmark-handle-bookmark', `bookmark-jump-noselect' (Emacs -;; 20-22), `bookmark-location', `bookmark-make-record', -;; `bookmark-make-record-default', -;; `bookmark-maybe-load-default-file', `bookmark-prop-get' (Emacs -;; 20-22), `bookmark-prop-set', `bookmark-show-annotation', -;; `bookmark-show-all-annotations', `bookmark-store' (Emacs 20-22), -;; `bookmark-write-file'. -;; -;; -;; ***** NOTE: The following variables defined in `bookmark.el' -;; have been REDEFINED HERE: -;; -;; `bookmark-alist' (doc string only), -;; `bookmark-make-record-function' (Emacs 20-22), -;; `bookmarks-already-loaded' (doc string only). -;; -;; -;; ***** NOTE: The following functions defined in `info.el' -;; have been REDEFINED HERE: -;; -;; `Info-bookmark-jump' (Emacs 20-22), `Info-bookmark-make-record' -;; (Emacs 20-22). -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -;;;;;;;;;;;;;;;;;;;;;;; - -(unless (fboundp 'file-remote-p) (require 'ffap)) ;; ffap-file-remote-p -(eval-when-compile (require 'gnus)) ;; mail-header-id (really in `nnheader.el') -(eval-when-compile (require 'gnus-sum)) ;; gnus-summary-article-header -(eval-when-compile (require 'cl)) ;; case, multiple-value-bind, typecase (plus, for Emacs 20: dolist) - -(require 'thingatpt+ nil t) ;; (no error if not found): -;; region-or-non-nil-symbol-name-nearest-point, symbol-nearest-point - -(require 'bookmark) -;; bookmark-alist, bookmark-alist-modification-count, bookmark-annotation-name, -;; bookmark-automatically-show-annotations, bookmark-bmenu-bookmark, -;; bookmark-bmenu-surreptitiously-rebuild-list, bookmark-buffer-file-name, bookmark-buffer-name, -;; bookmark-completion-ignore-case, bookmark-current-bookmark, bookmark-default-file, -;; bookmark-edit-annotation, bookmark-get-annotation, bookmark-get-bookmark-record, bookmark-get-filename, -;; bookmark-get-front-context-string, bookmark-get-handler, bookmark-get-position, -;; bookmark-get-rear-context-string, bookmark-import-new-list, bookmark-insert-file-format-version-stamp, -;; bookmark-kill-line, bookmark-make-record, bookmark-maybe-historicize-string, -;; bookmark-maybe-upgrade-file-format, bookmark-menu-popup-paned-menu, bookmark-name-from-full-record, -;; bookmark-name-from-record, bookmark-popup-menu-and-apply-function, bookmark-prop-get, bookmark-save-flag, -;; bookmark-search-size, bookmark-set-annotation, bookmark-set-filename, bookmark-set-position, -;; bookmark-time-to-save-p, bookmark-use-annotations, bookmark-version-control, bookmark-yank-point - - -;; Some general Renamings. -;; -;; 1. Fix incompatibility introduced by gratuitous Emacs name change. -;; -(cond ((and (fboundp 'bookmark-name-from-record) (not (fboundp 'bookmark-name-from-full-record))) - (defalias 'bookmark-name-from-full-record 'bookmark-name-from-record)) - ((and (fboundp 'bookmark-name-from-full-record) (not (fboundp 'bookmark-name-from-record))) - (defalias 'bookmark-name-from-record 'bookmark-name-from-full-record))) - -;; 2. The vanilla name of the first is misleading, as it returns only the cdr of the record. -;; The second is for consistency. -;; -(defalias 'bmkp-bookmark-data-from-record 'bookmark-get-bookmark-record) -(defalias 'bmkp-bookmark-name-from-record 'bookmark-name-from-full-record) - - -(require 'bookmark+-mac) -;; bmkp-define-cycle-command, bmkp-define-file-sort-predicate, bmkp-menu-bar-make-toggle, -;; bmkp-replace-regexp-in-string, bmkp-with-output-to-plain-temp-buffer - -(put 'bmkp-with-output-to-plain-temp-buffer 'common-lisp-indent-function '(4 &body)) - -(eval-when-compile (require 'bookmark+-bmu)) -;; bmkp-bmenu-before-hide-marked-alist, -;; bmkp-bmenu-before-hide-unmarked-alist, bmkp-bmenu-commands-file, -;; bmkp-bmenu-filter-function, bmkp-bmenu-filter-pattern, -;; bmkp-bmenu-first-time-p, bmkp-flagged-bookmarks, bmkp-bmenu-goto-bookmark-named, -;; bmkp-bmenu-marked-bookmarks, bmkp-bmenu-omitted-bookmarks, -;; bmkp-bmenu-refresh-menu-list, bmkp-bmenu-show-all, -;; bmkp-bmenu-state-file, bmkp-bmenu-title, -;; bmkp-maybe-unpropertize-bookmark-names, bmkp-sort-orders-alist, -;; bookmark-bmenu-toggle-filenames - - -;; (eval-when-compile (require 'bookmark+-lit nil t)) -;; bmkp-light-bookmark, bmkp-light-bookmarks, bmkp-light-this-buffer - - -;; For the redefinition of `bookmark-get-bookmark'. -(provide 'bookmark+-1) ; Ensure this library is loaded before we compile it. -(require 'bookmark+-1) ; So be sure to put this library in your `load-path' before - ; trying to byte-compile it. - -;;;;;;;;;;;;;;;;;;;;;;; - -;; Quiet the byte-compiler - -(defvar bmkp-auto-light-when-set) ; Defined in `bookmark+-lit.el'. -(defvar bmkp-auto-light-when-jump) ; Defined in `bookmark+-lit.el'. -(defvar bmkp-light-priorities) ; Defined in `bookmark+-lit.el'. -(defvar bmkp-temporary-bookmarking-mode) -(defvar bmkp-global-auto-idle-bookmark-mode) -(defvar bookmark-current-point) ; Defined in `bookmark.el', but not in Emacs 23+. -(defvar bookmark-edit-annotation-text-func) ; Defined in `bookmark.el'. -(defvar bookmark-read-annotation-text-func) ; Defined in `bookmark.el', but not in Emacs 23+. -(defvar bookmark-make-record-function) ; Defined in `bookmark.el'. -(defvar desktop-basefilename) ; Defined in `desktop.el' (Emacs < 22). -(defvar desktop-base-file-name) ; Defined in `desktop.el'. -(defvar desktop-buffer-args-list) ; Defined in `desktop.el'. -(defvar desktop-delay-hook) ; Defined in `desktop.el'. -(defvar desktop-dirname) ; Defined in `desktop.el'. -(defvar desktop-file-modtime) ; Defined in `desktop.el'. -(defvar desktop-globals-to-save) ; Defined in `desktop.el'. -(defvar desktop-save-mode) ; Defined in `desktop.el'. -(defvar desktop-save) ; Defined in `desktop.el'. -(defvar dired-actual-switches) ; Defined in `dired.el'. -(defvar dired-buffers) ; Defined in `dired.el'. -(defvar dired-directory) ; Defined in `dired.el'. -(defvar dired-guess-shell-case-fold-search) ; Defined in `dired-x.el'. -(defvar dired-subdir-alist) ; Defined in `dired.el'. -(defvar gnus-article-current) ; Defined in `gnus-sum.el'. -(defvar Info-current-node) ; Defined in `info.el'. -(defvar Info-current-file) ; Defined in `info.el'. -(defvar Man-arguments) ; Defined in `man.el'. -(defvar read-file-name-completion-ignore-case) ; Emacs 23+. -(defvar last-repeatable-command) ; Defined in `repeat.el'. -(defvar w3m-current-title) ; Defined in `w3m.el'. -(defvar w3m-current-url) ; Defined in `w3m.el'. -(defvar w3m-mode-map) ; Defined in `w3m.el'. -(defvar wide-n-restrictions) ; Defined in `wide-n.el'. -(defvar woman-last-file-name) ; Defined in `woman.el'. - -;;(@* "User Options (Customizable)") -;;; User Options (Customizable) -------------------------------------- - -;;;###autoload -(defcustom bmkp-auto-idle-bookmark-min-distance 1000 - "*Minimum number of chars between automatic bookmark positions." - :type '(choice - (const :tag "No minumum distance" nil) - (integer :tag "At least this many chars" :value 1000)) - :group 'bookmark-plus) - -;; Emacs 20 only. -;;;###autoload -(unless (fboundp 'define-minor-mode) - (defcustom bmkp-auto-idle-bookmark-mode nil - "*Non-nil means that bookmarks are created periodically automatically. -Setting this variable directly does not take effect; -use either \\[customize] or command `bmkp-auto-idle-bookmark-mode'." - :set (lambda (symbol value) (bmkp-auto-idle-bookmark-mode (if value 1 -1))) - :initialize 'custom-initialize-default - :type 'boolean :group 'bookmark-plus :require 'bookmark+)) - -;;;###autoload -(defcustom bmkp-auto-idle-bookmark-mode-delay 60 - "*Number of seconds delay before automatically setting a bookmark. -Such automatic bookmarking is controlled by -`bmkp-temporary-bookmarking-mode'." - :type 'integer :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-auto-idle-bookmark-mode-lighter " Auto-Bmk" - "*Lighter for `bmkp-auto-idle-bookmark-mode'. -This string shows in the mode line when `bmkp-auto-idle-bookmark-mode' -is enabled. Set this to nil or \"\" if you do not want any lighter." - :type 'string :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-auto-idle-bookmark-mode-set-function #'bmkp-set-autonamed-bookmark-at-line - "*Function used to set an automatic bookmark. -Used by `bmkp-temporary-bookmarking-mode'. -The default value, `bmkp-set-autonamed-bookmark-at-line', sets an -autonamed bookmark at the start of the current line. To bookmark the -current position, so you can have more than one automatic bookmark per -line, use `bmkp-set-autonamed-bookmark' instead." - :type 'function :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-autoname-bookmark-function 'bmkp-autoname-bookmark-function-default - "*Function to automatically name a bookmark at point (cursor position). -It should accept a buffer position as its (first) argument. -The name returned should match the application of -`bmkp-autoname-format' to the buffer name." - :type 'function :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-autoname-format (if (> emacs-major-version 21) "^[0-9]\\{9\\} %s" "^[0-9]+ %s") - "*Format string to match an autonamed bookmark name. -It must have a single `%s' to accept the buffer name." - :type 'string :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-autotemp-bookmark-predicates '(bmkp-autonamed-bookmark-p - bmkp-autonamed-this-buffer-bookmark-p) - "*Predicates for bookmarks to be set (created) as temporary bookmarks. -Each is typically a type predicate, but it can be any function that -accepts as its (first) argument a bookmark or bookmark name. -These are the predefined type predicates: - `bmkp-autofile-bookmark-p', `bmkp-autonamed-bookmark-for-buffer-p', - `bmkp-autonamed-bookmark-p', `bmkp-autonamed-this-buffer-bookmark-p', - `bmkp-bookmark-file-bookmark-p', `bmkp-bookmark-list-bookmark-p', - `bmkp-desktop-bookmark-p', `bmkp-dired-bookmark-p', - `bmkp-dired-this-dir-bookmark-p', `bmkp-file-bookmark-p', - `bmkp-file-remote-p', `bmkp-file-this-dir-bookmark-p', - `bmkp-function-bookmark-p', `bmkp-gnus-bookmark-p', - `bmkp-image-bookmark-p', `bmkp-info-bookmark-p', - `bmkp-last-specific-buffer-p', `bmkp-last-specific-file-p', - `bmkp-local-directory-bookmark-p', `bmkp-local-file-bookmark-p', - `bmkp-man-bookmark-p', `bmkp-non-file-bookmark-p', - `bmkp-region-bookmark-p', `bmkp-remote-file-bookmark-p', - `bmkp-sequence-bookmark-p', `bmkp-this-buffer-p', `bmkp-this-file-p', - `bmkp-url-bookmark-p', `bmkp-url-browse-bookmark-p', - `bmkp-variable-list-bookmark-p', `bmkp-w3m-bookmark-p'" - :type '(repeat symbol) :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-bookmark-name-length-max 70 - "*Max number of chars for default name for a bookmark with a region." - :type 'integer :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-count-multi-mods-as-one-flag t - "*Non-nil means count multiple modifications as one. - -This is for `bookmark-alist-modification-count'. Non-nil means that -when you invoke a command that acts on multiple bookmarks or acts in -multiple ways on one bookmark, all of changes together count as only -one moficication. That can prevent automatic saving of your bookmark -file during the sequence of modifications, so that when the command is -done you can choose not to save (i.e., to quit) if you like." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-crosshairs-flag (> emacs-major-version 21) - "*Non-nil means highlight with crosshairs when you visit a bookmark. -The highlighting is temporary - until your next action. -You need library `crosshairs.el' for this feature, and you need Emacs -22 or later. - -NOTE: Crosshairs highlighting is shown in the buffer that is current -after jumping. If the bookmarked jumped to does not really have an -associated buffer, for example a bookmark with a handler such as -`w32-browser' that just invokes a separate, non-Emacs program, then -the current buffer after jumping will be the buffer before jumping. - -If you use this option in Lisp code, you will want to add/remove -`bmkp-crosshairs-highlight' to/from `bookmark-after-jump-hook'." - :set (lambda (sym new-val) - (custom-set-default sym new-val) - (if (and bmkp-crosshairs-flag (> emacs-major-version 21) - (condition-case nil (require 'crosshairs nil t) (error nil))) - (add-hook 'bookmark-after-jump-hook 'bmkp-crosshairs-highlight) - (remove-hook 'bookmark-after-jump-hook 'bmkp-crosshairs-highlight))) - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-default-bookmark-name 'highlighted - "*Default bookmark name preference. -In `*Bookmark List*' use the name of the current line's bookmark. -Otherwise, if `bookmark+-lit.el' is not loaded then use the name of - the last-used bookmark in the current file. - -Otherwise, use this option to determine the default, by preferring one -of the following, if available: - -* a highlighted bookmark at point -* the last-used bookmark in the current file" - :type '(choice - (const :tag "Highlighted bookmark at point" highlighted) - (const :tag "Last used bookmark in same file" last-used)) - :group 'bookmark-plus) - - -;; We do not use `define-obsolete-variable-alias' so that byte-compilation in older Emacs -;; works for newer Emacs too. -(when (fboundp 'defvaralias) ; Emacs 22+ - (defvaralias 'bmkp-default-handler-associations 'bmkp-default-handlers-for-file-types) - (make-obsolete-variable 'bmkp-default-handler-associations 'bmkp-default-handlers-for-file-types - "2012-02-27")) - -;;;###autoload -(defcustom bmkp-default-handlers-for-file-types - (and (require 'dired-x) ; It in turn requires `dired-aux.el' - (eval-when-compile (when (< emacs-major-version 21) (require 'cl))) ;; `dolist', for Emacs 20 - (let ((assns ())) - (dolist (shell-assn dired-guess-shell-alist-user) - (push (cons (car shell-assn) - `(lambda (bmk) - (dired-run-shell-command - (dired-shell-stuff-it ,(cadr shell-assn) (list (bookmark-get-filename bmk)) - nil nil)))) - assns)) - assns)) - "*File associations for bookmark handlers used for indirect bookmarks. -Each element of the alist is (REGEXP . COMMAND). -REGEXP matches a file name. -COMMAND is a sexp that evaluates to either a shell command (a string) - or an Emacs function (a symbol or a lambda form). The shell command - or Lisp function must accept a file-name argument. - -Example value: - - ((\"\\\\.pdf$\" . \"AcroRd32.exe\") ; Adobe Acrobat Reader - (\"\\\\.ps$\" . \"gsview32.exe\") ; Ghostview (PostScript viewer) - (\"\\\\.html?$\" . browse-url) ; Use Lisp function `browse-url' - (\"\\\\.doc$\" . w32-browser)) ; Use Lisp function `w32-browser' - -When you change this option using Customize, if you want to use a -literal string as COMMAND then you must double-quote the text: -\"...\". (But do not use double-quotes for the REGEXP.) If you want -to use a symbol as COMMAND, just type the symbol name (no quotes). - -This option is used by `bmkp-default-handler-for-file' to determine -the default `file-handler' property for a given file bookmark. If a -given file name does not match this option, and if -`bmkp-guess-default-handler-for-file-flag' is non-nil, then -`bmkp-default-handler-for-file' tries to guess a shell command to use -in the default handler. For that it uses `dired-guess-default' and -\(Emacs 23+ only) mailcap entries, in that order." - :type '(alist :key-type - regexp :value-type - (sexp :tag "Shell command (string) or Emacs function (symbol or lambda form)")) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-desktop-no-save-vars '(search-ring regexp-search-ring kill-ring) - "*List of variables not to save when creating a desktop bookmark. -They are removed from `desktop-globals-to-save' for the duration of -the save (only)." - :type '(repeat (variable :tag "Variable")) :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-handle-region-function 'bmkp-handle-region-default - "*Function to handle a bookmarked region." - :type 'function :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-incremental-filter-delay (if (boundp 'bookmark-search-delay) - bookmark-search-delay - 0.2) - "*Seconds to wait before updating display when filtering bookmarks." - :type 'number :group 'bookmark-plus) - -;; Remove autoload cookie to avoid (void-variable bookmark-default-file) ;;;###autoload -(defcustom bmkp-last-as-first-bookmark-file bookmark-default-file - "*Whether to use the last-used bookmark file as the first used. -If nil then Emacs always uses the value of `bookmark-default-file' as -the initial bookmark file, in any given session. - -If non-nil, Emacs uses the last bookmark file you used, in the last -Emacs session. If none was recorded then it uses -`bookmark-default-file'. The particular non-nil value must be a an -absolute file name \(possibly containing `~') - it is not expanded). - -NOTE: A non-nil option value is overwritten by Bookmark+, so that it -becomes the last-used bookmark file. A nil value is never -overwritten." - :type '(choice - (const :tag "Use `bookmark-default-file' as initial bookmark file" nil) - (file :tag "Use last-used bookmark file as initial bookmark file" - :value "~/.emacs.bmk")) - :group 'bookmark) - -;;;###autoload -(defcustom bmkp-menu-popup-max-length 20 - "*Max number of bookmarks for `bookmark-completing-read' to use a menu. -When choosing a bookmark from a list of bookmarks using -`bookmark-completing-read', this controls whether to use a menu or -minibuffer input with completion. -If t, then always use a menu. -If nil, then never use a menu. -If an integer, then use a menu only if there are fewer bookmark - choices than the value." - :type '(choice - (integer :tag "Use a menu if there are fewer bookmark choices than this" 20) - (const :tag "Always use a menu to choose a bookmark" t) - (const :tag "Never use a menu to choose a bookmark" nil)) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-new-bookmark-default-names - (let ((fns '((lambda () (let ((ff (function-called-at-point))) - (and ff (symbolp ff) (symbol-name ff))))))) - (when (fboundp 'region-or-non-nil-symbol-name-nearest-point) ; Defined in `thingatpt+.el'. - (push 'region-or-non-nil-symbol-name-nearest-point fns))) - "Functions to produce the default name for a new bookmark. -\(The default name for an *existing* bookmark is obtained using -`bmkp-default-bookmark-name'.) - -The option value is a list of functions that do not require an -argument and return a string (or nil). They are invoked in order to -produce the default names. - -The following names are also provided, after the names described -above: The value of variable `bookmark-current-bookmark' and the -return value of function `bookmark-buffer-name', in that order. - -These latter names are the defaults provided by vanilla Emacs -`bookmark.el', so if you want the vanilla behavior then set the option -value to nil. - -For non-interactive use of a default bookmark name, and for Emacs -prior to Emacs 23 even for interactive use, only the first default -name is used. - -Some functions you might want to use in the option value: - - * `region-or-non-nil-symbol-name-nearest-point' - * (lambda () (let ((ff (function-called-at-point))) - (and (symbolp ff) (symbol-name ff)))) - * (lambda () (let ((vv (variable-at-point))) ; `variable-at-point' - (and (symbolp vv) (symbol-name vv)))) ; returns 0 if no var - * `word-at-point' - * (lambda () (let ((ss (symbol-at-point))) - (and ss (symbol-name ss)))) - -The first of these is defined in library `thingatpt+.el'. It returns -the text in the region, if it is active and not empty. Otherwise it -returns the name of the (non-`nil') symbol nearest point, within -maximum search distances `near-point-x-distance' (left and right) and -`near-point-y-distance' (up and down)." - :type '(repeat function) :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-other-window-pop-to-flag t - "*Non-nil means other-window bookmark jumping uses `pop-to-buffer'. -Use nil if you want the vanilla Emacs behavior, which uses -`switch-to-buffer-other-window'. That creates a new window even if -there is already another window showing the buffer." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-prompt-for-tags-flag nil - "*Non-nil means `bookmark-set' prompts for tags (when called interactively)." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-region-search-size 40 - "*Same as `bookmark-search-size', but specialized for bookmark regions." - :type 'integer :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-save-new-location-flag t - "*Non-nil means save automatically relocated bookmarks. -If nil, then the new bookmark location is visited, but it is not saved -as part of the bookmark definition." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-sequence-jump-display-function 'pop-to-buffer - "*Function used to display the bookmarks in a bookmark sequence." - :type 'function :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-show-end-of-region t - "*Show end of region with `exchange-point-and-mark' when activating a region. -If nil show only beginning of region." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-sort-comparer '((bmkp-info-cp bmkp-gnus-cp bmkp-url-cp bmkp-local-file-type-cp) - bmkp-alpha-p) ; This corresponds to `s k'. - ;; $$$$$$ An alternative default value: `bmkp-alpha-p', which corresponds to `s n'. - "*Predicate or predicates for sorting (comparing) bookmarks. -This defines the default sort for bookmarks in the bookmark list. - -Various sorting commands, such as \\\ -`\\[bmkp-bmenu-sort-by-bookmark-visit-frequency]', change the value of this -option dynamically (but they do not save the changed value). - -The value must be one of the following: - -* nil, meaning do not sort - -* a predicate that takes two bookmarks as args - -* a list of the form ((PRED...) FINAL-PRED), where each PRED and - FINAL-PRED are predicates that take two bookmarks as args - -If the value is a list of predicates, then each PRED is tried in turn -until one returns a non-nil value. In that case, the result is the -car of that value. If no non-nil value is returned by any PRED, then -FINAL-PRED is used and its value is the result. - -Each PRED should return `(t)' for true, `(nil)' for false, or nil for -undecided. A nil value means that the next PRED decides (or -FINAL-PRED, if there is no next PRED). - -Thus, a PRED is a special kind of predicate that indicates either a -boolean value (as a singleton list) or \"I cannot decide - let the -next guy else decide\". (Essentially, each PRED is a hook function -that is run using `run-hook-with-args-until-success'.) - -Examples: - - nil - No sorting. - - string-lessp - Single predicate that returns nil or non-nil. - - ((p1 p2)) - Two predicates `p1' and `p2', which each return - (t) for true, (nil) for false, or nil for undecided. - - ((p1 p2) string-lessp) - - Same as previous, except if both `p1' and `p2' return - nil, then the return value of `string-lessp' is used. - -Note that these two values are generally equivalent, in terms of their -effect (*): - - ((p1 p2)) - ((p1) p2-plain) where p2-plain is (bmkp-make-plain-predicate p2) - -Likewise, these three values generally act equivalently (*): - - ((p1)) - (() p1-plain) - p1-plain where p1-plain is (bmkp-make-plain-predicate p1) - -The PRED form lets you easily combine predicates: use `p1' unless it -cannot decide, in which case try `p2', and so on. The value ((p2 p1)) -tries the predicates in the opposite order: first `p2', then `p1' if -`p2' returns nil. - -Using a single predicate or FINAL-PRED makes it easy to reuse an -existing predicate that returns nil or non-nil. - -You can also convert a PRED-type predicate (which returns (t), (nil), -or nil) into an ordinary predicate, by using function -`bmkp-make-plain-predicate'. That lets you reuse elsewhere, as -ordinary predicates, any PRED-type predicates you define. - -For example, this defines a plain predicate to compare by URL: - (defalias 'bmkp-url-p (bmkp-make-plain-predicate 'bmkp-url-cp)) - -Note: As a convention, predefined Bookmark+ PRED-type predicate names -have the suffix `-cp' (for \"component predicate\") instead of `-p'. - --- -* If you use `\\[bmkp-reverse-multi-sort-order]', then there is a difference in \ -behavior between - - (a) using a plain predicate as FINAL-PRED and - (b) using the analogous PRED-type predicate (and no FINAL-PRED). - - In the latter case, `\\[bmkp-reverse-multi-sort-order]' affects when the predicate \ -is tried and - its return value. See `bmkp-reverse-multi-sort-order'." - :type '(choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate")))) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-su-or-sudo-regexp "\\(/su:\\|/sudo:\\)" - "*Regexp to recognize `su' or `sudo' Tramp bookmarks." - :type 'regexp :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-tags-for-completion 'current - "*List of strings used as tags for completion (not an alist). -The tags can be specified here individually or taken from (a) the -current bookmark list or (b) one or more bookmark files or both. - -\(In Emacs 20 and 21, you cannot choose (b) when customizing, but if -\(b) was chosen using a later Emacs version then the option value can -still be used in Emacs 20 and 21.) - -If a relative file name is specified for a bookmark file then the -current value of `default-directory' is used to find the file." - :type (if (> emacs-major-version 21) - '(choice - (const :tag "From current bookmarks only" current) - (list :tag "From current bookmarks and other sources" - (const :tag "" current) - (repeat :inline t :tag "Additional sources or specific tags" - (choice - (string :tag "Specific tag") - (cons :tag "All tags from a bookmark file" - (const :tag "" bmkfile) (file :must-match t))))) - (repeat :tag "Choose sources or specific tags" - (choice - (string :tag "Specific tag") - (cons :tag "All tags from a bookmark file" - (const :tag "" bmkfile) (file :must-match t))))) - ;; A bug in Emacs 20-21 means we must sacrifice the user choice of current plus other sources. - '(choice - (const :tag "From current bookmarks only" current) - (repeat :tag "Choose sources or specific tags" ; A 2nd Emacs 20-21 bug ignores `:tag' for menu. - (choice - (string :tag "Specific tag") - (cons :tag "All tags from a bookmark file" - (const :tag "" bmkfile) (file :must-match t)))))) - :group 'bookmark-plus) - -;; Emacs 20 only. -(unless (fboundp 'define-minor-mode) - (defcustom bmkp-temporary-bookmarking-mode nil - "*Non-nil means that bookmarks are temporary (not recorded on disk). -Setting this variable directly does not take effect; -use either \\[customize] or command `bmkp-temporary-bookmarking-mode'." - :set (lambda (symbol value) (bmkp-temporary-bookmarking-mode (if value 1 -1))) - :initialize 'custom-initialize-default - :type 'boolean :group 'bookmark-plus :require 'bookmark+)) - -;;;###autoload -(defcustom bmkp-temporary-bookmarking-mode-hook () - "*Functions run after entering and exiting temporary-bookmarking mode." - :type 'hook :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-this-file/buffer-cycle-sort-comparer '((bmkp-position-cp)) - "*`bmkp-sort-comparer' value for cycling this-file/buffer bookmarks. -Use bookmarks for the currently visited file or (non-file) buffer. -Some values you might want to use: ((bmkp-position-cp)), - ((bmkp-bookmark-creation-cp)), ((bmkp-visited-more-cp)). -See `bmkp-sort-comparer'." - :type '(choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate")))) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-guess-default-handler-for-file-flag nil - "*Non-nil means guess the default handler when creating a file bookmark. -This is ignored if a handler can be found using option -`bmkp-default-handlers-for-file-types'. Otherwise, this is used by -function `bmkp-default-handler-for-file' to determine the default -handler for a given file." - :type 'boolean :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-temporary-bookmarking-mode-lighter " Temp-Bmk" - "*Lighter for `bmkp-temporary-bookmarking-mode'. -This string shows in the mode line when `bmkp-temporary-bookmarking-mode' -is enabled. Set this to nil or \"\" if you do not want any lighter." - :type 'string :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-use-region t - "*Non-nil means visiting a bookmark activates its recorded region." - :type '(choice - (const :tag "Activate bookmark region (except during cycling)" t) - (const :tag "Do not activate bookmark region" nil) - (const :tag "Activate bookmark region even during cycling" cycling-too)) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-w3m-allow-multi-tabs t - "*Non-nil means jump to W3M bookmarks in a new session." - :type 'boolean :group 'bookmark-plus) - -;;(@* "Internal Variables") -;;; Internal Variables ----------------------------------------------- - -(defconst bmkp-non-file-filename " - no file -" - "Name to use for `filename' entry, for non-file bookmarks.") - -(defconst bmkp-types-alist '(("autofile" . bmkp-autofile-history) - ("autonamed" . bmkp-autonamed-history) - ("bookmark-file" . bmkp-bookmark-file-history) - ("bookmark-list" . bmkp-bookmark-list-history) - ("desktop" . bmkp-desktop-history) - ("dired" . bmkp-dired-history) - ("dired-this-dir" . bmkp-dired-history) - ("file" . bmkp-file-history) - ("file-this-dir" . bmkp-file-history) - ("gnus" . bmkp-gnus-history) - ("image" . bmkp-image-history) - ("info" . bmkp-info-history) - ("local-file" . bmkp-local-file-history) - ("man" . bmkp-man-history) - ("non-file" . bmkp-non-file-history) - ("region" . bmkp-region-history) - ("remote-file" . bmkp-remote-file-history) - ("specific-buffers" . bmkp-specific-buffers-history) - ("specific-files" . bmkp-specific-files-history) - ("temporary" . bmkp-temporary-history) - ("url" . bmkp-url-history) - ("variable-list" . bmkp-variable-list-history)) - "Alist of bookmark types used by `bmkp-jump-to-type'. -Keys are bookmark type names. Values are corresponding history variables.") - -(defvar bmkp-autofile-history () "History for autofile bookmarks.") -(defvar bmkp-autonamed-history () "History for autonamed bookmarks.") -(defvar bmkp-bookmark-file-history () "History for bookmark-file bookmarks.") -(defvar bmkp-bookmark-list-history () "History for bookmark-list bookmarks.") -(defvar bmkp-desktop-history () "History for desktop bookmarks.") -(defvar bmkp-dired-history () "History for Dired bookmarks.") -(defvar bmkp-file-history () "History for file bookmarks.") -(defvar bmkp-gnus-history () "History for Gnus bookmarks.") -(defvar bmkp-image-history () "History for image-file bookmarks.") -(defvar bmkp-info-history () "History for Info bookmarks.") -(defvar bmkp-last-bmenu-state-file nil "Last value of option `bmkp-bmenu-state-file'.") -(defvar bmkp-local-file-history () "History for local-file bookmarks.") -(defvar bmkp-man-history () "History for `man'-page bookmarks.") -(defvar bmkp-non-file-history () "History for buffer (non-file) bookmarks.") -(defvar bmkp-region-history () "History for bookmarks that activate the region.") -(defvar bmkp-remote-file-history () "History for remote-file bookmarks.") -(defvar bmkp-specific-buffers-history () "History for specific-buffers bookmarks.") -(defvar bmkp-specific-files-history () "History for specific-files bookmarks.") -(defvar bmkp-temporary-history () "History for temporary bookmarks.") -(defvar bmkp-url-history () "History for URL bookmarks.") -(defvar bmkp-variable-list-history () "History for variable-list bookmarks.") -(defvar bmkp-w3m-history () "History for W3M bookmarks.") - -(defvar bmkp-after-set-hook nil "Hook run after `bookmark-set' sets a bookmark.") - -(defvar bmkp-auto-idle-bookmarks () - "Alist of bookmarks that were created automatically during this session.") - -(defvar bmkp-auto-idle-bookmark-mode-timer nil - "Timer for `bmkp-auto-idle-bookmark-mode'. -This variable is buffer-local, which means that there is a separate -timer for each buffer where automatic bookmarking is enabled. - -NOTE: For Emacs 20, the variable is not buffer-local, by default. To -make it so, do this: - - (make-variable-buffer-local 'bmkp-auto-idle-bookmark-mode-timer)") - -(unless (< emacs-major-version 21) (make-variable-buffer-local 'bmkp-auto-idle-bookmark-mode-timer)) - - -(defvar bmkp-autotemp-all-when-set-p nil "Non-nil means make any bookmark temporary whenever it is set.") - -;;; $$$$$$ No - don't bother. -;;; (defconst bmkp-bookmark-modifier-functions '(bookmark-prop-set bmkp-replace-existing-bookmark -;;; bookmark-set-name bookmark-store) -;;; "List of functions that modify bookmarks. -;;; Used to mark modified, unsaved bookmarks, in `*Bookmark List*'. -;;; Should not include any function that calls another in the list.") - -(defvar bmkp-copied-tags () - "List of tags copied from a bookmark, for pasting to other bookmarks.") - -(defvar bmkp-current-bookmark-file bookmark-default-file - "Current bookmark file. -When you start Emacs, this is initialized according to -`bmkp-last-as-first-bookmark-file'. - -When you load bookmarks using `\\[bmkp-switch-bookmark-file-create]', this is set to the file you -load. When you save bookmarks using `bookmark-save' with no prefix -arg, they are saved to this file. - -Loading a bookmark file does not change the value of -`bookmark-default-file', but it might change the value of -`bmkp-last-as-first-bookmark-file' (which see). The value of -`bookmark-default-file' is never changed, except by your -customizations.") - -(defvar bmkp-edit-bookmark-orig-record nil - "Record of bookmark being edited.") - -(defvar bmkp-file-bookmark-handlers '(bmkp-jump-dired image-bookmark-jump) - "List of functions that handle file or directory bookmarks. -This is used to determine `bmkp-file-bookmark-p'.") - -(defvar bmkp-last-bookmark-file bookmark-default-file - "Last bookmark file used in this session (or default bookmark file). -This is a backup for `bmkp-current-bookmark-file'.") - -(defvar bmkp-current-nav-bookmark nil "Current bookmark for navigation.") - -(defvar bmkp-jump-display-function nil "Function used currently to display a bookmark.") - -(defvar bmkp-last-specific-buffer "" - "Name of buffer used by `bmkp-last-specific-buffer-p'.") - -(defvar bmkp-last-specific-file "" - "(Absolute) file name used by `bmkp-last-specific-file-p'.") - -(defvar bmkp-modified-bookmarks () - "Alist of bookmarks that have been modified and not saved.") - -(defvar bmkp-nav-alist () "Current bookmark alist used for navigation.") - -(defvar bmkp-return-buffer nil "Name of buffer to return to.") - -(defvar bmkp-reverse-sort-p nil "Non-nil means the sort direction is reversed.") - -(defvar bmkp-reverse-multi-sort-p nil - "Non-nil means the truth values returned by predicates are complemented. -This changes the order of the sorting groups, but it does not in -general reverse that order. The order within each group is unchanged -\(not reversed).") - -(defvar bmkp-use-w32-browser-p nil - "Non-nil means use `w32-browser' in the default bookmark handler. -That is, use the default Windows application for the bookmarked file. -This has no effect if function `w32-browser' is not defined.") - -(defvar bmkp-latest-bookmark-alist () "Copy of `bookmark-alist' as last filtered.") - -(defvar bmkp-last-save-flag-value nil "Last value of option `bookmark-save-flag'.") - -(defvar bmkp-sorted-alist () - "Copy of current bookmark alist, as sorted for buffer `*Bookmark List*'. -Has the same structure as `bookmark-alist'.") - -(defvar bmkp-tag-history () "History of tags read from the user.") - -(defvar bmkp-tags-alist () - "Alist of all bookmark tags, per option `bmkp-tags-for-completion'. -Each entry is a full tag: a cons whose car is a tag name, a string. -This is set by function `bmkp-tags-list'. -Use that function to update the value.") - - -;; REPLACES ORIGINAL DOC STRING in `bookmark.el'. -;; -;; Doc string does not say that the file that was loaded is `bookmark-default-file'. -;; -(defvar bookmarks-already-loaded nil - "Non-nil means some bookmarks have been loaded during this Emacs session.") - - -;; REPLACES ORIGINAL DOC STRING in `bookmark.el'. -;; -;; Doc string reflects `Bookmark+' enhancements. -;; -(put 'bookmark-alist 'variable-documentation - "Association list of bookmarks and their records. -Bookmark functions update the value automatically. -You probably do not want to change the value yourself. - -The value is an alist with entries of the form - (BOOKMARK-NAME . PARAM-ALIST) -or the deprecated form (BOOKMARK-NAME PARAM-ALIST). - - BOOKMARK-NAME is the name you gave to the bookmark when creating it. - PARAM-ALIST is an alist of bookmark information. The order of the - entries in PARAM-ALIST is not important. The possible entries are - described below. An entry with a key but null value means the entry - is not used. - -Bookmarks created using vanilla Emacs (`bookmark.el'): - - (filename . FILENAME) - (location . LOCATION) - (position . POS) - (front-context-string . STR-AFTER-POS) - (rear-context-string . STR-BEFORE-POS) - (handler . HANDLER) - (annotation . ANNOTATION) - - FILENAME names the bookmarked file. - LOCATION names the bookmarked file, URL, or other place (Emacs 23+). - FILENAME or LOCATION is what is shown in the bookmark list - (`C-x r l') when you use `M-t'. - POS is the bookmarked buffer position (position in the file). - STR-AFTER-POS is buffer text that immediately follows POS. - STR-BEFORE-POS is buffer text that immediately precedes POS. - ANNOTATION is a string that you can provide to identify the bookmark. - See options `bookmark-use-annotations' and - `bookmark-automatically-show-annotations'. - HANDLER is a function that provides the bookmark-jump behavior - for a specific kind of bookmark. This is the case for Info - bookmarks, for instance (starting with Emacs 23). - -Bookmarks created using Bookmark+ are the same as for vanilla Emacs, -except for the following differences. - -1. Visit information is recorded, using entries `visits' and `time': - - (visits . NUMBER-OF-VISITS) - (time . TIME-LAST-VISITED) - - NUMBER-OF-VISITS is a whole-number counter. - - TIME-LAST-VISITED is an Emacs time representation, such as is - returned by function `current-time'. - -2. The buffer name is recorded, using entry `buffer-name'. It need -not be associated with a file. - -3. If no file is associated with the bookmark, then FILENAME is - ` - no file -'. - -4. Bookmarks can be tagged by users. The tag information is recorded -using entry `tags': - - (tags . TAGS-ALIST) - - TAGS-ALIST is an alist with string keys. - -5. A bookmark can be simply a wrapper for a file, in which case it has -entry `file-handler' instead of `handler'. When you \"jump\" to such -a bookmark, the `file-handler' function or shell-command is applied to -the `filename' entry. Any `handler' entry present is ignored, as are -entries such as `position'. It is only the target file that is -important. - -6. Bookmarks can have individual highlighting, provided by users. -This overrides any default highlighting. - - (lighting . HIGHLIGHTING) - - HIGHLIGHTING is a property list that contain any of these keyword - pairs: - - `:style' - Highlighting style. Cdrs of `bmkp-light-styles-alist' - entries are the possible values. - `:face' - Highlighting face, a symbol. - `:when' - A sexp to be evaluated. Return value of `:no-light' - means do not highlight. - -7. The following additional entries are used to record region -information. When a region is bookmarked, POS represents the region -start position. - - (end-position . END-POS) - (front-context-region-string . STR-BEFORE-END-POS) - (rear-context-region-string . STR-AFTER-END-POS)) - - END-POS is the region end position. - STR-BEFORE-END-POS is buffer text that precedes END-POS. - STR-AFTER-END-POS is buffer text that follows END-POS. - -The two context region strings are non-nil only when a region is -bookmarked. - - NOTE: The relative locations of `front-context-region-string' and - `rear-context-region-string' are reversed from those of - `front-context-string' and `rear-context-string'. For example, - `front-context-string' is the text that *follows* `position', but - `front-context-region-string' *precedes* `end-position'. - -8. The following additional entries are used for a Dired bookmark. - - (dired-marked . MARKED-FILES) - (dired-switches . SWITCHES) - - MARKED-FILES is the list of files that were marked. - SWITCHES is the string of `dired-listing-switches'. - -9. The following additional entries are used for a Gnus bookmark. - - (group . GNUS-GROUP-NAME) - (article . GNUS-ARTICLE-NUMBER) - (message-id . GNUS-MESSAGE-ID) - - GNUS-GROUP-NAME is the name of a Gnus group. - GNUS-ARTICLE-NUMBER is the number of a Gnus article. - GNUS-MESSAGE-ID is the identifier of a Gnus message. - -10. For a URL bookmark, FILENAME or LOCATION is a URL. - -11. A sequence bookmark has this additional entry: - - (sequence . COMPONENT-BOOKMARKS) - - COMPONENT-BOOKMARKS is the list of component bookmark names. - -12. A function bookmark has this additional entry, which records the -FUNCTION: - - (function . FUNCTION) - -13. A bookmark-list bookmark has this additional entry, which records -the state of buffer `*Bookmark List*' at the time it is created: - - (bookmark-list . STATE) - - STATE records the sort order, filter function, omit list, and title.") - -;;(@* "Compatibility Code for Older Emacs Versions") -;;; Compatibility Code for Older Emacs Versions ---------------------- - -(when (< emacs-major-version 23) - - ;; These definitions are for Emacs versions prior to Emacs 23. - ;; They are the same as the vanilla Emacs 23+ definitions, except as noted. - ;; They let older versions of Emacs handle bookmarks created with Emacs 23. - ;; (Emacs < 23 also needs a compatible `bookmark-make-record' version, - ;; but I redefine it for all versions, in any case.) - - (defun Info-bookmark-make-record () - "Create an Info bookmark record." - `(,Info-current-node - ,@(bookmark-make-record-default 'no-file) - (filename . ,Info-current-file) - (info-node . ,Info-current-node) - (handler . Info-bookmark-jump))) - - ;; Requires `info.el' explicitly (not autoloaded for `Info-find-node'. - (defun Info-bookmark-jump (bookmark) - "Jump to Info bookmark BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (require 'info) - ;; Implements the `handler' for the record type returned by `Info-bookmark-make-record'. - (let* ((file (bookmark-prop-get bookmark 'filename)) - (info-node (bookmark-prop-get bookmark 'info-node)) - (buf (save-window-excursion ; VANILLA EMACS FIXME: doesn't work with frames! - (Info-find-node file info-node) (current-buffer)))) - ;; Use `bookmark-default-handler' to move to appropriate location within Info node. - (bookmark-default-handler - `("" (buffer . ,buf) . ,(bmkp-bookmark-data-from-record bookmark))))) - - (add-hook 'Info-mode-hook (lambda () (set (make-local-variable 'bookmark-make-record-function) - 'Info-bookmark-make-record))) - - (defvar bookmark-make-record-function 'bookmark-make-record-default - "Function called with no arguments, to create a bookmark record. -It should return the new record, which should be a cons cell of the -form (NAME . ALIST) or just ALIST, where ALIST is as described in -`bookmark-alist'. If it cannot construct the record, then it should -raise an error. - -NAME is a string that names the new bookmark. NAME can be nil, in -which case a default name is used. - -ALIST can contain an entry (handler . FUNCTION) which sets the handler -to FUNCTION, which is then used instead of `bookmark-default-handler'. -FUNCTION must accept the same arguments as `bookmark-default-handler'. - -You can set this variable buffer-locally to enable bookmarking of -locations that should be treated specially, such as Info nodes, news -posts, images, pdf documents, etc.") - - (defun bookmark-prop-get (bookmark prop) - "Return property PROP of BOOKMARK, or nil if no such property. -BOOKMARK is a bookmark name or a bookmark record." - (cdr (assq prop (bmkp-bookmark-data-from-record bookmark)))) - - (defun bookmark-get-handler (bookmark) - "Return the `handler' entry for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bookmark-prop-get bookmark 'handler)) - - (defun bookmark-jump-noselect (bookmark) - "Return the location recorded for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -The return value has the form (BUFFER . POINT), where BUFFER is a -buffer and POINT is the location within BUFFER." - (save-excursion (bookmark-handle-bookmark bookmark) (cons (current-buffer) (point))))) - -(when (< emacs-major-version 22) - - ;; These definitions are for Emacs versions prior to Emacs 22. - ;; They are the same as the vanilla Emacs 22+ definitions, except as noted. - -;;; ;; Bookmark+ doesn't use this, but `bookmark.el' still does. Who has a slow `baud-rate' now? -;;; (defun bookmark-maybe-message (fmt &rest args) -;;; "Apply `message' to FMT and ARGS, but only if the display is fast enough." -;;; (when (>= baud-rate 9600) (apply 'message fmt args))) - - ;; Emacs 22+ just uses `bookmark-jump-other-window' for the menu also. - (defun bmkp-menu-jump-other-window (event) - "Jump to BOOKMARK (a point in some file) in another window. -See `bookmark-jump-other-window'." - (interactive "e") - (bookmark-popup-menu-and-apply-function 'bookmark-jump-other-window - "Jump to Bookmark (Other Window)" event))) - -;;(@* "Core Replacements (`bookmark-*' except `bookmark-bmenu-*')") -;;; Core Replacements (`bookmark-*' except `bookmark-bmenu-*') ------- - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Doc string does not mention `bookmark-alist': does NOT test whether BOOKMARK is in `bookmark-alist'. -;; -(defun bookmark-get-bookmark-record (bookmark) - "Return the data part of BOOKMARK, that is, all but the name. -BOOKMARK is a bookmark name or a bookmark record. -If it is a bookmark name then it is looked up in `bookmark-alist'. -If it is a record then it is NOT looked up (need not belong)." - (let ((data (cdr (bookmark-get-bookmark bookmark)))) - ;; A bookmark record is either (NAME ALIST) or (NAME . ALIST). - (if (and (null (cdr data)) (consp (caar data))) - (car data) - data))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. If BOOKMARK is a bookmark-name string that has non-nil property `bmkp-full-record' -;; then look up the bookmark that is the value of that property in `bookmark-alist', and -;; if found return it. -;; 2. Handle the should-not-happen case of non-string, non-cons. -;; 3. Document NOERROR in doc string. -;; -(defun bookmark-get-bookmark (bookmark &optional noerror) - "Return the full bookmark (record) that corresponds to BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -Non-nil optional arg NOERROR means return nil if BOOKMARK is not a -valid bookmark. If NOERROR is nil then raise an error in this case. - -If BOOKMARK is a bookmark name instead of a full bookmark then return -what `bmkp-bookmark-record-from-name' (with no MEMP check) returns. - -This function is like `bmkp-get-bookmark-in-alist', except that -`bmkp-get-bookmark-in-alist' always tests whether BOOKMARK is in -`bookmark-alist', whether BOOKMARK is a string (a bookmark name) or a -full bookmark. `bmkp-get-bookmark-in-alist' is thus a real test for -bookmark existence. Use `bookmark-get-bookmark' only when you do NOT -want to look up the bookmark in `bookmark-alist'." - (cond ((consp bookmark) bookmark) ; No test of alist membership. - ((stringp bookmark) (bmkp-bookmark-record-from-name bookmark noerror)) ; No MEMP check. - (t (and (not noerror) (error "Invalid bookmark: `%s'" bookmark))))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Use option `bmkp-new-bookmark-default-names' to obtain the default name. -;; -(defun bookmark-make-record () - "Return a new bookmark record (NAME . ALIST) for the current location. -Start with `bookmark-make-record-function'. If it does not provide a -bookmark name, then use option `bmkp-new-bookmark-default-names' to -provide it. If that does not provide it then use -`bookmark-current-bookmark' or `bookmark-buffer-name', in that order." - (let ((record (funcall bookmark-make-record-function)) - defname) - (if (stringp (car record)) - record - (when (car record) (push nil record)) - (setq defname (catch 'bookmark-make-record - (dolist (fn bmkp-new-bookmark-default-names) - (when (functionp fn) ; Be sure it is defined and is a function. - (let ((val (funcall fn))) - (when (and (stringp val) (not (string= "" val))) - (throw 'bookmark-make-record val))))) - (or bookmark-current-bookmark (bookmark-buffer-name)))) - (when (and defname (not (stringp defname))) (setq defname (format "%s" defname))) ; Just in case. - (setcar record defname) - record))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Update the bookmark name also, not just the data, for an existing bookmark. -;; 2. Use `bmkp-get-bookmark-in-alist' to test whether the bookmark already exists. -;; 3. Put full bookmark record on bookmark name (inside record) as property `bmkp-full-record'. -;; 4. Use `bmkp-maybe-save-bookmarks'. -;; 5. Add the bookmark to `bmkp-modified-bookmarks', and to `bmkp-auto-idle-bookmarks' if appropriate. -;; 6. Return the bookmark. -;; -(defun bookmark-store (bookmark-name data no-overwrite &optional no-msg-p) - "Store the bookmark named BOOKMARK-NAME, giving it DATA. -Return the new bookmark. - -DATA is the bookmark record without its name, i.e., what -`bmkp-bookmark-data-from-record' returns. - -If NO-OVERWRITE is non-nil and bookmark BOOKMARK-NAME already exists -in the current bookmark list (`bookmark-alist') then record the new -bookmark but do not discard the old one. - -The check for existence uses `bmkp-get-bookmark-in-alist'. - -Note: In spite of the function name, like all functions that define or -change bookmarks, this function does not necessarily save your -bookmark file. Saving the file depends on `bookmark-save-flag'. - -Non-nil optional arg NO-MSG-P means do not show progress messages." - (bookmark-maybe-load-default-file) - (let ((bname (copy-sequence bookmark-name)) - bmk) - (unless (featurep 'xemacs) - ;; XEmacs's `set-text-properties' does not work on free-standing strings, apparently. - (set-text-properties 0 (length bname) () bname)) - (if (or no-overwrite (not (setq bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)))) - (push (setq bmk (cons bname data)) bookmark-alist) ; Add new bookmark. - (bookmark-set-name bmk bname) ; Overwrite existing bookmark. - (setcdr bmk data)) - ;; Put the full bookmark on its name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (put-text-property 0 (length bname) 'bmkp-full-record bmk bname) - (bmkp-maybe-save-bookmarks) - ;; These two are the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bmk bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons bmk bmkp-modified-bookmarks))) - (when (and (boundp 'bmkp-setting-auto-idle-bmk-p) - (not (memq bmk bmkp-auto-idle-bookmarks))) - (setq bmkp-auto-idle-bookmarks (cons bmk bmkp-auto-idle-bookmarks))) - (setq bookmark-current-bookmark bname) - (bmkp-refresh/rebuild-menu-list bmk no-msg-p) - bmk)) ; Return the bookmark. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; BUG fix: Need bookmark arg in `interactive' spec. -;; -;;;###autoload -(defun bookmark-edit-annotation-mode (bookmark) - "Mode for editing the annotation of bookmark BOOKMARK. -When you have finished composing, type \\[bookmark-send-annotation]. -BOOKMARK is a bookmark name or a bookmark record. - -\\{bookmark-edit-annotation-mode-map}" - (interactive (list (bookmark-completing-read "Edit annotation of bookmark" - (bmkp-default-bookmark-name) - (bmkp-annotated-alist-only)))) - (kill-all-local-variables) - (make-local-variable 'bookmark-annotation-name) - (setq bookmark-annotation-name bookmark) - (use-local-map bookmark-edit-annotation-mode-map) - (setq major-mode 'bookmark-edit-annotation-mode - mode-name "Edit Bookmark Annotation") - (insert (funcall (if (boundp 'bookmark-edit-annotation-text-func) - bookmark-edit-annotation-text-func - bookmark-read-annotation-text-func) - bookmark)) - (let ((annotation (bookmark-get-annotation bookmark))) - (if (and annotation (not (string-equal annotation ""))) - (insert annotation))) - (if (fboundp 'run-mode-hooks) - (run-mode-hooks 'text-mode-hook) - (run-hooks 'text-mode-hook))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. BUG fix: Put point back where it was (on the bookmark just annotated). -;; 2. Refresh menu list, to pick up the `a' marker. -;; 3. Make sure it's the annotation buffer that gets killed. -;; 4. Delete window also, if `misc-cmds.el' loaded. -;; -;;;###autoload -(defun bookmark-send-edited-annotation () - "Use buffer contents as annotation for a bookmark. -Lines beginning with `#' are ignored." - (interactive) - (unless (eq major-mode 'bookmark-edit-annotation-mode) - (error "Not in bookmark-edit-annotation-mode")) - (goto-char (point-min)) - (while (< (point) (point-max)) - (if (looking-at "^#") - (bookmark-kill-line t) - (forward-line 1))) - (let ((annotation (buffer-substring-no-properties (point-min) (point-max))) - (bookmark bookmark-annotation-name) - (annotation-buf (current-buffer))) - (bookmark-set-annotation bookmark annotation) - (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count)) - (bmkp-refresh/rebuild-menu-list bookmark) ; So display `a' and `*' markers (updated). - (if (fboundp 'kill-buffer-and-its-windows) - (kill-buffer-and-its-windows annotation-buf) ; Defined in `misc-cmds.el'. - (kill-buffer annotation-buf)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Added `interactive' spec. -;; -;;;###autoload -(defun bookmark-edit-annotation (bookmark) - "Pop up a buffer for editing bookmark BOOKMARK's annotation. -BOOKMARK is a bookmark name or a bookmark record." - (interactive (list (bookmark-completing-read "Edit annotation of bookmark" - (bmkp-default-bookmark-name) - (bmkp-annotated-alist-only)))) - (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) - (bookmark-edit-annotation-mode bookmark)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Added optional arg ALIST. -;; -(defun bookmark-all-names (&optional alist) - "Return a list of all bookmark names. -The names are those of the bookmarks in ALIST or, if nil, -`bookmark-alist'." - (bookmark-maybe-load-default-file) - (mapcar (lambda (bmk) (bmkp-bookmark-name-from-record bmk)) (or alist bookmark-alist))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional args ALIST, PRED, and HIST. -;; 2. Define using helper function `bmkp-completing-read-1', -;; which binds `icicle-delete-candidate-object' to (essentially) `bookmark-delete'. -;; -(defun bookmark-completing-read (prompt &optional default alist pred hist) - "Read a bookmark name, prompting with PROMPT. -PROMPT is automatically suffixed with \": \", so do not include that. - -Optional arg DEFAULT is a string to return if the user enters the - empty string. -The alist argument used for completion is ALIST or, if nil, - `bookmark-alist'. -Optional arg PRED is a predicate used for completion. -Optional arg HIST is a history variable for completion. Default is - `bookmark-history'. - -If you access this function from a menu, then, depending on the value -of option `bmkp-menu-popup-max-length' and the number of -bookmarks in ALIST, you choose the bookmark using a menu or using -completion. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate." - (bmkp-completing-read-1 prompt default alist pred hist nil)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Handles also regions and non-file buffers. -;; 2. Do not use NO-CONTEXT or POSN if < Emacs 24. -;; -(defun bookmark-make-record-default (&optional no-file no-context position visits) - "Return the record describing the location of a new bookmark. -Point must be where the bookmark is to be set. - -Non-nil NO-FILE means return only the subset of the record that - pertains to the location within the buffer (not also the file name). - -Non-nil NO-CONTEXT means do not include the front and rear context -strings in the record enough. - -Non-nil POSITION means record it, not point, as the `position' entry. - -Non-nil VISITS means record it as the `visits' entry." - (let* ((dired-p (and (boundp 'dired-buffers) (car (rassq (current-buffer) dired-buffers)))) - (buf (buffer-name)) - (ctime (current-time)) - - ;; Begin `let*' dependencies. - (regionp (and transient-mark-mode mark-active (not (eq (mark) (point))))) - (beg (if regionp (region-beginning) (or position (point)))) - (end (if regionp (region-end) (point))) - (fcs (if regionp - (bmkp-position-post-context-region beg end) - (bmkp-position-post-context beg))) - (rcs (if regionp - (bmkp-position-pre-context-region beg) - (bmkp-position-pre-context beg))) - (fcrs (when regionp (bmkp-end-position-pre-context beg end))) - (ecrs (when regionp (bmkp-end-position-post-context end)))) - `(,@(unless no-file - `((filename . ,(cond ((buffer-file-name) (bookmark-buffer-file-name)) - (dired-p nil) - (t bmkp-non-file-filename))))) - (buffer-name . ,buf) - ,@(unless (and no-context (> emacs-major-version 23)) - `((front-context-string . ,fcs))) - ,@(unless (and no-context (> emacs-major-version 23)) - `((rear-context-string . ,rcs))) - ,@(unless (and no-context (> emacs-major-version 23)) - `((front-context-region-string . ,fcrs))) - ,@(unless (and no-context (> emacs-major-version 23)) - `((rear-context-region-string . ,ecrs))) - (visits . ,(or visits 0)) - (time . ,ctime) - (created . ,ctime) - (position . ,beg) - (end-position . ,end)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Put full bookmark record on bookmark name (inside record), as property `bmkp-full-record'. -;; -(defun bookmark-alist-from-buffer () - "Read and return a bookmark list (in any format) from the current buffer. -Put the full bookmark record on the bookmark name (in the record), as -a text property. Point is irrelevant and unaffected." - (let ((bmks (save-excursion - (goto-char (point-min)) - (if (search-forward bookmark-end-of-version-stamp-marker nil t) - (read (current-buffer)) - ;; Else we're dealing with format version 0 - (if (search-forward "(" nil t) - (progn (forward-char -1) (read (current-buffer))) - ;; Else no hope of getting information here. - (error "Buffer is not in bookmark-list format")))))) - ;; Put full bookmark on bookmark names as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If property needs to be stripped, that will be done when saving. - (dolist (bmk bmks) - (put-text-property 0 (length (car bmk)) 'bmkp-full-record bmk (car bmk))) - bmks)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Use `bookmark-make-record'. -;; 2. Use special default prompts for active region, W3M, and Gnus. -;; 3. Use function `bmkp-new-bookmark-default-names', in addition to the name that -;; `bookmark-make-record' comes up with, as the list of default values. -;; 4. Use `bmkp-completing-read-lax', choosing from current buffer's bookmarks. -;; 5. Numeric prefix arg (diff from plain): all bookmarks as completion candidates. -;; 6. Prompt for tags if `bmkp-prompt-for-tags-flag' is non-nil. -;; 7. Possibly highlight bookmark and other bookmarks in buffer, per `bmkp-auto-light-when-set'. -;; 8. Make bookmark temporary, if `bmkp-autotemp-bookmark-predicates' says to. -;; 9. Run `bmkp-after-set-hook'. -;; -;;;###autoload -(defun bookmark-set (&optional name parg interactivep) ; `C-x r m', `C-x p c m' - "Set a bookmark named NAME, then run `bmkp-after-set-hook'. -If the region is active (`transient-mark-mode') and nonempty, then -record the region limits in the bookmark. - -If NAME is nil, then prompt for the bookmark name. The default names -for prompting are as follows (in order of priority): - - * If in W3M mode, then the current W3M title. - - * If in a Gnus mode, then the Gnus summary article header. - - * If on a `man' page, then the page name (command and section). - - * If the region is active and nonempty, then the buffer name followed - by \": \" and the region prefix (up to - `bmkp-bookmark-name-length-max' chars). - - * The names defined by option `bmkp-new-bookmark-default-names'. - - * The value of variable `bookmark-current-bookmark', the name of the - last-used bookmark for the current file. - - * The value returned by function `bookmark-buffer-name'. - -For Emacs 23+, all of the names described above are available as -default values, by repeating `M-n'. For older Emacs versions, the -first name provided is the only default value. - -While entering a bookmark name at the prompt: - - * You can use (lax) completion against bookmarks in the same buffer. - If there are no bookmarks in the current buffer, then all bookmarks - are completion candidates. (See also below, about a numeric prefix - argument.) - - * You can use `C-M-w' to yank words from the buffer to the - minibuffer. Repeating `C-M-w' yanks successive words (newlines - between yanked words are stripped out). - - * You can use `C-M-u' to insert the name of the last bookmark used in - the buffer. This can be useful as an aid to track your progress - through a large file. (If no bookmark has yet been used, then - `C-M-u' inserts the name of the visited file.) - -A prefix argument changes the behavior as follows: - - * Numeric prefix arg: Use all bookmarks as completion candidates, - instead of just the bookmarks for the current buffer. - - * Plain prefix arg (`C-u'): Do not overwrite a bookmark that has the - same name as NAME, if such a bookmark already exists. Instead, - push the new bookmark onto the bookmark alist. - - The most recently set bookmark named NAME is thus the one in effect - at any given time, but any others named NAME are still available, - should you decide to delete the most recent one. - -Use `\\[bookmark-delete]' to remove bookmarks (you give it a name, and it removes -only the first instance of a bookmark with that name from the list of -bookmarks)." - (interactive (list nil current-prefix-arg t)) - (unwind-protect - (progn - (bookmark-maybe-load-default-file) - (setq bookmark-current-point (point)) ; `bookmark-current-point' is a free var here. - ;; Do not set these if they are already set in some other buffer (e.g gnus-art). - (unless (and bookmark-yank-point bookmark-current-buffer) - (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) - (setq bookmark-current-buffer (current-buffer))) - (let* ((record (bookmark-make-record)) - (defname (cond ((eq major-mode 'w3m-mode) w3m-current-title) - ((eq major-mode 'gnus-summary-mode) (elt (gnus-summary-article-header) 1)) - ((memq major-mode '(Man-mode woman-mode)) - (buffer-substring (point-min) (save-excursion (goto-char (point-min)) - (skip-syntax-forward "^ ") - (point)))) - (t nil))) - (defname (and defname (bmkp-replace-regexp-in-string "\n" " " defname))) - (bname (or name (bmkp-completing-read-lax - "Set bookmark " - (bmkp-new-bookmark-default-names defname) - (and (or (not parg) (consp parg)) ; No numeric PARG: all bookmarks. - (bmkp-specific-buffers-alist-only)) - nil 'bookmark-history)))) - (when (string-equal bname "") (setq bname defname)) - (bookmark-store bname (cdr record) (consp parg) (not interactivep)) - (when (and interactivep bmkp-prompt-for-tags-flag) - (bmkp-add-tags bname (bmkp-read-tags-completing) 'NO-UPDATE-P)) ; Do not refresh tags. (?) - (case (and (boundp 'bmkp-auto-light-when-set) bmkp-auto-light-when-set) - (autonamed-bookmark (when (bmkp-autonamed-bookmark-p bname) - (bmkp-light-bookmark bname))) - (non-autonamed-bookmark (unless (bmkp-autonamed-bookmark-p bname) - (bmkp-light-bookmark bname))) - (any-bookmark (bmkp-light-bookmark bname)) - (autonamed-in-buffer (bmkp-light-bookmarks - (bmkp-remove-if-not #'bmkp-autonamed-bookmark-p - (bmkp-this-buffer-alist-only)) - nil interactivep)) - (non-autonamed-in-buffer (bmkp-light-bookmarks - (bmkp-remove-if #'bmkp-autonamed-bookmark-p - (bmkp-this-buffer-alist-only)) - nil interactivep)) - (all-in-buffer (bmkp-light-this-buffer nil interactivep))) - ;; Maybe make bookmark temporary. - (if bmkp-autotemp-all-when-set-p - (bmkp-make-bookmark-temporary bname) - (catch 'bookmark-set - (dolist (pred bmkp-autotemp-bookmark-predicates) - (when (and (functionp pred) (funcall pred bname)) - (bmkp-make-bookmark-temporary bname) - (throw 'bookmark-set t))))) - (run-hooks 'bmkp-after-set-hook) - (if bookmark-use-annotations - (bookmark-edit-annotation bname) - (goto-char bookmark-current-point)))) ; `bookmark-current-point' is a free var here. - (setq bookmark-yank-point nil - bookmark-current-buffer nil))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Put full bookmark record on the name as property `bmkp-full-record'. -;; Add BOOKMARK to `bmkp-modified-bookmarks'. -;; -(defun bookmark-set-name (bookmark newname) - "Set name of BOOKMARK to NEWNAME. -BOOKMARK is a bookmark name or a bookmark record." - (setq bookmark (bookmark-get-bookmark bookmark)) - (setcar bookmark newname) - ;; Put the full bookmark on its name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (put-text-property 0 (length newname) 'bmkp-full-record bookmark newname) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bookmark bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons bookmark bmkp-modified-bookmarks)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Prevent adding a newline in a bookmark name when yanking. -;; -;;;###autoload -(defun bookmark-yank-word () ; Bound to `C-M-w' in minibuffer when setting bookmark. - "Yank the word at point in `bookmark-current-buffer'. -Repeat to yank consecutive words from the current buffer, appending -them to the minibuffer. However, newline characters between yanked -words are stripped out." - (interactive) - (let ((string (with-current-buffer bookmark-current-buffer - (goto-char bookmark-yank-point) - (buffer-substring-no-properties (point) - (progn (forward-word 1) - (setq bookmark-yank-point (point))))))) - (setq string (bmkp-replace-regexp-in-string "\n" "" string)) - (insert string))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Separate renaming of obsolete default bookmark name (do it even if not loading the default file). -;; 2. Load `bmkp-last-as-first-bookmark-file' if it is non-nil. -;; -(defun bookmark-maybe-load-default-file () - "If bookmarks have not yet been loaded, load them. -If `bmkp-last-as-first-bookmark-file' is non-nil, load it. -Otherwise, load `bookmark-default-file'." - ;; If there is no file at `bookmark-default-file' but there is a file with the obsolete default - ;; name, then rename that file to the value of `bookmark-default-file'. - ;; Do this regardless of whether it is `bookmark-default-file' that we load here. - (when (and (file-exists-p bookmark-old-default-file) (not (file-exists-p bookmark-default-file))) - (rename-file bookmark-old-default-file bookmark-default-file)) - (let ((file-to-load (bmkp-default-bookmark-file))) - (and (not bookmarks-already-loaded) - (null bookmark-alist) - (file-readable-p file-to-load) - (bookmark-load file-to-load t 'nosave) - (setq bookmarks-already-loaded t)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Save DISPLAY-FUNCTION to `bmkp-jump-display-function' before calling -;; `bookmark-handle-bookmark'. -;; 2. Update the name and position of an autonamed bookmark, in case it moved. -;; 3. Possibly highlight bookmark and other bookmarks in buffer, per `bmkp-auto-light-when-jump'. -;; 4. Added `catch', so a handler can throw to skip the rest of the processing if it wants. -;; -(defun bookmark--jump-via (bookmark display-function) - "Display BOOKMARK using DISPLAY-FUNCTION. -Then run `bookmark-after-jump-hook' and show annotations for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bmkp-record-visit bookmark 'BATCHP) - (setq bmkp-jump-display-function display-function) - (catch 'bookmark--jump-via - (bookmark-handle-bookmark bookmark) - (let ((win (get-buffer-window (current-buffer) 0))) - (when win (set-window-point win (point)))) - ;; If this is an autonamed bookmark, update its name and position, in case it moved. - ;; But don't do this if we're using w32, since we might not have moved to the bookmark position. - (when (and (bmkp-autonamed-bookmark-for-buffer-p bookmark (buffer-name)) - (not bmkp-use-w32-browser-p)) - (setq bookmark (bmkp-update-autonamed-bookmark bookmark))) - (case (and (boundp 'bmkp-auto-light-when-jump) bmkp-auto-light-when-jump) - (autonamed-bookmark (when (bmkp-autonamed-bookmark-p bookmark) - (bmkp-light-bookmark bookmark nil nil nil 'USE-POINT))) - (non-autonamed-bookmark (unless (bmkp-autonamed-bookmark-p bookmark) - (bmkp-light-bookmark bookmark nil nil nil 'USE-POINT))) - (any-bookmark (bmkp-light-bookmark bookmark nil nil nil 'USE-POINT)) - (autonamed-in-buffer (bmkp-light-bookmarks - (bmkp-remove-if-not #'bmkp-autonamed-bookmark-p - (bmkp-this-buffer-alist-only)) - nil 'MSG)) - (non-autonamed-in-buffer (bmkp-light-bookmarks - (bmkp-remove-if #'bmkp-autonamed-bookmark-p (bmkp-this-buffer-alist-only)) - nil 'MSG)) - (all-in-buffer (bmkp-light-this-buffer nil 'MSG))) - (let ((orig-buff (current-buffer))) ; Used by `crosshairs-highlight'. - (run-hooks 'bookmark-after-jump-hook)) - (let ((jump-fn (bmkp-get-tag-value bookmark "bmkp-jump"))) - (when jump-fn (funcall jump-fn))) - (when bookmark-automatically-show-annotations (bookmark-show-annotation bookmark)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Add to beginning, not end, of bookmark record. -;; 2. Do not use `nconc'. -;; 3. Respect both old and newer bookmark formats. -;; 4. Add BOOKMARK to `bmkp-modified-bookmarks'. -;; -(defun bookmark-prop-set (bookmark prop val) - "Set the property PROP of BOOKMARK to VAL. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let* ((bmk (bookmark-get-bookmark bookmark)) - (cell (assq prop (bmkp-bookmark-data-from-record bmk)))) - (if cell - (setcdr cell val) - (if (consp (car (cadr bmk))) ; Old format: ("name" ((filename . "f")...)) - (setcdr bmk (list (cons (cons prop val) (cadr bmk)))) - (setcdr bmk (cons (cons prop val) (cdr bmk))))) ; New: ("name" (filename . "f")...) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bmk bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons bmk bmkp-modified-bookmarks))))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg USE-REGION-P. -;; 2. Use `bmkp-default-bookmark-name' as default when interactive. -;; 3. Use `bmkp-jump-1'. -;; 4. Added note about Icicles `S-delete' to doc string. -;; -;;;###autoload -(defun bookmark-jump (bookmark ; Bound to `C-x j j', `C-x r b', `C-x p g' - &optional display-function use-region-p) - "Jump to bookmark BOOKMARK. -You may have a problem using this function if the value of variable -`bookmark-alist' is nil. If that happens, you need to load in some -bookmarks. See function `bookmark-load' for more about this. - -If the file pointed to by BOOKMARK no longer exists, you are asked if -you wish to give the bookmark a new location. If so, `bookmark-jump' -jumps to the new location and saves it. - -If the bookmark defines a region, then the region is activated if -`bmkp-use-region' is not-nil or it is nil and you use a prefix -argument. A prefix arg temporarily flips the value of -`bmkp-use-region'. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate. - -In Lisp code: -BOOKMARK is a bookmark name or a bookmark record. -Non-nil DISPLAY-FUNCTION is a function to display the bookmark. By - default, `switch-to-buffer' is used. -Non-nil USE-REGION-P flips the value of `bmkp-use-region'." - (interactive (list (bookmark-completing-read "Jump to bookmark" (bmkp-default-bookmark-name)) - nil - current-prefix-arg)) - (bmkp-jump-1 bookmark (or display-function 'switch-to-buffer) use-region-p)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg USE-REGION-P. -;; 2. Use `bmkp-default-bookmark-name' as default when interactive. -;; 3. Use `bmkp-jump-1'. -;; -;;;###autoload -(defun bookmark-jump-other-window (bookmark &optional use-region-p) - ; Bound to `C-x 4 j j', `C-x p j', `C-x p o', `C-x p q' - "Jump to bookmark BOOKMARK in another window. -See `bookmark-jump', in particular for info about using a prefix arg." - (interactive (list (bookmark-completing-read "Jump to bookmark (in another window)" - (bmkp-default-bookmark-name)) - current-prefix-arg)) - (bmkp-jump-1 bookmark 'bmkp-select-buffer-other-window use-region-p)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Privilege property `file-handler' over `handler'. If the former is available, apply it to the file. -;; -;; 2. If BOOKMARK has its own handler but that is not a defined function, then use the default handler. -;; This lets Emacs 22, for instance, handle Emacs 23+ image bookmarks. -;; -;; 3. Different relocation message for non-file bookmark. -;; -(defun bookmark-handle-bookmark (bookmark) - "Call BOOKMARK's handler, or `bookmark-default-handler' if it has none. -Return nil or raise an error. - -BOOKMARK is a bookmark name or a bookmark record. - -More precisely: - - If BOOKMARK has both `file-handler' and `filename' entries then - apply the former to the latter. - - Else, if BOOKMARK has a `handler' property that is a defined - function then apply it to BOOKMARK. - - Else, apply the default bookmark handler, - `bookmark-default-handler', to BOOKMARK. - -The default handler changes the current buffer and point. - -If the default handler is used and a file error is raised, the error -is handled as follows: - If BOOKMARK has no `filename' entry, do nothing. - Else prompt to relocate the file. - If relocated, then try again to handle. Else raise a file error." - (cond ((functionp (bookmark-prop-get bookmark 'file-handler)) - (funcall (bookmark-prop-get bookmark 'file-handler) (bookmark-get-filename bookmark))) - ((functionp (bookmark-get-handler bookmark)) - (funcall (bookmark-get-handler bookmark) (bookmark-get-bookmark bookmark))) - (t - (condition-case err - (funcall 'bookmark-default-handler (bookmark-get-bookmark bookmark)) - (bookmark-error-no-filename ; `file-error' - ;; BOOKMARK can be either a bookmark name or a bookmark record. - ;; If a record, do nothing - assume it is a bookmark used internally by some other package. - (when (stringp bookmark) - (let ((file (bookmark-get-filename bookmark)) - (use-dialog-box nil) - (use-file-dialog nil)) - (when file - ;; Ask user whether to relocate the file. If no, signal the file error. - (unless (string= file bmkp-non-file-filename) (setq file (expand-file-name file))) - (ding) - (cond ((y-or-n-p (if (and (string= file bmkp-non-file-filename) - (bmkp-get-buffer-name bookmark)) - "Bookmark's buffer does not exist. Re-create it? " - (concat (file-name-nondirectory file) " nonexistent. Relocate \"" - bookmark "\"? "))) - (if (string= file bmkp-non-file-filename) - ;; This is probably not the right way to get the correct buffer, but it's - ;; better than nothing, and it gives the user a chance to DTRT. - (pop-to-buffer (bmkp-get-buffer-name bookmark)) ; Create buffer. - (bookmark-relocate bookmark)) ; Relocate to file. - (funcall (or (bookmark-get-handler bookmark) 'bookmark-default-handler) - (bookmark-get-bookmark bookmark))) ; Try again - (t - (message "Bookmark not relocated: `%s'" bookmark) - (signal (car err) (cdr err))))))))))) - (when (stringp bookmark) (setq bookmark-current-bookmark bookmark)) - ;; $$$$$$ The vanilla code returns nil, but there is no explanation of why and no code seems - ;; to use the return value. Perhaps we should return the bookmark instead? - nil) ; Return nil if no error. - -(put 'bookmark-error-no-filename 'error-conditions - '(error bookmark-errors bookmark-error-no-filename)) -(put 'bookmark-error-no-filename 'error-message "Bookmark has no associated file (or directory)") - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Support regions, buffer names, and property `file-handler'. -;; 2. Handle MS Windows `Open' command if `bmkp-use-w32-browser-p' and if `w32-browser' is defined. -;; -(defun bookmark-default-handler (bookmark) - "Default handler to jump to the location of BOOKMARK. -Return nil (or raise an error). - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. - -If `bmkp-use-w32-browser-p' is non-nil and function `w32-browser' is -defined, then call `w32-browser'. That is, use the default MS Windows -application for the bookmarked file. - -If BOOKMARK has properties `file-handler' and `filename', then apply -the value of the former to the latter. - -If BOOKMARK is an old-style Info bookmark, then go to the Info node. - -If BOOKMARK records a nonempty region and `bmkp-use-region' is - non-nil then activate the region. - -Otherwise, call `bmkp-goto-position' to go to the recorded position." - (let* ((bmk (bookmark-get-bookmark bookmark)) - (file (bookmark-get-filename bmk)) - (buf (bookmark-prop-get bmk 'buffer)) - (bufname (bmkp-get-buffer-name bmk)) - (pos (bookmark-get-position bmk)) - (end-pos (bmkp-get-end-position bmk)) - (old-info-node (and (not (bookmark-get-handler bookmark)) (bookmark-prop-get bmk 'info-node)))) - - (cond ((and bmkp-use-w32-browser-p (fboundp 'w32-browser) file) (w32-browser file)) - ((and (bookmark-prop-get bookmark 'file-handler) file) - (funcall (bookmark-prop-get bookmark 'file-handler) file)) - (old-info-node ; Emacs 20-21 Info bookmarks - no handler entry. - (progn (require 'info) (Info-find-node file old-info-node) (goto-char pos))) - ((not (and bmkp-use-region end-pos (/= pos end-pos))) - ;; Single-position bookmark (no region). Go to it. - (bmkp-goto-position bmk file buf bufname pos - (bookmark-get-front-context-string bmk) - (bookmark-get-rear-context-string bmk))) - (t - ;; Bookmark with a region. Go to it and activate the region. - (if (and file (file-readable-p file) (not (buffer-live-p buf))) - (with-current-buffer (find-file-noselect file) (setq buf (buffer-name))) - ;; No file found. If no buffer either, then signal that file doesn't exist. - (unless (or (and buf (get-buffer buf)) - (and bufname (get-buffer bufname) (not (string= buf bufname)))) - (signal 'bookmark-error-no-filename (list 'stringp file)))) - (set-buffer (or buf bufname)) - (when bmkp-jump-display-function - (save-current-buffer (funcall bmkp-jump-display-function (current-buffer))) - (raise-frame)) - (goto-char (min pos (point-max))) - (when (> pos (point-max)) (error "Bookmark position is beyond buffer end")) - ;; Activate region. Relocate it if it moved. Save relocated bookmark if confirm. - (funcall bmkp-handle-region-function bmk))) - ;; $$$$$$ The vanilla code returns nil, but there is no explanation of why and no code seems - ;; to use the return value. Perhaps we should return the bookmark instead? - nil)) ; Return nil if no file error. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added bookmark default for interactive use. -;; 2. Added optional arg NO-UPDATE-P. -;; 3. Added note about `S-delete' to doc string. -;; 4. Changed arg name: BOOKMARK -> BOOKMARK-NAME. -;; 5. Update Dired location too, for Dired bookmark. -;; 6. Refresh menu list, to show new location. -;; -;;;###autoload -(defun bookmark-relocate (bookmark-name &optional no-update-p) ; Not bound - "Relocate the bookmark named BOOKMARK-NAME to another file. -You are prompted for the new file name. - -Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and do not -refresh/rebuild the bookmark-list display. - -Changes the file associated with the bookmark. -Useful when a file has been renamed after a bookmark was set in it. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate." - (interactive (list (bookmark-completing-read "Bookmark to relocate" (bmkp-default-bookmark-name)))) - (bookmark-maybe-historicize-string bookmark-name) - (bookmark-maybe-load-default-file) - (let* ((icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (bookmark-filename (bookmark-get-filename bookmark-name)) - (new-filename (abbreviate-file-name - (expand-file-name - (read-file-name - (format "Relocate %s to: " bookmark-name) - (file-name-directory bookmark-filename)))))) - (bookmark-set-filename bookmark-name new-filename) - ;; Change location for Dired too, but not if different from original file name (e.g. a cons). - (let ((dired-dir (bookmark-prop-get bookmark-name 'dired-directory))) - (when (and dired-dir (equal dired-dir bookmark-filename)) - (bookmark-prop-set bookmark-name 'dired-directory new-filename)))) - (bmkp-maybe-save-bookmarks) - (when (and bookmark-bmenu-toggle-filenames (get-buffer "*Bookmark List*") - (get-buffer-window (get-buffer "*Bookmark List*") 0) - (not no-update-p)) - (with-current-buffer (get-buffer "*Bookmark List*") ; Do NOT just use `bmkp-refresh/rebuild-menu-list'. - (bmkp-refresh-menu-list bookmark-name)))) ; So display new location and `*' marker. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added bookmark default for interactive use. -;; 2. Do not add any text properties here. That's done in `bmkp-bmenu-propertize-item'. -;; 3. Added note about `S-delete' to doc string. -;; 4. Changed arg name: BOOKMARK -> BOOKMARK-NAME. -;; -;;;###autoload -(defun bookmark-insert-location (bookmark-name &optional no-history) ; `C-x p I' (original: `C-x p f') - "Insert file or buffer name for the bookmark named BOOKMARK-NAME. -If a file is bookmarked, insert the recorded file name. -If a non-file buffer is bookmarked, insert the recorded buffer name. - -Optional second arg NO-HISTORY means do not record this in the -minibuffer history list `bookmark-history'. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate." - (interactive - (let ((bmk (bookmark-completing-read "Insert bookmark location" (bmkp-default-bookmark-name)))) - (if (> emacs-major-version 21) (list bmk) bmk))) - (or no-history (bookmark-maybe-historicize-string bookmark-name)) - (insert (bookmark-location bookmark-name))) ; Return the line inserted. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Pass full bookmark to the various "get" functions. -;; 2. Location returned can be a buffer name, instead of a file name. -;; -(defun bookmark-location (bookmark) - "Return the name of the file or buffer associated with BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. -Return \"-- Unknown location --\" if no location name can be found." - (bookmark-maybe-load-default-file) - (setq bookmark (bookmark-get-bookmark bookmark)) - (or (bookmark-prop-get bookmark 'location) - (bookmark-get-filename bookmark) - (bmkp-get-buffer-name bookmark) - (bookmark-prop-get bookmark 'buffer) - "-- Unknown location --")) - ;; $$$$$$$$$ "")) - ;; $$$$ (error "Bookmark has no file or buffer name: %S" bookmark))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added BATCHP arg. Return OLD if BATCHP is non-nil and NEW is nil. -;; 2. Rename also in marked and omitted lists. -;; 3. Use `bmkp-bookmark-record-from-name', not `bookmark-get-bookmark'. -;; 4. Use `bmkp-completing-read-lax', not `read-from-minibuffer'. -;; 5. Put `bmkp-full-record' property on new name. -;; 3. Use `bmkp-bookmark-record-from-name', not `bookmark-get-bookmark'. -;; 4. Added note about `S-delete' to doc string. -;; 6. Refresh menu list, to show new name. -;; -;;;###autoload -(defun bookmark-rename (old &optional new batchp) ; Not bound in Bookmark+ - "Change bookmark's name from OLD to NEW. -Interactively: - If called from the keyboard, then prompt for OLD. - If called from the menubar, select OLD from a menu. -If NEW is nil, then prompt for its string value (unless BATCH). - -When entering the NEW name you can use completion against existing -bookmark names. This completion is lax, so you can easily edit an -existing name. See `bookmark-set' for particular keys available -during this input. - -If BATCHP is non-nil, then do not rebuild the bookmark list. (NEW -should be non-nil if BATCH is non-nil.) - -If you use Icicles then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate." - (interactive (list (bookmark-completing-read "Old bookmark name" (bmkp-default-bookmark-name)))) - (bookmark-maybe-historicize-string old) - (bookmark-maybe-load-default-file) - (setq bookmark-current-point (point)) ; `bookmark-current-point' is a free var here. - (save-excursion (skip-chars-forward " ") (setq bookmark-yank-point (point))) - (setq bookmark-current-buffer (current-buffer)) - (let ((newname (or new (and (not batchp) (bmkp-completing-read-lax "New name: " old))))) -;;; $$$$$$ (read-from-minibuffer "New name: " nil -;;; (let ((now-map (copy-keymap minibuffer-local-map))) -;;; (define-key now-map "\C-w" 'bookmark-yank-word) -;;; now-map) -;;; nil 'bookmark-history)))) - - (when newname - (bookmark-set-name old newname) - ;; Put the bookmark on the name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (put-text-property 0 (length newname) 'bmkp-full-record (bmkp-bookmark-record-from-name newname) - newname) - (bmkp-rename-for-marked-and-omitted-lists old newname) ; Rename in marked & omitted lists, if present. - (setq bookmark-current-bookmark newname) - (unless batchp - (if (and (get-buffer "*Bookmark List*") (get-buffer-window (get-buffer "*Bookmark List*") 0)) - (with-current-buffer (get-buffer "*Bookmark List*") - (bmkp-refresh-menu-list newname)) ; So the new name is displayed. - (bookmark-bmenu-surreptitiously-rebuild-list))) - (bmkp-maybe-save-bookmarks)) - (or newname old))) ; NEWNAME is nil only if BATCHP is non-nil and NEW was nil. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added bookmark default for interactive use. -;; 2. Added note about `S-delete' to doc string. -;; 3. Changed arg name: BOOKMARK -> BOOKMARK-NAME. -;; -(or (fboundp 'old-bookmark-insert) -(fset 'old-bookmark-insert (symbol-function 'bookmark-insert))) - -;;;###autoload -(defun bookmark-insert (bookmark-name) ; Bound to `C-x p i' - "Insert the text of a bookmarked file. -BOOKMARK-NAME is the name of the bookmark. -You may have a problem using this function if the value of variable -`bookmark-alist' is nil. If that happens, you need to load in some -bookmarks. See function `bookmark-load' for more about this. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate." - (interactive (list (bookmark-completing-read "Insert bookmark contents" (bmkp-default-bookmark-name)))) - (old-bookmark-insert bookmark-name)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Accept a bookmark or a bookmark name as arg. -;; 2. Use `bmkp-default-bookmark-name' as default when interactive. -;; 3. Use `bmkp-get-bookmark-in-alist', not `bookmark-get-bookmark'. -;; 4. Remove highlighting for the bookmark. -;; 5. Doc string includes note about `S-delete' for Icicles. -;; 6. Update `bmkp-latest-bookmark-alist', `bmkp-bmenu-omitted-bookmarks', and `bmkp-auto-idle-bookmarks'. -;; 7. Increment `bookmark-alist-modification-count' even when BATCHP is non-nil. -;; -;;;###autoload -(defun bookmark-delete (bookmark &optional batchp) ; Bound to `C-x p d' - "Delete the BOOKMARK from the bookmark list. -BOOKMARK is a bookmark name or a bookmark record. -Interactively, default to the \"current\" bookmark (that is, the one -most recently used in this file), if it exists. - -If BOOKMARK is a name and it has property `bmkp-full-record' then use -that property along with the name to find the bookmark to delete. -If it is a name without property `bmkp-full-record' then delete (only) -the first bookmark in `bookmark-alist' with that name. - -Optional arg BATCHP means do not update buffer `*Bookmark List*'. - -If you use Icicles, then you can use `S-delete' during completion of a -bookmark name to delete the bookmark named by the current completion -candidate. In this way, you can delete multiple bookmarks." - (interactive (list (bookmark-completing-read "Delete bookmark" (bmkp-default-bookmark-name)))) - - ;; $$$$$$ Instead of loading unconditionally, maybe we should just try to delete conditionally? - ;; IOW, why not (when bookmarks-already-loaded BODY) instead of `bookmark-maybe-load-default-file'? - ;; If it gets called on a hook that gets run before ever loading, then should probably do nothing. - ;; Leaving it as is for now (2011-04-06). - (bookmark-maybe-load-default-file) - - (let* ((bmk (bookmark-get-bookmark bookmark 'NOERROR)) - (bname (bmkp-bookmark-name-from-record bmk))) ; BOOKMARK might have been a bookmark. - (when bname ; Do nothing if BOOKMARK does not represent a bookmark. - (bookmark-maybe-historicize-string bname) - (when (fboundp 'bmkp-unlight-bookmark) (bmkp-unlight-bookmark bmk 'NOERROR)) - (setq bookmark-alist (delq bmk bookmark-alist) - bmkp-latest-bookmark-alist (delq bmk bmkp-latest-bookmark-alist) - bmkp-auto-idle-bookmarks (delq bmk bmkp-auto-idle-bookmarks) - bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list - bname bmkp-bmenu-omitted-bookmarks)) - (unless (bmkp-get-bookmark-in-alist bookmark-current-bookmark 'NOERROR) - (setq bookmark-current-bookmark nil)) ; Make this nil if last occurrence of BMK was deleted. - ;; Do NOT refresh/rebuild if BATCHP. Caller must do that if batching deletions. - (unless batchp (bmkp-refresh/rebuild-menu-list nil batchp)) - (bmkp-maybe-save-bookmarks)))) ; Increments `bookmark-alist-modification-count'. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Use `bmkp-current-bookmark-file', not `bookmark-default-file'. -;; 2. Update `bmkp-last-as-first-bookmark-file' if it is non-nil. -;; 3. Reset `bmkp-modified-bookmarks' to (). -;; 4. Call `bmkp-refresh/rebuild-menu-list'. -;; -;;;###autoload -(defun bookmark-save (&optional parg file) ; Bound to `C-x p s' - "Save currently defined bookmarks. -Save by default in the file named by variable -`bmkp-current-bookmark-file'. With a prefix arg, you are prompted for -the file to save to. - -If `bmkp-last-as-first-bookmark-file' is non-nil, update its value to -the file being saved. - -To load bookmarks from a specific file, use `\\[bookmark-load]' -\(`bookmark-load'). - -If called from Lisp: - With nil PARG, use file `bmkp-current-bookmark-file'. - With non-nil PARG and non-nil FILE, use file FILE. - With non-nil PARG and nil FILE, prompt the user for the file to use." - (interactive "P") - (bookmark-maybe-load-default-file) - (let ((file-to-save - (cond ((and (not parg) (not file)) bmkp-current-bookmark-file) - ((and (not parg) file) file) - ((and parg (not file)) (bmkp-read-bookmark-file-name "File to save bookmarks in: "))))) - (when (and bmkp-last-as-first-bookmark-file - bookmark-save-flag) ; nil if temporary bookmarking mode. - (customize-save-variable 'bmkp-last-as-first-bookmark-file file-to-save)) - (bookmark-write-file file-to-save)) - ;; Indicate by the count that we have synced the current bookmark file. - ;; If an error has already occurred somewhere, the count will not be set, which is what we want. - (setq bookmark-alist-modification-count 0 - bmkp-modified-bookmarks ()) - (bmkp-refresh/rebuild-menu-list)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Do not save temporary bookmarks (`bmkp-temporary-bookmark-p'). -;; 2. Added optional arg ALT-MSG. -;; 3. Insert code piecewise, to improve performance when saving `bookmark-alist'. -;; (Do not let `pp' parse all of `bookmark-alist' at once.) -;; 4. Unless `bmkp-propertize-bookmark-names-flag', remove text properties from bookmark name and file name. -;; 5. Bind `print-circle' to t around pp, to record bookmark name with `bmkp-full-record' property. -;; 6. Use `case', not `cond'. -;; -(defun bookmark-write-file (file &optional alt-msg) - "Write `bookmark-alist' to FILE. -Bookmarks that have a non-nil `bmkp-temp' property are not saved. -They are removed from the bookmark file, but not from the current -bookmark list. - -Non-nil ALT-MSG is a message format string to use in place of the -default, \"Saving bookmarks to file `%s'...\". The string must -contain a `%s' construct, so that it can be passed along with FILE to -`format'. At the end, \"done\" is appended to the message." - (let ((msg (or alt-msg "Saving bookmarks to file `%s'..." file))) - (message (or alt-msg "Saving bookmarks to file `%s'...") file) - (with-current-buffer (get-buffer-create " *Bookmarks*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil) - bname fname last-fname) - (bookmark-insert-file-format-version-stamp) - (insert "(") - (dolist (bmk bookmark-alist) - (unless (bmkp-temporary-bookmark-p bmk) - (setq bname (car bmk) - fname (bookmark-get-filename bmk)) - (when (or (not (> emacs-major-version 20)) ; Emacs 20 can't do (not (boundp 'print-circle)). - (not bmkp-propertize-bookmark-names-flag)) - (set-text-properties 0 (length bname) () bname) - (when fname (set-text-properties 0 (length fname) () fname))) - (setcar bmk bname) - (when (setq last-fname (assq 'filename bmk)) (setcdr last-fname fname)) - (let ((print-circle t)) (pp bmk (current-buffer))))) - (insert ")") - (let ((version-control (case bookmark-version-control - ((nil) nil) - (never 'never) - (nospecial version-control) - (t t))) - (errorp nil)) - (condition-case nil - (write-region (point-min) (point-max) file) - (file-error (setq errorp t) (message "CANNOT WRITE FILE `%s'" file) (sit-for 4))) - (kill-buffer (current-buffer)) - (unless errorp (message (concat msg "done") file))))))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg means OVERWRITE. -;; 2. Use `bmkp-read-bookmark-file-name', not `read-file-name', and use different default. -;; 3. If OVERWRITE is non-nil: -;; * Update `bmkp-last-bookmark-file' to `bmkp-current-bookmark-file'. -;; * Update `bmkp-current-bookmark-file' to FILE . -;; * If `bmkp-last-as-first-bookmark-file', then update it to FILE and save it to disk. -;; 4. If the bookmark-file buffer already existed, do not kill it after loading. -;; 5. Set `bookmarks-already-loaded' regardless of FILE (not just `bookmark-default-file'). -;; 6. Update `bmkp-sorted-alist' (it's a cache). -;; 7. Final msg says whether overwritten. -;; 8. Call `bmkp-bmenu-refresh-menu-list' at end. -;; -;;;###autoload -(defun bookmark-load (file &optional overwrite batchp) ; Bound to `C-x p l' - "Load bookmarks from FILE (which must be in the standard format). -Without a prefix argument (argument OVERWRITE is nil), add the newly -loaded bookmarks to those already current. They will be saved to the -current bookmark file when bookmarks are saved. - -If you do not use a prefix argument, then no existing bookmarks are -overwritten. If you load some bookmarks that have the same names as -bookmarks already defined in your Emacs session, numeric suffixes -\"<2>\", \"<3>\",... are appended as needed to the names of those new -bookmarks to distinguish them. - -With a prefix argument, switch the bookmark file currently used, -*replacing* all currently existing bookmarks with the newly loaded -bookmarks. In this case, the value of `bmkp-current-bookmark-file'is -backed up to `bmkp-last-bookmark-file' and then changed to FILE, so -bookmarks will subsequently be saved to FILE. If -`bmkp-last-as-first-bookmark-file' is non-nil then its value is also -changed to FILE and it is saved persistently, so that the next Emacs -session will start with it as the bookmark file. (The value of -`bookmark-default-file' is unaffected.) - -Interactively, if any bookmarks have been modified since last saved -then you are asked whether you want to first save them before loading -FILE. If you hit `C-g' then both saving and loading are canceled. - -When called from Lisp, non-nil optional arg BATCHP means this is not -an interactive call. In this case, do not interact with the user: do -not ask whether to save the current (unsaved) bookmark list before -loading; do not display any load progress messages; and do not -update/refresh buffer `*Bookmark List*'. - -If BATCHP is `save' and bookmarks have been modified since the -bookmark list was last saved, then save the bookmark list before -loading. - -If BATCHP is any other non-nil value besides `save', do not save the -bookmark list. - -Your initial bookmark file, either `bmkp-last-as-first-bookmark-file' -or `bookmark-default-file', is loaded automatically by Emacs the first -time you use bookmarks in a session - you do not need to load it -manually. Use `bookmark-load' only to load extra bookmarks (with no -prefix arg) or an alternative set of bookmarks (with a prefix arg). - -If you use `bookmark-load' to load a file that does not contain a -proper bookmark alist, then when bookmarks are saved the current -bookmark file will likely become corrupted. You should load only -bookmark files that were created using the bookmark functions." - (interactive - (list (let ((default (if (bmkp-same-file-p bmkp-current-bookmark-file bmkp-last-bookmark-file) - (bmkp-default-bookmark-file) - bmkp-last-bookmark-file))) - (bmkp-read-bookmark-file-name - (if current-prefix-arg "Switch to bookmark file: " "Add bookmarks from file: ") - (or (file-name-directory default) "~/") - default - t)) - current-prefix-arg)) - ;; Maybe save first. - (when (or (eq batchp 'save) - (and (not batchp) (> bookmark-alist-modification-count 0) - (condition-case err - (yes-or-no-p "Save current bookmarks before loading? (`C-g': cancel load) ") - (quit (error "OK, canceled")) - (error (error (error-message-string err)))))) - (bookmark-save)) - ;; Load. - (setq file (abbreviate-file-name (expand-file-name file))) - (unless (file-readable-p file) (error "Cannot read bookmark file `%s'" file)) - (unless batchp (message "Loading bookmarks from `%s'..." file)) - (let ((existing-buf (get-file-buffer file))) - (with-current-buffer (let ((enable-local-variables nil)) (find-file-noselect file)) - (goto-char (point-min)) - (bookmark-maybe-upgrade-file-format) - (let ((blist (bookmark-alist-from-buffer))) - (unless (listp blist) (error "Invalid bookmark list in `%s'" file)) - (cond (overwrite - (setq bmkp-last-bookmark-file bmkp-current-bookmark-file - bmkp-current-bookmark-file file - bookmark-alist blist - bookmark-alist-modification-count 0) - (when bmkp-last-as-first-bookmark-file - (customize-save-variable 'bmkp-last-as-first-bookmark-file file))) - (t - (bookmark-import-new-list blist) - (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count)))) - (setq bookmarks-already-loaded t ; Systematically, whenever any file is loaded. - bmkp-sorted-alist (bmkp-sort-omit bookmark-alist))) - (unless (eq existing-buf (current-buffer)) (kill-buffer (current-buffer))))) - (unless batchp ; If appropriate, *CALLER* MUST refresh/rebuild, if BATCHP. - (bmkp-refresh/rebuild-menu-list) - (message "%s bookmarks in `%s'" (if overwrite "Switched to" "Added") file))) - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg MSG-P. Show message if no annotation. -;; 2. Name buffer after the bookmark. -;; 3. MSG-P means message if no annotation. -;; 4. Use `view-mode'. `q' uses `quit-window'. -;; 5. Fit frame to buffer if `one-windowp'. -;; 6. Restore frame selection. -;; -(defun bookmark-show-annotation (bookmark &optional msg-p) - "Display the annotation for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. -If no annotation and MSG-P is non-nil, show a no-annotation message." - (let* ((bmk (bookmark-get-bookmark bookmark 'NOERROR)) - (bmk-name (bmkp-bookmark-name-from-record bmk)) - (ann (and bmk (bookmark-get-annotation bmk)))) - (if (not (and ann (not (string-equal ann "")))) - (when msg-p (message "Bookmark has no annotation")) - (let ((oframe (selected-frame))) - (save-selected-window - (pop-to-buffer (get-buffer-create (format "*`%s' Annotation*" bmk-name))) - (let ((buffer-read-only nil)) ; Because buffer might already exist, in view mode. - (delete-region (point-min) (point-max)) - (insert (concat "Annotation for bookmark '" bmk-name "':\n\n")) - (put-text-property (line-beginning-position -1) (line-end-position 1) - 'face 'bmkp-heading) - (insert ann)) - (goto-char (point-min)) - (view-mode-enter (cons (selected-window) (cons nil 'quit-window))) - (when (fboundp 'fit-frame-if-one-window) (fit-frame-if-one-window))) - (select-frame-set-input-focus oframe))))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Use name `*Bookmark Annotations*', not `*Bookmark Annotation*'. -;; 2. Don't list bookmarks that have no annotation. -;; 3. Highlight bookmark names. Don't indent annotations. Add a blank line after each annotation. -;; 4. Use `view-mode'. `q' uses `quit-window'. -;; 5. Fit frame to buffer if `one-windowp'. -;; 6. Restore frame selection. -;; -(defun bookmark-show-all-annotations () - "Display the annotations for all bookmarks." - (let ((oframe (selected-frame))) - (save-selected-window - (pop-to-buffer (get-buffer-create "*Bookmark Annotations*")) - (let ((buffer-read-only nil)) ; Because buffer might already exist, in view mode. - (delete-region (point-min) (point-max)) - (dolist (full-record bookmark-alist) ; (Could use `bmkp-annotated-alist-only' here instead.) - (let ((ann (bookmark-get-annotation full-record))) - (when (and ann (not (string-equal ann ""))) - (insert (concat (bmkp-bookmark-name-from-record full-record) ":\n")) - (put-text-property (line-beginning-position 0) (line-end-position 0) 'face 'bmkp-heading) - (insert ann) (unless (bolp) (insert "\n\n"))))) - (goto-char (point-min)) - (view-mode-enter (cons (selected-window) (cons nil 'quit-window))) - (when (fboundp 'fit-frame-if-one-window) (fit-frame-if-one-window)))) - (select-frame-set-input-focus oframe))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Save menu-list state to `bmkp-bmenu-state-file'. -;; -(defun bookmark-exit-hook-internal () ; This goes on `kill-emacs-hook'. - "Save currently defined bookmarks and perhaps bookmark menu-list state. -Run `bookmark-exit-hook', then save bookmarks if they were updated. -Then save menu-list state to file `bmkp-bmenu-state-file', but only if -that option is non-nil." - (run-hooks 'bookmark-exit-hook) - (when (and bookmark-alist (bookmark-time-to-save-p t)) (bookmark-save)) - (bmkp-save-menu-list-state)) - -;;(@* "Bookmark+ Functions (`bmkp-*')") -;;; Bookmark+ Functions (`bmkp-*') ----------------------------------- - -(defun bmkp-new-bookmark-default-names (&optional first-def) - "Return a list of default names (strings) for a new bookmark. -A non-nil optional arg FIRST-DEF is prepended to the list of names -described below. - -If the region is active and non-empty, then the first default name -\(other than FIRST-DEF) is the current buffer name followed by \": \" -and the region prefix (up to `bmkp-bookmark-name-length-max' chars). -The other names are as described below. - -Uses option `bmkp-new-bookmark-default-names' to come up with the -other names. To these names, `bookmark-current-bookmark' and -`bookmark-buffer-name' are appened, if available (non-nil). - -NOTE: For Emacs versions prior to Emacs 23, return only a single -default name, not a list of names. The name is the first in the list -of names described above for Emacs 23+." - (let ((defs (and first-def (list first-def))) - val) - (unless (and (< emacs-major-version 23) defs) ; Just use FIRST-DEF for Emacs < 23. - ;; If region is active, first default is its text, with buffer name prepended. - (when (and transient-mark-mode mark-active (not (eq (mark) (point)))) - (let* ((regname (concat (buffer-name) ": " (buffer-substring (region-beginning) (region-end)))) - (defname (bmkp-replace-regexp-in-string - "\n" " " - (progn (save-excursion (goto-char (region-beginning)) - (skip-chars-forward " ") - (setq bookmark-yank-point (point))) - (substring regname 0 (min bmkp-bookmark-name-length-max - (length regname))))))) - (if (< emacs-major-version 23) - (setq defs defname) - (add-to-list 'defs defname)))) - ;; Names provided by option `bmkp-new-bookmark-default-names', - ;; plus `bookmark-current-bookmark' and `bookmark-buffer-name'. - (unless (and (< emacs-major-version 23) defs) - (catch 'bmkp-new-bookmark-default-names - (dolist (fn bmkp-new-bookmark-default-names) - (when (functionp fn) ; Be sure it is defined and is a function. - (setq val (funcall fn)) - (when (and (stringp val) (not (string= "" val))) - (setq val (bmkp-replace-regexp-in-string "\n" " " val)) - (if (> emacs-major-version 22) - (add-to-list 'defs val) - (throw 'bmkp-new-bookmark-default-names (setq defs val))))))) - (when (and (< emacs-major-version 23) (null defs)) - (setq defs (or bookmark-current-bookmark (bookmark-buffer-name)))) - (when (consp defs) - (when bookmark-current-bookmark (push bookmark-current-bookmark defs)) - (let ((buf (bookmark-buffer-name))) (when buf (push buf defs))) - (setq defs (nreverse defs))))) - defs)) - -(defun bmkp-bookmark-record-from-name (bookmark-name &optional noerror memp alist) - "Return the full bookmark (record) that corresponds to BOOKMARK-NAME. -BOOKMARK-NAME must be a string. If it has non-nil text property -`bmkp-full-record' then use that. Otherwise, look for the first -bookmark in ALIST that has the given name. - -Non-nil optional arg NOERROR means return nil if BOOKMARK-NAME does -not name a valid bookmark or is valid but is not in ALIST. If NOERROR -is nil then raise an error in this case. - -Non-nil optional arg MEMP means that if property `bmkp-full-record' is -available then look up its value (the full bookmark) in ALIST, testing -with `eq'. If that record is not in ALIST, return nil. - -Optional arg ALIST defaults to `bookmark-alist'." - (unless alist (setq alist bookmark-alist)) - (let ((full (get-text-property 0 'bmkp-full-record bookmark-name))) - (or (and full - (or (not memp) (memq full alist)) - full) - ;; Punt: return first matching bookmark in ALIST. - (if (fboundp 'assoc-string) ; Emacs 22+. Use `assoc-string' for its CASE-FOLD arg. - (assoc-string bookmark-name alist bookmark-completion-ignore-case) - (assoc bookmark-name alist)) - (and (not noerror) (error "No such bookmark in bookmark list: `%s'" bookmark-name))))) - -(defun bmkp-rename-for-marked-and-omitted-lists (old new) - "Replace OLD bookmark name with NEW in marked and omitted lists." - (when (bmkp-marked-bookmark-p old) - (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list old - bmkp-bmenu-marked-bookmarks)) - (push new bmkp-bmenu-marked-bookmarks)) - (when (bmkp-omitted-bookmark-p old) - (setq bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list old - bmkp-bmenu-omitted-bookmarks)) - (push new bmkp-bmenu-omitted-bookmarks))) - -(defun bmkp-get-bookmark-in-alist (bookmark &optional noerror alist) - "Return the full bookmark in ALIST that corresponds to BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. - -Non-nil optional arg NOERROR means return nil if BOOKMARK does not -represent a valid bookmark or is valid but is not in ALIST. If -NOERROR is nil then raise an error in this case. - -Optional arg ALIST defaults to `bookmark-alist'. - -Bookmark membership in ALIST is tested using `eq'. - -If BOOKMARK is a bookmark name instead of a full bookmark then return -what `bmkp-bookmark-record-from-name' with non-nil arg MEMP returns. - -This function is like `bookmark-get-bookmark', except that -`bookmark-get-bookmark' tests whether BOOKMARK is in `bookmark-alist' -only when it is a string (a bookmark name, not a full bookmark). When -BOOKMARK is a full bookmark `bookmark-get-bookmark' is thus not a test -for its existence, as is `bmkp-get-bookmark-in-alist'." - (cond ((consp bookmark) (and (memq bookmark bookmark-alist) bookmark)) - ((stringp bookmark) (bmkp-bookmark-record-from-name bookmark noerror 'MEMP)) - (t (and (not noerror) (error "Invalid bookmark: `%s'" bookmark))))) - -(defun bmkp-default-bookmark-file () - "`bmkp-last-as-first-bookmark-file', or `bookmark-default-file' if nil." - (or bmkp-last-as-first-bookmark-file bookmark-default-file)) - -(defun bmkp-completing-read-lax (prompt &optional default alist pred hist) - "Read a bookmark name, prompting with PROMPT. -Like `bookmark-completing-read', but completion is lax: your input -need not match any existing bookmark name. - -In addition: - * You can use `SPC' and `?' freely when typing the name. - * You can use `C-M-w' repeatedly to yank consecutive words from the - current buffer (see `bookmark-yank-word')." - (let ((orig-C-M-w (lookup-key minibuffer-local-completion-map (kbd "C-M-w"))) - (orig-C-M-u (lookup-key minibuffer-local-completion-map (kbd "C-M-u"))) - (orig-SPC (lookup-key minibuffer-local-completion-map (kbd "SPC"))) - (orig-qmark (lookup-key minibuffer-local-completion-map (kbd "?")))) - (unwind-protect - (progn (define-key minibuffer-local-completion-map (kbd "C-M-w") 'bookmark-yank-word) - (define-key minibuffer-local-completion-map (kbd "C-M-u") 'bookmark-insert-current-bookmark) - (unless (and (boundp 'icicle-mode) icicle-mode - (eq orig-SPC 'icicle-self-insert)) - (define-key minibuffer-local-completion-map (kbd "SPC") 'self-insert-command)) - (unless (and (boundp 'icicle-mode) icicle-mode - (eq orig-qmark 'icicle-self-insert)) - (define-key minibuffer-local-completion-map (kbd "?") 'self-insert-command)) - (bmkp-completing-read-1 prompt default alist pred hist t)) - (define-key minibuffer-local-completion-map (kbd "C-M-w") orig-C-M-w) - (define-key minibuffer-local-completion-map (kbd "C-M-u") orig-C-M-u) - (define-key minibuffer-local-completion-map (kbd "SPC") orig-SPC) - (define-key minibuffer-local-completion-map (kbd "?") orig-qmark)))) - -(defun bmkp-completing-read-1 (prompt default alist pred hist laxp) - "Helper for `bookmark-completing-read(-lax)'. -LAXP non-nil means use lax completion." - (bookmark-maybe-load-default-file) - (setq alist (or alist bookmark-alist)) - (if (and (not laxp) - (listp last-nonmenu-event) - (or (eq t bmkp-menu-popup-max-length) - (and (integerp bmkp-menu-popup-max-length) - (< (length alist) bmkp-menu-popup-max-length)))) - (bookmark-menu-popup-paned-menu - t prompt - (if bmkp-sort-comparer ; Test whether to sort, but always use `string-lessp'. - (sort (bookmark-all-names alist) 'string-lessp) - (bookmark-all-names alist))) - (let* ((icicle-delete-candidate-object (lambda (cand) ; For `S-delete' in Icicles. - (bookmark-delete - (icicle-transform-multi-completion cand)))) - (completion-ignore-case bookmark-completion-ignore-case) - (default default) - (prompt (if default - (concat prompt - (format " (%s): " - (if (consp default) (car default) default) - default)) - (concat prompt ": "))) - (str (completing-read prompt alist pred (not laxp) nil - (or hist 'bookmark-history) default))) - (when (consp default) (setq default (car default))) ; Emacs 23+ - (if (and (string-equal "" str) default) default str)))) - -(defun bmkp-jump-1 (bookmark display-function use-region-p) - "Helper function for `bookmark-jump' commands. -BOOKMARK is a bookmark name or a bookmark record. -DISPLAY-FUNCTION is passed to `bookmark--jump-via'. -Non-nil USE-REGION-P means activate the region, if recorded." - (setq bookmark (bookmark-get-bookmark bookmark 'NOERROR)) - (unless bookmark (error "No bookmark specified")) - (bookmark-maybe-historicize-string (bmkp-bookmark-name-from-record bookmark)) - (let ((bmkp-use-region (if use-region-p (not bmkp-use-region) bmkp-use-region))) - (bookmark--jump-via bookmark display-function))) - -(defun bmkp-select-buffer-other-window (buffer) - "Select BUFFER in another window. -If `bmkp-other-window-pop-to-flag' is non-nil, then use -`pop-to-buffer'. Otherwise, use `switch-to-buffer-other-window'." - (if bmkp-other-window-pop-to-flag - (pop-to-buffer buffer t) - (switch-to-buffer-other-window buffer))) - -(defun bmkp-maybe-save-bookmarks (&optional same-count-p) - "Increment save counter and maybe save `bookmark-alist'. -Non-nil optional arg SAME-COUNT-P means do not increment -`bookmark-alist-modification-count'." - (unless same-count-p (setq bookmark-alist-modification-count (1+ bookmark-alist-modification-count))) - (when (bookmark-time-to-save-p) (bookmark-save))) - -;;;###autoload -(defun bmkp-edit-bookmark-name-and-file (bookmark &optional edit-record-p) - ; Bound to `C-x p r' (`r' in bookmark list) - "Edit BOOKMARK's name and file name, and maybe save them. -Return a list of the new bookmark name and new file name. -BOOKMARK is a bookmark name or a bookmark record. - -Without a prefix arg, you are prompted for the new bookmark name and - the new file name. When entering the new name you can use completion - against existing names. This completion is lax, so you can easily - edit an existing name. See `bookmark-set' for particular keys -available during this input. - -With a prefix arg, edit the complete bookmark record (the - internal, Lisp form)." - (interactive - (list (bookmark-completing-read - (concat "Edit " (and current-prefix-arg "internal record for ") "bookmark") - (bmkp-default-bookmark-name)) - current-prefix-arg)) - (setq bookmark (bmkp-get-bookmark-in-alist bookmark)) - (if edit-record-p - (bmkp-edit-bookmark-record bookmark) - (let* ((bookmark-name (bmkp-bookmark-name-from-record bookmark)) - (bookmark-filename (bookmark-get-filename bookmark-name)) - (new-bmk-name (bmkp-completing-read-lax - "New bookmark name: " bookmark-name)) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (new-filename (read-file-name - "New file name (location): " - (and bookmark-filename - (file-name-directory bookmark-filename)) - bookmark-filename)) - (changed-bmk-name-p (and (not (equal new-bmk-name "")) - (not (equal new-bmk-name bookmark-name)))) - (changed-filename-p (and (not (equal new-filename "")) - (not (equal new-filename bookmark-filename))))) - - - (when (or changed-bmk-name-p changed-filename-p) - (when changed-bmk-name-p (bookmark-rename bookmark-name new-bmk-name 'BATCHP)) - (when changed-filename-p (bookmark-set-filename new-bmk-name new-filename)) - ;; Change location for Dired too, but not if different from original file name (e.g. a cons). - (let ((dired-dir (bookmark-prop-get new-bmk-name 'dired-directory))) - (when (and dired-dir (equal dired-dir bookmark-filename)) - (bookmark-prop-set new-bmk-name 'dired-directory new-filename))) - (bmkp-maybe-save-bookmarks) ; Maybe save automatically. - (when (and bookmark-alist-modification-count ; Did not save automatically. Ask user. - (y-or-n-p "Save changes? ")) - (bookmark-save)) - (list new-bmk-name new-filename))))) - -(define-derived-mode bmkp-edit-bookmark-records-mode emacs-lisp-mode - "Edit Bookmark Records" - "Mode for editing a list of bookmark records, as in `bookmark-alist'. -When you have finished editing, use `\\[bmkp-edit-bookmark-record-send]'." - :group 'bookmark-plus) - -;; This binding must be defined *after* the mode, so `bmkp-edit-bookmark-records-mode-map' is defined. -;; (Alternatively, we could use a `defvar' to define `bmkp-edit-bookmark-records-mode-map' before -;; calling `define-derived-mode'.) -(define-key bmkp-edit-bookmark-records-mode-map "\C-c\C-c" 'bmkp-edit-bookmark-records-send) - -(defvar bmkp-edit-bookmark-records-number 0 - "NUmber of bookmard records being edited.") - -;;;###autoload -(defun bmkp-edit-bookmark-records-send (&optional msg-p) ; Bound to `C-c C-c' in records-editing buffer. - "Update `bookmark-alist' with buffer contents: a bookmark alist. -Lines beginning with `;;' are ignored. -Non-interactively, optional arg MSG-P means display progress messages. - -This assumes that the bookmarks in the buffer are the marked bookmarks -in `*Bookmark List*'. That is, it assumes that the buffer was created -by `bmkp-bmenu-edit-marked' (`\\\\[bmkp-bmenu-edit-marked]' in `*Bookmark List*')." - (interactive "p") - (unless (eq major-mode 'bmkp-edit-bookmark-records-mode) - (error "Not in `bmkp-edit-bookmark-records-mode'")) - (when msg-p (message "Reading edited bookmarks...")) - (let ((editbuf (current-buffer)) - (read-error-msg - (catch 'bmkp-edit-bookmark-records-send - (let ((edited-bookmarks (condition-case err - (save-excursion (goto-char (point-min)) (read (current-buffer))) - (error (throw 'bmkp-edit-bookmark-records-send - (error-message-string err))))) - (orig-bmks (bmkp-marked-bookmarks-only)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save only after `dolist'. - (cond ((not (listp edited-bookmarks)) - (throw 'bmkp-edit-bookmark-records-send "Not a list of bookmarks")) - ((not (= (length edited-bookmarks) bmkp-edit-bookmark-records-number)) - (throw 'bmkp-edit-bookmark-records-send - (format "Need %d bookmarks, but there seem to be %d" - bmkp-edit-bookmark-records-number (length edited-bookmarks))))) - (dolist (edited-bmk edited-bookmarks) - (unless (and (consp edited-bmk) (stringp (car edited-bmk))) ; Sanity check. - (throw 'bmkp-edit-bookmark-records-send (format "Invalid bookmark: `%s'" edited-bmk))) - (let ((bname (bmkp-bookmark-name-from-record edited-bmk)) - (data (bmkp-bookmark-data-from-record edited-bmk))) - ;; Put the full bookmark on its name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (put-text-property 0 (length bname) 'bmkp-full-record edited-bmk bname) - ;; Update the original bookmark (same cons cell) with what's in the edited version. - (setcar (car orig-bmks) bname) - (setcdr (car orig-bmks) data) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq (car orig-bmks) bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons (car orig-bmks) bmkp-modified-bookmarks))) - (setq orig-bmks (cdr orig-bmks)))) - ;; Update using modified ORIG-BMKS. - (setq bmkp-bmenu-marked-bookmarks (mapcar #'bmkp-bookmark-name-from-record - bmkp-modified-bookmarks) - bmkp-sorted-alist (bmkp-sort-omit bookmark-alist) - bookmark-alist-modification-count (1+ bookmark-alist-modification-count))) - nil))) - (if (stringp read-error-msg) - (if msg-p (message "%s --> edit and try again" read-error-msg) (error read-error-msg)) - (when (get-buffer editbuf) (kill-buffer editbuf)) - (bmkp-refresh/rebuild-menu-list nil (not msg-p))))) - -(define-derived-mode bmkp-edit-bookmark-record-mode emacs-lisp-mode - "Edit Bookmark Record" - "Mode for editing an internal bookmark record. -When you have finished editing, use `\\[bmkp-edit-bookmark-record-send]'." - :group 'bookmark-plus) - -;; This binding must be defined *after* the mode, so `bmkp-edit-bookmark-record-mode-map' is defined. -;; (Alternatively, we could use a `defvar' to define `bmkp-edit-bookmark-record-mode-map' before -;; calling `define-derived-mode'.) -(define-key bmkp-edit-bookmark-record-mode-map "\C-c\C-c" 'bmkp-edit-bookmark-record-send) - -;;;###autoload -(defun bmkp-edit-bookmark-record (bookmark) ; Bound to `C-x p e'. - "Edit the full record (the Lisp sexp) for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -When you finish editing, use `\\[bmkp-edit-bookmark-record-send]'. -The current bookmark list is then updated to reflect your edits." - (interactive (list (bookmark-completing-read "Edit Lisp record for bookmark:" - (bmkp-default-bookmark-name)))) - (bookmark-maybe-load-default-file) - (setq bmkp-edit-bookmark-orig-record (bmkp-get-bookmark-in-alist bookmark)) - (let* ((bmk-copy (copy-sequence bmkp-edit-bookmark-orig-record)) ; Shallow copy - (bname (bmkp-bookmark-name-from-record bmk-copy)) - (bufname (format "*Edit Record for Bookmark `%s'*" bname))) - (set-text-properties 0 (length bname) nil bname) ; Strip properties from (copied) name string. - (bookmark-maybe-historicize-string bname) - (bmkp-with-output-to-plain-temp-buffer bufname - (princ - (substitute-command-keys - (concat ";; Edit the Lisp record for bookmark\n;;\n" - ";; `" bname "'\n;;\n" - ";; Type \\\ -`\\[bmkp-edit-bookmark-record-send]' when done.\n;;\n"))) - ;; (let ((print-circle t)) (pp bmk)) ; $$$$$$ Binding should not really be needed now. - (pp bmk-copy) - (goto-char (point-min))) - (pop-to-buffer bufname) - (buffer-enable-undo) - (with-current-buffer (get-buffer bufname) (bmkp-edit-bookmark-record-mode)))) - -;;;###autoload -(defun bmkp-edit-bookmark-record-send (&optional msg-p) ; Bound to `C-c C-c' in record-editing buffer. - "Update `bookmark-alist' with buffer contents: a bookmark record. -Lines beginning with `;;' are ignored. -Non-interactively, optional arg MSG-P means display progress messages." - (interactive "p") - (unless (eq major-mode 'bmkp-edit-bookmark-record-mode) - (error "Not in `bmkp-edit-bookmark-record-mode'")) - (when msg-p (message "Reading edited bookmark...")) - (let* ((editbuf (current-buffer)) - (bmk-name nil) - (read-error-msg - (catch 'bmkp-edit-bookmark-record-send - (let ((edited-bmk - (condition-case err - (save-excursion (goto-char (point-min)) (read (current-buffer))) - (error (throw 'bmkp-edit-bookmark-record-send (error-message-string err)))))) - (unless (and (consp edited-bmk) (stringp (car edited-bmk))) - (throw 'bmkp-edit-bookmark-record-send (format "Invalid bookmark: `%s'" edited-bmk))) - (let ((bname (bmkp-bookmark-name-from-record edited-bmk)) - (data (bmkp-bookmark-data-from-record edited-bmk))) - ;; Put the full bookmark on its name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (put-text-property 0 (length bname) 'bmkp-full-record edited-bmk bname) - ;; Update the original bookmark with what's in the edited version. - (setcar bmkp-edit-bookmark-orig-record bname) - (setcdr bmkp-edit-bookmark-orig-record data) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bmkp-edit-bookmark-orig-record bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons bmkp-edit-bookmark-orig-record - bmkp-modified-bookmarks))) - (setq bmk-name bname)) ; Save for bookmark-list display, below. - (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist) - bookmark-alist-modification-count (1+ bookmark-alist-modification-count))) - nil))) - (if (stringp read-error-msg) - (if msg-p - (message "%s --> edit and try again" read-error-msg) - (error read-error-msg)) - (when (get-buffer editbuf) (kill-buffer editbuf)) - (bmkp-refresh/rebuild-menu-list bmk-name (not msg-p)))) - (setq bmkp-edit-bookmark-orig-record nil)) ; Reset it. - -(define-derived-mode bmkp-edit-tags-mode emacs-lisp-mode - "Edit Bookmark Tags" - "Mode for editing bookmark tags. -When you have finished composing, type \\[bmkp-edit-tags-send]." - :group 'bookmark-plus) - -;; This binding must be defined *after* the mode, so `bmkp-edit-tags-mode-map' is defined. -;; (Alternatively, we could use a `defvar' to define `bmkp-edit-tags-mode-map' before -;; calling `define-derived-mode'.) -(define-key bmkp-edit-tags-mode-map "\C-c\C-c" 'bmkp-edit-tags-send) - -;;;###autoload -(defun bmkp-edit-tags (bookmark) ; Bound to `C-x p t e' - "Edit BOOKMARK's tags, and maybe save the result. -The edited value must be a list each of whose elements is either a - string or a cons whose key is a string. -BOOKMARK is a bookmark name or a bookmark record." - (interactive (list (bookmark-completing-read "Edit tags for bookmark" (bmkp-default-bookmark-name)))) - (setq bookmark (bmkp-get-bookmark-in-alist bookmark)) - (let* ((btags (bmkp-get-tags bookmark)) - (bmkname (bmkp-bookmark-name-from-record bookmark)) - (edbuf (format "*Edit Tags for Bookmark `%s'*" bmkname))) - (setq bmkp-return-buffer (current-buffer)) - (bmkp-with-output-to-plain-temp-buffer edbuf - (princ - (substitute-command-keys - (concat ";; Edit tags for bookmark\n;;\n;; \"" bmkname "\"\n;;\n" - ";; The edited value must be a list each of whose elements is\n" - ";; either a string or a cons whose key is a string.\n;;\n" - ";; DO NOT MODIFY THESE COMMENTS.\n;;\n" - ";; Type \\`\\[bmkp-edit-tags-send]' when done.\n\n"))) - (let ((print-circle t)) (pp btags)) - (goto-char (point-min))) - (pop-to-buffer edbuf) - (buffer-enable-undo) - (with-current-buffer (get-buffer edbuf) (bmkp-edit-tags-mode)))) - -;;;###autoload -(defun bmkp-edit-tags-send (&optional batchp) - "Use buffer contents as the internal form of a bookmark's tags. -DO NOT MODIFY the header comment lines, which begin with `;;'." - (interactive) - (unless (eq major-mode 'bmkp-edit-tags-mode) (error "Not in `bmkp-edit-tags-mode'")) - (let (bname) - (unwind-protect - (let (tags bmk) - (goto-char (point-min)) - (unless (search-forward ";; Edit tags for bookmark\n;;\n;; ") - (error "Missing header in edit buffer")) - (unless (stringp (setq bname (read (current-buffer)))) - (error "Bad bookmark name in edit-buffer header")) - (unless (setq bmk (bmkp-get-bookmark-in-alist bname 'NOERROR)) - (error "No such bookmark: `%s'" bname)) - (unless (bmkp-bookmark-type bmk) (error "Invalid bookmark")) - (goto-char (point-min)) - (setq tags (read (current-buffer))) - (unless (listp tags) (error "Tags sexp is not a list of strings or an alist with string keys")) - (bookmark-prop-set bmk 'tags tags) - (setq bname (bmkp-bookmark-name-from-record bmk)) - (bmkp-record-visit bmk batchp) - (bmkp-refresh/rebuild-menu-list bname batchp) - (bmkp-maybe-save-bookmarks) - (unless batchp (message "Updated bookmark file with edited tags"))) - (kill-buffer (current-buffer))) - (when bmkp-return-buffer - (pop-to-buffer bmkp-return-buffer) - (when (equal (buffer-name (current-buffer)) "*Bookmark List*") - (bmkp-bmenu-goto-bookmark-named bname))))) - -(defun bmkp-bookmark-type (bookmark) - "Return the type of BOOKMARK or nil if no type is recognized. -Return nil if the bookmark record is not recognized (invalid). -See the code for the possible non-nil return values. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (condition-case nil - (progn - ;; If BOOKMARK is already a bookmark record, not a bookmark name, then we must use it. - ;; If we used the name instead, then tests such as `bookmark-get-filename' would fail, - ;; because they call `bookmark-get-bookmark', which, for a string, checks whether the - ;; bookmark exists in `bookmark-alist'. But we want to be able to use `bmkp-bookmark-type' - ;; to get the type of any bookmark record, not necessarily one that is in `bookmark-alist'. - (when (stringp bookmark) (setq bookmark (bookmark-get-bookmark bookmark))) - (let ((filep (bookmark-get-filename bookmark))) - (cond ((bmkp-sequence-bookmark-p bookmark) 'bmkp-sequence-bookmark-p) - ((bmkp-function-bookmark-p bookmark) 'bmkp-function-bookmark-p) - ((bmkp-variable-list-bookmark-p bookmark) 'bmkp-variable-list-bookmark-p) - ((bmkp-url-bookmark-p bookmark) 'bmkp-url-bookmark-p) - ((bmkp-gnus-bookmark-p bookmark) 'bmkp-gnus-bookmark-p) - ((bmkp-desktop-bookmark-p bookmark) 'bmkp-desktop-bookmark-p) - ((bmkp-bookmark-file-bookmark-p bookmark) 'bmkp-bookmark-file-bookmark-p) - ((bmkp-bookmark-list-bookmark-p bookmark) 'bmkp-bookmark-list-bookmark-p) - ((bmkp-man-bookmark-p bookmark) 'bmkp-man-bookmark-p) - ((bmkp-info-bookmark-p bookmark) 'bmkp-info-bookmark-p) - ((bookmark-get-handler bookmark) 'bookmark-get-handler) - ((bmkp-region-bookmark-p bookmark) 'bmkp-region-bookmark-p) - ;; Make sure we test for remoteness before any other tests of the file itself - ;; (e.g. `file-exists-p'). We do not want to prompt for a password etc. - ((and filep (bmkp-file-remote-p filep)) 'remote-file) - ((and filep (file-directory-p filep)) 'local-directory) - (filep 'local-file) - ((and (bmkp-get-buffer-name bookmark) - (or (not filep) - (equal filep bmkp-non-file-filename))) 'buffer) - (t nil)))) - (error nil))) - -(defun bmkp-record-visit (bookmark &optional batchp) - "Update the data recording a visit to BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -This increments the `visits' entry and sets the `time' entry to the -current time. If either an entry is not present, it is added (with 0 -value for `visits'). -With non-nil optional arg BATCHP, do not rebuild the menu list. - -Although this function modifies BOOKMARK, it does not increment -`bookmark-alist-modification-count', and it does not add BOOKMARK to -`bmkp-modified-bookmarks'. This is so that simply recording the visit -does not count toward needing to save or showing BOOKMARK as modified." - (let ((vis (bookmark-prop-get bookmark 'visits)) - (bmkp-modified-bookmarks bmkp-modified-bookmarks)) - (if vis (bookmark-prop-set bookmark 'visits (1+ vis)) (bookmark-prop-set bookmark 'visits 0)) - (bookmark-prop-set bookmark 'time (current-time)) - (unless batchp (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)) - (let ((bookmark-save-flag nil)) (bmkp-maybe-save-bookmarks 'SAME-COUNT-P)))) - -(defun bmkp-default-bookmark-name (&optional alist) - "Default bookmark name. See option `bmkp-default-bookmark-name'. -Non-nil ALIST means return nil unless the default names a bookmark in -ALIST." - (let ((bname (if (equal (buffer-name (current-buffer)) "*Bookmark List*") - (bookmark-bmenu-bookmark) - (if (fboundp 'bmkp-default-lighted) - (if (eq 'highlighted bmkp-default-bookmark-name) - (or (bmkp-default-lighted) bookmark-current-bookmark) - (or bookmark-current-bookmark (bmkp-default-lighted))) - bookmark-current-bookmark)))) - (when (and bname alist) - (setq bname (bmkp-bookmark-name-from-record (bmkp-bookmark-record-from-name - bname 'NOERROR 'MEMP alist)))) - bname)) - -(defun bmkp-buffer-names () - "Buffer names used by existing bookmarks that really have buffers. -This excludes buffers for bookmarks such as desktops that are not -really associated with a buffer." - (let ((bufs ()) - buf) - (dolist (bmk bookmark-alist) - (when (and (not (bmkp-desktop-bookmark-p bmk)) - (not (bmkp-bookmark-file-bookmark-p bmk)) - (not (bmkp-sequence-bookmark-p bmk)) - (not (bmkp-function-bookmark-p bmk)) - (not (bmkp-variable-list-bookmark-p bmk)) - (setq buf (bmkp-get-buffer-name bmk))) - (add-to-list 'bufs buf))) - bufs)) - -(defun bmkp-file-names () - "The absolute file names used by the existing bookmarks. -This excludes the pseudo file name `bmkp-non-file-filename'." - (let ((files ()) - file) - (dolist (bmk bookmark-alist) - (when (and (setq file (bookmark-get-filename bmk)) (not (equal file bmkp-non-file-filename))) - (add-to-list 'files file))) - files)) - -;;;###autoload -(defun bmkp-send-bug-report () ; Not bound - "Send a bug report about a Bookmark+ problem." - (interactive) - (browse-url (format (concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ -Bookmark+ bug: \ -&body=Describe bug below, using a precise recipe that starts with `emacs -Q' or `emacs -q'. \ -Be sure to mention the `Update #' from header of the particular Bookmark+ file header.\ -%%0A%%0AEmacs version: %s") - (emacs-version)))) - -;;;###autoload -(defun bmkp-toggle-bookmark-set-refreshes () ; Not bound - "Toggle `bookmark-set' refreshing `bmkp-latest-bookmark-alist'. -Add/remove `bmkp-refresh-latest-bookmark-list' to/from -`bmkp-after-set-hook'." - (interactive) - (if (member 'bmkp-refresh-latest-bookmark-list bmkp-after-set-hook) - (remove-hook 'bmkp-after-set-hook 'bmkp-refresh-latest-bookmark-list) - (add-hook 'bmkp-after-set-hook 'bmkp-refresh-latest-bookmark-list))) - -(defun bmkp-refresh-latest-bookmark-list () - "Refresh `bmkp-latest-bookmark-alist' to reflect `bookmark-alist'." - (setq bmkp-latest-bookmark-alist (if bmkp-bmenu-filter-function - (funcall bmkp-bmenu-filter-function) - bookmark-alist))) - -;;;###autoload -(defun bmkp-toggle-saving-menu-list-state () ; Bound to `C-M-~' in bookmark list - "Toggle the value of option `bmkp-bmenu-state-file'. -Tip: You can use this before quitting Emacs, to not save the state. -If the initial value of `bmkp-bmenu-state-file' is nil, then this -command has no effect." - (interactive) - (unless (or bmkp-last-bmenu-state-file bmkp-bmenu-state-file) - (error "Cannot toggle: initial value of `bmkp-bmenu-state-file' is nil")) - (setq bmkp-last-bmenu-state-file (prog1 bmkp-bmenu-state-file - (setq bmkp-bmenu-state-file bmkp-last-bmenu-state-file))) - (message (if bmkp-bmenu-state-file - "Autosaving of bookmark list state is now ON" - "Autosaving of bookmark list state is now OFF"))) - -;;;###autoload -(defun bmkp-save-menu-list-state (&optional msg-p) ; Used in `bookmark-exit-hook-internal'. - "Save menu-list state, unless not saving or list has not yet been shown. -The state is saved to the value of `bmkp-bmenu-state-file'. -Non-interactively, optional arg MSG-P means display progress messages." - (interactive "p") - (when (and (not bmkp-bmenu-first-time-p) bmkp-bmenu-state-file) - (when msg-p (message "Saving bookmark-list display state...")) - (let ((config-list - `((last-sort-comparer . ,bmkp-sort-comparer) - (last-reverse-sort-p . ,bmkp-reverse-sort-p) - (last-reverse-multi-sort-p . ,bmkp-reverse-multi-sort-p) - (last-latest-bookmark-alist . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-latest-bookmark-alist)) - (last-bmenu-omitted-bookmarks . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-omitted-bookmarks)) - (last-bmenu-marked-bookmarks . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-marked-bookmarks)) - (last-bmenu-filter-function . ,bmkp-bmenu-filter-function) - (last-bmenu-filter-pattern . ,bmkp-bmenu-filter-pattern) - (last-bmenu-title . ,bmkp-bmenu-title) - (last-bmenu-bookmark . ,(and (get-buffer "*Bookmark List*") - (with-current-buffer - (get-buffer "*Bookmark List*") - (bookmark-bmenu-bookmark)))) - (last-specific-buffer . ,bmkp-last-specific-buffer) - (last-specific-file . ,bmkp-last-specific-file) - (last-bmenu-toggle-filenames . ,bookmark-bmenu-toggle-filenames) - (last-bmenu-before-hide-marked-alist . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-before-hide-marked-alist)) - (last-bmenu-before-hide-unmarked-alist . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-before-hide-unmarked-alist)) - (last-bookmark-file . ,(convert-standard-filename - (expand-file-name - bmkp-current-bookmark-file)))))) - (with-current-buffer (get-buffer-create " *Menu-List State*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil) - (print-circle t)) - (pp config-list (current-buffer))) - (condition-case nil - (write-region (point-min) (point-max) bmkp-bmenu-state-file) - (file-error (message "Cannot write `%s'" bmkp-bmenu-state-file))) - (kill-buffer (current-buffer))) - (when msg-p (message "Saving bookmark-list display state...done"))))) - -;;;###autoload -(defun bmkp-toggle-saving-bookmark-file (&optional msg-p) ; Bound to `M-~' in bookmark list - "Toggle the value of option `bookmark-save-flag'. -If the initial value of `bookmark-save-flag' is nil, then this -command has no effect. -Non-interactively, non-nil MSG-P means display a status message." - (interactive "p") - (unless (or bmkp-last-save-flag-value bookmark-save-flag) - (error "Cannot toggle: initial value of `bookmark-save-flag' is nil")) - (setq bmkp-last-save-flag-value (prog1 bookmark-save-flag - (setq bookmark-save-flag bmkp-last-save-flag-value))) - (when msg-p (message (if bookmark-save-flag - "Autosaving of current bookmark file is now ON" - "Autosaving of current bookmark file is now OFF")))) - -;;;###autoload -(defun bmkp-make-function-bookmark (bookmark-name function &optional msg-p) ; Not bound - "Create a bookmark that invokes FUNCTION when \"jumped\" to. -You are prompted for the bookmark name and the name of the function. -Interactively, you are prompted for the bookmark and the function. -Returns the new bookmark (internal record). - -Non-interactively, non-nil optional arg MSG-P means display a status -message." - (interactive - (let ((icicle-unpropertize-completion-result-flag t)) - (list (read-string "Bookmark: ") - (completing-read "Function: " obarray 'functionp) - t))) - (bookmark-store bookmark-name `((filename . ,bmkp-non-file-filename) - (position . 0) - (function . ,(read function)) - (handler . bmkp-jump-function)) - nil (not msg-p)) - (let ((new (bmkp-bookmark-record-from-name bookmark-name 'NOERROR))) - (unless (memq new bmkp-latest-bookmark-alist) - (setq bmkp-latest-bookmark-alist (cons new bmkp-latest-bookmark-alist))) - (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p)) - new)) - -;;;###autoload -(defun bmkp-revert-bookmark-file (&optional msg-p) ; Same as `C-u g' in bookmark list (but not bound). - "Revert to the bookmarks in the current bookmark file. -This discards all modifications to bookmarks and the bookmark list -\(e.g. added/deleted bookmarks). -This has the same effect as using `C-u \\\\[bmkp-bmenu-refresh-menu-list]' in \ -buffer `*Bookmark List*'. -Non-interactively, non-nil MSG-P means display a status message." - (interactive "p") - (if (and msg-p (not (yes-or-no-p (format "Revert to bookmarks saved in file `%s'? " - bmkp-current-bookmark-file)))) - (error "OK - canceled") - (bookmark-load bmkp-current-bookmark-file 'OVERWRITE msg-p) ; Do not let `bookmark-load' ask to save. - (bmkp-refresh/rebuild-menu-list nil (not msg-p)))) - -;;;###autoload -(defun bmkp-switch-bookmark-file (file &optional batchp) ; Not bound and not used in the code now. - "Switch to a different bookmark file, FILE. -Return FILE. Interactively, you are prompted for FILE. -Replace all bookmarks in the current bookmark list with those from the -newly loaded FILE. Bookmarks are subsequently saved to FILE. - -Optional arg BATCHP is passed to `bookmark-load'." - (interactive - (list (let* ((std-default (bmkp-default-bookmark-file)) - (default (if (bmkp-same-file-p bmkp-current-bookmark-file bmkp-last-bookmark-file) - (if (bmkp-same-file-p bmkp-current-bookmark-file std-default) - bookmark-default-file - std-default) - bmkp-last-bookmark-file))) - (bmkp-read-bookmark-file-name "Switch to bookmark file: " - (or (file-name-directory default) "~/") - default t)))) ; Require that the file exist. - (bookmark-load file t batchp)) ; Treat it interactively, if this command is called interactively. - -;;;###autoload -(defun bmkp-switch-to-last-bookmark-file (&optional batchp) ; Not bound to any key, by default - "Switch back to the last-used bookmark file. -Replace all currently existing bookmarks with those newly loaded from -the last-used file. Swap the values of `bmkp-last-bookmark-file' and -`bmkp-current-bookmark-file'. - -Optional arg BATCHP is passed to `bookmark-load'." - (interactive) - (bookmark-load (or bmkp-last-bookmark-file (bmkp-default-bookmark-file)) - t batchp)) ; Treat it interactively, if this command is called interactively. - -;;;###autoload -(defun bmkp-switch-bookmark-file-create (file &optional batchp) - ; Bound to `C-x p L', (`L' in bookmark list) - "Switch to bookmark file FILE, creating it as empty if it does not exist. -Return FILE. Interactively, you are prompted for FILE. -Replace all bookmarks in the current bookmark list with those from the -newly loaded FILE. Bookmarks are subsequently saved to FILE. - -If there is no file with the name you provide (FILE), then create a -new, empty bookmark file with that name and use that from now on. -This empties the bookmark list. Interactively, you are required to -confirm this. - -Non-nil BATCHP is passed to `bookmark-load'." - (interactive - (list (let* ((std-default (bmkp-default-bookmark-file)) - (default (if (bmkp-same-file-p bmkp-current-bookmark-file bmkp-last-bookmark-file) - (if (bmkp-same-file-p bmkp-current-bookmark-file std-default) - bookmark-default-file - std-default) - bmkp-last-bookmark-file))) - (bmkp-read-bookmark-file-name "Switch to bookmark file: " - (or (file-name-directory default) "~/") - default)))) - (let ((empty-p nil)) - (if (file-readable-p file) -;;; (if (or batchp (y-or-n-p (format "CONFIRM: `%s' as the current bookmark file? " file))) -;;; (bookmark-load file t batchp) -;;; (error "OK, canceled")) - (bookmark-load file t batchp) ; Treat it interactively, if this command is called interactively. - (setq empty-p t) - (if (and (not batchp) - (not (y-or-n-p (format "Create and use NEW, EMPTY bookmark file `%s'? " file)))) - (error "OK - canceled") - (bmkp-empty-file file) - (bookmark-load file t batchp))) ; Treat it interactively, if this command is called interactively. - (unless batchp (message "Bookmark file is now %s`%s'" (if empty-p "EMPTY file " "") file))) - file) - -(defun bmkp-read-bookmark-file-name (&optional prompt dir default-filename require-match) - "Read and return an (absolute) bookmark file name. -PROMPT is the prompt to use (default: \"Use bookmark file: \"). - -DEFAULT-FILENAME is as for `read-file-name', except if nil then the -default is `.emacs.bmk' in the current directory. Regardless what -DEFAULT-FILENAME is, you can enter any file name. - -The other args are the same as for `read-file-name'." - (let ((insert-default-directory t) - (icicle-unpropertize-completion-result-flag t)) ; For `read-file-name'. - (expand-file-name - (read-file-name (or prompt "Use bookmark file: ") dir (or default-filename - (if (> emacs-major-version 22) - (list ".emacs.bmk" bookmark-default-file) - ".emacs.bmk")) - require-match)))) - -;;;###autoload -(defun bmkp-empty-file (file &optional confirmp) ; Bound to `C-x p 0' - "Empty the bookmark file FILE, or create FILE (empty) if it does not exist. -In either case, FILE will become an empty bookmark file. Return FILE. - -NOTE: If FILE already exists and you confirm emptying it, no check is - made that it is in fact a bookmark file before emptying it. - It is simply replaced by an empty bookmark file and saved. - -This does NOT also make FILE the current bookmark file. To do that, -use `\\[bmkp-switch-bookmark-file-create]' (`bmkp-switch-bookmark-file-create')." - (interactive (list (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "Create empty bookmark file: " "~/")) - t)) - (setq file (expand-file-name file)) - (bookmark-maybe-load-default-file) - (when (and confirmp (file-exists-p file) - (not (y-or-n-p (format "CONFIRM: Empty the existing file `%s'? " file)))) - (error "OK - canceled")) - (let ((bookmark-alist ())) - (bookmark-write-file file (if (file-exists-p file) - "Emptying bookmark file `%s'..." - "Creating new, empty bookmark file `%s'..."))) - file) - -;;;###autoload -(defun bmkp-crosshairs-highlight () ; Not bound - "Call `crosshairs-highlight', unless the region is active. -You can add this to hook `bookmark-after-jump-hook'. -You need library `crosshairs.el' to use this command." - (interactive) - (when (> emacs-major-version 21) ; No-op for Emacs 20-21. - (unless (condition-case nil (require 'crosshairs nil t) (error nil)) - (error "You need library `crosshairs.el' to use this command")) - (unless mark-active - (let ((crosshairs-overlay-priority (and (boundp 'bmkp-light-priorities) - (1+ (apply #'max - (mapcar #'cdr bmkp-light-priorities)))))) - (crosshairs-highlight))))) - -;;;###autoload -(defun bmkp-choose-navlist-from-bookmark-list (bookmark-name &optional alist) ; Bound to `C-x p B' - "Choose a bookmark-list bookmark and set the bookmark navigation list. -The navigation-list variable, `bmkp-nav-alist', is set to the list of -bookmarks that would be displayed by `bookmark-bmenu-list' (`C-x r l') -for the chosen bookmark-list bookmark, sorted and filtered as -appropriate. - -Instead of choosing a bookmark-list bookmark, you can choose the -pseudo-bookmark `CURRENT *Bookmark List*'. The bookmarks used for the -navigation list are those that would be currently shown in the -`*Bookmark List*' (even if the list is not currently displayed)." - (interactive - (let ((bookmark-alist (cons (bmkp-current-bookmark-list-state) (bmkp-bookmark-list-alist-only)))) - (list (bmkp-read-bookmark-for-type "bookmark-list" bookmark-alist nil nil - 'bmkp-bookmark-list-history "Choose ") - bookmark-alist))) - (let ((state (let ((bookmark-alist (or alist (cons (bmkp-current-bookmark-list-state) - (bmkp-bookmark-list-alist-only))))) - (bookmark-prop-get bookmark-name 'bookmark-list)))) - (let ((bmkp-sort-comparer (cdr (assq 'last-sort-comparer state))) - (bmkp-reverse-sort-p (cdr (assq 'last-reverse-sort-p state))) - (bmkp-reverse-multi-sort-p (cdr (assq 'last-reverse-multi-sort-p state))) - (bmkp-bmenu-omitted-bookmarks (cdr (assq 'last-bmenu-omitted-bookmarks state))) - (bmkp-bmenu-filter-function (cdr (assq 'last-bmenu-filter-function state))) - (bmkp-bmenu-filter-pattern (or (cdr (assq 'last-bmenu-filter-pattern state)) "")) - (bmkp-bmenu-title (cdr (assq 'last-bmenu-title state))) - (bookmark-bmenu-toggle-filenames (cdr (assq 'last-bmenu-toggle-filenames state)))) - (setq bmkp-nav-alist (bmkp-sort-omit - (if bmkp-bmenu-filter-function - (funcall bmkp-bmenu-filter-function) - (if (string= "CURRENT *Bookmark List*" bookmark-name) - (or bmkp-latest-bookmark-alist bookmark-alist) - bookmark-alist)) - (and (not (eq bmkp-bmenu-filter-function - 'bmkp-omitted-alist-only)) - bmkp-bmenu-omitted-bookmarks)) - bmkp-current-nav-bookmark (car bmkp-nav-alist)))) - (message "Bookmark navigation list is now %s" - (if (and (string= "CURRENT *Bookmark List*" bookmark-name) - (not (get-buffer "*Bookmark List*"))) - "the global bookmark list" - (format "`%s'" bookmark-name)))) - -(defun bmkp-current-bookmark-list-state () - "Pseudo-bookmark for the current `*Bookmark List*' state." - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (cons "CURRENT *Bookmark List*" (bmkp-make-bookmark-list-record))) - -;;;###autoload -(defun bmkp-choose-navlist-of-type (type) ; Bound to `C-x p :' - "Set the bookmark navigation list to the bookmarks of a type you choose. -The pseudo-type `any' sets the navigation list to all bookmarks. -This sets variable `bmkp-nav-alist'." - (interactive - (let* ((completion-ignore-case t) - (icicle-unpropertize-completion-result-flag t) - (type (completing-read "Type: " - (cons '("any" . bookmark-history) - bmkp-types-alist) - nil t nil nil "any"))) - (list type))) - (setq bmkp-nav-alist (if (equal "any" type) - bookmark-alist - (funcall (intern (format "bmkp-%s-alist-only" type))))) - (unless bmkp-nav-alist (error "No bookmarks")) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist)) - (message "Bookmark navigation list is now %s" - (if (equal "any" type) "all bookmarks" (format "for type `%s'" type)))) - -(defun bmkp-autonamed-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an autonamed bookmark. -BOOKMARK is a bookmark name or a bookmark record." - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (string-match (format bmkp-autoname-format ".*") bookmark)) - -(defun bmkp-autonamed-this-buffer-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an autonamed bookmark for this buffer." - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (and (bmkp-autonamed-bookmark-p bookmark) (bmkp-this-buffer-p bookmark))) - -(defun bmkp-autonamed-bookmark-for-buffer-p (bookmark buffer-name) - "Return non-nil if BOOKMARK is an autonamed bookmark for BUFFER. -BOOKMARK is a bookmark name or a bookmark record. -BUFFER-NAME is a string matching the buffer-name part of an autoname. -This does not check the `buffer-name' entry of BOOKMARK. It checks -only the buffer indicated by the bookmark name." - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (string-match (format bmkp-autoname-format (regexp-quote buffer-name)) bookmark)) - -(defun bmkp-update-autonamed-bookmark (bookmark) - "Update the name and position of the autonamed BOOKMARK at point. -Return the updated BOOKMARK: If input was a bookmark name, then return - then new name, else the new (full) bookmark. -It is a good idea to set BOOKMARK to the result of this call. -BOOKMARK is a bookmark name or a bookmark record." - (let ((namep (stringp bookmark))) - (setq bookmark (bookmark-get-bookmark bookmark)) - (bookmark-set-position bookmark (point)) - ;; Autonamed bookmarks do not have regions. Update `end-position' to be the same as `position'. - (when (bmkp-get-end-position bookmark) - (bookmark-prop-set bookmark 'end-position (point))) - (let ((newname (funcall bmkp-autoname-bookmark-function (point)))) - (bookmark-rename (bmkp-bookmark-name-from-record bookmark) newname 'BATCHP) - (bmkp-refresh/rebuild-menu-list (bmkp-bookmark-name-from-record bookmark)) ; So display new name. - (bmkp-maybe-save-bookmarks)) - (if namep (bmkp-bookmark-name-from-record bookmark) bookmark))) ; Return updated bookmark or name. - -;;;###autoload -(defun bmkp-this-file/buffer-bmenu-list () ; Bound to `C-x p ,' - "Show the bookmark list just for bookmarks for the current file/buffer. -If visiting a file, this is `bmkp-this-file-bmenu-list'. Otherwise, -this is `bmkp-this-buffer-bmenu-list'." - (interactive) - (if (buffer-file-name) (bmkp-this-file-bmenu-list) (bmkp-this-buffer-bmenu-list))) - -;;;###autoload -(defun bmkp-this-file-bmenu-list () - "Show the bookmark list just for bookmarks for the current file. -Set `bmkp-last-specific-file' to the current file name. -If the current buffer is not visiting a file, prompt for the file name." - (interactive) - (setq bmkp-last-specific-file (or (buffer-file-name) - (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "File: "))) - bmkp-bmenu-filter-function 'bmkp-last-specific-file-alist-only - bmkp-bmenu-title (format "File `%s' Bookmarks" bmkp-last-specific-file)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)) - (bmkp-bmenu-state-file nil)) ; Prevent restoring saved state. - (unless bookmark-alist (error "No bookmarks for file `%s'" bmkp-last-specific-file)) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (pop-to-buffer (get-buffer-create "*Bookmark List*")) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - (format "Only bookmarks for file `%s' are shown" - bmkp-last-specific-file))) - (raise-frame)) - -;;;###autoload -(defun bmkp-this-buffer-bmenu-list () - "Show the bookmark list just for bookmarks for the current buffer. -Set `bmkp-last-specific-buffer' to the current buffer name." - (interactive) - (setq bmkp-last-specific-buffer (buffer-name) - bmkp-bmenu-filter-function 'bmkp-last-specific-buffer-alist-only - bmkp-bmenu-title (format "Buffer `%s' Bookmarks" bmkp-last-specific-buffer)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function)) - (bmkp-bmenu-state-file nil)) ; Prevent restoring saved state. - (unless bookmark-alist (error "No bookmarks for buffer `%s'" bmkp-last-specific-buffer)) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (pop-to-buffer (get-buffer-create "*Bookmark List*")) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - (format "Only bookmarks for buffer `%s' are shown" - bmkp-last-specific-buffer))) - (raise-frame)) - -;;;###autoload -(defun bmkp-navlist-bmenu-list () ; Bound to `C-x p N' - "Show the bookmark list just for bookmarks from the navigation list." - (interactive) - (unless bmkp-nav-alist - (bookmark-maybe-load-default-file) - (setq bmkp-nav-alist bookmark-alist) - (unless bmkp-nav-alist (error "No bookmarks")) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist)) - (message "Bookmark navigation list is now the global bookmark list") (sit-for 2)) - (setq bmkp-bmenu-title "Current Navlist Bookmarks") - (let ((bookmark-alist bmkp-nav-alist) - (bmkp-bmenu-state-file nil)) ; Prevent restoring saved state. - (unless bookmark-alist (error "No bookmarks")) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (pop-to-buffer (get-buffer-create "*Bookmark List*")) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - "Only bookmarks for the navigation list are shown")) - (raise-frame)) - -(defun bmkp-completing-read-buffer-name (&optional no-default-p) - "Read the name of a buffer associated with a bookmark. -The candidates are the buffers in `bmkp-buffer-names'. -Non-nil NO-DEFAULT-P means provide no default value. Used when - called in a loop, to let the user exit using empty input. -If NO-DEFAULT-P is nil, then the default is the current buffer's name, - or the value of `bmkp-last-specific-buffer' if the current buffer has - no bookmarks." - (bookmark-maybe-load-default-file) - (let ((icicle-unpropertize-completion-result-flag t)) - (completing-read "Buffer: " (mapcar #'list (bmkp-buffer-names)) nil t nil 'buffer-name-history - (and (not no-default-p) - (if (member (buffer-name) (bmkp-buffer-names)) - (buffer-name) - bmkp-last-specific-buffer))))) - -(defun bmkp-completing-read-file-name (&optional no-default-p) - "Read the name of a file associated with a bookmark. -The candidates are the absolute file names in `bmkp-file-names'. -Non-nil NO-DEFAULT-P means provide no default value. Used when - called in a loop, to let the user exit using empty input. -If NO-DEFAULT-P is nil, then the default is the current buffer's file - name, if any, or the value of `bmkp-last-specific-file' if the - current buffer has no associated file or the file has no bookmarks." - (bookmark-maybe-load-default-file) - (let ((completion-ignore-case (if (boundp 'read-file-name-completion-ignore-case) - read-file-name-completion-ignore-case - (memq system-type - '(ms-dos windows-nt darwin cygwin)))) - (icicle-unpropertize-completion-result-flag t)) - (completing-read "File: " (mapcar #'list (bmkp-file-names)) nil t nil 'file-name-history - (and (not no-default-p) - (let ((file (buffer-file-name))) - (if (and file (member file (bmkp-file-names))) - file - bmkp-last-specific-file)))))) - -(defun bmkp-refresh/rebuild-menu-list (&optional bookmark no-msg-p) - "Refresh or rebuild buffer `*Bookmark List*'. -If the buffer is already displayed, call `bmkp-refresh-menu-list'. -Otherwise, call `bookmark-bmenu-surreptitiously-rebuild-list'. -Args are the same as for `bmkp-refresh-menu-list'." - (let ((bmklistbuf (get-buffer "*Bookmark List*"))) - (if (and bmklistbuf (get-buffer-window bmklistbuf 0)) - (with-current-buffer bmklistbuf (bmkp-refresh-menu-list bookmark no-msg-p)) - (bookmark-bmenu-surreptitiously-rebuild-list no-msg-p)))) - -(defun bmkp-refresh-menu-list (&optional bookmark no-msg-p) - "Refresh (revert) the bookmark list (\"menu list\"). -This brings the displayed list up to date. It does not change the -current filtering or sorting of the displayed list. -Non-nil optional arg BOOKMARK means move cursor to BOOKMARK's line. -BOOKMARK is a bookmark name or a bookmark record. -Non-nil optional arg NO-MSG-P means do not show progress messages." - (let ((bookmark-alist (if bmkp-bmenu-filter-function - (funcall bmkp-bmenu-filter-function) - bookmark-alist))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (unless no-msg-p (message "Updating bookmark list...")) - (bookmark-bmenu-list bmkp-bmenu-filter-function) ; No filter function means start anew. - (when bookmark - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (with-current-buffer (get-buffer "*Bookmark List*") - (bmkp-bmenu-goto-bookmark-named bookmark) - (let ((bmenu-win (get-buffer-window (current-buffer) 0))) - (when bmenu-win (set-window-point bmenu-win (point)))))) - (unless no-msg-p (message "Updating bookmark list...done")))) - -;;;###autoload -(defun bmkp-unomit-all (&optional msg-p) ; Bound to `O U' in bookmark list - "Remove all bookmarks from the list of omitted bookmarks. -After this, all bookmarks are available for display. -Non-interactively, non-nil optional arg MSG-P means display a status -message." - (interactive "p") - (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks to UN-omit")) - (when msg-p (message "UN-omitting ALL omitted bookmarks...")) - (let ((count 0)) - (dolist (bmk-name bmkp-bmenu-omitted-bookmarks) - (setq bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list - bmk-name bmkp-bmenu-omitted-bookmarks) - count (1+ count))) - (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p)) - (when msg-p (message "UN-omitted %d bookmarks" count))) - (when (equal (buffer-name (current-buffer)) "*Bookmark List*") (bmkp-bmenu-show-all)) - (when (and (fboundp 'fit-frame-if-one-window) - (equal (buffer-name (current-buffer)) "*Bookmark List*")) - (fit-frame-if-one-window))) - -(defun bmkp-omitted-alist-only () - "`bookmark-alist', filtered to retain only the omitted bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-omitted-bookmark-p bookmark-alist)) - -(defun bmkp-omitted-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an omitted bookmark. -BOOKMARK is a bookmark name or a bookmark record." - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (bmkp-bookmark-name-member bookmark bmkp-bmenu-omitted-bookmarks)) - - -;;(@* "Search-and-Replace Locations of Marked Bookmarks") -;; *** Search-and-Replace Locations of Marked Bookmarks *** - -(when (> emacs-major-version 22) - (defvar bmkp-isearch-bookmarks nil - "Bookmarks whose locations are to be incrementally searched.") - - (defun bmkp-isearch-next-bookmark-buffer (&optional bookmark wrap) - "Return the next buffer in a series of bookmark buffers. -Used as a value for `multi-isearch-next-buffer-function', for Isearch -of multiple bookmarks. - -Variable `bmkp-isearch-bookmarks' is a list of bookmarks. Each -bookmark in the list is visited by `bookmark--jump-via', and the -corresponding bookmark buffer is returned." - (let ((bookmarks (if isearch-forward bmkp-isearch-bookmarks (reverse bmkp-isearch-bookmarks)))) - (bookmark--jump-via - (if wrap - (car bookmarks) - (let ((this-bmk (catch 'bmkp-isearch-next-bookmark-buffer - (dolist (bmk bookmarks) - (when (if (bmkp-get-buffer-name bmk) - (equal (bmkp-get-buffer-name bmk) (buffer-name)) - (equal (bookmark-get-filename bmk) (buffer-file-name))) - (throw 'bmkp-isearch-next-bookmark-buffer bmk))) - (car bookmarks)))) - (cadr (member this-bmk bookmarks)))) - 'ignore) - (current-buffer))) - - (defun bmkp-isearch-bookmarks (bookmarks) - "Start multi-bookmark Isearch on BOOKMARKS." - (let ((multi-isearch-next-buffer-function 'bmkp-isearch-next-bookmark-buffer) - (bmkp-isearch-bookmarks bookmarks)) - (bookmark-jump (car bookmarks)) - (goto-char (if isearch-forward (point-min) (point-max))) - (isearch-forward))) - - (defun bmkp-isearch-bookmarks-regexp (bookmarks) - "Start multi-bookmark regexp Isearch on BOOKMARKS." - (let ((multi-isearch-next-buffer-function 'bmkp-isearch-next-bookmark-buffer) - (bmkp-isearch-bookmarks bookmarks)) - (bookmark-jump (car bookmarks)) - (goto-char (if isearch-forward (point-min) (point-max))) - (isearch-forward-regexp)))) - - -;;(@* "Tags") -;; *** Tags *** - -(defun bmkp-get-tags (bookmark) - "Return the `tags' entry for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bookmark-prop-get bookmark 'tags)) - -(defalias 'bmkp-tagged-bookmark-p 'bmkp-get-tags) - -(defun bmkp-get-tag-value (bookmark tag) - "Return value of BOOKMARK's tag TAG. -BOOKMARK is a bookmark name or a bookmark record. -TAG is a string. -Return nil if BOOKMARK has no such TAG or if TAG has no value." - (assoc-default tag (bmkp-get-tags bookmark))) - -(defun bmkp-has-tag-p (bookmark tag) - "Return non-nil if BOOKMARK is tagged with TAG. -BOOKMARK is a bookmark name or a bookmark record. -TAG is a string." - (assoc-default tag (bmkp-get-tags bookmark) nil t)) - -;; NOT USED currently - we use `bmkp-read-tags-completing' instead. -(defun bmkp-read-tags () - "Read tags one by one, and return them as a list." - (let ((tag (read-string "Tag (RET for each, empty input to finish): ")) - (btags ())) - (while (not (string= "" tag)) - (push tag btags) - (setq tag (read-string "Tag: "))) - btags)) - -(defun bmkp-read-tag-completing (&optional prompt candidate-tags require-match update-tags-alist-p) - "Read a tag with completion, and return it as a string. -The candidate tags available are determined by option -`bmkp-tags-for-completion'. - -PROMPT is the prompt string. If nil, then use \"Tag: \". -CANDIDATE-TAGS is an alist of tags to use for completion. - If nil, then all tags from all bookmarks are used for completion. - The set of all tags is taken from variable `bmkp-tags-alist'. -REQUIRE-MATCH is passed to `completing-read'. -Non-nil UPDATE-TAGS-ALIST-P means update var `bmkp-tags-alist'." - (bookmark-maybe-load-default-file) - (let ((cand-tags (copy-sequence - (or candidate-tags - (and (not update-tags-alist-p) - bmkp-tags-alist) ; Use cached list. - (bmkp-tags-list)))) ; Update the cache. - (icicle-unpropertize-completion-result-flag t)) - (completing-read (or prompt "Tag: ") cand-tags nil require-match nil 'bmkp-tag-history))) - -(defun bmkp-read-tags-completing (&optional candidate-tags require-match update-tags-alist-p) - "Read tags with completion, and return them as a list of strings. -Read tags one by one, until you hit `RET' twice consecutively. - -CANDIDATE-TAGS is an alist of tags to use for completion. - If nil then the candidate tags are taken from variable - `bmkp-tags-alist'. -REQUIRE-MATCH is passed to `completing-read'. -Non-nil UPDATE-TAGS-ALIST-P means update var `bmkp-tags-alist', -determining the tags to use per option `bmkp-tags-for-completion'." - (bookmark-maybe-load-default-file) - (let ((cands ()) - (btags ()) - (prompt1 "Tag (RET for each, empty input to finish): ") - (prompt2 "Tag: ") - (icicle-unpropertize-completion-result-flag t) - tag old-tag) - ;; Make a new candidates alist, with just one entry per tag name. The original cdr is discarded. - (dolist (full-tag (or candidate-tags - (and (not update-tags-alist-p) bmkp-tags-alist) ; Use cached list. - (bmkp-tags-list))) - (add-to-list 'cands (list (if (consp full-tag) (car full-tag) full-tag)))) - (setq tag (completing-read prompt1 cands nil require-match nil 'bmkp-tag-history) - cands (delete (assoc tag cands) cands)) ; Tag read is no longer a candidate. - (while (not (string= "" tag)) - (if (member tag btags) ; User can enter it more than once, if not REQUIRE-MATCH. - (message "Tag `%s' already included" tag) - (push tag btags)) ; But we only add it once. - (setq tag (completing-read prompt2 cands nil require-match nil 'bmkp-tag-history) - cands (delete (assoc tag cands) cands))) - (nreverse btags))) - -;;;###autoload -(defun bmkp-list-all-tags (fullp current-only-p &optional msg-p) - ; Bound to `C-x p t l', (`T l' in bookmark list) - "List bookmark tags. -Show the list in the minibuffer or, if not enough space, in buffer -`*All Tags*'. The tags are listed alphabetically, respecting option -`case-fold-search'. - -With no prefix arg or with a plain prefix arg (`C-u'), the tags listed -are those defined by option `bmkp-tags-for-completion'. Otherwise -\(i.e., with a numeric prefix arg), the tags listed are those from the -current list of bookmarks only. - -With no prefix arg or with a negative prefix arg (e.g. `C--'), list -only the tag names. With a non-negative prefix arg (e.g. `C-1' or -plain `C-u'), list the full alist of tags. - -Note that when the full tags alist is shown, the same tag name appears -once for each of its different values. - -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (and current-prefix-arg (> (prefix-numeric-value current-prefix-arg) 0)) - (and current-prefix-arg (not (consp current-prefix-arg))) - t)) - (require 'pp) - (when msg-p (message "Gathering tags...")) - (pp-display-expression (sort (bmkp-tags-list (not fullp) current-only-p) - (if fullp - (lambda (t1 t2) (bmkp-string-less-case-fold-p (car t1) (car t2))) - 'bmkp-string-less-case-fold-p)) - "*All Tags")) - -(defun bmkp-tags-list (&optional names-only-p current-only-p) - "List of all bookmark tags, per option `bmkp-tags-for-completion'. -Non-nil NAMES-ONLY-P means return a list of only the tag names. -Otherwise, return an alist of the full tags and set variable -`bmkp-tags-alist' to that alist, as a cache. - -Non-nil CURRENT-ONLY-P means ignore option `bmkp-tags-for-completion' -and return only the tags for the currently loaded bookmarks." - (let ((tags ()) - (opt-tags bmkp-tags-for-completion) - bmk-tags) - (when (or (eq opt-tags 'current) current-only-p) (setq opt-tags '(current))) - (dolist (entry opt-tags) - (typecase entry - (cons ; A bookmark file - (when (eq 'bmkfile (car entry)) - (setq entry (cdr entry) - tags (append tags (bmkp-tags-in-bookmark-file entry names-only-p))))) - (string (add-to-list 'tags (if names-only-p entry (list entry)))) - (symbol (when (eq entry 'current) - (bookmark-maybe-load-default-file) - (dolist (bmk bookmark-alist) - (setq bmk-tags (bmkp-get-tags bmk)) - (dolist (tag bmk-tags) - (add-to-list 'tags (if names-only-p (bmkp-tag-name tag) (bmkp-full-tag tag))))))))) - (unless names-only-p (setq bmkp-tags-alist tags)) - tags)) - -(defun bmkp-tags-in-bookmark-file (file &optional names-only-p) - "Return the list of tags from all bookmarks in bookmark-file FILE. -If FILE is a relative file name, it is expanded in `default-directory. -If FILE does not name a valid, bookmark file then nil is returned. -Non-nil NAMES-ONLY-P means return a list of only the tag names. -Otherwise, return an alist of the full tags. -" - (setq file (expand-file-name file)) - (let ((bookmark-save-flag nil) ; Just to play safe. - (bmk-alist ()) - (tags ()) - bmk-tags) - (if (not (file-readable-p file)) - (message "Cannot read bookmark file `%s'" file) - (with-current-buffer (let ((enable-local-variables ())) (find-file-noselect file)) - (goto-char (point-min)) - (condition-case nil ; Check whether it's a valid bookmark file. - (progn (bookmark-maybe-upgrade-file-format) - (unless (listp (setq bmk-alist (bookmark-alist-from-buffer))) (error ""))) - (error (message "Not a valid bookmark file: `%s'" file)))) - (dolist (bmk bmk-alist) - (setq bmk-tags (bmkp-get-tags bmk)) - (dolist (tag bmk-tags) - (add-to-list 'tags (if names-only-p (bmkp-tag-name tag) (bmkp-full-tag tag)))))) - tags)) - -(defun bmkp-tag-name (tag) - "Name of TAG. If TAG is an atom, then TAG, else (car TAG)." - (if (atom tag) tag (car tag))) - -(defun bmkp-full-tag (tag) - "Full cons entry for TAG. If TAG is a cons, then TAG, else (list TAG)." - (if (consp tag) tag (list tag))) - -;;;###autoload -(defun bmkp-remove-all-tags (bookmark &optional no-update-p msg-p) - ; Bound to `C-x p t 0', (`T 0' in bookmark list) - "Remove all tags from BOOKMARK. -Non-interactively: - - Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. - - Non-nil optional arg MSG-P means show a message about the removal." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) 'msg)) - (when (and msg-p (null (bmkp-get-tags bookmark))) (error "Bookmark has no tags to remove")) - (let ((nb-removed (and (interactive-p) (length (bmkp-get-tags bookmark))))) - (bookmark-prop-set bookmark 'tags ()) - (unless no-update-p (bmkp-tags-list)) ; Update the tags cache. - (bmkp-maybe-save-bookmarks) - (when (and msg-p nb-removed) (message "%d tags removed" nb-removed))) - (unless no-update-p - (bmkp-refresh/rebuild-menu-list bookmark (not msg-p)))) ; So remove `t' marker and add `*' for BOOKMARK. - -;;;###autoload -(defun bmkp-add-tags (bookmark tags &optional no-update-p msg-p) - ; `C-x p t + b' (`b' for bookmark), (`T +' in bookmark list) - "Add TAGS to BOOKMARK. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. -Completion for the bookmark name is strict. -Completion for tags is lax: you are not limited to existing tags. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them. - -Non-interactively: -* TAGS is a list of strings. -* Non-nil MSG-P means display a message about the addition. -* Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. - -The absolute value of the return value is the number of tags added. -If BOOKMARK was untagged before the operation, then the return value -is negative." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) - (bmkp-read-tags-completing nil nil current-prefix-arg) - 'msg)) - (let* ((newtags (copy-alist (bmkp-get-tags bookmark))) - (olen (length newtags))) - (dolist (tag tags) (unless (or (assoc tag newtags) (member tag newtags)) (push tag newtags))) - (bookmark-prop-set bookmark 'tags newtags) - (unless no-update-p (bmkp-tags-list)) ; Update the tags cache. - (bmkp-maybe-save-bookmarks) - (unless no-update-p - (bmkp-refresh/rebuild-menu-list bookmark (not msg-p))) ; So display `t' and `*' markers for BOOKMARK. - (let ((nb-added (- (length newtags) olen))) - (when msg-p (message "%d tags added. Now: %S" nb-added ; Echo just the tag names. - (let ((tgs (mapcar #'bmkp-tag-name newtags))) - (setq tgs (sort tgs #'string<))))) - (when (and (zerop olen) (> (length newtags) 0)) - (setq nb-added (- nb-added))) - nb-added))) - -;; $$$$$$ Not yet used -;;;###autoload -(defun bmkp-set-tag-value-for-navlist (tag value) ; Bound to `C-x p t V' - "Set the value of TAG to VALUE, for each bookmark in the navlist. -If any of the bookmarks has no tag named TAG, then add one with VALUE." - (interactive (list (bmkp-read-tag-completing) (read (read-string "Value: ")) 'msg)) - (bmkp-set-tag-value-for-bookmarks bmkp-nav-alist tag value)) - -;; $$$$$$ Not yet used -(defun bmkp-set-tag-value-for-bookmarks (bookmarks tag value) ; Not bound - "Set the value of TAG to VALUE, for each of the BOOKMARKS. -If any of the BOOKMARKS has no tag named TAG, then add one with VALUE." - (let ((bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save only after `dolist'. - (dolist (bmk bookmarks) (bmkp-set-tag-value bmk tag value 'NO-UPDATE-P)))) - -;;;###autoload -(defun bmkp-set-tag-value (bookmark tag value &optional no-update-p msg-p) ; Bound to `C-x p t v' - "For BOOKMARK's TAG, set the value to VALUE. -If BOOKMARK has no tag named TAG, then add one with value VALUE. -Non-interactively: -* Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and -* do not refresh/rebuild the bookmark-list display. -* Non-nil MSG-P means display a message about the updated value." - (interactive - (let* ((bmk (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name))) - (tag (bmkp-read-tag-completing "Tag: " (mapcar 'bmkp-full-tag (bmkp-get-tags bmk))))) - (list bmk tag (read (read-string "Value: ")) 'msg))) - (unless (bmkp-has-tag-p bookmark tag) (bmkp-add-tags bookmark (list tag) no-update-p)) - (let* ((newtags (copy-alist (bmkp-get-tags bookmark))) - (assoc-tag (assoc tag newtags)) - (member-tag (and (not assoc-tag) (member tag newtags)))) - (if assoc-tag (setcdr assoc-tag value) (setcar member-tag (cons (car member-tag) value))) - (bookmark-prop-set bookmark 'tags newtags)) - (when msg-p "Tag value set")) - -;;;###autoload -(defun bmkp-remove-tags (bookmark tags &optional no-update-p msg-p) - ; `C-x p t - b' (`b' for bookmark), (`T -' in bookmark list) - "Remove TAGS from BOOKMARK. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them. - -Non-interactively: -* TAGS is a list of strings. The corresponding tags are removed. -* Non-nil MSG-P means display status messages. -* Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. - -The absolute value of the return value is the number of tags removed. -If BOOKMARK is untagged after the operation, then the return value -is negative." - (interactive (let ((bmk (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)))) - (list bmk - (bmkp-read-tags-completing (mapcar 'bmkp-full-tag (bmkp-get-tags bmk)) - t current-prefix-arg) - 'msg))) - (let* ((remtags (copy-alist (bmkp-get-tags bookmark))) - (olen (length remtags))) - (if (null remtags) - (when msg-p (message "Bookmark has no tags to remove")) ; Do nothing if bookmark has no tags. - (setq remtags (bmkp-remove-if (lexical-let ((tgs tags)) - #'(lambda (tag) - (if (atom tag) (member tag tgs) (member (car tag) tgs)))) - remtags)) - (bookmark-prop-set bookmark 'tags remtags) - (unless no-update-p (bmkp-tags-list)) ; Update the tags cache. - (bmkp-maybe-save-bookmarks) - (unless no-update-p - (bmkp-refresh/rebuild-menu-list bookmark (not msg-p))) ; So remove `t' marker if no tags. - (let ((nb-removed (- olen (length remtags)))) - (when msg-p (message "%d tags removed. Now: %S" nb-removed ; Echo just the tag names. - (let ((tgs (mapcar #'bmkp-tag-name remtags))) - (setq tgs (sort tgs #'string<))))) - (when (and (zerop (length remtags)) (> olen 0)) - (setq nb-removed (- nb-removed))) - nb-removed)))) - -;;;###autoload -(defun bmkp-remove-tags-from-all (tags &optional msg-p) ; Bound to `C-x p t d', (`T d' in bookmark list) - "Remove TAGS from all bookmarks. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter each tag. -This affects all bookmarks, even those not showing in bookmark list. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them. - -Non-interactively: -* TAGS is a list of strings. The corresponding tags are removed. -* Non-nil optional arg MSG-P means show a message about the deletion." - (interactive - (if (not (y-or-n-p "Delete the tags you specify from ALL bookmarks? ")) - (error "OK - deletion canceled") - (list (bmkp-read-tags-completing nil t current-prefix-arg) - 'MSG))) - (let ((bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save only after `dolist'. - (dolist (bmk (bookmark-all-names)) (bmkp-remove-tags bmk tags 'NO-UPDATE-P))) - (bmkp-tags-list) ; Update the tags cache (only once, at end). - (when msg-p (message "Tags removed from all bookmarks: %S" tags))) - -;;;###autoload -(defun bmkp-rename-tag (tag newname &optional msg-p) ; Bound to `C-x p t r', (`T r' in bookmark list) - "Rename TAG to NEWNAME in all bookmarks, even those not showing. -Non-interactively, non-nil MSG-P means display a message about the -deletion." - (interactive (list (bmkp-read-tag-completing "Tag (old name): ") - (bmkp-read-tag-completing "New name: ") - 'MSG)) - (let ((tag-exists-p nil) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save only after `dolist'. - (dolist (bmk (bookmark-all-names)) - (let ((newtags (copy-alist (bmkp-get-tags bmk)))) - (when newtags - (let* ((assoc-tag (assoc tag newtags)) - (member-tag (and (not assoc-tag) (member tag newtags)))) - (cond (assoc-tag (setcar assoc-tag newname)) - (member-tag (setcar member-tag newname))) - (when (or assoc-tag member-tag) - (setq tag-exists-p t) - (bookmark-prop-set bmk 'tags newtags)))))) - (if tag-exists-p - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (error "No such tag: `%s'" tag)) - (when msg-p (message "Renamed")))) - -;;;###autoload -(defun bmkp-copy-tags (bookmark &optional msg-p) ; Bound to `C-x p t c', `C-x p t M-w' - "Copy tags from BOOKMARK, so you can paste them to another bookmark. -Note that you can copy from a BOOKMARK that has no tags or has an -empty tags list. In that case, the copied-tags list is empty, so if -you paste it as a replacement then the recipient bookmark will end up -with no tags. - -Non-interactively, non-nil MSG-P means display a message about the -number of tags copied." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) 'msg)) - (let ((btags (bmkp-get-tags bookmark))) - (setq bmkp-copied-tags (copy-alist btags)) - (when msg-p (message "%d tags now available for pasting" (length btags))))) - -;;;###autoload -(defun bmkp-paste-add-tags (bookmark &optional no-update-p msg-p) ; Bound to `C-x p t p', `C-x p t C-y' - "Add tags to BOOKMARK that were previously copied from another bookmark. -Return the number of tags added. -The tags are copied from `bmkp-copied-tags'. -Non-interactively: -* Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. -* Non-nil MSG-P means display a message about the addition." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) 'msg)) - (unless (listp bmkp-copied-tags) - (error "`bmkp-paste-add-tags': `bmkp-copied-tags' is not a list")) - (bmkp-add-tags bookmark bmkp-copied-tags no-update-p msg-p)) - -;;;###autoload -(defun bmkp-paste-replace-tags (bookmark &optional no-update-p msg-p) ; Bound to `C-x p t q' - "Replace tags for BOOKMARK with those copied from another bookmark. -Return the number of tags for BOOKMARK. -The tags are copied from `bmkp-copied-tags'. -Any previously existing tags for BOOKMARK are lost. -Non-interactively: -* Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. -* Non-nil MSG-P means display a message about the addition." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) 'msg)) - (unless (listp bmkp-copied-tags) - (error "`bmkp-paste-replace-tags': `bmkp-copied-tags' is not a list")) - (let ((has-tags-p (bmkp-get-tags bookmark))) - (when (and msg-p has-tags-p - (not (y-or-n-p "Existing tags will be LOST - really replace them? "))) - (error "OK - paste-replace tags canceled")) - (when has-tags-p (bmkp-remove-all-tags bookmark no-update-p msg-p))) - (bmkp-add-tags bookmark bmkp-copied-tags no-update-p msg-p)) - - -;;(@* "Bookmark Predicates") -;; *** Bookmark Predicates *** - -(defun bmkp-autofile-bookmark-p (bookmark &optional prefix) - "Return non-nil if BOOKMARK is an autofile bookmark. -That means that it is `bmkp-file-bookmark-p' and also its -non-directory file name is the same as the bookmark name. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. - -Non-interactively, non-nil optional arg PREFIX means that the bookmark -name is actually expected to be the file name prefixed by PREFIX (a -string)." - (setq bookmark (bookmark-get-bookmark bookmark)) - (and (bmkp-file-bookmark-p bookmark) - (let ((fname (file-name-nondirectory (bookmark-get-filename bookmark)))) - (string= (if prefix (concat prefix fname) fname) - (bmkp-bookmark-name-from-record bookmark))))) - -(defun bmkp-bookmark-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a bookmark-file bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-bookmark-file)) - -(defun bmkp-bookmark-list-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a bookmark-list bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-bookmark-list)) - -(defun bmkp-desktop-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a desktop bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-desktop)) - -;; Note: To avoid remote access, if bookmark does not have the Dired handler, then we insist -;; that it be for a local directory. IOW, we do not include remote directories that were not -;; bookmarked by Bookmark+ (and so do not have the Dired handler). -(defun bmkp-dired-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a Dired bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (or (eq (bookmark-get-handler bookmark) 'bmkp-jump-dired) - (bmkp-local-directory-bookmark-p bookmark))) - -(defun bmkp-dired-this-dir-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a Dired bookmark for the `default-directory'. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (and (bmkp-dired-bookmark-p bookmark) - (let ((dir (file-name-directory (bookmark-get-filename bookmark)))) - (bmkp-same-file-p dir default-directory)))) - -(defun bmkp-dired-wildcards-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks a Dired buffer with wildcards. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (and (bmkp-dired-bookmark-p bookmark) - (let ((file (bookmark-get-filename bookmark))) - (and (stringp file) (if (fboundp 'string-match-p) - (string-match-p (regexp-quote "*") file) - (save-match-data (string-match (regexp-quote "*") file))))))) - -(defun bmkp-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks a file or directory. -This excludes bookmarks of a more specific kind (e.g. Info, Gnus). -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let* ((filename (bookmark-get-filename bookmark)) - (nonfile-p (equal filename bmkp-non-file-filename)) - (handler (bookmark-get-handler bookmark))) - (and filename (not nonfile-p) - (or (not handler) - (memq handler bmkp-file-bookmark-handlers) - (equal handler (bmkp-default-handler-for-file filename))) - (not (and (bookmark-prop-get bookmark 'info-node)))))) ; Emacs 20-21 Info: no handler. - -(defun bmkp-file-this-dir-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks file/subdir in `default-directory'. -This excludes bookmarks of a more specific kind (e.g. Info, Gnus). -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (and (bmkp-file-bookmark-p bookmark) - (equal (file-name-directory (bookmark-get-filename bookmark)) default-directory))) - -(defun bmkp-flagged-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is flagged for deletion in `*Bookmark List*'. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (memq bookmark bmkp-flagged-bookmarks)) - -(defun bmkp-function-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a function bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-function)) - -(defun bmkp-gnus-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a Gnus bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (memq (bookmark-get-handler bookmark) - '(gnus-summary-bookmark-jump bmkp-jump-gnus bmkext-jump-gnus))) - -(defun bmkp-image-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an image-file bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (or (eq (bookmark-get-handler bookmark) 'image-bookmark-jump) - (and (fboundp 'image-file-name-regexp) ; In `image-file.el' (Emacs 22+). - (bmkp-file-bookmark-p bookmark) - (not (bmkp-dired-bookmark-p bookmark)) - (if (fboundp 'string-match-p) - (string-match-p (image-file-name-regexp) (bookmark-get-filename bookmark)) - (save-match-data - (string-match (image-file-name-regexp) (bookmark-get-filename bookmark))))))) - -(defun bmkp-info-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an Info bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (or (eq (bookmark-get-handler bookmark) 'Info-bookmark-jump) - (and (not (bookmark-get-handler bookmark)) - (or (string= "*info*" (bmkp-get-buffer-name bookmark)) - (bookmark-prop-get bookmark 'info-node))))) ; Emacs 20-21 - no `buffer-name' entry. - -(defun bmkp-local-directory-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks a local directory. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let ((file (bookmark-get-filename bookmark))) - (and (bmkp-local-file-bookmark-p bookmark) (file-directory-p file)))) - -(defun bmkp-local-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks a local file or directory. -This excludes bookmarks of a more specific kind (e.g. Info, Gnus). -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (and (bmkp-file-bookmark-p bookmark) (not (bmkp-remote-file-bookmark-p bookmark)))) - -(defun bmkp-man-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a `man' page bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (memq (bookmark-get-handler bookmark) '(bmkp-jump-man bmkp-jump-woman - bmkext-jump-man bmkext-jump-woman))) - -(defun bmkp-marked-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a marked bookmark in `*Bookmark List*'. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (unless (stringp bookmark) (setq bookmark (bmkp-bookmark-name-from-record bookmark))) - (bmkp-bookmark-name-member bookmark bmkp-bmenu-marked-bookmarks)) - -(defun bmkp-modified-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a modified bookmark'. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (memq bookmark bmkp-modified-bookmarks)) - -(defun bmkp-non-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a non-file bookmark (e.g *scratch*). -This excludes bookmarks of a more specific kind (e.g. Info, Gnus). -It includes bookmarks to existing buffers, as well as bookmarks -defined for buffers that do not currently exist. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let* ((filename (bookmark-get-filename bookmark)) - (nonfile-p (equal filename bmkp-non-file-filename))) - (and (bmkp-get-buffer-name bookmark) - (or (not filename) nonfile-p - ;; Ensure not remote before calling `file-exists-p'. (Do not prompt for password.) - (and (not (bmkp-file-remote-p filename)) (not (file-exists-p filename)))) - (not (bookmark-get-handler bookmark))))) - -(defun bmkp-orphaned-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an orphaned file or directory bookmark. -This means that the file recorded for BOOKMARK does not exist or is -not readable. But a Dired bookmark with wildcards in the file name is -assumed to be readable. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (and (bmkp-file-bookmark-p bookmark) - (if (bmkp-dired-bookmark-p bookmark) - (and (not (bmkp-dired-wildcards-bookmark-p bookmark)) - (not (file-readable-p (bookmark-get-filename bookmark)))) - (not (file-readable-p (bookmark-get-filename bookmark)))))) - -(defun bmkp-orphaned-local-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an orphaned local-file bookmark. -This means that the file name recorded for BOOKMARK is not remote, and -the file does not exist or is not readable. But a Dired bookmark with -wildcards in the file name is assumed to be readable. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (and (bmkp-local-file-bookmark-p bookmark) - (if (bmkp-dired-bookmark-p bookmark) - (and (not (bmkp-dired-wildcards-bookmark-p bookmark)) - (not (file-readable-p (bookmark-get-filename bookmark)))) - (not (file-readable-p (bookmark-get-filename bookmark)))))) - -(defun bmkp-orphaned-remote-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is an orphaned remote-file bookmark. -This means that the file name recorded for BOOKMARK is remote, and the -file does not exist or is not readable. But a Dired bookmark with -wildcards in the file name is assumed to be readable. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (and (bmkp-remote-file-bookmark-p bookmark) - (if (bmkp-dired-bookmark-p bookmark) - (and (not (bmkp-dired-wildcards-bookmark-p bookmark)) - (not (file-readable-p (bookmark-get-filename bookmark)))) - (not (file-readable-p (bookmark-get-filename bookmark)))))) - -(defun bmkp-region-bookmark-p (bookmark) - "Return non-nil if BOOKMARK has region information. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (and (bmkp-get-end-position bookmark) - (/= (bookmark-get-position bookmark) (bmkp-get-end-position bookmark)))) - -(defun bmkp-remote-file-bookmark-p (bookmark) - "Return non-nil if BOOKMARK bookmarks a remote file or directory. -This includes remote Dired bookmarks, but otherwise excludes bookmarks -with handlers (e.g. Info, Gnus). - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let* ((handler (bookmark-get-handler bookmark)) - (file (bookmark-get-filename bookmark)) - (rem-file (and file (bmkp-file-remote-p file)))) - (and rem-file (or (not handler) (eq handler 'bmkp-jump-dired))))) - -(defun bmkp-temporary-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is temporary. -This means that it has a non-nil `bmkp-temp' property. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (setq bookmark (bookmark-get-bookmark bookmark 'NOERROR)) - (if (not bookmark) nil (bookmark-prop-get bookmark 'bmkp-temp))) - -(defun bmkp-this-buffer-p (bookmark) - "Return non-nil if BOOKMARK's buffer is the current buffer. -But return nil if BOOKMARK has an associated file, but it is not the - buffer's file. -And return nil for bookmarks, such as desktops, that are not really - associated with a buffer, even if they have a `buffer-name' entry. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (and (let ((this-file (condition-case nil (bookmark-buffer-file-name) (error nil))) - (bmk-file (and (bmkp-file-bookmark-p bookmark) (bookmark-get-filename bookmark)))) - ;; Two possibilities: - ;; * Neither buffer nor bookmark has a file, and the buffer names are the same. - ;; * Both have files, and they are the same file. - (or (and (not this-file) (not bmk-file) (equal (bmkp-get-buffer-name bookmark) (buffer-name))) - (and this-file bmk-file (bmkp-same-file-p this-file bmk-file)))) - (not (bmkp-desktop-bookmark-p bookmark)) - (not (bmkp-bookmark-file-bookmark-p bookmark)) - (not (bmkp-sequence-bookmark-p bookmark)) - (not (bmkp-function-bookmark-p bookmark)) - (not (bmkp-variable-list-bookmark-p bookmark)))) - -(defun bmkp-this-file-p (bookmark) - "Return non-nil if BOOKMARK's file is the visited file. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let ((bmk-file (and (bmkp-file-bookmark-p bookmark) (bookmark-get-filename bookmark))) - (this-file (or (and (buffer-file-name) (bookmark-buffer-file-name)) - (and (eq major-mode 'dired-mode) (if (consp dired-directory) - (car dired-directory) - dired-directory))))) - (and bmk-file (bmkp-same-file-p this-file bmk-file)))) - -(defun bmkp-last-specific-buffer-p (bookmark) - "Return t if BOOKMARK's `buffer-name' is `bmkp-last-specific-buffer'. -But return nil for bookmarks, such as desktops, that are not really -associated with a buffer, even if they have a `buffer-name' entry. -It does not matter whether the buffer exists. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let ((buf (bmkp-get-buffer-name bookmark))) - (and buf (string= buf bmkp-last-specific-buffer) - (not (bmkp-desktop-bookmark-p bookmark)) - (not (bmkp-bookmark-file-bookmark-p bookmark)) - (not (bmkp-sequence-bookmark-p bookmark)) - (not (bmkp-function-bookmark-p bookmark)) - (not (bmkp-variable-list-bookmark-p bookmark))))) - -(defun bmkp-last-specific-file-p (bookmark) - "Return t if BOOKMARK's `filename' is `bmkp-last-specific-file'. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (let ((file (bookmark-get-filename bookmark))) - (and file (string= file bmkp-last-specific-file)))) - -(defun bmkp-sequence-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a sequence bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-sequence)) - -(defun bmkp-url-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a URL bookmark. -This means that it satifies either `bmkp-url-browse-bookmark-p' or -`bmkp-w3m-bookmark-p'. - -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (or (bmkp-url-browse-bookmark-p bookmark) (bmkp-w3m-bookmark-p bookmark))) - -(defun bmkp-url-browse-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a `browse-url' bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-url-browse)) - -(defun bmkp-variable-list-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a variable-list bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (eq (bookmark-get-handler bookmark) 'bmkp-jump-variable-list)) - -(defun bmkp-w3m-bookmark-p (bookmark) - "Return non-nil if BOOKMARK is a W3M bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (memq (bookmark-get-handler bookmark) '(bmkp-jump-w3m bmkext-jump-w3m))) - - -;;(@* "Filter Functions") -;; *** Filter Functions *** - -(defun bmkp-all-tags-alist-only (tags) - "`bookmark-alist', but with only bookmarks having all their tags in TAGS. -Does not include bookmarks that have no tags. -A new list is returned (no side effects)." - (bmkp-remove-if-not - #'(lambda (bmk) - (lexical-let* ((tgs tags) - (bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags (bmkp-every #'(lambda (tag) (member (bmkp-tag-name tag) tgs)) bmk-tags)))) - bookmark-alist)) - -(defun bmkp-all-tags-regexp-alist-only (regexp) - "`bookmark-alist', but with only bookmarks having all tags match REGEXP. -Does not include bookmarks that have no tags. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) - (let ((bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) bmk-tags))))) - bookmark-alist)) - -(defun bmkp-annotated-alist-only () - "`bookmark-alist', but only for bookmarks with non-empty annotations. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (lambda (bmk) - (let ((annotation (bookmark-get-annotation bmk))) - (and annotation (not (string-equal annotation ""))))) - bookmark-alist)) - -(defun bmkp-autofile-alist-only (&optional prefix) - "`bookmark-alist', filtered to retain only autofile bookmarks. -With non-nil arg PREFIX, the bookmark names must all have that PREFIX." - (bookmark-maybe-load-default-file) - (if (not prefix) - (bmkp-remove-if-not #'bmkp-autofile-bookmark-p bookmark-alist) - (bmkp-remove-if-not (lexical-let ((pref prefix)) #'(lambda (bmk) (bmkp-autofile-bookmark-p bmk pref))) - bookmark-alist))) - -(defun bmkp-autofile-all-tags-alist-only (tags) - "`bookmark-alist', with only autofiles having all tags in TAGS. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) - (and (bmkp-autofile-bookmark-p bmk) (bmkp-get-tags bmk) - (bmkp-every (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) tgs)))) - bookmark-alist)) - -(defun bmkp-autofile-all-tags-regexp-alist-only (regexp) - "`bookmark-alist', with only autofiles having all tags match REGEXP. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) - (and (bmkp-autofile-bookmark-p bmk) - (let ((bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - bmk-tags)))))) - bookmark-alist)) - -(defun bmkp-autofile-some-tags-alist-only (tags) - "`bookmark-alist', with only autofiles having some tags in TAGS. -A new list is returned (no side effects)." - (bmkp-remove-if-not - #'(lambda (bmk) (and (bmkp-autofile-bookmark-p bmk) - (bmkp-some (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) - tags))) - bookmark-alist)) - -(defun bmkp-autofile-some-tags-regexp-alist-only (regexp) - "`bookmark-alist', with only autofiles having some tags match REGEXP. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) (and (bmkp-autofile-bookmark-p bmk) - (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - (bmkp-get-tags bmk))))) - bookmark-alist)) -(defun bmkp-autonamed-alist-only () - "`bookmark-alist', with only autonamed bookmarks (from any buffers). -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-autonamed-bookmark-p bookmark-alist)) - -(defun bmkp-autonamed-this-buffer-alist-only () - "`bookmark-alist', with only autonamed bookmarks for the current buffer. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (lambda (bmk) (bmkp-this-buffer-p bmk)) bookmark-alist)) - -(defun bmkp-bookmark-file-alist-only () - "`bookmark-alist', filtered to retain only bookmark-file bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-bookmark-file-bookmark-p bookmark-alist)) - -(defun bmkp-bookmark-list-alist-only () - "`bookmark-alist', filtered to retain only bookmark-list bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-bookmark-list-bookmark-p bookmark-alist)) - -(defun bmkp-desktop-alist-only () - "`bookmark-alist', filtered to retain only desktop bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-desktop-bookmark-p bookmark-alist)) - -(defun bmkp-dired-alist-only () - "`bookmark-alist', filtered to retain only Dired bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-dired-bookmark-p bookmark-alist)) - -(defun bmkp-dired-this-dir-alist-only () - "`bookmark-alist', with only Dired bookmarks for the current directory. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-dired-this-dir-bookmark-p bookmark-alist)) - -(defun bmkp-file-alist-only () - "`bookmark-alist', filtered to retain only file and directory bookmarks. -This excludes bookmarks that might contain file information but are -particular in some way - for example, Info bookmarks or Gnus bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-file-bookmark-p bookmark-alist)) - -(defun bmkp-file-all-tags-alist-only (tags) - "`bookmark-alist', with only file bookmarks having all tags in TAGS. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) - (and (bmkp-file-bookmark-p bmk) (bmkp-get-tags bmk) - (bmkp-every (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) tgs)))) - bookmark-alist)) - -(defun bmkp-file-all-tags-regexp-alist-only (regexp) - "`bookmark-alist', with only file bookmarks having all tags match REGEXP. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) - (and (bmkp-file-bookmark-p bmk) - (let ((bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - bmk-tags)))))) - bookmark-alist)) - -(defun bmkp-file-some-tags-alist-only (tags) - "`bookmark-alist', with only file bookmarks having some tags in TAGS. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) (and (bmkp-file-bookmark-p bmk) - (bmkp-some (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) - tgs)))) - bookmark-alist)) - -(defun bmkp-file-some-tags-regexp-alist-only (regexp) - "`bookmark-alist', with only file bookmarks having some tags match REGEXP. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) (and (bmkp-file-bookmark-p bmk) - (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - (bmkp-get-tags bmk))))) - bookmark-alist)) - -(defun bmkp-file-this-dir-alist-only () - "`bookmark-alist', filtered with `bmkp-file-this-dir-bookmark-p'. -Include only files and subdir that are in `default-directory'. -This excludes bookmarks that might contain file information but are -particular in some way - for example, Info bookmarks or Gnus bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-file-this-dir-bookmark-p bookmark-alist)) - -(defun bmkp-file-this-dir-all-tags-alist-only (tags) - "`bookmark-alist', for files in this dir having all tags in TAGS. -Include only files and subdir that are in `default-directory'. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) - (and (bmkp-file-this-dir-bookmark-p bmk) (bmkp-get-tags bmk) - (bmkp-every (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) tgs)))) - bookmark-alist)) - -(defun bmkp-file-this-dir-all-tags-regexp-alist-only (regexp) - "`bookmark-alist', for files in this dir having all tags match REGEXP. -Include only files and subdir that are in `default-directory'. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) - (and (bmkp-file-this-dir-bookmark-p bmk) - (let ((bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags - (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) bmk-tags)))))) - bookmark-alist)) - -(defun bmkp-file-this-dir-some-tags-alist-only (tags) - "`bookmark-alist', for files in this dir having some tags in TAGS. -Include only files and subdir that are in `default-directory'. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) (and (bmkp-file-this-dir-bookmark-p bmk) - (bmkp-some (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) - tgs)))) - bookmark-alist)) - -(defun bmkp-file-this-dir-some-tags-regexp-alist-only (regexp) - "`bookmark-alist', for files in this dir having some tags match REGEXP. -Include only files and subdir that are in `default-directory'. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((rg regexp)) - #'(lambda (bmk) (and (bmkp-file-this-dir-bookmark-p bmk) - (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - (bmkp-get-tags bmk))))) - bookmark-alist)) - -(defun bmkp-gnus-alist-only () - "`bookmark-alist', filtered to retain only Gnus bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-gnus-bookmark-p bookmark-alist)) - -(defun bmkp-image-alist-only () - "`bookmark-alist', filtered to retain only image-file bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-image-bookmark-p bookmark-alist)) - -(defun bmkp-info-alist-only () - "`bookmark-alist', filtered to retain only Info bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-info-bookmark-p bookmark-alist)) - -(defun bmkp-last-specific-buffer-alist-only () - "`bookmark-alist', but only for `bmkp-last-specific-buffer'. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-last-specific-buffer-p bookmark-alist)) - -(defun bmkp-last-specific-file-alist-only () - "`bookmark-alist', but only for `bmkp-last-specific-file'. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-last-specific-file-p bookmark-alist)) - -(defun bmkp-man-alist-only () - "`bookmark-alist', filtered to retain only `man' page bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-man-bookmark-p bookmark-alist)) - -(defun bmkp-local-file-alist-only () - "`bookmark-alist', filtered to retain only local-file bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-local-file-bookmark-p bookmark-alist)) - -(defun bmkp-non-autonamed-alist-only () - "`bookmark-alist', with only non-autonamed bookmarks (from any buffers). -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (lambda (bmk) (not (bmkp-autonamed-bookmark-p bmk))) bookmark-alist)) - -(defun bmkp-non-file-alist-only () - "`bookmark-alist', filtered to retain only non-file bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-non-file-bookmark-p bookmark-alist)) - -(defun bmkp-orphaned-file-alist-only () - "`bookmark-alist', filtered to retain only orphaned file bookmarks." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-orphaned-file-bookmark-p bookmark-alist)) - -(defun bmkp-orphaned-local-file-alist-only () - "`bookmark-alist', but retaining only orphaned local-file bookmarks." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-orphaned-local-file-bookmark-p bookmark-alist)) - -(defun bmkp-orphaned-remote-file-alist-only () - "`bookmark-alist', but retaining only orphaned remote-file bookmarks." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-orphaned-remote-file-bookmark-p bookmark-alist)) - -(defun bmkp-regexp-filtered-annotation-alist-only () - "`bookmark-alist' for annotations matching `bmkp-bmenu-filter-pattern'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not - #'(lambda (bmk) - (let ((annot (bookmark-get-annotation bmk))) - (and (stringp annot) (not (string= "" annot)) - (string-match bmkp-bmenu-filter-pattern annot)))) - bookmark-alist)) ; (Could use `bmkp-annotated-alist-only' here instead.) - -(defun bmkp-regexp-filtered-bookmark-name-alist-only () - "`bookmark-alist' for bookmarks matching `bmkp-bmenu-filter-pattern'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not - #'(lambda (bmk) (string-match bmkp-bmenu-filter-pattern (car bmk))) bookmark-alist)) - -(defun bmkp-regexp-filtered-file-name-alist-only () - "`bookmark-alist' for files matching `bmkp-bmenu-filter-pattern'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'(lambda (bmk) (let ((fname (bookmark-get-filename bmk))) - (and fname (string-match bmkp-bmenu-filter-pattern fname)))) - bookmark-alist)) - -(defun bmkp-regexp-filtered-tags-alist-only () - "`bookmark-alist' for tags matching `bmkp-bmenu-filter-pattern'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'(lambda (bmk) - (let ((bmk-tags (bmkp-get-tags bmk))) - (and bmk-tags (bmkp-some #'(lambda (tag) (string-match bmkp-bmenu-filter-pattern - (bmkp-tag-name tag))) - bmk-tags)))) - bookmark-alist)) - -(defun bmkp-region-alist-only () - "`bookmark-alist', filtered to retain only bookmarks that have regions. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-region-bookmark-p bookmark-alist)) - -(defun bmkp-remote-file-alist-only () - "`bookmark-alist', filtered to retain only remote-file bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-remote-file-bookmark-p bookmark-alist)) - -(defun bmkp-some-tags-alist-only (tags) - "`bookmark-alist', but with only bookmarks having some tags in TAGS. -A new list is returned (no side effects)." - (bmkp-remove-if-not - (lexical-let ((tgs tags)) - #'(lambda (bmk) (bmkp-some (lexical-let ((bk bmk)) #'(lambda (tag) (bmkp-has-tag-p bk tag))) tgs))) - bookmark-alist)) - -(defun bmkp-some-tags-regexp-alist-only (regexp) - "`bookmark-alist', but with only bookmarks having some tags match REGEXP. -A new list is returned (no side effects)." - (bmkp-remove-if-not (lexical-let ((rg regexp)) - #'(lambda (bmk) (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - (bmkp-get-tags bmk)))) - bookmark-alist)) - -(defun bmkp-specific-buffers-alist-only (&optional buffers) - "`bookmark-alist', filtered to retain only bookmarks to buffers BUFFERS. -BUFFERS is a list of buffer names. -It defaults to a singleton list with the current buffer's name. -A new list is returned (no side effects). - -Note: Bookmarks created by vanilla Emacs do not record the buffer -name. They are therefore excluded from the returned alist." - (unless buffers (setq buffers (list (buffer-name)))) - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (lexical-let ((bufs buffers)) - #'(lambda (bmk) - (and (not (bmkp-desktop-bookmark-p bmk)) ; Exclude these - (not (bmkp-bookmark-file-bookmark-p bmk)) - (not (bmkp-sequence-bookmark-p bmk)) - (not (bmkp-function-bookmark-p bmk)) - (not (bmkp-variable-list-bookmark-p bmk)) - (member (bmkp-get-buffer-name bmk) bufs)))) - bookmark-alist)) - -(defun bmkp-specific-files-alist-only (&optional files) - "`bookmark-alist', filtered to retain only bookmarks to files FILES. -FILES is a list of absolute file names. -It defaults to a singleton list with the current buffer's file name. -A new list is returned (no side effects)." - (unless files (setq files (list (buffer-file-name)))) - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (lexical-let ((ff files)) #'(lambda (bmk) (member (bookmark-get-filename bmk) ff))) - bookmark-alist)) - -(defun bmkp-temporary-alist-only () - "`bookmark-alist', filtered to retain only temporary bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-temporary-bookmark-p bookmark-alist)) - -(defun bmkp-this-file/buffer-alist-only () - "`bookmark-alist', with only bookmarks for the current file/buffer. -A new list is returned (no side effects). -If visiting a file, this is `bmkp-this-file-alist-only'. -Otherwise, this is `bmkp-this-buffer-alist-only'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not (if (buffer-file-name) #'bmkp-this-file-p #'bmkp-this-buffer-p) bookmark-alist)) - -(defun bmkp-this-buffer-alist-only () - "`bookmark-alist', with only bookmarks for the current buffer. -A new list is returned (no side effects). -See `bmkp-this-buffer-p'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-this-buffer-p bookmark-alist)) - -(defun bmkp-this-file-alist-only () - "`bookmark-alist', with only bookmarks for the current file. -A new list is returned (no side effects). -See `bmkp-this-file-p'." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-this-file-p bookmark-alist)) - -(defun bmkp-url-alist-only () - "`bookmark-alist', filtered to retain only URL bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-url-bookmark-p bookmark-alist)) - -(defun bmkp-url-browse-alist-only () - "`bookmark-alist', filtered to retain only non-W3M URL bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-url-browse-bookmark-p bookmark-alist)) - -(defun bmkp-variable-list-alist-only () - "`bookmark-alist', filtered to retain only variable-list bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-variable-list-bookmark-p bookmark-alist)) - -(defun bmkp-w3m-alist-only () - "`bookmark-alist', filtered to retain only W3M bookmarks. -A new list is returned (no side effects)." - (bookmark-maybe-load-default-file) - (bmkp-remove-if-not #'bmkp-w3m-bookmark-p bookmark-alist)) - - -;;; Marked bookmarks - -(defun bmkp-marked-bookmarks-only () - "Return the list of marked bookmarks." - (bmkp-remove-if-not #'bmkp-marked-bookmark-p bookmark-alist)) - -(defun bmkp-unmarked-bookmarks-only () - "Return the list of unmarked bookmarks." - (bmkp-remove-if #'bmkp-marked-bookmark-p bookmark-alist)) - -(defun bmkp-some-marked-p (alist) - "Return non-nil if ALIST is nonempty and includes a marked bookmark." - (catch 'break (dolist (i alist) (and (bmkp-marked-bookmark-p i) (throw 'break t))))) - -(defun bmkp-some-unmarked-p (alist) - "Return non-nil if ALIST is nonempty and includes an unmarked bookmark." - (catch 'break (dolist (i alist) (and (not (bmkp-marked-bookmark-p i)) (throw 'break t))))) - - -;;(@* "General Utility Functions") -;; *** General Utility Functions *** - -(when (and (fboundp 'cl-puthash) (not (fboundp 'puthash))) ; Emacs 20 with `cl-extra.el' loaded. - (defalias 'puthash 'cl-puthash)) - -(if (fboundp 'puthash) ; Emacs 21+, or Emacs 20 with `cl-extra.el' loaded. - (defun bmkp-remove-dups (sequence &optional test) - "Copy of SEQUENCE with duplicate elements removed. -Optional arg TEST is the test function. If nil, test with `equal'. -See `make-hash-table' for possible values of TEST." - (setq test (or test #'equal)) - (let ((htable (make-hash-table :test test))) - (loop for elt in sequence - unless (gethash elt htable) - do (puthash elt elt htable) - finally return (loop for i being the hash-values in htable collect i)))) - - (defun bmkp-remove-dups (list &optional use-eq) - "Copy of LIST with duplicate elements removed. -Test using `equal' by default, or `eq' if optional USE-EQ is non-nil." - (let ((tail list) - new) - (while tail - (unless (if use-eq (memq (car tail) new) (member (car tail) new)) - (push (car tail) new)) - (pop tail)) - (nreverse new)))) - -;; For a name propertized with `bmkp-full-record', this is similar to `bmkp-assoc-delete-all'. -(defun bmkp-delete-bookmark-name-from-list (delname bnames) - "Delete names that represent the same bookmark as DELNAME from BNAMES. -This means that they are `string=' and they either have no property -`bmkp-full-record' or that property has the same value. -Return the modified list BNAMES." - ;; $$$$$$ Can we change `equal' to `eq' everywhere here? - (let ((delprop (get-text-property 0 'bmkp-full-record delname)) - bmkprop) - (if (not delprop) - (setq bnames (delete delname bnames)) ; Unpropertized - just use `delete'. - ;; Propertized. Delete names that are `string=' and have the same property value or none. - (while (and bnames (string= delname (car bnames)) ; Delete those at list beginning. - (or (not (setq bmkprop (get-text-property 0 'bmkp-full-record (car bnames)))) - (equal delprop bmkprop))) - (setq bnames (cdr bnames))) - (let ((tail bnames) ; Delete those not at list beginning. - tail-cdr) - (while (setq tail-cdr (cdr tail)) - (if (and (car tail-cdr) - (string= delname (car tail-cdr)) - (or (not (setq bmkprop (get-text-property 0 'bmkp-full-record (car tail-cdr)))) - (equal delprop bmkprop))) - (setcdr tail (cdr tail-cdr)) - (setq tail tail-cdr)))) - bnames))) - -(defun bmkp-bookmark-name-member (name names) - "Like `member', but tests also bookmark NAME's `bmkp-full-record' property. -Return the tail of NAMES whose car is NAME with the property match. -If NAME has no `bmkp-full-record' property then this is just `member'. -If NAME has property `bmkp-full-record', then test whether both: - a. NAME is a member of NAMES and - b. NAME has the same `bmkp-full-record' value as an element of NAMES." - ;; $$$$$$ Can we change `equal' to `eq' here? - (let ((prop (get-text-property 0 'bmkp-full-record name))) - (if (not prop) - (member name names) ; Unpropertized - just use `member'. - (while (and names (not (and (string= name (car names)) ; = `bmkp-names-same-bookmark-p'. - ;; If unpropertized in NAMES, then assume it's the one. - (or (not (get-text-property 0 'bmkp-full-record (car names))) - (equal prop (get-text-property 0 'bmkp-full-record (car names))))))) - (setq names (cdr names))) - names))) - -(defun bmkp-names-same-bookmark-p (name1 name2) - "Return non-nil if the two strings name the same bookmark. -The strings are `string=' and their `bmkp-full-record' property values -for the first character are `equal'." - - ;; $$$$$$ Can we change `equal' to `eq' here? - (and (string= name1 name2) - (equal (get-text-property 0 'bmkp-full-record name1) - (get-text-property 0 'bmkp-full-record name2)))) - -(defun bmkp-remove-if (pred xs) - "A copy of list XS with no elements that satisfy predicate PRED." - (let ((result ())) - (dolist (x xs) (unless (funcall pred x) (push x result))) - (nreverse result))) - -(defun bmkp-remove-if-not (pred xs) - "A copy of list XS with only elements that satisfy predicate PRED." - (let ((result ())) - (dolist (x xs) (when (funcall pred x) (push x result))) - (nreverse result))) - -;; Similar to `every' in `cl-extra.el', without non-list sequences and multiple sequences. -(defun bmkp-every (predicate list) - "Return t if PREDICATE is true for all elements of LIST; else nil." - (while (and list (funcall predicate (car list))) (setq list (cdr list))) - (null list)) - -;; Similar to `some' in `cl-extra.el', without non-list sequences and multiple sequences. -(defun bmkp-some (predicate list) - "Return non-nil if PREDICATE is true for some element of LIST; else nil. -Return the first non-nil value returned by PREDICATE." - (let ((res nil)) - (while (and list (not (setq res (funcall predicate (pop list)))))) - res)) - -;; From `cl-seq.el', function `union', without keyword treatment. -;; (Same as `icicle-set-union' in `icicles-fn.el'.) -(defun bmkp-set-union (list1 list2) - "Combine LIST1 and LIST2 using a set-union operation. -The result list contains all items that appear in either LIST1 or -LIST2. Comparison is done using `equal'. This is a non-destructive -function; it copies the data if necessary." - (cond ((null list1) list2) - ((null list2) list1) - ((equal list1 list2) list1) - (t - (unless (>= (length list1) (length list2)) - (setq list1 (prog1 list2 (setq list2 list1)))) ; Swap them. - (while list2 - (unless (member (car list2) list1) (setq list1 (cons (car list2) list1))) - (setq list2 (cdr list2))) - list1))) - -(defun bmkp-upcase (string) - "`upcase', but in case of error, return original STRING. -This works around an Emacs 20 problem that occurs if STRING contains -binary data (weird chars)." - (condition-case nil (upcase string) (error string))) - -;; Thx to Michael Heerdegen and Michael Albinus for help with this one. -(defun bmkp-same-file-p (file1 file2) - "Return non-nil if FILE1 and FILE2 name the same file. -If either name is not absolute, then it is expanded relative to -`default-directory' for the test." - (let* ((remote1 (bmkp-file-remote-p file1)) - (remote2 (bmkp-file-remote-p file2)) - (ignore-case-p (and (not remote1) (not remote2) ; Assume case-sensitive if remote. - (if (boundp 'read-file-name-completion-ignore-case) - (eval (car (get 'read-file-name-completion-ignore-case - 'standard-value))) - ;; From the Emacs 24 definition of `read-file-name-completion-ignore-case'. - (memq system-type '(ms-dos windows-nt darwin cygwin)))))) - (and (equal remote1 remote2) - (if (fboundp 'file-equal-p) - (file-equal-p file1 file2) - (let ((ft1 (file-truename (expand-file-name file1))) - (ft2 (file-truename (expand-file-name file2)))) - (eq t (compare-strings ft1 0 (length ft1) ft2 0 (length ft2) ignore-case-p))))))) - -;;; $$$$$$ -;;; (defun bmkp-same-file-p (file1 file2) -;;; "Return non-nil if FILE1 and FILE2 name the same file. -;;; If either name is not absolute, then it is expanded relative to -;;; `default-directory' for the test." -;;; (and (equal (bmkp-file-remote-p file1) (bmkp-file-remote-p file2)) -;;; (string= (file-truename (expand-file-name file1)) -;;; (file-truename (expand-file-name file2))))) - -;;; $$$$$$ -;;; (defun bmkp-file-remote-p (file-name) -;;; "Returns non-nil if string FILE-NAME is likely to name a remote file." -;;; (if (fboundp 'file-remote-p) -;;; (file-remote-p file-name) -;;; (and (fboundp 'ffap-file-remote-p) (ffap-file-remote-p file-name)))) - -(defun bmkp-file-remote-p (file) - "Test whether FILE specifies a location on a remote system. -Return nil or a string identifying the remote connection (ideally a -prefix of FILE). - -A file is considered remote if accessing it is likely to be slower or -less reliable than accessing local files. - -This is `file-remote-p', if that function is available. If not, use a -simple match against rough remote file syntax: `/...:'. - -Unless `file-remote-p' is available and FILE has a `file-remote-p' -handler that opens a remote connection, `bmkp-file-remote-p' does not -open a remote connection." - (if (fboundp 'file-remote-p) - (file-remote-p file) - (and (stringp file) (string-match "\\`/[^/]+:" file) - (match-string 0 file)))) - -(defun bmkp-float-time (&optional specified-time) - "Same as `float-time'. (Needed for Emacs 20.)" - (if (fboundp 'float-time) - (float-time specified-time) - (unless specified-time (setq specified-time (current-time))) - (+ (* (float (nth 0 specified-time)) (expt 2 16)) (nth 1 specified-time)))) - -(defun bmkp-string-less-case-fold-p (s1 s2) - "Like `string-lessp', but respect `case-fold-search'." - (when case-fold-search (setq s1 (bmkp-upcase s1) - s2 (bmkp-upcase s2))) - (string-lessp s1 s2)) - -(defun bmkp-make-plain-predicate (pred &optional final-pred) - "Return a plain predicate that corresponds to component-predicate PRED. -PRED and FINAL-PRED correspond to their namesakes in -`bmkp-sort-comparer' (which see). - -PRED should return `(t)', `(nil)', or nil. - -Optional arg FINAL-PRED is the final predicate to use if PRED cannot -decide (returns nil). If FINAL-PRED is nil, then `bmkp-alpha-p', the -plain-predicate equivalent of `bmkp-alpha-cp' is used as the final -predicate." - `(lambda (b1 b2) (let ((res (funcall ',pred b1 b2))) - (if res (car res) (funcall ',(or final-pred 'bmkp-alpha-p) b1 b2))))) - -(defun bmkp-repeat-command (command) - "Repeat COMMAND." - (let ((repeat-message-function 'ignore)) - (setq last-repeatable-command command) - (repeat nil))) - - -;;; If you need this for some reason, uncomment it. -;;; (defun bmkp-fix-bookmark-alist-and-save () -;;; "Update format of `bookmark-default-file' created in summer of 2009. -;;; You DO NOT NEED THIS, unless you happen to have used `bookmark+.el' in -;;; the summer of 2009 to create non-file bookmarks. If you did that, -;;; then some of those bookmarks might cause vanilla Emacs (emacs -Q) to -;;; raise an error. You can use this command to fix that problem: it -;;; modifies your existing `bookmark-default-file' (`.emacs.bmk'), after -;;; backing up that file (suffixing the name with \"_saveNUMBER\")." -;;; (interactive) -;;; (require 'cl) ; For `gensym' -;;; (if (not (yes-or-no-p -;;; "This will modify your bookmark file, after backing it up. OK? ")) -;;; (message "OK, nothing done") -;;; (bookmark-maybe-load-default-file) -;;; (let ((bkup-file (concat bookmark-default-file "_" (symbol-name (gensym "save"))))) -;;; (when (condition-case err -;;; (progn -;;; (with-current-buffer (find-file-noselect bookmark-default-file) -;;; (write-file bkup-file)) -;;; (dolist (bmk bookmark-alist) -;;; (let ((fn-tail (member '(filename) bmk)) -;;; (hdlr (bookmark-get-handler (car bmk)))) -;;; (cond (fn-tail -;;; (setcar fn-tail (cons 'filename bmkp-non-file-filename))) -;;; ((and (eq hdlr 'bmkp-jump-gnus) -;;; (not (assoc 'filename bmk))) -;;; (setcdr bmk (cons (cons 'filename bmkp-non-file-filename) -;;; (cdr bmk))))))) -;;; t) ; Be sure `dolist' exit with t to allow saving. -;;; (error (error "No changes made. %s" (error-message-string err)))) -;;; (bookmark-save) -;;; (message "Bookmarks file fixed. Old version is `%s'" bkup-file))))) - - -;;(@* "Bookmark Entry Access Functions") -;; *** Bookmark Entry Access Functions *** - -(defun bmkp-get-buffer-name (bookmark) - "Return the `buffer-name' value for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bookmark-prop-get bookmark 'buffer-name)) - -(defun bmkp-get-end-position (bookmark) - "Return the `end-position' value for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bookmark-prop-get bookmark 'end-position)) - -(defun bmkp-get-visits-count (bookmark) - "Return the `visits' count for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - (bookmark-prop-get bookmark 'visits)) - -(defun bmkp-get-visit-time (bookmark) - "Return the `time' value for BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record." - ;; Should just be a prop-get, but when first implemented, we used a float - ;; instead of a time cons, so we need to convert any such obsolete recorded times. - (let ((vt (bookmark-prop-get bookmark 'time))) - (when (numberp vt) ; Convert mid-2009 time values (floats) to cons form. - (setq vt (if (boundp 'seconds-to-time) - (seconds-to-time vt) - (list (floor vt 65536) ; Inlined `seconds-to-time', for Emacs 20-21. - (floor (mod vt 65536)) - (floor (* (- vt (ffloor vt)) 1000000)))))) - vt)) - - -;;(@* "Sorting - General Functions") -;; *** Sorting - General Functions *** - -(defun bmkp-sort-omit (alist &optional omit) - "Sort a copy of ALIST, omitting any elements whose keys are in OMIT. -Return the copy. -Do not sort if `bmkp-sort-comparer' is nil. -This is a non-destructive operation: ALIST is not modified. - -Sorting is done using using `bmkp-sort-comparer'. -If `bmkp-reverse-sort-p' is non-nil, then reverse the sort order. -Keys are compared for sorting using `equal'. - -If optional arg OMIT is non-nil, then it is a list of keys. Omit from -the return value any elements with keys in the list." - (lexical-let ((new-alist (bmkp-remove-omitted alist omit)) - (sort-fn (and bmkp-sort-comparer (if (and (not (functionp bmkp-sort-comparer)) - (consp bmkp-sort-comparer)) - 'bmkp-multi-sort - bmkp-sort-comparer)))) - (when sort-fn - (setq new-alist (sort new-alist (if bmkp-reverse-sort-p - #'(lambda (a b) (not (funcall sort-fn a b))) - sort-fn)))) - new-alist)) - -(defun bmkp-remove-omitted (alist &optional omit) - "Copy of bookmark ALIST without bookmarks whose names are in list OMIT. -Name comparison is done using `bmkp-bookmark-name-member'. -If optional arg OMIT is non-nil, then omit from the return value any -elements with keys in list OMIT." - (let ((new ())) - (dolist (ii alist) (unless (bmkp-bookmark-name-member (car ii) omit) (push ii new))) - (nreverse new))) - -;;; $$$$$$ No longer used. -;;; (defun bmkp-sort-and-remove-dups (alist &optional omit) -;;; "Remove duplicates from a copy of ALIST, then sort it and return it. -;;; Do not sort if `bmkp-sort-comparer' is nil. -;;; Always remove duplicates. Keep only the first element with a given -;;; key. This is a non-destructive operation: ALIST is not modified. - -;;; Sorting is done using using `bmkp-sort-comparer'. -;;; If `bmkp-reverse-sort-p' is non-nil, then reverse the sort order. -;;; Keys are compared for sorting using `equal'. -;;; If optional arg OMIT is non-nil, then omit from the return value any -;;; elements with keys in list OMIT." -;;; (lexical-let ((new-alist (bmkp-remove-assoc-dups alist omit)) -;;; (sort-fn (and bmkp-sort-comparer (if (and (not (functionp bmkp-sort-comparer)) -;;; (consp bmkp-sort-comparer)) -;;; 'bmkp-multi-sort -;;; bmkp-sort-comparer)))) -;;; (when sort-fn -;;; (setq new-alist (sort new-alist (if bmkp-reverse-sort-p -;;; #'(lambda (a b) (not (funcall sort-fn a b))) -;;; sort-fn)))) -;;; new-alist)) - -;;; KEEP this simpler version also. This uses `run-hook-with-args-until-success', but it -;;; does not respect `bmkp-reverse-multi-sort-p'. -;;; (defun bmkp-multi-sort (b1 b2) -;;; "Try predicates in `bmkp-sort-comparer', in order, until one decides. -;;; See the description of `bmkp-sort-comparer'." -;;; (let* ((preds (append (car bmkp-sort-comparer) (cdr bmkp-sort-comparer))) -;;; (result (run-hook-with-args-until-success 'preds b1 b2))) -;;; (if (consp result) -;;; (car result) -;;; result))) - -;;; $$$$$$ No longer used. -;;; (defun bmkp-remove-assoc-dups (alist &optional omit) -;;; "Shallow copy of ALIST without elements that have duplicate keys. -;;; Only the first element of those with the same key is kept. -;;; Keys are compared using `equal'. -;;; If optional arg OMIT is non-nil, then omit from the return value any -;;; elements with keys in list OMIT." -;;; (let ((new ())) -;;; (dolist (ii alist) (unless (or (assoc (car ii) new) (member (car ii) omit)) (push ii new))) -;;; (nreverse new))) - - -;; This Lisp definition respects `bmkp-reverse-multi-sort-p', and can be extended. -(defun bmkp-multi-sort (b1 b2) - "Try predicates in `bmkp-sort-comparer', in order, until one decides. -See the description of `bmkp-sort-comparer'. -If `bmkp-reverse-multi-sort-p' is non-nil, then reverse the order for -using multi-sorting predicates." - (let ((preds (car bmkp-sort-comparer)) - (final-pred (cadr bmkp-sort-comparer)) - (result nil)) - (when bmkp-reverse-multi-sort-p (setq preds (reverse preds))) - (catch 'bmkp-multi-sort - (dolist (pred preds) - (setq result (funcall pred b1 b2)) - (when (consp result) - (when bmkp-reverse-multi-sort-p (setq result (list (not (car result))))) - (throw 'bmkp-multi-sort (car result)))) - (and final-pred (if bmkp-reverse-multi-sort-p - (not (funcall final-pred b1 b2)) - (funcall final-pred b1 b2)))))) - -;; The message is only approximate. The effect of `bmkp-reverse-multi-sort-p' is not -;; always intuitive, but it can often be useful. What's not always intuitive is the placement -;; (the order) of bookmarks that are not sorted by the PREDs. -;; -(defun bmkp-msg-about-sort-order (order &optional prefix-msg suffix-msg) - "Display a message mentioning the current sort ORDER and direction. -Optional arg PREFIX-MSG is prepended to the constructed message, and -terminated with a period. -Similarly, SUFFIX-MSG is appended, after appending \". \"." - (let ((msg (if (not bmkp-sort-comparer) - "Bookmarks NOT sorted" - (format "%s%s" (concat "Sorted " order) - (if (not (and (consp bmkp-sort-comparer) ; Ordinary single predicate. - (consp (car bmkp-sort-comparer)))) - (if bmkp-reverse-sort-p "; REVERSED" "") - (if (not (cadr (car bmkp-sort-comparer))) - ;; Single PRED. - (if (or (and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p)) - (and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p))) - "; REVERSED" - "") - - ;; In case we want to distinguish: - ;; (if (and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p)) - ;; "; reversed" - ;; (if (and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p)) - ;; "; reversed +" - ;; "")) - - ;; At least two PREDs. - (cond ((and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p)) - "; REVERSED") - ((and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p)) - "; each predicate group reversed") - ((and bmkp-reverse-multi-sort-p bmkp-reverse-sort-p) - "; order of predicate groups reversed") - (t "")))))))) - (when prefix-msg (setq msg (concat prefix-msg ". " msg))) - (when suffix-msg (setq msg (concat msg ". " suffix-msg))) - (message msg))) - - -;;(@* "Sorting - Commands") -;; *** Sorting - Commands *** - -(defun bmkp-current-sort-order () - "Current sort order or sort function, as a string suitable in a message." - (or (car (rassoc bmkp-sort-comparer bmkp-sort-orders-alist)) (format "%s" bmkp-sort-comparer))) - - -;;(@* "Sorting - General Predicates") -;; *** Sorting - General Predicates *** - -(defun bmkp-flagged-cp (b1 b2) - "True if bookmark B1 is flagged for deletion and bookmark B2 is not. -Return nil if incomparable as described. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((m1 (bmkp-flagged-bookmark-p b1)) - (m2 (bmkp-flagged-bookmark-p b2))) - (cond ((and m1 m2) nil) - (m1 '(t)) - (m2 '(nil)) - (t nil)))) - -(defun bmkp-marked-cp (b1 b2) - "True if bookmark B1 is marked and bookmark B2 is not. -Return nil if incomparable as described. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((m1 (bmkp-marked-bookmark-p b1)) - (m2 (bmkp-marked-bookmark-p b2))) - (cond ((and m1 m2) nil) - (m1 '(t)) - (m2 '(nil)) - (t nil)))) - -(defun bmkp-modified-cp (b1 b2) - "True if bookmark B1 is modified and bookmark B2 is not. -Return nil if incomparable as described. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((m1 (bmkp-modified-bookmark-p b1)) - (m2 (bmkp-modified-bookmark-p b2))) - (cond ((and m1 m2) nil) - (m1 '(t)) - (m2 '(nil)) - (t nil)))) - -(defun bmkp-tagged-cp (b1 b2) - "True if bookmark B1 is tagged and bookmark B2 is not. -Return nil if incomparable as described. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((m1 (bmkp-tagged-bookmark-p b1)) - (m2 (bmkp-tagged-bookmark-p b2))) - (cond ((and m1 m2) nil) - (m1 '(t)) - (m2 '(nil)) - (t nil)))) - -(defun bmkp-visited-more-cp (b1 b2) - "True if bookmark B1 was visited more often than B2. -Return nil if incomparable as described. - -True also if B1 was visited but B2 was not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((v1 (bmkp-get-visits-count b1)) - (v2 (bmkp-get-visits-count b2))) - (cond ((and v1 v2) - (cond ((> v1 v2) '(t)) - ((> v2 v1) '(nil)) - (t nil))) - (v1 '(t)) - (v2 '(nil)) - (t nil)))) - -(defun bmkp-bookmark-creation-cp (b1 b2) - "True if bookmark B1 was created more recently than B2. -Return nil if incomparable as described. - -True also if B1 has a `created' entry but B2 has none. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((t1 (bookmark-prop-get b1 'created)) - (t2 (bookmark-prop-get b2 'created))) - (cond ((and t1 t2) - (setq t1 (bmkp-float-time t1) - t2 (bmkp-float-time t2)) - (cond ((> t1 t2) '(t)) - ((> t2 t1) '(nil)) - (t nil))) - (t1 '(t)) - (t2 '(nil)) - (t nil)))) - -;; Not used currently. -(defun bmkp-same-creation-time-p (b1 b2) - "Return non-nil if `B1 and B2 have same `created' entry. -If neither has a `created' entry (vanilla bookmarks), then return -non-nil if the full bookmarks are `equal'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (let ((time1 (bookmark-prop-get b1 'created)) - (time2 (bookmark-prop-get b2 'created))) - (if (or time1 time2) - (equal time1 time2) - (equal b1 b2)))) - -(defun bmkp-bookmark-last-access-cp (b1 b2) - "True if bookmark B1 was visited more recently than B2. -Return nil if incomparable as described. - -True also if B1 was visited but B2 was not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((t1 (bmkp-get-visit-time b1)) - (t2 (bmkp-get-visit-time b2))) - (cond ((and t1 t2) - (setq t1 (bmkp-float-time t1) - t2 (bmkp-float-time t2)) - (cond ((> t1 t2) '(t)) - ((> t2 t1) '(nil)) - (t nil))) - (t1 '(t)) - (t2 '(nil)) - (t nil)))) - -(defun bmkp-buffer-last-access-cp (b1 b2) - "True if bookmark B1's buffer or file was visited more recently than B2's. -Return nil if incomparable as described. - -A bookmark to an existing buffer sorts before a file bookmark, even if -the buffer has not been visited during this session. - -True also if B1 has a buffer but B2 does not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((buf1 (bmkp-get-buffer-name b1)) - (buf2 (bmkp-get-buffer-name b2)) - f1 f2 t1 t2) - (setq buf1 (and buf1 (get-buffer buf1)) - buf2 (and buf2 (get-buffer buf2))) - (cond ((and buf1 buf2) ; Both buffers exist. See whether they were accessed. - (when buf1 (setq buf1 (member buf1 (buffer-list)) - buf1 (length buf1))) - (when buf2 (setq buf2 (member buf2 (buffer-list)) - buf2 (length buf2))) - (cond ((and buf1 buf2) ; Both were accessed. Priority to most recent access. - (cond ((< buf1 buf2) '(t)) - ((< buf2 buf1) '(nil)) - (t nil))) - (buf1 '(t)) ; Only buf1 was accessed. - (buf2 '(nil)) ; Only buf2 was accessed. - (t nil))) ; Neither was accessed. - - (buf1 '(t)) ; Only buf1 exists. - (buf2 '(nil)) ; Only buf2 exists. - (t nil)))) ; Neither buffer exists - -(defun bmkp-handler-cp (b1 b2) - "True if bookmark B1's handler name sorts alphabetically before B2's. -Return nil if neither sorts before the other. - -Two bookmarks with handlers are compared alphabetically, by their -handler-function names, respecting `case-fold-search'. -True also if B1 has a handler but B2 has not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((h1 (bookmark-get-handler b1)) - (h2 (bookmark-get-handler b2))) - (cond ((and h1 h2 (symbolp h1) (symbolp h2)) - ;; Pretend woman bookmarks are man bookmarks, to keep them together. - (when (eq h1 'bmkp-jump-woman) (setq h1 'bmkp-jump-man)) - (when (eq h2 'bmkp-jump-woman) (setq h2 'bmkp-jump-man)) - (setq h1 (symbol-name h1) - h2 (symbol-name h2)) - (when case-fold-search (setq h1 (bmkp-upcase h1) - h2 (bmkp-upcase h2))) - (cond ((string-lessp h1 h2) '(t)) - ((string-lessp h2 h1) '(nil)) - (t nil))) - (h1 '(t)) - (h2 '(nil)) - (t nil)))) - -(defun bmkp-info-cp (b1 b2) - "True if bookmark B1 sorts as an Info bookmark before B2. -Return nil if neither sorts before the other. - -Two Info bookmarks are compared first by file name (corresponding to -the manual), then by node name, then by position. -True also if B1 is an Info bookmark but B2 is not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((i1 (bmkp-info-bookmark-p b1)) - (i2 (bmkp-info-bookmark-p b2))) - (cond ((and i1 i2) - (setq i1 (abbreviate-file-name (bookmark-get-filename b1)) - i2 (abbreviate-file-name (bookmark-get-filename b2))) - (when case-fold-search (setq i1 (bmkp-upcase i1) - i2 (bmkp-upcase i2))) - (cond ((string-lessp i1 i2) '(t)) ; Compare manuals (file names). - ((string-lessp i2 i1) '(nil)) - (t ; Compare node names. - (setq i1 (bookmark-prop-get b1 'info-node) - i2 (bookmark-prop-get b2 'info-node)) - (cond ((string-lessp i1 i2) '(t)) - ((string-lessp i2 i1) '(nil)) - (t - (setq i1 (bookmark-get-position b1) - i2 (bookmark-get-position b2)) - (cond ((or (not i1) (not i2)) '(t)) ; Fallback if no `position' entry. - ((<= i1 i2) '(t)) - ((< i2 i1) '(nil)))))))) - (i1 '(t)) - (i2 '(nil)) - (t nil)))) - -(defun bmkp-gnus-cp (b1 b2) - "True if bookmark B1 sorts as a Gnus bookmark before B2. -Return nil if neither sorts before the other. - -Two Gnus bookmarks are compared first by Gnus group name, then by -article number, then by message ID. -True also if B1 is a Gnus bookmark but B2 is not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((g1 (bmkp-gnus-bookmark-p b1)) - (g2 (bmkp-gnus-bookmark-p b2))) - (cond ((and g1 g2) - (setq g1 (bookmark-prop-get b1 'group) - g2 (bookmark-prop-get b2 'group)) - (cond ((string-lessp g1 g2) '(t)) ; Compare groups. - ((string-lessp g2 g1) '(nil)) - (t ; Compare article numbers. - (setq g1 (bookmark-prop-get b1 'article) - g2 (bookmark-prop-get b2 'article)) - (cond ((< g1 g2) '(t)) - ((< g2 g1) '(nil)) - (t - (setq g1 (bookmark-prop-get b1 'message-id) - g2 (bookmark-prop-get b2 'message-id)) - (cond ((string-lessp g1 g2) '(t)) ; Compare message IDs. - ((string-lessp g2 g1) '(nil)) - (t nil))))))) - (g1 '(t)) - (g2 '(nil)) - (t nil)))) - -(defun bmkp-url-cp (b1 b2) - "True if bookmark B1 sorts as a URL bookmark before B2. -Return nil if neither sorts before the other. - -Two URL bookmarks are compared alphabetically, by their URLs. -True also if B1 is a URL bookmark but B2 is not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((u1 (bmkp-url-bookmark-p b1)) - (u2 (bmkp-url-bookmark-p b2))) - (cond ((and u1 u2) - (setq u1 (or (bookmark-prop-get b1 'location) (bookmark-get-filename b1)) - u2 (or (bookmark-prop-get b2 'location) (bookmark-get-filename b2))) - (cond ((string-lessp u1 u2) '(t)) - ((string-lessp u2 u1) '(nil)) - (t nil))) - (u1 '(t)) - (u2 '(nil)) - (t nil)))) - -;; Not used now. -(defun bmkp-w3m-cp (b1 b2) - "True if bookmark B1 sorts as a W3M URL bookmark before B2. -Return nil if neither sorts before the other. - -Two W3M URL bookmarks are compared alphabetically, by their URLs. -True also if B1 is a W3M bookmark but B2 is not. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((w1 (bmkp-w3m-bookmark-p b1)) - (w2 (bmkp-w3m-bookmark-p b2))) - (cond ((and w1 w2) - (setq w1 (bookmark-get-filename b1) - w2 (bookmark-get-filename b2)) - (cond ((string-lessp w1 w2) '(t)) - ((string-lessp w2 w1) '(nil)) - (t nil))) - (w1 '(t)) - (w2 '(nil)) - (t nil)))) - -(defun bmkp-position-cp (b1 b2) - "True if the `position' of B1 is not greater than that of B2. -Return nil if B1 and B2 do not bookmark the same buffer or they have -the same `position' value. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((buf1 (bmkp-get-buffer-name b1)) - (buf2 (bmkp-get-buffer-name b2))) - (and buf1 buf2 (equal buf1 buf2) - (let ((i1 (bookmark-get-position b1)) - (i2 (bookmark-get-position b2))) - (cond ((or (not i1) (not i2)) '(t)) ; Fallback if no `position' entry. - ((<= i1 i2) '(t)) - ((< i2 i1) '(nil))))))) - -(defun bmkp-alpha-cp (b1 b2) - "True if bookmark B1's name sorts alphabetically before B2's. -Return nil if neither sorts before the other. - -The bookmark names are compared, respecting `case-fold-search'. -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((s1 (car b1)) - (s2 (car b2))) - (when case-fold-search (setq s1 (bmkp-upcase s1) - s2 (bmkp-upcase s2))) - (cond ((string-lessp s1 s2) '(t)) - ((string-lessp s2 s1) '(nil)) - (t nil)))) - -;; Do not use `bmkp-make-plain-predicate', because it falls back on `bookmark-alpha-p'. -;; Return nil if `bookmark-alpha-cp' cannot decide. -(defun bmkp-alpha-p (b1 b2) - "True if bookmark B1's name sorts alphabetically before B2's. -The bookmark names are compared, respecting `case-fold-search'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (car (bmkp-alpha-cp b1 b2))) - - -;;(@* "Sorting - File-Name Predicates") -;; *** Sorting - File-Name Predicates *** - -(defun bmkp-file-alpha-cp (b1 b2) - "True if bookmark B1's file name sorts alphabetically before B2's. -Return nil if neither sorts before the other. - -The file names are shortened using `abbreviate-file-name', then they -are compared respecting `case-fold-search'. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (let ((f1 (bmkp-file-bookmark-p b1)) - (f2 (bmkp-file-bookmark-p b2))) - (cond ((and f1 f2) - ;; Call `abbreviate-file-name' mainly to get letter case right per platform. - (setq f1 (abbreviate-file-name (bookmark-get-filename b1)) - f2 (abbreviate-file-name (bookmark-get-filename b2))) - (when case-fold-search (setq f1 (bmkp-upcase f1) - f2 (bmkp-upcase f2))) - (cond ((string-lessp f1 f2) '(t)) - ((string-lessp f2 f1) '(nil)) - (t nil))) - (f1 '(t)) - (f2 '(nil)) - (t nil)))) - -;; We define all file-attribute predicates, in case you want to use them. -;; -;; `bmkp-file-attribute-0-cp' - type -;; `bmkp-file-attribute-1-cp' - links -;; `bmkp-file-attribute-2-cp' - uid -;; `bmkp-file-attribute-3-cp' - gid -;; `bmkp-file-attribute-4-cp' - last access time -;; `bmkp-file-attribute-5-cp' - last update time -;; `bmkp-file-attribute-6-cp' - last status change -;; `bmkp-file-attribute-7-cp' - size -;; `bmkp-file-attribute-8-cp' - modes -;; `bmkp-file-attribute-9-cp' - gid change -;; `bmkp-file-attribute-10-cp' - inode -;; `bmkp-file-attribute-11-cp' - device -;; -(bmkp-define-file-sort-predicate 0) ; Type: file, symlink, dir -(bmkp-define-file-sort-predicate 1) ; Links -(bmkp-define-file-sort-predicate 2) ; Uid -(bmkp-define-file-sort-predicate 3) ; Gid -(bmkp-define-file-sort-predicate 4) ; Last access time -(bmkp-define-file-sort-predicate 5) ; Last modification time -(bmkp-define-file-sort-predicate 6) ; Last status-change time -(bmkp-define-file-sort-predicate 7) ; Size -(bmkp-define-file-sort-predicate 8) ; Modes -(bmkp-define-file-sort-predicate 9) ; Gid would change if re-created -(bmkp-define-file-sort-predicate 10) ; Inode -(bmkp-define-file-sort-predicate 11) ; Device - -(defun bmkp-local-file-accessed-more-recently-cp (b1 b2) - "True if bookmark B1's local file was accessed more recently than B2's. -Return nil if neither sorts before the other. - -A local file sorts before a remote file, which sorts before other -bookmarks. Two remote files are considered incomparable - their -access times are not examined. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (cond ((and (bmkp-local-file-bookmark-p b1) (bmkp-local-file-bookmark-p b2)) - (bmkp-cp-not (bmkp-file-attribute-4-cp b1 b2))) - ((bmkp-local-file-bookmark-p b1) '(t)) - ((bmkp-local-file-bookmark-p b2) '(nil)) - ((and (bmkp-remote-file-bookmark-p b1) - (bmkp-remote-file-bookmark-p b2)) nil) - ((bmkp-remote-file-bookmark-p b1) '(t)) - ((bmkp-remote-file-bookmark-p b2) '(nil)) - (t nil))) - -(defun bmkp-local-file-updated-more-recently-cp (b1 b2) - "True if bookmark B1's local file was updated more recently than B2's. -Return nil if neither sorts before the other. - -A local file sorts before a remote file, which sorts before other -bookmarks. Two remote files are considered incomparable - their -update times are not examined. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (cond ((and (bmkp-local-file-bookmark-p b1) (bmkp-local-file-bookmark-p b2)) - (bmkp-cp-not (bmkp-file-attribute-5-cp b1 b2))) - ((bmkp-local-file-bookmark-p b1) '(t)) - ((bmkp-local-file-bookmark-p b2) '(nil)) - ((and (bmkp-remote-file-bookmark-p b1) - (bmkp-remote-file-bookmark-p b2)) nil) - ((bmkp-remote-file-bookmark-p b1) '(t)) - ((bmkp-remote-file-bookmark-p b2) '(nil)) - (t nil))) - -(defun bmkp-local-file-size-cp (b1 b2) - "True if bookmark B1's local file is larger than B2's. -Return nil if neither sorts before the other. - -A local file sorts before a remote file, which sorts before other -bookmarks. Two remote files are considered incomparable - their -sizes are not examined. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (cond ((and (bmkp-local-file-bookmark-p b1) (bmkp-local-file-bookmark-p b2)) - (bmkp-cp-not (bmkp-file-attribute-7-cp b1 b2))) - ((bmkp-local-file-bookmark-p b1) '(t)) - ((bmkp-local-file-bookmark-p b2) '(nil)) - ((and (bmkp-remote-file-bookmark-p b1) - (bmkp-remote-file-bookmark-p b2)) nil) - ((bmkp-remote-file-bookmark-p b1) '(t)) - ((bmkp-remote-file-bookmark-p b2) '(nil)) - (t nil))) - -(defun bmkp-local-file-type-cp (b1 b2) - "True if bookmark B1 sorts by local file type before B2. -Return nil if neither sorts before the other. - -For two local files, a file sorts before a symlink, which sorts before -a directory. - -A local file sorts before a remote file, which sorts before other -bookmarks. Two remote files are considered incomparable - their file -types are not examined. - -Reverse the roles of B1 and B2 for a false value. -A true value is returned as `(t)', a false value as `(nil)'. - -B1 and B2 are full bookmarks (records) or bookmark names. -If either is a record then it need not belong to `bookmark-alist'." - (setq b1 (bookmark-get-bookmark b1) - b2 (bookmark-get-bookmark b2)) - (cond ((and (bmkp-local-file-bookmark-p b1) (bmkp-local-file-bookmark-p b2)) - (bmkp-file-attribute-0-cp b1 b2)) - ((bmkp-local-file-bookmark-p b1) '(t)) - ((bmkp-local-file-bookmark-p b2) '(nil)) - ((and (bmkp-remote-file-bookmark-p b1) - (bmkp-remote-file-bookmark-p b2)) nil) - ((bmkp-remote-file-bookmark-p b1) '(t)) - ((bmkp-remote-file-bookmark-p b2) '(nil)) - (t nil))) - -(defun bmkp-cp-not (truth) - "Return the negation of boolean value TRUTH. -If TRUTH is (t), return (nil), and vice versa. -If TRUTH is nil, return nil." - (and truth (if (car truth) '(nil) '(t)))) - - -;;(@* "Indirect Bookmarking Functions") -;; *** Indirect Bookmarking Functions *** - -;;;###autoload -(defun bmkp-url-target-set (url &optional prefix-only-p name/prefix msg-p) ; `C-x p c u' - "Set a bookmark for a URL. Return the bookmark. -Interactively you are prompted for the URL. Completion is available. -Use `M-n' to pick up the url at point as the default. - -You are also prompted for the bookmark name. But with a prefix arg, -you are prompted only for a bookmark-name prefix. In that case, the -bookmark name is the prefix followed by the URL. - -When entering a bookmark name you can use completion against existing -names. This completion is lax, so you can easily edit an existing -name. See `bookmark-set' for particular keys available during this -input. - -Non-interactively: -* Non-nil PREFIX-ONLY-P means NAME/PREFIX is a bookmark-name prefix. -* NAME/PREFIX is the bookmark name or its prefix (the suffix = URL). -* Non-nil MSG-P means display a status message." - (interactive - (list (if (require 'ffap nil t) - (ffap-read-file-or-url "URL: " (or (thing-at-point 'url) (and (fboundp 'url-get-url-at-point) - (url-get-url-at-point)))) - (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "URL: " nil (or (thing-at-point 'url) (and (fboundp 'url-get-url-at-point) - (url-get-url-at-point)))))) - current-prefix-arg - (if current-prefix-arg - (read-string "Prefix for bookmark name: ") - (bmkp-completing-read-lax "Bookmark name")))) - (unless name/prefix (setq name/prefix "")) - (lexical-let* ((ul url) - (bookmark-make-record-function (if (eq major-mode 'w3m-mode) - 'bmkp-make-w3m-record - #'(lambda () (bmkp-make-url-browse-record ul)))) - bmk failure) - (condition-case err - (setq bmk (bookmark-store (if prefix-only-p (concat name/prefix url) name/prefix) - (cdr (bookmark-make-record)) nil (not msg-p))) - (error (setq failure err))) - (if (not failure) - bmk ; Return the bookmark. - (error "Failed to create bookmark for `%s':\n%s\n" url failure)))) - -;;;###autoload -(defun bmkp-file-target-set (file &optional prefix-only-p name/prefix no-overwrite no-update-p msg-p) - ; Bound to `C-x p c f' - "Set a bookmark for FILE. Return the bookmark. -The bookmarked position is the beginning of the file. -Interactively you are prompted for FILE. Completion is available. -You can use `M-n' to pick up the file name at point, or if none then -the visited file. - -You are also prompted for the bookmark name. But with a prefix arg, -you are prompted only for a bookmark-name prefix. In that case, the -bookmark name is the prefix followed by the non-directory part of -FILE. - -When entering a bookmark name you can use completion against existing -names. This completion is lax, so you can easily edit an existing -name. See `bookmark-set' for particular keys available during this -input. - -Non-interactively: - - Non-nil optional arg PREFIX-ONLY-P means prompt for a name prefix. - - Optional arg NAME/PREFIX is the name or name prefix string. - - Optional arg NO-OVERWRITE is passed to `bookmark-store': non-nil - means do not overwrite an existing bookmark that has the same name. - - Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. - - Non-nil optional arg MSG-P means show a warning message if file - does not exist." - (interactive - (list (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "File: " nil - (or (if (boundp 'file-name-at-point-functions) ; In `files.el', Emacs 23.2+. - (run-hook-with-args-until-success 'file-name-at-point-functions) - (ffap-guesser)) - (thing-at-point 'filename) - (buffer-file-name)))) - current-prefix-arg - (if current-prefix-arg - (read-string "Prefix for bookmark name: ") - (bmkp-completing-read-lax "Bookmark name")) - 'MSG)) - (unless name/prefix (setq name/prefix "")) - (let ((bookmark-make-record-function (bmkp-make-record-for-target-file file)) - bmk failure) - (condition-case err - (setq bmk (bookmark-store (if prefix-only-p - (concat name/prefix (file-name-nondirectory file)) - name/prefix) - (cdr (bookmark-make-record)) - no-overwrite - (not msg-p))) - (error (setq failure (error-message-string err)))) - (if (not failure) - (prog1 bmk ; Return the bookmark. - (unless no-update-p (bmkp-refresh/rebuild-menu-list bmk (not msg-p))) - (when (and msg-p (not (file-exists-p file))) - (message "File name is now bookmarked, but no such file yet: `%s'" (expand-file-name file)))) - (error "Failed to create bookmark for `%s':\n%s\n" file failure)))) - -(defun bmkp-make-record-for-target-file (file) - "Return a function that creates a bookmark record for FILE. -The bookmarked position will be the beginning of the file." - ;; $$$$$$ Maybe need a way to bypass default handler, at least for autofiles. - ;; Doesn't seem to make much sense to use a handler such as a shell cmd in this context. (?) - (let ((default-handler (condition-case nil (bmkp-default-handler-for-file file) (error nil)))) - (cond (default-handler ; User default handler - `(lambda () '((filename . ,file) (position . 0) (file-handler . ,default-handler)))) - ;; Non-user defaults. - ((and (require 'image nil t) (require 'image-mode nil t) ; Image - (condition-case nil (image-type file) (error nil))) - ;; Last two lines of function are from `image-bookmark-make-record'. - ;; But don't use that directly, because it uses - ;; `bookmark-make-record-default', which gets nil for `filename'. - - ;; NEED to keep this code sync'd with `diredp-bookmark'. - (lambda () - `((filename . ,file) - (position . 0) - (image-type . ,(image-type file)) - (handler . image-bookmark-jump)))) - ((let ((case-fold-search t)) (string-match "\\([.]au$\\|[.]wav$\\)" file)) ; Sound - ;; Obsolete: `(lambda () '((filename . ,file) (handler . bmkp-sound-jump)))) - `(lambda () '((filename . ,file) (file-handler . play-sound-file)))) - (t - `(lambda () '((filename . ,file) (position . 0))))))) - -;;;###autoload -(defalias 'bmkp-bookmark-a-file 'bmkp-autofile-set) -;;;###autoload -(defun bmkp-autofile-set (file &optional dir prefix no-update-p msg-p) ; Bound to `C-x p c a' - "Set a bookmark for FILE, autonaming the bookmark for the file. -Return the bookmark. -Interactively, you are prompted for FILE. You can use `M-n' to pick -up the file name at point or the visited file. - -The bookmark name is the non-directory part of FILE, but with a prefix -arg you are also prompted for a PREFIX string to prepend to the -bookmark name. The bookmarked position is the beginning of the file. - -Note that if you provide PREFIX then the bookmark will not satisfy -`bmkp-autofile-bookmark-p' unless you provide the same PREFIX to that -predicate. - -The bookmark's file name is FILE if absolute. If relative then it is -FILE expanded in DIR, if non-nil, or in the current directory -\(`default-directory'). - -If a bookmark with the same name already exists for the same file name -then do nothing. - -Otherwise, create a new bookmark for the file, even if a bookmark with -the same name already exists. This means that you can have more than -one autofile bookmark with the same bookmark name and the same -relative file name (non-directory part), but with different absolute -file names. - -Non-interactively: - - Non-nil NO-UPDATE-P means do not update `bmkp-tags-alist' and - do not refresh/rebuild the bookmark-list display. - - Non-nil optional arg MSG-P means display status messages." - (interactive - (list (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "File: " nil - (if (or (> emacs-major-version 23) - (and (= emacs-major-version 23) (> emacs-minor-version 1))) - (let ((deflts ()) - def) - (when (setq def (buffer-file-name)) (push def deflts)) - (when (setq def (thing-at-point 'filename)) (push def deflts)) - (when (setq def (ffap-guesser)) (push def deflts)) - (when (and (boundp 'file-name-at-point-functions) - (setq def (run-hook-with-args-until-success - 'file-name-at-point-functions))) - (push def deflts)) - deflts) - (or (if (boundp 'file-name-at-point-functions) ; In `files.el', Emacs 23.2+. - (run-hook-with-args-until-success 'file-name-at-point-functions) - (ffap-guesser)) - (thing-at-point 'filename) - (buffer-file-name))))) - nil - (and current-prefix-arg (read-string "Prefix for bookmark name: ")) - 'MSG)) - (let* ((dir-to-use (if (file-name-absolute-p file) - (file-name-directory file) - (or dir default-directory))) - ;; Look for existing bookmark with same name, same file, in `dir-to-use'. - (bmk (bmkp-get-autofile-bookmark file dir-to-use prefix))) - ;; If BMK was found, then instead of doing nothing we could replace the existing BMK with a new - ;; one, as follows: - ;; (let ((bookmark-make-record-function (bmkp-make-record-for-target-file file))) - ;; (bmkp-replace-existing-bookmark bmk)) ; Update the existing bookmark. - (if (not bmk) - ;; Create a new bookmark, and return it. - (bmkp-file-target-set (expand-file-name file dir-to-use) t prefix 'NO-OVERWRITE no-update-p msg-p) - (when msg-p (message "Autofile bookmark set for `%s'" file)) - bmk))) ; Return the bookmark. - -(defun bmkp-get-autofile-bookmark (file &optional dir prefix) - "Return an existing autofile bookmark for FILE, or nil if there is none. -The bookmark name is the non-directory part of FILE, but if PREFIX is -non-nil then it is PREFIX prepended to the non-directory part of FILE. - -The directory part of property `filename' is the directory part of -FILE, if FILE is absolute. Otherwise, it is DIR, if non-nil, or -`default-directory' otherwise. - -FILE and the `filename' property of the bookmark returned are the -same, except possibly for their directory parts (see previous)." - (let* ((fname (file-name-nondirectory file)) - (bname (if prefix (concat prefix fname) fname)) - (dir-to-use (if (file-name-absolute-p file) - (file-name-directory file) - (or dir default-directory)))) - ;; Look for existing bookmark with same name, same file, in `dir-to-use'. - (catch 'bmkp-get-autofile-bookmark - (dolist (bmk bookmark-alist) - (when (string= bname (bmkp-bookmark-name-from-record bmk)) - (let* ((bfil (bookmark-get-filename bmk)) - (bdir (and bfil (file-name-directory bfil)))) - (when (and bfil - (bmkp-same-file-p fname (file-name-nondirectory bfil)) - (bmkp-same-file-p bdir dir-to-use)) - (throw 'bmkp-get-autofile-bookmark bmk))))) ; Return the bookmark. - nil))) - -;;;###autoload -(defalias 'bmkp-tag-a-file 'bmkp-autofile-add-tags) ; Bound to `C-x p t + a' -;;;###autoload -(defun bmkp-autofile-add-tags (file tags &optional dir prefix no-update-p msg-p) - "Add TAGS to the autofile bookmark for FILE. -Return the number of tags added. - -If there is no autofile bookmark for FILE, create one. -Interactively, you are prompted for FILE and then TAGS. -When prompted for FILE you can use `M-n' to pick up the file name at -point, or if none then the visited file. - -With a non-negative prefix argument, you are prompted for a file-name -prefix, as in `bmkp-autofile-set'. - -When prompted for tags, hit `RET' to enter each tag, then hit `RET' -again after the last tag. You can use completion to enter each tag. -Completion is lax: you are not limited to existing tags. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a non-positive prefix argument if you want to refresh them. - -Non-interactively: - - TAGS is a list of strings. - - DIR, PREFIX, and NO-UPDATE-P are as for `bmkp-autofile-set'. - - Non-nil MSG-P means display a message about the addition." - (interactive - (list (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "File: " nil - (or (if (boundp 'file-name-at-point-functions) ; In `files.el', Emacs 23.2+. - (run-hook-with-args-until-success 'file-name-at-point-functions) - (ffap-guesser)) - (thing-at-point 'filename) - (buffer-file-name)))) - (bmkp-read-tags-completing nil nil (and current-prefix-arg - (< (prefix-numeric-value current-prefix-arg) 1))) - nil - (and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg)) - (read-string "Prefix for bookmark name: ")) - 'msg)) - (bmkp-add-tags (bmkp-autofile-set file dir prefix no-update-p) tags no-update-p msg-p)) - -;;;###autoload -(defalias 'bmkp-untag-a-file 'bmkp-autofile-remove-tags) ; Bound to `C-x p t - a' -;;;###autoload -(defun bmkp-autofile-remove-tags (file tags &optional dir prefix no-update-p msg-p) - "Remove TAGS from autofile bookmark for FILE. -Return the number of tags removed. - -Interactively, you are prompted for TAGS and then FILE. -With Emacs 22 and later, only files with at least one of the given -tags are candidates. - -When prompted for FILE you can use `M-n' to pick up the file name at -point, or if none then the visited file. - -With a non-negative prefix argument, you are prompted for a file-name -prefix, as in `bmkp-autofile-set'. - - -When prompted for tags, hit `RET' to enter each tag to be removed, -then hit `RET' again after the last tag. You can use completion to -enter each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a non-positive prefix argument if you want to refresh them. - -Non-interactively: - - TAGS is a list of strings. - - DIR, PREFIX, and NO-UPDATE-P are as for `bmkp-autofile-set'. - - Non-nil MSG-P means display a message about the removal." - (interactive - (lexical-let* ((pref - (and current-prefix-arg (wholenump (prefix-numeric-value current-prefix-arg)) - (read-string "Prefix for bookmark name: "))) - (tgs - (bmkp-read-tags-completing nil nil (and current-prefix-arg (< (prefix-numeric-value - current-prefix-arg) 1)))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (fil (condition-case nil - (read-file-name - "File: " nil - (or (if (boundp 'file-name-at-point-functions) ; In `files.el', Emacs 23.2+. - (run-hook-with-args-until-success 'file-name-at-point-functions) - (ffap-guesser)) - (thing-at-point 'filename) - (buffer-file-name)) - t nil #'(lambda (ff) ; PREDICATE - only for Emacs 22+. - (let* ((bmk (bmkp-get-autofile-bookmark ff nil pref)) - (btgs (and bmk (bmkp-get-tags bmk)))) - (and btgs (catch 'bmkp-autofile-remove-tags-pred - (dolist (tag tgs) - (when (not (member tag btgs)) - (throw 'bmkp-autofile-remove-tags-pred nil))) - t))))) - (error (read-file-name "File: " nil (or (ffap-guesser) - (thing-at-point 'filename) - (buffer-file-name))))))) - (list fil tgs nil pref 'MSG))) - (bmkp-remove-tags (bmkp-autofile-set file dir prefix no-update-p) tags no-update-p msg-p)) - -;;;###autoload -(defun bmkp-purge-notags-autofiles (&optional prefix msg-p) ; Not bound - "Delete all autofile bookmarks that have no tags. -With a prefix arg, you are prompted for a PREFIX for the bookmark name. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (if (not (y-or-n-p "Delete all autofile bookmarks that do not have tags? ")) - (error "OK - deletion canceled") - (list (and current-prefix-arg (read-string "Prefix for bookmark name: ")) - 'MSG-P))) - (let ((bmks (bmkp-autofile-alist-only prefix)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag)) ; Save only after `dolist'. - record tags) - ;; Needs Bookmark+ version of `bookmark-delete', which accepts a bookmark, not just its name. - (dolist (bmk bmks) - (when (and (setq tags (assq 'tags (bmkp-bookmark-data-from-record bmk))) - (or (not tags) (null (cdr tags)))) - (bookmark-delete bmk 'BATCHP)))) ; Do not refresh list here - do it after iterate. - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (bmkp-refresh/rebuild-menu-list nil (not msg-p))) ; Refresh now, after iterate. - - -;; $$$$$$ Not used currently. -(defun bmkp-replace-existing-bookmark (bookmark) - "Replace existing BOOKMARK with a new one of the same name. -Return the new bookmark. -BOOKMARK is a full bookmark record, not a bookmark name. - -This replaces the existing bookmark data with the data for a new -bookmark, based on `bookmark-make-record-function'. It also updates -the `bmkp-full-record' on the bookmark name (without otherwise -changing the name)." - (let (failure) - (condition-case err - (progn ; Code similar to `bookmark-store'. - (setcdr bookmark (cdr (bookmark-make-record))) - (bmkp-maybe-save-bookmarks) - ;; Put the full bookmark on its name as property `bmkp-full-record'. - ;; Do this regardless of Emacs version and `bmkp-propertize-bookmark-names-flag'. - ;; If it needs to be stripped, that will be done when saving. - (let ((bname (bmkp-bookmark-name-from-record bookmark))) - (put-text-property 0 (length bname) 'bmkp-full-record bookmark bname) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bookmark bmkp-modified-bookmarks) - (setq bmkp-modified-bookmarks (cons bookmark bmkp-modified-bookmarks))) - (setq bookmark-current-bookmark bname)) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)) - (error (setq failure (error-message-string err)))) - (if (not failure) - bookmark ; Return the bookmark. - (error "Failed to update bookmark `%s':\n%s\n" - (bmkp-bookmark-name-from-record bookmark) failure)))) - -(defun bmkp-default-handler-for-file (filename) - "Return a default bookmark handler for FILENAME, or nil. -If non-nil, it is a Lisp function, determined as follows: - -1. Match FILENAME against `bmkp-default-handlers-for-file-types'. If -it matches a Lisp function, return that function. If it matches a -shell command, return a Lisp function that invokes that shell command. - -2. If no match is found and `bmkp-guess-default-handler-for-file-flag' -is non-nil, then try to find an appropriate shell command using, in -order, `dired-guess-default' and (Emacs 23+ only) -`mailcap-file-default-commands'. If a match is found then return a -Lisp function that invokes that shell command." - (lexical-let* ((ff (list filename)) - (bmkp-user (bmkp-default-handler-user filename)) - (shell-cmd (if (stringp bmkp-user) - bmkp-user - (and (not bmkp-user) - bmkp-guess-default-handler-for-file-flag - (or (and (require 'dired-x nil t) - (let* ((case-fold-search - (or (and (boundp 'dired-guess-shell-case-fold-search) - dired-guess-shell-case-fold-search) - case-fold-search)) - (default (dired-guess-default (list filename)))) - (if (consp default) (car default) default))) - (and (require 'mailcap nil t) ; Emacs 23+ - (car (mailcap-file-default-commands (list filename))))))))) - (cond ((stringp shell-cmd) #'(lambda (bmk) (dired-do-shell-command shell-cmd nil ff))) - ((or (functionp bmkp-user) (and bmkp-user (symbolp bmkp-user))) - bmkp-user) - (t nil)))) - -(defun bmkp-default-handler-user (filename) - "Return default handler for FILENAME. -The value is based on `bmkp-default-handlers-for-file-types'." - (catch 'bmkp-default-handler-user - (dolist (assn bmkp-default-handlers-for-file-types) - (when (string-match (car assn) filename) - (throw 'bmkp-default-handler-user (cdr assn)))) - nil)) - -;; Keep this only for compatibility with existing bookmarks that have `bmkp-sound-jump' as `handler' prop. -(defun bmkp-sound-jump (bookmark) - "Handler for sound files: play the sound file that is BOOKMARK's file. -This is deprecated. It is kept only for old bookmarks that already -use this as the `handler' property. New sound bookmarks use -`play-sound-file' as property `file-handler'." - (play-sound-file (bookmark-get-filename bookmark))) - -(when (> emacs-major-version 21) - (defun bmkp-compilation-target-set (&optional prefix) ; Bound to `C-c C-b' in compilation mode - "Set a bookmark at the start of the line for this compilation hit. -You are prompted for the bookmark name. But with a prefix arg, you -are prompted only for a PREFIX string. In that case, and in Lisp -code, the bookmark name is PREFIX followed by the (relative) file name -of the hit, followed by the line number of the hit." - (interactive "P") - (let* ((file+line (bmkp-compilation-file+line-at (line-beginning-position))) - (file (car file+line)) - (line (cdr file+line))) - (unless (and file line) (error "Cursor is not on a compilation hit")) - (save-excursion - (with-current-buffer (find-file-noselect file) - (goto-char (point-min)) (forward-line (1- line)) - (if (not prefix) - (call-interactively #'bookmark-set) - (when (interactive-p) - (setq prefix (read-string "Prefix for bookmark name: "))) - (unless (stringp prefix) (setq prefix "")) - (bookmark-set (format "%s%s, line %s" prefix (file-name-nondirectory file) line) - 99 'INTERACTIVEP)))))) - - (defun bmkp-compilation-file+line-at (&optional pos) - "Return the file and position indicated by this compilation message. -These are returned as a cons: (FILE . POSITION). -POSITION is the beginning of the line indicated by the message." - (unless pos (setq pos (point))) - (let* ((loc (car (get-text-property pos 'message))) - (line (cadr loc)) - (filename (caar (nth 2 loc))) - (directory (cadr (car (nth 2 loc)))) - (spec-dir (if directory (expand-file-name directory) default-directory))) - (cons (expand-file-name filename spec-dir) line)))) - -(when (> emacs-major-version 21) - (defun bmkp-compilation-target-set-all (prefix &optional msg-p) ; Bound to `C-c C-M-b' in compilation mode - "Set a bookmark for each hit of a compilation buffer. -NOTE: You can use `C-x C-q' to make the buffer writable and then - remove any hits that you do not want to bookmark. Only the hits - remaining in the buffer are bookmarked. - -Interactively, you are prompted for a PREFIX string to prepend to each -bookmark name, the rest of which is the file name of the hit followed -by its line number. -Non-interactively, non-nil optional arg MSG-P means prompt and display -status messages." - (interactive (list (read-string "Prefix for bookmark name: ") - 'MSG-P)) - (when (and msg-p (not (y-or-n-p "This will bookmark *EACH* hit in the buffer. Continue? "))) - (error "OK - canceled")) - (let ((count 0)) - (save-excursion - (goto-char (point-min)) - (when (get-text-property (point) 'message) ; Visible part of buffer starts with a hit - (condition-case nil ; because buffer is narrowed or header text otherwise removed. - (bmkp-compilation-target-set prefix) ; Ignore error here (e.g. killed buffer). - (error nil)) - (setq count (1+ count))) - (while (and (condition-case nil (progn (compilation-next-error 1) t) (error nil)) - (not (eobp))) - (condition-case nil - (bmkp-compilation-target-set prefix) ; Ignore error here (e.g. killed buffer). - (error nil)) - (setq count (1+ count))) - (when msg-p (message "Set %d bookmarks" count)))))) - - -;; We could make the `occur' code work for Emacs 20 & 21 also, but you would not be able to -;; delete some occurrences and bookmark only the remaining ones. - -(when (> emacs-major-version 21) - (defun bmkp-occur-target-set (&optional prefix) ; Bound to `C-c C-b' in Occur mode - "Set a bookmark at the start of the line for this `(multi-)occur' hit. -You are prompted for the bookmark name. But with a prefix arg, you -are prompted only for a PREFIX string. In that case, and in Lisp -code, the bookmark name is PREFIX followed by the buffer name of the -hit, followed by the line number of the hit. - -You can use this only in `Occur' mode (commands such as `occur' and -`multi-occur')." - (interactive "P") - (unless (eq major-mode 'occur-mode) (error "You must be in `occur-mode'")) - (let* ((line (and prefix - (save-excursion - (forward-line 0) - ;; We could use [: ] here, to handle `moccur', but that loses anyway for - ;; `occur-mode-find-occurrence', so we would need other hoops too. - (re-search-forward "^\\s-+\\([0-9]+\\):" (line-end-position) 'NOERROR) - (or (format "%5d" (string-to-number (match-string 1))) "")))) - (mkr (occur-mode-find-occurrence)) - (buf (marker-buffer mkr)) - (file (or (buffer-file-name buf) bmkp-non-file-filename))) - (save-excursion (with-current-buffer buf - (goto-char mkr) - (if (not prefix) - (call-interactively #'bookmark-set) - (when (interactive-p) - (setq prefix (read-string "Prefix for bookmark name: "))) - (unless (stringp prefix) (setq prefix "")) - (bookmark-set (format "%s%s, line %s" prefix buf line) 99 'INTERACTIVEP))))))) - -(when (> emacs-major-version 21) - (defun bmkp-occur-target-set-all (&optional prefix msg-p) ; Bound to `C-c C-M-b' in Occur mode - "Set a bookmark for each hit of a `(multi-)occur' buffer. -NOTE: You can use `C-x C-q' to make the buffer writable and then - remove any hits that you do not want to bookmark. Only the hits - remaining in the buffer are bookmarked. - -Interactively, you are prompted for a PREFIX string to prepend to each -bookmark name, the rest of which is the buffer name of the hit -followed by its line number. - -You can use this only in `Occur' mode (commands such as `occur' and -`multi-occur'). - -See also command `bmkp-occur-create-autonamed-bookmarks', which -creates autonamed bookmarks to all `occur' and `multi-occur' hits. - -Non-interactively, non-nil MSG-P means prompt and show status -messages." - (interactive (list (read-string "Prefix for bookmark name: ") - 'MSG-P)) - (when (and msg-p (not (y-or-n-p "This will bookmark *EACH* hit in the buffer. Continue? "))) - (error "OK - canceled")) - (let ((count 0)) - (save-excursion - (goto-char (point-min)) - (while (condition-case nil - (progn (occur-next) t) ; "No more matches" ends loop. - (error nil)) - (condition-case nil - (bmkp-occur-target-set prefix) ; Ignore error here (e.g. killed buffer). - (error nil)) - (setq count (1+ count))) - (when msg-p (message "Set %d bookmarks" count)))))) - - -;;(@* "Other Bookmark+ Functions (`bmkp-*')") -;; *** Other Bookmark+ Functions (`bmkp-*') *** - -;;;###autoload -(defun bmkp-describe-bookmark (bookmark &optional defn) ; Bound to `C-x p ?' - "Describe BOOKMARK. -With a prefix argument, show the internal definition of the bookmark. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. - -Starting with Emacs 22, if the file is an image file then: -* Show a thumbnail of the image as well. -* If you have command-line tool `exiftool' installed and in your - `$PATH' or `exec-path', then show EXIF data (metadata) about the - image. See standard Emacs library `image-dired.el' for more - information about `exiftool'" - (interactive (list (bookmark-completing-read - "Describe bookmark" - (or (and (fboundp 'bmkp-default-lighted) (bmkp-default-lighted)) - (bmkp-default-bookmark-name))) - current-prefix-arg)) - (if defn - (bmkp-describe-bookmark-internals bookmark) - (setq bookmark (bookmark-get-bookmark bookmark)) - (help-setup-xref (list #'bmkp-describe-bookmark bookmark) (interactive-p)) - (let ((help-text (bmkp-bookmark-description bookmark))) - (with-output-to-temp-buffer "*Help*" (princ help-text)) - (with-current-buffer "*Help*" - (save-excursion - (goto-char (point-min)) - (when (re-search-forward "@#%&()_IMAGE-HERE_()&%#@\\(.+\\)" nil t) - (let* ((image-file (match-string 1)) - (image-string (save-match-data - (apply #'propertize "X" - `(display - ,(append (image-dired-get-thumbnail-image image-file) - '(:margin 10)) - rear-nonsticky (display) - mouse-face highlight - follow-link t - help-echo "`mouse-2' or `RET': Show full image" - keymap - (keymap - (mouse-2 - . (lambda (e) (interactive "e") - (find-file ,image-file))) - (13 - . (lambda () (interactive) - (find-file ,image-file)))))))) - (buffer-read-only nil)) - (replace-match image-string))))) - help-text))) - -(defun bmkp-bookmark-description (bookmark &optional no-image) - "Help-text description of BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'. - -Starting with Emacs 22 and unless optional arg NO-IMAGE is non-nil, if -the file is an image file then the description includes the following: -* A placeholder for a thumbnail image: \"@#%&()_IMAGE-HERE_()&%#@\" -* EXIF data (metadata) about the image, provided you have command-line - tool `exiftool' installed and in your `$PATH' or `exec-path'. See - standard Emacs library `image-dired.el' for more information about - `exiftool'." - (setq bookmark (bookmark-get-bookmark bookmark)) - (let ((bname (bmkp-bookmark-name-from-record bookmark)) - (buf (bmkp-get-buffer-name bookmark)) - (file (bookmark-get-filename bookmark)) - (image-p (bmkp-image-bookmark-p bookmark)) - (location (bookmark-prop-get bookmark 'location)) - (start (bookmark-get-position bookmark)) - (end (bmkp-get-end-position bookmark)) - (created (bookmark-prop-get bookmark 'created)) - (time (bmkp-get-visit-time bookmark)) - (visits (bmkp-get-visits-count bookmark)) - (tags (mapcar #'bmkp-tag-name (bmkp-get-tags bookmark))) - (sequence-p (bmkp-sequence-bookmark-p bookmark)) - (function-p (bmkp-function-bookmark-p bookmark)) - (variable-list-p (bmkp-variable-list-bookmark-p bookmark)) - (desktop-p (bmkp-desktop-bookmark-p bookmark)) - (bookmark-file-p (bmkp-bookmark-file-bookmark-p bookmark)) - (dired-p (bmkp-dired-bookmark-p bookmark)) - (gnus-p (bmkp-gnus-bookmark-p bookmark)) - (info-p (bmkp-info-bookmark-p bookmark)) - (man-p (bmkp-man-bookmark-p bookmark)) - (url-p (bmkp-url-bookmark-p bookmark)) - (w3m-p (bmkp-w3m-bookmark-p bookmark)) - (temp-p (bmkp-temporary-bookmark-p bookmark)) - (annot (bookmark-get-annotation bookmark)) - no-position-p) - (setq no-position-p (not start)) - (when (or sequence-p function-p variable-list-p) (setq no-position-p t)) - (let* ((temp-text (if temp-p "TEMPORARY " "")) - (help-text - (concat - (format "%sBookmark `%s'\n%s\n\n" temp-text bname - (make-string (+ 11 (length temp-text) (length bname)) ?-)) - (cond (sequence-p (format "Sequence:\n%s\n" - (pp-to-string - (bookmark-prop-get bookmark 'sequence)))) - (function-p (let ((fn (bookmark-prop-get bookmark 'function))) - (if (symbolp fn) - (format "Function:\t\t%s\n" fn) - (format "Function:\n%s\n" - (pp-to-string - (bookmark-prop-get bookmark 'function)))))) - (variable-list-p (format "Variable list:\n%s\n" - (pp-to-string (bookmark-prop-get bookmark 'variables)))) - (gnus-p (format "Gnus, group:\t\t%s, article: %s, message-id: %s\n" - (bookmark-prop-get bookmark 'group) - (bookmark-prop-get bookmark 'article) - (bookmark-prop-get bookmark 'message-id))) - (man-p (format "UNIX `man' page for:\t`%s'\n" - (or (bookmark-prop-get bookmark 'man-args) - ;; WoMan has no variable for the cmd name. - (bookmark-prop-get bookmark 'buffer-name)))) - (info-p (format "Info node:\t\t(%s) %s\n" - (file-name-nondirectory file) - (bookmark-prop-get bookmark 'info-node))) - (w3m-p (format "W3m URL:\t\t%s\n" file)) - (url-p (format "URL:\t\t%s\n" location)) - (desktop-p (format "Desktop file:\t\t%s\n" - (bookmark-prop-get bookmark 'desktop-file))) - (bookmark-file-p (format "Bookmark file:\t\t%s\n" - (bookmark-prop-get bookmark 'bookmark-file))) - (dired-p (let ((switches (bookmark-prop-get bookmark 'dired-switches)) - (marked (length (bookmark-prop-get bookmark - 'dired-marked))) - (inserted (length (bookmark-prop-get bookmark - 'dired-subdirs))) - (hidden (length - (bookmark-prop-get bookmark - 'dired-hidden-dirs)))) - (format "Dired%s:%s\t\t%s\nMarked:\t\t\t%s\n\ -Inserted subdirs:\t%s\nHidden subdirs:\t\t%s\n" - (if switches (format " `%s'" switches) "") - (if switches "" (format "\t")) - (expand-file-name file) - marked inserted hidden))) - ((equal file bmkp-non-file-filename) - (format "Buffer:\t\t\t%s\n" (bmkp-get-buffer-name bookmark))) - (file (concat (format "File:\t\t\t%s\n" (file-name-nondirectory file)) - (let ((dir (file-name-directory (expand-file-name file)))) - (and dir (format "Directory:\t\t%s\n" dir))))) - (t "Unknown\n")) - (unless no-position-p - (if (bmkp-region-bookmark-p bookmark) - (format "Region:\t\t\t%d to %d (%d chars)\n" start end (- end start)) - (format "Position:\t\t%d\n" start))) - (and visits (format "Visits:\t\t\t%d\n" visits)) - (and time (format "Last visit:\t\t%s\n" (format-time-string "%c" time))) - (and created (format "Creation:\t\t%s\n" (format-time-string "%c" created))) - (and tags (format "Tags:\n \"%s\"\n" (mapconcat #'identity tags "\"\n \""))) - (and annot (format "\nAnnotation:\n%s\n" annot)) - (and (not no-image) - (fboundp 'image-file-name-regexp) ; In `image-file.el' (Emacs 22+). - (if (fboundp 'string-match-p) - (string-match-p (image-file-name-regexp) file) - (save-match-data - (string-match (image-file-name-regexp) file))) - (if (fboundp 'display-graphic-p) (display-graphic-p) window-system) - (require 'image-dired nil t) - (image-dired-get-thumbnail-image file) - (concat "\n@#%&()_IMAGE-HERE_()&%#@" file "\n")) - (and (not no-image) - (fboundp 'image-file-name-regexp) ; In `image-file.el' (Emacs 22+). - (if (fboundp 'string-match-p) - (string-match-p (image-file-name-regexp) file) - (save-match-data - (string-match (image-file-name-regexp) file))) - (progn (message "Gathering image data...") t) - (condition-case nil - (let ((all (bmkp-all-exif-data (expand-file-name file)))) - (concat - (and all (not (zerop (length all))) - (format "\nImage Data (EXIF)\n-----------------\n%s" - all)))) - (error nil)))))) - help-text))) - -;; This is the same as `help-all-exif-data' in `help-fns+.el', but we avoid requiring that library. -(defun bmkp-all-exif-data (file) - "Return all EXIF data from FILE, using command-line tool `exiftool'." - (with-temp-buffer - (delete-region (point-min) (point-max)) - (unless (eq 0 (call-process shell-file-name nil t nil shell-command-switch - (format "exiftool -All \"%s\"" file))) - (error "Could not get EXIF data")) - (buffer-substring (point-min) (point-max)))) - - -;;;###autoload -(defun bmkp-describe-bookmark-internals (bookmark) - "Show the internal definition of the bookmark BOOKMARK. -BOOKMARK is a bookmark name or a bookmark record. -If it is a record then it need not belong to `bookmark-alist'." - (interactive (list (bookmark-completing-read "Describe bookmark" (bmkp-default-bookmark-name)))) - ;; Work with a copy of the bookmark, so we can unpropertize the name. - (setq bookmark (copy-sequence (bookmark-get-bookmark bookmark))) - (help-setup-xref (list #'bmkp-describe-bookmark-internals bookmark) (interactive-p)) - (let* ((bname (copy-sequence (bmkp-bookmark-name-from-record bookmark))) - (IGNORE (set-text-properties 0 (length bname) nil bname)) ; Strip properties from name. - (bmk (cons bname (bmkp-bookmark-data-from-record bookmark))) ; Fake bmk with stripped name. - (help-text (format "Bookmark `%s'\n%s\n\n%s" bname (make-string (+ 11 (length bname)) ?-) - (pp-to-string bmk)))) - (with-output-to-temp-buffer "*Help*" (princ help-text)) - help-text)) - -;;;###autoload -(defun bmkp-list-defuns-in-commands-file () - "List the functions defined in `bmkp-bmenu-commands-file'. -Typically, these are all commands." - (interactive) - (when (and bmkp-bmenu-commands-file (file-readable-p bmkp-bmenu-commands-file)) - (let ((fns ()) - (buf (let ((enable-local-variables nil)) - (find-file-noselect bmkp-bmenu-commands-file)))) - (help-setup-xref (list #'bmkp-list-defuns-in-commands-file) (interactive-p)) - (with-current-buffer buf - (goto-char (point-min)) - (while (not (eobp)) - (when (re-search-forward "\\s-*(defun \\([^ \t\n(\"]+\\)[ \t\n(]" nil 'move) - (push (match-string 1) fns))) - (setq fns (nreverse fns) - fns (sort fns 'string-lessp))) - (when (buffer-live-p buf) (kill-buffer buf)) - (with-output-to-temp-buffer "*Help*" - (princ "Bookmark Commands You Defined (in `bmkp-bmenu-commands-file')") (terpri) - (princ "------------------------------------------------------------------") (terpri) - (terpri) - (let ((non-dups (bmkp-remove-dups fns))) - (dolist (fn non-dups) - (if (and (fboundp (intern fn)) (fboundp 'help-insert-xref-button)) - (with-current-buffer "*Help*" - (goto-char (point-max)) - (help-insert-xref-button fn 'help-function (intern fn) (commandp (intern fn)))) - (princ fn)) - (let ((dups (member fn fns)) ; Sorted, so all dups are together. - (count 0)) - (while (equal fn (car dups)) - (setq count (1+ count) - dups (cdr dups))) - (when (> count 1) (princ (format " (%d times)" count)))) - (terpri))) - (help-make-xrefs (current-buffer))) - fns))) - -(defun bmkp-root-or-sudo-logged-p () - "Return t if the user logged in using Tramp as `root' or `sudo'. -Otherwise, return nil." - (catch 'break - (dolist (ii (mapcar #'buffer-name (buffer-list))) - (when (string-match "*tramp/\\(su\\|sudo\\) ." ii) (throw 'break t))))) - -(defun bmkp-position-post-context (breg) - "Return `bookmark-search-size' chars, starting at position BREG. -Return nil if there are not that many chars. -This is text that follows the bookmark's `position'. -This is used for a non-region bookmark." - (and (>= (- (point-max) breg) bookmark-search-size) - (buffer-substring-no-properties breg (+ breg bookmark-search-size)))) - -(defun bmkp-position-post-context-region (breg ereg) - "Return the region prefix, at BREG. -Return at most `bmkp-region-search-size' or (- EREG BREG) chars. -This is text that follows the bookmark's `position'. -This is used for a region bookmark." - (buffer-substring-no-properties breg (+ breg (min bmkp-region-search-size (- ereg breg))))) - -(defun bmkp-position-pre-context (breg) - "Return `bookmark-search-size' chars that precede BREG. -Return nil if there are not that many chars. -This is text that precedes the bookmark's `position'. -This is used for a non-region bookmark." - (and (>= (- breg (point-min)) bookmark-search-size) - (buffer-substring-no-properties breg (- breg bookmark-search-size)))) - -(defun bmkp-position-pre-context-region (breg) - "Return the text preceding the region beginning, BREG. -Return at most `bmkp-region-search-size' chars. -This is text that precedes the bookmark's `position'. -This is used for a region bookmark." - (buffer-substring-no-properties (max (- breg bmkp-region-search-size) (point-min)) breg)) - -(defun bmkp-end-position-pre-context (breg ereg) - "Return the region suffix, ending at EREG. -Return at most `bmkp-region-search-size' or (- EREG BREG) chars. -This is text that precedes the bookmark's `end-position'." - (buffer-substring-no-properties (- ereg (min bmkp-region-search-size (- ereg breg))) ereg)) - -(defun bmkp-end-position-post-context (ereg) - "Return the text following the region end, EREG. -Return at most `bmkp-region-search-size' chars. -This is text that follows the bookmark's `end-position'." - (buffer-substring-no-properties ereg - (+ ereg (min bmkp-region-search-size (- (point-max) (point)))))) - -(defun bmkp-position-after-whitespace (position) - "Move forward from POSITION, skipping over whitespace. Return point." - (goto-char position) (skip-chars-forward " \n\t" (point-max)) (point)) - -(defun bmkp-position-before-whitespace (position) - "Move backward from POSITION, skipping over whitespace. Return point." - (goto-char position) (skip-chars-backward " \n\t" (point-min)) (point)) - -(defun bmkp-save-new-region-location (bookmark beg end) - "Update and save `bookmark-alist' for BOOKMARK, relocating its region. -Saving happens according to `bookmark-save-flag'. -BOOKMARK is a bookmark record. -BEG and END are the new region limits for BOOKMARK. -Do nothing and return nil if `bmkp-save-new-location-flag' is nil. -Otherwise, return non-nil if region was relocated." - (and bmkp-save-new-location-flag - (y-or-n-p "Region relocated. Do you want to save new region limits? ") - (progn - (bookmark-prop-set bookmark 'front-context-string (bmkp-position-post-context-region - beg end)) - (bookmark-prop-set bookmark 'rear-context-string (bmkp-position-pre-context-region beg)) - (bookmark-prop-set bookmark 'front-context-region-string (bmkp-end-position-pre-context - beg end)) - (bookmark-prop-set bookmark 'rear-context-region-string (bmkp-end-position-post-context end)) - (bookmark-prop-set bookmark 'position beg) - (bookmark-prop-set bookmark 'end-position end) - (bmkp-maybe-save-bookmarks) - t))) - -(defun bmkp-handle-region-default (bookmark) - "Default function to handle BOOKMARK's region. -BOOKMARK is a bookmark name or a bookmark record. -Relocate the region if necessary, then activate it. -If region was relocated, save it if user confirms saving." - ;; Relocate by searching from the beginning (and possibly the end) of the buffer. - (let* (;; Get bookmark object once and for all. - ;; We should know BOOKMARK is a bookmark record (not a name), but play it safe. - (bmk (bookmark-get-bookmark bookmark)) - (bor-str (bookmark-get-front-context-string bmk)) - (eor-str (bookmark-prop-get bmk 'front-context-region-string)) - (br-str (bookmark-get-rear-context-string bmk)) - (ar-str (bookmark-prop-get bookmark 'rear-context-region-string)) - (pos (bookmark-get-position bmk)) - (end-pos (bmkp-get-end-position bmk)) - (reg-retrieved-p t) - (reg-relocated-p nil)) - (unless (and (string= bor-str (buffer-substring-no-properties - (point) (min (point-max) (+ (point) (length bor-str))))) - (string= eor-str (buffer-substring-no-properties - end-pos (max (point-min) (- end-pos (length bor-str)))))) - ;; Relocate region by searching from beginning (and possibly from end) of buffer. - (let ((beg nil) - (end nil)) - ;; Go to bob and search forward for END. - (goto-char (point-min)) - (if (search-forward eor-str (point-max) t) ; Find END, using `eor-str'. - (setq end (point)) - ;; Verify that region is not before context. - (unless (search-forward br-str (point-max) t) - (when (search-forward ar-str (point-max) t) ; Find END, using `ar-str'. - (setq end (match-beginning 0) - end (and end (bmkp-position-before-whitespace end)))))) - ;; If failed to find END, go to eob and search backward for BEG. - (unless end (goto-char (point-max))) - (if (search-backward bor-str (point-min) t) ; Find BEG, using `bor-str'. - (setq beg (point)) - ;; Verify that region is not after context. - (unless (search-backward ar-str (point-min) t) - (when (search-backward br-str (point-min) t) ; Find BEG, using `br-str'. - (setq beg (match-end 0) - beg (and beg (bmkp-position-after-whitespace beg)))))) - (setq reg-retrieved-p (or beg end) - reg-relocated-p reg-retrieved-p - ;; If only one of BEG or END was found, the relocated region is only - ;; approximate (keep the same length). If both were found, it is exact. - pos (or beg (and end (- end (- end-pos pos))) pos) - end-pos (or end (and beg (+ pos (- end-pos pos))) end-pos)))) - ;; Region is available. Activate it and maybe save it. - (cond (reg-retrieved-p - (goto-char pos) - (push-mark end-pos 'nomsg 'activate) - (setq deactivate-mark nil) - (when bmkp-show-end-of-region - (let ((end-win (save-excursion (forward-line (window-height)) (line-end-position)))) - ;; Bounce point and mark. - (save-excursion (sit-for 0.6) (exchange-point-and-mark) (sit-for 1)) - ;; Recenter if region end is not visible. - (when (> end-pos end-win) (recenter 1)))) - ;; Maybe save region. - (if (and reg-relocated-p (bmkp-save-new-region-location bmk pos end-pos)) - (message "Saved relocated region (from %d to %d)" pos end-pos) - (message "Region is from %d to %d" pos end-pos))) - (t ; No region. Go to old start. Don't push-mark. - (goto-char pos) (forward-line 0) - (message "No region from %d to %d" pos end-pos))))) - -;; Same as `line-number-at-pos', which is not available until Emacs 22. -(defun bmkp-line-number-at-pos (&optional pos) - "Buffer line number at position POS. Current line number if POS is nil. -Counting starts at (point-min), so any narrowing restriction applies." - (1+ (count-lines (point-min) (save-excursion (when pos (goto-char pos)) (forward-line 0) (point))))) - -(defun bmkp-goto-position (bookmark file buf bufname pos forward-str behind-str) - "Go to a bookmark that has no region. -Update the recorded position if `bmkp-save-new-location-flag'. -Arguments are respectively the bookmark, its file, buffer, buffer -name, recorded position, and the context strings for the position." - (if (and file (file-readable-p file) (not (buffer-live-p buf))) - (with-current-buffer (find-file-noselect file) (setq buf (buffer-name))) - ;; No file found. See if a non-file buffer exists for this. If not, raise error. - (unless (or (and buf (get-buffer buf)) - (and bufname (get-buffer bufname) (not (string= buf bufname)))) - (signal 'file-error `("Jumping to bookmark" "No such file or directory" ,file)))) - (set-buffer (or buf bufname)) - (when bmkp-jump-display-function - (save-current-buffer (funcall bmkp-jump-display-function (current-buffer)))) - (setq deactivate-mark t) - (raise-frame) - (goto-char pos) - ;; Try to relocate position. - ;; Search forward first. Then, if FORWARD-STR exists and was found in the file, search - ;; backward for BEHIND-STR. The rationale is that if text was inserted between the two - ;; in the file, then it's better to end up before point, so you can see the text, rather - ;; than after it and not see it. - (when (and forward-str (search-forward forward-str (point-max) t)) - (goto-char (match-beginning 0))) - (when (and behind-str (search-backward behind-str (point-min) t)) (goto-char (match-end 0))) - (when (and (/= pos (point)) bmkp-save-new-location-flag) - (bookmark-prop-set bookmark 'position (point)) - (bookmark-prop-set bookmark 'end-position (point)) - ;; Perhaps we should treat the case of a bookmark that had position 0 changing to position 1 specially, - ;; by passing non-nil SAME-COUNT-P arg to `bmkp-maybe-save-bookmarks'. On the other hand, if initially - ;; 0 then the bookmark does not claim that the file is non-empty. If now set to 1 then we know it is. - ;; Leave it this way, at least for now. The consequence is that the user will see that bookmarks have - ;; modified (e.g. `Save' is enabled in the menu), even though nothing much has changed. - (bmkp-maybe-save-bookmarks)) - (/= pos (point))) ; Return value indicates whether POS was accurate. - -(defun bmkp-jump-sequence (bookmark) - "Handle a sequence bookmark BOOKMARK. -Handler function for sequence bookmarks. -BOOKMARK is a bookmark name or a bookmark record." - (dolist (bmk (bookmark-prop-get bookmark 'sequence)) - (bookmark--jump-via bmk bmkp-sequence-jump-display-function)) - (message "Done invoking bookmarks in sequence `%s'" - (if (stringp bookmark) bookmark (bmkp-bookmark-name-from-record bookmark)))) - -(defun bmkp-jump-function (bookmark) - "Handle a function bookmark BOOKMARK. -Handler function for function bookmarks. -BOOKMARK is a bookmark name or a bookmark record." - (funcall (bookmark-prop-get bookmark 'function))) - -(defun bmkp-make-bookmark-list-record () - "Create and return a bookmark-list bookmark record. -This records the current state of buffer `*Bookmark List*': the sort -order, filter function, regexp pattern, title, and omit list." - (let ((state `((last-sort-comparer . ,bmkp-sort-comparer) - (last-reverse-sort-p . ,bmkp-reverse-sort-p) - (last-reverse-multi-sort-p . ,bmkp-reverse-multi-sort-p) - (last-bmenu-filter-function . ,bmkp-bmenu-filter-function) - (last-bmenu-filter-pattern . ,bmkp-bmenu-filter-pattern) - (last-bmenu-omitted-bookmarks . ,(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-omitted-bookmarks)) - (last-bmenu-title . ,bmkp-bmenu-title) - (last-bmenu-toggle-filenames . ,bookmark-bmenu-toggle-filenames)))) - `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT) - (filename . ,bmkp-non-file-filename) - (bookmark-list . ,state) - (handler . bmkp-jump-bookmark-list)))) - -(add-hook 'bookmark-bmenu-mode-hook - #'(lambda () (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-bookmark-list-record))) - -(defun bmkp-jump-bookmark-list (bookmark) - "Jump to bookmark-list bookmark BOOKMARK. -Handler function for record returned by -`bmkp-make-bookmark-list-record'. -BOOKMARK is a bookmark name or a bookmark record." - (let ((state (bookmark-prop-get bookmark 'bookmark-list))) - (setq bmkp-sort-comparer (cdr (assq 'last-sort-comparer state)) - bmkp-reverse-sort-p (cdr (assq 'last-reverse-sort-p state)) - bmkp-reverse-multi-sort-p (cdr (assq 'last-reverse-multi-sort-p state)) - bmkp-bmenu-filter-function (cdr (assq 'last-bmenu-filter-function state)) - bmkp-bmenu-filter-pattern (or (cdr (assq 'last-bmenu-filter-pattern state)) "") - bmkp-bmenu-omitted-bookmarks (cdr (assq 'last-bmenu-omitted-bookmarks state)) - bmkp-bmenu-title (cdr (assq 'last-bmenu-title state)) - bookmark-bmenu-toggle-filenames (cdr (assq 'last-bmenu-toggle-filenames state)))) - (let ((bookmark-alist (if bmkp-bmenu-filter-function - (funcall bmkp-bmenu-filter-function) - bookmark-alist))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp) - (when (get-buffer "*Bookmark List*") (pop-to-buffer "*Bookmark List*")))) - -;; Bookmark-file bookmarks. -;;;###autoload -(defun bmkp-set-bookmark-file-bookmark (file &optional msg-p) ; Bound to `C-x p y', `C-x p c y' - "Create a bookmark that loads bookmark-file FILE when \"jumped\" to. -You are prompted for the names of the bookmark file and the bookmark. -When entering the bookmark name you can use completion against -existing names. This completion is lax, so you can easily edit an -existing name. See `bookmark-set' for particular keys available -during this input. - -Non-interactively, non-nil MSG-P means display a status message." - (interactive - (list (let* ((insert-default-directory t) - (std-default (bmkp-default-bookmark-file)) - (default (if (bmkp-same-file-p bmkp-current-bookmark-file bmkp-last-bookmark-file) - (if (bmkp-same-file-p bmkp-current-bookmark-file std-default) - bookmark-default-file - std-default) - bmkp-last-bookmark-file))) - (bmkp-read-bookmark-file-name "Create bookmark to load bookmark file: " - (or (file-name-directory default) "~/") - default - 'confirm)) ; Non-existing file is OK, but must confirm. - 'MSG)) - (setq file (expand-file-name file)) - (unless (file-readable-p file) (error "Unreadable bookmark file `%s'" file)) - (with-current-buffer (let ((enable-local-variables ())) (find-file-noselect file)) - (goto-char (point-min)) - (condition-case nil ; Check whether it's a valid bookmark file. - (progn (bookmark-maybe-upgrade-file-format) - (unless (listp (bookmark-alist-from-buffer)) (error ""))) - (error (error "Not a valid bookmark file: `%s'" file)))) - (let ((bookmark-make-record-function (lexical-let ((ff file)) - #'(lambda () (bmkp-make-bookmark-file-record ff)))) - (bookmark-name (bmkp-completing-read-lax "Bookmark-file BOOKMARK name " - file nil nil 'bookmark-history))) - (bookmark-set bookmark-name 99 'interactivep)) - (when msg-p (message "Set bookmark-file bookmark"))) - -(defun bmkp-make-bookmark-file-record (bookmark-file) - "Create and return a bookmark-file bookmark record. -Records the BOOKMARK-FILE name. -Adds a handler that tests the prefix arg and loads the bookmark file -either as a replacement for the current bookmark file or as a -supplement to it." - `(,@(bookmark-make-record-default 'no-file 'no-context) - (filename . ,bookmark-file) - (bookmark-file . ,bookmark-file) - (handler . bmkp-jump-bookmark-file))) - -(defun bmkp-jump-bookmark-file (bookmark &optional switchp batchp) - "Jump to bookmark-file bookmark BOOKMARK, which loads the bookmark file. -Handler function for record returned by -`bmkp-make-bookmark-file-record'. -BOOKMARK is a bookmark name or a bookmark record. -Non-nil optional arg SWITCHP means overwrite current bookmark list. -Non-nil optional arg BATCHP is passed to `bookmark-load'." - (let ((file (bookmark-prop-get bookmark 'bookmark-file)) - (overwritep (and switchp (y-or-n-p "SWITCH to new bookmark file, instead of just adding it? ")))) - (bookmark-load file overwritep batchp)) ; Treat load interactively, if no BATCHP. - ;; This `throw' is only for the case where this handler is called from `bookmark--jump-via'. - ;; It just tells `bookmark--jump-via' to skip the rest of what it does after calling the handler. - (condition-case nil - (throw 'bookmark--jump-via 'BOOKMARK-FILE-JUMP) - (no-catch nil))) - -;;;###autoload -(defun bmkp-bookmark-file-jump (bookmark-name &optional switchp no-msg) ; `C-x j y' - "Jump to a bookmark-file bookmark, which means load its bookmark file. -With a prefix argument, switch to the new bookmark file. -Otherwise, load it to supplement the current bookmark list." - (interactive - (let ((alist (bmkp-bookmark-file-alist-only))) - (list (bmkp-read-bookmark-for-type "bookmark-file" alist nil nil 'bmkp-bookmark-file-history) - current-prefix-arg))) - (bmkp-jump-bookmark-file bookmark-name switchp no-msg)) - -;; Desktop bookmarks -;;;###autoload -(defun bmkp-set-desktop-bookmark (desktop-file) ; Bound globally to `C-x p K', `C-x r K', `C-x p c K' - "Save the desktop as a bookmark. -You are prompted for the desktop-file location and the bookmark name. -The default value for the desktop-file location is the current value -of `desktop-file'. As always, you can use `M-n' to retrieve it. - -If you also use library Icicles, then the desktop files of all -existing desktop bookmarks are available during the desktop file-name -completion as proxy candidates. To see them, use `C-M-_' to turn on -the display of proxy candidates." - (interactive - (progn (unless (condition-case nil (require 'desktop nil t) (error nil)) - (error "You must have library `desktop.el' to use this command")) - (let ((icicle-proxy-candidates (and (boundp 'icicle-mode) icicle-mode - (mapcar #'(lambda (bmk) - (bookmark-prop-get - bmk 'desktop-file)) - (bmkp-desktop-alist-only)))) - (icicle-unpropertize-completion-result-flag t)) - (list (read-file-name "Save desktop in file: " nil (if (boundp 'desktop-base-file-name) - desktop-base-file-name - desktop-basefilename)))))) - (set-text-properties 0 (length desktop-file) nil desktop-file) - (unless (file-name-absolute-p desktop-file) (setq desktop-file (expand-file-name desktop-file))) - (unless (condition-case nil (require 'desktop nil t) (error nil)) - (error "You must have library `desktop.el' to use this command")) - (let ((desktop-basefilename (file-name-nondirectory desktop-file)) ; Emacs < 22 - (desktop-base-file-name (file-name-nondirectory desktop-file)) ; Emacs 23+ - (desktop-dir (file-name-directory desktop-file)) - (desktop-restore-eager t) ; Don't bother with lazy restore. - (desktop-globals-to-save (bmkp-remove-if #'(lambda (elt) (memq elt bmkp-desktop-no-save-vars)) - desktop-globals-to-save))) - (if (< emacs-major-version 22) - (desktop-save desktop-dir) ; Emacs < 22 has no locking. - (desktop-save desktop-dir 'RELEASE)) - (message "Desktop saved in `%s'" desktop-file) - (let ((bookmark-make-record-function (lexical-let ((df desktop-file)) - #'(lambda () (bmkp-make-desktop-record df))))) - (call-interactively #'bookmark-set)))) - -(defun bmkp-make-desktop-record (desktop-file) - "Create and return a desktop bookmark record. -DESKTOP-FILE is the absolute file name of the desktop file to use." - `(,@(bookmark-make-record-default 'no-file 'no-context) - (filename . ,bmkp-non-file-filename) - (desktop-file . ,desktop-file) - (handler . bmkp-jump-desktop))) - -(defun bmkp-jump-desktop (bookmark) - "Jump to desktop bookmark BOOKMARK. -Handler function for record returned by `bmkp-make-desktop-record'. -BOOKMARK is a bookmark name or a bookmark record." - (let ((desktop-file (bookmark-prop-get bookmark 'desktop-file))) - (unless (condition-case nil (require 'desktop nil t) (error nil)) - (error "You must have library `desktop.el' to use this command")) - ;; (unless desktop-file (error "Not a desktop-bookmark: %S" bookmark)) ; Shouldn't happen. - (bmkp-desktop-change-dir desktop-file) - (unless (bmkp-desktop-read desktop-file) (error "Could not load desktop file")))) - -;; Derived from code in `desktop-change-dir'. -;;;###autoload -(defun bmkp-desktop-change-dir (desktop-file) - "Change to desktop saved in DESKTOP-FILE. -Kill the desktop as specified by variables `desktop-save-mode' and - `desktop-save' (starting with Emacs 22). -Clear the desktop and load DESKTOP-FILE DIRNAME." - (interactive (list (let ((icicle-unpropertize-completion-result-flag t)) - (read-file-name "Change to desktop file: ")))) - (set-text-properties 0 (length desktop-file) nil desktop-file) - (unless (file-name-absolute-p desktop-file) (setq desktop-file (expand-file-name desktop-file))) - (unless (condition-case nil (require 'desktop nil t) (error nil)) - (error "You must have library `desktop.el' to use this command")) - (let ((desktop-basefilename (file-name-nondirectory desktop-file)) ; Emacs < 22 - (desktop-base-file-name (file-name-nondirectory desktop-file)) ; Emacs 23+ - (desktop-dir (file-name-directory desktop-file)) - (desktop-restore-eager t) ; Don't bother with lazy restore. - (desktop-globals-to-save (bmkp-remove-if #'(lambda (elt) (memq elt bmkp-desktop-no-save-vars)) - desktop-globals-to-save))) - (bmkp-desktop-kill) - (desktop-clear) - (if (< emacs-major-version 22) (desktop-read) (desktop-read desktop-dir)))) - -;; Derived from code in `desktop-kill'. -(defun bmkp-desktop-kill () - "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do. -In any case, release the lock on the desktop file. -This function does nothing in Emacs versions prior to Emacs 22." - ;; We assume here: `desktop.el' has been loaded and `desktop-dirname' is defined. - (when (and (boundp 'desktop-save-mode) ; Not defined in Emacs 20-21. - desktop-save-mode - (let ((exists (file-exists-p (desktop-full-file-name)))) - (or (eq desktop-save t) - (and exists (memq desktop-save '(ask-if-new if-exists))) - (and (or (memq desktop-save '(ask ask-if-new)) - (and exists (eq desktop-save 'ask-if-exists))) - (y-or-n-p "Save current desktop first? "))))) - (condition-case err - (if (< emacs-major-version 22) - (desktop-save desktop-dirname) ; Emacs < 22 has no locking. - (desktop-save desktop-dirname 'RELEASE)) - (file-error (unless (yes-or-no-p "Error while saving the desktop. IGNORE? ") - (signal (car err) (cdr err)))))) - ;; Just release lock, regardless of whether this Emacs process is the owner. - (when (fboundp 'desktop-release-lock) (desktop-release-lock))) ; Not defined for Emacs 20. - -;; Derived from code in `desktop-read'. -;;;###autoload -(defun bmkp-desktop-read (file) - "Load desktop-file FILE, then run `desktop-after-read-hook'. -Return t if FILE was loaded, nil otherwise." - (interactive) - (unless (file-name-absolute-p file) (setq file (expand-file-name file))) ; Shouldn't happen. - (setq desktop-dirname (file-name-directory file)) - (if (not (file-readable-p file)) - nil ; Return nil, meaning not loaded. - (let ((desktop-restore-eager t) ; Don't bother with lazy restore. - (desktop-first-buffer nil) - (desktop-buffer-ok-count 0) - (desktop-buffer-fail-count 0) - (desktop-save nil)) ; Prevent desktop saving during eval of desktop buffer. - (when (fboundp 'desktop-lazy-abort) (desktop-lazy-abort)) ; Emacs 22+. - (load file t t t) - (when (boundp 'desktop-file-modtime) ; Emacs 22+ - (setq desktop-file-modtime (nth 5 (file-attributes file)))) - ;; `desktop-create-buffer' puts buffers at end of the buffer list. - ;; We want buffers existing prior to evaluating the desktop (and not reused) to be placed - ;; at the end of the buffer list, so we move them here. - (mapc 'bury-buffer (nreverse (cdr (memq desktop-first-buffer (nreverse (buffer-list)))))) - (switch-to-buffer (car (buffer-list))) - (run-hooks 'desktop-delay-hook) - (setq desktop-delay-hook ()) - (run-hooks 'desktop-after-read-hook) - (when (boundp 'desktop-buffer-ok-count) ; Emacs 22+ - (message "Desktop: %d buffer%s restored%s%s." desktop-buffer-ok-count - (if (= 1 desktop-buffer-ok-count) "" "s") - (if (< 0 desktop-buffer-fail-count) - (format ", %d failed to restore" desktop-buffer-fail-count) - "") - (if (and (boundp 'desktop-buffer-args-list) desktop-buffer-args-list) - (format ", %d to be restored lazily" (length desktop-buffer-args-list)) - ""))) - t))) ; Return t, meaning successfully loaded. - -;;;###autoload -(defun bmkp-desktop-delete (bookmark-name) - "Delete desktop bookmark BOOKMARK-NAME, and delete its desktop file. -Release the lock file in that desktop's directory. -\(This means that if you currently have locked a different desktop -in the same directory, then you will need to relock it.)" - (interactive (let ((alist (bmkp-desktop-alist-only))) - (list (bmkp-read-bookmark-for-type "desktop" alist nil nil 'bmkp-desktop-history - "Delete ")))) - (let ((desktop-file (bookmark-prop-get bookmark-name 'desktop-file))) - (unless desktop-file (error "Not a desktop-bookmark: `%s'" bookmark-name)) - ;; Release the desktop lock file in the same directory as DESKTOP-FILE. - ;; This will NOT be the right thing to do if a desktop file different from DESKTOP-FILE - ;; is currently locked in the same directory. - (let ((desktop-dir (file-name-directory desktop-file))) - (when (fboundp 'desktop-release-lock) (desktop-release-lock))) ; Not defined for Emacs 20. - (when (file-exists-p desktop-file) (delete-file desktop-file))) - (bookmark-delete bookmark-name)) - -;; Variable-list bookmarks -(when (boundp 'wide-n-restrictions) - (defun bmkp-set-restrictions-bookmark () - "Save the ring of restrictions for the current buffer as a bookmark. -You need library `wide-n.el' to use the bookmark created." - (interactive) - (let ((bookmark-make-record-function - (lambda () (bmkp-make-variable-list-record - `((wide-n-restrictions - . ,(mapcar (lambda (x) - (if (eq x 'all) - 'all - (let ((beg (car x)) ; Convert markers to number positions. - (end (cdr x))) - (cons (if (markerp beg) (marker-position beg) beg) - (if (markerp end) (marker-position end) end))))) - wide-n-restrictions))))))) - (call-interactively #'bookmark-set) - (unless (featurep 'wide-n) (message "Bookmark created, but you need `wide-n.el' to use it"))))) - -;;;###autoload -(defun bmkp-set-variable-list-bookmark (variables) - "Save a list of variables as a bookmark. -Interactively, read the variables to save, using -`bmkp-read-variables-completing'." - (interactive (list (bmkp-read-variables-completing))) - (let ((bookmark-make-record-function (lexical-let ((vars variables)) - #'(lambda () (bmkp-make-variable-list-record vars))))) - (call-interactively #'bookmark-set))) - -;; Not used in the Bookmark+ code. Available for users to create varlist bookmark non-interactively. -(defun bmkp-create-variable-list-bookmark (bookmark-name vars vals &optional buffer-name) - "Create a variable-list bookmark named BOOKMARK-NAME from VARS and VALS. -VARS and VALS are corresponding lists of variables and their values. - -Optional arg BUFFER-NAME is the buffer name to use for the bookmark (a -string). This is useful if some of the variables are buffer-local. -If BUFFER-NAME is nil, the current buffer name is recorded." - (eval `(multiple-value-bind ,vars ',vals - (let ((bookmark-make-record-function (lexical-let ((vs vars) - (buf buffer-name)) - #'(lambda () (bmkp-make-variable-list-record vs buf))))) - (bookmark-set ,bookmark-name nil t))))) - -(defun bmkp-read-variables-completing (&optional option) - "Read variable names with completion, and return them as a list of symbols. -Reads names one by one, until you hit `RET' twice consecutively. -Non-nil argument OPTION means read only user option names." - (bookmark-maybe-load-default-file) - (let ((var (bmkp-read-variable "Variable (RET for each, empty input to finish): " option)) - (vars ()) - old-var) - (while (not (string= "" var)) - (add-to-list 'vars var) - (setq var (bmkp-read-variable "Variable: " option))) - (nreverse vars))) - -(defun bmkp-read-variable (prompt &optional option default-value) - "Read name of a variable and return it as a symbol. -Prompt with string PROMPT. -With non-nil OPTION, read the name of a user option. -The default value is DEFAULT-VALUE if non-nil, or the nearest symbol -to the cursor if it is a variable." - (setq option (if option 'user-variable-p 'boundp)) - (let ((symb (cond ((fboundp 'symbol-nearest-point) - (symbol-nearest-point)) ; In `thingatpt+.el'. - ((fboundp 'symbol-at-point) (symbol-at-point)) - (t nil))) - (enable-recursive-minibuffers t) - (icicle-unpropertize-completion-result-flag t)) - (when (and default-value (symbolp default-value)) - (setq default-value (symbol-name default-value))) - (intern (completing-read prompt obarray option t nil 'minibuffer-history - (or default-value (and (funcall option symb) (symbol-name symb))) - t)))) - -(defun bmkp-make-variable-list-record (variables &optional buffer-name) - "Create and return a variable-list bookmark record. -VARIABLES is the list of variables to save. -Each entry in VARIABLES is either a variable (a symbol) or a cons - whose car is a variable and whose cdr is the variable's value. - -Optional arg BUFFER-NAME is the buffer to use for the bookmark. This -is useful if some of the variables are buffer-local. If BUFFER-NAME -is nil, the current buffer is used." - (let ((record `(,@(bookmark-make-record-default 'no-file 'no-context) - (filename . ,bmkp-non-file-filename) - (variables . ,(or (bmkp-printable-vars+vals variables) - (error "No variables to bookmark"))) - (handler . bmkp-jump-variable-list)))) - (when buffer-name (let ((bname (assq 'buffer-name record))) (setcdr bname buffer-name))) - record)) - -(defun bmkp-printable-vars+vals (variables) - "Return an alist of printable VARIABLES paired with their values. -Display a message for any variables that are not printable. -VARIABLES is the list of variables. Each entry in VARIABLES is either - a variable (a symbol) or a cons whose car is a variable and whose cdr - is the variable's value." - (let ((vars+vals ()) - (unprintables ())) - (dolist (var variables) - (let ((val (if (consp var) (cdr var) (symbol-value var)))) - (if (bmkp-printable-p val) - (add-to-list 'vars+vals (if (consp var) var (cons var val))) - (add-to-list 'unprintables var)))) - (when unprintables (message "Unsavable (unreadable) vars: %S" unprintables) (sit-for 3)) - vars+vals)) - -;; Same as `savehist-printable', except added `print-circle' binding. -(defun bmkp-printable-p (value) - "Return non-nil if VALUE would be Lisp-readable if printed using `prin1'." - (or (stringp value) (numberp value) (symbolp value) - (with-temp-buffer ; Print and try to read. - (condition-case nil - (let ((print-readably t) - (print-level nil) - (print-circle t)) - (prin1 value (current-buffer)) - (read (point-min-marker)) - t) - (error nil))))) - -(defun bmkp-jump-variable-list (bookmark) - "Jump to variable-list bookmark BOOKMARK, restoring the recorded values. -Handler function for record returned by -`bmkp-make-variable-list-record'. -BOOKMARK is a bookmark name or a bookmark record." - (let ((buf (bmkp-get-buffer-name bookmark)) - (vars+vals (bookmark-prop-get bookmark 'variables))) - (unless (get-buffer buf) - (message "Bookmarked for non-existent buffer `%s', so using current buffer" buf) (sit-for 3) - (setq buf (current-buffer))) - (with-current-buffer buf - (dolist (var+val vars+vals) - (set (car var+val) (cdr var+val)))) - (message "Variables restored in buffer `%s': %S" buf (mapcar #'car vars+vals)) - (sit-for 3))) - -;; URL browse support -(defun bmkp-make-url-browse-record (url) - "Create and return a url bookmark for `browse-url' to visit URL. -The handler is `bmkp-jump-url-browse'." - (require 'browse-url) - (let ((url-0 (copy-sequence url))) - (set-text-properties 0 (length url) () url-0) - `((filename . ,bmkp-non-file-filename) - (location . ,url-0) - (handler . bmkp-jump-url-browse)))) - -(defun bmkp-jump-url-browse (bookmark) - "Handler function for record returned by `bmkp-make-url-browse-record'. -BOOKMARK is a bookmark name or a bookmark record." - (require 'browse-url) - (let ((url (bookmark-prop-get bookmark 'location))) - (browse-url url))) - -;; W3M support -(defun bmkp-make-w3m-record () - "Make a special entry for w3m buffers." - (require 'w3m) ; For `w3m-current-url'. - `(,w3m-current-title - ,@(bookmark-make-record-default 'no-file) - (filename . ,w3m-current-url) - (handler . bmkp-jump-w3m))) - -(add-hook 'w3m-mode-hook #'(lambda () (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-w3m-record))) - -(defun bmkp-w3m-set-new-buffer-name () - "Set the w3m buffer name according to the number of w3m buffers already open." - (require 'w3m) ; For `w3m-list-buffers'. - (let ((len (length (w3m-list-buffers 'nosort)))) - (if (= len 0) "*w3m*" (format "*w3m*<%d>" (1+ len))))) - -(defun bmkp-jump-w3m-new-session (bookmark) - "Jump to W3M bookmark BOOKMARK, setting a new tab." - (require 'w3m) - (let ((buf (bmkp-w3m-set-new-buffer-name))) - (w3m-browse-url (bookmark-prop-get bookmark 'filename) 'newsession) - (while (not (get-buffer buf)) (sit-for 1)) ; Be sure we have the W3M buffer. - (with-current-buffer buf - (goto-char (point-min)) - ;; Wait until data arrives in buffer, before setting region. - (while (eq (line-beginning-position) (line-end-position)) (sit-for 1))) - (bookmark-default-handler - `("" (buffer . ,buf) . ,(bmkp-bookmark-data-from-record bookmark))))) - -(defun bmkp-jump-w3m-only-one-tab (bookmark) - "Close all W3M sessions and jump to BOOKMARK in a new W3M buffer." - (require 'w3m) - (w3m-quit 'force) ; Be sure we start with an empty W3M buffer. - (w3m-browse-url (bookmark-prop-get bookmark 'filename)) - (with-current-buffer "*w3m*" (while (eq (point-min) (point-max)) (sit-for 1))) - (bookmark-default-handler - `("" (buffer . ,(buffer-name (current-buffer))) . ,(bmkp-bookmark-data-from-record bookmark)))) - -(defalias 'bmkext-jump-w3m 'bmkp-jump-w3m) -(defun bmkp-jump-w3m (bookmark) - "Handler function for record returned by `bmkp-make-w3m-record'. -BOOKMARK is a bookmark name or a bookmark record. -Use multi-tabs in W3M if `bmkp-w3m-allow-multi-tabs' is non-nil." - (require 'w3m) - (if bmkp-w3m-allow-multi-tabs - (bmkp-jump-w3m-new-session bookmark) - (bmkp-jump-w3m-only-one-tab bookmark))) - - -;; GNUS support for Emacs < 24. More or less the same as `gnus-summary-bookmark-make-record' in Emacs 24+. -;; But this: -;; -;; * Works for other Emacs versions as well. -;; * Requires `gnus.el'. -;; * Adds a `bmkp-non-file-filename' `filename' entry. -;; * Uses `bmkp-jump-gnus', not `gnus-summary-bookmark-jump' as the handler. -;; -(defun bmkp-make-gnus-record () - "Make a bookmark entry for a Gnus summary buffer. -Current buffer can be the article buffer or the summary buffer." - (require 'gnus) - (let ((pos nil) - buf) - ;; If in article buffer, record point and buffer, then go to summary buffer - ;; and record bookmark there. - (unless (and (if (fboundp 'derived-mode-p) - (derived-mode-p 'gnus-summary-mode) - (eq major-mode 'gnus-summary-mode)) - gnus-article-current) - (setq buf "art" - bookmark-yank-point (point) - bookmark-current-buffer (current-buffer)) - (save-restriction (widen) (setq pos (point))) ; Position in article buffer. - (gnus-article-show-summary)) - (let* ((grp (car gnus-article-current)) - (art (cdr gnus-article-current)) - (head (gnus-summary-article-header art)) - (id (mail-header-id head))) - (unless buf (setq buf "sum")) - `((elt (gnus-summary-article-header) 1) ; Subject. - ,@(condition-case - nil - (bookmark-make-record-default 'NO-FILE 'NO-CONTEXT pos) ; POS = nil if started in summary buf. - (wrong-number-of-arguments (bookmark-make-record-default 'POINT-ONLY))) - (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id)) - (filename . ,bmkp-non-file-filename) (group . ,grp) (article . ,art) (message-id . ,id) - (handler . bmkp-jump-gnus))))) ; Vanilla Emacs 24+ uses `gnus-summary-bookmark-jump'. - - -;; Vanilla Emacs 24+ uses `gnus-summary-bookmark-make-record' for these hooks. -;; Better to use `bmkp-make-gnus-record' even for Emacs 24+, because `bmkp-jump-gnus' is better than -;; `gnus-summary-bookmark-jump' (no `sit-for' if article buffer not needed). - -;; $$$$$$ (unless (> emacs-major-version 23) ; Emacs 24 has `gnus-summary-bookmark-make-record'. -(add-hook 'gnus-summary-mode-hook #'(lambda () - (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-gnus-record))) - -;; $$$$$$ (unless (> emacs-major-version 23) ; Emacs 24 has `gnus-summary-bookmark-make-record'. -(add-hook 'gnus-article-mode-hook #'(lambda () - (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-gnus-record))) - -;; More or less the same as `gnus-summary-bookmark-jump' in Emacs 24+. -;; But this does not `sit-for' unless BUF is "Gnus-art". -;; -(defun bmkp-jump-gnus (bookmark) - "Handler function for record returned by `bmkp-make-gnus-record'. -BOOKMARK is a bookmark name or a bookmark record." - (let* ((group (bookmark-prop-get bookmark 'group)) - (article (bookmark-prop-get bookmark 'article)) - (id (bookmark-prop-get bookmark 'message-id)) - (loc (bookmark-prop-get bookmark 'location)) - (buf (if loc (car (split-string loc)) (bookmark-prop-get bookmark 'buffer)))) - (if (< emacs-major-version 22) (gnus-fetch-group group) (gnus-fetch-group group (list article))) - (gnus-summary-insert-cached-articles) - (gnus-summary-goto-article id nil 'force) - ;; Go to article buffer if appropriate. Wait for it to be ready, so `bookmark-default-handler' has time - ;; to set the right position. - (when (equal buf "Gnus-art") (sit-for 1) (other-window 1)) - (bookmark-default-handler `("" (buffer . ,buf) . ,(bmkp-bookmark-data-from-record bookmark))))) - -(defun bmkext-jump-gnus (bookmark) ; Compatibility code. - "`gnus-summary-bookmark-jump' if defined, else `bmkp-jump-gnus'." - (if (fboundp 'gnus-summary-bookmark-jump) - (gnus-summary-bookmark-jump bookmark) ; Emacs 24 - (bmkp-jump-gnus bookmark))) - - -;; `man' and `woman' support for Emacs < 24. - -(when (> emacs-major-version 20) - (defun bmkp-make-woman-record () - "Create bookmark record for `man' page bookmark created by `woman'." - `(,@(bookmark-make-record-default 'no-file) - (filename . ,woman-last-file-name) (handler . bmkp-jump-woman))) - - (unless (> emacs-major-version 23) - (add-hook 'woman-mode-hook #'(lambda () - (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-woman-record))))) - -(defun bmkp-make-man-record () - "Create bookmark record for `man' page bookmark created by `man'." - `(,@(bookmark-make-record-default 'no-file) - (filename . ,bmkp-non-file-filename) - (man-args . ,Man-arguments) (handler . bmkp-jump-man))) - -(unless (> emacs-major-version 23) - (add-hook 'Man-mode-hook #'(lambda () (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-man-record)))) - -(defun bmkext-jump-woman (bookmark) ; Compatibility code. - "`woman-bookmark-jump' if defined, else `bmkp-jump-woman'." - (if (fboundp 'woman-bookmark-jump) - (woman-bookmark-jump bookmark) ; Emacs 24 - (bmkp-jump-woman bookmark))) - -(defun bmkp-jump-woman (bookmark) - "Handler function for `man' page bookmark created by `woman'. -BOOKMARK is a bookmark name or a bookmark record." - (unless (> emacs-major-version 20) - (error "`woman' bookmarks are not supported in Emacs prior to Emacs 21")) - (bookmark-default-handler - `("" (buffer . ,(save-window-excursion (woman-find-file (bookmark-get-filename bookmark)) - (current-buffer))) - . ,(bmkp-bookmark-data-from-record bookmark)))) - -(defun bmkext-jump-man (bookmark) ; Compatibility code. - "`Man-bookmark-jump' if defined, else `bmkp-jump-man'." - (if (fboundp 'Man-bookmark-jump) - (Man-bookmark-jump bookmark) ; Emacs 24 - (bmkp-jump-man bookmark))) - -(defun bmkp-jump-man (bookmark) - "Handler function for `man' page bookmark created by `man'. -BOOKMARK is a bookmark name or a bookmark record." - (require 'man) - (let ((Man-notify-method - (case bmkp-jump-display-function - ((nil display-buffer) 'quiet) - (switch-to-buffer 'pushy) - ((bmkp-select-buffer-other-window switch-to-buffer-other-window pop-to-buffer) 'friendly) - (t 'quiet)))) - (Man-getpage-in-background (bookmark-prop-get bookmark 'man-args)) - (while (get-process "man") (sit-for 0.2)) - (bookmark-default-handler (bookmark-get-bookmark bookmark)))) - -(defun bmkp-make-dired-record () - "Create and return a Dired bookmark record." - (let ((hidden-dirs (save-excursion (dired-remember-hidden)))) - (unwind-protect - (let ((dir (expand-file-name (if (consp dired-directory) - (file-name-directory (car dired-directory)) - dired-directory))) - (subdirs (bmkp-dired-subdirs)) - (mfiles (mapcar #'car (dired-remember-marks (point-min) (point-max))))) - `(,dir - ,@(bookmark-make-record-default 'no-file) - (filename . ,dir) (dired-directory . ,dired-directory) - (dired-marked . ,mfiles) (dired-switches . ,dired-actual-switches) - (dired-subdirs . ,subdirs) (dired-hidden-dirs . ,hidden-dirs) - (handler . bmkp-jump-dired))) - (save-excursion ; Hide subdirs that were hidden. - (dolist (dir hidden-dirs) (when (dired-goto-subdir dir) (dired-hide-subdir 1))))))) - -;;;###autoload -(defun bmkp-dired-subdirs () - "Alist of inserted subdirectories, without their positions (markers). -This is like `dired-subdir-alist' but without the top-level dir and -without subdir positions (markers)." - (interactive) - (let ((subdir-alist (cdr (reverse dired-subdir-alist))) ; Remove top. - (subdirs-wo-posns ())) - (dolist (sub subdir-alist) (push (list (car sub)) subdirs-wo-posns)) - subdirs-wo-posns)) - -(add-hook 'dired-mode-hook #'(lambda () (set (make-local-variable 'bookmark-make-record-function) - 'bmkp-make-dired-record))) - -(defun bmkp-jump-dired (bookmark) - "Jump to Dired bookmark BOOKMARK. -Handler function for record returned by `bmkp-make-dired-record'. -BOOKMARK is a bookmark name or a bookmark record." - (let ((dir (bookmark-prop-get bookmark 'dired-directory)) - (mfiles (bookmark-prop-get bookmark 'dired-marked)) - (switches (bookmark-prop-get bookmark 'dired-switches)) - (subdirs (bookmark-prop-get bookmark 'dired-subdirs)) - (hidden-dirs (bookmark-prop-get bookmark 'dired-hidden-dirs))) - (case bmkp-jump-display-function - ((nil switch-to-buffer display-buffer) (dired dir switches)) - ((bmkp-select-buffer-other-window pop-to-buffer switch-to-buffer-other-window) - (dired-other-window dir switches)) - (t (dired dir switches))) - (let ((inhibit-read-only t)) - (dired-insert-old-subdirs subdirs) - (dired-mark-remembered (mapcar (lexical-let ((dd dir)) - #'(lambda (mf) (cons (expand-file-name mf dd) 42))) - mfiles)) - (save-excursion - (dolist (dir hidden-dirs) (when (dired-goto-subdir dir) (dired-hide-subdir 1))))) - (goto-char (bookmark-get-position bookmark)))) - - -(defun bmkp-read-bookmark-for-type (type alist &optional other-win pred hist action) - "Read the name of a bookmark of type TYPE, with completion. -TYPE is a string used in the prompt: \"Jump to TYPE bookmark: \". -ALIST is the alist used for completion. If nil then raise an error to - let the user know there are no bookmarks of type TYPE. -Non-nil OTHER-WIN means append \" in another window\" to the prompt. -Non-nil PRED is a predicate used for bookmark-name completion. -Non-nil HIST is a history symbol. Default is `bookmark-history'. -ACTION is the action to mention in the prompt. `Jump to ', if nil." - (unless alist (error "No bookmarks of type %s" type)) - (bookmark-completing-read (concat (or action "Jump to ") type " bookmark" - (and other-win " in another window")) - (bmkp-default-bookmark-name alist) - alist pred hist)) - -;;;###autoload -(defun bmkp-jump-to-type (bookmark-name &optional use-region-p) ; `C-x j :' - "Jump to a bookmark of a given type. You are prompted for the type. -Otherwise, this is the same as `bookmark-jump' - see that, in -particular, for info about using a prefix argument. - -When prompted for the type, you can use completion against the known -bookmark types (see `bmkp-types-alist'). - -Completion is lax, so you can also enter the name of a bookmark -`handler' or `file-handler' function, without completion. Bookmarks -with that property value are then the jump candidates." - (interactive - (let* ((completion-ignore-case t) - (type-cands bmkp-types-alist) - (icicle-unpropertize-completion-result-flag t) - (type (completing-read "Type of bookmark: " type-cands)) - (history (assoc-default type type-cands)) - (alist (if history - (funcall - (intern (format "bmkp-%s-alist-only" type))) - bookmark-alist)) - (bmk-name (bmkp-read-bookmark-for-type - type alist nil - ;; PREDICATE if not a recognized type name. - (and (not history) - (bmkp-handler-pred (intern type))) - history))) - (list bmk-name (or (equal type "Region") current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-jump-to-type-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j :' - "`bmkp-jump-to-type', but in another window." - (interactive - (let* ((completion-ignore-case t) - (type-cands bmkp-types-alist) - (icicle-unpropertize-completion-result-flag t) - (type (completing-read "Type of bookmark: " type-cands)) - (history (assoc-default type type-cands)) - (alist (if history - (funcall - (intern (format "bmkp-%s-alist-only" type))) - bookmark-alist)) - (bmk-name (bmkp-read-bookmark-for-type - type alist t - ;; PREDICATE if not a recognized type name. - (and (not history) - (bmkp-handler-pred (intern type))) - history))) - (list bmk-name (or (equal type "Region") current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -(defun bmkp-handler-pred (type) - "Return a bookmark predicate that tests bookmarks with handler TYPE. -More precisely, the predicate returns non-nil if TYPE is either the -bookmark's `handler' or `file-handler' property value." - `(lambda (bmk) - (member ',type `(,(bookmark-prop-get bmk 'file-handler) ,(bookmark-get-handler bmk))))) - -;;;###autoload -(defun bmkp-autonamed-jump (bookmark-name) ; `C-x j #' - "Jump to an autonamed bookmark. -This is a specialization of `bookmark-jump'." - (interactive - (let ((alist (bmkp-autonamed-alist-only))) - (list (bmkp-read-bookmark-for-type "autonamed" alist nil nil 'bmkp-autonamed-history)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-autonamed-jump-other-window (bookmark-name) ; `C-x 4 j # #' - "`bmkp-autonamed-jump', but in another window." - (interactive - (let ((alist (bmkp-autonamed-alist-only))) - (list (bmkp-read-bookmark-for-type "autonamed" alist t nil 'bmkp-autonamed-history)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window nil)) - -;;;###autoload -(defun bmkp-autonamed-this-buffer-jump (bookmark-name) ; `C-x j , #' - "Jump to an autonamed bookmark in the current buffer. -This is a specialization of `bookmark-jump'." - (interactive - (let ((alist (bmkp-autonamed-this-buffer-alist-only))) - (list (bmkp-read-bookmark-for-type "autonamed" alist nil nil 'bmkp-autonamed-history)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-autonamed-this-buffer-jump-other-window (bookmark-name) ; `C-x 4 j # .' - "`bmkp-autonamed-this-buffer-jump', but in another window." - (interactive - (let ((alist (bmkp-autonamed-this-buffer-alist-only))) - (list (bmkp-read-bookmark-for-type "autonamed" alist t nil 'bmkp-autonamed-history)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window nil)) - -;;;###autoload -(defun bmkp-bookmark-list-jump (bookmark-name &optional use-region-p) ; `C-x j B' - "Jump to a bookmark-list bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-bookmark-list-alist-only))) - (list (bmkp-read-bookmark-for-type "bookmark-list" alist nil nil 'bmkp-bookmark-list-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-desktop-jump (bookmark-name &optional use-region-p) ; `C-x j K' - "Jump to a desktop bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-desktop-alist-only))) - (list (bmkp-read-bookmark-for-type "desktop" alist nil nil 'bmkp-desktop-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-dired-jump (bookmark-name &optional use-region-p) ; `C-x j d', (`J' in Dired) - "Jump to a Dired bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-dired-alist-only))) - (list (bmkp-read-bookmark-for-type "Dired" alist nil nil 'bmkp-dired-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-dired-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j d' - "`bmkp-dired-jump', but in another window." - (interactive - (let ((alist (bmkp-dired-alist-only))) - (list (bmkp-read-bookmark-for-type "Dired" alist t nil 'bmkp-dired-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-dired-this-dir-jump (bookmark-name &optional use-region-p) ; `C-x j . d', (`C-j' in Dired) - "Jump to a Dired bookmark for the `default-directory'. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-dired-this-dir-alist-only))) - (list (bmkp-read-bookmark-for-type "Dired-for-this-dir " alist nil nil 'bmkp-dired-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-dired-this-dir-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j C-d' - "`bmkp-dired-this-dir-jump', but in another window." - (interactive - (let ((alist (bmkp-dired-this-dir-alist-only))) - (list (bmkp-read-bookmark-for-type "Dired-for-this-dir" alist t nil 'bmkp-dired-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-file-jump (bookmark-name &optional use-region-p) ; `C-x j f' - "Jump to a file or directory bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-file-alist-only))) - (list (bmkp-read-bookmark-for-type "file" alist nil nil 'bmkp-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-file-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j f' - "`bmkp-file-jump', but in another window." - (interactive - (let ((alist (bmkp-file-alist-only))) - (list (bmkp-read-bookmark-for-type "file" alist t nil 'bmkp-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-file-this-dir-jump (bookmark-name &optional use-region-p) ; `C-x j . f' - "Jump to a bookmark for a file or subdir in the `default-directory'. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-file-this-dir-alist-only))) - (list (bmkp-read-bookmark-for-type "file-in-this-dir" alist nil nil 'bmkp-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-file-this-dir-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j . f' - "`bmkp-file-this-dir-jump', but in another window." - (interactive - (let ((alist (bmkp-file-this-dir-alist-only))) - (list (bmkp-read-bookmark-for-type "file-in-this-dir" alist t nil 'bmkp-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-gnus-jump (bookmark-name &optional use-region-p) ; `C-x j g', (`j' in Gnus summary mode) - "Jump to a Gnus bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-gnus-alist-only))) - (list (bmkp-read-bookmark-for-type "Gnus" alist nil nil 'bmkp-gnus-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-gnus-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j g' - "`bmkp-gnus-jump', but in another window." - (interactive - (let ((alist (bmkp-gnus-alist-only))) - (list (bmkp-read-bookmark-for-type "Gnus" alist t nil 'bmkp-gnus-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-image-jump (bookmark-name &optional use-region-p) ; `C-x j M-i' - "Jump to an image-file bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-image-alist-only))) - (list (bmkp-read-bookmark-for-type "image" alist nil nil 'bmkp-image-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-image-jump-other-window (bookmark-name &optional use-region-p) ; `C-x j M-i' - "`bmkp-image-jump', but in another window." - (interactive - (let ((alist (bmkp-image-alist-only))) - (list (bmkp-read-bookmark-for-type "image" alist t nil 'bmkp-image-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-info-jump (bookmark-name &optional use-region-p) ; `C-x j i', (`j' in Info) - "Jump to an Info bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-info-alist-only))) - (list (bmkp-read-bookmark-for-type "Info" alist nil nil 'bmkp-info-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-info-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j i' - "`bmkp-info-jump', but in another window." - (interactive - (let ((alist (bmkp-info-alist-only))) - (list (bmkp-read-bookmark-for-type "Info" alist t nil 'bmkp-info-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-local-file-jump (bookmark-name &optional use-region-p) ; `C-x j l' - "Jump to a local file or directory bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-local-file-alist-only))) - (list (bmkp-read-bookmark-for-type "local file" alist nil nil 'bmkp-local-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-local-file-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j l' - "`bmkp-local-file-jump', but in another window." - (interactive - (let ((alist (bmkp-local-file-alist-only))) - (list (bmkp-read-bookmark-for-type "local file" alist t nil 'bmkp-local-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-man-jump (bookmark-name &optional use-region-p) ; `C-x j m', (`j' in Man) - "Jump to a `man'-page bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-man-alist-only))) - (list (bmkp-read-bookmark-for-type "`man'" alist nil nil 'bmkp-man-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-man-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j m' - "`bmkp-man-jump', but in another window." - (interactive - (let ((alist (bmkp-man-alist-only))) - (list (bmkp-read-bookmark-for-type "`man'" alist t nil 'bmkp-man-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-non-file-jump (bookmark-name &optional use-region-p) ; `C-x j b', (`j' in Buffer Menu) - "Jump to a non-file (buffer) bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-non-file-alist-only))) - (list (bmkp-read-bookmark-for-type "non-file (buffer)" alist nil nil 'bmkp-non-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-non-file-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j b' - "`bmkp-non-file-jump', but in another window." - (interactive - (let ((alist (bmkp-non-file-alist-only))) - (list (bmkp-read-bookmark-for-type "non-file (buffer)" alist t nil 'bmkp-non-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-region-jump (bookmark-name) ; `C-x j r' - "Jump to a region bookmark. Select the region. -This is a specialization of `bookmark-jump', but without a prefix arg." - (interactive (list (bmkp-read-bookmark-for-type "region" (bmkp-region-alist-only) nil nil - 'bmkp-region-history))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer t)) - -;;;###autoload -(defun bmkp-region-jump-other-window (bookmark-name) ; `C-x 4 j r' - "`bmkp-region-jump', but in another window." - (interactive (list (bmkp-read-bookmark-for-type "region" (bmkp-region-alist-only) t nil - 'bmkp-region-history))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window t)) - -;;;###autoload -(defun bmkp-remote-file-jump (bookmark-name &optional use-region-p) ; `C-x j n' - "Jump to a remote file or directory bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-remote-file-alist-only))) - (list (bmkp-read-bookmark-for-type "remote file" alist nil nil 'bmkp-remote-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-remote-file-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j n' - "`bmkp-remote-file-jump', but in another window." - (interactive - (let ((alist (bmkp-remote-file-alist-only))) - (list (bmkp-read-bookmark-for-type "remote file" alist t nil 'bmkp-remote-file-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-specific-buffers-jump (buffers bookmark-name &optional use-region-p) ; `C-x j = b' - "Jump to a bookmark for a buffer in list BUFFERS. -Interactively, read buffer names and bookmark name, with completion. - -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((buffs ()) - buff) - (while (and (setq buff (bmkp-completing-read-buffer-name 'ALLOW-EMPTY)) (not (string= "" buff))) - (add-to-list 'buffs buff)) - (let ((alist (bmkp-specific-buffers-alist-only buffs))) - (list buffs (bmkp-read-bookmark-for-type "specific-buffers" alist nil nil 'specific-buffers-history) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-specific-buffers-jump-other-window (buffers bookmark-name - &optional use-region-p) ; `C-x 4 j = b' - "`bmkp-specific-buffers-jump', but in another window." - (interactive - (let ((buffs ()) - buff) - (while (and (setq buff (bmkp-completing-read-buffer-name 'ALLOW-EMPTY)) (not (string= "" buff))) - (add-to-list 'buffs buff)) - (let ((alist (bmkp-specific-buffers-alist-only buffs))) - (list buffs (bmkp-read-bookmark-for-type "specific-buffers" alist t nil 'specific-buffers-history) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-specific-files-jump (files bookmark-name &optional use-region-p) ; `C-x j = f' - "Jump to a bookmark for a file in list FILES. -Interactively, read file names and bookmark name, with completion. - -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((use-file-dialog nil) - (files ()) - file) - (while (and (setq file (bmkp-completing-read-file-name 'ALLOW-EMPTY)) (not (string= "" file))) - (add-to-list 'files file)) - (let ((alist (bmkp-specific-files-alist-only files))) - (list files (bmkp-read-bookmark-for-type "specific-files" alist nil nil 'specific-files-history) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-specific-files-jump-other-window (files bookmark-name - &optional use-region-p) ; `C-x 4 j = f' - "`bmkp-specific-files-jump', but in another window." - (interactive - (let ((use-file-dialog nil) - (files ()) - file) - (while (and (setq file (bmkp-completing-read-file-name 'ALLOW-EMPTY)) (not (string= "" file))) - (add-to-list 'files file)) - (let ((alist (bmkp-specific-files-alist-only files))) - (list files (bmkp-read-bookmark-for-type "specific-files" alist t nil 'specific-files-history) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-temporary-jump (bookmark-name) ; `C-x j x' - "Jump to a temporary bookmark. -This is a specialization of `bookmark-jump', but without a prefix arg." - (interactive (list (bmkp-read-bookmark-for-type "temporary" (bmkp-temporary-alist-only) nil nil - 'bmkp-temporary-history))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer t)) - -;;;###autoload -(defun bmkp-temporary-jump-other-window (bookmark-name) ; `C-x 4 j x' - "`bmkp-temporary-jump', but in another window." - (interactive (list (bmkp-read-bookmark-for-type "temporary" (bmkp-temporary-alist-only) t nil - 'bmkp-temporary-history))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window t)) - -;;;###autoload -(defun bmkp-this-buffer-jump (bookmark-name &optional use-region-p) ; `C-x j , ,' - "Jump to a bookmark for the current buffer. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-this-buffer-alist-only))) - (unless alist (error "No bookmarks for this buffer")) - (list (bookmark-completing-read "Jump to bookmark for this buffer" - (bmkp-default-bookmark-name alist) alist) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-this-buffer-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j , ,' - "`bmkp-this-buffer-jump', but in another window." - (interactive - (let ((alist (bmkp-this-buffer-alist-only))) - (unless alist (error "No bookmarks for this buffer")) - (list (bookmark-completing-read "Jump to bookmark for this buffer in another window" - (bmkp-default-bookmark-name alist) alist) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;; ;;;###autoload -;;; (defun bmkp-this-file-jump (bookmark-name &optional use-region-p) -;;; "Jump to a bookmark for the current file (absolute file name). -;;; This is a specialization of `bookmark-jump' - see that, in particular -;;; for info about using a prefix argument." -;;; (interactive -;;; (progn (unless (or (buffer-file-name) (and (eq major-mode 'dired-mode) -;;; (if (consp dired-directory) -;;; (car dired-directory) -;;; dired-directory))) -;;; (error "This buffer is not associated with a file")) -;;; (let ((alist (bmkp-this-file-alist-only))) -;;; (unless alist (error "No bookmarks for this file")) -;;; (list (bookmark-completing-read "Jump to bookmark for this file" -;;; (bmkp-default-bookmark-name alist) alist) -;;; current-prefix-arg)))) -;;; (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;; ;;;###autoload -;;; (defun bmkp-this-file-jump-other-window (bookmark-name &optional use-region-p) -;;; "`bmkp-this-file-jump', but in another window." -;;; (interactive -;;; (progn (unless (or (buffer-file-name) (and (eq major-mode 'dired-mode) -;;; (if (consp dired-directory) -;;; (car dired-directory) -;;; dired-directory))) -;;; (error "This buffer is not associated with a file")) -;;; (let ((alist (bmkp-this-file-alist-only))) -;;; (unless alist (error "No bookmarks for this file")) -;;; (list (bookmark-completing-read "Jump to bookmark for this file in another window" -;;; (bmkp-default-bookmark-name alist) alist) -;;; current-prefix-arg)))) -;;; (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-variable-list-jump (bookmark-name) ; `C-x j v' - "Jump to a variable-list bookmark. -This is a specialization of `bookmark-jump'." - (interactive - (let ((alist (bmkp-variable-list-alist-only))) - (list (bmkp-read-bookmark-for-type "variable-list" alist nil nil 'bmkp-variable-list-history)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-url-jump (bookmark-name &optional use-region-p) ; `C-x j u' - "Jump to a URL bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (if (fboundp 'w3m-list-buffers) - (bmkp-url-alist-only) - (bmkp-url-browse-alist-only)))) - (list (bmkp-read-bookmark-for-type "URL" alist nil nil 'bmkp-url-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-url-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j u' - "`bmkp-url-jump', but in another window." - (interactive - (let ((alist (if (fboundp 'w3m-list-buffers) - (bmkp-url-alist-only) - (bmkp-url-browse-alist-only)))) - (list (bmkp-read-bookmark-for-type "URL" alist t nil 'bmkp-url-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-w32-browser-jump (bookmark-name) ; Not bound by default. - "Jump to a bookmark whose handler applies `w32-browser' to its file. -This is a specialization of `bookmark-jump'." - (interactive - (list (bmkp-read-bookmark-for-type "w32-browser" bookmark-alist nil - ;; Use a predicate, since `w32-browser' is a handler, not a type name. - (bmkp-handler-pred 'w32-browser) - 'bmkp-w32-browser-history))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-w3m-jump (bookmark-name &optional use-region-p) ; `C-x j w', (`j' in W3M) - "Jump to a W3M bookmark. -This is a specialization of `bookmark-jump' - see that, in particular -for info about using a prefix argument." - (interactive - (let ((alist (bmkp-w3m-alist-only))) - (list (bmkp-read-bookmark-for-type "W3M" alist nil nil 'bmkp-w3m-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-w3m-jump-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j w' - "`bmkp-w3m-jump', but in another window." - (interactive - (let ((alist (bmkp-w3m-alist-only))) - (list (bmkp-read-bookmark-for-type "W3M" alist t nil 'bmkp-w3m-history) - current-prefix-arg))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-all-tags-jump (tags bookmark) ; `C-x j t *' - "Jump to a BOOKMARK that has all of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. -If you specify no tags, then every bookmark that has some tags is a -candidate. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-all-tags-alist-only tgs))) - (unless alist (error "No bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-all-tags-jump-other-window (tags bookmark) ; `C-x 4 j t *' - "`bmkp-all-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-all-tags-alist-only tgs))) - (unless alist (error "No bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-all-tags-regexp-jump (regexp bookmark) ; `C-x j t % *' - "Jump to a BOOKMARK that has each tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for all tags: ")) - (alist (bmkp-all-tags-regexp-alist-only rgx))) - (unless alist (error "No bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-all-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t % *' - "`bmkp-all-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for all tags: ")) - (alist (bmkp-all-tags-regexp-alist-only rgx))) - (unless alist (error "No bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-some-tags-jump (tags bookmark) ; `C-x j t +' - "Jump to a BOOKMARK that has at least one of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-some-tags-jump-other-window (tags bookmark) ; `C-x 4 j t +' - "`bmkp-some-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-some-tags-regexp-jump (regexp bookmark) ; `C-x j t % +' - "Jump to a BOOKMARK that has a tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-some-tags-regexp-alist-only rgx))) - (unless alist (error "No bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-some-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t % +' - "`bmkp-some-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-some-tags-regexp-alist-only rgx))) - (unless alist (error "No bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-all-tags-jump (tags bookmark) ; `C-x j t f *' - "Jump to a file or directory BOOKMARK that has all of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. -If you specify no tags, then every bookmark that has some tags is a -candidate. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-all-tags-jump-other-window (tags bookmark) ; `C-x 4 j t f *' - "`bmkp-file-all-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-all-tags-regexp-jump (regexp bookmark) ; `C-x j t f % *' - "Jump to a file or directory BOOKMARK that has each tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-all-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t f % *' - "`bmkp-file-all-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-some-tags-jump (tags bookmark) ; `C-x j t f +' - "Jump to a file or directory BOOKMARK that has at least one of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-some-tags-jump-other-window (tags bookmark) ; `C-x 4 j t f +' - "`bmkp-file-some-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-some-tags-regexp-jump (regexp bookmark) ; `C-x j t f % +' - "Jump to a file or directory BOOKMARK that has a tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-some-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t f % +' - "`bmkp-file-some-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-all-tags-jump (tags bookmark) ; `C-x j t . *' - "Jump to a file BOOKMARK in this dir that has all of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. -If you specify no tags, then every bookmark that has some tags is a -candidate. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-this-dir-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-all-tags-jump-other-window (tags bookmark) ; `C-x 4 j t . *' - "`bmkp-file-this-dir-all-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-this-dir-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-all-tags-regexp-jump (regexp bookmark) ; `C-x j t . % *' - "Jump to a file BOOKMARK in this dir that has each tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-this-dir-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-all-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t . % *' - "`bmkp-file-this-dir-all-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-this-dir-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-some-tags-jump (tags bookmark) ; `C-x j t . +' - "Jump to a file BOOKMARK in this dir that has at least one of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-this-dir-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-some-tags-jump-other-window (tags bookmark) ; `C-x 4 j t . +' - "`bmkp-file-this-dir-some-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-file-this-dir-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-some-tags-regexp-jump (regexp bookmark) ; `C-x j t . % +' - "Jump to a file BOOKMARK in this dir that has a tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-this-dir-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-file-this-dir-some-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t . % +' - "`bmkp-file-this-dir-some-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-file-this-dir-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-autofile-jump (bookmark-name) ; `C-x j a' - "Jump to an autofile bookmark. -This is a specialization of `bookmark-jump'." - (interactive - (let ((alist (bmkp-autofile-alist-only))) - (list (bmkp-read-bookmark-for-type "autofile" alist nil nil 'bmkp-autofile-history)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-autofile-jump-other-window (bookmark-name) ; `C-x 4 j a' - "`bmkp-autofile-jump' but in another window." - (interactive - (let ((alist (bmkp-autofile-alist-only))) - (list (bmkp-read-bookmark-for-type "autofile" alist t nil 'bmkp-autofile-history)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer nil)) - -;;;###autoload -(defun bmkp-autofile-all-tags-jump (tags bookmark) ; `C-x j t a *' - "Jump to an autofile BOOKMARK in this dir that has all of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. -If you specify no tags, then every bookmark that has some tags is a -candidate. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-autofile-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-autofile-all-tags-jump-other-window (tags bookmark) ; `C-x 4 j t a *' - "`bmkp-autofile-all-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-autofile-all-tags-alist-only tgs))) - (unless alist (error "No file or dir bookmarks have all of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-autofile-all-tags-regexp-jump (regexp bookmark) ; `C-x j t a % *' - "Jump to an autofile BOOKMARK in this dir that has each tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-autofile-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-autofile-all-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t a % *' - "`bmkp-autofile-all-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-autofile-all-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-autofile-some-tags-jump (tags bookmark) ; `C-x j t a +' - "Jump to an autofile BOOKMARK in this dir that has at least one of the TAGS. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter the bookmark name and each tag. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-autofile-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-autofile-some-tags-jump-other-window (tags bookmark) ; `C-x 4 j t a +' - "`bmkp-autofile-some-tags-jump', but in another window." - (interactive - (let* ((tgs (bmkp-read-tags-completing nil nil current-prefix-arg)) - (alist (bmkp-autofile-some-tags-alist-only tgs))) - (unless tgs (error "You did not specify any tags")) - (unless alist (error "No file or dir bookmarks have any of the specified tags")) - (list tgs (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -;;;###autoload -(defun bmkp-autofile-some-tags-regexp-jump (regexp bookmark) ; `C-x j t a % +' - "Jump to an autofile BOOKMARK in this dir that has a tag matching REGEXP. -You are prompted for the REGEXP. -Then you are prompted for the BOOKMARK (with completion)." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-autofile-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump bookmark)) - -;;;###autoload -(defun bmkp-autofile-some-tags-regexp-jump-other-window (regexp bookmark) ; `C-x 4 j t a % +' - "`bmkp-autofile-some-tags-regexp-jump', but in another window." - (interactive - (let* ((rgx (read-string "Regexp for tags: ")) - (alist (bmkp-autofile-some-tags-regexp-alist-only rgx))) - (unless alist (error "No file or dir bookmarks have tags that match `%s'" rgx)) - (list rgx (bookmark-completing-read "File bookmark" (bmkp-default-bookmark-name alist) alist)))) - (bookmark-jump-other-window bookmark)) - -(defun bmkp-find-file (&optional file create-autofile-p must-exist-p msg-p) ; `C-x j C-f' - "Visit a file or directory, respecting any associated autofile handlers. -You are prompted for the file or directory name, FILE. - -If FILE matches an entry in `bmkp-default-handlers-for-file-types' -then use the associated default handler to access the file. -Otherwise, just use `find-file'. - -With a prefix arg, create an autofile bookmark if FILE does not -already have one. - -Non-interactively: -* Non-nil MUST-EXIST-P means raise an error if FILE has no autofile - bookmark. -* Non-nil MSG-P means display a status message." - (interactive "i\nP\ni\np") - (let* ((use-file-dialog nil) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (fil (or file (read-file-name "Find file: " nil nil t))) - (dir-to-use (if (file-name-absolute-p fil) - (file-name-directory fil) - default-directory)) - (bmk (bmkp-get-autofile-bookmark fil))) - (if bmk - (bookmark-jump bmk) - (if must-exist-p - (error "File `%s' is not an autofile (no bookmark)" fil) - (when create-autofile-p ; Create a new bookmark. - (bmkp-file-target-set (expand-file-name fil dir-to-use) t nil 'NO-OVERWRITE msg-p) - (when msg-p (message "Autofile bookmark set for `%s'" fil))) - (let ((default-handler (condition-case nil (bmkp-default-handler-for-file fil) (error nil)))) - (if default-handler - (funcall default-handler fil) - (find-file fil 'WILDCARDS))))))) - -(defun bmkp-find-file-other-window (&optional file create-autofile-p must-exist-p msg-p) ; `C-x 4 j C-f' - "`bmkp-find-file', but in another window." - (interactive "i\nP\ni\np") - (let* ((use-file-dialog nil) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (fil (or file (read-file-name "Find file: " nil nil t))) - (dir-to-use (if (file-name-absolute-p fil) - (file-name-directory fil) - default-directory)) - (bmk (bmkp-get-autofile-bookmark fil dir-to-use))) - (if bmk - (bookmark-jump-other-window bmk) - (if must-exist-p - (error "File `%s' is not an autofile (no bookmark)" fil) - (when create-autofile-p ; Create a new bookmark. - (bmkp-file-target-set (expand-file-name fil dir-to-use) t nil 'NO-OVERWRITE msg-p) - (when msg-p (message "Autofile bookmark created for `%s'" fil))) - (let ((default-handler (condition-case nil (bmkp-default-handler-for-file fil) (error nil)))) - (if default-handler - (funcall default-handler fil) - (find-file-other-window fil 'WILDCARDS))))))) - - -;;; We could allow these even for Emacs 20 for Icicles users, -;;; but the predicate would have no effect when not in Icicle mode. So don't bother with Emacs 20. - -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-all-tags (tags &optional file) ; `C-x j t C-f *' - "Visit a file or directory that has all of the TAGS. -You are prompted first for the tags. Hit `RET' to enter each tag, -then hit `RET' again after the last tag. You can use completion to -enter each tag. This completion is lax: you are not limited to -existing tags. - -You are then prompted for the file name. This is read using -`read-file-name', so you can browse up and down the file hierarchy. -The completion candidates are file names, not bookmark names. -However, only files that are bookmarked as autofiles are candidates. - -If you specify no tags, then every file that has some tags is a -candidate. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive (list (bmkp-read-tags-completing nil nil current-prefix-arg))) - (lexical-let* ((tgs tags) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (lexical-let* ((bmk (bmkp-get-autofile-bookmark ff)) - (btgs (and bmk (bmkp-get-tags bmk)))) - (and btgs (bmkp-every #'(lambda (tag) (bmkp-has-tag-p bmk tag)) tgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (when bmk (bookmark-jump bmk))))) - -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-all-tags-other-window (tags &optional file) ; `C-x 4 j t C-f *' - "`bmkp-find-file-all-tags', but in another window." - (interactive (list (bmkp-read-tags-completing nil nil current-prefix-arg))) - (lexical-let* ((tgs tags) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (lexical-let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-every #'(lambda (tag) (bmkp-has-tag-p bk tag)) tgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump-other-window bmk)))) - -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-all-tags-regexp (regexp &optional file) ; `C-x j t C-f % *' - "Visit a file or directory that has each tag matching REGEXP. -You are prompted for the REGEXP." - (interactive (list (read-string "Regexp for tags: "))) - (lexical-let* ((rg regexp) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - btgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump bmk)))) - -;;;###autoload -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-all-tags-regexp-other-window (regexp &optional file) ; `C-x 4 j t C-f % *' - "`bmkp-find-file-all-tags-regexp', but in another window." - (interactive (list (read-string "Regexp for tags: "))) - (lexical-let* ((rg regexp) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-every #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - btgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump-other-window bmk)))) - -;;;###autoload -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-some-tags (tags &optional file) ; `C-x j t C-f +' - "Visit a file or directory that has at least one of the TAGS. -You are prompted first for the tags. Hit `RET' to enter each tag, -then hit `RET' again after the last tag. You can use completion to -enter each tag. This completion is lax: you are not limited to -existing tags. - -You are then prompted for the file name. This is read using -`read-file-name', so you can browse up and down the file hierarchy. -The completion candidates are file names, not bookmark names. -However, only files that are bookmarked as autofiles are candidates. - -By default, the tag choices for completion are NOT refreshed, to save -time. Use a prefix argument if you want to refresh them." - (interactive (list (bmkp-read-tags-completing nil nil current-prefix-arg))) - (lexical-let* ((tgs tags) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (lexical-let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-some #'(lambda (tag) (bmkp-has-tag-p bk tag)) tgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump bmk)))) - -;;;###autoload -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-some-tags-other-window (tags &optional file) ; `C-x 4 j t C-f +' - "`bmkp-find-file-some-tags', but in another window." - (interactive (list (bmkp-read-tags-completing nil nil current-prefix-arg))) - (lexical-let* ((tgs tags) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (lexical-let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-some #'(lambda (tag) (bmkp-has-tag-p bk tag)) tgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump-other-window bmk)))) - -;;;###autoload -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-some-tags-regexp (regexp &optional file) ; `C-x j t C-f % +' - "Visit a file or directory that has a tag matching REGEXP. -You are prompted for the REGEXP." - (interactive (list (read-string "Regexp for tags: "))) - (lexical-let* ((rg regexp) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - btgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump bmk)))) - -;;;###autoload -(when (> emacs-major-version 21) ; Needs `read-file-name' with a PREDICATE arg. - (defun bmkp-find-file-some-tags-regexp-other-window (regexp &optional file) ; `C-x 4 j t C-f % +' - "`bmkp-find-file-some-tags-regexp', but in another window." - (interactive (list (read-string "Regexp for tags: "))) - (lexical-let* ((rg regexp) - (use-file-dialog nil) - (pred - #'(lambda (ff) - (let* ((bk (bmkp-get-autofile-bookmark ff)) - (btgs (and bk (bmkp-get-tags bk)))) - (and btgs (bmkp-some #'(lambda (tag) (string-match rg (bmkp-tag-name tag))) - btgs))))) - (icicle-unpropertize-completion-result-flag t) ; For `read-file-name'. - (icicle-must-pass-after-match-predicate pred) - (fil (or (and file (funcall pred file) file) - (read-file-name - "Find file: " nil nil t nil - (and (or (not (boundp 'icicle-mode)) - (not icicle-mode)) - pred)))) - (bmk (bmkp-get-autofile-bookmark fil))) - (bookmark-jump-other-window bmk)))) - -;;;###autoload -(defun bmkp-jump-in-navlist (bookmark-name &optional use-region-p) ; `C-x j N' - "Jump to a bookmark, choosing from those in the navigation list." - (interactive - (progn (unless bmkp-nav-alist - (bookmark-maybe-load-default-file) - (setq bmkp-nav-alist bookmark-alist) - (unless bmkp-nav-alist (error "No bookmarks")) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist)) - (message "Bookmark navigation list is now the global bookmark list") (sit-for 2)) - (let ((bookmark-alist bmkp-nav-alist)) - (list (bookmark-completing-read "Jump to bookmark (in another window)" - (bmkp-default-bookmark-name)) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p)) - -;;;###autoload -(defun bmkp-jump-in-navlist-other-window (bookmark-name &optional use-region-p) ; `C-x 4 j N' - "Same as `bmkp-jump-in-navlist', but use another window." - (interactive - (progn (unless bmkp-nav-alist - (bookmark-maybe-load-default-file) - (setq bmkp-nav-alist bookmark-alist) - (unless bmkp-nav-alist (error "No bookmarks")) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist)) - (message "Bookmark navigation list is now the global bookmark list") (sit-for 2)) - (let ((bookmark-alist bmkp-nav-alist)) - (list (bookmark-completing-read "Jump to bookmark (in another window)" - (bmkp-default-bookmark-name)) - current-prefix-arg)))) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)) - -;;;###autoload -(defun bmkp-cycle (increment &optional other-window startoverp) - "Cycle through bookmarks in the navlist by INCREMENT (default: 1). -Positive INCREMENT cycles forward. Negative INCREMENT cycles backward. -Interactively, the prefix arg determines INCREMENT: - Plain `C-u': 1 - otherwise: the numeric prefix arg value - -Plain `C-u' also means start over at first bookmark. - -You can set the navigation list using commands - `bmkp-choose-navlist-from-bookmark-list' and - `bmkp-choose-navlist-of-type'. - -You can cycle among bookmarks in the current buffer using - `bmkp-cycle-this-buffer' and - `bmkp-cycle-this-buffer-other-window.' - -In Lisp code: - Non-nil OTHER-WINDOW means jump to the bookmark in another window. - Non-nil STARTOVERP means reset `bmkp-current-nav-bookmark' to the - first bookmark in the navlist." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) nil startovr))) - (unless bmkp-nav-alist - (bookmark-maybe-load-default-file) - (setq bmkp-nav-alist bookmark-alist) - (unless bmkp-nav-alist (error "No bookmarks")) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist)) - (message "Bookmark navigation list is now the global bookmark list") (sit-for 2)) - (unless (and bmkp-current-nav-bookmark (not startoverp) - (bookmark-get-bookmark bmkp-current-nav-bookmark 'NOERROR)) - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist))) - (if (bmkp-cycle-1 increment other-window startoverp) - (unless (or (bmkp-sequence-bookmark-p bmkp-current-nav-bookmark) - (bmkp-function-bookmark-p bmkp-current-nav-bookmark)) - (message "Position: %9d, Bookmark: `%s'" - (point) (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark))) - (message "Invalid bookmark: `%s'" (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark)))) - -;;;###autoload -(defun bmkp-cycle-other-window (increment &optional startoverp) - "Same as `bmkp-cycle' but uses another window." - (interactive "p") - (bmkp-cycle increment 'OTHER-WINDOW startoverp)) - -;;;###autoload -(defun bmkp-cycle-this-file/buffer (increment &optional other-window startoverp) - "Cycle through bookmarks for this file/buffer by INCREMENT (default: 1). -If visiting a file, this is `bmkp-cycle-this-file'. -Otherwise, this is `bmkp-cycle-this-buffer'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) nil startovr))) - (if (buffer-file-name) - (bmkp-cycle-this-file increment other-window startoverp) - (bmkp-cycle-this-buffer increment other-window startoverp))) - -;;;###autoload -(defun bmkp-cycle-this-file/buffer-other-window (increment &optional startoverp) - "Same as `bmkp-cycle-this-file/buffer' but use other window." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file/buffer increment 'OTHER-WINDOW startoverp)) - -;;;###autoload -(defun bmkp-cycle-this-file (increment &optional other-window startoverp) - "Cycle through bookmarks for this file by INCREMENT (default: 1). -Positive INCREMENT cycles forward. Negative INCREMENT cycles backward. -Interactively, the prefix arg determines INCREMENT: - Plain `C-u': 1 - otherwise: the numeric prefix arg value - -Plain `C-u' also means start over at first bookmark. - -You can cycle among bookmarks beyond the current file using -`bmkp-cycle' and `bmkp-cycle-other-window.' - -You can set your preferred sort order for this-file bookmarks by -customizing option `bmkp-this-file/buffer-cycle-sort-comparer'. - -To change the sort order without customizing, you can use \ -`\\[bmkp-this-file-bmenu-list]' to -show the `*Bookmark List*' with only this file's bookmarks, sort -them there, and use `\\[bmkp-choose-navlist-from-bookmark-list]', choosing \ -`CURRENT *Bookmark List*' as -the navigation list. - -Then you can cycle the bookmarks using `bmkp-cycle' -\(`\\[bmkp-next-bookmark-repeat]' etc.), instead of `bmkp-cycle-this-file'. - -In Lisp code: - Non-nil OTHER-WINDOW means jump to the bookmark in another window. - Non-nil STARTOVERP means reset `bmkp-current-nav-bookmark' to the - first bookmark in the navlist." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) nil startovr))) - (bookmark-maybe-load-default-file) - (let ((bmkp-sort-comparer bmkp-this-file/buffer-cycle-sort-comparer)) - (setq bmkp-nav-alist (bmkp-sort-omit (bmkp-this-file-alist-only)))) - (unless bmkp-nav-alist (error "No bookmarks for this file")) - (unless (and bmkp-current-nav-bookmark (not startoverp) - (bookmark-get-bookmark bmkp-current-nav-bookmark 'NOERROR) - (bmkp-this-file-p bmkp-current-nav-bookmark)) ; Exclude desktops etc. - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist))) - (if (bmkp-cycle-1 increment other-window startoverp) - (unless (or (bmkp-sequence-bookmark-p bmkp-current-nav-bookmark) - (bmkp-function-bookmark-p bmkp-current-nav-bookmark)) - (message "Position: %9d, Bookmark: `%s'" - (point) (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark))) - (message "Invalid bookmark: `%s'" (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark)))) - -;;;###autoload -(defun bmkp-cycle-this-file-other-window (increment &optional startoverp) - "Same as `bmkp-cycle-this-file' but use other window." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file increment 'OTHER-WINDOW startoverp)) - -;;;###autoload -(defun bmkp-cycle-this-buffer (increment &optional other-window startoverp) - "Cycle through bookmarks in this buffer by INCREMENT (default: 1). -Positive INCREMENT cycles forward. Negative INCREMENT cycles backward. -Interactively, the prefix arg determines INCREMENT: - Plain `C-u': 1 - otherwise: the numeric prefix arg value - -Plain `C-u' also means start over at first bookmark. - -You can cycle among bookmarks beyond the current buffer using -`bmkp-cycle' and `bmkp-cycle-other-window.' - -You can set your preferred sort order for this-buffer bookmarks by -customizing option `bmkp-this-file/buffer-cycle-sort-comparer'. - -To change the sort order without customizing, you can use \ -`\\[bmkp-this-buffer-bmenu-list]' to -show the `*Bookmark List*' with only this buffer's bookmarks, sort -them there, and use `\\[bmkp-choose-navlist-from-bookmark-list]', choosing \ -`CURRENT *Bookmark List*' as -the navigation list. - -Then you can cycle the bookmarks using `bmkp-cycle' -\(`\\[bmkp-next-bookmark-repeat]' etc.), instead of `bmkp-cycle-this-buffer'. - -In Lisp code: - Non-nil OTHER-WINDOW means jump to the bookmark in another window. - Non-nil STARTOVERP means reset `bmkp-current-nav-bookmark' to the - first bookmark in the navlist." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) nil startovr))) - (bookmark-maybe-load-default-file) - (let ((bmkp-sort-comparer bmkp-this-file/buffer-cycle-sort-comparer)) - (setq bmkp-nav-alist (bmkp-sort-omit (bmkp-this-buffer-alist-only)))) - (unless bmkp-nav-alist (error "No bookmarks in this buffer")) - (unless (and bmkp-current-nav-bookmark (not startoverp) - (bookmark-get-bookmark bmkp-current-nav-bookmark 'NOERROR) - (bmkp-this-buffer-p bmkp-current-nav-bookmark)) ; Exclude desktops etc. - (setq bmkp-current-nav-bookmark (car bmkp-nav-alist))) - (if (bmkp-cycle-1 increment other-window startoverp) - (unless (or (bmkp-sequence-bookmark-p bmkp-current-nav-bookmark) - (bmkp-function-bookmark-p bmkp-current-nav-bookmark)) - (message "Position: %9d, Bookmark: `%s'" - (point) (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark))) - (message "Invalid bookmark: `%s'" (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark)))) - -;;;###autoload -(defun bmkp-cycle-this-buffer-other-window (increment &optional startoverp) - "Same as `bmkp-cycle-this-buffer' but use other window." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-buffer increment 'OTHER-WINDOW startoverp)) - -(defun bmkp-cycle-1 (increment &optional other-window startoverp) - "Helper for `bmkp-cycle*' commands. -Do nothing if `bmkp-current-nav-bookmark' is an invalid bookmark. -Return `bmkp-current-nav-bookmark', or nil if invalid. - -NOTE: If `pop-up-frames' is non-nil, then cycling inhibits automatic -showing of annotations (`bookmark-automatically-show-annotations'). -This is to prevent change of frame focus, so cycling can continue -properly. - -See `bmkp-cycle' for descriptions of the arguments." - (let ((bookmark-alist bmkp-nav-alist) - (bookmark (bookmark-get-bookmark bmkp-current-nav-bookmark 'NOERROR)) - (bmkp-use-region (eq 'cycling-too bmkp-use-region))) - (unless bookmark-alist (error "No bookmarks for cycling")) - (when bookmark ; Skip bookmarks with bad names. - (setq bmkp-current-nav-bookmark - (if startoverp - (car bookmark-alist) - (let ((index (bmkp-list-position bookmark bookmark-alist #'eq))) - (if index - (nth (mod (+ increment index) (length bookmark-alist)) bookmark-alist) - (message "bmkp-cycle-1: Bookmark `%s' is not in navlist" - (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark)) - (car bookmark-alist))))) - (let ((bookmark-automatically-show-annotations ; Prevent possible frame focus change. - (and bookmark-automatically-show-annotations (not pop-up-frames)))) - (if other-window - (bookmark-jump-other-window (bmkp-bookmark-name-from-record bmkp-current-nav-bookmark)) - (save-selected-window (bmkp-bookmark-name-from-record - (bookmark-jump bmkp-current-nav-bookmark)))))) - (and bookmark bmkp-current-nav-bookmark))) ; Return nil if not a valid bookmark. - -(defun bmkp-list-position (item items &optional test) - "Find the first occurrence of ITEM in list ITEMS. -Return the index of the matching item, or nil if not found. -Items are compared using binary predicate TEST, or `equal' if TEST is -nil." - (unless test (setq test 'equal)) - (let ((pos 0)) - (catch 'bmkp-list-position - (dolist (itm items) - (when (funcall test item itm) (throw 'bmkp-list-position pos)) - (setq pos (1+ pos))) - nil))) - -;;;###autoload -(defun bmkp-next-bookmark (n &optional startoverp) ; You can bind this to a repeatable key - "Jump to the Nth next bookmark in the bookmark navigation list. -N defaults to 1, meaning the next bookmark. -Plain `C-u' means start over at first bookmark. -See also `bmkp-cycle'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle n nil startoverp)) - -;;;###autoload -(defun bmkp-previous-bookmark (n &optional startoverp) ; You can bind this to a repeatable key - "Jump to the Nth previous bookmark in the bookmark navigation list. -See `bmkp-next-bookmark'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle (- n) nil startoverp)) - -;;;###autoload -(defun bmkp-next-bookmark-repeat (arg) ; `C-x p right', `C-x p f', `C-x p C-f' - "Jump to the Nth-next bookmark in the bookmark navigation list. -This is a repeatable version of `bmkp-next-bookmark'. -N defaults to 1, meaning the next bookmark. -Plain `C-u' means start over at the first bookmark (and no repeat)." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-next-bookmark)) - -;;;###autoload -(defun bmkp-previous-bookmark-repeat (arg) ; `C-x p left', `C-x p b', `C-x p C-b' - "Jump to the Nth-previous bookmark in the bookmark navigation list. -See `bmkp-next-bookmark-repeat'." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-previous-bookmark)) - -;;;###autoload -(defun bmkp-next-bookmark-this-file/buffer (n &optional startoverp) ; Bind to repeatable key, e.g. `S-f2' - "Jump to the Nth-next bookmark for the current file/buffer. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one. -See also `bmkp-cycle-this-file/buffer'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file/buffer n nil startoverp)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-file/buffer (n &optional startoverp) ; Bind to repeatable key, e.g. `f2' - "Jump to the Nth-previous bookmark for the current file/buffer. -See `bmkp-next-bookmark-this-file/buffer'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file/buffer (- n) nil startoverp)) - -;;;###autoload -(defun bmkp-next-bookmark-this-file/buffer-repeat (arg) - ; `C-x p down', `C-x p n', `C-x p C-n', `C-x p mouse-wheel-up' - "Jump to the Nth next bookmark for the current file/buffer. -This is a repeatable version of `bmkp-next-bookmark-this-file/buffer'. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one (and no repeat)." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-next-bookmark-this-file/buffer)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-file/buffer-repeat (arg) - ; `C-x p up', `C-x p p', `C-x p C-p', `C-x p mouse-wheel-down' - "Jump to the Nth previous bookmark for the current file/buffer. -See `bmkp-next-bookmark-this-file/buffer-repeat'." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-previous-bookmark-this-file/buffer)) - -;;;###autoload -(defun bmkp-next-bookmark-this-file (n &optional startoverp) ; Bind to repeatable key, e.g. `S-f2' - "Jump to the Nth-next bookmark for the current file. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one. -See also `bmkp-cycle-this-file'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file n nil startoverp)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-file (n &optional startoverp) ; Bind to repeatable key, e.g. `f2' - "Jump to the Nth-previous bookmark for the current file. -See `bmkp-next-bookmark-this-file'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-file (- n) nil startoverp)) - -;;;###autoload -(defun bmkp-next-bookmark-this-file-repeat (arg) - "Jump to the Nth next bookmark for the current file. -This is a repeatable version of `bmkp-next-bookmark-this-file'. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one (and no repeat)." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-next-bookmark-this-file)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-file-repeat (arg) - "Jump to the Nth previous bookmark for the current file. -See `bmkp-next-bookmark-this-file-repeat'." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-previous-bookmark-this-file)) - - -;;;###autoload -(defun bmkp-next-bookmark-this-buffer (n &optional startoverp) ; Bind to repeatable key, e.g. `S-f2' - "Jump to the Nth-next bookmark in the current buffer. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one. -See also `bmkp-cycle-this-buffer'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-buffer n nil startoverp)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-buffer (n &optional startoverp) ; Bind to repeatable key, e.g. `f2' - "Jump to the Nth-previous bookmark in the current buffer. -See `bmkp-next-bookmark-this-buffer'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (bmkp-cycle-this-buffer (- n) nil startoverp)) - -;;;###autoload -(defun bmkp-next-bookmark-this-buffer-repeat (arg) - "Jump to the Nth next bookmark in the current buffer. -This is a repeatable version of `bmkp-next-bookmark-this-buffer'. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one (and no repeat)." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-next-bookmark-this-buffer)) - -;;;###autoload -(defun bmkp-previous-bookmark-this-buffer-repeat (arg) - "Jump to the Nth previous bookmark in the current buffer. -See `bmkp-next-bookmark-this-buffer-repeat'." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-previous-bookmark-this-buffer)) - -;;;###autoload -(defun bmkp-next-bookmark-w32 (n &optional startoverp) ; You can bind this to a repeatable key - "Windows `Open' the Nth next bookmark in the bookmark navigation list. -MS Windows only. Invokes the program associated with the file type. -N defaults to 1, meaning the next one. -Plain `C-u' means start over at the first one. -See also `bmkp-cycle'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (let ((bmkp-use-w32-browser-p t)) (bmkp-cycle n nil startoverp))) - -;;;###autoload -(defun bmkp-previous-bookmark-w32 (n &optional startoverp) ; You can bind this to a repeatable key - "Windows `Open' the Nth previous bookmark in the bookmark navlist. -See `bmkp-next-bookmark-w32'." - (interactive (let ((startovr (consp current-prefix-arg))) - (list (if startovr 1 (prefix-numeric-value current-prefix-arg)) startovr))) - (let ((bmkp-use-w32-browser-p t)) (bmkp-cycle (- n) nil startoverp))) - -;;;###autoload -(defun bmkp-next-bookmark-w32-repeat (arg) ; `C-x p next' - "Windows `Open' the Nth next bookmark in the bookmark navigation list. -This is a repeatable version of `bmkp-next-bookmark'. -N defaults to 1, meaning the next bookmark. -Plain `C-u' means start over at the first one (and no repeat)." - (interactive "P") - (require 'repeat) - (let ((bmkp-use-w32-browser-p t)) (bmkp-repeat-command 'bmkp-next-bookmark))) - -;;;###autoload -(defun bmkp-previous-bookmark-w32-repeat (arg) ; `C-x p prior' - "Windows `Open' the Nth previous bookmark in the bookmark navlist. -See `bmkp-next-bookmark-w32-repeat'." - (interactive "P") - (require 'repeat) - (let ((bmkp-use-w32-browser-p t)) (bmkp-repeat-command 'bmkp-previous-bookmark))) - -;; In spite of their names, `bmkp-cycle-specific-(buffers|files)*' just cycle bookmarks in the -;; current buffer or file. There is no way to choose multiple buffers or files. -;; -;; `bmkp-cycle-autonamed', `bmkp-cycle-autonamed-other-window', -;; `bmkp-cycle-bookmark-list', `bmkp-cycle-bookmark-list-other-window', -;; `bmkp-cycle-desktop', -;; `bmkp-cycle-dired', `bmkp-cycle-dired-other-window', -;; `bmkp-cycle-file', `bmkp-cycle-file-other-window', -;; `bmkp-cycle-gnus', `bmkp-cycle-gnus-other-window', -;; `bmkp-cycle-info', `bmkp-cycle-info-other-window', -;; `bmkp-cycle-lighted', `bmkp-cycle-lighted-other-window', -;; `bmkp-cycle-local-file', `bmkp-cycle-local-file-other-window', -;; `bmkp-cycle-man', `bmkp-cycle-man-other-window', -;; `bmkp-cycle-non-file', `bmkp-cycle-non-file-other-window', -;; `bmkp-cycle-remote-file', `bmkp-cycle-remote-file-other-window', -;; `bmkp-cycle-specific-buffers', `bmkp-cycle-specific-buffers-other-window', -;; `bmkp-cycle-specific-files', `bmkp-cycle-specific-files-other-window', -;; `bmkp-cycle-variable-list', -;; `bmkp-cycle-url', `bmkp-cycle-url-other-window', -;; `bmkp-next-autonamed-bookmark', `bmkp-next-autonamed-bookmark-repeat', -;; `bmkp-next-bookmark-list-bookmark', `bmkp-next-bookmark-list-bookmark-repeat', -;; `bmkp-next-desktop-bookmark', `bmkp-next-desktop-bookmark-repeat', -;; `bmkp-next-dired-bookmark', `bmkp-next-dired-bookmark-repeat', -;; `bmkp-next-file-bookmark', `bmkp-next-file-bookmark-repeat', -;; `bmkp-next-gnus-bookmark', `bmkp-next-gnus-bookmark-repeat', -;; `bmkp-next-info-bookmark', `bmkp-next-info-bookmark-repeat', -;; `bmkp-next-lighted-bookmark', `bmkp-next-lighted-bookmark-repeat', -;; `bmkp-next-local-file-bookmark', `bmkp-next-local-file-bookmark-repeat', -;; `bmkp-next-man-bookmark', `bmkp-next-man-bookmark-repeat', -;; `bmkp-next-non-file-bookmark', `bmkp-next-non-file-bookmark-repeat', -;; `bmkp-next-remote-file-bookmark', `bmkp-next-remote-file-bookmark-repeat', -;; `bmkp-next-specific-buffers-bookmark', `bmkp-next-specific-buffers-bookmark-repeat', -;; `bmkp-next-specific-files-bookmark', `bmkp-next-specific-files-bookmark-repeat', -;; `bmkp-next-variable-list-bookmark', `bmkp-next-variable-list-bookmark-repeat', -;; `bmkp-next-url-bookmark', `bmkp-next-url-bookmark-repeat'. -;; -(bmkp-define-cycle-command "autonamed") -(bmkp-define-cycle-command "autonamed" 'OTHER-WINDOW) -(bmkp-define-cycle-command "bookmark-list") ; No other-window version needed -(bmkp-define-cycle-command "desktop") ; No other-window version needed -(bmkp-define-cycle-command "dired") -(bmkp-define-cycle-command "dired" 'OTHER-WINDOW) -(bmkp-define-cycle-command "file") -(bmkp-define-cycle-command "file" 'OTHER-WINDOW) -(bmkp-define-cycle-command "gnus") -(bmkp-define-cycle-command "gnus" 'OTHER-WINDOW) -(bmkp-define-cycle-command "info") -(bmkp-define-cycle-command "info" 'OTHER-WINDOW) -(when (featurep 'bookmark+-lit) - (bmkp-define-cycle-command "lighted") - (bmkp-define-cycle-command "lighted" 'OTHER-WINDOW)) -(bmkp-define-cycle-command "local-file") -(bmkp-define-cycle-command "local-file" 'OTHER-WINDOW) -(bmkp-define-cycle-command "man") -(bmkp-define-cycle-command "man" 'OTHER-WINDOW) -(bmkp-define-cycle-command "non-file") -(bmkp-define-cycle-command "non-file" 'OTHER-WINDOW) -(bmkp-define-cycle-command "remote-file") -(bmkp-define-cycle-command "remote-file" 'OTHER-WINDOW) -(bmkp-define-cycle-command "specific-buffers") -(bmkp-define-cycle-command "specific-buffers" 'OTHER-WINDOW) -(bmkp-define-cycle-command "specific-files") -(bmkp-define-cycle-command "specific-files" 'OTHER-WINDOW) -(bmkp-define-cycle-command "variable-list") ; No other-window version needed -(bmkp-define-cycle-command "url") -(bmkp-define-cycle-command "url" 'OTHER-WINDOW) - -(bmkp-define-next+prev-cycle-commands "autonamed") -(bmkp-define-next+prev-cycle-commands "bookmark-list") -(bmkp-define-next+prev-cycle-commands "desktop") -(bmkp-define-next+prev-cycle-commands "dired") -(bmkp-define-next+prev-cycle-commands "file") -(bmkp-define-next+prev-cycle-commands "gnus") -(bmkp-define-next+prev-cycle-commands "info") -(bmkp-define-next+prev-cycle-commands "lighted") -(bmkp-define-next+prev-cycle-commands "local-file") -(bmkp-define-next+prev-cycle-commands "man") -(bmkp-define-next+prev-cycle-commands "non-file") -(bmkp-define-next+prev-cycle-commands "remote-file") -(bmkp-define-next+prev-cycle-commands "specific-buffers") -(bmkp-define-next+prev-cycle-commands "specific-files") -(bmkp-define-next+prev-cycle-commands "variable-list") -(bmkp-define-next+prev-cycle-commands "url") - -;;;###autoload -(defun bmkp-toggle-autonamed-bookmark-set/delete (&optional position allp) - ; Bound to `C-x p RET', `C-x p c RET' - "If there is an autonamed bookmark at point, delete it, else create one. -The bookmark created has no region. Its name is formatted according -to option `bmkp-autoname-bookmark-function'. - -With a prefix arg, delete *ALL* autonamed bookmarks for this buffer. - -Non-interactively, act at POSITION, not point. If nil, act at point." - (interactive "d\nP") - (unless position (setq position (point))) - (if allp - (bmkp-delete-all-autonamed-for-this-buffer) - (let ((bmk-name (funcall bmkp-autoname-bookmark-function position))) - (if (not (bmkp-get-bookmark-in-alist bmk-name 'NOERROR)) - (let ((mark-active nil)) ; Do not set a region bookmark. - (bookmark-set bmk-name) - (message "Set bookmark `%s'" bmk-name)) - (bookmark-delete bmk-name) - (message "Deleted bookmark `%s'" bmk-name))))) - -;;;###autoload -(defun bmkp-set-autonamed-bookmark (&optional position msg-p) - "Set an autonamed bookmark at point. -The bookmark created has no region. Its name is formatted according -to option `bmkp-autoname-bookmark-function'. -Non-interactively: - - Act at POSITION, not point. If nil, act at point. - - Non-nil optional arg MSG-P means display a status message." - (interactive (list (point) t)) - (unless position (setq position (point))) - (let ((bmk-name (funcall bmkp-autoname-bookmark-function position)) - (mark-active nil)) ; Do not set a region bookmark. - (bookmark-set bmk-name) - (when msg-p (message "Set bookmark `%s'" bmk-name)))) - -;;;###autoload -(defun bmkp-set-autonamed-bookmark-at-line (&optional number) - "Set an autonamed bookmark at the beginning of the given line NUMBER. -If NUMBER is nil, use the current line." - (interactive "nSet bookmark on line: ") - (unless number (setq number (count-lines (point-min) (point)))) - (save-excursion - (goto-char (point-min)) - (unless (zerop (forward-line (1- number))) - (error "No such line: %d (%d lines total)" number (1+ (count-lines (point-min) (point-max))))) - (bmkp-set-autonamed-bookmark (point)))) - -(when (> emacs-major-version 21) - (defun bmkp-occur-create-autonamed-bookmarks ( &optional msg-p) ; Bound to `C-c C-M-B' (aka `C-c C-M-S-b') - "Create an autonamed bookmark for each `occur' hit. -You can use this only in `Occur' mode (commands such as `occur' and -`multi-occur'). -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list 'MSG)) - (unless (eq major-mode 'occur-mode) (error "You must be in `occur-mode'")) - (let ((count 0)) - (save-excursion - (goto-char (point-min)) - (while (condition-case nil (progn (occur-next) t) (error nil)) - (let* ((pos (get-text-property (point) 'occur-target)) - (buf (and pos (marker-buffer pos)))) - (when buf - (with-current-buffer buf - (goto-char pos) - (bmkp-set-autonamed-bookmark (point))) - (setq count (1+ count)))))) - (when msg-p (message "Created %d autonamed bookmarks" count))))) - -;;;###autoload -(defun bmkp-set-autonamed-regexp-buffer (regexp &optional msg-p) - "Set autonamed bookmarks at matches for REGEXP in the buffer. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (read-string "Regexp: " nil 'regexp-history) - t)) - (bmkp-set-autonamed-regexp-region regexp (point-min) (point-max) msg-p)) - -;;;###autoload -(defun bmkp-set-autonamed-regexp-region (regexp beg end &optional msg-p) - "Set autonamed bookmarks at matches for REGEXP in the region. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (read-string "Regexp: " nil 'regexp-history) - (region-beginning) (region-end) - t)) - (let ((count 0)) - (save-excursion - (goto-char beg) - (while (re-search-forward regexp end t) - (bmkp-set-autonamed-bookmark (point)) - (setq count (1+ count)) - (forward-line 1))) - (when msg-p (message "Set %d autonamed bookmarks" count)))) - -(defun bmkp-autoname-bookmark-function-default (position) - "Return a bookmark name using POSITION and the current buffer name. -The name is composed as follows: - POSITION followed by a space and then the buffer name. - The position value is prefixed with zeros to comprise 9 characters. - For example, for POSITION value 31416 and current buffer `my-buffer', - the name returned would be `000031416 my-buffer'" - (format "%09d %s" (abs position) (buffer-name))) - -;;;###autoload -(defun bmkp-delete-all-autonamed-for-this-buffer (&optional msg-p) - "Delete all autonamed bookmarks for the current buffer. -Interactively, or with non-nil arg MSG-P, require confirmation. -To be deleted, a bookmark name must be an autonamed bookmark whose -buffer part names the current buffer." - (interactive "p") - (let ((bmks-to-delete (mapcar #'bmkp-bookmark-name-from-record - (bmkp-autonamed-this-buffer-alist-only)))) - (if (null bmks-to-delete) - (when msg-p (message "No autonamed bookmarks for buffer `%s'" (buffer-name))) - (when (or (not msg-p) - (y-or-n-p (format "Delete ALL autonamed bookmarks for buffer `%s'? " - (buffer-name)))) - (let ((bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (dolist (bmk bmks-to-delete) (bookmark-delete bmk 'BATCHP))) ; No refresh yet. - (bmkp-refresh/rebuild-menu-list nil (not msg-p)) ; Now refresh, after iterate. - (when msg-p (message "Deleted all bookmarks for buffer `%s'" (buffer-name))))))) - -;; You can use this in `kill-buffer-hook'. -(defun bmkp-delete-autonamed-this-buffer-no-confirm (&optional no-refresh-p) - "Delete all autonamed bookmarks for this buffer, without confirmation. -Non-nil optional arg NO-REFRESH-P means do not refresh/rebuild the -bookmark-list." - (when (and bookmarks-already-loaded bookmark-alist) - (let ((bmks-to-delete (mapcar #'bmkp-bookmark-name-from-record - (bmkp-autonamed-this-buffer-alist-only))) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (dolist (bmk bmks-to-delete) (bookmark-delete bmk 'BATCHP))) ; No refresh yet. - (unless no-refresh-p - (bmkp-refresh/rebuild-menu-list nil 'BATCHP)))) ; Now refresh, after iterate. - - -;; You can use this in `kill-emacs-hook'. -(defun bmkp-delete-autonamed-no-confirm () - "Delete all autonamed bookmarks for all buffers, without confirmation." - (when (and bookmarks-already-loaded bookmark-alist) - (let ((bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (dolist (buf (buffer-list)) - (with-current-buffer buf - (bmkp-delete-autonamed-this-buffer-no-confirm 'NO-REFRESH-P)))) ; No refresh yet. - (bmkp-refresh/rebuild-menu-list nil 'BATCHP))) ; Now refresh, after iterate. - -(cond ((fboundp 'define-minor-mode) - ;; Emacs 21 and later. Eval this so that even if the library is byte-compiled with Emacs 20, - ;; loading it into Emacs 21+ will define variable `bmkp-auto-idle-bookmark-mode'. - (eval '(define-minor-mode bmkp-auto-idle-bookmark-mode - "Toggle automatic setting of a bookmark when Emacs is idle. -Non-interactively, turn automatic bookmarking on for the current -buffer if and only if ARG is positive. - -To enable or disable automatic bookmarking in all buffers, use -`bmkp-global-auto-idle-bookmark-mode'. - -When the mode is enabled in the current buffer, a bookmark is -automatically set every `bmkp-auto-idle-bookmark-mode-delay' seconds, -using the setting function that is the value of option -`bmkp-auto-idle-bookmark-mode-set-function'. Note that a buffer must -be current (selected) for an automatic bookmark to be created there - -it is not enough that the mode be enabled in the buffer. - -Turning the mode on and off runs hooks -`bmkp-auto-idle-bookmark-mode-on-hook' and -`bmkp-auto-idle-bookmark-mode-off-hook', respectively. - -If you want the automatic bookmarks to be temporary (not saved to your -bookmark file), then customize option -`bmkp-autotemp-bookmark-predicates' so that it includes the kind of -bookmarks that are set by `bmkp-auto-idle-bookmark-mode-set-function'. -For example, if automatic bookmarking sets autonamed bookmarks, then -`bmkp-autotemp-bookmark-predicates' should include -`bmkp-autonamed-bookmark-p' or -`bmkp-autonamed-this-buffer-bookmark-p'. - -If you want the automatically created bookmarks to be highlighted, -then customize option `bmkp-auto-light-when-set' to highlight -bookmarks of the appropriate kind. For example, to highlight -autonamed bookmarks set it to `autonamed-bookmark'. - -NOTE: If you use Emacs 21 then there is no global version of the mode -- that is, there is no command `bmkp-global-auto-idle-bookmark-mode'." - :init-value nil :group 'bookmark-plus :require 'bookmark+ - :lighter bmkp-auto-idle-bookmark-mode-lighter - :link `(url-link :tag "Send Bug Report" - ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ -Bookmark bug: \ -&body=Describe bug here, starting with `emacs -Q'. \ -Don't forget to mention your Emacs and library versions.")) - :link '(url-link :tag "Download" "http://www.emacswiki.org/bookmark+.el") - :link '(url-link :tag "Description" "http://www.emacswiki.org/BookmarkPlus") - :link '(emacs-commentary-link :tag "Commentary" "bookmark+") - (when bmkp-auto-idle-bookmark-mode-timer - (cancel-timer bmkp-auto-idle-bookmark-mode-timer) - (setq bmkp-auto-idle-bookmark-mode-timer nil)) - (when bmkp-auto-idle-bookmark-mode - (setq bmkp-auto-idle-bookmark-mode-timer - (run-with-idle-timer bmkp-auto-idle-bookmark-mode-delay 'REPEAT - (lambda () - (when (and bmkp-auto-idle-bookmark-mode - (bmkp-not-near-other-auto-idle-bmks)) - (let ((bmkp-setting-auto-idle-bmk-p t)) - (funcall bmkp-auto-idle-bookmark-mode-set-function))))))) - (when (interactive-p) - (message "Automatic bookmarking is now %s in buffer `%s'" - (if bmkp-auto-idle-bookmark-mode "ON" "OFF") (buffer-name))))) - - (eval '(defun bmkp-turn-on-auto-idle-bookmark-mode () - "Turn on `bmkp-auto-idle-bookmark-mode'." - (bmkp-auto-idle-bookmark-mode 1))) - - (when (fboundp 'define-globalized-minor-mode) ; Emacs 22+, not 21. - (eval '(define-globalized-minor-mode bmkp-global-auto-idle-bookmark-mode - bmkp-auto-idle-bookmark-mode - bmkp-turn-on-auto-idle-bookmark-mode - :group 'bookmark-plus :require 'bookmark+)))) - (t ; Emacs 20. - (defun bmkp-auto-idle-bookmark-mode (&optional arg) - "Toggle automatic setting of a bookmark when Emacs is idle. -Non-interactively, turn automatic bookmarking on if and only if ARG is -positive. - -When the mode is enabled, a bookmark is automatically set every -`bmkp-auto-idle-bookmark-mode-delay' seconds, using the setting -function that is the value of option -`bmkp-auto-idle-bookmark-mode-set-function'. Note that a buffer must -be current (selected) for an automatic bookmark to be created there - -it is not enough that the mode be enabled in the buffer. - -If you want these bookmarks to be temporary (not saved to your -bookmark file), then customize option -`bmkp-autotemp-bookmark-predicates' so that it includes the kind of -bookmarks that are set by `bmkp-auto-idle-bookmark-mode-set-function'. -For example, if automatic bookmarking sets autonamed bookmarks, then -`bmkp-autotemp-bookmark-predicates' should include -`bmkp-autonamed-bookmark-p'. - -If you want the automatically created bookmarks to be highlighted, -then customize option `bmkp-auto-light-when-set' to highlight -bookmarks of the appropriate kind. For example, to highlight -autonamed bookmarks set it to `autonamed-bookmark'. - -NOTE: This is the Emacs 20 version of `bmkp-auto-idle-bookmark-mode', -which is global only, that is, all buffers are affected. If you -instead want it to be local only, then do both of the following in -your init file: - (make-variable-buffer-local 'bmkp-auto-idle-bookmark-mode) - (make-variable-buffer-local 'bmkp-auto-idle-bookmark-mode-timer)" - (interactive (list (or current-prefix-arg 'toggle))) - (setq bmkp-auto-idle-bookmark-mode (if (eq arg 'toggle) - (not bmkp-auto-idle-bookmark-mode) - (> (prefix-numeric-value arg) 0))) - (when bmkp-auto-idle-bookmark-mode-timer - (cancel-timer bmkp-auto-idle-bookmark-mode-timer) - (setq bmkp-auto-idle-bookmark-mode-timer nil)) - (when bmkp-auto-idle-bookmark-mode - (setq bmkp-auto-idle-bookmark-mode-timer - (run-with-idle-timer bmkp-auto-idle-bookmark-mode-delay 'REPEAT - (lambda () ; This allows use as a local mode. - (when (and bmkp-auto-idle-bookmark-mode - (bmkp-not-near-other-auto-idle-bmks)) - (let ((bmkp-setting-auto-idle-bmk-p t)) - (funcall bmkp-auto-idle-bookmark-mode-set-function))))))) - (when (interactive-p) - (message "Automatic bookmarking is now %s%s" - (if bmkp-auto-idle-bookmark-mode "ON" "OFF") - (if (local-variable-if-set-p 'bmkp-auto-idle-bookmark-mode) - (format " in buffer `%s'" (current-buffer)) - "")))) - - - (add-to-list 'minor-mode-alist `(bmkp-auto-idle-bookmark-mode - ,bmkp-auto-idle-bookmark-mode-lighter)))) - -(defun bmkp-not-near-other-auto-idle-bmks (&optional position) - "Is POSITION far enough from automatic bookmarks to create a new one? -Return non-nil if `bmkp-auto-idle-bookmark-min-distance' is nil or if -POSITION is at least `bmkp-auto-idle-bookmark-min-distance' chars from -all other automatic bookmarks in the same buffer. Else return nil." - (unless position (setq position (point))) - (or (not bmkp-auto-idle-bookmark-min-distance) - (catch 'bmkp-not-near-other-auto-idle-bmks - (let (pos) - (dolist (bmk bmkp-auto-idle-bookmarks) - (when (and (bmkp-this-buffer-p bmk) - (setq pos (bookmark-get-position bmk)) - (< (abs (- (point) pos)) bmkp-auto-idle-bookmark-min-distance)) - (throw 'bmkp-not-near-other-auto-idle-bmks nil))) - t)))) - -(if (fboundp 'define-minor-mode) - ;; Emacs 21 and later. Eval this so that even if the library is byte-compiled with Emacs 20, - ;; loading it into Emacs 21+ will define variable `bmkp-temporary-bookmarking-mode'. - (eval '(define-minor-mode bmkp-temporary-bookmarking-mode ; `M-L' in `*Bookmark List*'. - "Toggle temporary bookmarking. -Temporary bookmarking means that any bookmark changes (creation, -modification, deletion) are NOT automatically saved. - -Interactively, you are required to confirm turning on the mode. - -When the mode is turned ON: - a. `bookmark-save-flag' is set to nil. - b. `bmkp-current-bookmark-file' is set to a new, empty bookmark file - in directory `temporary-file-directory' (via `make-temp-file'). - c. That file is not saved automatically. - d. In the `*Bookmark List*' display, the major-mode mode-line - indicator is set to `TEMPORARY ONLY'. - -Non-interactively, turn temporary bookmarking on if and only if ARG is -positive. Non-interactively there is no prompt for confirmation." - :init-value nil :global t :group 'bookmark-plus :lighter bmkp-temporary-bookmarking-mode-lighter - :link `(url-link :tag "Send Bug Report" - ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ -Bookmark bug: \ -&body=Describe bug here, starting with `emacs -Q'. \ -Don't forget to mention your Emacs and library versions.")) - :link '(url-link :tag "Download" "http://www.emacswiki.org/bookmark+.el") - :link '(url-link :tag "Description" "http://www.emacswiki.org/BookmarkPlus") - :link '(emacs-commentary-link :tag "Commentary" "bookmark+") - (cond ((not bmkp-temporary-bookmarking-mode) ; Turn off. - (when (fboundp 'bmkp-unlight-bookmarks) ; In `bookmark+-lit.el'. - (bmkp-unlight-bookmarks ; Unhighlight the temporary (current) bookmarks. - '(bmkp-autonamed-overlays bmkp-non-autonamed-overlays) nil)) - (bmkp-switch-to-last-bookmark-file) - (setq bmkp-last-bookmark-file bmkp-current-bookmark-file) ; Forget last (temp file). - (when (interactive-p) - (message "Bookmarking is NOT temporary now. Restored previous bookmarks list"))) - ((or (not (interactive-p)) - (y-or-n-p (format "%switch to only temporary bookmarking? " - (if bookmark-save-flag "Save current bookmarks, then s" "S")))) - (when (and (> bookmark-alist-modification-count 0) bookmark-save-flag) - (bookmark-save)) - (let ((new-file (make-temp-file "bmkp-temp-"))) - (bmkp-empty-file new-file) - (bookmark-load new-file t 'nosave) ; Saving was done just above. - (when bookmark-save-flag (bmkp-toggle-saving-bookmark-file (interactive-p)))) - (when (interactive-p) (message "Bookmarking is now TEMPORARY"))) - (t ; User refused to confirm. - (message "OK, canceled - bookmarking is NOT temporary") - (setq bmkp-temporary-bookmarking-mode nil))))) - - ;; Emacs 20 - (defun bmkp-temporary-bookmarking-mode (&optional arg) ; `M-L' in `*Bookmark List*'. - "Toggle temporary bookmarking. -Temporary bookmarking means that any bookmark changes (creation, -modification, deletion) are NOT automatically saved. - -Interactively, you are required to confirm turning on the mode. - -When the mode is turned ON: - a. `bookmark-save-flag' is set to nil. - b. `bmkp-current-bookmark-file' is set to a new, empty bookmark file - in directory `temporary-file-directory' (via `make-temp-file'). - c. That file is not saved automatically. - d. In the `*Bookmark List*' display, the major-mode mode-line - indicator is set to `TEMPORARY ONLY'. - -Non-interactively, turn temporary bookmarking on if and only if ARG is -positive. Non-interactively there is no prompt for confirmation." - (interactive "P") - (setq bmkp-temporary-bookmarking-mode - (if arg (> (prefix-numeric-value arg) 0) (not bmkp-temporary-bookmarking-mode))) - (cond ((not bmkp-temporary-bookmarking-mode) ; Turn off. - (when (fboundp 'bmkp-unlight-bookmarks) ; In `bookmark+-lit.el'. - (bmkp-unlight-bookmarks ; Unhighlight the temporary (current) bookmarks. - '(bmkp-autonamed-overlays bmkp-non-autonamed-overlays) nil)) - (bmkp-switch-to-last-bookmark-file) - (setq bmkp-last-bookmark-file bmkp-current-bookmark-file) ; Forget last (temporary file). - (run-hooks 'bmkp-temporary-bookmarking-mode-hook) - (when (interactive-p) - (message "Bookmarking is NOT temporary now. Restored previous bookmarks list"))) - ((or (not (interactive-p)) - (y-or-n-p (format "%switch to only TEMPORARY bookmarking? " - (if bookmark-save-flag "Save current bookmarks, then s" "S")))) - (when (and (> bookmark-alist-modification-count 0) bookmark-save-flag) - (bookmark-save)) - (let ((new-file (make-temp-file "bmkp-temp-"))) - (bmkp-empty-file new-file) - (bookmark-load new-file t 'nosave) ; Saving was done just above. - (when bookmark-save-flag (bmkp-toggle-saving-bookmark-file (interactive-p)))) - (run-hooks 'bmkp-temporary-bookmarking-mode-hook) - (when (interactive-p) (message "Bookmarking is now TEMPORARY"))) - (t ; User refused to confirm. - (message "OK, canceled - bookmarking is NOT temporary") - (setq bmkp-temporary-bookmarking-mode nil)))) - - - (add-to-list 'minor-mode-alist `(bmkp-temporary-bookmarking-mode - ,bmkp-temporary-bookmarking-mode-lighter))) - -;;;###autoload -(defun bmkp-toggle-autotemp-on-set (&optional msg-p) ; Bound to `C-x p x' - "Toggle automatically making any bookmark temporary whenever it is set. -Non-interactively, non-nil MSG-P means display a status message." - (interactive "p") - (setq bmkp-autotemp-all-when-set-p (not bmkp-autotemp-all-when-set-p)) - (when msg-p (message "Automatically making bookmarks temporary when set is now %s" - (if bmkp-autotemp-all-when-set-p "ON" "OFF")))) - -;;;###autoload -(defun bmkp-toggle-temporary-bookmark (bookmark &optional msg-p) - "Toggle whether BOOKMARK is temporary (not saved to disk). -Return the full updated bookmark. -BOOKMARK is a bookmark name or a bookmark record. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) t)) - (let ((was-temp (bmkp-temporary-bookmark-p bookmark))) - (bookmark-prop-set bookmark 'bmkp-temp (not was-temp)) - (when msg-p (message "Bookmark `%s' is now %s" - (if (stringp bookmark) bookmark (bmkp-bookmark-name-from-record bookmark)) - (if was-temp "SAVABLE" "TEMPORARY")))) - bookmark) - -;;;###autoload -(defun bmkp-make-bookmark-temporary (bookmark &optional msg-p) - "Make BOOKMARK temporary (not saved to disk). -Return the full updated bookmark. -BOOKMARK is a bookmark name or a bookmark record. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) t)) - (bookmark-prop-set bookmark 'bmkp-temp t) - (when msg-p (message "Bookmark `%s' is now TEMPORARY" - (if (stringp bookmark) bookmark (bmkp-bookmark-name-from-record bookmark)))) - bookmark) - -;;;###autoload -(defun bmkp-make-bookmark-savable (bookmark &optional msg-p) - "Make BOOKMARK savable to disk (not temporary). -Return the full updated bookmark. -BOOKMARK is a bookmark name or a bookmark record. -Non-interactively, non-nil MSG-P means display a status message." - (interactive (list (bookmark-completing-read "Bookmark" (bmkp-default-bookmark-name)) t)) - (bookmark-prop-set bookmark 'bmkp-temp nil) - (when msg-p (message "Bookmark `%s' is now SAVABLE" - (if (stringp bookmark) bookmark (bmkp-bookmark-name-from-record bookmark)))) - bookmark) - -;;;###autoload -(defun bmkp-delete-all-temporary-bookmarks (&optional msg-p) - "Delete all temporary bookmarks, after confirmation. -These are bookmarks that are `bmkp-temporary-bookmark-p'. You can -make a bookmark temporary using `bmkp-make-bookmark-temporary' or -`bmkp-toggle-temporary-bookmark'. -Non-interactively, non-nil MSG-P means display a status message." - (interactive "p") - (let ((bmks-to-delete (mapcar #'bmkp-bookmark-name-from-record (bmkp-temporary-alist-only)))) - (if (null bmks-to-delete) - (when msg-p (message "No temporary bookmarks to delete")) - (when (and msg-p (not (y-or-n-p (format "Delete ALL temporary bookmarks? ")))) - (error "OK - delete canceled")) - (let ((bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (dolist (bmk bmks-to-delete) (bookmark-delete bmk 'BATCHP))) ; No refresh yet. - (bmkp-refresh/rebuild-menu-list nil (not msg-p)) ; Now refresh, after iterate. - (when msg-p (message "Deleted all temporary bookmarks"))))) - -;; You can use this in `kill-emacs-hook'. -(defun bmkp-delete-temporary-no-confirm () - "Delete all temporary bookmarks, without confirmation." - (when (and bookmarks-already-loaded bookmark-alist) - (let ((bmks-to-delete (mapcar #'bmkp-bookmark-name-from-record (bmkp-temporary-alist-only))) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (dolist (bmk bmks-to-delete) (bookmark-delete bmk 'BATCHP))) ; No refresh yet. - (bmkp-refresh/rebuild-menu-list nil 'BATCHP))) ; Now refresh, after iterate. - -;;;###autoload -(defun bmkp-delete-bookmarks (&optional position allp alist msg-p) ; Bound to `C-x p delete' - "Delete some bookmarks at point or all bookmarks in the buffer. -With no prefix argument, delete some bookmarks at point. -If there is more than one, require confirmation for each. - -With a prefix argument, delete *ALL* bookmarks in the current buffer. - -Non-interactively: -* Delete at POSITION, not point. If nil, delete at point. -* Non-nil optional arg ALLP means delete all bookmarks in the buffer. -* ALIST is the alist of bookmarks. - If nil, use the bookmarks in the current buffer. -* Non-nil MSG-P means display informative messages." - (interactive "d\nP\ni\np") - (unless position (setq position (point))) - (let ((bmks-to-delete (and allp (mapcar #'bmkp-bookmark-name-from-record - (bmkp-this-buffer-alist-only)))) - (bmks-deleted ()) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag)) ; Save at most once, after `dolist'. - bmk-pos) - (when (and msg-p bmks-to-delete (not (y-or-n-p (format "Delete ALL bookmarks in buffer `%s'? " - (buffer-name))))) - (error "Canceled - no bookmarks deleted")) - (cond (bmks-to-delete ; Delete all. - (dolist (bname bmks-to-delete) (bookmark-delete bname 'BATCHP)) ; No refresh yet. - (bmkp-refresh/rebuild-menu-list nil (not msg-p)) ; Now refresh, after iterate. - (when msg-p (message "Deleted all bookmarks in buffer `%s'" (buffer-name)))) - - (allp ; Requested ALLP, but there are none. (No-op if not interactive.) - (when msg-p (message "No bookmarks to delete in buffer `%s'" (buffer-name)))) - - (t ; Delete selected bookmarks at point. - (let (bname) - (dolist (bmk (or alist (bmkp-this-buffer-alist-only))) - (when (eq position (setq bmk-pos (bookmark-get-position bmk))) - (setq bname (bmkp-bookmark-name-from-record bmk)) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bname bmks-to-delete) - (setq bmks-to-delete (cons bname bmks-to-delete)))))) - (cond ((cadr bmks-to-delete) ; More than one at point. - (dolist (bname bmks-to-delete) - (when (or (not msg-p) (y-or-n-p (format "Delete bookmark `%s'? " bname))) - (bookmark-delete bname 'BATCHP) ; No refresh yet. - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bname bmks-deleted) - (setq bmks-deleted (cons bname bmks-deleted))))) - (bmkp-refresh/rebuild-menu-list nil (not msg-p)) ; Now refresh. - (when msg-p - (message (if bmks-deleted - (format "Deleted bookmarks: %s" - (mapconcat (lambda (bname) (format "`%s'" bname)) bmks-deleted - ", ")) - "No bookmarks deleted")))) - (bmks-to-delete ; Only one bookmark at point. - (bookmark-delete (car bmks-to-delete)) - (when msg-p (message "Deleted bookmark `%s'" (car bmks-to-delete)))) - (t - (when msg-p (message "No bookmarks at point to delete")))))))) - -;;;;;;;;;;;;;;;;;;;;;;; - -(provide 'bookmark+-1) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; bookmark+-1.el ends here diff --git a/.emacs.d/elisp/icicle/bookmark+-bmu.el b/.emacs.d/elisp/icicle/bookmark+-bmu.el deleted file mode 100644 index aff34a8..0000000 --- a/.emacs.d/elisp/icicle/bookmark+-bmu.el +++ /dev/null @@ -1,5326 +0,0 @@ -;;; bookmark+-bmu.el --- Bookmark+ code for the `*Bookmark List*' (bmenu). -;; -;; Filename: bookmark+-bmu.el -;; Description: Bookmark+ code for the `*Bookmark List*' (bmenu). -;; Author: Drew Adams, Thierry Volpiatto -;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") -;; Copyright (C) 2000-2012, Drew Adams, all rights reserved. -;; Copyright (C) 2009, Thierry Volpiatto, all rights reserved. -;; Created: Mon Jul 12 09:05:21 2010 (-0700) -;; Last-Updated: Sat May 5 14:55:00 2012 (-0700) -;; By: dradams -;; Update #: 2047 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-bmu.el -;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, info, url, w3m, gnus -;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x -;; -;; Features that might be required by this library: -;; -;; `bookmark', `bookmark+-mac', `pp'. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; This library contains code for buffer `*Bookmark List*' (mode -;; `bookmark-bmenu-mode'). -;; -;; The Bookmark+ libraries are these: -;; -;; `bookmark+.el' - main (driver) library -;; `bookmark+-mac.el' - Lisp macros -;; `bookmark+-lit.el' - (optional) code for highlighting bookmarks -;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (this file) -;; `bookmark+-1.el' - other required code (non-bmenu) -;; `bookmark+-key.el' - key and menu bindings -;; -;; `bookmark+-doc.el' - documentation (comment-only file) -;; `bookmark+-chg.el' - change log (comment-only file) -;; -;; The documentation (in `bookmark+-doc.el') includes how to -;; byte-compile and install Bookmark+. The documentation is also -;; available in these ways: -;; -;; 1. From the bookmark list (`C-x r l'): -;; Use `?' to show the current bookmark-list status and general -;; help, then click link `Doc in Commentary' or link `Doc on the -;; Web'. -;; -;; 2. From the Emacs-Wiki Web site: -;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus. -;; -;; 3. From the Bookmark+ group customization buffer: -;; `M-x customize-group bookmark-plus', then click link -;; `Commentary'. -;; -;; (The commentary links in #1 and #3 work only if you have library -;; `bookmark+-doc.el' in your `load-path'.) - -;;(@> "Index") -;; -;; Index -;; ----- -;; -;; If you have library `linkd.el' and Emacs 22 or later, load -;; `linkd.el' and turn on `linkd-mode' now. It lets you easily -;; navigate around the sections of this doc. Linkd mode will -;; highlight this Index, as well as the cross-references and section -;; headings throughout this file. You can get `linkd.el' here: -;; http://dto.freeshell.org/notebook/Linkd.html. -;; -;; (@> "Things Defined Here") -;; (@> "Faces (Customizable)") -;; (@> "User Options (Customizable)") -;; (@> "Internal Variables") -;; (@> "Compatibility Code for Older Emacs Versions") -;; (@> "Menu List Replacements (`bookmark-bmenu-*')") -;; (@> "Bookmark+ Functions (`bmkp-*')") -;; (@> "Menu-List (`*-bmenu-*') Filter Commands") -;; (@> "Menu-List (`*-bmenu-*') Commands Involving Marks") -;; (@> "Omitted Bookmarks") -;; (@> "Search-and-Replace Locations of Marked Bookmarks") -;; (@> "Tags") -;; (@> "General Menu-List (`-*bmenu-*') Commands and Functions") -;; (@> "Sorting - Commands") -;; (@> "Other Bookmark+ Functions (`bmkp-*')") -;; (@> "Keymaps") - -;;(@* "Things Defined Here") -;; -;; Things Defined Here -;; ------------------- -;; -;; Commands defined here: -;; -;; `bmkp-bmenu-add-tags', `bmkp-bmenu-add-tags-to-marked', -;; `bmkp-bmenu-change-sort-order', -;; `bmkp-bmenu-change-sort-order-repeat', `bmkp-bmenu-copy-tags', -;; `bmkp-bmenu-define-command', -;; `bmkp-bmenu-define-full-snapshot-command', -;; `bmkp-bmenu-define-jump-marked-command', -;; `bmkp-bmenu-delete-marked', `bmkp-bmenu-describe-marked', -;; `bmkp-bmenu-describe-this+move-down', -;; `bmkp-bmenu-describe-this+move-up', -;; `bmkp-bmenu-describe-this-bookmark',`bmkp-bmenu-dired-marked', -;; `bmkp-bmenu-edit-bookmark-name-and-file', `bmkp-edit-tags-send', -;; `bmkp-bmenu-filter-annotation-incrementally', -;; `bmkp-bmenu-filter-bookmark-name-incrementally', -;; `bmkp-bmenu-filter-file-name-incrementally', -;; `bmkp-bmenu-filter-tags-incrementally', -;; `bmkp-bmenu-flag-for-deletion', -;; `bmkp-bmenu-flag-for-deletion-backwards', -;; `bmkp-bmenu-isearch-marked-bookmarks' (Emacs 23+), -;; `bmkp-bmenu-isearch-marked-bookmarks-regexp' (Emacs 23+), -;; `bmkp-bmenu-make-sequence-from-marked', `bmkp-bmenu-mark-all', -;; `bmkp-bmenu-mark-autofile-bookmarks', -;; `bmkp-bmenu-mark-bookmark-file-bookmarks', -;; `bmkp-bmenu-mark-bookmarks-satisfying', -;; `bmkp-bmenu-mark-bookmarks-tagged-all', -;; `bmkp-bmenu-mark-bookmarks-tagged-none', -;; `bmkp-bmenu-mark-bookmarks-tagged-not-all', -;; `bmkp-bmenu-mark-bookmarks-tagged-regexp', -;; `bmkp-bmenu-mark-bookmarks-tagged-some', -;; `bmkp-bmenu-mark-desktop-bookmarks', -;; `bmkp-bmenu-mark-dired-bookmarks', -;; `bmkp-bmenu-mark-file-bookmarks', -;; `bmkp-bmenu-mark-gnus-bookmarks', -;; `bmkp-bmenu-mark-image-bookmarks', -;; `bmkp-bmenu-mark-info-bookmarks', -;; `bmkp-bmenu-mark-lighted-bookmarks', -;; `bmkp-bmenu-mark-man-bookmarks', -;; `bmkp-bmenu-mark-non-file-bookmarks', -;; `bmkp-bmenu-mark-orphaned-local-file-bookmarks', -;; `bmkp-bmenu-mark-region-bookmarks', -;; `bmkp-bmenu-mark-specific-buffer-bookmarks', -;; `bmkp-bmenu-mark-specific-file-bookmarks', -;; `bmkp-bmenu-mark-url-bookmarks', -;; `bmkp-bmenu-mark-variable-list-bookmarks', -;; `bmkp-bmenu-mark-w3m-bookmarks', `bmkp-bmenu-mouse-3-menu', -;; `bmkp-bmenu-mode-status-help', `bmkp-bmenu-omit', -;; `bmkp-bmenu-omit-marked', `bmkp-bmenu-omit/unomit-marked', -;; `bmkp-bmenu-paste-add-tags', -;; `bmkp-bmenu-paste-add-tags-to-marked', -;; `bmkp-bmenu-paste-replace-tags', -;; `bmkp-bmenu-paste-replace-tags-for-marked', -;; `bmkp-bmenu-query-replace-marked-bookmarks-regexp', -;; `bmkp-bmenu-quit', `bmkp-bmenu-refresh-menu-list', -;; `bmkp-bmenu-regexp-mark', `bookmark-bmenu-relocate' (Emacs 20, -;; 21), `bmkp-bmenu-remove-all-tags', `bmkp-bmenu-remove-tags', -;; `bmkp-bmenu-remove-tags-from-marked', -;; `bmkp-bmenu-search-marked-bookmarks-regexp', -;; `bmkp-bmenu-set-tag-value', -;; `bmkp-bmenu-set-tag-value-for-marked', `bmkp-bmenu-show-all', -;; `bmkp-bmenu-show-only-autofiles', -;; `bmkp-bmenu-show-only-autonamed.', -;; `bmkp-bmenu-show-only-bookmark-files', -;; `bmkp-bmenu-show-only-desktops', `bmkp-bmenu-show-only-dired', -;; `bmkp-bmenu-show-only-files', `bmkp-bmenu-show-only-gnus', -;; `bmkp-bmenu-show-only-image-files', -;; `bmkp-bmenu-show-only-info-nodes', -;; `bmkp-bmenu-show-only-man-pages', -;; `bmkp-bmenu-show-only-non-files', -;; `bmkp-bmenu-show-only-omitted', -;; `bmkp-bmenu-show-only-orphaned-local-files', -;; `bmkp-bmenu-show-only-regions', -;; `bmkp-bmenu-show-only-specific-buffer', -;; `bmkp-bmenu-show-only-specific-file', -;; `bmkp-bmenu-show-only-tagged', `bmkp-bmenu-show-only-urls', -;; `bmkp-bmenu-show-only-variable-lists', -;; `bmkp-bmenu-show-only-w3m-urls', -;; `bmkp-bmenu-sort-by-bookmark-name', -;; `bmkp-bmenu-sort-by-bookmark-visit-frequency', -;; `bmkp-bmenu-sort-by-bookmark-type', -;; `bmkp-bmenu-sort-by-creation-time', -;; `bmkp-bmenu-sort-by-file-name', -;; `bmkp-bmenu-sort-by-Gnus-thread', -;; `bmkp-bmenu-sort-by-Info-location', -;; `bmkp-bmenu-sort-by-last-bookmark-access', -;; `bmkp-bmenu-sort-by-last-buffer-or-file-access', -;; `bmkp-bmenu-sort-by-last-local-file-access', -;; `bmkp-bmenu-sort-by-last-local-file-update', -;; `bmkp-bmenu-sort-by-local-file-size', -;; `bmkp-bmenu-sort-by-local-file-type', `bmkp-bmenu-sort-by-url', -;; `bmkp-bmenu-sort-flagged-before-unflagged', -;; `bmkp-bmenu-sort-marked-before-unmarked', -;; `bmkp-bmenu-sort-modified-before-unmodified', -;; `bmkp-bmenu-sort-tagged-before-untagged', -;; `bmkp-bmenu-toggle-marked-temporary/savable', -;; `bmkp-bmenu-toggle-marks', `bmkp-bmenu-toggle-show-only-marked', -;; `bmkp-bmenu-toggle-show-only-unmarked', -;; `bmkp-bmenu-toggle-temporary', `bmkp-bmenu-unmark-all', -;; `bmkp-bmenu-unmark-bookmarks-tagged-all', -;; `bmkp-bmenu-unmark-bookmarks-tagged-none', -;; `bmkp-bmenu-unmark-bookmarks-tagged-not-all', -;; `bmkp-bmenu-unmark-bookmarks-tagged-regexp', -;; `bmkp-bmenu-unmark-bookmarks-tagged-some', -;; `bmkp-bmenu-unomit-marked', `bmkp-bmenu-w32-open', -;; `bmkp-bmenu-w32-open-select', `bmkp-bmenu-w32-open-with-mouse', -;; `bmkp-define-tags-sort-command'. -;; -;; Faces defined here: -;; -;; `bmkp-*-mark', `bmkp->-mark', `bmkp-a-mark', -;; `bmkp-bad-bookmark', `bmkp-bookmark-file', `bmkp-bookmark-list', -;; `bmkp-buffer', `bmkp-D-mark', `bmkp-desktop', -;; `bmkp-file-handler', `bmkp-function', `bmkp-gnus', -;; `bmkp-heading', `bmkp-info', `bmkp-local-directory', -;; `bmkp-local-file-with-region', `bmkp-local-file-without-region', -;; `bmkp-man', `bmkp-non-file', `bmkp-remote-file', -;; `bmkp-sequence', `bmkp-su-or-sudo', `bmkp-t-mark', `bmkp-url', -;; `bmkp-variable-list', `bmkp-X-mark'. -;; -;; User options defined here: -;; -;; `bmkp-bmenu-commands-file', -;; `bmkp-bmenu-image-bookmark-icon-file', -;; `bmkp-bmenu-omitted-bookmarks', `bmkp-bmenu-state-file', -;; `bmkp-propertize-bookmark-names-flag', `bmkp-sort-orders-alist', -;; `bmkp-sort-orders-for-cycling-alist'. -;; -;; Non-interactive functions defined here: -;; -;; `bmkp-bmenu-barf-if-not-in-menu-list', -;; `bmkp-bmenu-cancel-incremental-filtering', -;; `bmkp-bmenu-filter-alist-by-annotation-regexp', -;; `bmkp-bmenu-filter-alist-by-bookmark-name-regexp', -;; `bmkp-bmenu-filter-alist-by-file-name-regexp', -;; `bmkp-bmenu-filter-alist-by-tags-regexp', -;; `bmkp-bmenu-get-marked-files', `bmkp-bmenu-goto-bookmark-named', -;; `bmkp-bmenu-list-1', -;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none', -;; `bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all', -;; `bmkp-bmenu-propertize-item', `bmkp-bmenu-read-filter-input', -;; `bmkp-face-prop', `bmkp-maybe-unpropertize-bookmark-names', -;; `bmkp-reverse-multi-sort-order', `bmkp-reverse-sort-order'. -;; -;; Internal variables defined here: -;; -;; `bmkp-bmenu-before-hide-marked-alist', -;; `bmkp-bmenu-before-hide-unmarked-alist', -;; `bmkp-bmenu-define-command-menu', `bmkp-bmenu-filter-function', -;; `bmkp-bmenu-filter-pattern', `bmkp-bmenu-filter-prompt', -;; `bmkp-bmenu-filter-timer', `bmkp-bmenu-first-time-p', -;; `bmkp-flagged-bookmarks', `bmkp-bmenu-header-lines', -;; `bmkp-bmenu-highlight-menu', `bmkp-bmenu-line-overlay', -;; `bmkp-bmenu-mark-menu', `bmkp-bmenu-marked-bookmarks', -;; `bmkp-bmenu-marks-width', `bmkp-bmenu-menubar-menu', -;; `bmkp-bmenu-omit-menu', `bmkp-bmenu-show-menu', -;; `bmkp-bmenu-sort-menu', `bmkp-bmenu-tags-menu', -;; `bmkp-bmenu-title', `bmkp-last-bmenu-bookmark'. -;; -;; -;; ***** NOTE: The following commands defined in `bookmark.el' -;; have been REDEFINED HERE: -;; -;; `bookmark-bmenu-execute-deletions', `bookmark-bmenu-list', -;; `bookmark-bmenu-mark', `bookmark-bmenu-1-window', -;; `bookmark-bmenu-2-window', `bookmark-bmenu-other-window', -;; `bookmark-bmenu-other-window-with-mouse', -;; `bookmark-bmenu-rename', `bookmark-bmenu-show-annotation', -;; `bookmark-bmenu-switch-other-window', -;; `bookmark-bmenu-this-window', `bookmark-bmenu-toggle-filenames', -;; `bookmark-bmenu-unmark'. -;; -;; -;; ***** NOTE: The following non-interactive functions and macros -;; defined in `bookmark.el' have been REDEFINED HERE: -;; -;; `bookmark-bmenu-bookmark', `bookmark-bmenu-check-position', -;; `bookmark-bmenu-delete', `bookmark-bmenu-delete-backwards', -;; `bookmark-bmenu-ensure-position' (Emacs 23.2+), -;; `bookmark-bmenu-hide-filenames', `bookmark-bmenu-mode', -;; `bookmark-bmenu-show-filenames', -;; `bookmark-bmenu-surreptitiously-rebuild-list', -;; `bookmark-bmenu-switch-other-window', -;; `with-buffer-modified-unmodified' (Emacs < 23.2). -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -;;;;;;;;;;;;;;;;;;;;;;; - -(eval-when-compile (require 'cl)) ;; case (plus, for Emacs 20: dolist) -(eval-when-compile (require 'easymenu)) ;; easy-menu-create-menu - -(require 'bookmark) -;; bookmark-alist, bookmark-bmenu-file-column, -;; bookmark-bmenu-hidden-bookmarks, bookmark-bmenu-mode-map, -;; bookmark-bmenu-select, bookmark-get-annotation, -;; bookmark-get-filename, bookmark-get-handler, bookmark-kill-line, -;; bookmark-maybe-load-default-file, bookmark-name-from-full-record, -;; bookmark-name-from-record, bookmark-prop-get - - -;; Some general Renamings. -;; -;; 1. Fix incompatibility introduced by gratuitous Emacs name change. -;; -(cond ((and (fboundp 'bookmark-name-from-record) (not (fboundp 'bookmark-name-from-full-record))) - (defalias 'bookmark-name-from-full-record 'bookmark-name-from-record)) - ((and (fboundp 'bookmark-name-from-full-record) (not (fboundp 'bookmark-name-from-record))) - (defalias 'bookmark-name-from-record 'bookmark-name-from-full-record))) - -;; 2. The vanilla name of the first is misleading, as it returns only the cdr of the record. -;; The second is for consistency. -;; -(defalias 'bmkp-bookmark-data-from-record 'bookmark-get-bookmark-record) -(defalias 'bmkp-bookmark-name-from-record 'bookmark-name-from-full-record) - - -(require 'bookmark+-mac) ;; bmkp-define-sort-command, bmkp-with-output-to-plain-temp-buffer - -(put 'bmkp-with-output-to-plain-temp-buffer 'common-lisp-indent-function '(4 &body)) - -;; (eval-when-compile (require 'bookmark+-1)) -;; bmkp-add-tags, bmkp-alpha-p, bmkp-bookmark-creation-cp, -;; bmkp-bookmark-description, bmkp-bookmark-file-bookmark-p, -;; bmkp-bookmark-last-access-cp, bmkp-bookmark-list-bookmark-p, -;; bmkp-buffer-last-access-cp, bmkp-completing-read-buffer-name, -;; bmkp-completing-read-file-name, bmkp-current-bookmark-file, -;; bmkp-current-sort-order, bmkp-describe-bookmark, -;; bmkp-describe-bookmark-internals, bmkp-desktop-bookmark-p, -;; bmkp-edit-bookmark-name-and-file, bmkp-file-alpha-cp, -;; bmkp-file-remote-p, bmkp-function-bookmark-p, -;; bookmark-get-bookmark, bmkp-get-buffer-name, bmkp-get-tags, -;; bmkp-gnus-bookmark-p, bmkp-gnus-cp, bmkp-handler-cp, -;; bmkp-incremental-filter-delay, bmkp-image-bookmark-p, -;; bmkp-info-bookmark-p, bmkp-info-cp, bmkp-isearch-bookmarks, -;; bmkp-isearch-bookmarks-regexp, bmkp-jump-1, -;; bmkp-last-bookmark-file, bmkp-last-specific-buffer, -;; bmkp-last-specific-file, bmkp-latest-bookmark-alist, -;; bmkp-local-file-bookmark-p, bmkp-local-file-type-cp, -;; bmkp-local-file-accessed-more-recently-cp, -;; bmkp-local-file-updated-more-recently-cp, bmkp-man-bookmark-p, -;; bmkp-marked-bookmark-p, bmkp-marked-bookmarks-only, bmkp-marked-cp, -;; bmkp-msg-about-sort-order, bmkp-non-file-filename, -;; bmkp-read-tag-completing, bmkp-read-tags-completing, -;; bmkp-refresh-menu-list, bmkp-region-bookmark-p, -;; bmkp-remove-all-tags, bmkp-remove-if, bmkp-remove-tags, -;; bmkp-repeat-command, bmkp-reverse-multi-sort-p, -;; bmkp-reverse-sort-p, bmkp-root-or-sudo-logged-p, bmkp-same-file-p, -;; bmkp-save-menu-list-state, bmkp-sequence-bookmark-p, -;; bmkp-set-tag-value, bmkp-set-tag-value-for-bookmarks, -;; bmkp-set-union, bmkp-some, bmkp-some-marked-p, -;; bmkp-some-unmarked-p, bmkp-sort-omit, bmkp-sort-comparer, -;; bmkp-sorted-alist, bmkp-su-or-sudo-regexp, bmkp-tag-name, -;; bmkp-tags-list, bmkp-url-bookmark-p, bmkp-url-cp, -;; bmkp-unmarked-bookmarks-only, bmkp-variable-list-bookmark-p, -;; bmkp-visited-more-cp, bookmark-store - -;; (eval-when-compile (require 'bookmark+-lit nil t)) -;; bmkp-get-lighting - -;;;;;;;;;;;;;;;;;;;;;;; - -;; Quiet the byte-compiler -(defvar dired-re-mark) ; In `dired.el'. -(defvar tramp-file-name-regexp) ; In `tramp.el'. - -(defvar bmkp-edit-bookmark-orig-record) ; In `bookmark+-1.el'. -(defvar bmkp-edit-bookmark-records-number) ; In `bookmark+-1.el'. -(defvar bmkp-temporary-bookmarking-mode) ; In `bookmark+-1.el'. - - -;;(@* "Faces (Customizable)") -;;; Faces (Customizable) --------------------------------------------- - -(defgroup bookmark-plus nil - "Bookmark enhancements." - :prefix "bmkp-" :group 'bookmark - :link `(url-link :tag "Send Bug Report" - ,(concat "mailto:" "drew.adams" "@" "oracle" ".com?subject=\ -Bookmark+ bug: \ -&body=Describe bug here, starting with `emacs -Q'. \ -Don't forget to mention your Emacs and library versions.")) - :link '(url-link :tag "Download" "http://www.emacswiki.org/bookmark+.el") - :link '(url-link :tag "Description" "http://www.emacswiki.org/BookmarkPlus") - :link '(emacs-commentary-link :tag "Commentary" "bookmark+")) - -(defface bmkp->-mark '((((background dark)) (:foreground "Yellow")) - (t (:foreground "Blue"))) - ;; (:foreground "Magenta2" :box (:line-width 1 :style pressed-button)))) - "*Face used for a `>' mark in the bookmark list." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-a-mark '((((background dark)) (:background "SaddleBrown")) - (t (:background "SkyBlue"))) - "*Face used for an annotation indicator (`a') in the bookmark list." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-bad-bookmark '((t (:foreground "Red" :background "Chartreuse1"))) - "*Face used for a bookmark that seems to be bad: e.g., nonexistent file." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-bookmark-file - '((((background dark)) - (:foreground "#00005A5AFFFF" :background "#FFFF9B9BFFFF")) ; ~ blue, ~ pink - (t (:foreground "Orange" :background "DarkGreen"))) - "*Face used for a bookmark-file bookmark." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-bookmark-list - '((((background dark)) (:foreground "#7474FFFFFFFF" :background "DimGray")) ; ~ cyan - (t (:foreground "DarkRed" :background "LightGray"))) - "*Face used for a bookmark-list bookmark." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-buffer - '((((background dark)) (:foreground "#FFFF9B9BFFFF")) ; ~ pink - (t (:foreground "DarkGreen"))) - "*Face used for a bookmarked existing buffer not associated with a file." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-D-mark '((t (:foreground "Yellow" :background "Red"))) - "*Face used for a deletion mark (`D') in the bookmark list." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-desktop - '((((background dark)) (:foreground "Orange" :background "DarkSlateBlue")) - (t (:foreground "DarkBlue" :background "PaleGoldenrod"))) - "*Face used for a bookmarked desktop." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-file-handler - '((((background dark)) (:background "#272740402727")) ; ~ dark green - (t (:background "Thistle"))) - "*Face used for a bookmark that has a `file-handler' attribute." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-function - '((((background dark)) (:foreground "#0000EBEB6C6C")) ; ~ green - (t (:foreground "DeepPink1"))) - "*Face used for a function bookmark: a bookmark that invokes a function." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-gnus - '((((background dark)) (:foreground "Gold")) - (t (:foreground "DarkBlue"))) - "*Face used for a Gnus bookmark." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-info - '((((background dark)) (:foreground "#7474FFFFFFFF")) ; ~ light cyan - (t (:foreground "DarkRed"))) - "*Face used for a bookmarked Info node." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-local-directory - '((((background dark)) - (:foreground "Pink" :background "DarkBlue")) - (t (:foreground "DarkBlue" :background "HoneyDew2"))) - "*Face used for a bookmarked local directory." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-local-file-without-region - '((((background dark)) (:foreground "White")) - (t (:foreground "Black"))) - "*Face used for a bookmarked local file (without a region)." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-local-file-with-region - '((((background dark)) (:foreground "Yellow")) - (t (:foreground "Blue"))) - "*Face used for a region bookmark in a local file." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-man - '((((background dark)) (:foreground "Orchid")) - (t (:foreground "Orange4"))) - "*Face used for a `man' page bookmark." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-*-mark '((t (:foreground "Red" :background "Yellow"))) - "*Face used for a modification mark (`*') in the bookmark list." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-non-file - '((t (:foreground "gray60"))) - "*Face used for a bookmark not associated with an existing file or buffer." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-remote-file - '((((background dark)) (:foreground "#6B6BFFFF2C2C")) ; ~ green - (t (:foreground "DarkViolet"))) - "*Face used for a bookmarked tramp remote file (/ssh:)." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-sequence - '((((background dark)) (:foreground "DeepSkyBlue")) - (t (:foreground "DarkOrange2"))) - "*Face used for a sequence bookmark: one composed of other bookmarks." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-su-or-sudo '((t (:foreground "Red"))) - "*Face used for a bookmarked tramp file (/su: or /sudo:)." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-t-mark '((((background dark)) (:foreground "Magenta")) - (t (:foreground "#000093F402A2"))) ; a medium green - "*Face used for a tags mark (`t') in the bookmark list." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-url - '((((background dark)) (:foreground "#7474FFFF7474")) ; ~ green - (t (:foreground "DarkMagenta"))) - "*Face used for a bookmarked URL." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-variable-list - '((((background dark)) (:foreground "#FFFF74747474")) ; ~ salmon - (t (:foreground "DarkCyan"))) - "*Face used for a bookmarked list of variables." - :group 'bookmark-plus :group 'faces) - -(defface bmkp-X-mark '((t (:foreground "Red"))) - "*Face used for a temporary-bookmark indicator (`X') in the bookmark list." - :group 'bookmark-plus :group 'faces) - -;; $$$$$$ Not used now - using `bmkp-url' instead. -;; (defface bmkp-w3m -;; '((((background dark)) (:foreground "yellow")) -;; (t (:foreground "DarkMagenta"))) -;; "*Face used for a bookmarked w3m url." -;; :group 'bookmark-plus :group 'faces) - -;; Instead of vanilla `bookmark-menu-heading' (defined in Emacs 22+), to use a better default. -(defface bmkp-heading '((((background dark)) (:foreground "Yellow")) - (t (:foreground "Blue"))) - "*Face used to highlight the headings in various Bookmark+ buffers." - :group 'bookmark-plus :version "22.1" :group 'faces) - -;;(@* "User Options (Customizable)") -;;; User Options (Customizable) -------------------------------------- - -;;;###autoload -(defcustom bmkp-bmenu-omitted-bookmarks () - "*List of names of omitted bookmarks. -They are generally not available for display in the bookmark list. -You can, however, use \\\ -`\\[bmkp-bmenu-show-only-omitted]' to see them. -You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]' - to make those that are marked available again for the bookmark list." - ;; $$$$$$ TODO: Create a customize :type `bookmark-name' - ;; and provide completion for filling out the field. - :type '(repeat (string :tag "Bookmark name")) :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-bmenu-commands-file (convert-standard-filename "~/.emacs-bmk-bmenu-commands.el") - "*File for saving user-defined bookmark-list commands. -This must be an absolute file name (possibly containing `~') or nil -\(it is not expanded). - -You can use `\\[bmkp-list-defuns-in-commands-file]' to list the -commands defined in the file and how many times each is defined. - -NOTE: Each time you define a command using \\\ -`\\[bmkp-bmenu-define-command]', `\\[bmkp-bmenu-define-full-snapshot-command]', \ -`\\[bmkp-bmenu-define-jump-marked-command], or `\\[bmkp-define-tags-sort-command]', -it is saved in the file. The new definition is simply appended to the -file - old definitions of the same command are not overwritten. So -you might want to clean up the file occasionally, to remove any old, -unused definitions. This is especially advisable if you used \ -`\\[bmkp-bmenu-define-full-snapshot-command]', -because such command definitions can be very large." - :type '(file :tag "File for saving menu-list state") :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-bmenu-state-file (convert-standard-filename "~/.emacs-bmk-bmenu-state.el") - "*File for saving `*Bookmark List*' state when you quit bookmark list. -This must be an absolute file name (possibly containing `~') or nil -\(it is not expanded). - -The state is also saved when you quit Emacs, even if you don't quit -the bookmark list first (using \\`\\[bmkp-bmenu-quit]'). - -Set this to nil if you do not want to restore the bookmark list as it -was the last time you used it." - :type '(choice - (const :tag "Do not save and restore menu-list state" nil) - (file :tag "File for saving menu-list state")) - :group 'bookmark-plus) - -;;;###autoload -(defcustom bmkp-bmenu-image-bookmark-icon-file - (and (fboundp 'display-images-p) (display-images-p) - (let ((bmk-img (convert-standard-filename "~/.emacs-bmk-bmenu-image-file-icon.png")) - (emacs-img (convert-standard-filename - (concat data-directory "images/gnus/exit-gnus.xpm")))) - (or (and (file-readable-p bmk-img) bmk-img) - (and (file-readable-p emacs-img) emacs-img)))) - "*Iconic image file to show next to image-file bookmarks. -If nil, show no image. Otherwise, this is an absolute file name, -possibly containing `~', (the value is not expanded). - -Use any image file that Emacs can display, but you probably want to -use a small, iconic image - say 16x16 pixels. - -The default image, which you are sure to have in any Emacs version -that supports images, is 24x24 pixels. That wastes vertical space, so -you probably want to use something smaller. - -If you don't have another image that you prefer, try this one (16x16): -http://www.emacswiki.org/emacs/BookmarkPlusImageFileDefaultIcon" - :type '(choice - (file :tag "Use iconic image file") - (const :tag "Show no image")) - :group 'bookmark-plus) - -;; This is a general option. It is in this file because it is used mainly by the bmenu code. -(when (> emacs-major-version 20) - (defcustom bmkp-sort-orders-alist () - "*Alist of all available sort functions. -This is a pseudo option - you probably do NOT want to customize this. -Instead: - - * To add a new sort function to this list, use macro - `bmkp-define-sort-command'. It defines a new sort function - and automatically adds it to this list. - - * To have fewer sort orders available for cycling by \\\ -`\\[bmkp-bmenu-change-sort-order-repeat]'..., - customize option `bmkp-sort-orders-for-cycling-alist'. - -Each alist element has the form (SORT-ORDER . COMPARER): - - SORT-ORDER is a short string or symbol describing the sort order. - Examples: \"by last access time\", \"by bookmark name\". - - COMPARER compares two bookmarks. It must be acceptable as a value of - `bmkp-sort-comparer'." - :type '(alist - :key-type (choice :tag "Sort order" string symbol) - :value-type (choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate"))))) - :group 'bookmark-plus)) - -(unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist. - (defcustom bmkp-sort-orders-alist () - "*Alist of all available sort functions. -This is a pseudo option - you probably do NOT want to customize this. -Instead: - - * To add a new sort function to this list, use macro - `bmkp-define-sort-command'. It defines a new sort function - and automatically adds it to this list. - - * To have fewer sort orders available for cycling by \\\ -`\\[bmkp-bmenu-change-sort-order-repeat]'..., - customize option `bmkp-sort-orders-for-cycling-alist'. - -Each alist element has the form (SORT-ORDER . COMPARER): - - SORT-ORDER is a short string or symbol describing the sort order. - Examples: \"by last access time\", \"by bookmark name\". - - COMPARER compares two bookmarks. It must be acceptable as a value of - `bmkp-sort-comparer'." - :type '(repeat - (cons - (choice :tag "Sort order" string symbol) - (choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate")))))) - :group 'bookmark-plus)) - -(defcustom bmkp-propertize-bookmark-names-flag (> emacs-major-version 20) - "*Non-nil means to propertize bookmark names to hold full bookmark data. -This means that you can effectively have more than one bookmark with -the same name. - -Emacs 20 users: If you need to use your bookmarks with Emacs 20 then -set this to nil. In particular, if your bookmark file was written -with this as non-nil, then it contains propertized strings which are -unreadable by Emacs 20. To convert the file to be usable with Emacs -20 you must, in Emacs 21 or later, set this to nil and then do `M-x -bookmark-save'." - :type 'boolean :group 'bookmark-plus) - -;;(@* "Internal Variables") -;;; Internal Variables ----------------------------------------------- - -(defconst bmkp-bmenu-header-lines 5 - "Number of lines used for the `*Bookmark List*' header.") - -(defconst bmkp-bmenu-marks-width 4 - "Number of columns (chars) used for the `*Bookmark List*' marks columns. -Bookmark names thus begin in this column number (since zero-based).") - - -(defvar bmkp-bmenu-before-hide-marked-alist () - "Copy of `bookmark-alist' made before hiding marked bookmarks.") - -(defvar bmkp-bmenu-before-hide-unmarked-alist () - "Copy of `bookmark-alist' made before hiding unmarked bookmarks.") - -(defvar bmkp-bmenu-filter-function nil "Latest filtering function for `*Bookmark List*' display.") - -(defvar bmkp-bmenu-filter-pattern "" "Regexp for incremental filtering.") - -(defvar bmkp-bmenu-filter-prompt "Pattern: " "Prompt for `bmkp-bmenu-filter-incrementally'.") - -(defvar bmkp-bmenu-filter-timer nil "Timer used for incremental filtering.") - -(defvar bmkp-bmenu-first-time-p t - "Non-nil means bookmark list has not yet been shown after quitting it. -Quitting the list or the Emacs session resets this to t. -The first time the list is displayed, it is set to nil.") - -(defvar bmkp-flagged-bookmarks () - "Alist of bookmarks that are flagged for deletion in `*Bookmark List*'.") - -(defvar bmkp-bmenu-marked-bookmarks () - "Names of the marked bookmarks. -This includes possibly omitted bookmarks, that is, bookmarks listed in -`bmkp-bmenu-omitted-bookmarks'.") - -(defvar bmkp-bmenu-title "" "Latest title for `*Bookmark List*' display.") - -;; This is a general variable. It is in this file because it is used only in the bmenu code. -(defvar bmkp-last-bmenu-bookmark nil "The name of the last bookmark current in the bookmark list.") - -;;(@* "Compatibility Code for Older Emacs Versions") -;;; Compatibility Code for Older Emacs Versions ---------------------- - -(when (or (< emacs-major-version 23) (and (= emacs-major-version 23) (= emacs-minor-version 1))) - (defmacro with-buffer-modified-unmodified (&rest body) - "Save and restore `buffer-modified-p' state around BODY." - (let ((was-modified (make-symbol "was-modified"))) - `(let ((,was-modified (buffer-modified-p))) - (unwind-protect (progn ,@body) - (set-buffer-modified-p ,was-modified)))))) - -(when (< emacs-major-version 22) - (defun bookmark-bmenu-relocate () - "Change the file path of the bookmark on the current line, -prompting with completion for the new path." - (interactive) - (let ((bmk (bookmark-bmenu-bookmark)) - (thispoint (point))) - (bookmark-relocate bmk) - (goto-char thispoint)))) - -;;(@* "Menu List Replacements (`bookmark-bmenu-*')") -;;; Menu List Replacements (`bookmark-bmenu-*') ---------------------- - - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Return t. Value doesn't mean anything (didn't anyway), but must be non-nil for vanilla Emacs. -;; 2. Do not count lines. Just make sure we're on a bookmark line. -;; -(defalias 'bookmark-bmenu-check-position 'bookmark-bmenu-ensure-position) -(defun bookmark-bmenu-ensure-position () - "Move to the beginning of the nearest bookmark line." - (beginning-of-line) - (unless (bookmark-bmenu-bookmark) - (if (and (bolp) (eobp)) - (beginning-of-line 0) - (goto-char (point-min)) - (forward-line bmkp-bmenu-header-lines))) - t) ; Older vanilla bookmark code depends on non-nil value. - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Add bookmark to `bmkp-bmenu-marked-bookmarks'. Delete it from `bmkp-flagged-bookmarks'. -;; 2. Don't call `bookmark-bmenu-ensure-position' again at end. -;; 3. Raise error if not in `*Bookmark List*'. -;; 4. Narrower scope for `with-buffer-modified-unmodified' and `let'. -;; 5. If current sort is `s >' (marked first or last), and it was unmarked before, then re-sort. -;; 6. Added optional arg NO-RE-SORT-P to inhibit #5. -;; 7. Added optional arg MSG-P. -;; -;;;###autoload -(defun bookmark-bmenu-mark (&optional no-re-sort-p msg-p) ; Bound to `m' in bookmark list - "Mark the bookmark on this line, using mark `>'. -Add its name to `bmkp-bmenu-marked-bookmarks', after propertizing it -with the full bookmark as `bmkp-full-record'. - -If the bookmark was unmarked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive (list nil 'MSG-P)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (beginning-of-line) - (with-buffer-modified-unmodified - (let ((inhibit-read-only t)) - (delete-char 1) (insert ?>) (put-text-property (1- (point)) (point) 'face 'bmkp->-mark))) - (let* ((bname (bookmark-bmenu-bookmark)) - (bmk (bmkp-bookmark-record-from-name bname)) - (was-unmarked-p nil)) - ;; Put full bookmark on BNAME as property `bmkp-full-record'. - (put-text-property 0 (length bname) 'bmkp-full-record bmk bname) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (unless (memq bname bmkp-bmenu-marked-bookmarks) - (setq bmkp-bmenu-marked-bookmarks (cons bname bmkp-bmenu-marked-bookmarks) - was-unmarked-p t)) - (setq bmkp-flagged-bookmarks (delq bmk bmkp-flagged-bookmarks)) - (unless no-re-sort-p - ;; If it was unmarked but now is marked, and if sort order is `s >', then re-sort. - (when (and was-unmarked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p)) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))) - (forward-line 1)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Remove bookmark from `bmkp-bmenu-marked-bookmarks' and `bmkp-flagged-bookmarks'. -;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'. -;; 3. Don't call `bookmark-bmenu-ensure-position' again at end. -;; 4. Raise error if not in `*Bookmark List*'. -;; 5. Narrower scope for `with-buffer-modified-unmodified' and `let'. -;; 6. If current sort is `s >' (marked first or last), and it was marked before, then re-sort. -;; 7. Added optional arg NO-RE-SORT-P to inhibit #6. -;; 8. Added optional arg MSG-P. -;; -;;;###autoload -(defun bookmark-bmenu-unmark (&optional backup no-re-sort-p msg-p) ; Bound to `u' in bookmark list - "Unmark the bookmark on this line, then move down to the next. -With a prefix argument, move up instead. - -If the bookmark was marked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil optional arg BACKUP (prefix arg) means move up. -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive (list current-prefix-arg nil 'MSG-P)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (beginning-of-line) - (with-buffer-modified-unmodified - (let ((inhibit-read-only t)) - (delete-char 1) (insert " "))) - (let ((was-marked-p (memq (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks))) - (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list - (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks) - bmkp-flagged-bookmarks (delq (bmkp-bookmark-record-from-name (bookmark-bmenu-bookmark)) - bmkp-flagged-bookmarks)) - (unless no-re-sort-p - ;; If it was marked but now is unmarked, and if sort order is `s >', then re-sort. - (when (and was-marked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list (not msg-p)) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))))) - (forward-line (if backup -1 1))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Do not use `bookmark-bmenu-ensure-position' as a test - it always returns non-nil anyway. -;; And don't call it again the end. -;; 2. Use `bmkp-delete-bookmark-name-from-list', not `delete'. -;; 3. Use face `bmkp-D-mark' on the `D' flag. -;; 4. Raise error if not in buffer `*Bookmark List*'. -;; 5. Remove bookmark from `bmkp-bmenu-marked-bookmarks'. Add it to `bmkp-flagged-bookmarks'. -;; -;;;###autoload -(defalias 'bmkp-bmenu-flag-for-deletion 'bookmark-bmenu-delete) ; A better name. -;;;###autoload -(defun bookmark-bmenu-delete () ; Bound to `d', `k' in bookmark list - "Flag this bookmark for deletion, using mark `D'. -Use `\\\\[bookmark-bmenu-execute-deletions]' to carry out \ -the deletions." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (beginning-of-line) - (bookmark-bmenu-ensure-position) - (with-buffer-modified-unmodified - (let ((inhibit-read-only t)) - (delete-char 1) (insert ?D) (put-text-property (1- (point)) (point) 'face 'bmkp-D-mark))) - (when (bookmark-bmenu-bookmark) ; Should never be nil, but just to be safe. - (setq bmkp-bmenu-marked-bookmarks (bmkp-delete-bookmark-name-from-list - (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks)) - ;; This is the same as `add-to-list' with `EQ' (not available for Emacs 20-21). - (let ((bmk (bmkp-bookmark-record-from-name (bookmark-bmenu-bookmark)))) - (unless (memq bmk bmkp-flagged-bookmarks) - (setq bmkp-flagged-bookmarks (cons bmk bmkp-flagged-bookmarks))))) - (forward-line 1)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Do not move forward another line at end. Leave point above flagged bookmark. -;; -;;;###autoload -(defalias 'bmkp-bmenu-flag-for-deletion-backwards 'bookmark-bmenu-delete-backwards) ; A better name. -;;;###autoload -(defun bookmark-bmenu-delete-backwards () - "Mark bookmark on this line to be deleted, then move up one line. -To carry out the deletions that you've marked, use \\\ -\\[bookmark-bmenu-execute-deletions]." - (interactive) - (bookmark-bmenu-delete) - (forward-line -2) - (bookmark-bmenu-ensure-position)) - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg NO-MSG-P. -;; 2. Rebuild the menu list using the last filtered alist in use, `bmkp-latest-bookmark-alist'. -;; 3. Update the menu-list title. -;; -(defun bookmark-bmenu-surreptitiously-rebuild-list (&optional no-msg-p) - "Rebuild the bookmark list, if it exists. -Non-nil optional arg NO-MSG-P means do not show progress messages." - (when (get-buffer "*Bookmark List*") - (unless no-msg-p (message "Updating bookmark-list display...")) - (save-excursion (save-window-excursion (let ((bookmark-alist bmkp-latest-bookmark-alist)) - (bookmark-bmenu-list 'filteredp)))) - (unless no-msg-p (message "Updating bookmark-list display...done")))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added arg FILTEREDP. -;; 2. Handles also region bookmarks and buffer (non-file) bookmarks. -;; 3. Uses `pop-to-buffer', not `switch-to-buffer', so we respect `special-display-*' -;; (but keep `one-window-p' if that's the case). -;; 4. If option `bmkp-bmenu-state-file' is non-nil, then the first time since the last quit -;; (or the last Emacs session) restores the last menu-list state. -;; 5. If option `bmkp-bmenu-commands-file' is non-nil, then read that file, which contains -;; user-defined `*Bookmark List*' commands. -;; 6. Many differences in the display itself - see the doc. -;; -;;;###autoload -(defalias 'list-bookmarks 'bookmark-bmenu-list) -;;;###autoload -(defun bookmark-bmenu-list (&optional filteredp msg-p) ; Bound to `C-x p e', `C-x r l' - "Display a list of existing bookmarks, in buffer `*Bookmark List*'. -The leftmost column of a bookmark entry shows `D' if the bookmark is - flagged for deletion, or `>' if it is marked normally. -The second column shows `t' if the bookmark has tags. -The third column shows `a' if the bookmark has an annotation. - -The following faces are used for the list entries. -Use `customize-face' if you want to change the appearance. - - `bmkp-bad-bookmark', `bmkp-bookmark-list', `bmkp-buffer', - `bmkp-desktop', `bmkp-file-handler', `bmkp-function', `bmkp-gnus', - `bmkp-info', `bmkp-local-directory', - `bmkp-local-file-without-region', `bmkp-local-file-with-region', - `bmkp-man', `bmkp-non-file', `bmkp-remote-file', `bmkp-sequence', - `bmkp-su-or-sudo', `bmkp-url', `bmkp-variable-list'. - -If option `bmkp-bmenu-state-file' is non-nil then the state of the -displayed bookmark-list is saved when you quit it, and it is restored -when you next use this command. That saved state is not restored, -however, if it represents a different file from the current bookmark -file. - -If you call this interactively when buffer `*Bookmark List*' exists, -that buffer is refreshed to show all current bookmarks, and any -markings are removed. If you instead want to show the buffer in its -latest state then just do that: use `C-x b' or similar. If you want -to refresh the displayed buffer, to show the latest state, reflecting -any additions, deletions, renamings, and so on, use \\\ -`\\[bmkp-bmenu-refresh-menu-list]'. - - -Non-interactively: - - - Non-nil optional argument FILTEREDP means the bookmark list has - been filtered, which means: - - * Use `bmkp-bmenu-title' not the default menu-list title. - * Do not reset `bmkp-latest-bookmark-alist' to `bookmark-alist'. - - - Non-nil optional arg MSG-P means display progress messages. - -In Lisp code, non-nil optional argument FILTEREDP means the bookmark -list has been filtered, which means: - * Use `bmkp-bmenu-title' not the default menu-list title. - * Do not reset `bmkp-latest-bookmark-alist' to `bookmark-alist'." - (interactive "i\np") - (bookmark-maybe-load-default-file) - (when msg-p (message "Gathering bookmarks to display...")) - (when (and bmkp-bmenu-first-time-p bmkp-bmenu-commands-file - (file-readable-p bmkp-bmenu-commands-file)) - (with-current-buffer (let ((enable-local-variables ()) - (emacs-lisp-mode-hook nil)) - (find-file-noselect bmkp-bmenu-commands-file)) - (goto-char (point-min)) - (while (not (eobp)) (condition-case nil (eval (read (current-buffer))) (error nil))) - (kill-buffer (current-buffer)))) - (cond ((and bmkp-bmenu-first-time-p bmkp-bmenu-state-file ; Restore from state file. - (file-readable-p bmkp-bmenu-state-file)) - (let ((state ())) - (with-current-buffer (let ((enable-local-variables nil) - (emacs-lisp-mode-hook nil)) - (find-file-noselect bmkp-bmenu-state-file)) - (goto-char (point-min)) - (setq state (condition-case nil (read (current-buffer)) (error nil))) - (kill-buffer (current-buffer))) - (let ((last-bookmark-file-from-state (cdr (assq 'last-bookmark-file state)))) - (when (and (consp state) - ;; If bookmark file has changed, then do not use state saved from other file. - (or (not last-bookmark-file-from-state) - (bmkp-same-file-p last-bookmark-file-from-state - bmkp-current-bookmark-file))) - (setq bmkp-sort-comparer (cdr (assq 'last-sort-comparer state)) - bmkp-reverse-sort-p (cdr (assq 'last-reverse-sort-p state)) - bmkp-reverse-multi-sort-p (cdr (assq 'last-reverse-multi-sort-p state)) - bmkp-latest-bookmark-alist (cdr (assq 'last-latest-bookmark-alist state)) - bmkp-bmenu-omitted-bookmarks (cdr (assq 'last-bmenu-omitted-bookmarks state)) - bmkp-bmenu-marked-bookmarks (cdr (assq 'last-bmenu-marked-bookmarks state)) - bmkp-bmenu-filter-function (cdr (assq 'last-bmenu-filter-function state)) - bmkp-bmenu-filter-pattern - (or (cdr (assq 'last-bmenu-filter-pattern state)) "") - bmkp-bmenu-title (cdr (assq 'last-bmenu-title state)) - bmkp-last-bmenu-bookmark (cdr (assq 'last-bmenu-bookmark state)) - bmkp-last-specific-buffer (cdr (assq 'last-specific-buffer state)) - bmkp-last-specific-file (cdr (assq 'last-specific-file state)) - bookmark-bmenu-toggle-filenames (cdr (assq 'last-bmenu-toggle-filenames state)) - bmkp-last-bookmark-file bmkp-current-bookmark-file - bmkp-current-bookmark-file last-bookmark-file-from-state - bmkp-bmenu-before-hide-marked-alist - (cdr (assq 'last-bmenu-before-hide-marked-alist state)) - bmkp-bmenu-before-hide-unmarked-alist - (cdr (assq 'last-bmenu-before-hide-unmarked-alist state)))))) - (setq bmkp-bmenu-first-time-p nil) - (let ((bookmark-alist (or bmkp-latest-bookmark-alist bookmark-alist))) - (bmkp-bmenu-list-1 'filteredp nil msg-p)) - ;; Propertize bookmark names if not already propertized (lists saved with Emacs 20 or - ;; not `bmkp-propertize-bookmark-names-flag'). Check only the first to guess propertized. - (when (and (consp bmkp-bmenu-marked-bookmarks) - (not (get-text-property 0 'bmkp-full-record (car bmkp-bmenu-marked-bookmarks)))) - (setq bmkp-bmenu-marked-bookmarks - (condition-case nil - (mapcar (lambda (bname) - (if (get-text-property 0 'bmkp-full-record bname) - bname - (put-text-property 0 (length bname) 'bmkp-full-record - (bmkp-bookmark-record-from-name bname) bname) - bname)) - bmkp-bmenu-marked-bookmarks) - (error ())))) ; Reset to () if any name is not a current bookmark. - (when (and (consp bmkp-bmenu-omitted-bookmarks) - (not (get-text-property 0 'bmkp-full-record (car bmkp-bmenu-omitted-bookmarks)))) - (setq bmkp-bmenu-omitted-bookmarks - (condition-case nil - (mapcar (lambda (bname) - (if (get-text-property 0 'bmkp-full-record bname) - bname - (put-text-property 0 (length bname) 'bmkp-full-record - (bmkp-bookmark-record-from-name bname) bname) - bname)) - bmkp-bmenu-omitted-bookmarks) - (error ())))) ; Reset to () if any name is not a current bookmark. - (when bmkp-last-bmenu-bookmark - (with-current-buffer (get-buffer "*Bookmark List*") - (bmkp-bmenu-goto-bookmark-named bmkp-last-bmenu-bookmark)))) - (t - (setq bmkp-bmenu-first-time-p nil) - (bmkp-bmenu-list-1 filteredp (or msg-p (not (get-buffer "*Bookmark List*"))) msg-p)))) - -(defun bmkp-bmenu-list-1 (filteredp reset-p interactivep) - "Helper for `bookmark-bmenu-list'. -See `bookmark-bmenu-list' for the description of FILTEREDP. -Reset `bmkp-modified-bookmarks' and `bmkp-flagged-bookmarks'. -Non-nil RESET-P means reset `bmkp-bmenu-marked-bookmarks' also. -Non-nil INTERACTIVEP means `bookmark-bmenu-list' was called - interactively, so pop to the bookmark list and communicate the sort - order." - (setq bmkp-modified-bookmarks () - bmkp-flagged-bookmarks ()) - (when reset-p (setq bmkp-bmenu-marked-bookmarks ())) - (unless filteredp (setq bmkp-latest-bookmark-alist bookmark-alist)) - (if interactivep - (let ((one-win-p (one-window-p))) - (pop-to-buffer (get-buffer-create "*Bookmark List*")) - (when one-win-p (delete-other-windows))) - (set-buffer (get-buffer-create "*Bookmark List*"))) - (let* ((inhibit-read-only t) - (title (if (and filteredp bmkp-bmenu-title (not (equal "" bmkp-bmenu-title))) - bmkp-bmenu-title - "All Bookmarks")) - (show-image-file-icon-p (and (fboundp 'display-images-p) (display-images-p) - bmkp-bmenu-image-bookmark-icon-file - (file-readable-p bmkp-bmenu-image-bookmark-icon-file)))) - (erase-buffer) - (when (fboundp 'remove-images) (remove-images (point-min) (point-max))) - (insert (format "%s\n%s\n" title (make-string (length title) ?-))) - (add-text-properties (point-min) (point) (bmkp-face-prop 'bmkp-heading)) - (goto-char (point-min)) - (insert (format "Bookmark file:\n%s\n\n" bmkp-current-bookmark-file)) - (forward-line bmkp-bmenu-header-lines) - (let ((max-width 0) - name markedp flaggedp tags annotation temporaryp start) - (setq bmkp-sorted-alist (bmkp-sort-omit bookmark-alist - (and (not (eq bmkp-bmenu-filter-function - 'bmkp-omitted-alist-only)) - bmkp-bmenu-omitted-bookmarks))) - (dolist (bmk bmkp-sorted-alist) - (setq max-width (max max-width (length (bmkp-bookmark-name-from-record bmk))))) - (setq max-width (+ max-width bmkp-bmenu-marks-width)) - (dolist (bmk bmkp-sorted-alist) - (setq name (bmkp-bookmark-name-from-record bmk) - markedp (bmkp-marked-bookmark-p bmk) - flaggedp (bmkp-flagged-bookmark-p bmk) - tags (bmkp-get-tags bmk) - annotation (bookmark-get-annotation bmk) - start (+ bmkp-bmenu-marks-width (point))) - (cond (flaggedp - (insert "D") (put-text-property (1- (point)) (point) 'face 'bmkp-D-mark)) - (markedp - (insert ">") (put-text-property (1- (point)) (point) 'face 'bmkp->-mark)) - (t (insert " "))) - (if (null tags) - (insert " ") - (insert "t") (put-text-property (1- (point)) (point) 'face 'bmkp-t-mark)) - (cond ((bmkp-temporary-bookmark-p bmk) - (insert "X") (put-text-property (1- (point)) (point) 'face 'bmkp-X-mark)) - ((and annotation (not (string-equal annotation ""))) - (insert "a") (put-text-property (1- (point)) (point) 'face 'bmkp-a-mark)) - (t (insert " "))) - (if (not (memq bmk bmkp-modified-bookmarks)) - (insert " ") - (insert "*") - (put-text-property (1- (point)) (point) 'face 'bmkp-*-mark)) - (when (and (featurep 'bookmark+-lit) (bmkp-get-lighting bmk)) ; Highlight highlight overrides. - (put-text-property (1- (point)) (point) 'face 'bmkp-light-mark)) - (when (and (bmkp-image-bookmark-p bmk) show-image-file-icon-p) - (let ((image (create-image bmkp-bmenu-image-bookmark-icon-file nil nil :ascent 95))) - (put-image image (point)))) - (insert name) - (move-to-column max-width t) - (bmkp-bmenu-propertize-item bmk start (point)) - (insert "\n"))) - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (bookmark-bmenu-mode) - (when bookmark-bmenu-toggle-filenames (bookmark-bmenu-toggle-filenames t)) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - (when (and interactivep bmkp-sort-comparer) - (bmkp-msg-about-sort-order (bmkp-current-sort-order)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; Redefined. -;; 1. Get name of the current bookmark from text property `bmkp-bookmark-name'. -;; 2. Added optional arg FULL, to return full bookmark record. -;; 3. Use `condition-case' in case we're at eob (so cannot advance). -;; -(defun bookmark-bmenu-bookmark (&optional full) - "Return the name of the bookmark on this line. -Normally, the string returned is propertized with property -`bmkp-full-record', which records the full bookmark record. -Non-nil optional FULL means return the bookmark record, not the name." - (condition-case nil - (let ((name (save-excursion (forward-line 0) (forward-char (1+ bmkp-bmenu-marks-width)) - (get-text-property (point) 'bmkp-bookmark-name)))) - (if full - (get-text-property 0 'bmkp-full-record name) - name)) - (error nil))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Mode-line major-mode name is different, and indicates whether in temporary bookmarking minor mode. -;; 2. Doc string is different. -;; -(defun bookmark-bmenu-mode () - "Major mode for editing a list of bookmarks. - -More bookmarking help below. Each line represents an Emacs bookmark. -Keys without prefix `C-x' are available only in `*Bookmark List*'. -Other keys are available everywhere. - - -Help - Bookmark Info --------------------- - -\\\ -\\[bookmark-bmenu-toggle-filenames]\t- Toggle showing filenames next to bookmarks -\\[bmkp-bmenu-describe-this-bookmark]\t- Show information about bookmark (`C-u': internal form) -\\[bmkp-bmenu-describe-this+move-down]\t- Show the info, then move to next bookmark -\\[bmkp-bmenu-describe-this+move-up]\t- Show the info, then move to previous bookmark -\\[bmkp-bmenu-describe-marked]\t- Show info about the marked bookmarks (`C-u': internal form) -\\[bookmark-bmenu-locate]\t- Show location of bookmark (in minibuffer) -\\[bookmark-bmenu-show-annotation]\t- Show bookmark's annotation -\\[bookmark-bmenu-show-all-annotations]\t- Show the annotations of all annotated bookmarks - -\\[bmkp-list-defuns-in-commands-file] -\t- List the commands defined in `bmkp-bmenu-commands-file' - - -Bookmark-List Display (`*Bookmark List*') ------------------------------------------ - -\\[bmkp-toggle-saving-menu-list-state]\t- Toggle autosaving bookmark-list display state -\\[bmkp-save-menu-list-state]\t- Save bookmark-list display state - -\\[bmkp-bmenu-refresh-menu-list]\t- Refresh display to current bookmark list (`C-u': from file) -\\[bmkp-bmenu-show-all]\t- Show all bookmarks -\\[bmkp-toggle-bookmark-set-refreshes] -\t- Toggle whether `bookmark-set' refreshes the bookmark list -\\[bmkp-bmenu-mode-status-help]\t- Show this help -\\[bmkp-bmenu-quit]\t- Quit (`*Bookmark List*') - - -Bookmark Files --------------- - -\\[bmkp-toggle-saving-bookmark-file]\t- Toggle autosaving to the current bookmark file -\\[bookmark-bmenu-save]\t- Save bookmarks now (`C-u': Save As... - prompt for file) - -C-u \\[bmkp-bmenu-refresh-menu-list]\t- Revert to bookmarks in the bookmark file (overwrite load) -\\[bmkp-switch-bookmark-file-create]\t- Switch to a different bookmark file (overwrite load) -C-u \\[bmkp-switch-bookmark-file-create]\t- Switch back to the previous bookmark file (overwrite load) - -\\[bookmark-bmenu-load]\t- Add bookmarks from a different bookmark file (extra load) -\\[bmkp-bmenu-load-marked-bookmark-file-bookmarks]\t- Load marked bookmark-file bookmarks \ -\(extra load) - - -General -------- - -Here: - -\\[bmkp-bmenu-dired-marked]\t- Open Dired for the marked file and directory bookmarks -\\[bmkp-bmenu-make-sequence-from-marked] -\t- Create a sequence bookmark from the marked bookmarks -\\[bmkp-temporary-bookmarking-mode]\t- Toggle temporary-only bookmarking (new, empty bookmark file) - -Anywhere: - -\\[bmkp-toggle-autotemp-on-set]\t- Toggle making bookmarks temporary when setting them -\\[bmkp-set-bookmark-file-bookmark]\t- Create a bookmark to a bookmark file \ -\(`\\[bmkp-bookmark-file-jump]' to load) -\\[bmkp-delete-bookmarks]\t- Delete some bookmarks at point or all in buffer -\\[bmkp-make-function-bookmark]\t- Create a function bookmark -\\[bmkp-choose-navlist-of-type]\t- Set the navlist to the bookmarks of a type you choose -\\[bmkp-choose-navlist-from-bookmark-list]\t- Set the navlist to the bookmarks of a \ -bookmark-list bookmark -\\[bmkp-navlist-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in navlist -\\[bmkp-this-file/buffer-bmenu-list]\t- Open `*Bookmark List*' for bookmarks in current file/buffer - - -Create/Set Bookmarks (anywhere) --------------------- - -\\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Set/delete an autonamed bookmark here -\\[bmkp-autofile-set]\t- Set and autoname a bookmark for a file -\\[bmkp-file-target-set]\t- Set a bookmark for a file -\\[bmkp-url-target-set]\t- Set a bookmark for a URL -\\[bookmark-set]\t\t- Set a bookmark here -\\[bmkp-set-desktop-bookmark]\t\t- Set a bookmark for the current desktop -\\[bmkp-set-bookmark-file-bookmark]\t\t- Set a bookmark for a bookmark file - - -Jump to (Visit) Bookmarks -------------------------- - -Here: - -\\[bookmark-bmenu-select]\t- This bookmark and also visit bookmarks marked `>' -\\[bookmark-bmenu-this-window]\t- Bookmark in the same window -\\[bookmark-bmenu-other-window]\t- Bookmark in another window -\\[bookmark-bmenu-switch-other-window]\t- Bookmark in other window, without selecting it -\\[bookmark-bmenu-1-window]\t- Bookmark in a full-frame window -\\[bookmark-bmenu-2-window]\t- This bookmark and last-visited bookmark - -Anywhere: - -\\[bookmark-jump]\t- Bookmark by name -\\[bmkp-jump-to-type]\t- Bookmark by type -\\[bmkp-jump-in-navlist]\t- Bookmark in the navigation list -\\[bmkp-lighted-jump]\t- Highlighted bookmark -\\[bmkp-autofile-jump]\t- Autofile bookmark -\\[bmkp-autonamed-jump]\t- Autonamed bookmark -\\[bmkp-autonamed-this-buffer-jump]\t- Autonamed bookmark in buffer -\\[bmkp-temporary-jump]\t- Temporary bookmark -\\[bmkp-desktop-jump]\t- Desktop bookmark -\\[bmkp-bookmark-list-jump]\t- Bookmark-list bookmark -\\[bmkp-bookmark-file-jump]\t- Bookmark-file bookmark -\\[bmkp-dired-jump]\t- Dired bookmark -\\[bmkp-file-jump]\t- File or directory bookmark -\\[bmkp-dired-this-dir-jump]\t- Dired bookmark for this dir -\\[bmkp-file-this-dir-jump]\t- Bookmark for a file or subdir in this dir -\\[bmkp-local-file-jump]\t- Local-file bookmark -\\[bmkp-remote-file-jump]\t- Remote-file bookmark -\\[bmkp-region-jump]\t- Region bookmark -\\[bmkp-image-jump]\t- Image-file bookmark -\\[bmkp-info-jump]\t- Info bookmark -\\[bmkp-man-jump]\t- `man'-page bookmark -\\[bmkp-non-file-jump]\t- Non-file (buffer) bookmark -\\[bmkp-gnus-jump]\t- Gnus bookmark -\\[bmkp-url-jump]\t- URL bookmark -\\[bmkp-variable-list-jump]\t- Variable-list bookmark -\\[bmkp-some-tags-jump]\t- Bookmark having some tags you specify -\\[bmkp-all-tags-jump]\t- Bookmark having each tag you specify -\\[bmkp-some-tags-regexp-jump]\t- Bookmark having a tag that matches a regexp -\\[bmkp-all-tags-regexp-jump]\t- Bookmark having all its tags match a regexp -\\[bmkp-file-some-tags-jump]\t- File bookmark having some tags you specify -\\[bmkp-file-all-tags-jump]\t- File bookmark having each tag you specify -\\[bmkp-file-some-tags-regexp-jump]\t- File bookmark having a tag that matches a regexp -\\[bmkp-file-all-tags-regexp-jump]\t- File bookmark having all its tags match a regexp -\\[bmkp-file-this-dir-some-tags-jump]\t- File in this dir having some tags you specify -\\[bmkp-file-this-dir-all-tags-jump]\t- File in this dir having each tag you specify -\\[bmkp-file-this-dir-some-tags-regexp-jump]\t- File in this dir having a tag that matches a regexp -\\[bmkp-file-this-dir-all-tags-regexp-jump]\t- File in this dir having all its tags match a regexp - - -Autonamed Bookmarks (anywhere) -------------------- - -\\[bmkp-toggle-autonamed-bookmark-set/delete]\t- Create/delete autonamed bookmark at point -\\[bmkp-autonamed-jump]\t- Jump to an autonamed bookmark -\\[bmkp-autonamed-this-buffer-jump]\t- Jump to an autonamed bookmark in a given buffer -\\[bmkp-delete-all-autonamed-for-this-buffer] -\t- Delete all autonamed bookmarks in current buffer - - -Cycle Bookmarks (anywhere) ---------------- - -C-x p n n ...\t- Next bookmark in buffer (C-x p C-n, C-x p down) -C-x p p p ...\t- Prev bookmark in buffer (C-x p C-p, C-x p up) -C-x p f f ...\t- Next bookmark in navlist (C-x p C-f, C-x p right) -C-x p b b ...\t- Prev bookmark in navlist (C-x p C-b, C-x p left) -C-x p next ...\t- MS Windows `Open' next bookmark in navlist -C-x p prior ...\t- MS Windows `Open' previous bookmark in navlist -C-x C-down ...\t- Next highlighted bookmark in buffer -C-x C-up ...\t- Prev highlighted bookmark in buffer - - -Search-and-Replace in Bookmark Targets (here, in sort order) --------------------------------------- - -M-s a C-s\t- Isearch the marked bookmarks (Emacs 23+) -M-s a C-M-s\t- Regexp-isearch the marked bookmarks (Emacs 23+) -\\[bmkp-bmenu-search-marked-bookmarks-regexp]\t- Regexp-search the marked file bookmarks -\\[bmkp-bmenu-query-replace-marked-bookmarks-regexp]\t\t- Query-replace the marked file \ -bookmarks - - -Mark/Unmark Bookmarks ---------------------- - -\(Mark means `>'. Flag means `D'. See also `Tags', below.) - -\\[bookmark-bmenu-delete]\t- Flag bookmark `D' for deletion, then move down -\\[bookmark-bmenu-delete-backwards]\t- Flag bookmark `D' for deletion, then move up - -\\[bookmark-bmenu-mark]\t- Mark bookmark -\\[bookmark-bmenu-unmark]\t- Unmark bookmark (`C-u': move up one line) -\\[bookmark-bmenu-backup-unmark]\t- Unmark previous bookmark (move up, then unmark) - -\\[bmkp-bmenu-mark-all]\t- Mark all bookmarks -\\[bmkp-bmenu-regexp-mark]\t- Mark all bookmarks whose names match a regexp -\\[bmkp-bmenu-unmark-all]\t- Unmark all bookmarks (`C-u': interactive query) -\\[bmkp-bmenu-toggle-marks]\t- Toggle marks: unmark the marked and mark the unmarked - -\\[bmkp-bmenu-mark-autofile-bookmarks]\t- Mark autofile bookmarks -\\[bmkp-bmenu-mark-autonamed-bookmarks]\t- Mark autonamed bookmarks -\\[bmkp-bmenu-mark-temporary-bookmarks]\t- Mark temporary bookmarks -\\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark highlighted bookmarks (requires `bookmark+-lit.el) -\\[bmkp-bmenu-mark-dired-bookmarks]\t- Mark Dired bookmarks -\\[bmkp-bmenu-mark-file-bookmarks]\t- Mark file & directory bookmarks (`C-u': local only) -\\[bmkp-bmenu-mark-image-bookmarks]\t- Mark image-file bookmarks -\\[bmkp-bmenu-mark-orphaned-local-file-bookmarks]\t- Mark orphaned local file/dir bookmarks (`C-u': \ -remote also) -\\[bmkp-bmenu-mark-non-file-bookmarks]\t- Mark non-file (i.e. buffer) bookmarks -\\[bmkp-bmenu-mark-region-bookmarks]\t- Mark region bookmarks -\\[bmkp-bmenu-mark-bookmark-file-bookmarks]\t- Mark bookmark-file bookmarks -\\[bmkp-bmenu-mark-variable-list-bookmarks]\t- Mark variable-list bookmarks -\\[bmkp-bmenu-mark-desktop-bookmarks]\t- Mark desktop bookmarks -\\[bmkp-bmenu-mark-info-bookmarks]\t- Mark Info bookmarks -\\[bmkp-bmenu-mark-man-bookmarks]\t- Mark `man' page bookmarks (that's `M' twice, not Meta-M) -\\[bmkp-bmenu-mark-gnus-bookmarks]\t- Mark Gnus bookmarks -\\[bmkp-bmenu-mark-url-bookmarks]\t- Mark URL bookmarks -\\[bmkp-bmenu-mark-w3m-bookmarks]\t- Mark W3M (URL) bookmarks - - -Modify, Delete Bookmarks ------------------------- - -\(See also `Tags', next.) - -\\[bmkp-bmenu-edit-bookmark-name-and-file]\t- Rename or relocate bookmark -\\[bmkp-bmenu-edit-tags]\t- Edit bookmark's tags -\\[bookmark-bmenu-edit-annotation]\t- Edit bookmark's annotation -\\[bmkp-bmenu-edit-bookmark-record]\t- Edit internal record for bookmark (Lisp) -\\[bmkp-bmenu-edit-marked]\t- Edit internal records of marked bookmarks (Lisp) -\\[bmkp-bmenu-toggle-temporary]\t- Toggle temporary/savable status of bookmark -\\[bmkp-bmenu-toggle-marked-temporary/savable]\t- Toggle temporary/savable status of marked bookmarks -\\[bmkp-delete-all-temporary-bookmarks]\t- Delete all temp bookmarks -\\[bookmark-bmenu-execute-deletions]\t- Delete (visible) bookmarks flagged `D' -\\[bmkp-bmenu-delete-marked]\t- Delete (visible) bookmarks marked `>' - - -Bookmark Tags -------------- - -\\[bmkp-add-tags]\t- Add some tags to a bookmark -\\[bmkp-remove-tags]\t- Remove some tags from a bookmark -\\[bmkp-remove-all-tags]\t- Remove all tags from a bookmark -\\[bmkp-remove-tags-from-all]\t- Remove some tags from all bookmarks -\\[bmkp-rename-tag]\t- Rename a tag in all bookmarks -\\[bmkp-list-all-tags]\t- List all tags used in any bookmarks (`C-u': show tag values) -\\[bmkp-bmenu-edit-tags]\t- Edit bookmark's tags -\\[bmkp-bmenu-set-tag-value]\t- Set the value of a tag (as attribute) - -\\[bmkp-bmenu-add-tags-to-marked]\t- Add some tags to the marked bookmarks -\\[bmkp-bmenu-remove-tags-from-marked]\t- Remove some tags from the marked bookmarks - -\\[bmkp-bmenu-mark-bookmarks-tagged-regexp]\t- Mark bookmarks having at least one \ -tag that matches a regexp -\\[bmkp-bmenu-mark-bookmarks-tagged-some]\t- Mark bookmarks having at least one tag \ -in a set (OR) -\\[bmkp-bmenu-mark-bookmarks-tagged-all]\t- Mark bookmarks having all of the tags \ -in a set (AND) -\\[bmkp-bmenu-mark-bookmarks-tagged-none]\t- Mark bookmarks not having any of the tags \ -in a set (NOT OR) -\\[bmkp-bmenu-mark-bookmarks-tagged-not-all]\t- Mark bookmarks not having all of the \ -tags in a set (NOT AND) - -\\[bmkp-bmenu-unmark-bookmarks-tagged-regexp]\t- Unmark bookmarks having a \ -tag that matches a regexp -\\[bmkp-bmenu-unmark-bookmarks-tagged-some]\t- Unmark bookmarks having at least one \ -tag in a set (OR) -\\[bmkp-bmenu-unmark-bookmarks-tagged-all]\t- Unmark bookmarks having all of the tags \ -in a set (AND) -\\[bmkp-bmenu-unmark-bookmarks-tagged-none]\t- Unmark bookmarks not having any tags \ -in a set (NOT OR) -\\[bmkp-bmenu-unmark-bookmarks-tagged-not-all]\t- Unmark bookmarks not having all tags \ -in a set (NOT AND) - - -Bookmark Highlighting ---------------------- - -\\[bmkp-bmenu-show-only-lighted]\t- Show only the highlighted bookmarks -\\[bmkp-bmenu-set-lighting]\t- Set highlighting for bookmark -\\[bmkp-bmenu-set-lighting-for-marked]\t- Set highlighting for marked bookmarks -\\[bmkp-bmenu-light]\t- Highlight bookmark -\\[bmkp-bmenu-unlight]\t- Unhighlight bookmark -\\[bmkp-bmenu-mark-lighted-bookmarks]\t- Mark the highlighted bookmarks -\\[bmkp-bmenu-light-marked]\t- Highlight the marked bookmarks -\\[bmkp-bmenu-unlight-marked]\t- Unhighlight the marked bookmarks -\\[bmkp-light-bookmark-this-buffer]\t- Highlight a bookmark in current buffer -\\[bmkp-unlight-bookmark-this-buffer]\t- Unhighlight a bookmark in current buffer -\\[bmkp-light-bookmarks]\t- Highlight bookmarks (see prefix arg) -\\[bmkp-unlight-bookmarks]\t- Unhighlight bookmarks (see prefix arg) -\\[bmkp-bookmarks-lighted-at-point]\t- List bookmarks highlighted at point -\\[bmkp-unlight-bookmark-here]\t- Unhighlight a bookmark at point or on same line - - -Sort `*Bookmark List*' ----------------------- - -\(Repeat to cycle normal/reversed/off, except as noted.) - -\\[bmkp-reverse-sort-order]\t- Reverse current sort direction (repeat to toggle) -\\[bmkp-reverse-multi-sort-order]\t- Complement sort predicate decisions (repeat \ -to toggle) -\\[bmkp-bmenu-change-sort-order-repeat]\t- Cycle sort orders (repeat \ -to cycle) - -\\[bmkp-bmenu-sort-marked-before-unmarked]\t- Sort marked (`>') bookmarks first -\\[bmkp-bmenu-sort-flagged-before-unflagged]\t- Sort flagged (`D') bookmarks first -\\[bmkp-bmenu-sort-modified-before-unmodified]\t- Sort modified (`*') bookmarks first -\\[bmkp-bmenu-sort-tagged-before-untagged]\t- Sort tagged (`t') bookmarks first - -\\[bmkp-bmenu-sort-by-last-buffer-or-file-access]\t- Sort by last buffer or file \ -access -\\[bmkp-bmenu-sort-by-Gnus-thread]\t- Sort by Gnus thread: group, article, message -\\[bmkp-bmenu-sort-by-Info-location]\t- Sort by Info manual, node, position -\\[bmkp-bmenu-sort-by-bookmark-type]\t- Sort by bookmark type -\\[bmkp-bmenu-sort-by-bookmark-name]\t- Sort by bookmark name -\\[bmkp-bmenu-sort-by-creation-time]\t- Sort by bookmark creation time -\\[bmkp-bmenu-sort-by-last-bookmark-access]\t- Sort by last bookmark access time -\\[bmkp-bmenu-sort-by-bookmark-visit-frequency]\t- Sort by bookmark visit frequency -\\[bmkp-bmenu-sort-by-url]\t- Sort by URL - -\\[bmkp-bmenu-sort-by-local-file-type]\t- Sort by local file type: file, symlink, dir -\\[bmkp-bmenu-sort-by-file-name]\t- Sort by file name -\\[bmkp-bmenu-sort-by-local-file-size]\t- Sort by local file size -\\[bmkp-bmenu-sort-by-last-local-file-access]\t- Sort by last local file access -\\[bmkp-bmenu-sort-by-last-local-file-update]\t- Sort by last local file update (edit) - - -Hide/Show (`*Bookmark List*') ------------------------------ - -\\[bmkp-bmenu-show-all]\t- Show all bookmarks -\\[bmkp-bmenu-toggle-show-only-marked]\t- Toggle showing only marked bookmarks -\\[bmkp-bmenu-toggle-show-only-unmarked]\t- Toggle showing only unmarked bookmarks -\\[bmkp-bmenu-show-only-autofiles]\t- Show only autofile bookmarks -\\[bmkp-bmenu-show-only-autonamed]\t- Show only autonamed bookmarks -\\[bmkp-bmenu-show-only-temporary]\t- Show only temporary bookmarks -\\[bmkp-bmenu-show-only-dired]\t- Show only Dired bookmarks -\\[bmkp-bmenu-show-only-files]\t- Show only file & directory bookmarks (`C-u': local only) -\\[bmkp-bmenu-show-only-image-files]\t- Show only image-file bookmarks -\\[bmkp-bmenu-show-only-orphaned-local-files]\t- Show only orphaned local file bookmarks (`C-u': \ -remote also) -\\[bmkp-bmenu-show-only-non-files]\t- Show only non-file (i.e. buffer) bookmarks -\\[bmkp-bmenu-show-only-regions]\t- Show only region bookmarks -\\[bmkp-bmenu-show-only-bookmark-files]\t- Show only bookmark-file bookmarks -\\[bmkp-bmenu-show-only-variable-lists]\t- Show only variable-list bookmarks -\\[bmkp-bmenu-show-only-desktops]\t- Show only desktop bookmarks -\\[bmkp-bmenu-show-only-info-nodes]\t- Show only Info bookmarks -\\[bmkp-bmenu-show-only-man-pages]\t- Show only `man' page bookmarks -\\[bmkp-bmenu-show-only-gnus]\t- Show only Gnus bookmarks -\\[bmkp-bmenu-show-only-urls]\t- Show only URL bookmarks -\\[bmkp-bmenu-show-only-w3m-urls]\t- Show only W3M (URL) bookmarks -\\[bmkp-bmenu-filter-bookmark-name-incrementally]\t- Incrementally show only bookmarks \ -whose names match a regexp -\\[bmkp-bmenu-filter-file-name-incrementally]\t- Incrementally show only bookmarks whose \ -files match a regexp -\\[bmkp-bmenu-filter-annotation-incrementally]\t- Incrementally show bookmarks whose \ -annotations match regexp -\\[bmkp-bmenu-filter-tags-incrementally]\t- Incrementally show only bookmarks whose tags \ -match a regexp -\\[bmkp-bmenu-show-only-tagged]\t- Show only bookmarks that have tags - - -Omit/Un-omit (`*Bookmark List*') --------------------------------- - -\\[bmkp-bmenu-show-only-omitted]\t- Show (only) the omitted bookmarks -\\[bmkp-bmenu-show-all]\t- Show the un-omitted bookmarks (all) -\\[bmkp-bmenu-omit/unomit-marked]\t- Omit the marked bookmarks; un-omit them if after \ -`\\[bmkp-bmenu-show-only-omitted]' -\\[bmkp-unomit-all]\t- Un-omit all omitted bookmarks - - -Define Commands for `*Bookmark List*' -------------------------------------- - -\\[bmkp-bmenu-define-command]\t- Define a command to restore the current sort order & filter -\\[bmkp-bmenu-define-full-snapshot-command]\t- Define a command to restore the current \ -bookmark-list state -\\[bmkp-define-tags-sort-command]\t- Define a command to sort bookmarks by tags -\\[bmkp-bmenu-define-jump-marked-command]\t- Define a command to jump to a bookmark that is \ -now marked - - -Options for `*Bookmark List*' ------------------------------ - -bookmark-bmenu-file-column - Bookmark width if files are shown -bookmark-bmenu-toggle-filenames - Show filenames initially? - -bmkp-bmenu-omitted-bookmarks - List of omitted bookmarks -bmkp-bmenu-state-file - File to save bookmark-list state - (\"home\") nil: do not save/restore -bmkp-sort-comparer - Initial sort -bmkp-sort-orders-for-cycling-alist -\t - Sort orders that `\\[bmkp-bmenu-change-sort-order-repeat]'... cycles - - -Other Options -------------- - -bookmark-automatically-show-annotations - Show annotation when visit? -bookmark-completion-ignore-case - Case-sensitive completion? -bookmark-default-file - File to save bookmarks in -bookmark-menu-length - Max size of bookmark-name menu item -bookmark-save-flag - Whether and when to save -bookmark-use-annotations - Query for annotation when saving? -bookmark-version-control - Numbered backups of bookmark file? - -bmkp-autoname-format - Format of autonamed bookmark name -bmkp-last-as-first-bookmark-file - Whether to start with last b. file -bmkp-crosshairs-flag - Highlight position when visit? -bmkp-menu-popup-max-length - Use menus to choose bookmarks? -bmkp-save-new-location-flag - Save if bookmark relocated? -bmkp-sequence-jump-display-function - How to display a sequence -bmkp-sort-comparer - Predicates for sorting bookmarks -bmkp-su-or-sudo-regexp - Bounce-show each end of region? -bmkp-this-file/buffer-cycle-sort-comparer - cycling sort for here -bmkp-use-region - Activate saved region when visit?" - (kill-all-local-variables) - (use-local-map bookmark-bmenu-mode-map) - (setq truncate-lines t - buffer-read-only t - major-mode 'bookmark-bmenu-mode - mode-name (if bmkp-temporary-bookmarking-mode "TEMPORARY Bookmarking" "Bookmarks")) - (if (fboundp 'run-mode-hooks) - (run-mode-hooks 'bookmark-bmenu-mode-hook) - (run-hooks 'bookmark-bmenu-mode-hook))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Corrected (rewrote). Toggle var first (unless SHOW). Call fn according to the var (& to SHOW). -;; 2. Added optional arg NO-MSG-P. -;; -(defun bookmark-bmenu-toggle-filenames (&optional show no-msg-p) - "Toggle whether filenames are shown in the bookmark list. -Toggle the value of `bookmark-bmenu-toggle-filenames', unless SHOW is -non-nil. -Optional argument SHOW means show them unconditionally. - -Non-nil optional arg NO-MSG-P means do not show progress messages." - (interactive) - (unless show (setq bookmark-bmenu-toggle-filenames (not bookmark-bmenu-toggle-filenames))) - (let ((bookmark-bmenu-toggle-filenames (or show bookmark-bmenu-toggle-filenames))) - (if bookmark-bmenu-toggle-filenames - (bookmark-bmenu-show-filenames no-msg-p) - (bookmark-bmenu-hide-filenames no-msg-p)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Put `mouse-face' on whole line, with the same help-echo as for the bookmark name. -;; 2. Correct FORCE behavior. -;; 3. Correct doc string. -;; 4. Added optional arg NO-MSG-P and progress message. -;; 5. Fit one-window frame. -;; -(defun bookmark-bmenu-show-filenames (&optional force no-msg-p) - "Show file names if `bookmark-bmenu-toggle-filenames' is non-nil. -Otherwise do nothing, except non-nil optional argument FORCE has the -same effect as non-nil `bookmark-bmenu-toggle-filenames'. FORCE is -mainly for debugging. -Non-nil optional arg NO-MSG-P means do not show progress messages." - (when (or force bookmark-bmenu-toggle-filenames) - (unless no-msg-p (message "Showing file names...")) - (with-buffer-modified-unmodified - (save-excursion - (save-window-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (setq bookmark-bmenu-hidden-bookmarks ()) - (let ((inhibit-read-only t)) - (while (< (point) (point-max)) - (let ((bmk (bookmark-bmenu-bookmark))) - (setq bookmark-bmenu-hidden-bookmarks (cons bmk bookmark-bmenu-hidden-bookmarks)) - (move-to-column bookmark-bmenu-file-column t) - (delete-region (point) (line-end-position)) - (insert " ") - (bookmark-insert-location bmk t) ; Pass the NO-HISTORY arg. - (when (if (fboundp 'display-color-p) ; Emacs 21+. - (and (display-color-p) (display-mouse-p)) - window-system) - (let ((help (get-text-property (+ bmkp-bmenu-marks-width - (line-beginning-position)) 'help-echo))) - (put-text-property (+ bmkp-bmenu-marks-width (line-beginning-position)) - (point) 'mouse-face 'highlight) - (when help (put-text-property (+ bmkp-bmenu-marks-width - (line-beginning-position)) - (point) 'help-echo help)))) - (forward-line 1))))))) - (unless no-msg-p (message "Showing file names...done")) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Add text properties when hiding filenames. -;; 2. Do not set or use `bookmark-bmenu-bookmark-column' - use `bmkp-bmenu-marks-width' always. -;; 3. Correct FORCE behavior. -;; 4. Correct doc string. -;; 5. Added optional arg NO-MSG-P and progress message. -;; 6. Fit one-window frame. -;; -(defun bookmark-bmenu-hide-filenames (&optional force no-msg-p) - "Hide filenames if `bookmark-bmenu-toggle-filenames' is nil. -Otherwise do nothing, except non-nil optional argument FORCE has the -same effect as nil `bookmark-bmenu-toggle-filenames'. FORCE is mainly -for debugging. -Non-nil optional arg NO-MSG-P means do not show progress messages." - (when (or force (not bookmark-bmenu-toggle-filenames)) - (unless no-msg-p (message "Hiding file names...")) - (with-buffer-modified-unmodified - (save-excursion - (save-window-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (setq bookmark-bmenu-hidden-bookmarks (nreverse bookmark-bmenu-hidden-bookmarks)) - (let ((max-width 0)) - (dolist (name bookmark-bmenu-hidden-bookmarks) - (setq max-width (max max-width (length name)))) - (setq max-width (+ max-width bmkp-bmenu-marks-width)) - (save-excursion - (let ((inhibit-read-only t)) - (while bookmark-bmenu-hidden-bookmarks - (move-to-column bmkp-bmenu-marks-width t) - (bookmark-kill-line) - (let ((name (car bookmark-bmenu-hidden-bookmarks)) - (start (point)) - end) - (insert name) - (move-to-column max-width t) - (setq end (point)) - (bmkp-bmenu-propertize-item name start end)) - (setq bookmark-bmenu-hidden-bookmarks (cdr bookmark-bmenu-hidden-bookmarks)) - (forward-line 1)))))))) - (unless no-msg-p (message "Hiding file names...done")) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg reverses `bmkp-use-region'. -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-1-window (&optional use-region-p) ; Bound to `1' in bookmark list - "Select this line's bookmark, alone, in full frame. -See `bookmark-jump' for info about the prefix arg." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-jump-1 (bookmark-bmenu-bookmark) 'pop-to-buffer use-region-p) - (bury-buffer (other-buffer)) - (delete-other-windows)) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg reverses `bmkp-use-region'. -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-2-window (&optional use-region-p) ; Bound to `2' in bookmark list - "Select this line's bookmark, with previous buffer in second window. -See `bookmark-jump' for info about the prefix arg." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark-name (bookmark-bmenu-bookmark)) - (menu (current-buffer)) - (pop-up-windows t)) - (delete-other-windows) - (switch-to-buffer (other-buffer)) - ;; (let ((bookmark-automatically-show-annotations nil)) ; $$$$$$ Needed? - (bmkp-jump-1 bookmark-name 'pop-to-buffer use-region-p) - (bury-buffer menu))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg reverses `bmkp-use-region'. -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-this-window (&optional use-region-p) ; Bound to `RET' in bookmark list - "Select this line's bookmark in this window. -See `bookmark-jump' for info about the prefix arg." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark-name (bookmark-bmenu-bookmark))) - (bmkp-jump-1 bookmark-name 'switch-to-buffer use-region-p))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Use `pop-to-buffer', not `switch-to-buffer-other-window'. -;; 2. Prefix arg reverses `bmkp-use-region'. -;; 3. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-other-window (&optional use-region-p) ; Bound to `o' in bookmark list - "Select this line's bookmark in other window. Show `*Bookmark List*' still. -See `bookmark-jump' for info about the prefix arg." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark-name (bookmark-bmenu-bookmark))) - ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed? - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg reverses `bmkp-use-region'. -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-switch-other-window (&optional use-region-p) ; Bound to `C-o' in bookmark list - "Make the other window select this line's bookmark. -The current window remains selected. -See `bookmark-jump' for info about the prefix arg." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark-name (bookmark-bmenu-bookmark)) - (pop-up-windows t) - (same-window-buffer-names ()) - (same-window-regexps ())) - ;; (bookmark-automatically-show-annotations t)) ; $$$$$$ Needed? - (bmkp-jump-1 bookmark-name 'display-buffer use-region-p))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Prefix arg reverses `bmkp-use-region'. -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-other-window-with-mouse (event &optional use-region-p) - "Select clicked bookmark in other window. Show `*Bookmark List*' still." - (interactive "e\nP") - (with-current-buffer (window-buffer (posn-window (event-end event))) - (save-excursion (goto-char (posn-point (event-end event))) - (bookmark-bmenu-other-window use-region-p)))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg MSG-P. -;; 2. Call `bookmark-show-annotation' with arg MSG-P. -;; 3. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-show-annotation (msg-p) - "Show the annotation for the current bookmark in another window." - (interactive "p") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark (bookmark-bmenu-bookmark))) - (bookmark-show-annotation bookmark msg-p))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Added optional arg MARKEDP: handle bookmarks marked `>', not just those flagged `D'. -;; 2. Use `bookmark-bmenu-surreptitiously-rebuild-list', instead of using -;; `bookmark-bmenu-list', updating the modification count, and saving. -;; 3. Update `bmkp-latest-bookmark-alist' to reflect the deletions. -;; 4. Pass full bookmark, not name, to `delete' (and do not use `assoc'). -;; 5. Use `bmkp-bmenu-goto-bookmark-named'. -;; 6. Added status messages. -;; 7. Raise error if not in buffer `*Bookmark List*'. -;; -;;;###autoload -(defun bookmark-bmenu-execute-deletions (&optional markedp) ; Bound to `x' in bookmark list - "Delete (visible) bookmarks flagged `D'. -With a prefix argument, delete the bookmarks marked `>' instead, after -confirmation." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (if (or (not markedp) (yes-or-no-p "Delete bookmarks marked `>' (not `D') ")) - (let* ((mark-type (if markedp "^>" "^D")) - (o-str (and (not (looking-at mark-type)) (bookmark-bmenu-bookmark))) - (o-point (point)) - (count 0)) - (message "Deleting bookmarks...") - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (while (re-search-forward mark-type (point-max) t) - (let* ((bmk-name (bookmark-bmenu-bookmark)) - (bmk (bookmark-get-bookmark bmk-name))) - (bookmark-delete bmk-name 'BATCHP) - ;; Count is misleading if the bookmark is not really in `bookmark-alist'. - (setq count (1+ count) - bmkp-latest-bookmark-alist (delete bmk bmkp-latest-bookmark-alist)))) - (if (<= count 0) - (message (if markedp "No marked bookmarks" "No bookmarks flagged for deletion")) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (message "Deleted %d bookmarks" count)) - (if o-str - (bmkp-bmenu-goto-bookmark-named o-str) - (goto-char o-point) - (beginning-of-line))) - (message "OK, nothing deleted"))) - - -;; REPLACES ORIGINAL in `bookmark.el'. -;; -;; 1. Do not call `bookmark-bmenu-list' (it was already called). -;; 2. Raise error if not in buffer `*Bookmark List*'. -;; 3. Use `bmkp-bmenu-goto-bookmark-named' instead of just searching for name. -;; -;;;###autoload -(defun bookmark-bmenu-rename () ; Bound to `r' in bookmark list - "Rename bookmark on current line. Prompts for a new name." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((newname (bookmark-rename (bookmark-bmenu-bookmark)))) - (bmkp-bmenu-goto-bookmark-named newname))) - -;;(@* "Bookmark+ Functions (`bmkp-*')") -;;; Bookmark+ Functions (`bmkp-*') ----------------------------------- - - -;;(@* "Menu-List (`*-bmenu-*') Filter Commands") -;; *** Menu-List (`*-bmenu-*') Filter Commands *** - -;;;###autoload -(defun bmkp-bmenu-show-only-autofiles (&optional arg) ; Bound to `A S' in bookmark list - "Display (only) the autofile bookmarks. -This means bookmarks whose names are the same as their (non-directory) -file names. But with a prefix arg you are prompted for a prefix that -each bookmark name must have." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function (if (not arg) - 'bmkp-autofile-alist-only - (let ((prefix (read-string "Prefix for bookmark names: " - nil nil ""))) - `(lambda () (bmkp-autofile-alist-only ,prefix)))) - bmkp-bmenu-title "Autofile Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autofile bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-autonamed () ; Bound to `# S' in bookmark list - "Display (only) the autonamed bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-autonamed-alist-only - bmkp-bmenu-title "Autonamed Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only autonamed bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-bookmark-files () ; Bound to `Y S' in bookmark list - "Display (only) the bookmark-file bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-bookmark-file-alist-only - bmkp-bmenu-title "Bookmark-File Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmark-file bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-desktops () ; Bound to `K S' in bookmark list - "Display (only) the desktop bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-desktop-alist-only - bmkp-bmenu-title "Desktop Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only desktop bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-dired () ; Bound to `M-d M-s' in bookmark list - "Display (only) the Dired bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-dired-alist-only - bmkp-bmenu-title "Dired Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Dired bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-files (arg) ; Bound to `F S' in bookmark list - "Display a list of file and directory bookmarks (only). -With a prefix argument, do not include remote files or directories." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function (if arg 'bmkp-local-file-alist-only 'bmkp-file-alist-only) - bmkp-bmenu-title (if arg - "Local File and Directory Bookmarks" - "File and Directory Bookmarks")) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only file bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-orphaned-local-files (arg) ; Bound to `O S' in bookmark list - "Display a list of orphaned local file and directory bookmarks (only). -With a prefix argument, include remote orphans as well." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function (if arg - 'bmkp-orphaned-file-alist-only - 'bmkp-orphaned-local-file-alist-only) - bmkp-bmenu-title (if arg - "Orphaned File and Directory Bookmarks" - "Local Orphaned File and Directory Bookmarks")) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only orphaned file bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-non-files () ; Bound to `B S' in bookmark list - "Display (only) the non-file bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-non-file-alist-only - bmkp-bmenu-title "Non-File Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only non-file bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-gnus () ; Bound to `G S' in bookmark list - "Display (only) the Gnus bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-gnus-alist-only - bmkp-bmenu-title "Gnus Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Gnus bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-image-files () ; Bound to `M-i S' in bookmark list - "Display (only) the image-file bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-image-alist-only - bmkp-bmenu-title "Image-File Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - "Only image-file bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-info-nodes () ; Bound to `I S' in bookmark list - "Display (only) the Info bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-info-alist-only - bmkp-bmenu-title "Info Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only Info bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-man-pages () ; Bound to `M S' in bookmark list - "Display (only) the `man' page bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-man-alist-only - bmkp-bmenu-title "`man' Page Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only `man' page bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-regions () ; Bound to `R S' in bookmark list - "Display (only) the bookmarks that record a region." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-region-alist-only - bmkp-bmenu-title "Region Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only bookmarks with regions are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-temporary () ; Bound to `X S' in bookmark list - "Display (only) the temporary bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-temporary-alist-only - bmkp-bmenu-title "TEMPORARY ONLY") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only temporary bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-variable-lists () ; Bound to `V S' in bookmark list - "Display (only) the variable-list bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-variable-list-alist-only - bmkp-bmenu-title "Variable-List Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only variable-list bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-specific-buffer (&optional buffer) ; Bound to `= b S' in bookmark list - "Display (only) the bookmarks for BUFFER. -Interactively, read the BUFFER name. -If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it." - (interactive (list (bmkp-completing-read-buffer-name))) - (bmkp-bmenu-barf-if-not-in-menu-list) - (when buffer (setq bmkp-last-specific-buffer buffer)) - (setq bmkp-bmenu-filter-function 'bmkp-last-specific-buffer-alist-only - bmkp-bmenu-title (format "Buffer `%s' Bookmarks" bmkp-last-specific-buffer)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - (format "Only bookmarks for buffer `%s' are shown" - bmkp-last-specific-buffer)))) - -;;;###autoload -(defun bmkp-bmenu-show-only-specific-file (&optional file) ; Bound to `= f S' in bookmark list - "Display (only) the bookmarks for FILE, an absolute file name. -Interactively, read the FILE name. -If FILE is non-nil, set `bmkp-last-specific-file' to it." - (interactive (list (bmkp-completing-read-file-name))) - (bmkp-bmenu-barf-if-not-in-menu-list) - (when file (setq bmkp-last-specific-file file)) - (setq bmkp-bmenu-filter-function 'bmkp-last-specific-file-alist-only - bmkp-bmenu-title (format "File `%s' Bookmarks" bmkp-last-specific-file)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) - (format "Only bookmarks for file `%s' are shown" - bmkp-last-specific-file)))) - -;;;###autoload -(defun bmkp-bmenu-show-only-urls () ; Bound to `M-u M-s' in bookmark list - "Display (only) the URL bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-url-alist-only - bmkp-bmenu-title "URL Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only URL bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-only-w3m-urls () ; Bound to `W S' in bookmark list - "Display (only) the W3M URL bookmarks." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-w3m-alist-only - bmkp-bmenu-title "W3M Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only W3M bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-show-all () ; Bound to `.' in bookmark list - "Show all bookmarks known to the bookmark list (aka \"menu list\"). -Omitted bookmarks are not shown, however. -Also, this does not revert the bookmark list, to bring it up to date. -To revert the list, use `\\\\[bmkp-bmenu-refresh-menu-list]'." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function nil - bmkp-bmenu-title "All Bookmarks" - bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "All bookmarks are shown"))) - -;;;###autoload -(defun bmkp-bmenu-refresh-menu-list (&optional arg msg-p) ; Bound to `g' in bookmark list - "Refresh (revert) the bookmark list display (aka \"menu list\"). -This brings the displayed list up to date with respect to the current -bookmark list. It does not change the filtering or sorting of the -displayed list. - -With a prefix argument and upon confirmation, refresh the bookmark -list and its display from the current bookmark file. IOW, it reloads -the file, overwriting the current bookmark list. This also removes -any markings and omissions. - -You can use command `bmkp-toggle-bookmark-set-refreshes' to toggle -whether setting a bookmark in any way should automatically refresh the -list. - -From Lisp, non-nil optional arg MSG-P means show progress messages." - (interactive "P\np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((msg "Refreshing from bookmark ")) - (cond ((and arg (yes-or-no-p (format "Revert to bookmarks saved in file `%s'? " - bmkp-current-bookmark-file))) - (when msg-p (message (setq msg (concat msg "file...")))) - (bookmark-load bmkp-current-bookmark-file 'OVERWRITE 'NO-MSG-P) - (setq bmkp-bmenu-marked-bookmarks () ; Start from scratch. - bmkp-modified-bookmarks () - bmkp-flagged-bookmarks () - bmkp-bmenu-omitted-bookmarks (condition-case nil - (eval (car (get 'bmkp-bmenu-omitted-bookmarks - 'saved-value))) - (error nil))) - (let ((bmkp-bmenu-filter-function nil)) ; Remove any filtering. - (bmkp-refresh-menu-list (bookmark-bmenu-bookmark) (not msg-p)))) - (t - (when msg-p (message (setq msg (concat msg "list in memory...")))) - (bmkp-refresh-menu-list (bookmark-bmenu-bookmark) (not msg-p)))) - (when msg-p (message (concat msg "done"))))) - -;;;###autoload -(defun bmkp-bmenu-filter-bookmark-name-incrementally () ; Bound to `P B' in bookmark list - "Incrementally filter bookmarks by bookmark name using a regexp." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unwind-protect - (progn (setq bmkp-bmenu-filter-timer - (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT - #'bmkp-bmenu-filter-alist-by-bookmark-name-regexp)) - (bmkp-bmenu-read-filter-input)) - (bmkp-bmenu-cancel-incremental-filtering))) - -(defun bmkp-bmenu-filter-alist-by-bookmark-name-regexp () - "Filter bookmarks by bookmark name, then refresh the bookmark list." - (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-bookmark-name-alist-only - bmkp-bmenu-title (format "Bookmarks with Names Matching Regexp `%s'" - bmkp-bmenu-filter-pattern)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp))) - -;;;###autoload -(defun bmkp-bmenu-filter-file-name-incrementally () ; Bound to `P F' in bookmark list - "Incrementally filter bookmarks by file name using a regexp." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unwind-protect - (progn (setq bmkp-bmenu-filter-timer - (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT - #'bmkp-bmenu-filter-alist-by-file-name-regexp)) - (bmkp-bmenu-read-filter-input)) - (bmkp-bmenu-cancel-incremental-filtering))) - -(defun bmkp-bmenu-filter-alist-by-file-name-regexp () - "Filter bookmarks by file name, then refresh the bookmark list." - (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-file-name-alist-only - bmkp-bmenu-title (format "Bookmarks with File Names Matching Regexp `%s'" - bmkp-bmenu-filter-pattern)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp))) - -;;;###autoload -(defun bmkp-bmenu-filter-annotation-incrementally () ; Bound to `P A' in bookmark list - "Incrementally filter bookmarks by their annotations using a regexp." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unwind-protect - (progn (setq bmkp-bmenu-filter-timer - (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT - #'bmkp-bmenu-filter-alist-by-annotation-regexp)) - (bmkp-bmenu-read-filter-input)) - (bmkp-bmenu-cancel-incremental-filtering))) - -(defun bmkp-bmenu-filter-alist-by-annotation-regexp () - "Filter bookmarks by annoation, then refresh the bookmark list." - (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-annotation-alist-only - bmkp-bmenu-title (format "Bookmarks with Annotations Matching Regexp `%s'" - bmkp-bmenu-filter-pattern)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp))) - -;;;###autoload -(defun bmkp-bmenu-filter-tags-incrementally () ; Bound to `P T' in bookmark list - "Incrementally filter bookmarks by tags using a regexp." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unwind-protect - (progn (setq bmkp-bmenu-filter-timer - (run-with-idle-timer bmkp-incremental-filter-delay 'REPEAT - #'bmkp-bmenu-filter-alist-by-tags-regexp)) - (bmkp-bmenu-read-filter-input)) - (bmkp-bmenu-cancel-incremental-filtering))) - -(defun bmkp-bmenu-filter-alist-by-tags-regexp () - "Filter bookmarks by tags, then refresh the bookmark list." - (setq bmkp-bmenu-filter-function 'bmkp-regexp-filtered-tags-alist-only - bmkp-bmenu-title (format "Bookmarks with Tags Matching Regexp `%s'" - bmkp-bmenu-filter-pattern)) - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp))) - -(defun bmkp-bmenu-read-filter-input () - "Read input and add it to `bmkp-bmenu-filter-pattern'." - (setq bmkp-bmenu-filter-pattern "") - (let ((curr-bmk (bookmark-bmenu-bookmark))) - (when (eq 'QUIT - (let ((tmp-list ()) - (bmkp-bmenu-title bmkp-bmenu-title) - (bmkp-bmenu-filter-function bmkp-bmenu-filter-function) - (inhibit-quit t) - char) - (catch 'bmkp-bmenu-read-filter-input - (while (condition-case nil - (setq char (read-char (concat bmkp-bmenu-filter-prompt - bmkp-bmenu-filter-pattern))) - ;; `read-char' raises an error for non-char event. - (error (throw 'bmkp-bmenu-read-filter-input nil))) - (case char - ((?\e ?\r) (throw 'bmkp-bmenu-read-filter-input nil)) ; Break and exit. - (?\C-g (setq inhibit-quit nil) - (throw 'bmkp-bmenu-read-filter-input 'QUIT)) ; Quit. - (?\d (or (null tmp-list) ; No-op if no chars to delete. - (pop tmp-list) t)) ; Delete last char of `*-filter-pattern'. - (t (push (text-char-description char) tmp-list))) ; Accumulate CHAR. - (setq bmkp-bmenu-filter-pattern (mapconcat #'identity (reverse tmp-list) "")))))) - (message "Restoring display prior to incremental filtering...") - (bookmark-bmenu-list 'FILTEREDP) - (bmkp-bmenu-goto-bookmark-named curr-bmk) - (message "Restoring display prior to incremental filtering...done")))) - -(defun bmkp-bmenu-cancel-incremental-filtering () - "Cancel timer used for incrementally filtering bookmarks." - (cancel-timer bmkp-bmenu-filter-timer) - (setq bmkp-bmenu-filter-timer nil)) - -;;;###autoload -(defun bmkp-bmenu-toggle-show-only-unmarked () ; Bound to `<' in bookmark list - "Hide all marked bookmarks. Repeat to toggle, showing all." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - ;; Save display, to be sure `bmkp-bmenu-before-hide-marked-alist' is up-to-date. - (bmkp-save-menu-list-state) - (if (or (bmkp-some-marked-p bmkp-latest-bookmark-alist) - (bmkp-some-marked-p bmkp-bmenu-before-hide-marked-alist)) - (let ((bookmark-alist bmkp-latest-bookmark-alist) - status) - (if bmkp-bmenu-before-hide-marked-alist - (setq bookmark-alist bmkp-bmenu-before-hide-marked-alist - bmkp-bmenu-before-hide-marked-alist () - bmkp-latest-bookmark-alist bookmark-alist - status 'shown) - (setq bmkp-bmenu-before-hide-marked-alist bmkp-latest-bookmark-alist - bookmark-alist (bmkp-unmarked-bookmarks-only) - bmkp-latest-bookmark-alist bookmark-alist - status 'hidden)) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (cond ((eq status 'hidden) - (bookmark-bmenu-ensure-position) - (message "Marked bookmarks are now hidden")) - (t - (goto-char (point-min)) - (when (re-search-forward "^>" (point-max) t) (forward-line 0)) - (message "Marked bookmarks no longer hidden")))) - (message "No marked bookmarks to hide")) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - -;;;###autoload -(defun bmkp-bmenu-toggle-show-only-marked () ; Bound to `>' in bookmark list - "Hide all unmarked bookmarks. Repeat to toggle, showing all." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - ;; Save display, to be sure `bmkp-bmenu-before-hide-unmarked-alist' is up-to-date. - (bmkp-save-menu-list-state) - (if (or (bmkp-some-unmarked-p bmkp-latest-bookmark-alist) - (bmkp-some-unmarked-p bmkp-bmenu-before-hide-unmarked-alist)) - (let ((bookmark-alist bmkp-latest-bookmark-alist) - status) - (if bmkp-bmenu-before-hide-unmarked-alist - (setq bookmark-alist bmkp-bmenu-before-hide-unmarked-alist - bmkp-bmenu-before-hide-unmarked-alist () - bmkp-latest-bookmark-alist bookmark-alist - status 'shown) - (setq bmkp-bmenu-before-hide-unmarked-alist bmkp-latest-bookmark-alist - bookmark-alist (bmkp-marked-bookmarks-only) - bmkp-latest-bookmark-alist bookmark-alist - status 'hidden)) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (cond ((eq status 'hidden) - (bookmark-bmenu-ensure-position) - (message "Unmarked bookmarks are now hidden")) - (t - (goto-char (point-min)) - (when (re-search-forward "^>" (point-max) t) (forward-line 0)) - (message "Unmarked bookmarks no longer hidden")))) - (message "No unmarked bookmarks to hide")) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - - -;;(@* "Menu-List (`*-bmenu-*') Commands Involving Marks") -;; *** Menu-List (`*-bmenu-*') Commands Involving Marks *** - -;;;###autoload -(defun bmkp-bmenu-mark-all (&optional no-re-sort-p msg-p) ; Bound to `M-m' in bookmark list - "Mark all bookmarks, using mark `>'. -If any bookmark was unmarked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P meands display a status message." - (interactive "i\np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks))) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) (bookmark-bmenu-mark 'NO-RE-SORT-P) (setq count (1+ count)))) - (unless no-re-sort-p - ;; If some were unmarked before, and if sort order is `s >' then re-sort. - (when (and (/= nb-marked count) (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (message "Marked: %d" count)))) - -;; This is similar to `dired-unmark-all-files'. -;;;###autoload -(defun bmkp-bmenu-unmark-all (mark &optional arg no-re-sort-p msg-p) ; Bound to `M-DEL', `U' in bmk list - "Remove a mark from each bookmark. -Hit the mark character (`>' or `D') to remove those marks, - or hit `RET' to remove all marks (both `>' and `D'). -With a prefix arg, you are queried to unmark each marked bookmark. -Use `\\[help-command]' during querying for help. - -If any bookmark was marked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* MARK is the mark character or a carriage-return character (`?\r'). -* Non-nil ARG (prefix arg) means query. -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P meands display a status message." - (interactive "cRemove marks (RET means all): \nP\ni\np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (require 'dired-aux) - (let* ((count 0) - (some-marked-p bmkp-bmenu-marked-bookmarks) - (inhibit-read-only t) - (case-fold-search nil) - (query nil) - (string (format "\n%c" mark)) - (help-form "Type SPC or `y' to unmark one bookmark, DEL or `n' to skip to next, -`!' to unmark all remaining bookmarks with no more questions.")) - (save-excursion - (goto-char (point-min)) - (forward-line (if (eq mark ?\r) - bmkp-bmenu-header-lines - (1- bmkp-bmenu-header-lines))) ; Because STRING starts with a newline. - (while (and (not (eobp)) - (if (eq mark ?\r) - (re-search-forward dired-re-mark nil t) - (let ((case-fold-search t)) ; Treat `d' the same as `D'. - (search-forward string nil t)))) - (when (or (prog1 (not arg) (when msg-p (message "Updating bookmark-list display..."))) - (let ((bmk (bookmark-bmenu-bookmark))) - (and bmk (dired-query 'query "Unmark bookmark `%s'? " bmk)))) - (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (forward-line -1) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were marked before, and if sort order is `s >', then re-sort. - (when (and some-marked-p (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) (message "1 mark removed") (message "%d marks removed" count))))) - -;;;###autoload -(defun bmkp-bmenu-regexp-mark (regexp &optional no-re-sort-p msg-p) ; Bound to `% m' in bookmark list - "Mark bookmarks that match REGEXP. -The entire bookmark line is tested: bookmark name and possibly file name. -Note too that if file names are not shown currently then the bookmark -name is padded at the right with spaces. - -If any bookmark was unmarked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive "sRegexp: \np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks))) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (and (not (eobp)) (re-search-forward regexp (point-max) t)) - (bookmark-bmenu-mark 'NO-RE-SORT-P) - (setq count (1+ count)))) - (unless no-re-sort-p - ;; If some were unmarked before, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (< nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count))))) - -;;;###autoload -(defun bmkp-bmenu-mark-autofile-bookmarks (&optional arg) ; Bound to `A M' in bookmark list - "Mark autofile bookmarks: those whose names are the same as their files. -With a prefix arg you are prompted for a prefix that each bookmark -name must have." - (interactive "P") - (if (not arg) - (bmkp-bmenu-mark-bookmarks-satisfying #'bmkp-autofile-bookmark-p) - (let ((prefix (read-string "Prefix for bookmark names: " nil nil ""))) - (bmkp-bmenu-mark-bookmarks-satisfying #'(lambda (bb) (bmkp-autofile-bookmark-p bb prefix)))))) - -;;;###autoload -(defun bmkp-bmenu-mark-autonamed-bookmarks () ; Bound to `# M' in bookmark list - "Mark autonamed bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying #'bmkp-autonamed-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmark-file-bookmarks () ; Bound to `Y M' in bookmark list - "Mark bookmark-file bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-bookmark-file-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-desktop-bookmarks () ; Bound to `K M' in bookmark list - "Mark desktop bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-desktop-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-dired-bookmarks () ; Bound to `M-d M-m' in bookmark list - "Mark Dired bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-dired-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-file-bookmarks (arg) ; Bound to `F M' in bookmark list - "Mark file bookmarks. -With a prefix argument, do not mark remote files or directories." - (interactive "P") - (bmkp-bmenu-mark-bookmarks-satisfying - (if arg 'bmkp-local-file-bookmark-p 'bmkp-file-bookmark-p))) - -;;;###autoload -(defun bmkp-bmenu-mark-gnus-bookmarks () ; Bound to `G M' in bookmark list - "Mark Gnus bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-gnus-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-image-bookmarks () ; Bound to `M-i M' in bookmark list - "Mark image-file bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-image-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-info-bookmarks () ; Bound to `I M' in bookmark list - "Mark Info bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-info-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-man-bookmarks () ; Bound to `M M' in bookmark list - "Mark `man' page bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-man-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-non-file-bookmarks () ; Bound to `B M' in bookmark list - "Mark non-file bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-non-file-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-orphaned-local-file-bookmarks (arg) ; Bound to `O M' in bookmark list - "Mark orphaned local-file bookmarks (their recorded files are not readable). -With a prefix argument, mark also remote orphaned files or directories." - (interactive "P") - (bmkp-bmenu-mark-bookmarks-satisfying - (if arg 'bmkp-orphaned-file-bookmark-p 'bmkp-orphaned-local-file-bookmark-p))) - -;;;###autoload -(defun bmkp-bmenu-mark-region-bookmarks () ; Bound to `R M' in bookmark list - "Mark bookmarks that record a region." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-region-bookmark-p)) - -(when (featurep 'bookmark+-lit) - (defun bmkp-bmenu-mark-lighted-bookmarks () ; Bound to `H M' in bookmark list - "Mark the highlighted bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-lighted-p))) - -;;;###autoload -(defun bmkp-bmenu-mark-specific-buffer-bookmarks (&optional buffer) ; `= b M' in bookmark list - "Mark bookmarks for BUFFER. -Interactively, read the name of the buffer. -If BUFFER is non-nil, set `bmkp-last-specific-buffer' to it." - (interactive (list (bmkp-completing-read-buffer-name))) - (when buffer (setq bmkp-last-specific-buffer buffer)) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-buffer-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-specific-file-bookmarks (&optional file) ; Bound to `= f M' in bookmark list - "Mark bookmarks for FILE, an absolute file name. -Interactively, read the file name. -If FILE is non-nil, set `bmkp-last-specific-file' to it." - (interactive (list (bmkp-completing-read-file-name))) - (when file (setq bmkp-last-specific-file file)) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-last-specific-file-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-temporary-bookmarks () ; Bound to `X M' in bookmark list - "Mark temporary bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-temporary-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-variable-list-bookmarks () ; Bound to `V M' in bookmark list - "Mark variable-list bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-variable-list-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-url-bookmarks () ; Bound to `M-u M-m' in bookmark list - "Mark URL bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-url-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-w3m-bookmarks () ; Bound to `W M' in bookmark list - "Mark W3M (URL) bookmarks." - (interactive) - (bmkp-bmenu-mark-bookmarks-satisfying 'bmkp-w3m-bookmark-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-satisfying (pred &optional no-re-sort-p msg-p) ; Not bound - "Mark bookmarks that satisfy predicate PRED. -If you use this interactively, you are responsible for entering a -symbol that names a unnary predicate. The function you provide is not -checked - it is simply applied to each bookmark to test it. - -If any bookmark was unmarked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive "aPredicate: \np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks)) - bmk) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (setq bmk (bookmark-bmenu-bookmark)) - (if (not (funcall pred bmk)) - (forward-line 1) - (bookmark-bmenu-mark 'NO-RE-SORT-P) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were unmarked before, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (< nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count))))) - -;;;###autoload -(defun bmkp-bmenu-toggle-marks (&optional backup no-re-sort-p msg-p) ; Bound to `t' in bookmark list - "Toggle marks: Unmark all marked bookmarks; mark all unmarked bookmarks. -This affects only the `>' mark, not the `D' flag. - -Interactively or with nil optional arg NO-RE-SORT-P, if the current -sort order is marked first or last (`s >'), then re-sort. - -Non-interactively, non-nil optional arg MSG-P means display a status -message." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((marked-count 0) - (unmarked-count 0)) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (if (not (bmkp-some-marked-p bmkp-latest-bookmark-alist)) - (bmkp-bmenu-mark-all no-re-sort-p) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (cond ((bmkp-bookmark-name-member (bookmark-bmenu-bookmark) bmkp-bmenu-marked-bookmarks) - (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) - (setq unmarked-count (1+ unmarked-count))) - (t - (bookmark-bmenu-mark 'NO-RE-SORT-P) - (setq marked-count (1+ marked-count))))))) - ;; If sort order is `s >' then re-sort. - (when (and (not no-re-sort-p) (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk)))) - (when msg-p (message "Marked: %d, unmarked: %d" marked-count unmarked-count)))) - -;;;###autoload -(defun bmkp-bmenu-toggle-marked-temporary/savable () ; Bound to `M-X' in bookmark list - "Toggle the temporary/savable status of each marked bookmark. -If none are marked, toggle status of the bookmark of the current line." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((o-str (and (not (looking-at "^>")) (bookmark-bmenu-bookmark))) - (o-point (point)) - (count-temp 0) - (count-save 0) - bmk) - (message "Toggling temporary status of marked bookmarks...") - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (while (re-search-forward "^>" (point-max) t) - (bmkp-toggle-temporary-bookmark (setq bmk (bookmark-bmenu-bookmark))) - (if (bmkp-temporary-bookmark-p bmk) - (setq count-temp (1+ count-temp)) - (setq count-save (1+ count-save)))) - (cond ((and (<= count-temp 0) (<= count-save 0)) - (if o-str - (bmkp-bmenu-goto-bookmark-named o-str) - (goto-char o-point) - (beginning-of-line)) - (bmkp-toggle-temporary-bookmark (bookmark-bmenu-bookmark) 'MSG) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P)) - (t - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (message "%d made temporary; %d made savable" count-temp count-save))) - (if o-str - (bmkp-bmenu-goto-bookmark-named o-str) - (goto-char o-point) - (beginning-of-line))) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - -;;;###autoload -(defun bmkp-bmenu-toggle-temporary () ; Bound to `C-M-X' in bookmark list - "Toggle whether bookmark of current line is temporary (not saved to disk)." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((o-str (bookmark-bmenu-bookmark)) - (o-point (point))) - (bmkp-toggle-temporary-bookmark (bookmark-bmenu-bookmark) 'MSG) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (if o-str - (bmkp-bmenu-goto-bookmark-named o-str) - (goto-char o-point) - (beginning-of-line)))) - -;;;###autoload -(defun bmkp-bmenu-dired-marked (dirbufname) ; Bound to `M-d >' in bookmark list - "Dired in another window for the marked file and directory bookmarks. - -Absolute file names are used for the entries in the Dired buffer. -The only entries are for the marked files and directories. These can -be located anywhere. (In Emacs versions prior to release 23.2, remote -bookmarks are ignored, because of Emacs bug #5478.) - -You are prompted for the Dired buffer name. The `default-directory' -of the buffer is the same as that of buffer `*Bookmark List*'." - (interactive (list (read-string "Dired buffer name: "))) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((files ()) - file) - (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only))) - (when (or (bmkp-local-file-bookmark-p bmk) - (> emacs-major-version 23) - (and (= emacs-major-version 23) (> emacs-minor-version 1))) - (setq file (bookmark-get-filename bmk)) - (unless (file-name-absolute-p file) (setq file (expand-file-name file))) ; Should not happen. - (push file files))) - (dired-other-window (cons dirbufname files)))) - -;;;###autoload -(defun bmkp-bmenu-delete-marked () ; Bound to `D' in bookmark list - "Delete all (visible) bookmarks that are marked `>', after confirmation." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-execute-deletions 'marked)) - -;;;###autoload -(defun bmkp-bmenu-load-marked-bookmark-file-bookmarks (&optional msg-p) ; Bound to `M-l' in bookmark list - "Load the bookmark-file bookmarks that are marked, in display order. -Non bookmark-file bookmarks that are marked are ignored. -You can sort the bookmark-list display to change the load order. - -NOTE: Automatically saving the current bookmark list is turned OFF -before loading, and it remains turned off until you explicitly turn it -back on. Bookmark+ does not assume that you want to automatically -save all of the newly loaded bookmarks in the same bookmark file. If -you do, just use \\`\\[bmkp-toggle-saving-bookmark-file]' \ -to turn saving back on." - (interactive "p") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((bmks (bmkp-remove-if-not #'bmkp-bookmark-file-bookmark-p - (bmkp-remove-if-not 'bmkp-marked-bookmark-p bmkp-sorted-alist))) - (bmk (bookmark-bmenu-bookmark))) - (unless bmks (error "No marked bookmark-file bookmarks")) - ;; Maybe save bookmarks first. - (when (or (not msg-p) - (and (> bookmark-alist-modification-count 0) - (condition-case err - (yes-or-no-p "Save current bookmarks? (`C-g': cancel load too) ") - (quit (error "OK - canceled")) - (error (error (error-message-string err)))))) - (bookmark-save)) - (when (or (not msg-p) - (yes-or-no-p "Load the marked bookmark-file bookmarks? ") - (error "OK - canceled")) - (when bookmark-save-flag ; Turn off autosaving. - (bmkp-toggle-saving-bookmark-file) ; No MSG-P arg - issue message below. - (when bookmark-save-flag (setq bookmark-save-flag nil)) ; Be sure it's off. - (when msg-p (message "Autosaving of current bookmark file is now OFF"))) - (when msg-p (message "Loading marked bookmark files...")) - - (dolist (bmk bmks) ; Load. - ;; USE BATCHP: Do not refresh list or display messages here - do that after iterate. - (bookmark-load (bookmark-get-filename bmk) nil 'BATCHP)) - - ;; $$$$$$ Should we do (bmkp-tags-list) here to update the tags cache? - - (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate. - (when msg-p (message "Autosaving is now OFF. Loaded: %s" - (mapconcat (lambda (bmk) (format "`%s'" (bmkp-bookmark-name-from-record bmk))) - bmks - ", ")))))) - -;;;###autoload -(defun bmkp-bmenu-make-sequence-from-marked (bookmark-name &optional dont-omit-p) ; Not bound - "Create or update a sequence bookmark from the visible marked bookmarks. -The bookmarks that are currently marked are recorded as a sequence, in -their current order in buffer `*Bookmark List*'. -When you \"jump\" to the sequence bookmark, the bookmarks in the -sequence are processed in order. - -By default, omit the marked bookmarks, after creating the sequence. -With a prefix arg, do not omit them. - -If a bookmark with the specified name already exists, it is -overwritten. If a sequence bookmark with the name already exists, -then you are prompted whether to add the marked bookmarks to the -beginning of the existing sequence (or simply replace it). - -Note that another existing sequence bookmark can be marked, and thus -included in the sequence bookmark created or updated. That is, you -can include other sequences within a sequence bookmark. - -Returns the bookmark (internal record) created or updated." - (interactive "sName of sequence bookmark: \nP") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((marked-bmks ()) - (count 0)) - (message "Making sequence from marked bookmarks...") - (save-excursion - (with-current-buffer "*Bookmark List*" - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (while (re-search-forward "^>" (point-max) t) - (push (bookmark-bmenu-bookmark) marked-bmks) - (setq count (1+ count))))) - (when (zerop count) (error "No marked bookmarks")) - (let ((new-seq (nreverse marked-bmks)) - (bmk (bmkp-get-bookmark-in-alist bookmark-name 'NOERROR))) - (when (and bmk (bmkp-sequence-bookmark-p bmk)) - (if (y-or-n-p (format "ADD marked to existing sequence `%s' (otherwise, REPLACES it)? " - bookmark-name)) - (setq new-seq (nconc new-seq (bookmark-prop-get bmk 'sequence))) - "OK, existing sequence will be replaced")) - (bookmark-store bookmark-name `((filename . ,bmkp-non-file-filename) - (position . 0) - (sequence ,@new-seq) - (handler . bmkp-jump-sequence)) - nil))) - (let ((new (bookmark-get-bookmark bookmark-name 'NOERROR))) - (unless (memq new bmkp-latest-bookmark-alist) - (setq bmkp-latest-bookmark-alist (cons new bmkp-latest-bookmark-alist))) - (unless dont-omit-p - (bmkp-bmenu-omit-marked) - (message "Marked bookmarks now OMITTED - use `bmkp-bmenu-show-only-omitted' to show")) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (bmkp-bmenu-goto-bookmark-named bookmark-name) - new)) - - -;;(@* "Omitted Bookmarks") -;; *** Omitted Bookmarks *** - -;;;###autoload -(defun bmkp-bmenu-omit () ; Not bound - "Omit this bookmark." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (push (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (message "Omitted 1 bookmark")) - -;;;###autoload -(defun bmkp-bmenu-omit/unomit-marked () ; Bound to `- >' in bookmark list - "Omit all marked bookmarks or, if showing only omitted ones, unomit." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (if (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only) - (bmkp-bmenu-unomit-marked) - (bmkp-bmenu-omit-marked))) - -;;;###autoload -(defun bmkp-bmenu-omit-marked () ; Bound to `- >' in bookmark list - "Omit all marked bookmarks. -They will henceforth be invisible to the bookmark list. -You can, however, use \\`\\[bmkp-bmenu-show-only-omitted]' to see them. -You can then mark some of them and use `\\[bmkp-bmenu-omit/unomit-marked]' to make those marked - available again for the bookmark list." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((o-str (and (not (looking-at "^>")) (bookmark-bmenu-bookmark))) - (o-point (point)) - (count 0)) - (message "Omitting marked bookmarks...") - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (while (re-search-forward "^>" (point-max) t) - (setq bmkp-bmenu-omitted-bookmarks (cons (bookmark-bmenu-bookmark) bmkp-bmenu-omitted-bookmarks) - count (1+ count))) - (if (<= count 0) - (message "No marked bookmarks") - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (message "Omitted %d bookmarks" count)) - (if o-str - (bmkp-bmenu-goto-bookmark-named o-str) - (goto-char o-point) - (beginning-of-line))) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - -;;;###autoload -(defun bmkp-bmenu-unomit-marked () ; `- >' in bookmark list when showing omitted bookmarks - "Remove all marked bookmarks from the list of omitted bookmarks. -They will henceforth be available for display in the bookmark list. -\(In order to see and then mark omitted bookmarks you must use \\\ -`\\[bmkp-bmenu-show-only-omitted]'.)" - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks to UN-omit")) - (unless (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only) - (error "You must use command `bmkp-bmenu-show-only-omitted' first")) - (let ((count 0)) - (message "UN-omitting marked bookmarks...") - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (while (re-search-forward "^>" (point-max) t) - (let ((bmk-name (bookmark-bmenu-bookmark))) - (when (bmkp-bookmark-name-member bmk-name bmkp-bmenu-omitted-bookmarks) - (setq bmkp-bmenu-omitted-bookmarks (bmkp-delete-bookmark-name-from-list - bmk-name bmkp-bmenu-omitted-bookmarks) - count (1+ count))))) - (if (<= count 0) - (message "No marked bookmarks") - (setq bmkp-bmenu-filter-function nil - bmkp-bmenu-title "All Bookmarks" - bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (message "UN-omitted %d bookmarks" count))) - (when (and (fboundp 'fit-frame-if-one-window) - (eq (selected-window) (get-buffer-window (get-buffer-create "*Bookmark List*") 0))) - (fit-frame-if-one-window))) - -;;;###autoload -(defun bmkp-bmenu-show-only-omitted () ; Bound to `- S' in bookmark list to show only omitted - "Show only the omitted bookmarks. -You can then mark some of them and use `bmkp-bmenu-unomit-marked' to - make those that are marked available again for the bookmark list." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (unless bmkp-bmenu-omitted-bookmarks (error "No omitted bookmarks")) - (setq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only - bmkp-bmenu-title "Omitted Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only omitted bookmarks are shown now"))) - - -;;(@* "Search-and-Replace Locations of Marked Bookmarks") -;; *** Search-and-Replace Locations of Marked Bookmarks *** - -(when (> emacs-major-version 22) - (defun bmkp-bmenu-isearch-marked-bookmarks () ; Bound to `M-s a C-s' in bookmark list - "Isearch the marked bookmark locations, in their current order." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only)))) - (bmkp-use-region nil)) ; Suppress region handling. - (bmkp-isearch-bookmarks bookmarks))) ; Defined in `bookmark+-1.el'. - - (defun bmkp-bmenu-isearch-marked-bookmarks-regexp () ; Bound to `M-s a M-C-s' in bookmark list - "Regexp Isearch the marked bookmark locations, in their current order." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((bookmarks (mapcar #'car (bmkp-sort-omit (bmkp-marked-bookmarks-only)))) - (bmkp-use-region nil)) ; Suppress region handling. - (bmkp-isearch-bookmarks-regexp bookmarks)))) ; Defined in `bookmark+-1.el'. - -;;;###autoload -(defun bmkp-bmenu-search-marked-bookmarks-regexp (regexp) ; Bound to `M-s a M-s' in bookmark list - "Search the marked file bookmarks, in their current order, for REGEXP. -Use `\\[tags-loop-continue]' to advance among the search hits. -Marked directory and non-file bookmarks are ignored." - (interactive "sSearch marked file bookmarks (regexp): ") - (bmkp-bmenu-barf-if-not-in-menu-list) - (tags-search regexp '(let ((files ()) - file) - (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only))) - (setq file (bookmark-get-filename bmk)) - (when (and (not (equal bmkp-non-file-filename file)) - (not (file-directory-p file))) - (push file files))) - (setq files (nreverse files))))) - -;;;###autoload -(defun bmkp-bmenu-query-replace-marked-bookmarks-regexp (from to ; Bound to `M-q' in bookmark list - &optional delimited) - "`query-replace-regexp' FROM with TO, for all marked file bookmarks. -DELIMITED (prefix arg) means replace only word-delimited matches. -If you exit (`\\[keyboard-quit]', `RET' or `q'), you can use \ -`\\[tags-loop-continue]' to resume where -you left off." - (interactive (let ((common (query-replace-read-args "Query replace regexp in marked files" t t))) - (list (nth 0 common) (nth 1 common) (nth 2 common)))) - (bmkp-bmenu-barf-if-not-in-menu-list) - (tags-query-replace from to delimited - '(let ((files ()) - file) - (dolist (bmk (bmkp-sort-omit (bmkp-marked-bookmarks-only))) - (setq file (bookmark-get-filename bmk)) - (let ((buffer (get-file-buffer file))) - (when (and buffer (with-current-buffer buffer buffer-read-only)) - (error "File `%s' is visited read-only" file))) - (when (and (not (equal bmkp-non-file-filename file)) - (not (file-directory-p file))) - (push file files))) - (setq files (nreverse files))))) - - -;;(@* "Tags") -;; *** Tags *** - -;;;###autoload -(defun bmkp-bmenu-show-only-tagged () ; Bound to `T S' in bookmark list - "Display (only) the bookmarks that have tags." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-bmenu-filter-function 'bmkp-some-tags-alist-only - bmkp-bmenu-title "Tagged Bookmarks") - (let ((bookmark-alist (funcall bmkp-bmenu-filter-function))) - (setq bmkp-latest-bookmark-alist bookmark-alist) - (bookmark-bmenu-list 'filteredp)) - (when (interactive-p) - (bmkp-msg-about-sort-order (bmkp-current-sort-order) "Only tagged bookmarks are shown"))) - -;; Not bound, but `T 0' is `bmkp-remove-all-tags'. -;;;###autoload -(defun bmkp-bmenu-remove-all-tags (&optional must-confirm-p) - "Remove all tags from this bookmark. -Interactively, you are required to confirm." - (interactive "p") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bookmark (bookmark-bmenu-bookmark))) - (when (and must-confirm-p (null (bmkp-get-tags bookmark))) - (error "Bookmark has no tags to remove")) - (when (or (not must-confirm-p) (y-or-n-p "Remove all tags from this bookmark? ")) - (bmkp-remove-all-tags bookmark)))) - -;;;###autoload -(defun bmkp-bmenu-add-tags () ; Only on `mouse-3' menu in bookmark list. - "Add some tags to this bookmark." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((nb-added (bmkp-add-tags (bookmark-bmenu-bookmark) (bmkp-read-tags-completing)))) - (when (and (< nb-added 0) ; It was untagged but is now tagged. If `s t' then re-sort. - (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) ; Hardcoded value, for now. - (bmkp-bmenu-sort-tagged-before-untagged)) - nb-added)) - -;;;###autoload -(defun bmkp-bmenu-set-tag-value () ; Bound to `T v' in bookmark list - "Set the value of one of this bookmark's tags." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((this-bmk (bookmark-bmenu-bookmark))) - (bmkp-set-tag-value - this-bmk - (bmkp-read-tag-completing "Tag: " (mapcar 'bmkp-full-tag (bmkp-get-tags this-bmk))) - (read (read-string "Value: ")) - nil - 'MSG))) - -;;;###autoload -(defun bmkp-bmenu-set-tag-value-for-marked (tag value &optional msg-p) ; `T > v' in bookmark list - "Set the value of TAG to VALUE, for each of the marked bookmarks. -If any of the bookmarks has no tag named TAG, then add one with VALUE." - (interactive (list (bmkp-read-tag-completing) (read (read-string "Value: ")) 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (when msg-p (message "Setting tag values...")) - (let ((marked (bmkp-marked-bookmarks-only))) - (unless marked (error "No marked bookmarks")) - (when msg-p (message "Setting tag values...")) - (bmkp-set-tag-value-for-bookmarks marked tag value)) - (when (and msg-p tag) (message "Setting tag values...done"))) - -;;;###autoload -(defun bmkp-bmenu-remove-tags (&optional msg-p) ; Only on `mouse-3' menu in bookmark list. - "Remove some tags from this bookmark." - (interactive "p") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let* ((bmk (bookmark-bmenu-bookmark)) - (nb-removed (bmkp-remove-tags bmk - (bmkp-read-tags-completing - (mapcar 'bmkp-full-tag (bmkp-get-tags bmk)) t) - nil - msg-p))) - (when (and (< nb-removed 0) ; It was tagged but is now untagged. If `s t' then re-sort. - (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) ; Hardcoded value, for now. - (bmkp-bmenu-sort-tagged-before-untagged)) - nb-removed)) - -;;;###autoload -(defun bmkp-bmenu-add-tags-to-marked (tags &optional msg-p) ; Bound to `T > +' in bookmark list - "Add TAGS to each of the marked bookmarks. -TAGS is a list of strings. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter each tag, but you are not limited to -choosing existing tags." - (interactive (list (bmkp-read-tags-completing) 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((marked (bmkp-marked-bookmarks-only)) - (bmk (bookmark-bmenu-bookmark)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag)) ; Save at most once, after `dolist'. - (some-were-untagged-p nil)) - (unless marked (error "No marked bookmarks")) - (when msg-p (message "Adding tags...")) - (dolist (bmk (mapcar #'car marked)) - (when (< (bmkp-add-tags bmk tags 'NO-UPDATE-P) 0) (setq some-were-untagged-p t))) - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate. - (when (and some-were-untagged-p (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) - (bmkp-bmenu-sort-tagged-before-untagged)) - (when (and msg-p tags) (message "Tags added: %S" tags)))) - -;;;###autoload -(defun bmkp-bmenu-remove-tags-from-marked (tags &optional msg-p) ; Bound to `T > -' in bookmark list - "Remove TAGS from each of the marked bookmarks. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter each tag." - (interactive (let ((cand-tags ())) - (dolist (bmk (bmkp-marked-bookmarks-only)) - (setq cand-tags (bmkp-set-union cand-tags (bmkp-get-tags bmk)))) - (unless cand-tags (error "No tags to remove")) - (list (bmkp-read-tags-completing cand-tags t) 'MSG))) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((marked (bmkp-marked-bookmarks-only)) - (bmk (bookmark-bmenu-bookmark)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag)) ; Save at most once, after `dolist'. - (some-are-now-untagged-p nil)) - (unless marked (error "No marked bookmarks")) - (when msg-p (message "Removing tags...")) - (dolist (bmk (mapcar #'car marked)) - (when (< (bmkp-remove-tags bmk tags 'NO-UPDATE-P) 0) (setq some-are-now-untagged-p t))) - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate. - (when (and some-are-now-untagged-p (equal bmkp-sort-comparer '((bmkp-tagged-cp) bmkp-alpha-p))) - (bmkp-bmenu-sort-tagged-before-untagged)) - (when (and msg-p tags) (message "Tags removed: %S" tags)))) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-tagged-regexp (regexp &optional notp no-re-sort-p msg-p) - ; `T m %' in bookmark list - "Mark bookmarks any of whose tags match REGEXP. -With a prefix arg, mark all that are tagged but have no matching tags. - -If any bookmark was unmarked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil NOTP: see prefix arg, above. -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive "sRegexp: \nP\ni\p") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks)) - tags anyp) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark)) - anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag))) - tags))) - (if (not (and tags (if notp (not anyp) anyp))) - (forward-line 1) - (bookmark-bmenu-mark 'NO-RE-SORT-P) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were unmarked before, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (/= nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count))))) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-tagged-all (tags &optional nonep msg-p) ; `T m *' in bookmark list - "Mark all visible bookmarks that are tagged with *each* tag in TAGS. -As a special case, if TAGS is empty, then mark the bookmarks that have -any tags at all (i.e., at least one tag). - -With a prefix arg, mark all that are *not* tagged with *any* TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags nonep nil nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-tagged-none (tags &optional allp msg-p) ; `T m ~ +' in bookmark list - "Mark all visible bookmarks that are not tagged with *any* tag in TAGS. -As a special case, if TAGS is empty, then mark the bookmarks that have -no tags at all. - -With a prefix arg, mark all that are tagged with *each* tag in TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) nil nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-tagged-some (tags &optional somenotp msg-p) ; `T m +' in bookmark list - "Mark all visible bookmarks that are tagged with *some* tag in TAGS. -As a special case, if TAGS is empty, then mark the bookmarks that have -any tags at all. - -With a prefix arg, mark all that are *not* tagged with *all* TAGS. - -Hit `RET' to enter each tag, then hit `RET' again after the last tag. -You can use completion to enter each tag." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp nil nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-mark-bookmarks-tagged-not-all (tags &optional somep msg-p) ; `T m ~ *' in bmk list - "Mark all visible bookmarks that are *not* tagged with *all* TAGS. -As a special case, if TAGS is empty, then mark the bookmarks that have -no tags at all. - -With a prefix arg, mark all that are tagged with *some* tag in TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) nil nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-unmark-bookmarks-tagged-regexp (regexp &optional notp no-re-sort-p msg-p) - ; `T u %' in bookmark list - "Unmark bookmarks any of whose tags match REGEXP. -With a prefix arg, mark all that are tagged but have no matching tags. - -If any bookmark was marked before, and if the sort order is marked -first or last (`s >'), then re-sort. - -Non-interactively: -* Non-nil NOTP: see prefix arg, above. -* Non-nil optional arg NO-RE-SORT-P inhibits re-sorting. -* Non-nil optional arg MSG-P means display a status message." - (interactive "sRegexp: \nP\ni\np") - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks)) - tags anyp) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (setq tags (bmkp-get-tags (bookmark-bmenu-bookmark)) - anyp (and tags (bmkp-some (lambda (tag) (string-match regexp (bmkp-tag-name tag))) - tags))) - (if (not (and tags (if notp (not anyp) anyp))) - (forward-line 1) - (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were marked before, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (/= nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count))))) - -;;;###autoload -(defun bmkp-bmenu-unmark-bookmarks-tagged-all (tags &optional nonep msg-p) ; `T u *' in bookmark list - "Unmark all visible bookmarks that are tagged with *each* tag in TAGS. -As a special case, if TAGS is empty, then unmark the bookmarks that have -any tags at all. - -With a prefix arg, unmark all that are *not* tagged with *any* TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags nonep 'UNMARK nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-unmark-bookmarks-tagged-none (tags &optional allp msg-p) ; `T u ~ +' in bookmark list - "Unmark all visible bookmarks that are *not* tagged with *any* TAGS. -As a special case, if TAGS is empty, then unmark the bookmarks that have -no tags at all. - -With a prefix arg, unmark all that are tagged with *each* tag in TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none tags (not allp) 'UNMARK nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-unmark-bookmarks-tagged-some (tags &optional somenotp msg-p) ; `T u +' in bmk list - "Unmark all visible bookmarks that are tagged with *some* tag in TAGS. -As a special case, if TAGS is empty, then unmark the bookmarks that have -any tags at all. - -With a prefix arg, unmark all that are *not* tagged with *all* TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags somenotp 'UNMARK nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-unmark-bookmarks-tagged-not-all (tags &optional somep msg-p) ; `T u ~ *' in bmk list - "Unmark all visible bookmarks that are *not* tagged with *all* TAGS. -As a special case, if TAGS is empty, then unmark the bookmarks that have -no tags at all. - -With a prefix arg, unmark all that are tagged with *some* TAGS." - (interactive (list (bmkp-read-tags-completing) current-prefix-arg 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all tags (not somep) 'UNMARK nil msg-p)) - -(defun bmkp-bmenu-mark/unmark-bookmarks-tagged-all/none (tags &optional nonep unmarkp no-re-sort-p msg-p) - "Mark or unmark visible bookmarks tagged with all or none of TAGS. -TAGS is a list of strings, the tag names. -Non-nil NONEP means mark/unmark bookmarks that have none of the TAGS. -Non-nil UNMARKP means unmark; nil means mark. -Non-nil NO-RE-SORT-P inhibits re-sorting. -Non-nil MSG-P means display a status message. - -As a special case, if TAGS is empty, then mark or unmark the bookmarks -that have any tags at all, or if NONEP is non-nil then mark or unmark -those that have no tags at all. - -If any bookmark was (un)marked before but is not afterward, and if the -sort order is marked first or last (`s >'), then re-sort." - (with-current-buffer "*Bookmark List*" - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks)) - bmktags presentp) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark))) - (if (not (if (null tags) - (if nonep (not bmktags) bmktags) - (and bmktags (catch 'bmkp-b-mu-b-t-an - (dolist (tag tags) - (setq presentp (assoc-default tag bmktags nil t)) - (unless (if nonep (not presentp) presentp) - (throw 'bmkp-b-mu-b-t-an nil))) - t)))) - (forward-line 1) - (if unmarkp (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (bookmark-bmenu-mark 'NO-RE-SORT-P)) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were (un)marked before but not afterward, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (/= nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p (if (= 1 count) - (message "1 bookmark matched") - (message "%d bookmarks matched" count)))))) - -(defun bmkp-bmenu-mark/unmark-bookmarks-tagged-some/not-all (tags &optional notallp unmarkp - no-re-sort-p msg-p) - "Mark or unmark visible bookmarks tagged with any or not all of TAGS. -TAGS is a list of strings, the tag names. -Non-nil NOTALLP means mark/unmark bookmarks that do not have all TAGS. -Non-nil UNMARKP means unmark; nil means mark. -Non-nil NO-RE-SORT-P inhibits re-sorting. -Non-nil MSG-P means display a status message. - -As a special case, if TAGS is empty, then mark or unmark the bookmarks -that have any tags at all, or if NOTALLP is non-nil then mark or -unmark those that have no tags at all. - -If any bookmark was (un)marked before but is not afterward, and if the -sort order is marked first or last (`s >'), then re-sort." - (with-current-buffer "*Bookmark List*" - (let ((count 0) - (nb-marked (length bmkp-bmenu-marked-bookmarks)) - bmktags presentp) - (save-excursion - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (when msg-p (message "Updating bookmark-list display...")) - (while (not (eobp)) - (setq bmktags (bmkp-get-tags (bookmark-bmenu-bookmark))) - (if (not (if (null tags) - (if notallp (not bmktags) bmktags) - (and bmktags (catch 'bmkp-b-mu-b-t-sna - (dolist (tag tags) - (setq presentp (assoc-default tag bmktags nil t)) - (when (if notallp (not presentp) presentp) - (throw 'bmkp-b-mu-b-t-sna t))) - nil)))) - (forward-line 1) - (if unmarkp (bookmark-bmenu-unmark nil 'NO-RE-SORT-P) (bookmark-bmenu-mark 'NO-RE-SORT-P)) - (setq count (1+ count))))) - (unless no-re-sort-p - ;; If some were (un)marked before but not afterward, and if sort order is `s >', then re-sort. - (when (and (equal bmkp-sort-comparer '((bmkp-marked-cp) bmkp-alpha-p)) - (/= nb-marked (length bmkp-bmenu-marked-bookmarks))) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk (bmkp-bmenu-goto-bookmark-named current-bmk))))) - (when msg-p - (if (= 1 count) (message "1 bookmark matched") (message "%d bookmarks matched" count)))))) - -;;;###autoload -(defun bmkp-bmenu-copy-tags (&optional msg-p) ; `T c', `T M-w', `mouse-3' menu in bookmark list. - "Copy tags from this bookmark, so you can paste them to another bookmark." - (interactive (list 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-copy-tags (bookmark-bmenu-bookmark) msg-p)) - -;;;###autoload -(defun bmkp-bmenu-paste-add-tags (&optional msg-p) ; `T p', `T C-y', `mouse-3' menu in bookmark list. - "Add tags to this bookmark that were copied from another bookmark." - (interactive (list 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-paste-add-tags (bookmark-bmenu-bookmark) nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-paste-replace-tags (&optional msg-p) ; `T q', `mouse-3' menu. - "Replace tags for this bookmark with those copied from another bookmark." - (interactive (list 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-paste-replace-tags (bookmark-bmenu-bookmark) nil msg-p)) - -;;;###autoload -(defun bmkp-bmenu-paste-add-tags-to-marked (&optional msg-p) ; `T > p', `T > C-y' - "Add tags that were copied from another bookmark to the marked bookmarks." - (interactive (list 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((marked (bmkp-marked-bookmarks-only)) - (bmk (bookmark-bmenu-bookmark)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (unless marked (error "No marked bookmarks")) - (when msg-p (message "Adding tags...")) - (dolist (bmk marked) (bmkp-paste-add-tags bmk 'NO-UPDATE-P)) - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate. - (when msg-p (message "Tags added: %S" bmkp-copied-tags)))) - -;;;###autoload -(defun bmkp-bmenu-paste-replace-tags-for-marked (&optional msg-p) ; `T > q' - "Replace tags for the marked bookmarks with tags copied previously." - (interactive (list 'MSG)) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let ((marked (bmkp-marked-bookmarks-only)) - (bmk (bookmark-bmenu-bookmark)) - (bookmark-save-flag (and (not bmkp-count-multi-mods-as-one-flag) - bookmark-save-flag))) ; Save at most once, after `dolist'. - (unless marked (error "No marked bookmarks")) - (when msg-p (message "Replacing tags...")) - (dolist (bmk marked) (bmkp-paste-replace-tags bmk 'NO-UPDATE-P)) - (bmkp-tags-list) ; Update the tags cache now, after iterate. - (bmkp-refresh-menu-list bmk (not msg-p)) ; Refresh after iterate. - (when msg-p (message "Replacement tags: %S" bmkp-copied-tags)))) - - -;;(@* "General Menu-List (`-*bmenu-*') Commands and Functions") -;; *** General Menu-List (`-*bmenu-*') Commands and Functions *** - -;;;###autoload -(defun bmkp-bmenu-show-or-edit-annotation (editp msg-p) - "Show annotation for current buffer in another window. `C-u': Edit. -With no prefix arg, show the annotation. With a prefix arg, edit it." - (interactive "P\np") - (if editp - (bookmark-bmenu-edit-annotation) - (bookmark-bmenu-show-annotation msg-p))) - -;;;###autoload -(defun bmkp-bmenu-w32-open () ; Bound to `M-RET' in bookmark list. - "Use `w32-browser' to open this bookmark." - (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-this-window))) - -;;;###autoload -(defun bmkp-bmenu-w32-open-with-mouse (event) ; Bound to `M-mouse-2' in bookmark list. - "Use `w32-browser' to open the bookmark clicked." - (interactive "e") - (save-excursion - (with-current-buffer (window-buffer (posn-window (event-end event))) - (save-excursion (goto-char (posn-point (event-end event))) - (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-other-window)))))) - -;;;###autoload -(defun bmkp-bmenu-w32-open-select () ; Bound to `M-o' in bookmark-list. - "Use `w32-browser' to open this bookmark and all marked bookmarks." - (interactive) (let ((bmkp-use-w32-browser-p t)) (bookmark-bmenu-select))) - -;;;###autoload -(defun bmkp-bmenu-mode-status-help () ; Bound to `C-h m' and `?' in bookmark list - "`describe-mode' + current status of `*Bookmark List*' + face legend." - (interactive) - (unless (string= (buffer-name) "*Help*") (bmkp-bmenu-barf-if-not-in-menu-list)) - (with-current-buffer (get-buffer-create "*Help*") - (with-output-to-temp-buffer "*Help*" - (let ((buffer-read-only nil) - top) - (erase-buffer) - (save-excursion - (let ((standard-output (current-buffer))) - (if (> emacs-major-version 21) - (describe-function-1 'bookmark-bmenu-mode) - (describe-function-1 'bookmark-bmenu-mode nil t))) - (help-setup-xref (list #'bmkp-bmenu-mode-status-help) (interactive-p)) - (goto-char (point-min)) - (search-forward ; This depends on the text written by `bookmark-bmenu-mode'. - "Other keys are available everywhere." nil t) - (delete-region (point-min) (point)) ; Get rid of intro from `describe-function'. - (insert "*************************** Bookmark List ***************************\n\n") - (insert "Major mode for editing a list of bookmarks.\n") - (setq top (copy-marker (point))) - ;; Add buttons to access help and Customize. - ;; Not for Emacs 21.3 - its `help-insert-xref-button' signature is different. - (when (and (> emacs-major-version 21) ; In `help-mode.el'. - (condition-case nil (require 'help-mode nil t) (error nil)) - (fboundp 'help-insert-xref-button)) - (goto-char (point-min)) - (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button) - (insert " ") - (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button) - (insert " ") - (help-insert-xref-button "[Customize]" 'bmkp-customize-button) - (insert "\n\n") - (goto-char (point-max)) - (insert "\nSend a Bookmark+ bug report: `\\[icicle-send-bug-report]'.\n\n") - (help-insert-xref-button "[Doc in Commentary]" 'bmkp-commentary-button) - (insert " ") - (help-insert-xref-button "[Doc on the Web]" 'bmkp-help-button) - (insert " ") - (help-insert-xref-button "[Customize]" 'bmkp-customize-button) - (insert "\n\n") - (goto-char (point-min)) - (forward-line 2)) - (goto-char top) - (insert (format - "\n\nCurrent Status\n--------------\n -Bookmark file:\t%s\nSorted:\t\t\t%s\nFiltering:\t\t%s\nMarked:\t\t\t%d\nOmitted:\t\t%d\n\ -Autosave bookmarks:\t%s\nAutosave list display:\t%s\n\n\n" - bmkp-current-bookmark-file - (if (not bmkp-sort-comparer) - "no" - (format "%s%s" (bmkp-current-sort-order) - ;; Code essentially the same as found in `bmkp-msg-about-sort-order'. - (if (not (and (consp bmkp-sort-comparer) ; Ordinary single predicate - (consp (car bmkp-sort-comparer)))) - (if bmkp-reverse-sort-p "; reversed" "") - (if (not (cadr (car bmkp-sort-comparer))) - ;; Single PRED. - (if (or (and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p)) - (and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p))) - "; reversed" - "") - ;; In case we want to distinguish: - ;; (if (and bmkp-reverse-sort-p - ;; (not bmkp-reverse-multi-sort-p)) - ;; "; reversed" - ;; (if (and bmkp-reverse-multi-sort-p - ;; (not bmkp-reverse-sort-p)) - ;; "; reversed +" - ;; "")) - - ;; At least two PREDs. - (cond ((and bmkp-reverse-sort-p (not bmkp-reverse-multi-sort-p)) - "; reversed") - ((and bmkp-reverse-multi-sort-p (not bmkp-reverse-sort-p)) - "; each predicate group reversed") - ((and bmkp-reverse-multi-sort-p bmkp-reverse-sort-p) - "; order of predicate groups reversed") - (t "")))))) - (or (and bmkp-bmenu-filter-function (downcase bmkp-bmenu-title)) "none") - (length bmkp-bmenu-marked-bookmarks) - (length bmkp-bmenu-omitted-bookmarks) - (if bookmark-save-flag "yes" "no") - (if bmkp-bmenu-state-file "yes" "no"))) - - ;; Add markings legend. - (let ((mm ">") - (DD "D") - (tt "t") - (aa "a") - (XX "X") - (mod "*")) - (put-text-property 0 1 'face 'bmkp-D-mark DD) - (put-text-property 0 1 'face 'bmkp-t-mark tt) - (put-text-property 0 1 'face 'bmkp-a-mark aa) - (put-text-property 0 1 'face 'bmkp-X-mark XX) - (put-text-property 0 1 'face 'bmkp-*-mark mod) - (insert "Legend for Markings\n-------------------\n") - (insert (concat mm "\t- marked\n")) - (insert (concat DD "\t- flagged for deletion (`x' to delete all such)\n")) - (insert (concat tt "\t- tagged (`C-h C-RET' to see)\n")) - (insert (concat aa "\t- annotated (`C-h C-RET' to see)\n")) - (insert (concat mod "\t- modified (not saved)\n")) - (insert (concat XX "\t- temporary (will not be saved)\n")) - (insert "\n\n")) - - ;; Add face legend. - (let ((gnus "Gnus\n") - (info "Info node\n") - (man "Man page\n") - (url "URL\n") - (local-no-region "Local file with no region\n") - (local-w-region "Local file with a region\n") - (buffer "Buffer\n") - (no-buf "No current buffer\n") - (bad "Possibly invalid bookmark\n") - (remote "Remote file/directory or Dired buffer (could have wildcards)\n") - (sudo "Remote accessed by `su' or `sudo'\n") - (local-dir "Local directory or Dired buffer (could have wildcards)\n") - (file-handler "Bookmark with property `file-handler'\n") - (bookmark-list "*Bookmark List*\n") - (bookmark-file "Bookmark file\n") - (desktop "Desktop\n") - (sequence "Sequence\n") - (variable-list "Variable list\n") - (function "Function\n")) - (put-text-property 0 (1- (length gnus)) 'face 'bmkp-gnus gnus) - (put-text-property 0 (1- (length info)) 'face 'bmkp-info info) - (put-text-property 0 (1- (length man)) 'face 'bmkp-man man) - (put-text-property 0 (1- (length url)) 'face 'bmkp-url url) - (put-text-property 0 (1- (length local-no-region)) - 'face 'bmkp-local-file-without-region local-no-region) - (put-text-property 0 (1- (length local-w-region)) - 'face 'bmkp-local-file-with-region local-w-region) - (put-text-property 0 (1- (length buffer)) 'face 'bmkp-buffer buffer) - (put-text-property 0 (1- (length no-buf)) 'face 'bmkp-non-file no-buf) - (put-text-property 0 (1- (length bad)) 'face 'bmkp-bad-bookmark bad) - (put-text-property 0 (1- (length remote)) 'face 'bmkp-remote-file remote) - (put-text-property 0 (1- (length sudo)) 'face 'bmkp-su-or-sudo sudo) - (put-text-property 0 (1- (length local-dir)) - 'face 'bmkp-local-directory local-dir) - (put-text-property 0 (1- (length file-handler)) 'face 'bmkp-file-handler file-handler) - (put-text-property 0 (1- (length bookmark-list)) - 'face 'bmkp-bookmark-list bookmark-list) - (put-text-property 0 (1- (length bookmark-file)) - 'face 'bmkp-bookmark-file bookmark-file) - (put-text-property 0 (1- (length desktop)) 'face 'bmkp-desktop desktop) - (put-text-property 0 (1- (length sequence)) 'face 'bmkp-sequence sequence) - (put-text-property 0 (1- (length variable-list)) 'face 'bmkp-variable-list variable-list) - (put-text-property 0 (1- (length function)) 'face 'bmkp-function function) - (insert "Legend for Bookmark Types\n-------------------------\n") - (when (and (fboundp 'display-images-p) (display-images-p) - bmkp-bmenu-image-bookmark-icon-file - (file-readable-p bmkp-bmenu-image-bookmark-icon-file)) - (insert-image (create-image bmkp-bmenu-image-bookmark-icon-file nil nil :ascent 95)) - (insert "Image file\n")) - (insert gnus) (insert info) (insert man) (insert url) (insert local-no-region) - (insert local-w-region) (insert buffer) (insert no-buf) (insert remote) - (insert sudo) (insert local-dir) (insert file-handler) (insert bookmark-list) - (insert bookmark-file) (insert desktop) (insert sequence) (insert variable-list) - (insert function) (insert bad) - (insert "\n\n") - (insert "More bookmarking help below. Each line represents an Emacs bookmark.\n") - (insert "Keys without prefix `C-x' are available only in `*Bookmark List*'.\n") - (insert "Other keys are available everywhere."))))))) - -(when (and (> emacs-major-version 21) - (condition-case nil (require 'help-mode nil t) (error nil)) - (get 'help-xref 'button-category-symbol)) ; In `button.el' - (define-button-type 'bmkp-help-button - :supertype 'help-xref - 'help-function #'(lambda () (browse-url "http://www.emacswiki.org/emacs/BookmarkPlus")) - 'help-echo - (purecopy "mouse-2, RET: Bookmark+ documentation on the Emacs Wiki (requires Internet access)")) - (define-button-type 'bmkp-commentary-button - :supertype 'help-xref - 'help-function #'(lambda () - (message "Getting Bookmark+ doc from file commentary...") - (finder-commentary "bookmark+-doc") - (when (condition-case nil (require 'linkd nil t) (error nil)) (linkd-mode 1)) - (when (condition-case nil (require 'fit-frame nil t) (error nil)) - (fit-frame))) - 'help-echo (purecopy "mouse-2, RET: Bookmark+ documentation (no Internet needed)")) - (define-button-type 'bmkp-customize-button - :supertype 'help-xref - 'help-function #'(lambda () (customize-group-other-window 'bookmark-plus)) - 'help-echo (purecopy "mouse-2, RET: Customize/Browse Bookmark+ Options & Faces"))) - -;;;###autoload -(defun bmkp-bmenu-define-jump-marked-command () ; Bound to `M-c' in bookmark list - "Define a command to jump to a bookmark that is one of those now marked. -The bookmarks marked now will be those that are completion candidates -for the command (but omitted bookmarks are excluded). -Save the command definition in `bmkp-bmenu-commands-file'." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (let* ((cands (mapcar #'list - (bmkp-remove-if #'(lambda (bmk) - (bmkp-bookmark-name-member bmk - bmkp-bmenu-omitted-bookmarks)) - bmkp-bmenu-marked-bookmarks))) - (fn (intern (read-string "Define command to jump to a bookmark now marked: " nil - 'bmkp-bmenu-define-command-history))) - (def `(defun ,fn (bookmark-name &optional use-region-p) - (interactive (list (bmkp-read-bookmark-for-type nil ',cands t) current-prefix-arg)) - (bmkp-jump-1 bookmark-name 'bmkp-select-buffer-other-window use-region-p)))) - (eval def) - (with-current-buffer (get-buffer-create " *User Bookmark List Commands*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil)) - (pp def (current-buffer)) - (insert "\n") - (condition-case nil - (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append) - (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file))) - (kill-buffer (current-buffer)))) - (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file))) - -;;;###autoload -(defun bmkp-bmenu-define-command () ; Bound to `c' in bookmark list - "Define a command to use the current sort order, filter, and omit list. -Prompt for the command name. Save the command definition in -`bmkp-bmenu-commands-file'. - -The current sort order, filter function, omit list, and title for -buffer `*Bookmark List*' are encapsulated as part of the command. -Use the command at any time to restore them." - (interactive) - (let* ((fn (intern (read-string "Define sort+filter command: " nil - 'bmkp-bmenu-define-command-history))) - (def `(defun ,fn () - (interactive) - (setq - bmkp-sort-comparer ',bmkp-sort-comparer - bmkp-reverse-sort-p ',bmkp-reverse-sort-p - bmkp-reverse-multi-sort-p ',bmkp-reverse-multi-sort-p - bmkp-bmenu-filter-function ',bmkp-bmenu-filter-function - bmkp-bmenu-filter-pattern ',bmkp-bmenu-filter-pattern - bmkp-bmenu-omitted-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-omitted-bookmarks) - bmkp-bmenu-title ',bmkp-bmenu-title - bookmark-bmenu-toggle-filenames ',bookmark-bmenu-toggle-filenames) - (bmkp-bmenu-refresh-menu-list) - (when (interactive-p) - (bmkp-msg-about-sort-order - (car (rassoc bmkp-sort-comparer bmkp-sort-orders-alist))))))) - (eval def) - (with-current-buffer (get-buffer-create " *User Bookmark List Commands*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil)) - (pp def (current-buffer)) - (insert "\n") - (condition-case nil - (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append) - (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file))) - (kill-buffer (current-buffer)))) - (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file))) - -;;;###autoload -(defun bmkp-bmenu-define-full-snapshot-command () ; Bound to `C' in bookmark list - "Define a command to restore the current bookmark-list state. -Prompt for the command name. Save the command definition in -`bmkp-bmenu-commands-file'. - -Be aware that the command definition can be quite large, since it -copies the current bookmark list and accessory lists (hidden -bookmarks, marked bookmarks, etc.). For a lighter weight command, use -`bmkp-bmenu-define-full-snapshot-command' instead. That records only -the omit list and the sort & filter information." - (interactive) - (let* ((fn (intern (read-string "Define restore-snapshot command: " nil - 'bmkp-bmenu-define-command-history))) - (def `(defun ,fn () - (interactive) - (setq - bmkp-sort-comparer ',bmkp-sort-comparer - bmkp-reverse-sort-p ',bmkp-reverse-sort-p - bmkp-reverse-multi-sort-p ',bmkp-reverse-multi-sort-p - bmkp-latest-bookmark-alist ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-latest-bookmark-alist) - bmkp-bmenu-omitted-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-omitted-bookmarks) - bmkp-bmenu-marked-bookmarks ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-marked-bookmarks) - bmkp-bmenu-filter-function ',bmkp-bmenu-filter-function - bmkp-bmenu-filter-pattern ',bmkp-bmenu-filter-pattern - bmkp-bmenu-title ',bmkp-bmenu-title - bmkp-last-bmenu-bookmark ',(and (get-buffer "*Bookmark List*") - (with-current-buffer - (get-buffer "*Bookmark List*") - (bookmark-bmenu-bookmark))) - bmkp-last-specific-buffer ',bmkp-last-specific-buffer - bmkp-last-specific-file ',bmkp-last-specific-file - bookmark-bmenu-toggle-filenames ',bookmark-bmenu-toggle-filenames - bmkp-bmenu-before-hide-marked-alist ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-before-hide-marked-alist) - bmkp-bmenu-before-hide-unmarked-alist ',(bmkp-maybe-unpropertize-bookmark-names - bmkp-bmenu-before-hide-unmarked-alist) - bmkp-last-bookmark-file ',bmkp-last-bookmark-file - bmkp-current-bookmark-file ',bmkp-current-bookmark-file) - ;;(bmkp-bmenu-refresh-menu-list) - (let ((bookmark-alist (or bmkp-latest-bookmark-alist bookmark-alist))) - (bmkp-bmenu-list-1 'filteredp nil (interactive-p))) - (when bmkp-last-bmenu-bookmark - (with-current-buffer (get-buffer "*Bookmark List*") - (bmkp-bmenu-goto-bookmark-named bmkp-last-bmenu-bookmark))) - (when (interactive-p) - (bmkp-msg-about-sort-order - (car (rassoc bmkp-sort-comparer bmkp-sort-orders-alist))))))) - (eval def) - (with-current-buffer (get-buffer-create " *User Bookmark List Commands*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil) - (print-circle t)) - (pp def (current-buffer)) - (insert "\n") - (condition-case nil - (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append) - (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file))) - (kill-buffer (current-buffer)))) - (message "Command `%s' defined and saved in file `%s'" fn bmkp-bmenu-commands-file))) - -(defun bmkp-maybe-unpropertize-bookmark-names (list) - "Strip properties from the bookmark names in a copy of LIST. -LIST is a bookmark alist or a list of bookmark names (strings). -Return the updated copy. - -Note, however, that this is a shallow copy, so the names are also -stripped within any alist elements of the original LIST. - -We do this because Emacs 20 has no `print-circle'. and otherwise -property `bmkp-full-record' would make the state file unreadable. - -Do nothing in Emacs 21 or later or if -`bmkp-propertize-bookmark-names-flag' is nil. In these cases, just -return the list." - (if (and (> emacs-major-version 20) ; Emacs 21+. Cannot just use (boundp 'print-circle). - bmkp-propertize-bookmark-names-flag) - list - (let ((new-list (copy-sequence list))) - (dolist (bmk new-list) - (when (and (consp bmk) (stringp (car bmk))) (setq bmk (car bmk))) - (when (stringp bmk) (set-text-properties 0 (length bmk) nil bmk))) - new-list))) - -;; This is a general command. It is in this file because it uses macro `bmkp-define-sort-command' -;; and it is used mainly in the bookmark list display. -;;;###autoload -(defun bmkp-define-tags-sort-command (tags &optional msg-p) ; Bound to `T s' in bookmark list - "Define a command to sort bookmarks in the bookmark list by tags. -Hit `RET' to enter each tag, then hit `RET' again after the last tag. - -The new command sorts first by the first tag in TAGS, then by the -second, and so on. - -Besides sorting for these specific tags, any bookmark that has a tag -sorts before one that has no tags. Otherwise, sorting is by bookmark -name, alphabetically. - -The name of the new command is `bmkp-bmenu-sort-' followed by the -specified tags, in order, separated by hyphens (`-'). E.g., for TAGS -\(\"alpha\" \"beta\"), the name is `bmkp-bmenu-sort-alpha-beta'." - (interactive (list (bmkp-read-tags-completing) 'MSG)) - (let ((sort-order (concat "tags-" (mapconcat #'identity tags "-"))) - (doc-string (read-string "Doc string for command: ")) - (comparer ()) - def) - (dolist (tag tags) - (push `(lambda (b1 b2) - (let ((tags1 (bmkp-get-tags b1)) - (tags2 (bmkp-get-tags b2))) - (cond ((and (assoc-default ,tag tags1 nil t) - (assoc-default ,tag tags2 nil t)) nil) - ((assoc-default ,tag tags1 nil t) '(t)) - ((assoc-default ,tag tags2 nil t) '(nil)) - ((and tags1 tags2) nil) - (tags1 '(t)) - (tags2 '(nil)) - (t nil)))) - comparer)) - (setq comparer (nreverse comparer) - comparer (list comparer 'bmkp-alpha-p)) - (eval (setq def (macroexpand `(bmkp-define-sort-command ,sort-order ,comparer ,doc-string)))) - (with-current-buffer (get-buffer-create " *User Bookmark List Commands*") - (goto-char (point-min)) - (delete-region (point-min) (point-max)) - (let ((print-length nil) - (print-level nil)) - (pp def (current-buffer)) - (insert "\n") - (condition-case nil - (write-region (point-min) (point-max) bmkp-bmenu-commands-file 'append) - (file-error (error "Cannot write `%s'" bmkp-bmenu-commands-file))) - (kill-buffer (current-buffer)))) - (when msg-p (message "Defined and saved command `%s'" (concat "bmkp-bmenu-sort-" sort-order))))) - -;;;###autoload -(defun bmkp-bmenu-edit-bookmark-name-and-file (&optional internalp) ; Bound to `r' in bookmark list - "Edit the bookmark under the cursor: its name and file name. -With a prefix argument, edit the complete bookmark record (the -internal, Lisp form)." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (let ((bmk-name (bookmark-bmenu-bookmark))) - (if internalp - (bmkp-edit-bookmark-record bmk-name) - (let* ((new-data (bmkp-edit-bookmark-name-and-file bmk-name)) - (new-name (car new-data))) - (if (not new-data) (message "No changes made") (bmkp-refresh-menu-list new-name)))))) - -;;;###autoload -(defun bmkp-bmenu-edit-tags () ; Bound to `T e' in bookmark list - "Edit the tags of the bookmark under the cursor. -The edited value must be a list each of whose elements is either a -string or a cons whose key is a string." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-edit-tags (bookmark-bmenu-bookmark))) - -;;;###autoload -(defun bmkp-bmenu-edit-bookmark-record () ; Bound to `e' in bookmark list - "Edit the full record (the Lisp sexp) for the bookmark under the cursor. -When you finish editing, use `\\[bmkp-edit-bookmark-record-send]'. -The current bookmark list is then updated to reflect your edits." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (bookmark-bmenu-ensure-position) - (bmkp-edit-bookmark-record (setq bmkp-edit-bookmark-orig-record (bookmark-bmenu-bookmark)))) - -;;;###autoload -(defun bmkp-bmenu-edit-marked () ; Bound to `E' in bookmark list - "Edit the full records (the Lisp sexps) of the marked bookmarks. -When you finish editing, use `\\[bmkp-edit-bookmark-records-send]'. -The current bookmark list is then updated to reflect your edits." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-last-bmenu-bookmark (bookmark-bmenu-bookmark)) - (let ((bufname "*Edit Marked Bookmarks*") - (copied-bmks (mapcar (lambda (bmk) - (setq bmk (copy-sequence bmk)) ; Shallow copy - (let ((bname (bmkp-bookmark-name-from-record bmk))) - ;; Strip properties from name. - (set-text-properties 0 (length bname) nil bname)) - bmk) - (bmkp-marked-bookmarks-only)))) - (unless copied-bmks (error "No marked bookmarks")) - (setq bmkp-edit-bookmark-records-number (length copied-bmks)) - (bmkp-with-output-to-plain-temp-buffer bufname - (princ - (substitute-command-keys - (concat ";; Edit the Lisp records for the marked bookmarks.\n;;\n" - ";; DO NOT CHANGE THE ORDER of the bookmarks in this buffer.\n" - ";; DO NOT DELETE any of them.\n;;\n" - ";; Type \\\ -`\\[bmkp-edit-bookmark-records-send]' when done.\n;;\n"))) - ;; $$$$$$ (let ((print-circle t)) (pp copied-bmks)) ; $$$$$$ Should not really be needed now. - (pp copied-bmks) - (goto-char (point-min))) - (pop-to-buffer bufname) - (buffer-enable-undo) - (with-current-buffer (get-buffer bufname) (bmkp-edit-bookmark-records-mode)))) - -(defun bmkp-bmenu-propertize-item (bookmark start end) - "Propertize text in buffer from START to END, indicating bookmark type. -This propertizes the name of BOOKMARK. -Also give this region the property `bmkp-bookmark-name' with as value -the name of BOOKMARK as a propertized string. - -The propertized string has property `bmkp-full-record' with value -BOOKMARK, which is the full bookmark record, with the string as its -car. - -Return the propertized string (the bookmark name)." - (setq bookmark (bookmark-get-bookmark bookmark)) - (let* ((bookmark-name (bmkp-bookmark-name-from-record bookmark)) - (buffp (bmkp-get-buffer-name bookmark)) - - (filep (bookmark-get-filename bookmark)) - (sudop (and filep (boundp 'tramp-file-name-regexp) - (string-match tramp-file-name-regexp filep) - (string-match bmkp-su-or-sudo-regexp filep)))) - ;; Put the full bookmark itself on string `bookmark-name' as property `bmkp-full-record'. - ;; Then put that string on the name in the buffer text as property `bmkp-bookmark-name'. - (put-text-property 0 (length bookmark-name) 'bmkp-full-record bookmark bookmark-name) - (put-text-property start end 'bmkp-bookmark-name bookmark-name) - ;; Add faces, mouse face, and tooltips, to characterize the bookmark type. - (add-text-properties - start end - (cond ((bookmark-prop-get bookmark 'file-handler) ; `file-handler' bookmark - (append (bmkp-face-prop 'bmkp-file-handler) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Invoke the `file-handler' for this bookmark"))) - ((bmkp-sequence-bookmark-p bookmark) ; Sequence bookmark - (append (bmkp-face-prop 'bmkp-sequence) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Invoke the bookmarks in this sequence"))) - ((bmkp-function-bookmark-p bookmark) ; Function bookmark - (append (bmkp-face-prop 'bmkp-function) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Invoke this function bookmark"))) - ((bmkp-variable-list-bookmark-p bookmark) ; Variable-list bookmark - (append (bmkp-face-prop 'bmkp-variable-list) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Invoke this variable-list bookmark"))) - ((bmkp-bookmark-list-bookmark-p bookmark) ; Bookmark-list bookmark - (append (bmkp-face-prop 'bmkp-bookmark-list) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Invoke this bookmark-list bookmark"))) - ((bmkp-desktop-bookmark-p bookmark) ; Desktop bookmark - (append (bmkp-face-prop 'bmkp-desktop) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Jump to this desktop bookmark"))) - ((bmkp-bookmark-file-bookmark-p bookmark) ; Bookmark-file bookmark - (append (bmkp-face-prop 'bmkp-bookmark-file) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Load this bookmark's bookmark file"))) - ((bmkp-info-bookmark-p bookmark) ; Info bookmark - (append (bmkp-face-prop 'bmkp-info) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Jump to this Info bookmark"))) - ((bmkp-man-bookmark-p bookmark) ; Man bookmark - (append (bmkp-face-prop 'bmkp-man) - '(mouse-face highlight follow-link t - help-echo (format "mouse-2 Goto `man' page")))) - ((bmkp-gnus-bookmark-p bookmark) ; Gnus bookmark - (append (bmkp-face-prop 'bmkp-gnus) - '(mouse-face highlight follow-link t - help-echo "mouse-2: Jump to this Gnus bookmark"))) - ((bmkp-url-bookmark-p bookmark) ; URL bookmark - (append (bmkp-face-prop 'bmkp-url) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to URL `%s'" ,filep)))) - ((and sudop (not (bmkp-root-or-sudo-logged-p))) ; Root/sudo not logged in - (append (bmkp-face-prop 'bmkp-su-or-sudo) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to (visit) file `%s'" ,filep)))) - ;; Test for remoteness before any other tests of the file itself - ;; (e.g. `file-exists-p'), so we don't prompt for a password etc. - ((and filep (bmkp-file-remote-p filep) (not sudop)) ; Remote file (ssh, ftp) - (append (bmkp-face-prop 'bmkp-remote-file) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to (visit) remote file `%s'" ,filep)))) - ((and filep ; Local directory or local Dired buffer (could be wildcards) - (or (file-directory-p filep) (bmkp-dired-bookmark-p bookmark))) - (append (bmkp-face-prop 'bmkp-local-directory) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Dired directory `%s'" ,filep)))) - ((and filep (file-exists-p filep) ; Local file with region - (bmkp-region-bookmark-p bookmark)) - (append (bmkp-face-prop 'bmkp-local-file-with-region) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Activate region in file `%s'" ,filep)))) - ((and filep (file-exists-p filep)) ; Local file without region - (append (bmkp-face-prop 'bmkp-local-file-without-region) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to (visit) file `%s'" ,filep)))) - ((and buffp (get-buffer buffp) (equal filep bmkp-non-file-filename)) ; Buffer - (append (bmkp-face-prop 'bmkp-buffer) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to buffer `%s'" ,buffp)))) - ((and buffp (or (not filep) (equal filep bmkp-non-file-filename) - (not (file-exists-p filep)))) ; Buffer bookmark, but no buffer. - (append (bmkp-face-prop 'bmkp-non-file) - `(mouse-face highlight follow-link t - help-echo (format "mouse-2: Jump to buffer `%s'" ,buffp)))) - (t (append (bmkp-face-prop 'bmkp-bad-bookmark) - `(mouse-face highlight follow-link t - help-echo (format "BAD BOOKMARK (maybe): `%s'" ,filep)))))) - bookmark-name)) - -;;;###autoload -(defun bmkp-bmenu-quit () ; Bound to `q' in bookmark list - "Quit the bookmark list (aka \"menu list\"). -If `bmkp-bmenu-state-file' is non-nil, then save the state, to be -restored the next time the bookmark list is shown. Otherwise, reset -the internal lists that record menu-list markings." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (if (not bmkp-bmenu-state-file) - (setq bmkp-bmenu-marked-bookmarks () - bmkp-bmenu-before-hide-marked-alist () - bmkp-bmenu-before-hide-unmarked-alist ()) - (when (interactive-p) (message "Saving bookmark-list display state...")) - (bmkp-save-menu-list-state) - (when (interactive-p) (message "Saving bookmark-list display state...done")) - (setq bmkp-bmenu-first-time-p t)) - (quit-window)) - -(defun bmkp-bmenu-goto-bookmark-named (name) - "Go to the first bookmark whose name matches NAME (a string). -If NAME has non-nil property `bmkp-full-record' then go to the -bookmark it indicates. Otherwise, just go to the first bookmark with -the same name." - (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (let ((full (get-text-property 0 'bmkp-full-record name))) - (while (and (not (eobp)) - (not (if full - (equal full (get-text-property 0 'bmkp-full-record (bookmark-bmenu-bookmark))) - (equal name (bookmark-bmenu-bookmark))))) - (forward-line 1))) - (bookmark-bmenu-ensure-position)) ; Just in case we fall off the end. - -;; This is a general function. It is in this file because it is used only by the bmenu code. -(defun bmkp-bmenu-barf-if-not-in-menu-list () - "Raise an error if current buffer is not `*Bookmark List*'." - (unless (equal (buffer-name (current-buffer)) "*Bookmark List*") - (error "You can only use this command in buffer `*Bookmark List*'"))) - -(defun bmkp-face-prop (value) - "Return a list with elements `face' or `font-lock-face' and VALUE. -Starting with Emacs 22, the first element is `font-lock-face'." - (list (if (> emacs-major-version 21) 'font-lock-face 'face) value)) - - -;;(@* "Sorting - Commands") -;; *** Sorting - Commands *** - -;;;###autoload -(defun bmkp-bmenu-change-sort-order-repeat (arg) ; Bound to `s s'... in bookmark list - "Cycle to the next sort order. -With a prefix arg, reverse current sort order. -This is a repeatable version of `bmkp-bmenu-change-sort-order'." - (interactive "P") - (require 'repeat) - (bmkp-repeat-command 'bmkp-bmenu-change-sort-order)) - -;;;###autoload -(defun bmkp-bmenu-change-sort-order (&optional arg) - "Cycle to the next sort order. -With a prefix arg, reverse the current sort order." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-sort-orders-for-cycling-alist (delq nil bmkp-sort-orders-for-cycling-alist)) - (if arg - (bmkp-reverse-sort-order) - (let ((current-bmk (bookmark-bmenu-bookmark)) - next-order) - (let ((orders (mapcar #'car bmkp-sort-orders-for-cycling-alist))) - (setq next-order (or (cadr (member (bmkp-current-sort-order) orders)) (car orders)) - bmkp-sort-comparer (cdr (assoc next-order bmkp-sort-orders-for-cycling-alist)))) - (message "Sorting...") - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk ; Put cursor back on the right line. - (bmkp-bmenu-goto-bookmark-named current-bmk)) - (when (interactive-p) (bmkp-msg-about-sort-order next-order))))) - -;; This is a general command. It is in this file because it is used only by the bmenu code. -;;;###autoload -(defun bmkp-reverse-sort-order () ; Bound to `s r' in bookmark list - "Reverse the current bookmark sort order. -If you combine this with \\\ -`\\[bmkp-reverse-multi-sort-order]', then see the doc for that command." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-reverse-sort-p (not bmkp-reverse-sort-p)) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk ; Put cursor back on the right line. - (bmkp-bmenu-goto-bookmark-named current-bmk))) - (when (interactive-p) (bmkp-msg-about-sort-order (bmkp-current-sort-order)))) - -;; This is a general command. It is in this file because it is used only by the bmenu code. -;;;###autoload -(defun bmkp-reverse-multi-sort-order () ; Bound to `s C-r' in bookmark list - "Reverse the application of multi-sorting predicates. -These are the PRED predicates described for option -`bmkp-sort-comparer'. - -This reverses the order in which the predicates are tried, and it -also complements the truth value returned by each predicate. - -For example, if the list of multi-sorting predicates is (p1 p2 p3), -then the predicates are tried in the order: p3, p2, p1. And if a -predicate returns true, `(t)', then the effect is as if it returned -false, `(nil)', and vice versa. - -The use of multi-sorting predicates tends to group bookmarks, with the -first predicate corresponding to the first bookmark group etc. - -The effect of \\`\\[bmkp-reverse-multi-sort-order]' is \ -roughly as follows: - - - without also `\\[bmkp-reverse-sort-order]', it reverses the bookmark order in each \ -group - - - combined with `\\[bmkp-reverse-sort-order]', it reverses the order of the bookmark - groups, but not the bookmarks within a group - -This is a rough description. The actual behavior can be complex, -because of how each predicate is defined. If this description helps -you, fine. If not, just experiment and see what happens. \;-) - -Remember that ordinary `\\[bmkp-reverse-sort-order]' reversal on its own is \ -straightforward. -If you find `\\[bmkp-reverse-multi-sort-order]' confusing or not helpful, then do not \ -use it." - (interactive) - (bmkp-bmenu-barf-if-not-in-menu-list) - (setq bmkp-reverse-multi-sort-p (not bmkp-reverse-multi-sort-p)) - (let ((current-bmk (bookmark-bmenu-bookmark))) - (bookmark-bmenu-surreptitiously-rebuild-list 'NO-MSG-P) - (when current-bmk ; Put cursor back on the right line. - (bmkp-bmenu-goto-bookmark-named current-bmk))) - (when (interactive-p) (bmkp-msg-about-sort-order (bmkp-current-sort-order)))) - - - -;; The ORDER of the macro calls here defines the REVERSE ORDER of -;; `bmkp-sort-orders-alist'. The first here is thus also the DEFAULT sort order. -;; Entries are traversed by `s s'..., in `bmkp-sort-orders-alist' order. - -(bmkp-define-sort-command ; Bound to `s k' in bookmark list (`k' for "kind") - "by bookmark type" ; `bmkp-bmenu-sort-by-bookmark-type' - ((bmkp-info-cp bmkp-url-cp bmkp-gnus-cp bmkp-local-file-type-cp bmkp-handler-cp) - bmkp-alpha-p) - "Sort bookmarks by type: Info, URL, Gnus, files, other (by handler name).") - -(bmkp-define-sort-command ; Bound to `s u' in bookmark list - "by url" ; `bmkp-bmenu-sort-by-url' - ((bmkp-url-cp) bmkp-alpha-p) - "Sort URL bookmarks alphabetically by their URL/filename. -When two bookmarks are not comparable this way, compare them by -bookmark name.") - -;; $$$$$$ Not used now. -;; (bmkp-define-sort-command ; Bound to `s w' in bookmark list -;; "by w3m url" ; `bmkp-bmenu-sort-by-w3m-url' -;; ((bmkp-w3m-cp) bmkp-alpha-p) -;; "Sort W3M bookmarks alphabetically by their URL/filename. -;; When two bookmarks are not comparable this way, compare them by -;; bookmark name.") - -(bmkp-define-sort-command ; Bound to `s g' in bookmark list - "by Gnus thread" ; `bmkp-bmenu-sort-by-Gnus-thread' - ((bmkp-gnus-cp) bmkp-alpha-p) - "Sort Gnus bookmarks by group, then by article, then by message. -When two bookmarks are not comparable this way, compare them by -bookmark name.") - -(bmkp-define-sort-command ; Bound to `s i' in bookmark list - "by Info location" ; `bmkp-bmenu-sort-by-Info-location' - ((bmkp-info-cp) bmkp-alpha-p) - "Sort Info bookmarks by file name, then node name, then position. -When two bookmarks are not comparable this way, compare them by -bookmark name.") - -(bmkp-define-sort-command ; Bound to `s f u' in bookmark list - "by last local file update" ; `bmkp-bmenu-sort-by-last-local-file-update' - ((bmkp-local-file-updated-more-recently-cp) bmkp-alpha-p) - "Sort bookmarks by last local file update time. -Sort a local file before a remote file, and a remote file before other -bookmarks. Otherwise, sort by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s f d' in bookmark list - "by last local file access" ; `bmkp-bmenu-sort-by-last-local-file-access' - ((bmkp-local-file-accessed-more-recently-cp) bmkp-alpha-p) - "Sort bookmarks by last local file access time. -A local file sorts before a remote file, which sorts before other -bookmarks. Otherwise, sort by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s f s' in bookmark list - "by local file size" ; `bmkp-bmenu-sort-by-local-file-size' - ((bmkp-local-file-size-cp) bmkp-alpha-p) - "Sort bookmarks by local file size. -A local file sorts before a remote file, which sorts before other -bookmarks. Otherwise, sort by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s f n' in bookmark list - "by file name" ; `bmkp-bmenu-sort-by-file-name' - ((bmkp-file-alpha-cp) bmkp-alpha-p) - "Sort bookmarks by file name. -When two bookmarks are not comparable by file name, compare them by -bookmark name.") - -(bmkp-define-sort-command ; Bound to `s f k' in bookmark list (`k' for "kind") - "by local file type" ; `bmkp-bmenu-sort-by-local-file-type' - ((bmkp-local-file-type-cp) bmkp-alpha-p) - "Sort bookmarks by local file type: file, symlink, directory. -A local file sorts before a remote file, which sorts before other -bookmarks. Otherwise, sort by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s D' in bookmark list - "flagged before unflagged" ; `bmkp-bmenu-sort-flagged-before-unflagged' - ((bmkp-flagged-cp) bmkp-alpha-p) - "Sort bookmarks by putting flagged for deletion before unflagged. -Otherwise alphabetize by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s *' in bookmark list - "modified before unmodified" ; `bmkp-bmenu-sort-modified-before-unmodified' - ((bmkp-modified-cp) bmkp-alpha-p) - "Sort bookmarks by putting modified before unmodified (saved). -Otherwise alphabetize by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s >' in bookmark list - "marked before unmarked" ; `bmkp-bmenu-sort-marked-before-unmarked' - ((bmkp-marked-cp) bmkp-alpha-p) - "Sort bookmarks by putting marked before unmarked. -Otherwise alphabetize by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s 0' (zero) in bookmark list - "by creation time" ; `bmkp-bmenu-sort-by-creation-time' - ((bmkp-bookmark-creation-cp) bmkp-alpha-p) - "Sort bookmarks by the time of their creation. -When one or both of the bookmarks does not have a `created' entry), -compare them by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s b' in bookmark list - "by last buffer or file access" ; `bmkp-bmenu-sort-by-last-buffer-or-file-access' - ((bmkp-buffer-last-access-cp bmkp-local-file-accessed-more-recently-cp) - bmkp-alpha-p) - "Sort bookmarks by last buffer access or last local file access. -Sort a bookmark accessed more recently before one accessed less -recently or not accessed. Sort a bookmark to an existing buffer -before a local file bookmark. When two bookmarks are not comparable -by such critera, sort them by bookmark name. (In particular, sort -remote-file bookmarks by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s v' in bookmark list - "by bookmark visit frequency" ; `bmkp-bmenu-sort-by-bookmark-visit-frequency' - ((bmkp-visited-more-cp) bmkp-alpha-p) - "Sort bookmarks by the number of times they were visited as bookmarks. -When two bookmarks are not comparable by visit frequency, compare them -by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s d' in bookmark list - "by last bookmark access" ; `bmkp-bmenu-sort-by-last-bookmark-access' - ((bmkp-bookmark-last-access-cp) bmkp-alpha-p) - "Sort bookmarks by the time of their last visit as bookmarks. -When two bookmarks are not comparable by visit time, compare them -by bookmark name.") - -(bmkp-define-sort-command ; Bound to `s n' in bookmark list - "by bookmark name" ; `bmkp-bmenu-sort-by-bookmark-name' - bmkp-alpha-p - "Sort bookmarks by bookmark name, respecting `case-fold-search'.") - -(bmkp-define-sort-command ; Bound to `s t' in bookmark list - "tagged before untagged" ; `bmkp-bmenu-sort-tagged-before-untagged' - ((bmkp-tagged-cp) bmkp-alpha-p) - "Sort bookmarks by putting tagged before untagged. -Otherwise alphabetize by bookmark name.") - -;; This is a general option. It is in this file because it is used mainly by the bmenu code. -;; Its definitions MUST COME AFTER the calls to macro `bmkp-define-sort-command'. -;; Otherwise, they won't pick up a populated `bmkp-sort-orders-alist'. -(when (> emacs-major-version 20) - (defcustom bmkp-sort-orders-for-cycling-alist (copy-sequence bmkp-sort-orders-alist) - "*Alist of sort orders used for cycling via `s s'... -This is a subset of the complete list of available sort orders, -`bmkp-sort-orders-alist'. This lets you cycle among fewer sort -orders, if there are some that you do not use often. - -See the doc for `bmkp-sort-orders-alist', for the structure of -this value." - :type '(alist - :key-type (choice :tag "Sort order" string symbol) - :value-type (choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate"))))) - :group 'bookmark-plus)) - -(unless (> emacs-major-version 20) ; Emacs 20: custom type `alist' doesn't exist. - (defcustom bmkp-sort-orders-for-cycling-alist (copy-sequence bmkp-sort-orders-alist) - "*Alist of sort orders used for cycling via `s s'... -This is a subset of the complete list of available sort orders, -`bmkp-sort-orders-alist'. This lets you cycle among fewer sort -orders, if there are some that you do not use often. - -See the doc for `bmkp-sort-orders-alist', for the structure of this -value." - :type '(repeat - (cons - (choice :tag "Sort order" string symbol) - (choice - (const :tag "None (do not sort)" nil) - (function :tag "Sorting Predicate") - (list :tag "Sorting Multi-Predicate" - (repeat (function :tag "Component Predicate")) - (choice - (const :tag "None" nil) - (function :tag "Final Predicate")))))) - :group 'bookmark-plus)) - - -;;(@* "Other Bookmark+ Functions (`bmkp-*')") -;; *** Other Bookmark+ Functions (`bmkp-*') *** - -;;;###autoload -(defun bmkp-bmenu-describe-this+move-down (&optional defn) ; Bound to `C-down' in bookmark list - "Describe bookmark of current line, then move down to the next bookmark. -With a prefix argument, show the internal definition of the bookmark." - (interactive "P") - (bmkp-bmenu-describe-this-bookmark) (forward-line 1)) - -;;;###autoload -(defun bmkp-bmenu-describe-this+move-up (&optional defn) ; Bound to `C-up' in bookmark list - "Describe bookmark of current line, then move down to the next bookmark. -With a prefix argument, show the internal definition of the bookmark." - (interactive "P") - (bmkp-bmenu-describe-this-bookmark) (forward-line -1)) - -;;;###autoload -(defun bmkp-bmenu-describe-this-bookmark (&optional defn) ; Bound to `C-h RET' in bookmark list - "Describe bookmark of current line. -With a prefix argument, show the internal definition of the bookmark." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (if defn - (bmkp-describe-bookmark-internals (bookmark-bmenu-bookmark)) - (bmkp-describe-bookmark (bookmark-bmenu-bookmark)))) - -;;;###autoload -(defun bmkp-bmenu-describe-marked (&optional defn) ; Bound to `C-h >' in bookmark list - "Describe the marked bookmarks. -With a prefix argument, show the internal definitions." - (interactive "P") - (bmkp-bmenu-barf-if-not-in-menu-list) - (help-setup-xref (list #'bmkp-describe-bookmark-marked) (interactive-p)) - (with-output-to-temp-buffer "*Help*" - (dolist (bmk (bmkp-marked-bookmarks-only)) - (if defn - (let* ((bname (bmkp-bookmark-name-from-record bmk)) - (help-text (format "%s\n%s\n\n%s" bname (make-string (length bname) ?-) - (pp-to-string bmk)))) - (princ help-text) (terpri)) - (princ (bmkp-bookmark-description bmk)) (terpri))))) - -(defun bmkp-bmenu-get-marked-files () - "Return a list of the file names of the marked bookmarks. -Marked bookmarks that have no associated file are ignored." - (let ((files ())) - (dolist (bmk bmkp-bmenu-marked-bookmarks) - (when (bmkp-file-bookmark-p bmk) (push (bookmark-get-filename bmk) files))) - files)) - -;;(@* "Keymaps") -;;; Keymaps ---------------------------------------------------------- - -;; `bookmark-bmenu-mode-map' - -(when (< emacs-major-version 21) - (define-key bookmark-bmenu-mode-map (kbd "RET") 'bookmark-bmenu-this-window)) -(define-key bookmark-bmenu-mode-map "\M-~" 'bmkp-toggle-saving-bookmark-file) -(define-key bookmark-bmenu-mode-map (kbd "C-M-~") 'bmkp-toggle-saving-menu-list-state) -(define-key bookmark-bmenu-mode-map "." 'bmkp-bmenu-show-all) -(define-key bookmark-bmenu-mode-map ">" 'bmkp-bmenu-toggle-show-only-marked) -(define-key bookmark-bmenu-mode-map "<" 'bmkp-bmenu-toggle-show-only-unmarked) -(define-key bookmark-bmenu-mode-map (kbd "M-") 'bmkp-bmenu-unmark-all) -(define-key bookmark-bmenu-mode-map "-" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "->" 'bmkp-bmenu-omit/unomit-marked) -(define-key bookmark-bmenu-mode-map "-S" 'bmkp-bmenu-show-only-omitted) -(define-key bookmark-bmenu-mode-map "-U" 'bmkp-unomit-all) -(define-key bookmark-bmenu-mode-map "=" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "=bM" 'bmkp-bmenu-mark-specific-buffer-bookmarks) -(define-key bookmark-bmenu-mode-map "=fM" 'bmkp-bmenu-mark-specific-file-bookmarks) -(define-key bookmark-bmenu-mode-map "=bS" 'bmkp-bmenu-show-only-specific-buffer) -(define-key bookmark-bmenu-mode-map "=fS" 'bmkp-bmenu-show-only-specific-file) -(define-key bookmark-bmenu-mode-map "%" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "%m" 'bmkp-bmenu-regexp-mark) -(define-key bookmark-bmenu-mode-map "*" nil) ; For Emacs 20 -(when (< emacs-major-version 21) - (define-key bookmark-bmenu-mode-map "*m" 'bookmark-bmenu-mark)) -(define-key bookmark-bmenu-mode-map "#" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "#M" 'bmkp-bmenu-mark-autonamed-bookmarks) -(define-key bookmark-bmenu-mode-map "#S" 'bmkp-bmenu-show-only-autonamed) -(define-key bookmark-bmenu-mode-map "\M-a" 'bookmark-bmenu-show-all-annotations) -;; `a' is `bookmark-bmenu-show-annotation' in vanilla Emacs. -(define-key bookmark-bmenu-mode-map "a" 'bmkp-bmenu-show-or-edit-annotation) -;; `A' is `bookmark-bmenu-show-all-annotations' in vanilla Emacs (unbound in Bookmark+). -(define-key bookmark-bmenu-mode-map "A" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "AM" 'bmkp-bmenu-mark-autofile-bookmarks) -(define-key bookmark-bmenu-mode-map "AS" 'bmkp-bmenu-show-only-autofiles) -(define-key bookmark-bmenu-mode-map "B" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "BM" 'bmkp-bmenu-mark-non-file-bookmarks) -(define-key bookmark-bmenu-mode-map "BS" 'bmkp-bmenu-show-only-non-files) -(define-key bookmark-bmenu-mode-map "c" 'bmkp-bmenu-define-command) -(define-key bookmark-bmenu-mode-map "C" 'bmkp-bmenu-define-full-snapshot-command) -(define-key bookmark-bmenu-mode-map "\M-c" 'bmkp-bmenu-define-jump-marked-command) -(define-key bookmark-bmenu-mode-map "d" 'bmkp-bmenu-flag-for-deletion) -(define-key bookmark-bmenu-mode-map "D" 'bmkp-bmenu-delete-marked) -(define-key bookmark-bmenu-mode-map "\C-d" 'bmkp-bmenu-flag-for-deletion-backwards) -(define-key bookmark-bmenu-mode-map "\M-d" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "\M-d>" 'bmkp-bmenu-dired-marked) -(define-key bookmark-bmenu-mode-map "\M-d\M-m" 'bmkp-bmenu-mark-dired-bookmarks) -(define-key bookmark-bmenu-mode-map "\M-d\M-s" 'bmkp-bmenu-show-only-dired) -;; `e' is `bookmark-bmenu-edit-annotation' in vanilla Emacs. -(define-key bookmark-bmenu-mode-map "e" 'bmkp-bmenu-edit-bookmark-record) -(define-key bookmark-bmenu-mode-map "E" 'bmkp-bmenu-edit-marked) -(define-key bookmark-bmenu-mode-map "F" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "FM" 'bmkp-bmenu-mark-file-bookmarks) -(define-key bookmark-bmenu-mode-map "FS" 'bmkp-bmenu-show-only-files) -(define-key bookmark-bmenu-mode-map "g" 'bmkp-bmenu-refresh-menu-list) -(define-key bookmark-bmenu-mode-map "G" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "GM" 'bmkp-bmenu-mark-gnus-bookmarks) -(define-key bookmark-bmenu-mode-map "GS" 'bmkp-bmenu-show-only-gnus) -(if (fboundp 'command-remapping) - (define-key bookmark-bmenu-mode-map [remap describe-mode] 'bmkp-bmenu-mode-status-help) - ;; In Emacs < 22, the `substitute-...' affects only `?', not `C-h m', so we add it separately. - (substitute-key-definition 'describe-mode 'bmkp-bmenu-mode-status-help bookmark-bmenu-mode-map) - (define-key bookmark-bmenu-mode-map "\C-hm" 'bmkp-bmenu-mode-status-help)) -(define-key bookmark-bmenu-mode-map (kbd "C-h >") 'bmkp-bmenu-describe-marked) -(define-key bookmark-bmenu-mode-map (kbd "C-h RET") 'bmkp-bmenu-describe-this-bookmark) -(define-key bookmark-bmenu-mode-map (kbd "C-h C-") 'bmkp-bmenu-describe-this-bookmark) -(define-key bookmark-bmenu-mode-map (kbd "C-") 'bmkp-bmenu-describe-this+move-down) -(define-key bookmark-bmenu-mode-map (kbd "C-") 'bmkp-bmenu-describe-this+move-up) -(define-key bookmark-bmenu-mode-map (kbd "M-") 'bmkp-bmenu-w32-open) -(define-key bookmark-bmenu-mode-map [M-mouse-2] 'bmkp-bmenu-w32-open-with-mouse) -(when (featurep 'bookmark+-lit) - (define-key bookmark-bmenu-mode-map "H" nil) ; For Emacs 20 - (define-key bookmark-bmenu-mode-map "H+" 'bmkp-bmenu-set-lighting) - (define-key bookmark-bmenu-mode-map "H>+" 'bmkp-bmenu-set-lighting-for-marked) - (define-key bookmark-bmenu-mode-map "H>H" 'bmkp-bmenu-light-marked) - (define-key bookmark-bmenu-mode-map "HH" 'bmkp-bmenu-light) - (define-key bookmark-bmenu-mode-map "HM" 'bmkp-bmenu-mark-lighted-bookmarks) - (define-key bookmark-bmenu-mode-map "HS" 'bmkp-bmenu-show-only-lighted) - (define-key bookmark-bmenu-mode-map "H>U" 'bmkp-bmenu-unlight-marked) - (define-key bookmark-bmenu-mode-map "HU" 'bmkp-bmenu-unlight)) -(define-key bookmark-bmenu-mode-map "I" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "IM" 'bmkp-bmenu-mark-info-bookmarks) -(define-key bookmark-bmenu-mode-map "IS" 'bmkp-bmenu-show-only-info-nodes) -(define-key bookmark-bmenu-mode-map "\M-I" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "\M-I\M-M" 'bmkp-bmenu-mark-image-bookmarks) -(define-key bookmark-bmenu-mode-map "\M-I\M-S" 'bmkp-bmenu-show-only-image-files) -(define-key bookmark-bmenu-mode-map "k" 'bmkp-bmenu-flag-for-deletion) -(define-key bookmark-bmenu-mode-map "K" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "KM" 'bmkp-bmenu-mark-desktop-bookmarks) -(define-key bookmark-bmenu-mode-map "KS" 'bmkp-bmenu-show-only-desktops) -(define-key bookmark-bmenu-mode-map "L" 'bmkp-switch-bookmark-file-create) -(define-key bookmark-bmenu-mode-map "\M-l" - 'bmkp-bmenu-load-marked-bookmark-file-bookmarks) -(define-key bookmark-bmenu-mode-map "\M-L" 'bmkp-temporary-bookmarking-mode) -(define-key bookmark-bmenu-mode-map "M" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "MM" 'bmkp-bmenu-mark-man-bookmarks) -(define-key bookmark-bmenu-mode-map "MS" 'bmkp-bmenu-show-only-man-pages) -(define-key bookmark-bmenu-mode-map "\M-m" 'bmkp-bmenu-mark-all) -(define-key bookmark-bmenu-mode-map "O" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "OM" 'bmkp-bmenu-mark-orphaned-local-file-bookmarks) -(define-key bookmark-bmenu-mode-map "OS" 'bmkp-bmenu-show-only-orphaned-local-files) -(define-key bookmark-bmenu-mode-map "P" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "PA" 'bmkp-bmenu-filter-annotation-incrementally) -(define-key bookmark-bmenu-mode-map "PB" 'bmkp-bmenu-filter-bookmark-name-incrementally) -(define-key bookmark-bmenu-mode-map "PF" 'bmkp-bmenu-filter-file-name-incrementally) -(define-key bookmark-bmenu-mode-map "PT" 'bmkp-bmenu-filter-tags-incrementally) -(define-key bookmark-bmenu-mode-map "q" 'bmkp-bmenu-quit) -(define-key bookmark-bmenu-mode-map "\M-q" 'bmkp-bmenu-query-replace-marked-bookmarks-regexp) -(define-key bookmark-bmenu-mode-map "r" 'bmkp-bmenu-edit-bookmark-name-and-file) -(define-key bookmark-bmenu-mode-map "R" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "RM" 'bmkp-bmenu-mark-region-bookmarks) -(define-key bookmark-bmenu-mode-map "RS" 'bmkp-bmenu-show-only-regions) -(define-key bookmark-bmenu-mode-map "\M-r" 'bookmark-bmenu-relocate) ; `R' in Emacs -(define-key bookmark-bmenu-mode-map "S" 'bookmark-bmenu-save) ; `s' in Emacs -(define-key bookmark-bmenu-mode-map "s" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "s>" 'bmkp-bmenu-sort-marked-before-unmarked) -(define-key bookmark-bmenu-mode-map "s*" 'bmkp-bmenu-sort-modified-before-unmodified) -(define-key bookmark-bmenu-mode-map "s0" 'bmkp-bmenu-sort-by-creation-time) -(define-key bookmark-bmenu-mode-map "sb" 'bmkp-bmenu-sort-by-last-buffer-or-file-access) -(define-key bookmark-bmenu-mode-map "sd" 'bmkp-bmenu-sort-by-last-bookmark-access) -(define-key bookmark-bmenu-mode-map "sD" 'bmkp-bmenu-sort-flagged-before-unflagged) -(define-key bookmark-bmenu-mode-map "sfd" 'bmkp-bmenu-sort-by-last-local-file-access) -(define-key bookmark-bmenu-mode-map "sfk" 'bmkp-bmenu-sort-by-local-file-type) -(define-key bookmark-bmenu-mode-map "sfn" 'bmkp-bmenu-sort-by-file-name) -(define-key bookmark-bmenu-mode-map "sfs" 'bmkp-bmenu-sort-by-local-file-size) -(define-key bookmark-bmenu-mode-map "sfu" 'bmkp-bmenu-sort-by-last-local-file-update) -(define-key bookmark-bmenu-mode-map "sg" 'bmkp-bmenu-sort-by-Gnus-thread) -(define-key bookmark-bmenu-mode-map "si" 'bmkp-bmenu-sort-by-Info-location) -(define-key bookmark-bmenu-mode-map "sk" 'bmkp-bmenu-sort-by-bookmark-type) -(define-key bookmark-bmenu-mode-map "sn" 'bmkp-bmenu-sort-by-bookmark-name) -(define-key bookmark-bmenu-mode-map "sr" 'bmkp-reverse-sort-order) -(define-key bookmark-bmenu-mode-map "s\C-r" 'bmkp-reverse-multi-sort-order) -(define-key bookmark-bmenu-mode-map "ss" 'bmkp-bmenu-change-sort-order-repeat) -(define-key bookmark-bmenu-mode-map "st" 'bmkp-bmenu-sort-tagged-before-untagged) -(define-key bookmark-bmenu-mode-map "su" 'bmkp-bmenu-sort-by-url) -(define-key bookmark-bmenu-mode-map "sv" 'bmkp-bmenu-sort-by-bookmark-visit-frequency) -;; ;; (define-key bookmark-bmenu-mode-map "sw" 'bmkp-bmenu-sort-by-w3m-url) -(when (> emacs-major-version 22) ; Emacs 23+ - (define-key bookmark-bmenu-mode-map (kbd "M-s a C-s") 'bmkp-bmenu-isearch-marked-bookmarks) - (define-key bookmark-bmenu-mode-map (kbd "M-s a M-C-s") 'bmkp-bmenu-isearch-marked-bookmarks-regexp)) -(define-key bookmark-bmenu-mode-map (kbd "M-s a M-s") 'bmkp-bmenu-search-marked-bookmarks-regexp) -(define-key bookmark-bmenu-mode-map "T" nil) ; For Emacs20 -(define-key bookmark-bmenu-mode-map "T>+" 'bmkp-bmenu-add-tags-to-marked) -(define-key bookmark-bmenu-mode-map "T>-" 'bmkp-bmenu-remove-tags-from-marked) -(define-key bookmark-bmenu-mode-map "T>e" 'bmkp-bmenu-edit-marked) -(define-key bookmark-bmenu-mode-map "T>p" 'bmkp-bmenu-paste-add-tags-to-marked) -(define-key bookmark-bmenu-mode-map "T>q" 'bmkp-bmenu-paste-replace-tags-for-marked) -(define-key bookmark-bmenu-mode-map "T>v" 'bmkp-bmenu-set-tag-value-for-marked) -(define-key bookmark-bmenu-mode-map "T>\C-y" 'bmkp-bmenu-paste-add-tags-to-marked) -(define-key bookmark-bmenu-mode-map "T0" 'bmkp-remove-all-tags) -(define-key bookmark-bmenu-mode-map "T+" 'bmkp-add-tags) -(define-key bookmark-bmenu-mode-map "T-" 'bmkp-remove-tags) -(define-key bookmark-bmenu-mode-map "Tc" 'bmkp-bmenu-copy-tags) -(define-key bookmark-bmenu-mode-map "Td" 'bmkp-remove-tags-from-all) -(define-key bookmark-bmenu-mode-map "Te" 'bmkp-bmenu-edit-tags) -(define-key bookmark-bmenu-mode-map "Tl" 'bmkp-list-all-tags) -(define-key bookmark-bmenu-mode-map "Tm*" 'bmkp-bmenu-mark-bookmarks-tagged-all) -(define-key bookmark-bmenu-mode-map "Tm%" 'bmkp-bmenu-mark-bookmarks-tagged-regexp) -(define-key bookmark-bmenu-mode-map "Tm+" 'bmkp-bmenu-mark-bookmarks-tagged-some) -(define-key bookmark-bmenu-mode-map "Tm~*" 'bmkp-bmenu-mark-bookmarks-tagged-not-all) -(define-key bookmark-bmenu-mode-map "Tm~+" 'bmkp-bmenu-mark-bookmarks-tagged-none) -(define-key bookmark-bmenu-mode-map "Tp" 'bmkp-bmenu-paste-add-tags) -(define-key bookmark-bmenu-mode-map "Tq" 'bmkp-bmenu-paste-replace-tags) -(define-key bookmark-bmenu-mode-map "Tr" 'bmkp-rename-tag) -(define-key bookmark-bmenu-mode-map "Ts" 'bmkp-define-tags-sort-command) -(define-key bookmark-bmenu-mode-map "TS" 'bmkp-bmenu-show-only-tagged) -(define-key bookmark-bmenu-mode-map "Tu*" 'bmkp-bmenu-unmark-bookmarks-tagged-all) -(define-key bookmark-bmenu-mode-map "Tu%" 'bmkp-bmenu-unmark-bookmarks-tagged-regexp) -(define-key bookmark-bmenu-mode-map "Tu+" 'bmkp-bmenu-unmark-bookmarks-tagged-some) -(define-key bookmark-bmenu-mode-map "Tu~*" 'bmkp-bmenu-unmark-bookmarks-tagged-not-all) -(define-key bookmark-bmenu-mode-map "Tu~+" 'bmkp-bmenu-unmark-bookmarks-tagged-none) -(define-key bookmark-bmenu-mode-map "Tv" 'bmkp-bmenu-set-tag-value) -(define-key bookmark-bmenu-mode-map "T\M-w" 'bmkp-bmenu-copy-tags) -(define-key bookmark-bmenu-mode-map "T\C-y" 'bmkp-bmenu-paste-add-tags) -(define-key bookmark-bmenu-mode-map "\M-t" 'bookmark-bmenu-toggle-filenames) ; `t' in Emacs -(define-key bookmark-bmenu-mode-map "t" 'bmkp-bmenu-toggle-marks) -(define-key bookmark-bmenu-mode-map "U" 'bmkp-bmenu-unmark-all) -(define-key bookmark-bmenu-mode-map "\M-u" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "\M-u\M-m" 'bmkp-bmenu-mark-url-bookmarks) -(define-key bookmark-bmenu-mode-map "\M-u\M-s" 'bmkp-bmenu-show-only-urls) -(define-key bookmark-bmenu-mode-map "V" nil) ; For Emacs20 -(define-key bookmark-bmenu-mode-map "VM" 'bmkp-bmenu-mark-variable-list-bookmarks) -(define-key bookmark-bmenu-mode-map "VS" 'bmkp-bmenu-show-only-variable-lists) -(define-key bookmark-bmenu-mode-map "\M-o" 'bmkp-bmenu-w32-open-select) -(define-key bookmark-bmenu-mode-map "W" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "WM" 'bmkp-bmenu-mark-w3m-bookmarks) -(define-key bookmark-bmenu-mode-map "WS" 'bmkp-bmenu-show-only-w3m-urls) -(define-key bookmark-bmenu-mode-map "X" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "XM" 'bmkp-bmenu-mark-temporary-bookmarks) -(define-key bookmark-bmenu-mode-map "XS" 'bmkp-bmenu-show-only-temporary) -(define-key bookmark-bmenu-mode-map "\M-X" 'bmkp-bmenu-toggle-marked-temporary/savable) -(define-key bookmark-bmenu-mode-map "\C-\M-X" 'bmkp-bmenu-toggle-temporary) -(define-key bookmark-bmenu-mode-map "Y" nil) ; For Emacs 20 -(define-key bookmark-bmenu-mode-map "YM" 'bmkp-bmenu-mark-bookmark-file-bookmarks) -(define-key bookmark-bmenu-mode-map "YS" 'bmkp-bmenu-show-only-bookmark-files) - - -;;; `Bookmark+' menu-bar menu in `*Bookmark List*' - -(defvar bmkp-bmenu-menubar-menu (make-sparse-keymap "Bookmark+") "`Boomark+' menu-bar menu.") -(define-key bookmark-bmenu-mode-map [menu-bar bmkp] - (cons "Bookmark+" bmkp-bmenu-menubar-menu)) - -;; Top level -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-quit] - '(menu-item "Quit" bmkp-bmenu-quit - :help "Quit the bookmark list, saving its state and the current set of bookmarks")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-describe-marked] - '(menu-item "Describe Marked Bookmarks" bmkp-bmenu-describe-marked - :help "Describe the marked bookmarks. With `C-u' show internal format.")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-describe-this-bookmark] - '(menu-item "Describe This Bookmark" bmkp-bmenu-describe-this-bookmark - :help "Describe this line's bookmark. With `C-u' show internal format.")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-mode-status-help] - '(menu-item "Current Status, Mode Help" bmkp-bmenu-mode-status-help :keys "?" - :help "Describe `*Bookmark List*' and show its current status")) - -(define-key bmkp-bmenu-menubar-menu [top-sep5] '("--")) ; -------------------------------- -(define-key bmkp-bmenu-menubar-menu [bmkp-temporary-bookmarking-mode] - '(menu-item "Toggle Temporary Bookmarking Mode..." bmkp-temporary-bookmarking-mode - :help "Toggle temporary-only bookmarking (empty bookmark file *replaces* current bookmarks)")) -(define-key bmkp-bmenu-menubar-menu [bmkp-toggle-autotemp-on-set] - '(menu-item "Toggle Automatically Making Temporary" bmkp-toggle-autotemp-on-set - :help "Toggle automatically making any bookmark temporary whenever it is set")) -(define-key bmkp-bmenu-menubar-menu [bmkp-toggle-saving-menu-list-state] - '(menu-item "Toggle Autosaving Display State" bmkp-toggle-saving-menu-list-state - :help "Toggle the value of option `bmkp-bmenu-state-file'")) -(define-key bmkp-bmenu-menubar-menu [bmkp-toggle-saving-bookmark-file] - '(menu-item "Toggle Autosaving Bookmark File" bmkp-toggle-saving-bookmark-file - :help "Toggle the value of option `bookmark-save-flag'")) - -(define-key bmkp-bmenu-menubar-menu [top-sep4] '("--")) ; -------------------------------- -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-load-marked-bookmark-file-bookmarks] - '(menu-item "Load Marked Bookmark-File Bookmarks..." bmkp-bmenu-load-marked-bookmark-file-bookmarks - :help "Load the marked bookmark-file bookmarks, in order")) -(define-key bmkp-bmenu-menubar-menu [bmkp-empty-file] - '(menu-item "Empty Bookmark File..." bmkp-empty-file - :help "Empty an existing bookmark file or create a new, empty bookmark file")) -(define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-load] - '(menu-item "Add Bookmarks from File..." bookmark-bmenu-load - :help "Load additional bookmarks from a bookmark file")) -(define-key bmkp-bmenu-menubar-menu [bmkp-switch-bookmark-file-create] - '(menu-item "Switch to Bookmark File..." bmkp-switch-bookmark-file-create - :help "Switch to a different bookmark file, *replacing* the current set of bookmarks")) - -(define-key bmkp-bmenu-menubar-menu [top-sep3] '("--")) ; -------------------------------- -(define-key bmkp-bmenu-menubar-menu [bmkp-save-menu-list-state] - '(menu-item "Save Display State..." bmkp-save-menu-list-state - :help "Save the current bookmark-list display state to `bmkp-bmenu-state-file'" - :enable (and (not bmkp-bmenu-first-time-p) bmkp-bmenu-state-file))) -(define-key bmkp-bmenu-menubar-menu [bookmark-write] - '(menu-item "Save As..." bookmark-write - :help "Write the current set of bookmarks to a file whose name you enter")) -(define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-save] - '(menu-item "Save" bookmark-bmenu-save - :help "Save the current set of bookmarks to the current bookmark file" - :enable (> bookmark-alist-modification-count 0))) -(define-key bmkp-bmenu-menubar-menu [bmkp-revert-bookmark-file] - '(menu-item "Revert to Saved" bmkp-revert-bookmark-file - :help "Revert to bookmarks in current bookmark file, as last saved" :keys "C-u g")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-refresh-menu-list] - '(menu-item "Refresh to Current" bmkp-bmenu-refresh-menu-list - :help "Update display to reflect current bookmark list (`C-u': revert from file)")) - -(define-key bmkp-bmenu-menubar-menu [top-sep2] '("--")) ; -------------------------------- -(define-key bmkp-bmenu-menubar-menu [bmkp-make-function-bookmark] - '(menu-item "New Function Bookmark..." bmkp-make-function-bookmark - :help "Create a bookmark that will invoke FUNCTION when \"jumped\" to")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-make-sequence-from-marked] - '(menu-item "New Sequence Bookmark from Marked..." bmkp-bmenu-make-sequence-from-marked - :help "Create or update a sequence bookmark from the visible marked bookmarks")) -(define-key bmkp-bmenu-menubar-menu [bmkp-choose-navlist-from-bookmark-list] - '(menu-item "Set Navlist from Bookmark-List Bookmark..." bmkp-choose-navlist-from-bookmark-list - :help "Set the navigation list from a bookmark-list bookmark")) -(define-key bmkp-bmenu-menubar-menu [bmkp-choose-navlist-of-type] - '(menu-item "Set Navlist to Bookmarks of Type..." bmkp-choose-navlist-of-type - :help "Set the navigation list to the bookmarks of a certain type")) -(define-key bmkp-bmenu-menubar-menu [bmkp-list-defuns-in-commands-file] - '(menu-item "List User-Defined Bookmark Commands" bmkp-list-defuns-in-commands-file - :help "List the functions defined in `bmkp-bmenu-commands-file'")) - -(defvar bmkp-bmenu-define-command-menu (make-sparse-keymap "Define Command") - "`Define Command' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [define-command] - (cons "Define Command" bmkp-bmenu-define-command-menu)) - -(when (featurep 'bookmark+-lit) - (defvar bmkp-bmenu-highlight-menu (make-sparse-keymap "Highlight") - "`Highlight' submenu for menu-bar `Bookmark+' menu.") - (define-key bmkp-bmenu-menubar-menu [highlight] (cons "Highlight" bmkp-bmenu-highlight-menu))) - -(defvar bmkp-bmenu-tags-menu (make-sparse-keymap "Tags") - "`Tags' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [tags] (cons "Tags" bmkp-bmenu-tags-menu)) - -(defvar bmkp-bmenu-sort-menu (make-sparse-keymap "Sort") - "`Sort' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [sort] (cons "Sort" bmkp-bmenu-sort-menu)) - -(defvar bmkp-bmenu-show-menu (make-sparse-keymap "Show") - "`Show' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [show] (cons "Show" bmkp-bmenu-show-menu)) - -(defvar bmkp-bmenu-omit-menu (make-sparse-keymap "Omit") - "`Omit' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [omitting] (cons "Omit" bmkp-bmenu-omit-menu)) - -(defvar bmkp-bmenu-mark-menu (make-sparse-keymap "Mark") - "`Mark' submenu for menu-bar `Bookmark+' menu.") -(define-key bmkp-bmenu-menubar-menu [marking] (cons "Mark" bmkp-bmenu-mark-menu)) - -(define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-execute-deletions] - '(menu-item "Delete Flagged (D)..." bookmark-bmenu-execute-deletions - :help "Delete the (visible) bookmarks flagged `D'")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-delete-marked] - '(menu-item "Delete Marked (>)..." bmkp-bmenu-delete-marked - :help "Delete all (visible) bookmarks marked `>', after confirmation")) -(define-key bmkp-bmenu-menubar-menu [bmkp-delete-all-temporary-bookmarks] - '(menu-item "Delete All Temporaries..." bmkp-delete-all-temporary-bookmarks - :help "Delete the temporary bookmarks, (`X') whether visible here or not")) - -(define-key bmkp-bmenu-menubar-menu [top-sep1] '("--")) ; -------------------------------- -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-edit-marked] - '(menu-item "Edit Internal Records of Marked (Lisp)..." bmkp-bmenu-edit-marked - :help "Edit the internal records of the marked bookmarks" :keys "E")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-toggle-marked-temporary/savable] - '(menu-item "Toggle Temporary/Savable (X) for Marked" bmkp-bmenu-toggle-marked-temporary/savable - :help "Toggle the temporary (`X') vs. savable status of the marked bookmarks")) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-query-replace-marked-bookmarks-regexp] - '(menu-item "Query-Replace Marked..." bmkp-bmenu-query-replace-marked-bookmarks-regexp - :help "`query-replace-regexp' over all files whose bookmarks are marked")) -(when (fboundp 'bmkp-bmenu-isearch-marked-bookmarks) - (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-isearch-marked-bookmarks-regexp] - '(menu-item "Regexp-Isearch Marked..." bmkp-bmenu-isearch-marked-bookmarks-regexp - :help "Regexp Isearch the marked bookmark locations, in their current order")) - (define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-isearch-marked-bookmarks] - '(menu-item "Isearch Marked..." bmkp-bmenu-isearch-marked-bookmarks - :help "Isearch the marked bookmark locations, in their current order"))) -(define-key bmkp-bmenu-menubar-menu [bmkp-bmenu-search-marked-bookmarks-regexp] - '(menu-item "Search Marked..." bmkp-bmenu-search-marked-bookmarks-regexp - :help "Regexp-search the files whose bookmarks are marked, in their current order")) -(define-key bmkp-bmenu-menubar-menu [bookmark-bmenu-select] - '(menu-item "Jump to Marked" bookmark-bmenu-select - :help "Jump to this line's bookmark. Also visit each bookmark marked with `>'")) - - -;;; `Define Command' submenu ----------------------------------------- -(define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-full-snapshot-command] - '(menu-item "To Restore Full Bookmark-List State..." bmkp-bmenu-define-full-snapshot-command - :help "Define a command to restore the current bookmark-list state")) -(define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-command] - '(menu-item "To Restore Current Order and Filter..." bmkp-bmenu-define-command - :help "Define a command to use the current sort order, filter, and omit list")) -(define-key bmkp-bmenu-define-command-menu [bmkp-define-tags-sort-command] - '(menu-item "To Sort by Specific Tags..." bmkp-define-tags-sort-command - :help "Define a command to sort bookmarks in the bookmark list by certain tags")) -(define-key bmkp-bmenu-define-command-menu [bmkp-bmenu-define-jump-marked-command] - '(menu-item "To Jump to a Bookmark Now Marked..." bmkp-bmenu-define-jump-marked-command - :help "Define a command to jump to one of the bookmarks that is now marked" - :enable bmkp-bmenu-marked-bookmarks)) - - -;;; `Highlight' submenu ---------------------------------------------- -(when (featurep 'bookmark+-lit) - (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-show-only-lighted] - '(menu-item "Show Only Highlighted" bmkp-bmenu-show-only-lighted - :help "Display (only) highlighted bookmarks")) - (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-set-lighting-for-marked] - '(menu-item "Set Highlighting for Marked" bmkp-bmenu-set-lighting-for-marked - :help "Set specific highlighting for the marked bookmarks" - :enable bmkp-bmenu-marked-bookmarks)) - (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-unlight-marked] - '(menu-item "Unhighlight Marked" bmkp-bmenu-unlight-marked - :help "Unhighlight the marked bookmarks" - :enable bmkp-bmenu-marked-bookmarks)) - (define-key bmkp-bmenu-highlight-menu [bmkp-bmenu-light-marked] - '(menu-item "Highlight Marked" bmkp-bmenu-light-marked - :help "Highlight the marked bookmarks" - :enable bmkp-bmenu-marked-bookmarks))) - - -;;; `Tags' submenu --------------------------------------------------- -(define-key bmkp-bmenu-tags-menu [bmkp-list-all-tags] - '(menu-item "List All Tags" bmkp-list-all-tags :help "List all tags used for any bookmarks")) -(define-key bmkp-bmenu-tags-menu [bmkp-purge-notags-autofiles] - '(menu-item "Purge Autofiles with No Tags..." bmkp-purge-notags-autofiles - :help "Delete all autofile bookmarks that have no tags")) -(define-key bmkp-bmenu-tags-menu [bmkp-untag-a-file] - '(menu-item "Untag a File (Remove Some)..." bmkp-untag-a-file - :help "Remove some tags from autofile bookmark for a file")) -(define-key bmkp-bmenu-tags-menu [bmkp-tag-a-file] - '(menu-item "Tag a File (Add Some)..." bmkp-tag-a-file - :help "Add some tags to the autofile bookmark for a file")) - -(define-key bmkp-bmenu-tags-menu [tags-sep] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-tags-menu [bmkp-rename-tag] - '(menu-item "Rename Tag..." bmkp-rename-tag - :help "Rename a tag in all bookmarks, even those not showing")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-edit-marked] - '(menu-item "Edit Tags of Marked (Lisp)..." bmkp-bmenu-edit-marked - :help "Edit internal records of marked bookmarks (which include their tags)" - :keys "T > e")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-set-tag-value-for-marked] - '(menu-item "Set Tag Value for Marked..." bmkp-bmenu-set-tag-value-for-marked - :help "Set the value of a tag, for each of the marked bookmarks")) -(define-key bmkp-bmenu-tags-menu [bmkp-remove-tags-from-all] - '(menu-item "Remove Some Tags from All..." bmkp-remove-tags-from-all - :help "Remove a set of tags from all bookmarks")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-remove-tags-from-marked] - '(menu-item "Remove Some Tags from Marked..." bmkp-bmenu-remove-tags-from-marked - :help "Remove a set of tags from each of the marked bookmarks")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-add-tags-to-marked] - '(menu-item "Add Some Tags to Marked..." bmkp-bmenu-add-tags-to-marked - :help "Add a set of tags to each of the marked bookmarks")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-paste-replace-tags-for-marked] - '(menu-item "Paste Tags to Marked (Replace)..." bmkp-bmenu-paste-replace-tags-for-marked - :help "Replace tags for the marked bookmarks with tags copied previously")) -(define-key bmkp-bmenu-tags-menu [bmkp-bmenu-paste-add-tags-to-marked] - '(menu-item "Paste Tags to Marked (Add)..." bmkp-bmenu-paste-add-tags-to-marked - :help "Add tags copied from another bookmark to the marked bookmarks")) - -;;; `Sort' submenu --------------------------------------------------- -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-url] - '(menu-item "By URL" bmkp-bmenu-sort-by-url - :help "Sort URL bookmarks alphabetically by their URL/filename")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-Gnus-thread] - '(menu-item "By Gnus Thread" bmkp-bmenu-sort-by-Gnus-thread - :help "Sort Gnus bookmarks by group, then by article, then by message")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-Info-location] - '(menu-item "By Info Node" bmkp-bmenu-sort-by-Info-location - :help "Sort Info bookmarks by file name, then node name, then position")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-local-file-update] - '(menu-item "By Last Local File Update" bmkp-bmenu-sort-by-last-local-file-update - :help "Sort bookmarks by last local file update time")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-buffer-or-file-access] - '(menu-item "By Last Buffer/File Access" bmkp-bmenu-sort-by-last-buffer-or-file-access - :help "Sort bookmarks by time of last buffer access or local-file access")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-local-file-size] - '(menu-item "By Local File Size" bmkp-bmenu-sort-by-local-file-size - :help "Sort bookmarks by local file size")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-local-file-type] - '(menu-item "By Local File Type" bmkp-bmenu-sort-by-local-file-type - :help "Sort bookmarks by local file type: file, symlink, directory")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-type] - '(menu-item "By Type" bmkp-bmenu-sort-by-bookmark-type - :help "Sort bookmarks by type: Info, URL, Gnus, files, other")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-file-name] - '(menu-item "By File Name" bmkp-bmenu-sort-by-file-name :help "Sort bookmarks by file name")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-name] - '(menu-item "By Bookmark Name" bmkp-bmenu-sort-by-bookmark-name - :help "Sort bookmarks by bookmark name, respecting `case-fold-search'")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-creation-time] - '(menu-item "By Creation Time" bmkp-bmenu-sort-by-creation-time - :help "Sort bookmarks by the time of their creation")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-last-bookmark-access] - '(menu-item "By Last Bookmark Access" bmkp-bmenu-sort-by-last-bookmark-access - :help "Sort bookmarks by the time of their last visit as bookmarks")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-by-bookmark-visit-frequency] - '(menu-item "By Bookmark Use" bmkp-bmenu-sort-by-bookmark-visit-frequency - :help "Sort bookmarks by the number of times they were visited as bookmarks")) -(define-key bmkp-bmenu-sort-menu [bmkp-bmenu-sort-marked-before-unmarked] - '(menu-item "Marked Before Unmarked" bmkp-bmenu-sort-marked-before-unmarked - :help "Sort bookmarks by putting marked before unmarked")) -(define-key bmkp-bmenu-sort-menu [bmkp-reverse-sort-order] - '(menu-item "Reverse" bmkp-reverse-sort-order :help "Reverse the current bookmark sort order")) - - -;;; `Show' submenu --------------------------------------------------- -(define-key bmkp-bmenu-show-menu [bookmark-bmenu-show-all-annotations] - '(menu-item "Show Annotations" bookmark-bmenu-show-all-annotations - :help "Show the annotations for all bookmarks (in another window)")) -(define-key bmkp-bmenu-show-menu [bookmark-bmenu-toggle-filenames] - '(menu-item "Show/Hide File Names" bookmark-bmenu-toggle-filenames - :help "Toggle whether filenames are shown in the bookmark list")) - -(define-key bmkp-bmenu-show-menu [show-sep5] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-tags-incrementally] - '(menu-item "Show Only Tag Matches..." bmkp-bmenu-filter-tags-incrementally - :help "Incrementally filter bookmarks by tags using a regexp")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-annotation-incrementally] - '(menu-item "Show Only Annotation Matches..." bmkp-bmenu-filter-annotation-incrementally - :help "Incrementally filter bookmarks by annotation using a regexp")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-file-name-incrementally] - '(menu-item "Show Only File Name Matches..." bmkp-bmenu-filter-file-name-incrementally - :help "Incrementally filter bookmarks by file name using a regexp")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-filter-bookmark-name-incrementally] - '(menu-item "Show Only Name Matches..." bmkp-bmenu-filter-bookmark-name-incrementally - :help "Incrementally filter bookmarks by bookmark name using a regexp")) - -(define-key bmkp-bmenu-show-menu [show-sep4] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-w3m-urls] - '(menu-item "Show Only W3M URLs" bmkp-bmenu-show-only-w3m-urls - :help "Display (only) the W3M URL bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-urls] - '(menu-item "Show Only URLs" bmkp-bmenu-show-only-urls - :help "Display (only) the URL bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-gnus] - '(menu-item "Show Only Gnus Messages" bmkp-bmenu-show-only-gnus - :help "Display (only) the Gnus bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-man-pages] - '(menu-item "Show Only UNIX Manual Pages" bmkp-bmenu-show-only-man-pages - :help "Display (only) the `man' page bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-info-nodes] - '(menu-item "Show Only Info Nodes" bmkp-bmenu-show-only-info-nodes - :help "Display (only) the Info bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-desktops] - '(menu-item "Show Only Desktops" bmkp-bmenu-show-only-desktops - :help "Display (only) the desktop bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-variable-lists] - '(menu-item "Show Only Variable Lists" bmkp-bmenu-show-only-variable-lists - :help "Display (only) the variable-list bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-bookmark-files] - '(menu-item "Show Only Bookmark Files" bmkp-bmenu-show-only-bookmark-files - :help "Display (only) the bookmark-file bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-regions] - '(menu-item "Show Only Regions" bmkp-bmenu-show-only-regions - :help "Display (only) the bookmarks that record a region")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-non-files] - '(menu-item "Show Only Non-Files (Buffers)" bmkp-bmenu-show-only-non-files - :help "Display (only) the non-file bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-orphaned-local-files] - '(menu-item "Show Only Orphaned Local Files" bmkp-bmenu-show-only-orphaned-local-files - :help "Display (only) orphaned local-file bookmarks (`C-u': show remote also)")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-image-files] - '(menu-item "Show Only Image Files" bmkp-bmenu-show-only-image-files - :help "Display (only) image-file bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-files] - '(menu-item "Show Only Files" bmkp-bmenu-show-only-files - :help "Display (only) the file and directory bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-dired] - '(menu-item "Show Only Dired Buffers" bmkp-bmenu-show-only-dired - :help "Display (only) the Dired bookmarks")) - -(define-key bmkp-bmenu-show-menu [show-sep3] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-specific-file] - '(menu-item "Show Only for Specific File" bmkp-bmenu-show-only-specific-file - :help "Display (only) the bookmarks for a specific file")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-specific-buffer] - '(menu-item "Show Only for Specific Buffer" bmkp-bmenu-show-only-specific-buffer - :help "Display (only) the bookmarks for a specific buffer")) - -(define-key bmkp-bmenu-show-menu [show-sep2] '("--")) ; ---------------------------------- -(when (featurep 'bookmark+-lit) - (define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-lighted] - '(menu-item "Show Only Highlighted" bmkp-bmenu-show-only-lighted - :help "Display (only) highlighted bookmarks"))) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-temporary] - '(menu-item "Show Only Temporaries" bmkp-bmenu-show-only-temporary - :help "Display (only) the temporary bookmarks (`X')")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-autonamed] - '(menu-item "Show Only Autonamed" bmkp-bmenu-show-only-autonamed - :help "Display (only) the autonamed bookmarks")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-only-autofiles] - '(menu-item "Show Only Autofiles" bmkp-bmenu-show-only-autofiles - :help "Display (only) the autofile bookmarks: those named the same as their files")) - -(define-key bmkp-bmenu-show-menu [show-sep1] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-toggle-show-only-unmarked] - '(menu-item "Show Only Unmarked" bmkp-bmenu-toggle-show-only-unmarked - :help "Hide all marked bookmarks. Repeat to toggle, showing all")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-toggle-show-only-marked] - '(menu-item "Show Only Marked" bmkp-bmenu-toggle-show-only-marked - :help "Hide all unmarked bookmarks. Repeat to toggle, showing all")) -(define-key bmkp-bmenu-show-menu [bmkp-bmenu-show-all] - '(menu-item "Show All" bmkp-bmenu-show-all - :help "Show all bookmarks currently known to the bookmark list")) - - -;;; `Omit' submenu --------------------------------------------------- -(define-key bmkp-bmenu-omit-menu [bmkp-bmenu-show-all] - '(menu-item "Show All" bmkp-bmenu-show-all - :visible (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only) - :help "Show all bookmarks (except omitted)")) -(define-key bmkp-bmenu-omit-menu [bmkp-bmenu-show-only-omitted] - '(menu-item "Show Only Omitted" bmkp-bmenu-show-only-omitted - :visible (not (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)) - :enable bmkp-bmenu-omitted-bookmarks :help "Show only the omitted bookmarks")) -(define-key bmkp-bmenu-omit-menu [bmkp-unomit-all] - '(menu-item "Un-Omit All" bmkp-unomit-all - :visible bmkp-bmenu-omitted-bookmarks :help "Un-omit all omitted bookmarks")) -(define-key bmkp-bmenu-omit-menu [bmkp-bmenu-unomit-marked] - '(menu-item "Un-Omit Marked" bmkp-bmenu-unomit-marked - :visible (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only) - :enable (and bmkp-bmenu-omitted-bookmarks - (save-excursion (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (re-search-forward "^>" (point-max) t))) - :help "Un-omit the marked bookmarks" :keys "\\[bmkp-bmenu-omit/unomit-marked]")) -(define-key bmkp-bmenu-omit-menu [bmkp-bmenu-omit-marked] - '(menu-item "Omit Marked" bmkp-bmenu-omit-marked - :visible (not (eq bmkp-bmenu-filter-function 'bmkp-omitted-alist-only)) - :enable (and (save-excursion (goto-char (point-min)) (forward-line bmkp-bmenu-header-lines) - (re-search-forward "^>" (point-max) t))) - :help "Omit the marked bookmarks" :keys "\\[bmkp-bmenu-omit/unomit-marked]")) - - -;;; `Mark' submenu --------------------------------------------------- -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-not-all] - '(menu-item "Unmark If Not Tagged with All..." bmkp-bmenu-unmark-bookmarks-tagged-not-all - :help "Unmark all visible bookmarks that are tagged with *some* tag in a set you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-none] - '(menu-item "Unmark If Tagged with None..." bmkp-bmenu-unmark-bookmarks-tagged-none - :help "Unmark all visible bookmarks that are *not* tagged with *any* tag you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-all] - '(menu-item "Unmark If Tagged with All..." bmkp-bmenu-unmark-bookmarks-tagged-all - :help "Unmark all visible bookmarks that are tagged with *each* tag you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-some] - '(menu-item "Unmark If Tagged with Some..." bmkp-bmenu-unmark-bookmarks-tagged-some - :help "Unmark all visible bookmarks that are tagged with *some* tag in a set you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-bookmarks-tagged-regexp] - '(menu-item "Unmark If Tagged Matching Regexp..." bmkp-bmenu-unmark-bookmarks-tagged-regexp - :help "Unmark bookmarks any of whose tags match a regexp you enter")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-not-all] - '(menu-item "Mark If Not Tagged with All..." bmkp-bmenu-mark-bookmarks-tagged-not-all - :help "Mark all visible bookmarks that are *not* tagged with *all* tags you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-none] - '(menu-item "Mark If Tagged with None..." bmkp-bmenu-mark-bookmarks-tagged-none - :help "Mark all visible bookmarks that are not tagged with *any* tag you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-all] - '(menu-item "Mark If Tagged with All..." bmkp-bmenu-mark-bookmarks-tagged-all - :help "Mark all visible bookmarks that are tagged with *each* tag you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-some] - '(menu-item "Mark If Tagged with Some..." bmkp-bmenu-mark-bookmarks-tagged-some - :help "Mark all visible bookmarks that are tagged with *some* tag in a set you specify")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmarks-tagged-regexp] - '(menu-item "Mark If Tagged Matching Regexp..." bmkp-bmenu-mark-bookmarks-tagged-regexp - :help "Mark bookmarks any of whose tags match a regexp you enter")) - -(define-key bmkp-bmenu-mark-menu [mark-sep5] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-w3m-bookmarks] - '(menu-item "Mark W3M URLs" bmkp-bmenu-mark-w3m-bookmarks :help "Mark W3M URL bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-url-bookmarks] - '(menu-item "Mark URLs" bmkp-bmenu-mark-url-bookmarks :help "Mark URL bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-gnus-bookmarks] - '(menu-item "Mark Gnus Messages" bmkp-bmenu-mark-gnus-bookmarks :help "Mark Gnus bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-man-bookmarks] - '(menu-item "Mark UNIX Manual Pages" bmkp-bmenu-mark-man-bookmarks - :help "Mark `man' page bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-info-bookmarks] - '(menu-item "Mark Info Nodes" bmkp-bmenu-mark-info-bookmarks :help "Mark Info bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-desktop-bookmarks] - '(menu-item "Mark Desktops" bmkp-bmenu-mark-desktop-bookmarks - :help "Mark desktop bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-variable-list-bookmarks] - '(menu-item "Mark Variable Lists" bmkp-bmenu-mark-variable-list-bookmarks - :help "Mark the variable-list bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-bookmark-file-bookmarks] - '(menu-item "Mark Bookmark Files" bmkp-bmenu-mark-bookmark-file-bookmarks - :help "Mark the bookmark-file bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-region-bookmarks] - '(menu-item "Mark Regions" bmkp-bmenu-mark-region-bookmarks - :help "Mark bookmarks that record a region")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-non-file-bookmarks] - '(menu-item "Mark Non-Files (Buffers)" bmkp-bmenu-mark-non-file-bookmarks - :help "Mark non-file bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-orphaned-local-file-bookmarks] - '(menu-item "Mark Orphaned Local Files" bmkp-bmenu-mark-orphaned-local-file-bookmarks - :help "Mark orphaned local-file bookmarks (`C-u': remote also)")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-image-bookmarks] - '(menu-item "Mark Images" bmkp-bmenu-mark-image-bookmarks :help "Mark image-file bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-file-bookmarks] - '(menu-item "Mark Files" bmkp-bmenu-mark-file-bookmarks :help "Mark file bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-dired-bookmarks] - '(menu-item "Mark Dired Buffers" bmkp-bmenu-mark-dired-bookmarks :help "Mark Dired bookmarks")) - -(define-key bmkp-bmenu-mark-menu [mark-sep4] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-specific-file-bookmarks] - '(menu-item "Mark for Specific File" bmkp-bmenu-mark-specific-file-bookmarks - :help "Mark bookmarks for a specific file")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-specific-buffer-bookmarks] - '(menu-item "Mark for Specific Buffer" bmkp-bmenu-mark-specific-buffer-bookmarks - :help "Mark bookmarks for a specific buffer")) - -(define-key bmkp-bmenu-mark-menu [mark-sep3] '("--")) ; ---------------------------------- -(when (featurep 'bookmark+-lit) - (define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-lighted-bookmarks] - '(menu-item "Mark Highlighted" bmkp-bmenu-mark-lighted-bookmarks - :help "Mark highlighted bookmarks"))) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-temporary-bookmarks] - '(menu-item "Mark Temporaries" bmkp-bmenu-mark-temporary-bookmarks - :help "Mark temporary bookmarks (those with `X')")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-autonamed-bookmarks] - '(menu-item "Mark Autonamed" bmkp-bmenu-mark-autonamed-bookmarks - :help "Mark autonamed bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-autofile-bookmarks] - '(menu-item "Mark Autofiles" bmkp-bmenu-mark-autofile-bookmarks - :help "Mark autofile bookmarks: those whose names are the same as their files")) - -(define-key bmkp-bmenu-mark-menu [mark-sep2] '("--")) ; ---------------------------------- -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-unmark-all] - '(menu-item "Unmark All" bmkp-bmenu-unmark-all - :help "Remove a mark you specify (> or D) from each bookmark (RET to remove both kinds)")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-mark-all] - '(menu-item "Mark All" bmkp-bmenu-mark-all :help "Mark all bookmarks, using mark `>'")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-toggle-marks] - '(menu-item "Toggle Marked/Unmarked" bmkp-bmenu-toggle-marks - :help "Unmark all marked bookmarks; mark all unmarked bookmarks")) -(define-key bmkp-bmenu-mark-menu [bmkp-bmenu-regexp-mark] - '(menu-item "Mark Regexp Matches..." bmkp-bmenu-regexp-mark - :help "Mark bookmarks that match a regexp that you enter")) - - - -;;;--------------------------------------------------------------------------------------- - -;;; Mouse-3 menu binding. - -(defvar bmkp-bmenu-line-overlay nil - "Overlay to highlight the current line for `bmkp-bmenu-mouse-3-menu'.") -(define-key bookmark-bmenu-mode-map [down-mouse-3] 'bmkp-bmenu-mouse-3-menu) -(define-key bookmark-bmenu-mode-map [mouse-3] 'ignore) - -;;;###autoload -(defun bmkp-bmenu-mouse-3-menu (event) - "Pop-up menu on `mouse-3' for a bookmark listed in `*Bookmark List*'." - (interactive "e") - (let* ((mouse-pos (event-start event)) - (inhibit-field-text-motion t) ; Just in case. - bol eol bmk-name) - (with-current-buffer (window-buffer (posn-window mouse-pos)) - (save-excursion - (goto-char (posn-point mouse-pos)) - (setq bol (line-beginning-position) - eol (line-end-position)) - (unwind-protect - (progn - (if bmkp-bmenu-line-overlay ; Don't re-create. - (move-overlay bmkp-bmenu-line-overlay bol eol (current-buffer)) - (setq bmkp-bmenu-line-overlay (make-overlay bol eol)) - (overlay-put bmkp-bmenu-line-overlay 'face 'region)) - (setq bmk-name (bookmark-bmenu-bookmark)) - (when bmk-name - (sit-for 0) - (let* ((map (easy-menu-create-menu - "This Bookmark" - `(,(if (bmkp-bookmark-name-member bmk-name - bmkp-bmenu-marked-bookmarks) - ["Unmark" bookmark-bmenu-unmark] - ["Mark" bookmark-bmenu-mark]) - ,(save-excursion - (goto-char (posn-point mouse-pos)) - (beginning-of-line) - (if (looking-at "^D") - ["Unmark" bookmark-bmenu-unmark] - ["Flag for Deletion" bookmark-bmenu-delete])) - ["Omit" bmkp-bmenu-omit] - ["Jump To" bookmark-bmenu-this-window] - ["Jump To in Other Window" bookmark-bmenu-other-window] - - "--" ; ---------------------------------------------------- - ["Edit Tags..." bmkp-bmenu-edit-tags - :active (bmkp-get-tags bmk-name)] - ["Copy Tags" bmkp-bmenu-copy-tags - :active (bmkp-get-tags bmk-name)] - ["Paste Tags (Add)" bmkp-bmenu-paste-add-tags] - ["Paste Tags (Replace)" bmkp-bmenu-paste-replace-tags] - ["Add Some Tags..." bmkp-bmenu-add-tags] - ["Remove Some Tags..." bmkp-bmenu-remove-tags - :active (bmkp-get-tags bmk-name)] - ["Remove All Tags..." bmkp-bmenu-remove-all-tags - :active (bmkp-get-tags bmk-name)] - ["Set Tag Value..." bmkp-bmenu-set-tag-value - :active (bmkp-get-tags bmk-name)] - ["Rename Tag..." bmkp-rename-tag - :active (bmkp-get-tags bmk-name)] - - ["--" 'ignore :visible (featurep 'bookmark+-lit)] ; --------------- - ["Highlight" bmkp-bmenu-light - :visible (featurep 'bookmark+-lit) - :active (not (bmkp-lighted-p bmk-name))] - ["Unhighlight" bmkp-bmenu-unlight - :visible (featurep 'bookmark+-lit) - :active (bmkp-lighted-p bmk-name)] - ["Set Lighting" bmkp-bmenu-set-lighting - :visible (featurep 'bookmark+-lit)] - - "--" ; ---------------------------------------------------- - ["Toggle Temporary/Savable" bmkp-bmenu-toggle-temporary] - ["Rename or Relocate..." bmkp-bmenu-edit-bookmark-name-and-file] - ["Edit Internal Record (Lisp)..." bmkp-bmenu-edit-bookmark-record] - ["Show Annotation" bookmark-bmenu-show-annotation - :active (bookmark-get-annotation bmk-name)] - ["Add/Edit Annotation..." bookmark-bmenu-edit-annotation] - - "--" ; ---------------------------------------------------- - ["Describe" bmkp-bmenu-describe-this-bookmark]))) - (choice (x-popup-menu event map))) - (when choice - (call-interactively (lookup-key map (apply 'vector choice))))))) - (when bmkp-bmenu-line-overlay (delete-overlay bmkp-bmenu-line-overlay))))))) - -;;;;;;;;;;;;;;;;;;;;; - -(provide 'bookmark+-bmu) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; bookmark+-bmu.el ends here diff --git a/.emacs.d/elisp/icicle/bookmark+-chg.el b/.emacs.d/elisp/icicle/bookmark+-chg.el deleted file mode 100644 index 71ac460..0000000 --- a/.emacs.d/elisp/icicle/bookmark+-chg.el +++ /dev/null @@ -1,2316 +0,0 @@ -;;; bookmark+-chg.el - Change logs for Bookmark+ libraries. -;; -;; Filename: bookmark+-chg.el -;; Description: Change logs for Bookmark+ libraries. -;; Author: Drew Adams -;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") -;; Copyright (C) 2000-2012, Drew Adams, all rights reserved. -;; Created: Fri Sep 15 07:58:41 2000 -;; Last-Updated: Wed May 16 08:25:04 2012 (-0700) -;; By: dradams -;; Update #: 14938 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-chg.el -;; Keywords: bookmarks, bookmark+ -;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x -;; -;; Features that might be required by this library: -;; -;; None -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; Change log for the Bookmark+ libraries, which extend standard -;; library `bookmark.el'. This file contains no code, so you need -;; not load it. -;; -;; The Bookmark+ libraries are these: -;; -;; `bookmark+.el' - main (driver) code library -;; `bookmark+-mac.el' - Lisp macros -;; `bookmark+-lit' - (optional) code for highlighting bookmarks -;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (bmenu) -;; `bookmark+-1.el' - other (non-bmenu) required code -;; `bookmark+-key.el' - key and menu bindings -;; -;; `bookmark+-doc' - documentation (comment-only file) -;; `bookmark+-chg' - change log (this file) -;; -;; The documentation (in `bookmark+-doc.el') includes how to -;; byte-compile and install Bookmark+. The documentation is also -;; available in these ways: -;; -;; 1. From the bookmark list (`C-x r l'): -;; Use `?' to show the current bookmark-list status and general -;; help, then click link `Doc in Commentary' or link `Doc on the -;; Web'. -;; -;; 2. From the Emacs-Wiki Web site: -;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus. -;; -;; 3. From the Bookmark+ group customization buffer: -;; `M-x customize-group bookmark-plus', then click link -;; `Commentary'. -;; -;; (The commentary links in #1 and #3 work only if you put library -;; `bookmark+-doc.el' in your `load-path'.) -;; -;; -;; ****** NOTE ****** -;; -;; WHENEVER you update Bookmark+ (i.e., download new versions of -;; Bookmark+ source files), I recommend that you do the -;; following: -;; -;; 1. Delete ALL existing BYTE-COMPILED Bookmark+ files -;; (bookmark+*.elc). -;; 2. Load Bookmark+ (`load-library' or `require'). -;; 3. Byte-compile the source files. -;; -;; In particular, ALWAYS LOAD `bookmark+-mac.el' (not -;; `bookmark+-mac.elc') BEFORE YOU BYTE-COMPILE new versions of -;; the files, in case there have been any changes to Lisp macros -;; (in `bookmark+-mac.el'). -;; -;; (This is standard procedure for Lisp: code that depends on -;; macros needs to be byte-compiled anew after loading the -;; updated macros.) -;; -;; ****************** -;; -;; -;; ****** NOTE ****** -;; -;; On 2010-06-18, I changed the prefix used by package Bookmark+ -;; from `bookmarkp-' to `bmkp-'. THIS IS AN INCOMPATIBLE CHANGE. -;; I apologize for the inconvenience, but the new prefix is -;; preferable for a number of reasons, including easier -;; distinction from standard `bookmark.el' names. -;; -;; This change means that YOU MUST MANUALLY REPLACE ALL -;; OCCURRENCES of `bookmarkp-' by `bmkp-' in the following -;; places, if you used Bookmark+ prior to this change: -;; -;; 1. In your init file (`~/.emacs') or your `custom-file', if -;; you have one. This is needed if you customized any -;; Bookmark+ features. -;; -;; 2. In your default bookmark file, `bookmark-default-file' -;; (`.emacs.bmk'), and in any other bookmark files you might -;; have. -;; -;; 3. In your `*Bookmark List*' state file, -;; `bmkp-bmenu-state-file' (`~/.emacs-bmk-bmenu-state.el'). -;; -;; 4. In your `*Bookmark List*' commands file, -;; `bmkp-bmenu-commands-file' (`~/.emacs-bmk-bmenu-commands.el'), -;; if you have one. -;; -;; You can do this editing in a virgin Emacs session (`emacs -;; -Q'), that is, without loading Bookmark+. -;; -;; Alternatively, you can do this editing in an Emacs session -;; where Bookmark+ has been loaded, but in that case you must -;; TURN OFF AUTOMATIC SAVING of both your default bookmark file -;; and your `*Bookmark List*' state file. Otherwise, when you -;; quit Emacs your manually edits will be overwritten. -;; -;; To turn off this automatic saving, you can use `M-~' and `M-l' -;; in buffer `*Bookmark List*' (commands -;; `bmkp-toggle-saving-bookmark-file' and -;; `bmkp-toggle-saving-menu-list-state' - they are also in the -;; `Bookmark+' menu). -;; -;; -;; Again, sorry for this inconvenience. -;; -;; ****************** - -;;(@> "Index") -;; -;; If you have library `linkd.el' and Emacs 22 or later, load -;; `linkd.el' and turn on `linkd-mode' now. It lets you easily -;; navigate around the sections of this doc. Linkd mode will -;; highlight this Index, as well as the cross-references and section -;; headings throughout this file. You can get `linkd.el' here: -;; http://dto.freeshell.org/notebook/Linkd.html. -;; -;; (@> "CHANGE LOG FOR `bookmark+-1.el'") -;; (@> "CHANGE LOG FOR `bookmark+-bmu.el'") -;; (@> "CHANGE LOG FOR `bookmark+-key.el'") -;; (@> "CHANGE LOG FOR `bookmark+-lit.el'") -;; (@> "CHANGE LOG FOR `bookmark+-mac.el'") -;; (@> "CHANGE LOG FOR `bookmark+.el'") - -;;;(@* "CHANGE LOG FOR `bookmark+-1.el'") -;; -;; 2012/05/16 dadams -;; Added: bmkp-string-less-case-fold-p. -;; bmkp-list-all-tags: List tags alphabetically. Thx to Anders Johansson for the suggestion. -;; 2012/05/05 dadams -;; bookmark-store, bmkp-make-function-bookmark, bmkp-unomit-all, bmkp-url-target-set: -;; Added optional arg NO-MSG-P. -;; bookmark-store, bookmark-set, bmkp-record-visit, bmkp-make-function-bookmark, -;; bmkp-current-bookmark-list-state, bmkp-unomit-all, bmkp-url-target-set, bmkp-file-target-set, -;; bmkp-replace-existing-bookmark: -;; Pass NO-MSG-P to *-refresh/rebuild-menu-list, *-surreptitiously-rebuild-list, *-store. -;; 2012/05/04 dadams -;; bmkp-remove-tags, bmkp-all-tags(-regexp)-alist-only -;; bmkp(-(auto)file(-this-dir))(-(all|some)-tags)(-regexp)-alist-only, -;; bmkp-specific-(buffers|files)-alist-only, bmkp-sort-omit, bmkp-url-target-set, -;; bmkp-autofile-remove-tags. bmkp-default-handler-for-file, bmkp-set-bookmark-file-bookmark, -;; bmkp-set-desktop-bookmark, bmkp-set-variable-list-bookmark, -;; bmkp-create-variable-list-bookmark, bmkp-jump-dired, -;; bmkp-find-file-(all|some)-tags(-regexp)(-other-window): -;; Use lexical-let(*), to get closures for free vars in lambdas. -;; bmkp-regexp-filtered-(file-name|tags)-alist-only: Moved let inside lambda. -;; bmkp-make-dired-record: Use car instead of (lambda (x) (car x)). -;; 2012/05/01 dadams -;; Added: bmkp-tagged-bookmark-p (alias), bmkp-tagged-cp. -;; bmkp-(add|remove)-tags: Return negative nb-* if changed from (un)tagged to not (un)tagged. -;; bmkp-paste-replace-tags: Do not call bmkp-remove-all-tags unless there are tags to remove. -;; 2012/04/27 dadams -;; bmkp-edit-(tags|bookmark-record): Use bmkp-with-output-to-plain-temp-buffer. -;; 2012/04/18 dadams -;; Do not try to define bmkp-global-auto-idle-bookmark-mode for Emacs 21 (no define-globalized*). -;; 2012/04/16 dadams -;; bmkp-bookmark-description: List tags as strings on separate lines. -;; Add newline after annotation. -;; 2012/04/13 dadams -;; Added: bmkp-(flagged|modified)-bookmark-p, bmkp-(flagged|modified)-cp. -;; bookmark-store, bookmark-set-name, bookmark-prop-set, bmkp-edit-bookmark-record(s)-send, -;; bmkp-replace-existing-bookmark, bmkp-delete-bookmarks: -;; Use (equivalent of) eq version of add-to-list. -;; 2012/04/10 dadams -;; Added: bmkp-count-multi-mods-as-one-flag. -;; bmkp-edit-bookmark-records-send, bmkp-set-tag-value-for-bookmarks, bmkp-remove-tags-from-all, -;; bmkp-rename-tag, bmkp-purge-notags-autofiles, -;; bmkp-delete(-all)-autonamed(-for)(-this-buffer)(-no-confirm), bmkp-delete-bookmarks, -;; bmkp-delete(-all)-temporary(-bookmarks|-no-confirm): -;; Corrected bookmark-save to bookmark-save-flag in bindings to nil. -;; Use bmkp-count-multi-mods-as-one-flag for the binding. -;; 2012/04/09 dadams -;; bookmark-relocate, bmkp-edit-bookmark-records-send, bmkp-set-tag-value, bmkp-file-target-set, -;; bmkp-autofile-set: -;; Added optional arg NO-UPDATE-P. Use it to inhibit display refreshing. -;; bmkp-edit-bookmark-records-send, bmkp-set-tag-value-for-bookmarks, bmkp-remove-tags-from-all, -;; bmkp-rename-tag, bmkp-purge-notags-autofiles, delete-all-autonamed-for-this-buffer -;; bmkp-delete(-all)-temporary-(bookmarks|no-confirm), bmkp-delete-bookmarks, -;; bmkp-delete-autonamed(-this-buffer)(-no-confirm): -;; Bind bookmark-save to nil around iteration, to inhibit saving until finished. -;; bmkp-(add|remove)(-all)-tags, bmkp-paste-(add|replace)-tags, bmkp-autofile-(add|remove)-tags: -;; Swapped order of args MSGP and NO-UPDATE-P (put MSGP last). -;; bmkp-(add|remove)(-all)-tags, bmkp-autofile-(add|remove)-tags: -;; Use NO-UPDATE-P also to inhibit display refreshing. -;; bmkp-remove-tags-from-all: Pass non-nil NO-UPDATE-P arg to bmkp-remove-tags. -;; 2012/04/07 dadams -;; Added: bmkp-new-bookmark-default-names (option & function). -;; Redefine bookmark-make-record (for all Emacs versions) to use bmkp-new-bookmark-default-names. -;; bookmark-set: Use bmkp-new-bookmark-default-names (multiple defaults). -;; Moved the region-text default value stuff to fn bmkp-new-bookmark-default-names. -;; bmkp-completing-read-1: Handle a cons DEFAULT. -;; Added soft require of thingatpt+.el. -;; 2012/04/06 dadams -;; Added: bmkp-auto-idle-bookmark-min-distance, bmkp-not-near-other-auto-idle-bmks, -;; bmkp-auto-idle-bookmarks. -;; bmkp-autotemp-bookmark-predicates: -;; Changed default value to include bmkp-autonamed-bookmark(-this-buffer)-p. -;; bookmark-store: Add the bookmark to bmkp-auto-idle-bookmarks (if appropriate). -;; bookmark-delete: Remove the bookmark from bmkp-auto-idle-bookmarks. -;; bmkp-auto-idle-bookmark-mode: -;; Bind bmkp-setting-auto-idle-bmk-p. Do nothing if bmkp-not-near-other-auto-idle-bmks says so. -;; 2012/04/05 dadams -;; Added (Emacs 21+): bmkp-global-auto-idle-bookmark-mode, bmkp-turn-on-auto-idle-bookmark-mode. -;; bmkp-auto-idle-bookmark-mode (Emacs 21+): -;; Made it local: -;; Removed keyword :global, added keyword :require. -;; Timer function does nothing if the mode is not enabled (i.e., for the current buffer). -;; bmkp-auto-idle-bookmark-mode (Emacs 20): -;; Changed interactive spec to handle toggle symbol. -;; Timer function does nothing if the mode is not enabled (for the current buffer, if local). -;; Change message to mention buffer when the mode is local. -;; Removed: bmkp-auto-idle-bookmark-mode-hook. -;; Added autoload cookie for Emacs 20 defcustom for bmkp-auto-idle-bookmark-mode. -;; bmkp-auto-idle-bookmark-mode-timer: Use nil as default value. -;; bmkp-auto-idle-bookmark-mode: If timer is non-nil, set it to nil (and cancel it). -;; 2012/04/04 dadams -;; Added: bmkp-auto-idle-bookmark-mode(-delay|-hook|-lighter|-set-function), -;; bmkp-temporary-bookmarking-mode-lighter, bmkp-auto-idle-bookmark-mode-timer. -;; bmkp-temporary-bookmarking-mode: Added lighter. -;; bookmark-set: Pass INTERACTIVEP arg, not constant MSGP, to bmkp-light-(bookmarks|this-buffer). -;; 2012/04/03 dadams -;; Moved to bookmark+-bmu.el: bmkp-face-prop. -;; 2012/04/02 dadams -;; bmkp-toggle-autonamed-bookmark-set/delete, bmkp-set-autonamed-bookmark(-at-line), -;; bmkp-delete-bookmarks: -;; Made POSITION, NUMBER, ALLP optional. -;; 2012/03/18 dadams -;; Added: bmkp-modified-bookmarks, redefinition of bookmark-set-name. -;; bookmark-store, bookmark-set-name, bookmark-prop-set, bmkp-replace-existing-bookmark: -;; Add the bookmark to bmkp-modified-bookmarks. -;; bookmark-rename: Call bmkp-rename-for-marked-and-omitted-lists _after_ set new name w/ prop. -;; bookmark-save: Reset bmkp-modified-bookmarks. Call bmkp-refresh/rebuild-menu-list. -;; bmkp-rename-for-marked-and-omitted-lists: Fixed typo: marked -> omitted. -;; bmkp-edit-bookmark-name-and-file: -;; Save each of bmk name and file name only if changed (bug fix). Provide default file name. -;; If no automatic save, and modifications, ask user whether to save. -;; bmkp-edit-bookmark-records-send: -;; Add updated bookmarks to bmkp-modified-bookmarks. -;; Merge sanity-check dolist with main dolist. -;; Set bmkp-bmenu-marked-bookmarks to names in bmkp-modified-bookmarks, not in edited-bookmarks. -;; bmkp-edit-bookmark-record: Use (shallow) copy of bmkp-edit-bookmark-orig-record, not original. -;; bmkp-edit-bookmark-record-send: Add updated bookmark to bmkp-modified-bookmarks. -;; bmkp-record-visit: Let-bind bmkp-modified-bookmarks to itself, so will be restored. -;; bmkp-refresh-menu-list: Pass no FILTEREDP if no current filter (start anew). -;; bmkp-bookmark-name-member: If a name in NAMES is unpropertized, don't try to match property. -;; bmkp-replace-existing-bookmark: For propertize bookmark-current-bookmark with bmkp-full-record. -;; 2012/03/13 dadams -;; bmkp-incremental-filter-delay: -;; Use bookmark-search-delay as default value, if available. Else use 0.2 (not 0.6). -;; 2012/03/11 dadams -;; bmkp-revert-bookmark-file: Added p to interactive spec (forgot). -;; 2012/03/06 dadams -;; Added: bmkp-revert-bookmark-file. -;; bookmark-load: If bookmark-file buffer already existed, do not kill it after loading. -;; 2012/03/04 dadams -;; Added: bmkp-refresh/rebuild-menu-list. -;; bookmark-store, bookmark-send-edited-annotation, bookmark-delete, -;; bmkp-edit-bookmark-record(s)-send, bmkp-edit-tags-send, bmkp-update-autonamed-bookmark, -;; bmkp-remove(-all)-tags, bmkp-add-tags, bmkp-file-target-set, bmkp-refresh/rebuild-menu-list: -;; Use bmkp-refresh/rebuild-menu-list. -;; bookmark-load: -;; Use bmkp-refresh/rebuild-menu-list only if interactive. Do not call *-surreptitiously-*. -;; bmkp-edit-bookmark-record(s)-send: Added optional arg MSGP. Raise read error if batch. -;; bmkp-record-visit: -;; Added optional arg BATCHP. Do not bookmark-bmenu-surreptitiously-rebuild-list if BATCHP. -;; bmkp-edit-tags-send: Added optional arg BATCHP, and pass it to bmkp-record-visit. -;; bmkp-refresh-menu-list: Use bmkp-bookmark-name-from-record only when BOOKMARK is non-nil. -;; bmkp-paste-replace-tags, bmkp-(compilation|occur)-target-set-all: -;; Raise error with OK message if user cancels. -;; bmkp-purge-notags-autofiles, bmkp-delete-all-temporary-bookmarks: Added optional arg MSGP. -;; bmkp-purge-notags-autofiles, bmkp-delete-all-temporary-bookmarks, -;; bmkp-delete-temporary-no-confirm: -;; Call bmkp-refresh/rebuild-menu-list after the dolist. Inhibit refresh for bookmark-delete. -;; bmkp-jump-bookmark-file: Removed reference to current-prefix-arg: prompt only if SWITCHP. -;; bmkp-delete-all-autonamed-for-this-buffer: -;; Added optional arg MSGP. Prompt for confirmation only if MSGP. -;; bmkp-delete-autonamed-this-buffer-no-confirm: -;; Added optional arg NO-REFRESH-P. Inhibit refresh for bookmark-delete. -;; Unless NO-REFRESH-P, call bmkp-refresh/rebuild-menu-list after the dolist. -;; bmkp-delete-autonamed-no-confirm: -;; Call bmkp-delete-autonamed-this-buffer-no-confirm with NO-REFRESH-P. -;; Call bmkp-refresh/rebuild-menu-list after the dolist. -;; bmkp-delete-bookmarks: -;; Added optional arg MSGP. Prompt for confirmation only if MSGP. -;; Raise error with OK message if user cancels. -;; Call bmkp-refresh/rebuild-menu-list after the dolist. Inhibit refresh for bookmark-delete. -;; Use bmkp-this-buffer-alist-only, not bookmark-alist, for selecting bookmarks. -;; Use `...', etc. when echoing deleted bookmarks. -;; 2012/03/02 dadams -;; bookmark-load: -;; Changed last arg from NO-MSG-P to BATCHP. If non-nil, act with no prompt, saving or not. -;; If nil, prompt user whether to save before loading. If user quits with C-g, do not load. -;; bookmark-maybe-load-default-file: Pass symbol nosave, not t, as last arg to bookmark-load. -;; bmkp-switch-bookmark-file-create: Last arg is now the complement: BATCHP, not INTERACTIVEP. -;; bmkp-temporary-bookmarking-mode: Pass nosave as last arg to bookmark-load, since do save here. -;; bmkp-default-handlers-for-file-types: Added eval-when-compile to require cl.el for Emacs 20. -;; bmkp-maybe-save-bookmarks: Added optional arg SAME-COUNT-P. -;; bmkp-record-visit: Pass non-nil arg to bmkp-maybe-save-bookmarks to prevent changing mod count. -;; bookmark-store: Call bmkp-refresh-menu-list if Bookmark List is displayed. -;; bmkp-toggle-saving-bookmark-file: Added optional arg MSGP - show message only if non-nil. -;; bmkp-find-file(-other-window): Added missing FIL arg for error format string. -;; bmkp-temporary-bookmarking-mode: Pass a MSGP arg to bmkp-toggle-saving-bookmark-file. -;; 2012/02/29 dadams -;; bmkp-completing-read-lax: Bind & restore C-M-w, C-M-u, SPC, and ? (so can insert SPC, ? etc.). -;; 2012/02/28 dadams -;; bmkp-file-target-set: Call bmkp-refresh-menu-list if Bookmark List is displayed. -;; Renamed option bmkp-default-handler-associations to bmkp-default-handlers-for-file-types. -;; bmkp-default-handler-associations is NOW OBSOLETE - RENAME IT IF YOU HAVE CUSTOMIZED IT. -;; bmkp-same-file-p: Take advantage of Emacs 24 function, file-equal-p. Thx to Michael Albinus. -;; bmkp-find-file(-other-window): -;; Added optional args CREATE-AUTOFILE-P & MSGP (new arg order). Prefix arg creates bookmark. -;; Use bmkp-default-handlers-for-file-types even for files not bookmarked. -;; 2012/02/26 dadams -;; Added: bmkp-(autofile|autonamed)-history, bmkp-autofile-(all|some)-tags(-regexp)-alist-only, -;; bmkp-autofile(-(all|some)-tags(-regexp))-jump(-other-window). -;; bmkp-types-alist: Added entries for (autofile|autonamed). -;; Everywhere that read-file-name is used: -;; Bind icicle-unpropertize-completion-result-flag to t, for read-file-name. -;; No longer alias bmkp-autofile*-jump to bmkp-find-file. The *-autofile-*jump commands use -;; bmkp-read-bookmark-for-type and bmkp-jump-1, not read-file-name and find-file. -;; bmkp-find-file(-other-window): -;; Added optional args FILE MUST-EXIST-P. -;; Use read-file-name and either bookmark-jump or find-file, not just find-file (and no PRED). -;; bmkp-find-file-*-tags(-regexp)(-other-window): -;; Added optional FILE arg. -;; Use bookmark-jump, not find-file - so only autofiles with the tags are candidates. -;; Bind icicle-must-pass-after-match-predicate. Use PRED for read-file-name only if no Icicles. -;; The new bmkp-find-file* commands are bound to ... C-f, not ... a. -;; bmkp-default-handler-associations: Correct docstring: double backslashes. -;; 2012/02/21 dadams -;; bmkp-jump-to-type(-other-window): Corrected ALIST: If no HISTORY do not call *-alist-only. -;; 2012/02/20 dadams -;; bookmark-handle-bookmark: Handle, in priority, new property file-handler. -;; bookmark-default-handler: Handle new property file-handler. -;; bmkp-make-record-for-target-file: -;; Use new property file-handler, not handler, for default handler. -;; Use file-handler with play-sound-file, not handler with bmkp-sound-jump (deprecated). -;; bmkp-default-handler-for-file: Return function bmkp-user, not a lambda that applies it to file. -;; bmkp-handler-pred: -;; Return t if TYPE is handler or file-handler. Do not match a lambda that applies the handler. -;; bmkp-default-handler-associations, bookmark-alist, bmkp-jump-to-type: -;; Updated doc string to reflect new implementation of file handlers using prop file-handler. -;; 2012/02/19 dadams -;; Added: bmkp-handler-pred, bmkp-temporary-history, bmkp-w32-browser-jump. -;; bmkp-types-alist: Added bmkp-temporary-history. -;; bmkp-read-bookmark-for-type: Prepend a space before "bookmark" in prompt. -;; bmkp-jump-to-type: -;; Use lax completion. -;; When call bmkp-read-bookmark-for-type: -;; Do not append a space to TYPE name passed. -;; Pass a predicate arg returned by bmkp-handler-pred when TYPE is not a known type. -;; bmkp-*-jump(-other-window): Remove space after TYPE name passed to bmkp-read-bookmark-for-type. -;; bmkp-(specific-(buffers|files)|temporary)-jump(-other-window): -;; Pass specific HIST arg to bmkp-read-bookmark-for-type. -;; 2012/02/16 dadams -;; Updated for Emacs 24+: -;; bookmark-set: Do not set bookmark-(yank-point|current-buffer) if set. -;; bmkp-make-gnus-record: Be able to bookmark from article buffer, as well as summary buffer. -;; bmkp-jump-gnus: Go to article buffer if location field says to. -;; Use bmkp-make-gnus-record (not gnus-summary-bookmark-make-record) for Emacs 24+ also. -;; 2012/02/14 dadams -;; bmkp-set-desktop-bookmark: Provide default for read-file-name. Thx to Markus Grunwald. -;; Provide all bookmarked desktop files as Icicles proxy candidates. -;; 2012/02/08 dadams -;; bmkp-autofile-set: Use MSGP also for the case where the bookmark already exists. -;; bmkp-remove-dups: Redefined to use a hash table. -;; 2012/02/07 dadams -;; bmkp-same-file-p: Test compare-strings result using t, not non-nil. Thx to Michael Heerdegen. -;; 2012/02/04 dadams -;; Added: bmkp-tags-for-completion, bmkp-tags-in-bookmark-file. -;; Use bmkp-tags-for-completion for tags completing everywhere - updated doc strings. -;; bmkp-list-all-tags: Added args current-only-p and (optional) msgp. -;; Different prefix arg values for different behaviors. -;; bmkp-tags-list: Added optional arg current-only-p. Use bmkp-tags-for-completion by default. -;; 2012/01/20 dadams -;; bmkp(-autofile)-(add|remove)-tags(-from-all), bmkp-find-file-(all|some)-tags(-other-window), -;; bmkp(-file(-this-dir))-(all|some)-tags-jump(-other-window): -;; Let user use a prefix arg to refresh tags list. Add this info to doc string. -;; 2012/01/14 dadams -;; Corrected bmkp-same-file-p: call to compare-strings. -;; 2012/01/13 dadams -;; bmkp-same-file-p: Handle case-sensitivity for local files, at least (not yet done for remote). -;; 2012/01/08 dadams -;; Added: bmkp-autonamed-this-buffer-bookmark-p. -;; bmkp-autotemp-bookmark-predicates: Updated doc string for *-autonamed-this-buffer-bookmark-p. -;; bmkp-autonamed-bookmark-for-buffer-p: Updated doc string to mention it just checks the name. -;; bmkp-autonamed-this-buffer-alist-only: -;; Use bmkp-this-buffer-p, not bmkp-autonamed-bookmark-for-buffer-p. -;; 2011/12/30 dadams -;; Renamed bmkp-edit-bookmark to bmkp-edit-bookmark-name-and-file. -;; Added aliases: bmkp-bookmark-(data|name)-from-record. -;; Added: bmkp-get-bookmark-in-alist, bmkp-bookmark-record-from-name, -;; bmkp-edit-bookmark-records-(number|send|mode(-map)), -;; bookmark-alist-from-buffer (redefinition), bmkp-edit-bookmark-orig-record, -;; bmkp-rename-for-marked-and-omitted-lists. -;; Use new names (aliases) bmkp-bookmark-(data|name)-from-record. -;; bookmark-get-bookmark-record: Use redefinition for all Emacs versions (updated doc string). -;; bookmark-get-bookmark: Use bmkp-bookmark-record-from-name, with no MEMP check. -;; bookmark-store: Use bmkp-get-bookmark-in-alist to test whether bookmark exists. -;; Set the bookmark name also, not just the data, for an existing bookmark. -;; Unconditionally always put full bookmark on name as property bmkp-full-record. -;; bookmark-send-edited-annotation, bookmark-rename: -;; Do bookmark-bmenu-surreptitiously-rebuild-list only if no bmenu display window. -;; bookmark-rename: -;; Return OLD if if BATCHP is non-nil and NEW is nil. Do not prompt for name if BATCHP. -;; Use bmkp-rename-for-marked-and-omitted-lists (rename in those lists too). -;; Unconditionally always put full bookmark on name as property bmkp-full-record. -;; Use bmkp-bookmark-record-from-name, not bookmark-get-bookmark, to get full record. -;; bookmark-delete, bmkp-edit-bookmark-name-and-file, bmkp-edit-bookmark-record, -;; bmkp-edit-tags(-send), bmkp-toggle-autonamed-bookmark-set/delete: -;; Use bmkp-get-bookmark-in-alist, not bookmark-get-bookmark. -;; bookmark-load: Call bmkp-refresh-menu-list only if display is visible, and with NO-MSG-P arg. -;; bookmark-show-annotation: Do not raise error if not a valid bookmark. -;; bmkp-edit-bookmark-record: Record bmkp-edit-bookmark-orig-record. Strip properties from name. -;; Updated edit-buffer text. -;; bmkp-edit-bookmark-record-send: Rewrote similarly to bmkp-edit-bookmark-records-send. No args. -;; bmkp-default-bookmark-name: -;; Use bmkp-bookmark-record-from-name, not bookmark-get-bookmark, requiring membership in ALIST. -;; bmkp-save-menu-list-state, bmkp-get-tag-value: Added optional arg MSGP, and status messages. -;; bmkp-make-function-bookmark: Use bmkp-bookmark-record-from-name, not bookmark-get-bookmark. -;; bmkp-autonamed-bookmark(-for-buffer)-p: -;; Use bmkp-bookmark-name-from-record, not bookmark-get-bookmark and bookmark-name-from-*. -;; bmkp-get-tag-value, bmkp-has-tag-p: Removed unused arg MSGP. -;; bmkp-delete-bookmark-name-from-list: -;; For unpropertized DELNAME, Set BNAMES to result of delete call. -;; For propertized DELNAME, delete also unpropertized matches. -;; bmkp-(compilation|occur)-target-set-all: Do not prompt or show message unless MSGP. -;; bmkp-describe-bookmark-internals: Use a copy of the bookmark. Strip properties from name. -;; bmkp-set-autonamed-regexp-buffer: Pass MSGP, do not hardcode.n -;; Doc string improvements. -;; 2011/12/24 dadams -;; bmkp-refresh-menu-list: Added progress message. -;; bmkp-jump-bookmark-file: Pass NO-MSG-P arg to bookmark-load. -;; 2011/12/21 dadams -;; Added: bmkp-orphaned(-local|-remote)-file-(alist-only|bookmark-p), -;; bmkp-dired-wildcards-bookmark-p. -;; bookmark-load: -;; Call (bmkp-refresh-menu-list (bookmark-bmenu-bookmark)), not (bmkp-bmenu-refresh-menu-list). -;; 2011/12/19 dadams -;; bookmark-set, bmkp-handle-region-default: Use line-end-position, not end-of-line + point. -;; 2011/12/17 dadams -;; bmkp-remote-file-p: -;; If file-remote-p not available, match /...: (same as ffap-ftp-regexp). Return match. -;; bmkp-same-file-p: Redefined to use new bmkp-remote-file-p. Thx to M. Heerdegen & M. Albinus. -;; 2011/12/15 dadams -;; bmkp-dired-this-dir-bookmark-p: Use file-name-directory, in case filename has wildcards. -;; 2011/12/13 dadams -;; bmkp-handle-region-default: Limit buffer-substring-no-properties positions to point-min/max. -;; 2011/12/06 dadams -;; bmkp-last-as-first-bookmark-file: -;; Removed autoload cookie to avoid void-variable error for bookmark-default-file. -;; bmkp-edit-bookmark, bookmark-rename: Use bmkp-completing-read-lax, not read-from-minibuffer. -;; 2011/12/05 dadams -;; bmkp-this-buffer-p: -;; Do not use buffer-file-name (for Dired). Wrap bookmark-buffer-file-name with condition-case. -;; bookmark-save: Swap write order, so last message is about the bookmark file, not customize. -;; 2011/12/03 dadams -;; Renamed: bmkp-use-bookmark-file-create to bmkp-switch-bookmark-file-create. -;; Added: bmkp-last-as-first-bookmark-file, bookmark-maybe-load-default-file (redefinition), -;; bookmarks-already-loaded (redefinition), bmkp-default-bookmark-file. -;; bookmark-save: Update and save bmkp-last-as-first-bookmark-file. -;; bookmark-load: New default for reading file name, and require an existing file (match). -;; Update and save bmkp-last-as-first-bookmark-file. Update bmkp-sorted-alist. -;; bmkp-switch-bookmark-file (no longer used): New default for reading file name. -;; bmkp-switch-bookmark-file-create: Added optional arg INTERACTIVEP. New default for reading -;; file name. Use bookmark-load, not bmkp-switch-bookmark-file. Require confirmation only for -;; new, empty file. Added final message. -;; bmkp-switch-to-last-bookmark-file: Use bmkp-last-as-first-bookmark-file as first fallback. -;; bmkp-set-bookmark-file-bookmark: Use bmkp-read-bookmark-file-name, not read-file-name. -;; New default for reading file name. -;; bmkp-temporary-bookmarking-mode: Use bookmark-load, not bmkp-switch-bookmark-file. -;; Removed: bookmark-maybe-message. Use only message now, not bookmark-maybe-message. -;; bmkp-autofile-set: For Emacs 23.3+, provide multiple defaults for file name. -;; 2011/11/30 dadams -;; bmkp-same-file-p: Avoid having Tramp prompt for passwords, when possible. Thx to M. Heerdegen. -;; bmkp-toggle-autotemp-on-set: Removed ARG (copy/paste typos). -;; 2011/11/28 dadams -;; bmkp-set-bookmark-file-bookmark: Prompt user for bookmark name here, to make clear what it is. -;; 2011/11/27 dadams -;; bookmark-write-file: If write error, do not overwrite message. And show error msg for 4 sec. -;; 2011/11/18 dadams -;; Renamed: bmkp-bookmark-image-bookmark-p to bmkp-image-bookmark-p. -;; Added: bmkp-image-alist-only, bmkp-image-jump(-other-window), bmkp-image-history. -;; bookmark-handle-bookmark: If bmk has handler but it's not a function, use default handler. -;; bmkp-autotemp-bookmark-predicates: Update doc string to include bmkp-image-bookmark-p. -;; bmkp-types-alist: Added entry for images. -;; 2011/11/15 dadams -;; bookmark-relocate: Redefine without using old-*. Update Dired location too. -;; Added: bmkp-cycle-this-file(/buffer)(-other-window), -;; bmkp-(next|previous)-bookmark-this-file(/buffer)(-repeat), -;; bmkp-this-file(/buffer)-bmenu-list, bmkp-this-file/buffer-alist-only. -;; Renamed bmkp-this-buffer-cycle-sort-comparer to bmkp-this-file/buffer-cycle-sort-comparer. -;; bmkp-this-buffer-p: Return nil if bookmark has a file diff from buffer. -;; bmkp-this-file-p: -;; Ensure bmkp-file-bookmark-p and bookmark-buffer-file-name. Use bmkp-same-file-p. -;; 2011/11/09 dadams -;; bmkp-jump-dired, bmkp-jump-man: Added bmkp-select-buffer-other-window to other-window fns. -;; 2011/11/08 dadams -;; bmkp-edit-bookmark: For new file name, use read-file-name, not read-from-minibuffer. -;; 2011/11/03 dadams -;; Renamed: bmkp-autoname-bookmark to bmkp-autoname-bookmark-function-default. -;; 2011/11/01 dadams -;; Added: bmkp-temporary-jump(-other-window). -;; bmkp-bookmark-description: Title now indicates whether temporary. -;; 2011/10/31 dadams -;; Added: bmkp-toggle-autotemp-on-set, bmkp-autotemp-all-when-set-p. -;; bookmark-set: If bmkp-autotemp-all-when-set-p call bmkp-make-bookmark-temporary. -;; 2011/10/28 dadams -;; Added: bmkp-delete-temporary-no-confirm. -;; bmkp-delete-all-temporary-bookmarks: Rewrote (it was just a stub). -;; bmkp-bmenu-menubar-menu: -;; Added: bmkp-temporary-bookmarking-mode, bmkp-delete-all-temporary-bookmarks, -;; bmkp-bmenu-toggle-marked-temporary/savable. -;; bmkp-bmenu-show-menu: Added: bmkp-bmenu-show-only-temporary. -;; bmkp-bmenu-mark-menu: -;; Added: bmkp-bmenu-mark-temporary-bookmarks, bmkp-bmenu-mark-autonamed-bookmarks. -;; bmkp-bmenu-mouse-3-menu: Added: bmkp-bmenu-toggle-temporary. -;; bookmark-bmenu-mode: Updated doc string. -;; 2011/10/27 dadams -;; Added: bmkp-autotemp-bookmark-predicates, bmkp-temporary-bookmarking-mode(-hook), -;; bmkp-delete-all-temporary-bookmarks, bmkp-make-bookmark-(savable|temporary), -;; bmkp-toggle-temporary-bookmark, bmkp-temporary-alist-only, bmkp-temporary-bookmark-p. -;; bookmark-set: Make bookmark temporary, if bmkp-autotemp-bookmark-predicates says to. -;; bookmark-write-file: Do not save temporary bookmarks (bmkp-temporary-bookmark-p). -;; 2011/10/25 dadams -;; bmkp-empty-file: Added optional arg CONFIRMP. By default, no confirmation if not interactive. -;; 2011/08/09 dadams -;; Bind icicle-unpropertize-completion-result-flag to t for all calls to completing-read. -;; 2011/08/07 dadams -;; Added: bmkp-guess-default-handler-for-file-flag, bmkp-file-bookmark-handlers. -;; bmkp-file-bookmark-p: Use bmkp-file-bookmark-handlers, which means also image-bookmark-jump. -;; bmkp-make-record-for-target-file (need to keep in sync with diredp-bookmark): -;; Instead of image-bookmark-make-record, use explicit function that includes file and type. -;; bmkp-default-handler-for-file: -;; Use bmkp-guess-default only if bmkp-guess-default-handler-for-file-flag is non-nil. -;; bmkp-default-handler-associations: Updated doc string. -;; 2011/08/05 dadams -;; bmkp-file-bookmark-p: Allow handler to be bmkp-default-handler-for-file, e.g. for image files. -;; bmkp-all-tags-alist-only: Corrected. -;; bmkp-refresh-menu-list: Ensure BOOKMARK is a string. -;; bmkp-every: Removed unused binding. -;; 2011/05/08 dadams -;; Just put some definitions in alphabetic order - no real change. -;; 2011/04/25 dadams -;; bmkp-bookmark-description: Added optional arg NO-IMAGE. -;; bmkp-url-target-set: Protect url-get-url-at-point with fboundp. -;; bmkp-(file-target|autofile)-set, bmkp-autofile-(add|remove)-tags: -;; Added buffer-file-name as a default possibility. Removed URL functions for that purpose. -;; 2011/04/24 dadams -;; Added: bmkp-purge-notags-autofiles. -;; bookmark-delete: Redefined to accept either bookmark or name as arg. -;; bmkp-(url|file|compilation|occur)-target-set(-all), bmkp-autofile-(set|(add|remove)-tags): -;; Removed optional args when read prefix. -;; bmkp-occur-target-set-all: Made PREFIX arg optional too. -;; Added some missing autoload cookies. Removed some from non-def sexps. -;; 2011/04/21 dadams -;; Added: bmkp-copied-tags, bmkp-copy-tags, bmkp-paste-add-tags, bmkp-paste-replace-tags.. -;; 2011/04/20 dadams -;; bmkp-remove-all-tags: Added optional arg no-cache-update-p. -;; 2011/04/19 dadams -;; bmkp-make-record-for-target-file: Fixed backquotes on lambdas. -;; 2011/04/17 dadams -;; bmkp-edit-tags: Do not apply bmkp-full-tag to the tags. -;; 2011/04/16 dadams -;; Added: bmkp-edit-tags(-send|-mode(-map)), bmkp-return-buffer. -;; bookmark-(rename|relocate|send-edited-annotation), bmkp-update-autonamed-bookmark, -;; bmkp-(add|remove(-all)-tags: -;; Wrap with-current-buffer around bmkp-refresh-menu-list. -;; bookmark-(store|rename|write-file): Test emacs-major-version, not just (boundp 'print-circle). -;; bmkp-autofile-add-tags: Fix interactive args - forgot to include DIR arg (= nil). -;; 2011/04/15 dadams -;; Added: bmkp-autofile-alist-only, bmkp-autofile-bookmark-p. -;; 2011/04/13 dadams -;; Added: bmkp-autofile-jump(-other-window) (aliases), bmkp-find-file(-other-window). -;; bmkp-find-file-(all|some)-tags(-regexp)(-other-window): Bind use-file-dialog to nil. -;; 2011/04/12 -;; Added: bmkp-bookmark-name-member, bmkp-names-same-bookmark-p, bmkp-sort-omit, -;; bmkp-remove-omitted, bmkp-delete-bookmark-name-from-list, bmkp-bookmark-a-file (alias), -;; bmkp-autofile-(add|remove)-tags, bmkp-(un)tag-a-file (aliases), -;; bmkp-get-autofile-bookmark, bmkp-find-file-(all|some)-tags(-regexp)(-other-window). -;; Removed: bmkp-remove-assoc-dups, bmkp-sort-and-remove-dups. -;; Applied renaming: bmkp-bmenu-omitted-list to bmkp-bmenu-omitted-bookmarks. -;; bookmark-store: Redefine for all Emacs versions now: -;; Put the bookmark on the name as property bmkp-full-record. Use bmkp-maybe-save-bookmarks. -;; Return the bookmark. -;; bookmark-get-bookmark: Redefine for all Emacs versions now: -;; If BOOKMARK is a bookmark-name string that has property bmkp-full-record, return that value. -;; bookmark-send-edited-annotation: Make sure it's the annotation buffer that gets killed. -;; bookmark-default-handler: Return nil, like vanilla (but why?). -;; bookmark-location: Pass full bookmark to the various "get" functions. -;; bookmark-rename: Put bmkp-full-record property on new name. -;; bookmark-delete: -;; Use bmkp-delete-bookmark-name-from-list: If name has bmkp-full-record property, use that -;; with name to find bookmark to delete. -;; Pass full bookmark to unlight. -;; bmkp-edit-bookmark: Save if either is non-empty, not if both are. Thx to Michael Heerdegen. -;; bmkp-edit-bookmark-record: Bind print-circle to t around pp. -;; bmkp-default-bookmark-name: -;; Use bookmark-name-from-full-record plus bookmark-get-bookmark, not assoc. -;; If BNAME is nil (no default) then do not try to look it up in alist. -;; bookmark-write-file: Unpropertize only for Emacs 20 or nil bmkp-propertize-bookmark-names-flag. -;; Bind print-circle to t around pp. -;; bmkp-save-menu-list-state: Make it interactive (a command). Bind print-circle. -;; Use bmkp-maybe-unpropertize-bookmark-names on alists and name lists. -;; Bind print-circle to t around pp. -;; bmkp-unomit-all: Use bmkp-delete-bookmark-name-from-list, not delete. -;; bmkp-dired-this-dir-bookmark-p: Use bmkp-same-file-p, not string=. -;; bmkp-url-target-set, bmkp-replace-existing-bookmark:: Return the bookmark. -;; bmkp-file-target-set: Return bookmark. Added arg MSGP: msg if no file yet. -;; bmkp-autofile-set: -;; Added DIR arg and MSGP arg: msg if no file yet. Return the bookmark. -;; If read absolute file name, create bmk in its dir, not in default-directory. Else use DIR. -;; Use bmkp-get-autofile-bookmark, so uses bmkp-same-file-p for each file part (not equal). -;; bmkp-marked-bookmark-p, bmkp-omitted-bookmark-p: Use bmkp-bookmark-name-member, not member. -;; bookmark-location: Pass full bookmark to the various "get" functions. -;; bmkp-choose-navlist-from-bookmark-list, bmkp-cycle-this-buffer: -;; Use bmkp-sort-omit, not bmkp-sort-and-remove-dups. -;; bmkp-bookmark-description, bmkp-describe-bookmark-internals: Add Bookmark `' to title. -;; bmkp-make-bookmark-list-record: Use bmkp-maybe-unpropertize-bookmark-names on lists. -;; bmkp-printable-p: Bind print-circle to t around prin1. -;; bmkp-delete-autonamed(-this-buffer)-no-confirm: -;; Do nothing if bookmarks not loaded. Thx to Christoph Scholtes. -;; 2011/04/03 dadams -;; Added: bmkp-make-record-for-target-file, bmkp-replace-existing-bookmark (not used). -;; bmkp-file-this-dir-bookmark-p: Corrected it to compare directory to default-directory. -;; bmkp-file-target-set: Added arg NO-OVERWRITE (pass to bookmark-store). -;; Use (new) bmkp-make-record-for-target-file. -;; bmkp-autofile-set: Do nothing if bookmark with same name, file and dir exists. -;; Else create one, even if the bookmark name is the same. -;; You can have multiple autofile bookmarks with the same name (diff files). -;; 2011/04/02 dadams -;; Added: bmkp-autofile-set, bmkp-file-this-dir-(all|some)-tags(-regexp)-jump(-other-window), -;; bmkp-file-this-dir-(all|some)-tags(-regexp)-alist-only. -;; 2011/04/01 dadams -;; Moved key and menu bindings to (new) bookmark+-key.el. -;; Added: bmkp-(dired|file)-this-dir-alist-only, bmkp-(dired|file)-this-dir-bookmark-p, -;; bmkp-file-this-dir-jump(-other-window). -;; Renamed: bmkp-dired-jump-current(*) to bmkp-dired-this-dir-jump(*). -;; bmkp-dired-this-dir-jump(-other-window): Use bmkp-dired-this-dir-alist-only. -;; bmkp-types-alist: Added (dired|file)-this-dir. -;; Bound bmkp-(dired|file)-this-dir-jump to C-d and C-f in bookmark-jump(-other-window)-map. -;; bmkp-jump-dired, bmkp-jump-man: Treat null bmkp-jump-display-function as display-buffer. -;; 2011/03/26 dadams -;; Added: bmkp-file-(all|some)-tags(-regexp)-(alist-only|jump(-other-window)). -;; bmkp-jump-menu: Added the new commands, but not Emacs 20, to avoid crash if byte-compiled. -;; bmkp-bookmark-jump*-other-window: Simplified doc strings - refer to same-window version. -;; 2011/03/17 dadams -;; bmkp-describe-bookmark: Added 10-pixel margin around thumbnail image. -;; 2011/03/11 dadams -;; Protect use of mouse-wheel-*-event with boundp. Thx to Chris Poole. -;; 2011/03/04 dadams -;; bmkp-bookmark-description, bmkp-describe-bookmark: Added clickable thumbnail to the help. -;; bmkp-bookmark-description: Split file name into dir & relname, so shorter line, in help. -;; 2011/03/03 dadams -;; Added: bmkp-all-exif-data, bmkp-bookmark-image-bookmark-p. -;; bmkp-bookmark-description: Handle image EXIF data. -;; 2011/01/03 dadams -;; Removed autoload cookies from non def* sexps and from define-key and define-prefix-command. -;; Added some missing autoload cookies for commands, in particular redefined standard commands. -;; 2010/12/10 dadams -;; Added defalias for bookmark-name-from(-full)-record, to fix gratuitous Emacs name change. -;; 2010/10/22 dadams -;; Uncommented key bindings for mouse wheel, since Emacs bug #6256 has now been fixed. -;; bmkp-repeat-command: Don't bother to let-bind repeat-previous-repeated-command, -;; and use setq, not let, for last-repeatable-command. Thx to Stefan Monnier. -;; 2010/09/28 dadams -;; Added: bmkp-delete-autonamed(-this-buffer)-no-confirm. -;; 2010/09/25 dadams -;; Added: option bmkp-default-bookmark-name, bmkp-annotated-alist-only. -;; Added: bmkp-(next|previous)-*(-repeat), using macro bmkp-define-next+prev-cycle-commands. -;; bmkp-default-bookmark-name: Respect option. -;; bookmark-edit-annotation-mode, bookmark-edit-annotation: -;; Use bmkp-annotated-alist-only (and new bmkp-default-bookmark-name). -;; bookmark-send-edited-annotation: -;; End in orig buffer, not bmenu buffer. Delete edit window. Thx to Joe Bloggs. -;; 2010/09/24 dadams -;; Added: bmkp-autonamed(-this-buffer)-jump(-other-window). Bound to C-x j # (#|.) and menus. -;; Added, using bmkp-define-cycle-command: -;; bmkp-cycle-(autonamed|bookmark-list|desktop|dired|gnus|info|lighted|(local-|remote-)file| -;; man|non-file|remote-file|specific-(buffers|files)|variable-list|url) -;; (-other-window). -;; Added redefinitions: bookmark-edit-annotation(-mode). -;; Renamed: *varlist* to *variable-list*. -;; bmkp-autoname-format: Added ^ to anchor numeral at beginning. -;; bookmark--jump-via: Don't update autonamed if using w32 association. -;; bmkp-update-autonamed-bookmark: bmkp-refresh-menu-list only if buffer list is displayed. -;; *-(relocate|rename), *-update-autonamed-bookmark, *-remove-all-tags, *-(add|remove)-tags: -;; Don't create bookmark-list buffer if doesn't exist. -;; bookmark-show-(annotation|all-annotations): Restore selected window and frame focus. -;; bmkp-completing-read-(buffer|file)-name: Added optional NO-DEFAULT-P arg. -;; bmkp-describe-bookmark: Default to highlighted bookmarks on line, if there are any. -;; bmkp-specific-(buffers|files)-jump(-other-window): Allow empty input, to end loop. -;; bmkp-cycle: Ensure bmkp-current-nav-bookmark is a bookmark, else redefine. Use %9d, not %d. -;; bmkp-cycle-other-window: Added optional STARTOVERP arg here too. -;; 2010/09/20 dadams -;; bmkp-choose-navlist-of-type: Empty input means "any". -;; 2010/09/16 dadams -;; bmkp-read-bookmark-file-name: -;; Removed extra default-filename in call to read-file-name. Thx to Pedro Insua. -;; 2010/08/22 dadams -;; Added: bmkp-regexp-filtered-annotation-alist-only. -;; 2010/08/20 dadams -;; Added: bmkp-read-bookmark-file-name. -;; bookmark-save, bookmark-load, bmkp-switch-bookmark-file, bmkp-use-bookmark-file-create: -;; Use bmkp-read-bookmark-file-name. -;; 2010/08/19 dadams -;; Require gnus-sum.el when compile (for macro). Thx to S. Nemec. -;; 2010/08/18 dadams -;; Removed eval-when-compile for bookmark+-lit.el. -;; Replaced defvar of bmkp-edit-bookmark-record-mode-map with a define-key after derived mode. -;; 2010/08/17 dadams -;; bmkp-edit-bookmark: Made interactive. Bound to C-x p E. Added optional INTERNALP arg. -;; bmkp-info-bookmark-p: Return nil if a different handler. -;; 2010/08/15 dadams -;; Moved bmkp-define-file-sort-predicate, bmkp-menu-bar-make-toggle to bookmark+-mac.el. -;; Require: bookmark.el, bookmark+-mac.el. -;; Require for compile: bookmark+-bmu.el, bookmark+-lit.el (soft). -;; Ensure this file is loaded before compiling. -;; bmkp-set-bookmark-file-bookmark: Added missing arg for error format string. -;; 2010/08/08 dadams -;; bookmark-jump: Added optional arg DISPLAY-FUNCTION (Emacs 24). -;; bookmark-handle-bookmark: -;; Move non-default handler call outside condition-case. -;; Updated for Emacs 24: Use error condition bookmark-error-no-filename. Added props for it. -;; bookmark-default-handler: Updated for Emacs 24: -;; Signal condition bookmark-error-no-filename, not file-error, and pass (stringp FILE). -;; bookmark-make-record-default: Added optional args NO-CONTEXT, POSITION (Emacs 24), and VISITS. -;; bookmark-load: Updated for Emacs 24: Wrap with abbreviate-file-name. -;; bmkp-jump-1: Allow arg to be a bookmark or its name. -;; bmkp-gnus-bookmark-p: Updated for Emacs 24: Added gnus-summary-bookmark-jump. -;; bmkp-jump-gnus: Different gnus-fetch-group call for Emacs 20, 21. -;; bmkp-make-(desktop|varlist|bookmark-(file|list))-record: Call *-record-default with NO-CONTEXT. -;; w3m-current-title: Use w3m-current-title as bookmark name. -;; bmkp-w3m-set-new-buffer-name, bmkp-jump-w3m*: Require w3m. -;; bmkp-make-gnus-record: Get bookmark name from gnus-summary-article-header. -;; Update for Emacs 24: Bypass bmkp specific Gnus, man, and woman code. -;; 2010/08/06 dadams -;; Added (and bound the commands): -;; bmkp-(compilation|occur)-target-set(-all), bmkp-(file|url)-target-set, -;; bmkp-default-handler-associations, bmkp-compilation-file+line-at, -;; bmkp-default-handler-(for-file|user), bmkp-sound-jump. -;; bmkp-occur-create-autonamed-bookmarks: Do not define it for Emacs < 22. Protect wrt POS, BUF. -;; Added to Bookmark menu: bmkp-(file|url)-target-set, bmkp-set-(bookmark-file|desktop)-bookmark. -;; 2010/08/04 dadams -;; bmkp-edit-bookmark: Use new bookmark name for update of dired-directory. Thx to Kai Tetzlaff. -;; 2010/08/03 dadams -;; bmkp-make-url-browse-record: Remove text properties from URL arg. -;; 2010/07/17 dadams -;; Added: bmkp-url-jump-(other-window), bmkp-url(-browse)-(alist-only|bookmark-p), bmkp-url-cp, -;; bmkp-url-history, bmkp-make-url-browse-record, bmkp-jump-url-browse. -;; bmkp-sort-comparer: Use bmkp-url-cp, not bmkp-w3m-cp. -;; bmkp-types-alist: w3m -> url. -;; bookmark-alist: Updated doc string to mention LOCATION. W3M -> URL. -;; bmkp-bookmark-description: Treat URL. Set no-position-p depending on start. -;; Bind bmkp-url-jump*. Replace W3M by URL in menu items. -;; 2010/07/14 dadams -;; Created from bookmark+.el code. - -;;;(@* "CHANGE LOG FOR `bookmark+-bmu.el'") -;; -;; 2012/05/05 dadams -;; bookmark-bmenu-(un)mark(-all), bmkp-bmenu-regexp-mark, bmkp-bmenu-toggle-marks, -;; bmkp-bmenu-mark-bookmarks-satisfying, bmkp-bmenu-toggle-marked-temporary/savable, -;; bmkp-bmenu-(un)mark-bookmarks-tagged-regexp: -;; Added optional arg MSG-P. -;; bookmark-bmenu-(un)mark(-all), bookmark-bmenu-execute-deletions, bmkp-bmenu-regexp-mark, -;; bmkp-bmenu-toggle-show-only-(un)marked, bmkp-bmenu-mark-bookmarks-satisfying, -;; bmkp-bmenu-toggle-marks, bmkp-bmenu-toggle-marked-temporary/savable, -;; bmkp-bmenu-toggle-temporary, bmkp-bmenu-make-sequence-from-marked, -;; bmkp-bmenu-(un)omit(-marked), bmkp-bmenu-(un)mark-bookmarks-tagged-regexp, -;; bmkp-bmenu-mark/unmark-bookmarks-tagged-*, bmkp-bmenu-change-sort-order, -;; bmkp-reverse(-multi)-sort-order: -;; Pass NO-MSG-P to *-refresh/rebuild-menu-list, *-surreptitiously-rebuild-list, *-store. -;; bmkp-bmenu-mark/unmark-bookmarks-tagged-(all/none|some/not-all): -;; Swapped last two args, so consistent order. -;; bmkp-bmenu-(un)mark-bookmarks-tagged-*: Updated arg order in calls to b-b-m/u-b-t-(a/n|s/n-a). -;; bmkp-bmenu-(un)mark-bookmarks-tagged-regexp, bmkp-bmenu-mark/unmark-bookmarks-tagged-*: -;; Added status message. -;; 2012/05/01 dadams -;; Added redefinition of bookmark-bmenu-delete-backwards (they broke its movement). -;; Added aliases: bmkp-bmenu-flag-for-deletion(-backwards). Bind to d, k, C-d (same as aliases). -;; bmkp-bmenu-(add|remove)-tags, bmkp-bmenu-(add|remove)-tags-(to|from)-marked: -;; Automatically re-sort if # tagged bmks changed and sort order is tagged first/last (s t). -;; Added: bmkp-bmenu-sort-tagged-before-untagged. -;; Bind bmkp-bmenu-sort-tagged-before-untagged to s t. -;; Bind bmkp-bmenu-sort-by-last-bookmark-access to s d, not s t. -;; Bind bmkp-bmenu-sort-by-last-local-file-access to s f d, not s f t. -;; Bind bmkp-bmenu-sort-by-local-file-type to s f k, not s f d. -;; 2012/04/28 dadams -;; bookmark-bmenu-(un)mark(-all), bmkp-bmenu-regexp-mark, bmkp-bmenu-mark-bookmarks-satisfying, -;; bmkp-bmenu-toggle-marks, bmkp-bmenu-(un)mark-bookmarks-tagged-regexp, -;; bmkp-bmenu-mark/unmark-bookmarks-tagged-(all/none|some/not-all): -;; Added optional arg NO-RE-SORT-P. -;; Automatically re-sort if marks changed and if sort order is marked first/last (s >). -;; Changed all non-interactive calls of bookmark-bmenu-(un)mark to pass non-nil NO-RE-SORT-P. -;; bmkp-bmenu-toggle-marks: Call bookmark-bmenu-ensure-position at start. -;; 2012/04/27 dadams -;; bmkp-bmenu-edit-marked: Use bmkp-with-output-to-plain-temp-buffer. -;; 2012/04/13 dadams -;; Added: bmkp-bmenu-sort-(flagged|modified)-before-un(flagged|modified), bmkp-flagged-bookmarks. -;; Bound bmkp-bmenu-sort-(flagged|modified)-before-un(flagged|modified) to s D, s *. -;; bookmark-bmenu-(un)mark: Delete bookmark from bmkp-flagged-bookmarks. -;; bookmark-bmenu-mark: Use (equivalent of) eq version of add-to-list. -;; bookmark-bmenu-delete: Add bookmark to bmkp-flagged-bookmarks. -;; bmkp-bmenu-list-1: Always reset bmkp-(flagged|modified)-bookmarks. -;; Flag bookmarks if bmkp-flagged-bookmark-p. -;; bmkp-bmenu-refresh-menu-list: C-u resets bmkp-flagged-bookmarks too. -;; 2012/04/10 dadams -;; bmkp-bmenu-load-marked-bookmark-file-bookmarks: -;; Use bmkp-refresh-menu-list, not bmkp-refresh/rebuild-menu-list. -;; bmkp-bmenu-(add|remove)-tags-(to|from)-marked, bmkp-bmenu-paste-(add|replace)-tags-to-marked: -;; Corrected bookmark-save to bookmark-save-flag in bindings to nil. -;; Use bmkp-count-multi-mods-as-one-flag for the binding. -;; Call bmkp-refresh-menu-list. -;; 2012/04/09 dadams -;; bmkp-bmenu-set-tag-value, bmkp-bmenu-remove-tags, bmkp-bmenu-paste-(add|replace)-tags: -;; Added nil NO-UPDATE-P arg in calls to bmkp-set-tag-value, bmkp-remove-tags, -;; bmkp-paste-(add|replace)-tags. -;; bmkp-bmenu-add-tags-to-marked, bmkp-bmenu-remove-tags-from-marked, -;; bmkp-bmenu-paste-(add|replace)-tags-to-marked: -;; Bind bookmark-save to nil around iteration, to inhibit saving until finished. -;; New arg order for calls to bmkp-(add|remove)-tags. -;; Pass non-nil NO-UPDATE-P arg to bmkp-paste-(add|replace)-tags. -;; 2012/04/03 dadams -;; Moved here from bookmark+-1.el: bmkp-face-prop. -;; 2012/03/19 dadams -;; Added: bmkp-*-mark. -;; bmkp-bmenu-list-1, bmkp-bmenu-mode-status-help: Use bmkp-*-mark for *. -;; 2012/03/18 dadams -;; bookmark-bmenu-delete: Remove bookmark from bmkp-modified-bookmarks also. -;; bmkp-bmenu-list-1: RESET-P resets bmkp-modified-bookmarks also. Insert modified marks (*). -;; bmkp-bmenu-refresh-menu-list: -;; When revert from file: Reset *-marked-bookmarks, *-modified-bookmarks, *-omitted-bookmarks. -;; Bind bmkp-bmenu-filter-function to nil for bmkp-refresh-menu-list. -;; bmkp-bmenu-toggle-show-only-(un)marked: -;; Save display, so bmkp-bmenu-before-hide-marked-alist is up-to-date. -;; bmkp-bmenu-mode-status-help: Added legend for markings. -;; bmkp-bmenu-edit-marked: Use (shallow) copies of bookmarks, not originals. -;; Added bmkp-save-menu-list-state to Bookmark+ menu. -;; 2012/03/13 dadams -;; bmkp-bmenu-read-filter-input: -;; If C-g then restore previous display. -;; Use only one catch and test while condition. -;; Do not try to pop an empty list. -;; bmkp-bmenu-filter-((bookmark|file)-name|annotation|tags)-incrementally: -;; Use run-with-idle-timer, not run-with-timer -;; 2012/03/11 dadams -;; Added Revert to Saved (bmkp-revert-bookmark-file) to menu. -;; 2012/03/07 dadams -;; bmkp-bmenu-load-marked-bookmark-file-bookmarks: Use bmkp-sorted-alist to load in display order. -;; 2012/03/06 dadams -;; bookmark-bmenu-mode: Reorg. -;; bmkp-bmenu-refresh-menu-list: -;; Call bmkp-refresh-menu-list also when revert file. Use yes-or-no-p, not y-or-n-p. -;; 2012/03/05 dadams -;; bmkp-bmenu-mode-status-help: Added Autosave bookmarks and Autosave list display to info at top. -;; 2012/03/04 dadams -;; Added: bmkp-bmenu-load-marked-bookmark-file-bookmarks. -;; Bind bmkp-toggle-saving-menu-list-state to C-M-~, not M-l. -;; Bind bmkp-bmenu-load-marked-bookmark-file-bookmarks to M-l. Add it to menu. -;; 2012/03/02 dadams -;; bookmark-bmenu-list: Reset marked and omitted lists to () if a name is not a current bmk. -;; 2012/02/28 dadams -;; Added face bmkp-file-handler. -;; bmkp-bmenu-mode-status-help: Added bmkp-file-handler to face legend. -;; bmkp-bmenu-propertize-item: Propertize file-handler bookmarks, with bmkp-file-handler. -;; 2011/12/31 dadams -;; Define macro with-buffer-modified-unmodified for Emacs 23.1, in addition to Emacs < 23. -;; 2011/12/30 dadams -;; Added aliases: bmkp-bookmark-(data|name)-from-record. -;; Added: bmkp-bmenu-show-or-edit-annotation, bmkp-bmenu-edit-bookmark-record, -;; bmkp-bmenu-edit-marked. -;; Renamed bmkp-bmenu-edit-bookmark to bmkp-bmenu-edit-bookmark-name-and-file. -;; bookmark-bmenu-mark: Propertize bookmark name with bmkp-full-record before adding to list. -;; bookmark-bmenu-list: -;; Added optional arg MSGP. Show status messages. -;; Propertize bookmark names if not already propertized, in marked and omitted lists. -;; bookmark-bmenu-mode: Updated doc string. -;; bmkp-bmenu-make-sequence-from-marked: -;; Use bmkp-get-bookmark-in-alist, not bookmark-get-bookmark. -;; Bind bmkp-bmenu-show-or-edit-annotation (not *-show-annotation) to a. -;; Bind bmkp-bmenu-edit-bookmark-name-and-file to r now, not E. -;; Bind bmkp-bmenu-edit-marked to E and T > e. -;; Bind bmkp-bmenu-edit-bookmark-record to e. -;; bmkp-bmenu-quit: Show progress messages. -;; bmkp-bmenu-tags-menu: Added bmkp-bmenu-edit-marked. -;; bmkp-bmenu-mouse-3-menu: -;; Added: bmkp-bmenu-edit-tags. -;; Replaced *-rename and *-relocate with bmkp-bmenu-edit-bookmark-name-and-file. -;; 2011/12/24 dadams -;; Added: bookmark-bmenu-toggle-filenames, with optional arg NO-MSG-P. -;; bookmark-bmenu-surreptitiously-rebuild-list, bookmark-bmenu-(show|hide)-filenames: -;; Added progress messages and optional arg NO-MSG-P. -;; bookmark-bmenu-(show|hide)-filenames, bookmark-bmenu-toggle-filenames: -;; Correct FORCE behavior and doc strings. -;; bmkp-bmenu-refresh-menu-list: Pass (not) MSG-P to bmkp-refresh-menu-list. -;; 2011/12/21 dadams -;; Added: bmkp-bmenu-mark-orphaned-local-file-bookmarks, -;; bmkp-bmenu-show-only-orphaned-local-files, bmkp-bmenu-mark-variable-list-bookmarks. -;; bmkp-bmenu-refresh-menu-list: Added optional args ARG and MSGP, so you can revert from file. -;; bookmark-bmenu-mode: Updated and reordered doc string. -;; Bind O M, O S to orphaned commands, not omit commands. Changed omit bindings to use -, not O. -;; Bind bmkp-bmenu-mark-variable-list-bookmarks to V M. -;; bmkp-bmenu-show-menu: Reordered. Added: *-w3m-urls, *-variable-lists, *-orphaned-local-files. -;; bmkp-bmenu-mark-menu: Reordered. Added: *-w3m-*, *-variable-list-*, *-orphaned-local-file-*. -;; 2011/12/19 dadams -;; Added: with-buffer-modified-unmodified. -;; bookmark-bmenu-((un)mark|delete), bookmark-bmenu-(show|hide)-filenames: -;; Use with-buffer-modified-unmodified. -;; bookmark-bmenu-show-filenames, bmkp-bmenu-mouse-3-menu: Use line-(beginning|end)-position. -;; 2011/12/15 dadams -;; bmkp-bmenu-propertize-item: Use bmkp-local-directory face also for Dired (e.g. with wildcards). -;; bmkp-bmenu-mode-status-help: Clarify legend for remote and local dirs/Dired. -;; 2011/12/08 dadams -;; bmkp-bmenu-mouse-3-menu: Use easymenu to build the menu. Conditionalize some items. -;; Bind down-mouse-3, not mouse-3, to bmkp-bmenu-mouse-3-menu. (bind mouse-3 to ignore). -;; Added eval-when-compile for easymenu.el. -;; 2011/12/05 dadams -;; bmkp-bmenu-menubar-menu: Reordered items regarding bookmark files. -;; bmkp-bmenu-mode-status-help: Correct intro text, reorder, use marker for position TOP. -;; bookmark-bmenu-mode: Changed intro text slightly. -;; 2011/12/03 dadams -;; bmkp-bmenu-list-1: Print current bookmark file at top of display. -;; Increased bmkp-bmenu-header-lines to 5. -;; bookmark-bmenu-mode: Updated doc string for binding changes and new option. -;; bmkp-bmenu-regexp-mark: Mention right-padding of bookmark names in doc string. -;; bmkp-bmenu-mode-status-help: Reorder Current Status items, to put bookmark file first. -;; Bind L to bmkp-switch-bookmark-file-create, not bmkp-switch-bookmark-file. -;; 2011/11/19 dadams -;; bmkp-bmenu-image-bookmark-icon-file: Default to an existing Emacs image file, not nil. -;; 2011/11/18 dadams -;; Added: bmkp-bmenu-mark-image-bookmarks, bmkp-bmenu-show-only-image-files, -;; bmkp-bmenu-image-bookmark-icon-file. -;; bmkp-bmenu-list-1: Show icon image for image-file bookmarks. -;; bookmark-bmenu-mode: Add to doc string: bmkp-image-jump, bmkp-bmenu-mark-image-bookmarks, -;; bmkp-bmenu-show-only-image-files. -;; bmkp-bmenu-mode-status-help: Added image icon to legend. -;; Bound keys: M-I M-M, M-I M-S to *-mark-image-bookmarks *-show-only-image-files. -;; Added to menus (Mark, Show): bmkp-bmenu-mark-image-bookmarks, bmkp-bmenu-show-only-image-files. -;; 2011/11/01 dadams -;; bookmark-bmenu-mode: Changed mode-name var for mode line: Bookmarks, not Bookmark Menu. -;; Updated doc string for autofile & temporary jump commands. -;; 2011/10/31 dadams -;; bookmark-bmenu-mode: Updated doc string with bmkp-toggle-autotemp-on-set. -;; bmkp-bmenu-menubar-menu: Added: bmkp-toggle-autotemp-on-set. -;; 2011/10/27 dadams -;; Added: bmkp-X-mark, bmkp-bmenu-toggle-marked-temporary/savable, bmkp-bmenu-toggle-temporary, -;; bmkp-bmenu-mark-autonamed-bookmarks, bmkp-bmenu-show-only-temporary, -;; bmkp-bmenu-mark-temporary-bookmarks. -;; bmkp-bmenu-list-1: Mark with X in place of a, if bookmark is temporary. -;; bookmark-bmenu-mode: Mode-line major-mode name indicates when in temporary bookmarking mode. -;; Updated doc string with temporary bookmark commands. -;; bmkp-t-mark: Changed default attributes. -;; Bind: M-L to bmkp-temporary-bookmarking-mode, M-X to bmkp-bmenu-toggle-marked-temporary/savable -;; X M to bmkp-bmenu-mark-temporary-bookmarks, X S to bmkp-bmenu-show-only-temporary, -;; C-M-X to bmkp-bmenu-toggle-temporary. -;; bmkp-bmenu-show-only-bookmark-files: Bind to Y S, not X S. -;; bmkp-bmenu-mark-bookmark-file-bookmarks: Bind to Y M, not X M. -;; 2011/07/01 dadams -;; bmkp-bmenu-change-sort-order, bmkp(-multi)-reverse-sort-order: Handle null CURRENT-BMK. -;; 2011/04/24 dadams -;; Added to Tags menu: Purge Autofiles with No Tags. -;; 2011/04/23 dadams -;; Bound bmkp-bmenu-set-tag-value-for-marked to T > v and added to bmkp-bmenu-tags-menu. -;; bmkp-bmenu-mouse-3-menu: Added bmkp-rename-tag. -;; 2011/04/22 dadams -;; Bound *-copy-tags to T c, T M-w, *-paste(-add|replace)-tags to T p, T C-y, T q. -;; 2011/04/21 dadams -;; Added: bmkp-bmenu-copy-tags, bmkp-bmenu-paste-add-tags(-to-marked), -;; bmkp-bmenu-paste-replace-tags(-for-marked). -;; Bound and added to menus: bmkp-bmenu-paste-add-tags-to-marked, -;; bmkp-bmenu-paste-replace-tags-for-marked. -;; Added to This Bookmark menu: bmkp-bmenu-copy-tags, bmkp-bmenu-paste(-add|replace)-tags. -;; 2011/04/19 dadams -;; Added: bmkp-bmenu-unmark-bookmarks-tagged-regexp. Bound it to T u %. Added it to menu. -;; 2011/04/16 dadams -;; Added: bmkp-edit-tags-send. Bound it to T e in bookmark-bmenu-mode-map. -;; bookmark-bmenu-mode: Updated help text for tags editing. -;; bmkp-maybe-unpropertize-bookmark-names: -;; Test emacs-major-version, not just (boundp 'print-circle). -;; 2011/04/15 dadams -;; Added: bmkp-bmenu-mark-autofile-bookmarks, bmkp-bmenu-show-only-autofiles. -;; And added them to menus. -;; bookmark-bmenu-mode-map: -;; Bind bmkp-bmenu-mark-autofile-bookmarks, bmkp-bmenu-show-only-autofiles to A M, A S. -;; Bind bookmark-bmenu-show-all-annotations to M-a, not A. -;; Bind bmkp-bmenu-search-marked-bookmarks-regexp to M-s a M-s, not M-a. -;; Bind *-mark-url-bookmarks, *-show-only-urls to M-u M-m, M-u M-s, not M-u M, M-u S. -;; bookmark-bmenu-mode: Updated help to reflect latest bindings. -;; 2011/04/13 dadams -;; bmkp-bmenu-tags-menu: Added: bmkp-(un)tag-a-file. -;; 2011/04/12 -;; Added: bmkp-propertize-bookmark-names-flag, bmkp-maybe-unpropertize-bookmark-names, -;; bmkp-bmenu-get-marked-files. -;; Renamed: bmkp-bmenu-omitted-list to bmkp-bmenu-omitted-bookmarks. -;; bmkp-bmenu-define-full-snapshot-command: -;; Bind print-circle to t around pp. Use bmkp-maybe-unpropertize-bookmark-names on lists. -;; bookmark-bmenu-(show|hide)-filenames, bmkp-bmenu-toggle-show-only-(un)marked, -;; bmkp-bmenu-(un)omit-marked: -;; Fit one-window frame only if selected window is *Bookmark List*. -;; bookmark-bmenu-bookmark: Added optional arg FULL. Non-nil means return full bookmark record. -;; bookmark-bmenu-unmark, bookmark-bmenu-delete, bmkp-bmenu-unomit-marked: -;; Use bmkp-delete-bookmark-name-from-list, not delete. -;; bookmark-bmenu-execute-deletions: Pass full bookmark, not name, to delete, and don't use assoc. -;; bookmark-bmenu-rename: Use bmkp-bmenu-goto-bookmark-named instead of just searching for name. -;; bmkp-bmenu-toggle-marks, bmkp-bmenu-unomit-marked, bmkp-bmenu-define-jump-marked-command, -;; bmkp-bmenu-mouse-3-menu: -;; Use bmkp-bookmark-name-member, not member. -;; bmkp-bmenu-make-sequence-from-marked: Do not invoke bookmark-bmenu-list when no displayed list. -;; bmkp-bmenu-define-command: Use bmkp-maybe-unpropertize-bookmark-names on *-omitted-bookmarks. -;; bmkp-bmenu-list-1: Use bmkp-sort-omit, not bmkp-sort-and-remove-dups. -;; Pass full bookmark to bmkp-bmenu-propertize-item. -;; bmkp-bmenu-propertize-item: -;; First arg is now a full bookmark, not a bookmark name. Get bookmark name from it. -;; Put prop bmkp-bookmark-name on buffer text with propertized bookmark-name string as value. -;; String has property bmkp-full-record with value the full bookmark record, with string as car. -;; Return propertized bookmark-name string. -;; bmkp-bmenu-isearch-marked-bookmarks(-regexp), bmkp-bmenu-dired-marked, -;; bmkp-bmenu-(search|query-replace)-marked-bookmarks-regexp: -;; Use bmkp-sort-omit, not bmkp-sort-and-remove-dups. -;; bmkp-bmenu-goto-bookmark-named: -;; If NAME has property bmkp-full-record then go to the bookmark it indicates. Otherwise, just -;; go to the first bookmark with the same name. -;; bookmark-bmenu-mode: Added bmkp-save-menu-list-state (now a command) to the mode help. -;; 2011/04/02 dadams -;; bookmark-bmenu-mode: Added to mode help: bmkp-file-this-dir-(all|some)-tags(-regexp)-jump., -;; Create/Set section, with bmkp-autofile-set. -;; 2011/04/01 dadams -;; bookmark-bmenu-mode: Added to mode help: bmkp-(dired|file)-this-dir-jump. -;; 2011/03/26 dadams -;; bookmark-bmenu-mode: Added new file-with-tags jump commands to the help. -;; 2011/03/05 dadams -;; bmkp-bmenu-edit-bookmark: Use bmkp-refresh-menu-list, not *-surreptitiously-rebuild-list. -;; 2011/02/11 dadams -;; Faces: Better defaults for dark background. -;; 2011/01/03 dadams -;; Removed autoload cookies from non def* sexps and from define-key. -;; Added missing autoload cookies for commands, in particular redefined std commands & defalias. -;; 2010/12/10 dadams -;; Added defalias for bookmark-name-from(-full)-record, to fix gratuitous Emacs name change. -;; 2010/09/24 dadams -;; Added: bmkp-bmenu-show-only-autonamed. Bound to # S. Added to bmkp-bmenu-show-menu. -;; bookmark-bmenu-mode: Updated doc string for autonamed jumps, show. -;; Renamed varlist to variable-list everywhere. -;; 2010/08/22 dadams -;; Added: bmkp-bmenu-filter-annotation-incrementally, bookmark-bmenu-relocate (Emacs 20, 21), -;; bmkp-bmenu-filter-alist-by-annotation-regexp. Bound, added to menus and help. -;; 2010/08/18 dadams -;; Removed eval-when-compile for bookmark+-(lit|1).el. -;; bmkp-bmenu-propertize-item: Inconsequential simplification. -;; 2010/08/17 dadams -;; bmkp-bmenu-edit-bookmark: Added optional arg INTERNALP (prefix arg), for editing record. -;; 2010/08/15 dadams -;; Moved to bookmark+-mac.el: -;; bmkp-define-sort-command, bmkp-replace-regexp-in-string, bmkp-assoc-delete-all. -;; Renamed: bmkp-barf-if-not-in-menu-list to bmkp-bmenu-barf-if-not-in-menu-list. -;; Require bookmark.el, bookmark+-mac.el. -;; Require when compile: bookmark+-1.el, bookmark+-lit.el (soft). -;; 2010/07/17 dadams -;; Added: bmkp-bmenu-mark-url-bookmarks, bmkp-bmenu-show-only-urls, bmkp-bmenu-sort-by-url. -;; Removed: bmkp-bmenu-sort-by-w3m-url. -;; Replaced face bmkp-w3m by bmkp-url. -;; bookmark-bmenu-mode: Added mark and show URL commands. -;; bookmark-bmenu-mode, *-status-help, *-sort-by-bookmark-type, *-define-sort-command: w3m -> url. -;; Bind bmkp-bmenu-sort-by-url, not bmkp-bmenu-sort-by-w3m-url. -;; Bind bmkp-bmenu-mark-url-bookmarks, bmkp-bmenu-show-only-urls. -;; Replace W3M by URL in menu items. -;; 2010/07/14 dadams -;; Created from bookmark+.el code. - -;;;(@* "CHANGE LOG FOR `bookmark+-key.el'") -;; -;; 2012/02/26 dadams -;; Bind: -;; bmkp-this-file/buffer-bmenu-list to C-x p , not C-x p .. -;; bmkp-(file|dired)-this-dir-jump* to C-x j . f|d not C-x j C-f|C-d. -;; bmkp-file-this-dir-*-tags(-regexp)-jump* to C-x j t . [%][*+] not C-x j t C-f [%][*+]. -;; bmkp-this-buffer-jump* to C-x j , , not C-x j .. -;; bmkp-autonamed-this-buffer-jump* to C-x j , # not C-x j # .. -;; bmkp-autonamed-jump* to C-x j # not C-x j # #. -;; bmkp-autofile-jump* in all Emacs versions. -;; bmkp-find-file(-other-window), which is new, to C-x j C-f. -;; new autofile tags jump commands bmkp-autofile-(all|some)-tags(-regexp)-jump* to -;; C-x j t a [%][*+], which was for bmkp-find-file-*-tags*. -;; bmkp-find-file-(all|some)-tags(-regexp)* to C-x j t C-f [%] [*+] not C-x j t a [%] [*+]. -;; Add to menus: bmkp-autofile-*. Rename menu items for bmkp-find-file: Find Autofile.... -;; Rename menu Bookmarked File to Find File or Autofile. For Emacs 20-21, make it a single item. -;; bmkp-jump-tags-menu, bmkp-find-file-menu: Do not add Autofile tags items for Emacs 20. -;; 2012/02/21 dadams -;; Added bindings for: bmkp-autofile-(all|some)-tags(-regexp)-jump(-other-window), -;; bmkp-find-file(-other-window) (was same as *autofile*). -;; Changed bindings: -;; *-this-dir*: . [df] (was C-d/C-f), *this-buffer*: , (was .), *find-file*tags*: C-f (was a). -;; Define *autofile* for all Emacs versions. Separate bindings from *find-file* cmds. -;; 2011/12/30 dadams -;; Added aliases: bmkp-bookmark-(data|name)-from-record. -;; Bind E to bmkp-edit-bookmark-record, not bmkp-edit-bookmark. -;; Bind r to bmkp-edit-bookmark-name-and-file, not bookmark-rename. Ditto in menu. -;; Use bmkp-get-bookmark-in-alist, not bookmark-get-bookmark in :visible conditions. -;; menu-bar-bookmark-map: Added bmkp-edit-bookmark-record. -;; bmkp-tags-menu: Added bmkp-edit-tags. -;; 2011/12/14 dadams -;; Removed conditions :enable bookmark-alist. -;; 2011/12/09 dadams -;; Commented out menu items with complex :enable conditions, replacing them with simple ones. -;; Reason: too slow, especially in Emacs 20. -;; 2011/12/05 dadams -;; menu-bar-bookmark-map: Reordered items regarding bookmark files. -;; 2011/12/03 dadams -;; Bind C-x p L to bmkp-switch-bookmark-file-create, not bmkp-switch-bookmark-file. -;; Reordered bookmark-file items in menu-bar-bookmark-map. -;; 2011/11/18 dadams -;; Bind bmkp-image-jump(-other-window) to C-x (4) j M-i. -;; bmkp-jump-menu: Add bmkp-image-jump-other-window. -;; 2011/11/15 dadams -;; Bind *-this-file/buffer*, not *-this-buffer*. -;; 2011/11/01 dadams -;; Bind alias bmkp-autofile-jump(-*), not bmkp-find-file(-*) to C-x j a, so Icicles picks up key. -;; Bind bmkp-bookmark-file-jump to C-x j y, not C-x j x. Bind bmkp-temporary-jump(-*) to C-x j x. -;; bmkp-jump-menu: Bind bmkp-(autofile|temporary)-jump-other-window. -;; 2011/10/31 dadams -;; Bind bmkp-toggle-autotemp-on-set to C-x p x. Move bmkp-set-bookmark-file-bookmark to C-x p y. -;; menu-bar-bookmark-map: Added: bmkp-toggle-autotemp-on-set. -;; 2011/10/28 dadams -;; menu-bar-bookmark-map: -;; Added: bmkp-delete-all-temporary-bookmarks, bmkp-temporary-bookmarking-mode. Reordered. -;; bmkp-options-menu: Added: bmkp-toggle-saving-menu-list-state, bmkp-toggle-saving-bookmark-file. -;; 2011/04/24 dadams -;; Added to Bookmarks menu and its Tags submenu: Purge Autofiles with No Tags. -;; 2011/04/23 dadams -;; bmkp-tags-menu: -;; Added bmkp-set-tag-value, bmkp-(add|remove|copy)-tags, bmkp-paste-(add|replace)-tags. -;; 2011/04/21 dadams -;; Bound: bmkp-copy-tags, bmkp-paste-add-tags, bmkp-paste-replace-tags. -;; 2011/04/16 dadams -;; Added: bmkp-tags-map. Bound tag commands to prefix C-x p t. -;; 2011/04/14 dadams -;; Renamed menu Jump To Bookmark to just Jump To, in menu-bar-bookmark-map. -;; 2011/04/13 dadams -;; Added: -;; bmkp-find-file-menu (bmkp-find-file(-(all|some)-tags(-regexp)(-other-window)), -;; bmkp-jump-tags-menu (what was in main, plus bmkp-find-file-*-tags-regexp*), -;; bmkp-tags-menu (list all, rename, remove from all, (un)tag a file). -;; bmkp-jump(-other-window)-map: -;; Added bmkp-find-file(-other-window) to menu. -;; Bound keys for bmkp-find-file-(all|some)-tags(-regexp)(-other-window): C-x (4) j t a... -;; 2011/04/02 dadams -;; Added bindings for (new) bmkp-autofile-set, -;; bmkp-file-this-dir-(all|some)-tags(-regexp)-jump(-other-window). -;; 2011/04/01 dadams -;; Added to bmkp-jump-menu: bmkp-(dired|file)-this-dir-jump-other-window. -;; Created from code in bookmark+-1.el. - -;;;(@* "CHANGE LOG FOR `bookmark+-lit.el'") -;; -;; 2012/04/28 dadams -;; bmkp-make/move-overlay-of-style, bmkp-make/move-fringe: Use FRONT-ADVANCE arg for make-overlay. -;; 2011/12/30 dadams -;; Added aliases: bmkp-bookmark-(data|name)-from-record. -;; bmkp-bookmarks-lighted-at-point: Include only bookmarks in bookmark-alist. -;; bmkp-light-bookmark: Do nothing if BOOKMARK is not a bookmark or bookmark name. -;; bmkp-a-bookmark-lighted-at-pos: Return nil if no bookmark (at POS) in bookmark-alist. -;; 2011/11/15 dadams -;; Applied renaming: bmkp-this-buffer-cycle-sort-comparer to *-this-file/buffer*. -;; 2011/08/09 dadams -;; Bind icicle-unpropertize-completion-result-flag to t for all calls to completing-read. -;; 2011/04/12 -;; bmkp-cycle-lighted-this-buffer: Use bmkp-sort-omit, not bmkp-sort-and-remove-dups. -;; 2011/04/01 dadams -;; bmkp-light-bookmark(s): Don't call bookmark-handle-bookmark. Wrap with with-current-buffer. -;; 2011/01/03 dadams -;; Added autoload cookies: defcustoms and commands. -;; 2010/12/10 dadams -;; Added defalias for bookmark-name-from(-full)-record, to fix gratuitous Emacs name change. -;; 2010/09/25 dadams -;; Added: bmkp-set-lighting-for(bookmarks|(-this)-buffer). Requested by Joe Bloggs. -;; bmkp-set-lighting-for-bookmark: Added LIGHT-NOW-P arg (from prefix arg). -;; 2010/09/11 dadams -;; Removed eval-when-compile for bookmark+-bmu, bookmark+-1. -;; 2010/08/15 dadams -;; Require: bookmark.el. -;; Require when compile: bookmark+-bmu.el, bookmark+-1.el, pp+.el (soft). -;; Applied renaming of bmkp-barf-if-not-in-menu-list to bmkp-bmenu-barf-if-not-in-menu-list. -;; bmkp-light-bookmark(s): Added missing arg to throw call. -;; bmkp-light-bookmarks: Use bmkp-remove-if, not remove-if. -;; bmkp-light-bookmarks-in-region, bmkp-light-non-autonamed-this-buffer: -;; Use bmkp-remove-if-not, not remove-if-not. -;; bmkp-read-set-lighting-args: Use pp-read-expression-map only if bound (pp+.el). -;; 2010/07/03 dadams -;; bmkp-set-lighting-for-bookmark, bmkp-bmenu-set-lighting-for-marked: -;; Use *-refresh-menu-list, not *-surreptitiously-*. -;; 2010/07/01 dadams -;; Created. - -;;;(@* "CHANGE LOG FOR `bookmark+-mac.el'") -;; -;; ************************************************************************************************** -;; NOTE: If you byte-compile Bookmark+ (recommended), then WHENEVER `bookmark+-mac.el' is updated, -;; you must load `bookmark+-mac.el' (not just `bookmark+-mac.elc'), then compile it, then -;; RECOMPILE *ALL* of the other Bookmark+ source files as well. This is normal for Lisp: code -;; that depends on macros needs to be byte-compiled anew after loading the updated macros. -;; ************************************************************************************************** -;; -;; 2012/04/27 -;; Added: bmkp-with-output-to-plain-temp-buffer. -;; 2012/04/12 dadams -;; bmkp-define-sort-command: Do not bmkp-bmenu-goto-bookmark-named unless current-bmk (play safe). -;; 2012/04/11 dadams -;; bmkp-define-sort-command: In function def, change order to: fn, reverse-fn, unsorted. -;; 2011/12/30 dadams -;; bmkp-define-cycle-command: Applied renaming of bmkp-sort-and-remove-dups to bmkp-sort-omit. -;; bmkp-define-file-sort-predicate: Updated doc string of generated functions. -;; Added renamings of bookmark-name-from(-full)-record, bookmark-get-bookmark-record. -;; 2011/04/12 -;; bmkp-define-cycle-command: Use bmkp-sort-omit, not bmkp-sort-and-remove-dups. -;; 2011/01/03 dadams -;; Added autoload cookies: defmacro. -;; 2010/09/25 dadams -;; Added: bmkp-define-next+prev-cycle-commands. -;; 2010/09/24 dadams -;; Added: bmkp-define-cycle-command. -;; 2010/08/18 dadams -;; Removed eval-when-compile for bookmark+-(bmu|1).el. -;; 2010/08/15 dadams -;; Created, from code in other Bookmark+ files. - -;;;(@* "CHANGE LOG FOR `bookmark+.el'") -;; -;; 2012/02/26 dadams -;; Version 3.4.0. -;; 2011/12/30 dadams -;; Version 3.3.0. -;; 2011/04/12 dadams -;; Version 3.2.2. -;; 2011/04/01 dadams -;; Require bookmark+-key.el (new). Version 3.2.1. -;; 2011/01/03 dadams -;; Added autoload cookies: defconst, command. -;; 2010/08/19 -;; bmkp-version-number: Version 3.2.0. -;; 2010/08/15 dadams -;; Require bookmark+-mac.el. -;; Do not ensure loaded before compile (not needed here now). -;; 2010/07/14 dadams -;; Version 3.1.1. -;; Moved main content of bookmark+.el to new files bookmark+-1.el and bookmark+-bmu.el. -;; 2010/07/13 dadams -;; Version 3.1.0. -;; Added redefinitions: bookmark-bmenu-(1|2)-window, bookmark-bmenu-other-window-with-mouse, -;; bookmark-bmenu-this-window, bookmark-bmenu-switch-other-window. -;; Added: bmkp-last-bookmark-file, bmkp-switch-to-last-bookmark-file. -;; Removed pre-23 version of bookmark-bmenu-switch-other-window. -;; bookmark-load: Use bmkp-last-bookmark-file when read file name. Added missing prefix arg. -;; Save old current as bmkp-last-bookmark-file. -;; bookmark-bmenu-list: If bookmark file has changed do not restore state saved from other file. -;; Save old current as bmkp-last-bookmark-file. -;; bmkp-bmenu-list-1: Do not use bmkp-bmenu-title if it is empty (""). -;; bookmark-bmenu-mode: Added to doc string: bmkp-switch-bookmark-file. -;; bookmark-bmenu-other-window: Do not bind bookmark-automatically-show-annotations (per vanilla). -;; bookmark-bmenu-show-annotation: Ensure in bmenu list and on a bookmark line. -;; bmkp-switch-bookmark-file: Use bmkp-last-bookmark-file when read file name. -;; bmkp-bmenu-define-full-snapshot-command: Set bmkp-last-bookmark-file. -;; bmkp-bookmark-description: Fixed typo: bmkp-bookmark-file-bookmark-p (not desktop). -;; bmkp-make-bookmark-file-record: Use arg file (not bmkp-non-file-filename) as filename entry. -;; -;; Added more autoload cookies. -;; 2010/07/09 dadams -;; Added: bmkp-bmenu-mark-bookmark-file-bookmarks, bmkp-bmenu-show-only-bookmark-files, -;; bmkp-bookmark-file-jump, bmkp-set-bookmark-file-bookmark, bmkp-bookmark-file-history, -;; bmkp-use-bookmark-file-create, bmkp-bookmark-file, bmkp-bookmark-file-alist-only, -;; bmkp-bookmark-file-bookmark-p, bmkp-jump-bookmark-file, bmkp-make-bookmark-file-record. -;; bmkp-types-alist, bmkp-buffer-names, bmkp-bmenu-mode-status-help, bmkp-bmenu-propertize-item, -;; bmkp-this-buffer-p, bmkp-last-specific-buffer-p, bmkp-specific-buffers-alist-only, -;; bmkp-bookmark-description, bookmark-bmenu-mode: Updated for bookmark-file bookmarks. -;; bookmark--jump-via: Added a catch, so a handler can skip all other processing when it's done. -;; bookmark-load: Final msg says whether overwritten. -;; Bound and added to menus: bmkp-set-bookmark-file-bookmark, -;; bmkp-bmenu-mark-bookmark-file-bookmarks, -;; bmkp-bmenu-show-only-bookmark-files, bmkp-bookmark-file-jump. -;; 2010/07/07 dadams -;; bookmark-handle-bookmark: Bind use-dialog-box, use-file-dialog to nil. -;; bookmark-location: From Emacs 23: Use location property and -- Unknown location --. -;; bmkp-switch-bookmark-file: Bind insert-default-directory to nil. -;; bmkp-empty-file: Expand FILE. Return FILE. -;; 2010/07/03 dadams -;; Added: bmkp-bmenu-describe-marked, bmkp-bookmark-description. -;; bmkp-describe-bookmark: Rewrote to use bmkp-bookmark-description. -;; Bound bmkp-bmenu-describe-marked to C-h >. -;; bmkp-bmenu-menubar-menu: Added bmkp-bmenu-describe-(marked|bookmark). -;; Updated doc string of bookmark-alist. -;; 2010/07/01 dadams -;; Added: bmkp-bmenu-mark-lighted-bookmarks, bmkp-bmenu-set-tag-value-for-marked, -;; bmkp-bmenu-show-only-tagged, bmkp-occur-create-autonamed-bookmarks, -;; bmkp-set-autonamed-bookmark, bmkp-set-autonamed-bookmark-at-line, -;; bmkp-set-autonamed-regexp-buffer, bmkp-set-autonamed-regexp-region, -;; bmkp-set-tag-value-for-navlist, bmkp-prompt-for-tags-flag, bmkp-menu-bar-make-toggle, -;; bmkp-same-creation-time-p, bmkp-set-tag-value-for-bookmarks, -;; bmkp(-bmenu)-highlight-menu, bmkp-options-menu. -;; Renamed: bmkp-use-region-flag to bmkp-use-region, -;; bmkp-bmenu-jump-menu to bmkp-jump-menu. -;; Removed: bmkp-cycle-this-buffer-buff (unused). -;; Soft-require new library bookmark+-lit.el. -;; Split off new file bookmark+-chg.el from bookmark+-doc.el. -;; Changed default values of faces bmkp->-mark, bmkp-t-mark. -;; bmkp-crosshairs-flag: Added :set instead of add-hook at top level. -;; bmkp-use-region: Changed from boolean to choice - added cycling-too value. -;; bookmark-set: Added INTERACTIVEP arg. Prompt for tags when bmkp-prompt-for-tags-flag. -;; Auto-highlight when set, per bmkp-auto-light-when-set. -;; bookmark--jump-via: Auto-highlight when jump, per bmkp-auto-light-when-jump. -;; Set BOOKMARK to result of bmkp-update-autonamed-bookmark. -;; Bind orig-buff when running hook. -;; bookmark-default-handler: Pass the bookmark too as an arg to bmkp-goto-position. -;; bookmark-relocate, bookmark-rename, bmkp-bmenu-list-1, bmkp-remove(-all)-tags, bmkp-add-tags: -;; Add 0 as FRAME arg to get-buffer-window. -;; bookmark-delete: Remove any highlighting on bookmark. -;; bmkp-bmenu-list-1: Add highlight-overrides indicator. -;; bmkp-completing-read-1: Added (not laxp) guard for first branch of main if. -;; bmkp-crosshairs-highlight: Assign a priority. Make the cmd a no-op for Emacs 20-21. -;; bmkp-choose-navlist-*, bmkp-navlist-bmenu-list, bmkp-jump-in-navlist*, -;; bmkp-cycle(-this-buffer*): -;; Set bmkp-current-nav-bookmark to bookmark, not to its name. -;; bmkp-update-autonamed-bookmark: Do not set bmkp-current-nav-bookmark to the name. -;; Call bmkp-refresh-menu-list even if menu list is not displayed. -;; Pass the bookmark name to bmkp-refresh-menu-list. -;; Return the updated BOOKMARK. -;; bmkp-refresh-menu-list: Set window point also. -;; bmkp-goto-position: -;; Added BOOKMARK arg. When bmkp-save-new-location-flag, update BOOKMARK. Return indicator. -;; bmkp-create-varlist-bookmark: Call bookmark-set with INTERACTIVEP arg. -;; bmkp-cycle(-this-buffer*): Added STARTOVERP arg. Pass OTHER-WINDOW, STARTOVERP to bmkp-cycle-1. -;; bmkp-cycle-1: Added STARTOVERP arg. If non-nil pop-up-frames, then inhibit showing annotation. -;; Use region only if bmkp-use-region value is cycling-too. -;; Use eq for *-list-position test. If *-list-position returns nil, then reset. -;; Use save-selected-window, unlesl OTHER-WINDOW. -;; bmkp-(next|previous)-bookmark(-this-buffer|-w32): Added STARTOVERP arg. C-u: start over at 1. -;; Bind highlight cmds: *-map: h,H,u,U,C-u,=,C-up|down. *-bmenu-*map: H+,H>+,H>H,HH,HS,H>U,HU. -;; *-jump-map: h. Bind TS in *-bmenu-*map. -;; Add bmkp-occur-create-autonamed-bookmarks to occur-mode-map as C-c b. -;; Menus: Added Highlight, Toggle Option. Added light to Jump To, Show, Mark, mouse. Reorder. -;; 2010/06/23 dadams -;; Split the change log off from file bookmark+-doc.el to new file bookmark+-chg.el. -;; 2010/06/21 dadams -;; Renamed: bmkp-toggle-autoname-bookmark-set/delete to bmkp-toggle-autonamed-bookmark-set/delete, -;; bmkp-autonamed-bookmarks-alist-only to bmkp-autonamed-this-buffer-alist-only, -;; bmkp-bookmark-autoname-p to bmkp-autonamed-bookmark-for-buffer-p, -;; Added: bmkp-autonamed-alist-only, bmkp-non-autonamed-alist-only, bmkp-autonamed-bookmark-p, -;; bmkp-completing-read-1: Use DEFAULT as default. Use just (not lax) - no non-t. -;; Use DEFAULT if empty input only if DEFAULT is non-nil. -;; bmkp-choose-navlist-of-type: Added pseudo-type "any". -;; bmkp-specific-buffers-alist-only: Exclude desktop etc. bookmarks. -;; bmkp-update-autonamed-bookmark: Arg can be a bookmark (not just name). -;; 2010/06/19 dadams -;; RENAMED bookmarkp* TO bmkp*. ***** THIS IS AN INCOMPATIBLE CHANGE ****** -;; -;; If you have existing customizations, or if you have bookmarks that have the (internal) tag -;; "bmkp-jump", then YOU MUST REPLACE occurrences of "bookmarkp" by "bmkp" EVERYWHERE. This -;; includes replacing occurrences in (1) your bookmarks file (bookmark-default-file), (2) your -;; state file (bmkp-bmenu-state-file), and (3) your command file (bmkp-bmenu-commands-file). -;; -;; Changed *-bmenu-w32-open-select binding to M-o from M-v. -;; 2010/06/11 dadams -;; Wrap all (require '* nil t) in condition-case. -;; 2010/06/07 dadams -;; Fix deskstop bookmarks for Emacs < 22. Protect: -;; *-release-lock with fboundp, *-buffer-args-list with boundp, *-dir with Emacs version #, -;; 2010/05/30 dadams -;; Added: bookmarkp-(next|previous)-bookmark-w32(-repeat). Bound to C-x p (next|prior). -;; 2010/05/29 dadams -;; *-bmenu-list, *-choose-navlist-from-bookmark-list, *-bmenu-define(-full-snapshot)-command, -;; *-save-menu-list-state, -make-bookmark-list-record: -;; Add/restore bookmarkp-bmenu-filter-pattern to/from state. -;; *-jump-bookmark-list: Set bookmarkp-latest-bookmark-alist to bookmark-alist. -;; Reordered Bookmark menu and added items: -;; Set Bookmark, Delete Autonamed Bookmark, Delete All Autonamed Bookmarks Here, -;; Delete Bookmarks Here, Delete Bookmark, Rename Bookmark, Bookmark List for This Buffer, -;; Bookmark List for Navlist, Set Navlist to Bookmarks of Type, -;; Set Navlist from Bookmark-List Bookmark, Insert Bookmark Contents, Insert Bookmark Location. -;; Added to Bookmark+ menu: Set Navlist *. -;; Added to bookmarkp-bmenu-jump-menu: In Navigation List. -;; Added :enable entries for menu items. -;; Updated bookmark-bmenu-mode doc string for cycling, navlist, and options. -;; Corrected bindings of bookmarkp-jump-in-navlist(-other-window). -;; 2010/05/26 dadams -;; Added: -;; bookmarkp-choose-navlist-(from-bookmark-list|of-type), bookmarkp-crosshairs-highlight, -;; bookmarkp-cycle(-this-buffer)(-other-window), bookmarkp-delete-bookmarks, -;; bookmarkp-jump-in-navlist(-other-window), bookmarkp-navlist-bmenu-list, -;; bookmarkp-(next|previous)-bookmark(-this-buffer)(-repeat), -;; bookmarkp-toggle-autoname-bookmark-set/delete, bookmarkp-autoname-bookmark(-function), -;; bookmarkp-autonamed-bookmarks-alist-only, bookmarkp-autoname-format, -;; bookmarkp-bookmark-autoname-p, bookmarkp-crosshairs-flag, -;; bookmarkp-this-buffer-cycle-sort-comparer, bookmarkp-current-bookmark-list-state, -;; bookmarkp-cycle-1, bookmarkp-list-position, bookmarkp-position-cp, -;; bookmarkp-current-nav-bookmark, bookmarkp-cycle-this-buffer-buff, bookmarkp-nav-alist, -;; bookmarkp-update-autonamed-bookmark, bookmarkp-delete-all-autonamed-for-this-buffer. -;; Bound: -;; bookmarkp-choose-navlist-from-bookmark-list, bookmark-insert-location, -;; bookmarkp-navlist-bmenu-list, bookmarkp-choose-navlist-of-type, bookmarkp-delete-bookmarks, -;; bookmarkp-toggle-autoname-bookmark-set/delete, bookmarkp-jump-in-navlist(-other-window), -;; bookmarkp-(next|previous)-bookmark(-this-buffer)-repeat. -;; bookmark--jump-via: Update the name and position of an autonamed bookmark. -;; 2010/05/22 dadams -;; *-this-buffer-p: Return nil for bookmarks not really associated with a buffer. -;; *-default-handler, *-goto-position: Forgot comma to eval file-name when no-such-file error. -;; *-show-annotation: Bind buffer-read-only to nil for updating. -;; 2010/05/19 dadams -;; Added: bookmarkp-this-buffer-bmenu-list. Bound to `C-x p .'. -;; menu-bar-bookmark-map: -;; Added bookmarkp-this-buffer-bmenu-list. Added separators. -;; Added vanilla items edit, write, load, to impose order. Renamed item edit. -;; 2010/05/16 dadams -;; bookmark-set: Quoted history arg. Thx to S. Nemec. -;; bookmarkp-bmenu-define-full-snapshot-command: Use quote comma, not quote, for *-specific-*. -;; 2010/05/15 dadams -;; Replace *same-(buffer|file)-jump* by *specific-(buffers|files)-jump*: read multiple buff/files. -;; Renamed: *same-(buffer|file)* to *-last-specific-(buffer|file)* for pred, alist, and var. -;; Renamed: *same-(buffer|file)* to *specific-(buffer|file)* for hist, *types*, mark/show cmds. -;; Renamed: *-selected-buffers-alist* to *-specific-buffers-alist*. -;; Added: *-specific-files-alist*, *-(all|some)-tags(-regexp)-alist-only. -;; *-completing-read-(buffer|file)-name: Use (buffer|file)-name-history, not *-same-*-history. -;; *-read-tags-completing: Rewrote to correctly handle cons and string tags, error handling, etc. -;; *-bmenu-(add|remove)-tags-*-marked: Error handling. -;; *(all|some)-tags(-regexp)-jump*: Use *-(all|some)-tags(-regexp)-alist-only. -;; 2010/05/11 dadams -;; Added: bookmarkp-bmenu-mark-same-(buffer|file)-bookmarks, bookmarkp-this-(buffer|file)-p, -;; bookmarkp-this-(buffer|file)-alist-only, bookmarkp-bmenu-show-only-same-(buffer|file), -;; bookmarkp-completing-read-(buffer|file)-name, bookmarkp-same-(buffer|file)-history, -;; bookmarkp-(same|this)-(buffer|file)-alist-only, bookmarkp-last-same-(buffer|file), -;; bookmarkp-(same|this)-(buffer|file)-jump(-other-window), bookmarkp-(buffer|file)-names, -;; bookmarkp-same-(buffer|file)-as-last-p, bookmarkp-other-window-pop-to-flag, -;; bookmarkp-select-buffer-other-window. -;; Use bookmarkp-select-buffer-other-window instead of switch-to-buffer-other-window everywhere. -;; Bound = (b|f) (M|S), C-x j (=|.) (b|f) to (same|current)-(buffer|file) commands. -;; *-types-alist: Handle same-(buffer|file) too. -;; *-bmenu-list, *-bmenu-define-full-snapshot-command, *-save-menu-list-state: -;; Handle bookmarkp-last-same-(buffer|file) as part of state. -;; 2010/05/05 dadams -;; bookmarkp-create-varlist-bookmark, bookmarkp-make-varlist-record: -;; Added optional arg BUFFER-NAME. -;; bookmark-alist: Corrected doc string wrt BUFFER-NAME and region context strings. -;; 2010/05/04 dadams -;; Added: bookmarkp-create-varlist-bookmark. -;; bookmarkp-jump-varlist: If bookmark's buffer doesn't exist, use current buffer and show msg. -;; 2010/04/24 adams -;; Added: bookmarkp-bmenu-show-only-varlists, bookmarkp-set-restrictions-bookmark, -;; bookmarkp-set-varlist-bookmark, bookmarkp-varlist-jump, bookmarkp-varlist, -;; bookmarkp-jump-varlist, bookmarkp-make-varlist-record, bookmarkp-printable-p, -;; bookmarkp-printable-vars+vals, bookmarkp-read-variables-completing, -;; bookmarkp-read-variable, bookmarkp-varlist-alist-only, bookmarkp-varlist-bookmark-p, -;; bookmarkp-varlist-history. -;; Bound bookmarkp-bmenu-show-only-varlists to V S, bookmarkp-varlist-jump to C-x j v (and menu). -;; *-types-alist: Added bookmarkp-varlist-history. -;; *-bmenu-mode-status-help, *-bmenu-propertize-item, *-describe-bookmark: Handle varlist bmks. -;; *-bmenu-w32-open-select: Changed binding to M-v from V. -;; *-bmenu-mode: Updated doc string. -;; 2010/04/17 dadams -;; bookmark-set: Numeric prefix arg means use all bookmarks as completion candidates. -;; Simplified the prompt. -;; bookmarkp-completing-read-1: -;; Use icicle-transform-multi-completion in icicle-delete-candidate-object -;; Ensure loaded before byte-compile (put a require after provide). -;; Move bookmarkp-replace-regexp-in-string before macro bookmarkp-define-sort-command (uses it). -;; bookmarkp-bmenu-w32-open-with-mouse, bookmarkp-bmenu-mouse-3-menu: -;; Use with-current-buffer, not save-excursion of set-buffer. -;; bookmarkp-make-dired-record, bookmarkp-jump-dired: Use dolist, not mapcar (just side effect). -;; bookmarkp-(some|all)-tags-jump(-other-window): Removed extraneous arg in error call. -;; 2010/04/16 dadams -;; Added: bookmarkp-completing-read-1, bookmarkp-completing-read-lax, -;; bookmarkp-selected-buffers-alist-only. -;; bookmark-set: Use bookmark-completing-read-lax w/ buffer's bookmarks, not read-from-minibuffer. -;; bookmark-completing-read: Define using bookmarkp-completing-read-1. -;; 2010/04/09 dadams -;; bookmarkp-edit-bookmark: Update dired-directory property along with filename property. -;; 2010/03/28 dadams -;; bookmarkp-goto-position: Don't funcall bookmarkp-jump-display-function if it is nil. -;; 2010/03/28 dadams -;; bookmark-default-handler: Don't funcall bookmarkp-jump-display-function if it is nil. -;; 2010/03/27 dadams -;; Changed the customization group from bookmarkp to bookmark-plus. -;; Moved doc and change history from bookmark+.el to this new file, bookmark+-doc.el. -;; bookmarkp-commentary-button: Use bookmark+-doc.el, not bookmark+.el. -;; 2010/03/17 dadams -;; Added: bookmarkp-toggle-bookmark-set-refreshes, bookmarkp-refresh-latest-bookmark-list, -;; bookmarkp-after-set-hook. -;; 2010/03/16 dadams -;; Fixed parens placement (typo) for last change to define *-jump-woman for Emacs 20. -;; 2010/03/11 dadams -;; Define bookmarkp-jump-woman also for Emacs 20 (just raise an error). -;; *-show-annotation: Typo: bookmark -> bmk-name. -;; 2010/03/10 dadams -;; Added: bookmarkp-bookmark-creation-cp, bookmarkp-bmenu-sort-by-creation-time (bind: s0, menu). -;; *-make-record-default: Add entry: created. -;; *-describe-bookmark: Add creation time to description. -;; 2010/03/03 dadams -;; *-sort-and-remove-dups: Do not set bookmarkp-sorted-alist to the result. -;; *-bmenu-list-1: Set bookmarkp-sorted-alist to the result of calling *-sort-and-remove-dups. -;; 2010/03/02 dadams -;; Added: bookmarkp-sorted-alist. -;; *-bmenu-list-1: Use bookmarkp-sorted-alist. -;; *-sort-and-remove-dups: Set bookmarkp-sorted-alist to the result. -;; All *-cp (and hence *-define-file-sort-predicate): -;; Accept bookmark names as args, in addition to bookmarks. -;; bookmark-alpha-p: Don't use bookmarkp-make-plain-predicate, to avoid infinite recursion. -;; 2010/02/28 dadams -;; Added: bookmarkp-send-bug-report. -;; bookmarkp-bmenu-mode-status-help: Rewrote to provide only Bookmark+ help. Added help buttons. -;; Fixed Commentary typos. -;; 2010/02/26 dadams -;; Added: bookmarkp-desktop-change-dir, bookmarkp-desktop-kill, bookmarkp-desktop-delete. -;; *-jump-desktop: Call *-desktop-change-dir. -;; *-read-bookmark-for-type: Added optional arg ACTION. -;; 2010/02/24 dadams -;; *-bmenu-list: Handle case null last-bookmark-file (due to old file format). Thx to Seb Luque. -;; *-make-record-default: protect dired-buffers with boundp. Thx to Janek Schwarz. -;; 2010/02/16 dadams -;; bookmarkp-define-sort-command: Add msg suffix about repeating. -;; bookmarkp-msg-about-sort-order: Added optional arg SUFFIX-MSG. -;; 2010/02/15 dadams -;; Added: bookmark-bmenu-switch-other-window (redefinition for Emacs 20-22). -;; *-bmenu-mode: Added redefinition, instead of advising. -;; *-send-edited-annotation, *-relocate, *-rename, *-bmenu-refresh-menu-list, -;; *-remove(-all)-tags, *-add-tags: -;; Refresh the menu list, to pick up changes. -;; *-refresh-menu-list: Added optional arg BOOKMARK: go to it. -;; Do not bind bookmark-bmenu-relocate unless it's defined. -;; *-handler-cp: Respect case-fold-search. -;; 2010/02/14 dadams -;; Renamed bookmark-bmenu-list-1 to bookmarkp-bmenu-list-1. -;; Added faces: bookmarkp-(a|t|>|D)-mark, bookmarkp-heading (don't use bookmark-menu-heading). -;; Added redefinitions: bookmark-send-edited-annotation, bookmark(-bmenu)-show-annotation, -;; bookmark-show-all-annotations. -;; *-bmenu-mark, *-bmenu-delete, *-bmenu-list-1: Add faces to marks. -;; *-bmenu-list-1 and everywhere: Get rid of "% " before menu-list title. -;; *-bmenu-list-1: Use "a", not "*", as annotation mark. -;; Add "t" mark for tags. Add an extra space before bookmark name. -;; *-bmenu-marks-width: change value from 2 to 4, for the tags column and the extra space. -;; 2010/02/13 dadams -;; Added: bookmarkp-desktop-history, -;; bookmarkp-desktop-jump (bound to C-x j K; added to menu), -;; bookmarkp-bookmark-list-jump (bound to C-x j B; added to menu), -;; bookmarkp-bookmark-list-alist-only, bookmarkp-bookmark-list-history. -;; *-types-alist: Added entries for desktops and bookmark-lists. -;; *-describe-bookmark: Added optional arg, to show full (internal) info. -;; Bind it to ? in bookmark-map. -;; *-jump-bookmark-list: Pop to the bookmark-list (to show it). -;; *-bmenu-mark-w3m-bookmarks: Typo: wrong predicate. -;; *(-bmenu)-remove-all-tags: Raise error if no tags to remove. -;; *-bmenu-remove-all-tags: Require confirmation if interactive. -;; *-bmenu-remove-tags: Added optional arg MSGP. -;; Menus: Added "..." as needed. -;; *-bmenu-mouse-3-menu: Guard bookmark-bmenu-relocate with fboundp. -;; 2010/02/12 dadams -;; Added: bookmarkp-bmenu-define-jump-marked-command. Bound to M-c and added to menu. -;; Changed bookmarkp-toggle-saving-bookmark-file binding to M-~ (M-s conflicts w isearch-multi). -;; Updated bookmark-bmenu-mode doc string. -;; 2010/02/11 dadams -;; Added: bookmarkp-types-alist, -;; bookmarkp-(dired|gnus|info|man|region|w3m|(non-|local-|remote-)file)-history. -;; bookmark-completing-read: Added optional HIST arg. -;; *-(relocate|rename|insert(-location)): Added bookmark default for interactive use. -;; *-jump-dired: Handle bookmarkp-jump-display-function. -;; *-read-bookmark-for-type: Added optional HIST arg. -;; *-jump-to-type(-other-window), -;; *-(dired|file|gnus|info|man|region|w3m|(local-|non-|remote-)file)-jump*(-other-window): -;; Use type-specific history var. -;; 2010/02/09 dadams -;; Added: bookmarkp-get-tag-value. -;; bookmark--jump-via: Handle special bookmark tag bookmarkp-jump. -;; 2010/02/08 dadams -;; Renamed: bookmarkp-bmenu-dired-marked-local to bookmarkp-bmenu-dired-marked. -;; bookmarkp-bmenu-dired-marked: Handle remote bookmarks if Emacs > 23.1. -;; Support tags with values. -;; Added: bookmarkp-tag-name, bookmarkp-full-tag, bookmarkp(-bmenu)-set-tag-value. -;; Renamed variable (not fn) bookmarkp-tags-list to bookmarkp-tags-alist. -;; Use bookmarkp-full-tag everywhere for tag completion. -;; *-has-tag-p: Use assoc-default, not member. -;; *-read-tag(s)-completing: CANDIDATE-TAGS is now an alist. -;; *-list-all-tags: Added optional arg FULLP (prefix arg). -;; *-tags-list: Added optional arg NAMES-ONLY-P. -;; *-(add|remove|rename)-tags: Use copy-alist, not copy-sequence. Alist, not list, membership. -;; *-rename-tag: Raise error if no tag with old name. -;; *-bmenu-mark-bookmarks-tagged-regexp, *-regexp-filtered-tags-alist-only, *-describe-bookmark, -;; *-(all|some)-tags-regexp-jump(-other-window): -;; Use bookmarkp-tag-name. -;; *-bmenu-mark/unmark-bookmarks-tagged-(all|some)/(none|not-all), *-define-tags-sort-command: -;; Use assoc-default, not member. -;; Added: bookmarkp-bmenu-add-tags, bookmarkp-bmenu-remove(-all)-tags. -;; *-bmenu-mouse-3-menu: Use bookmarkp-bmenu-add-tags, bookmarkp-bmenu-remove(-all)-tags. -;; Added bookmarkp-bmenu-set-tag-value. -;; *-bmenu-mark-bookmarks-satisfying: Made it a command (interactive). -;; 2010/02/07 dadams -;; *-write-file: Corrected handling of ALT-MSG. -;; Cleanup. -;; *-remove-tags: Don't call *-get-tags twice. -;; *-bmenu-(un)mark-bookmarks-tagged(-not)-(all|none|some): -;; Don't duplicate what bookmarkp-read-tags-completing does. -;; *-add-tags, *-remove-tags(-from-all): TAGS arg must be a list from the beginning. -;; *-remove-tags-from-all, *-rename-tag: Use bookmark-all-names - don't mapcar car over alist. -;; *-all-tags-regexp-jump: Corrected to use same pred as *-all-tags-regexp-jump-other-window. -;; *-(some|all)-tags-jump(-other-window): Use bookmarkp-has-tag-p - don't repeat the definition. -;; *-read-tag(s)-completing: Removed unnecessary or. -;; 2010/02/06 dadams -;; *-write-file, *-empty-file: Corrected handling of ALT-MSG. -;; 2010/02/05 dadams -;; Added: bookmarkp-same-file-p, bookmarkp-empty-file. -;; Bound bookmarkp-empty-file to C-x p 0, and added it to menus. -;; *-bmenu-list, *-switch-bookmark-file: Use bookmarkp-same-file-p. -;; bookmark-write-file: Added optional ALT-MSG arg. -;; 2010/02/04 dadams -;; Added: bookmarkp-bmenu-omit, bookmarkp-list-all-tags. Added to mouse-3 menu, Tags menus. -;; 2010/02/01 dadams -;; Added: bookmarkp-current-bookmark-file, bookmarkp-switch-bookmark-file, -;; (redefinition of) bookmark-load, (redefinition of) bookmark-save, -;; bookmarkp-toggle-saving-bookmark-file, bookmarkp-last-save-flag-value. -;; *-bmenu-list: Restore bookmarkp-current-bookmark-file if appropriate. -;; *-bmenu-mode-status-help: Show bookmarkp-current-bookmark-file. -;; *-bmenu-define-full-snapshot-command, *-save-menu-list-state: -;; Save bookmarkp-current-bookmark-file. -;; Bound bookmarkp-switch-bookmark-file to L and C-x r L. Added both load commands to both menus. -;; *-toggle-saving-menu-list-state: Changed binding to M-l. Error if init value is nil. -;; Bound *-toggle-saving-bookmark-file to M-s and added to menu. -;; Added bookmark-write to bookmarkp-bmenu-menubar-menu (Save As). -;; bookmarkp-bmenu-menubar-menu: Added :help strings everywhere. -;; bookmarkp-bmenu-mode-status-help: Added face legend. -;; 2010/01/31 dadams -;; Added: bookmarkp-tags-list, bookmarkp-read-tag-completing, bookmarkp-use-w32-browser-p, -;; bookmarkp-bmenu-w32-open(-select|-with-mouse). Bind *-w32* to M-RET, V, M-mouse-2. -;; *-default-handler: Call w32-browser if bookmarkp-use-w32-browser-p. -;; *-bmenu-unomit-marked: Don't try to return to original position (duh). -;; *-bmenu-goto-bookmark-named: Use eobp as loop condition. Call bookmark-bmenu-ensure-position. -;; *-read-tags-completing: -;; Added arg UPDATE-TAGS-LIST-P. Call bookmark-maybe-load-default-file. -;; Use bookmarkp-tags-list if CANDIDATE-TAGS is nil. Update that var if UPDATE-TAGS-LIST-P. -;; *-(add|remove)-tags: Added arg NO-CACHE-UPDATE-P. If nil, call bookmarkp-tags-list. -;; *-remove-tags-from-all, *-rename-tag, *-bmenu-(add|remove)-tags-(to|from)-marked: -;; Call bookmarkp-tags-list. -;; *-remove-tags-from-all: Pass nil as tags arg to bookmarkp-read-tags-completing. -;; *-rename-tag: Use bookmarkp-read-tag-completing, not read-string. -;; 2010/01/29 dadams -;; bookmarkp-describe-bookmark: Handle desktop bookmarks specifically. -;; Added: bookmarkp-menu-popup-max-length. -;; bookmark-completing-read: Use bookmarkp-menu-popup-max-length. -;; bookmarkp-bmenu-state-file: Added missing default value for const. -;; Don't add jump-other entry to menu-bar-bookmark-map (just use Jump To submenu). -;; 2010/01/28 dadams -;; bookmarkp-(all|some)-tags(-regexp)-jump(-other-window): Error if no bookmarks with the tags. -;; bookmarkp-(all|some)-tags-jump(-other-window): Handle case where user enters no tags. -;; Use :advertised-binding property for bookmark-jump(-other-window). -;; Added: bookmarkp-bmenu-jump-menu. -;; Added bookmarkp-bmenu-jump-menu to menu-bar-bookmark-map and bookmarkp-bmenu-menubar-menu. -;; 2010/01/27 dadams -;; Added: bookmarkp-every, bookmarkp-(all|some)-tags(-regexp)-jump(-other-window). -;; 2010/01/26 dadams -;; Added: bookmarkp-bmenu-dired-marked-local. Bound to M-d >. -;; 2010/01/23 dadams -;; Added: bookmarkp-handler-cp, bookmarkp-desktop-no-save-vars, bookmarkp-set-desktop-bookmark, -;; bookmarkp-make-desktop-record, bookmarkp-jump-desktop, bookmarkp-desktop-read, -;; bookmarkp-desktop-alist-only, bookmarkp-desktop-bookmark-p, -;; bookmarkp-bmenu-mark-desktop-bookmarks, bookmarkp-bmenu-show-only-desktops, -;; face bookmarkp-desktop. -;; bookmarkp-bmenu-sort-by-bookmark-type: Add bookmarkp-handler-cp to the list (last). -;; bookmarkp-bmenu-propertize-item: Add face bookmarkp-desktop for desktop bookmarks. -;; Bound: bookmarkp-set-desktop-bookmark to C-x p K, C-x r K, -;; bookmarkp-bmenu-mark-desktop-bookmarks to K M (and Mark menu), -;; bookmarkp-bmenu-show-only-desktops to K S (and Show menu). -;; bookmark-bmenu-mode doc string: Updated for new commands. -;; Added autoload cookies for all defcustoms. -;; 2010/01/20 dadams -;; Added: bookmarkp-bmenu-mode-status-help. Bound to C-h m, ?. -;; 2010/01/19 dadams -;; bookmarkp-remote-file-bookmark-p: Include remote Dired bookmarks. Thx to Simon Harrison. -;; Added: bookmarkp-describe-bookmark-internals, bookmarkp-bmenu-describe-this+move-(down|up), -;; defalias for list-bookmarks. -;; bookmarkp-describe-bookmark: Reformatted help output. Added more info about Dired bookmarks. -;; bookmarkp-bmenu-describe-this-bookmark: -;; C-u calls bookmarkp-describe-bookmark-internals. Bound also to C-h C-RET. -;; 2010/01/18 dadams -;; Added: bookmarkp-dired-subdirs. -;; bookmarkp-make-dired-record, bookmarkp-jump-dired: Handle inserted and hidden dirs. -;; bookmarkp-jump-dired: Use expand-file-name, not concat. -;; 2010/01/17 dadams -;; Added: -;; bookmarkp-jump(-other-window)-map, bookmarkp-jump-1, bookmark-all-names (redefined), -;; bookmarkp-read-bookmark-for-type, bookmarkp-dired-jump-current(-other-window), -;; bookmarkp-(dired|(local-|remote-|non-)file|gnus|info|man|region|w3m)-jump(-other-window), -;; bookmarkp-jump-to-type(-other-window). -;; bookmark-jump(-other-window): Use bookmarkp-jump-1. -;; bookmark-completing-read: Added optional args ALIST and PRED. -;; bookmarkp-default-bookmark-name: Added optional arg ALIST. -;; 2010/01/14 dadams -;; bookmark-bmenu-surreptitiously-rebuild-list: Put back save-excursion & save-window-excursion. -;; 2010/01/02 dadams -;; Renamed *-bmenu-check-position to *-bmenu-ensure-position, per Emacs 23.2. Added defalias. -;; 2010/01/01 dadams -;; *-bmenu-(un)mark, *-bmenu-other-window, *-bmenu-rename: Call bookmark-bmenu-check-position. -;; *-bmenu-delete: Don't call bookmark-bmenu-check-position again at end. -;; *-bmenu-edit-bookmark: Call bookmark-bmenu-check-position at beginning, not end. -;; 2009/12/30 dadams -;; Added: bookmarkp-bmenu-header-lines, bookmarkp-bmenu-marks-width. Use everywhere. -;; 2009/12/29 dadams -;; Added: bookmarkp-make-bookmark-list-record, bookmarkp-jump-bookmark-list, face -;; bookmarkp-bookmark-list. -;; *-bmenu-propertize-item: Highlight bookmark-list bookmarks. -;; *-bmenu-refresh-menu-list: Set bookmarkp-latest-bookmark-alist to refreshed list. -;; Face *-local-directory: Made dark background version the inverse of light. -;; *-bmenu-list-1: Use eq, not equal, test for bookmarkp-omitted-alist-only as filter fn. -;; *-bmenu-define(-full-snapshot)-command: Include bookmarkp-bmenu-omitted-list in saved state. -;; 2009/12/26 dadams -;; Added: bookmarkp-bmenu-omitted-list, bookmarkp-bmenu-show-only-omitted, bookmarkp-unomit-all, -;; bookmarkp-bmenu-omit/unomit-marked, bookmarkp-bmenu-(un-)omit-marked, -;; bookmarkp-omitted-alist-only. -;; Bind *-bmenu-omit/unomit-marked, *-bmenu-show-only-omitted, *-unomit-all to O>,OS,OU. -;; Added omit/un-omit stuff to Bookmark+ menu. -;; bookmarkp-remove-assoc-dups, bookmarkp-sort-and-remove-dups: Added optional arg OMIT. -;; bookmark-delete: Update bookmarkp-bmenu-omitted-list. -;; bookmarkp-save-menu-list-state, bookmark-bmenu-list: -;; Save/restore bookmarkp-bmenu-omitted-list as part of state. -;; bookmark-bmenu-list-1: Treat omitted list when bookmarkp-omitted-alist-only. -;; bookmarkp-marked-bookmark-p: Arg can now be a bookmark (or a bookmark name). -;; bookmarkp-bmenu-unmark-all: Start by going forward 2 lines, not 1, if user hit RET. -;; bookmarkp-bmenu-make-sequence-from-marked: -;; Added optional arg DONT-OMIT-P. If nil, omit marked bookmarks. -;; If the seq bookmark already exists, prompt to add to it or replace it. -;; Go to the new bookmark in the menu list. -;; 2009/12/15 dadams -;; Added: bookmarkp-sequence-jump-display-function, bookmarkp-sequence, bookmarkp-function, -;; bookmarkp-bmenu-make-sequence-from-marked, bookmarkp-jump-sequence, -;; bookmarkp-sequence-bookmark-p, bookmarkp-make-function-bookmark, -;; bookmarkp-jump-function, bookmarkp-function-bookmark-p. -;; bookmarkp-describe-bookmark: Update for sequence and function bookmarks. -;; bookmark-bmenu-list: Use condition-case when read from bookmarkp-bmenu-state-file. -;; Bind emacs-lisp-mode-hook to nil. -;; bookmark-bmenu-surreptitiously-rebuild-list: Use save-current-buffer. -;; bookmarkp-bmenu-propertize-item: Add faces to function and sequence bookmarks. -;; bookmarkp-bmenu-menubar-menu: Add *-make-sequence-*-from-marked, *-make-function-bookmark. -;; bookmark--jump-via: Call *-record-visit with BATCH arg, to preserver point in menu list. -;; bookmark-bmenu-list-1: fit-frame only if buffer is *Bookmark List*. -;; 2009/12/13 dadams -;; *-alist-only: Call bookmark-maybe-load-default-file. -;; 2009/12/11 dadams -;; Added: bookmarkp-list-defuns-in-commands-file, bookmarkp-remove-dups. -;; 2009/12/06 dadams -;; Added: bookmarkp-bmenu-mouse-3-menu (bound to mouse-3), -;; bookmarkp-bmenu-(menubar|define-command|sort|show|tags|mark)-menu. -;; bookmark-bmenu-delete: Remove newly flagged bookmark from bookmarkp-bookmark-marked-list. -;; bookmarkp-define-tags-sort-command: Save macroexpanded definition in -;; bookmarkp-bmenu-commands-file. -;; 2009/12/04 dadams -;; Added: bookmarkp-bmenu-define-full-snapshot-command (bound to C), -;; bookmarkp-define-tags-sort-command. -;; bookmarkp-bmenu-mark-bookmarks-tagged-regexp: Removed extra forward-line if we mark line. -;; 2009/12/03 dadams -;; Added: bookmarkp-bmenu-define-command (bound to c), bookmarkp-bmenu-commands-file. -;; bookmark-bmenu-list: Read bookmarkp-bmenu-commands-file. -;; bookmarkp-sort-and-remove-dups: Bug fix - return the list even when null sort function. -;; 2009/11/01 dadams -;; Added: *-bmenu-check-position (redefinition), bmkext-jump-* defaliases. -;; *-(w3m|man|gnus)-bookmark-p: Recognize the aliases. -;; *-jump-man: Bind Man-notify-method. -;; *-bmenu-goto-bookmark-named: Check the text property, instead of searching. -;; *-bmenu-bookmark: Wrap in condition-case. -;; 2009/10/31 dadams -;; Added: bookmark-bmenu-list-1. bookmarkp-toggle-saving-menu-list-state (C-t), -;; bookmarkp-bmenu-state-file, bookmarkp-bmenu-first-time-p, -;; bookmarkp-last-bmenu-(bookmark|state-file), bookmark-exit-hook-internal -;; (redefinition), bookmarkp-save-menu-list-state. -;; bookmark-bmenu-list: Restore menu-list state if appropriate. Call bookmark-bmenu-list-1. -;; bookmarkp-bmenu-quit: If *-bmenu-state-file is non-nil, save the state. -;; bookmark-write-file: Use case, not cond. -;; bookmark-set: Use command name as default for man-page bookmark name. -;; bookmark-delete: Update bookmarkp-latest-bookmark-alist. -;; 2009/10/28 dadams -;; Renamed: bookmarkp-bookmark-marked-p to bookmarkp-marked-bookmark-p -;; bookmarkp-bmenu-sort-by-gnus-thread to bookmarkp-bmenu-sort-by-Gnus-thread. -;; Added: bookmarkp-man, bookmarkp-make-(wo)man-record, bookmarkp-jump-(wo)man, -;; bookmarkp-man-bookmark-p, bookmarkp-bmenu-mark-man-bookmarks, -;; bookmarkp-bmenu-show-only-man-pages, bookmarkp-man-alist-only. -;; *-bmenu-propertize-item: Handle (wo)man bookmarks. Use bookmarkp-info-bookmark-p. -;; *-regexp-filtered-*: Use bookmarkp-remove-if-not. -;; *-write-file: Remove text properties from file name also. -;; *-regexp-filtered-(tags|(bookmark|file)-name)-alist-only: Use *-remove-if-not. -;; 2009/10/26 dadams -;; Added: bookmarkp-bmenu-mark-*-bookmarks, bmenu-mark-bookmarks-satisfying. -;; Bound those and *-show-only-* accordingly. -;; bookmarkp-file-alist-only: Redefined to just use *-file-bookmark-p. -;; 2009/10/25 dadams -;; bookmarkp-bmenu-propertize-item: Put bookmark name on line as text property. -;; bookmark-bmenu-bookmark: Get bookmark name from text property bookmarkp-bookmark-name. -;; Removed: bookmarkp-latest-sorted-alist. -;; bookmark-bmenu-list: Use bookmarkp-bmenu-title only if defined. -;; 2009/10/21 dadams -;; Added: bookmarkp-barf-if-not-in-menu-list. Use in place of its body. -;; Added: bookmarkp-bmenu-mark-bookmarks-tagged-regexp. Bound to T m %. -;; Added: bookmarkp-record-visit. Use in *--jump-via. Replaces next two removals. -;; Removed: bookmarkp-add-or-update-time, bookmarkp-increment-visits. -;; Renamed: *-record-(end|front|rear)-context(-region)-string'. -;; New names: bookmarkp-(end-)position-(pre|post)-context(-region). -;; *-bmenu-describe-this-bookmark: Added *-barf-if-not-in-menu-list. -;; *-bmenu-(un)mark-all, *-bmenu-regexp-mark, *-bmenu-toggle-marks: -;; Removed with-current-buffer. -;; 2009/10/20 dadams -;; Added: bookmarkp-bmenu-filter-function, bookmarkp-bmenu-title. -;; Removed: bookmarkp-bmenu-called-from-inside-p. -;; *-bmenu-list: -;; Removed TITLE arg. Get title from bookmarkp-bmenu-title or default. -;; Use interactive-p and absence of menu list, not *-bmenu-called-from-inside-p, as the -;; criterion for removing marks. Fixes bugs such as bookmark creation removing marks. -;; *-define-sort-command, *-bmenu-execute-deletions, *-increment-visits, -;; *-add-or-update-time, *-bmenu-show-only-*, *-bmenu-show-all, -;; *-bmenu-refresh-menu-list, *-bmenu-toggle-show-only-(un)marked, -;; *-bmenu-filter-alist-by-regexp, *-bmenu-reverse(-multi-sort)-order, -;; *-bmenu-change-sort-order: -;; Do not bind or set *-called-from-inside-p. -;; *-bmenu-show-only-*, *-bmenu-show-all, *-bmenu-filter-alist-by-regexp: -;; Set *-bmenu-filter-function, *-bmenu-title. -;; *-bmenu-show-all: -;; Set *-latest-bookmark-alist to bookmark-alist. -;; *-bmenu-refresh-menu-list: Fix so that it in fact refreshes. -;; Do not use *-bmenu-surreptitiously-rebuild-list and *-bmenu-check-position. -;; Bind bookmark-alist to last alist (filtered or not), and call *-bmenu-list. -;; *-bmenu-surreptitiously-rebuild-list: -;; Do not use save*-excursion. Do not get current title and pass it to *-bmenu-list. -;; *-file-alist-only: -;; Removed optional arg. We have *-local-file-alist-only for that. -;; *-regexp-filtered-alist-only, *-bmenu-filter-alist-by-regexp: -;; Remove REGEXP arg - use bookmarkp-bmenu-filter-pattern. -;; *-bmenu-filter-incrementally: -;; Raise error if not in *Bookmark List*. -;; Use just bookmarkp-bmenu-filter-alist-by-regexp in timer - pass no regexp arg. -;; Added: bookmarkp-some, *-bmenu-filter-(file-name|tags)-incrementally, -;; *-bmenu-filter-alist-by-(file-name|tags)-regexp, -;; *-regexp-filtered-(file-name|tags)-alist-only. -;; Renamed: *-bmenu-filter-incrementally to *-bmenu-filter-bookmark-name-incrementally, -;; *-bmenu-filter-alist-by-regexp to *-bmenu-filter-alist-by-bookmark-name-regexp, -;; *-regexp-filtered-alist-only to *-regexp-filtered-bookmark-name-alist-only. -;; Bound these commands to P B, P F, and P T. Updated bookmark-bmenu-mode doc string. -;; 2009/10/18 dadams -;; Added: *-bmenu-filter-(incrementally|delay|prompt|pattern|timer|alist-by-regexp), -;; *-bmenu-read-filter-input, *-regexp-filtered-alist-only, -;; *-bmenu-cancel-incremental-filtering. -;; *-bmenu-execute-deletions: Don't update menu list if this is a no-op. -;; Updated Commentary. -;; Thx to Thierry Volpiatto. -;; Added: *-marked-cp, *-bmenu-sort-marked-before-unmarked. Bound to s >. -;; *-define-sort-command: Use copy-sequence for default value. -;; 2009/10/17 dadams -;; Added: *-read-tags-completing, *-set-union, *-tag-history, *-describe-bookmark, -;; *-bmenu-describe-this-bookmark. Bound *-bmenu-describe-this-bookmark to C-h RET. -;; Use *-read-tags-completing instead of *-read-tags. -;; *-sort-orders-for-cycling-alist: Use copy-sequence. -;; *-bmenu-change-sort-order: Use member, not memq. -;; *-get-bookmark: Handle case of non-string, non-cons. Document NOERROR in doc string. -;; *-bmenu-execute-deletions: Fix so marks aren't removed if when delete. Thx to Thierry. -;; Convert recorded time to an Emacs time spec: -;; *-make-record-default, -add-or-update-time: Use current-time, not bookmark-float-time. -;; *-get-visit-time: Convert a deprecated time entry to an Emacs time spec. -;; *-bookmark-last-access-cp: Convert recorded time to a number for comparison. -;; Added: *-bmenu-show-filenames (redef of vanilla: put props on whole line, fit frame). -;; Removed: old-bookmark-insert-location. -;; *-insert-location: Do not call original. Redefined: do not add text properties. -;; *-bmenu-list, *-bmenu-hide-filenames: Put properties on line up to max width. -;; *-bmenu-goto-bookmark-named: Allow trailing whitespace, since we use the whole line now. -;; *-bmenu-list: Use pop-to-buffer, not switch-to-buffer. Use do-list, not mapcar. -;; *-bmenu-hide-filenames: fit-frame-if-one-window. -;; *-bmenu-propertize-item: Better help-echo text. -;; Updated bookmark-alist doc string to mention visits, time, and tags entries. -;; 2009/10/16 dadams -;; Added tags feature. -;; Added: *-(get|read)-tags, *-has-tag-p, *-remove(-all)-tags(-from-all), -;; *-bmenu-remove-tags-from-marked, *-add-tags(-to-marked), *-rename-tag, -;; *-bmenu-(un)mark-bookmarks-tagged-(all|none|some|not-all), -;; *-bmenu-mark/unmark-bookmarks-tagged-(all/none|some/not-all). -;; Bound to prefix key T. -;; *-bmenu-mode: Updated doc string. -;; Added: bookmarkp-default-bookmark-name. Use as default instead of *-current-bookmark. -;; Renamed: *-maybe-save-bookmark to *-maybe-save-bookmarks. -;; Menu-list commands: Raise an error if command is used outside the menu list. -;; 2009/10/15 dadams -;; Added: *-bmenu-(search|query-replace)-marked-bookmarks-regexp. Bound to M-a, M-q. -;; Renamed: *-non-marked-bookmarks-only to *-unmarked-bookmarks-only, -;; *-bookmark-marked-alist to *-bmenu-marked-bookmarks. -;; *-increment-visits, *-add-or-update-time: -;; Set *-bmenu-called-from-inside-p to t, so we don't remove marks. -;; Redefined *-bmenu-bookmark to get name from *-latest-sorted-alist. Thx to Thierry V. -;; *-bmenu-surreptitiously-rebuild-list, *-bmenu-list: -;; Removed optional arg DONT-TOGGLE-FILENAMES-P. -;; *-bmenu-execute-deletions, *-bmenu-toggle-show-only-(un)marked, *-bmenu-(un)mark-all, -;; *-bmenu-regexp-mark, *-bmenu-toggle-marks: -;; Do not bother with *-bmenu-toggle-filenames and rebuilding the menu list. -;; 2009/10/14 dadams -;; Added: *-bmenu-delete (redefinition), *-isearch-bookmarks, -;; *-bmenu-isearch(-marked)-bookmarks(-regexp), *-isearch-next-bookmark-buffer. -;; Bound multi-isearch commands to M-s a C(-M)-s. -;; 2009/10/13 dadams -;; Added: *-make-dired-record, *-jump-dired, *-dired-bookmark-p, *-dired-alist-only, -;; *-bmenu-show-only-dired. Bound *-bmenu-show-only-dired to M-d. -;; bookmarkp-file-bookmark-p: Include bookmarks that have the Dired handler. -;; Moved *-sort-orders-for-cycling-alist defcustoms after *-define-sort-command calls. -;; Call bookmarkp-msg-about-sort-order only when interactive. -;; *-add-or-update-time, *-increment-visits: Do not save each time we access a bookmark. -;; Updated doc string of bookmark-alist and Commentary. -;; 2009/10/09 dadams -;; Added: bookmarkp-bmenu-delete-marked. Bound it to D. -;; bookmarkp-sort-orders-for-cycling-alist. -;; Renamed: bookmarkp-sort-functions-alist to bookmarkp-sort-orders-alist, -;; bookmarkp-sort-function to bookmarkp-sort-comparer. -;; bookmark-bmenu-execute-deletions: Added optional arg, for *-bmenu-delete-marked. -;; *-sort-function: Changed default value to sorting by bookmark type (`s k'). -;; *-bmenu-change-sort-order: Use *-sort-orders-for-cycling-alist, not all sort orders. -;; Updated Commentary and doc string (bookmark-bmenu-mode). -;; 2009/10/08 dadams -;; Added: *-bmenu-sort-by-(w3m-url|gnus-thread), *-(gnus|w3m)-cp, *-cp-not, -;; *-local-file-(accessed|updated)-more-recently-cp, *-bmenu-sort-by-bookmark-type. -;; Renamed: *-bmenu-sort-by(-last)-file-(size|type|access|update) to -;; *-bmenu-sort-by(-last)-local-file-(size|typeaccess|update), -;; *-file-visited-more-recently-cp to *-local-file-accessed-more-recently-cp, -;; *-file-(size|type)-cp to *-local-file-(size|type)-cp. -;; Removed: *-file-(device|gid(-chg)|inode|last-(access|update|status-change)|links|modes -;; |uid)-cp. -;; Bound *-bmenu-sort-by-bookmark-type to `s k'. -;; *-define-file-sort-predicate: Use *-file-bookmark-p, not *-local-file-bookmark-p. -;; *-msg-about-sort-order: Added optional arg PREFIX-ARG. Use in: *-show-(all|only-*). -;; 2009/10/07 dadams -;; Renamed: *-bmenu-sort-by-last-visit-time to *-bmenu-sort-by-last-bookmark-access, -;; *-bmenu-sort-by-visit-frequency to *-bmenu-sort-by-bookmark-visit-frequency, -;; *-visited-more-recently-cp to *-bookmark-last-access-cp. -;; 2009/10/06 dadams -;; Added: bookmarkp-msg-about-sort-order. -;; bookmark-completing-read: Simple sort when use menu-bar menu. -;; 2009/10/05 dadams -;; Added: *-make-plain-predicate, *-reverse-multi-sort-order, *-multi-sort, -;; *-define-file-sort-predicate, *-bmenu-sort-by-file-*, *-file-attribute-*-cp, -;; and aliases *-file-*-cp, *-current-sort-order. -;; Redefined sorting to allow multi-predicates: -;; Redefined: *-sort-function, *-sort-and-remove-dups, *-define-sort-command, -;; *-sort-functions-alist. -;; Bound keys with `s f' prefix to file-sorting commands -;; *-current-sort-order: Use rassoc instead of rassq now. -;; Swap keys s and S. S is now bookmark-bmenu-save. s is not the sorting prefix key. -;; bookmark-bmenu-mode: Mention S key explicitly here (even though it is also -;; mentioned in the vanilla part of the doc string). -;; 2009/10/04 dadams -;; *-bmenu-change-sort-order-repeat: Require repeat.el. -;; Renamed: bookmarkp-current-sec-time to bookmarkp-float-time. -;; *-float-time: Added arg, so it's the same as float-time (for Emacs 20). -;; Bind *-reverse-sort-order to `S R'. -;; *-remote-file-bookmark-p: Removed extra rem-file in last and. -;; *-non-file-bookmark-p: Ensure it's not a remote file, before calling file-exists-p. -;; 2009/10/03 dadams -;; Added: bookmarkp-file-remote-p, bookmarkp-buffer (face). -;; bookmarkp-non-file (face): Changed to gray. -;; *-default-handler, *-bmenu-propertize-item, *-(info|file)-bookmark-p: -;; Support Emacs 20-21 Info-node bookmarks. -;; bookmarkp-bmenu-propertize-item: Use different face for existing buffers. -;; Use bookmarkp-non-file-filename. -;; bookmarkp-non-file-bookmark-p: Include buffer bookmarks for nonexistent buffers. -;; bookmarkp-remote-file-bookmark-p: Use bookmarkp-file-remote-p. -;; bookmark-handle-bookmark: -;; Redefine for all Emacs versions. Handle buffer (non-file) bookmarks. -;; Reordered some function definitions. -;; 2009/10/02 dadams -;; Added: bookmarkp-bmenu-goto-bookmark-named, bookmarkp-latest-sorted-alist. -;; *-sort-and-remove-dups: Set *-latest-sorted-alist (not used yet). -;; *-define-sort-command, *-bmenu-change-sort-order, *-reverse-sort-order: -;; Bind *-bmenu-called-from-inside-p to t, to prevent losing marks. -;; Restore cursor position to same bookmark after sorting - use *-goto-bookmark-named. -;; *-bmenu-surreptitiously-rebuild-list, *-bmenu-list: Added arg DONT-TOGGLE-FILENAMES-P. -;; *-bmenu-execute-deletions, *-bmenu-toggle-show-only-(un)marked: -;; Call *-surreptitiously-* with arg DONT-TOGGLE-FILENAMES-P. -;; *-bmenu-hide-filenames: Simplify - don't get to position by searching backward. -;; *-handle-region-default: Use forward-line, not goto-line. -;; Thx to Thierry V. -;; 2009/10/01 dadams -;; Added: bookmarkp-some-unmarked-p. -;; Renamed: *-bmenu-toggle-show-only- to *-bmenu-show-only-, -;; *-bmenu-called-from-inside-flag to *-bmenu-called-from-inside-p. -;; bookmarkp-some-marked-p: Do not test bookmarkp-bookmark-marked-alist. -;; Arg must be required (explicit). Changed calls accordingly. -;; bookmark-bmenu-mode: Cleaned up doc string. -;; bookmark-bmenu-((un)mark|rename|edit-*|toggle-marks|surreptitiously-rebuild-list), -;; bookmarkp-root-or-sudo-logged-p, bookmarkp-jump-w3m-(new-session|only-one-tab), -;; bookmarkp-some-marked-p: -;; Inline let vars used only once. -;; bookmarkp-bmenu-toggle-show-only-marked: -;; Test bookmarkp-some-unmarked-p, not bookmarkp-some-marked-p, -;; and include *-before-hide-unmarked in the test. -;; bookmarkp-bmenu(-toggle)-show-only-*: Display status message. -;; bookmarkp-bmenu-toggle-show-only-(un)marked: Fit frame. -;; bookmark-prop-set: Fixed, so it handles old bookmark format also. -;; 2009/10/01 Thierry Volpiatto -;; Removed: bookmarkp-bmenu-restore-marks. -;; bookmark-bmenu-list: -;; Do the mark restoration in line, at the same time as the annotation * restoration. -;; Simplify use of START and END. -;; 2009/09/30 dadams -;; bookmarkp-bmenu-regexp-mark: Remove binding of bookmark-alist. -;; bookmark-bmenu-(un)mark, bookmarkp-bmenu-edit-bookmark (remove first call only), -;; bookmark-bmenu-other-window, bookmark-bmenu-rename, bookmarkp-bmenu-restore-marks: -;; Remove bookmark-bmenu-check-position (done by bookmark-bmenu-bookmark anyway). -;; bookmark-insert-location: Fix interactive spec for Emacs < 22. -;; bookmark-location: Return "" instead of raising error, if no location found. -;; bookmarkp-current-sec-time: Move the let: do not call current-time unless we need to. -;; bookmarkp-bmenu-unmark-all: forward-line only 1, not 2. Thx to Thierry. -;; bookmark-bmenu-mode: Updated doc string - bindings and mention options. -;; bookmarkp-bmenu-propertize-item: For buffer, check also against " - no file -". -;; 2009/09/29 dadams -;; bookmark-bmenu-unmark: Use delete, not remove. -;; Removed: bookmark-bmenu-check-position, bookmarkp-maybe-sort. -;; Added: bookmarkp-sort-and-remove-dups, bookmarkp-remove-assoc-dups, -;; bookmarkp-face-prop, bookmarkp-bad-bookmark, bookmark-menu-heading (Emacs 20,21), -;; bookmark-bmenu-bookmark (redefinition). -;; *-bmenu-toggle-show-only-*: Do not call-interactively. -;; bookmarkp-bmenu-(un)mark-all: -;; Handle bookmark-bmenu-toggle-filenames (wrapper). -;; Remove bookmark-bmenu-check-position - just ensure within menu list. -;; bookmarkp-bmenu-mark-all: Move save-excursion so it applies to all movements. -;; Message stating number marked. -;; bookmarkp-bmenu-unmark-all: Use with-current-buffer ensure in menu list. -;; Use bookmark-bmenu-unmark. -;; Fixed U bindings for bookmarkp-bmenu-unmark-all. -;; bookmarkp-bmenu-regexp-mark: -;; Remove bookmark-bmenu-check-position - just ensure in menu list. -;; bookmarkp-bmenu-toggle-marks: Use forward-line 2, to ensure in menu list. -;; Message stating number marked. -;; bookmark-bmenu-list, bookmarkp-bmenu-propertize-item: Use bookmarkp-face-prop. -;; bookmark-bmenu-list: Don't start applying the faces until column 2. -;; Removed key bindings in bookmark-map for *-toggle-show-only-*. -;; Redefined faces, esp. for a light background. -;; Use font-lock-face or face property, depending on Emacs version. -;; -;; 2009-06-09 to 2009-09-27 Thierry Volpiatto and dadams -;; New features, as follows. -;; See also the change log at -;; http://mercurial.intuxication.org/hg/bookmark-icicle-region/. -;; 2090-09-27 Rewrote sorting and unmarking code. (+ Updates to doc, names.) -;; Unmarking is now like Dired & query-replace. -;; Sorting is via one sort function; sort predicates do all the sorting. -;; Can now cycle sort orders with S S S... -;; Sort cmds now cycle among normal, reverse, off. -;; Add: *-define-sort-command (macro), *-assoc-delete-all, *-upcase, -;; *-get-visits-count, *-get-visit-time, *-sort-functions-alist. -;; Remove docstring from defalias (for Emacs 20). -;; 2009-09-26 Fix *-bmenu-mode doc (defadvice). -;; 2009-09-25 *-bmenu-edit, *-bmenu-sort-1: Fix bmk retrieval code. -;; Redefine *-bmenu-unmark. Add: *-bmenu-toggle-marks. -;; Bind *-bmenu-unmark-all-bookmarks to M-DEL. Reorder code. -;; Rename: *-bmenu-unmark-all-(bookmarks|(delete|mark)-flag)', -;; *-bmenu-unmark-all-bookmarks-1. -;; Change sort predicates in defalias. Rename bmk entry visit to visits. -;; Remove: *-bmenu-show-number-of-visit. -;; 2009-09-22 Rewrote sorting code. Renamed unmarking fns. -;; 2009-09-21 Rename mark/unmark cmds to have -bmenu. -;; Add: *-bmenu-called-from-inside-flag - set it in (un)hide marks fns. -;; 2009-09-20 *-write-file: Remove text properties before saving. -;; Remove all marks only in current display. -;; 2009-09-19 *-current-sec-time: Protect with fboundp for Emacs 20. -;; *-bmenu-sort-1: Add msg showing sort method. -;; Change key S-A to S-S (A is annotations). -;; 2009-09-18 Improve sorting by visit frequency. Always increment when jump. -;; Fix increment visit fn. Allow sorting by last visited. -;; When visit values are equal, sort with string-lessp. -;; Add TIME bookmark-alist entry. *-make-record-default: Add time entry. -;; Fix: bad parens, errors in sorting predicate. Rename fns. -;; Use single fn to sort using diff methods. -;; Add: *-bmenu-refresh-alist (bind to g). -;; 2009-09-16 Add: *-toggle-sorting-by-most-visited, *-reset-visit-flag, -;; *-bmenu-show-number-of-visit. -;; Redefine *-prop-set. Improve *-toggle-sorting-by-most-visited. -;; Add auto-doc to header. *-bmenu-mode: Add missing key. -;; Update menu-list after jumping. -;; Increment save counter when jump with visit flag. -;; 2009-09-15 Record number of visits. Added sorting by most visits. -;; 2009-09-14 Add doc string. Update defadvice doc string wrt keys. -;; 2009-09-12 Add: fns to mark all, unmark D or > or all, *-bmenu-reset-alist. -;; Fix keymap (Emacs 20). *-unmark-all-bookmarks1: Move the save-excursion. -;; 2009-09-11 Add: *-bmenu-check-position (redef to improve performance), -;; *-unmark-all-bookmarks, *-current-list-have-marked-p, -;; *-bookmark-marked-p, *-(non-)marked-bookmarks-only. -;; *-bmenu-hide-unmarked: Add toggling. Restore lost fn. -;; Reorder code. Bind cmds in *-bmenu-mode-map. -;; *-bmenu-hide-marked: Do not hide if no marked in current filter. -;; Improve: *-bmenu-hide(-not)-marked-bookmark, (un)hide marked fns. -;; 2009-09-10 Fix *--restore-all-mark, *-bmenu-regexp-mark. -;; *-bmenu-list: Add *-restore-all-mark. -;; *-bmenu-mark: Push marked bmk to marked list. -;; Add: bookmarkp-bookmark-marked-list, *-bmenu-quit. -;; 2009-09-09 *-maybe-sort-alist: Use copy-sequence. -;; So remove fixes for *-rename, *-edit-bookmark. -;; *-yank, *-rename', *-set: Fix yanking. -;; Remove non-file bmks from file-only list. -;; Add: *-bmenu-list-only-non-file-bookmarks, *-maybe-message (Emacs 20), -;; *-bmenu-mark-bookmark-matching-regexp, *-bmenu-hide-marked-bookmark, -;; *-bmenu-hide-not-marked-bookmark, *-bmenu-mark (redefinition). -;; *-write-file: Improve performance. -;; *-non-file-alist-only: Remove unused def. -;; Fix: hide marked/unmarked with toggle-filenames, keymap for Emacs 20. -;; Improve comments, doc strings. -;; *-bmenu-mark-bookmark-matching-regexp: Fix while loop. -;; 2009-09-08 bookmark-store: Remove duplicate setq of *-current-bookmark. -;; 2009-09-07 Reorganize (reorder), add comments, improve doc strings. -;; Change binding of *-bmenu-relocate from R to M-r. -;; 2009-09-06 bookmark-rename: Redefine with new arg BATCH. -;; *-bmenu-rename: Go to new pos, not old. -;; *-edit-bookmark, bookmark-rename: Fix display update for Emacs 20. -;; 2009-09-05 Add: *-edit-bookmark, *-bmenu-edit-bookmark, *-maybe-save-bookmark. -;; 2009-09-04 Require cl. Allow RET in Emacs 20. Add doc string. -;; *-fix-bookmark-alist-and-save: -;; 2009-09-03 Fix *-fix-bookmark-alist-and-save: -;; Use error, not message. Change value for setcdr. -;; Do not use push with non-var (cl). -;; bookmark-delete: -;; Redefine, to fix vanilla bug: increment count even when BATCHP is non-nil. -;; *-non-file-name: Change to - no file -. *-bmenu-list: Add arg FILTER-ON. -;; *-bmenu-execute-deletions: Use delete, not remove. -;; Add: *-replace-regexp-in-string. -;; bookmark-set: Fix *-yank-point for region case. Fix bad parens. -;; 2009-09-02 Add: *-non-file-filename. *-fix-bookmark-alist-and-save: Fix msg. -;; Require cl (gensym). *-at-bol/eol' -> line-*-position (for Emacs 20). -;; Redefine *-bmenu-execute-deletions, -;; *-bmenu-surreptitiously-rebuild-list. -;; Update current filtered display - do not reload & display all bmks. -;; Add redefinitions of *-bmenu-rename', *-yank-word to fix vanilla bugs: -;; *-bmenu-rename: Do not call *-bmenu-list twice. -;; *-yank-word: Do not insert whitespace. -;; Rename *-last-bookmark-alist-in-use to *-latest-bookmark-alist. -;; 2009-09-01 Fix: Loading of new doc for bookmark-alist (add vacuous defvar). -;; *-bmenu-(list|hide-filenames): start -> end, end -> start. -;; Removed extraneous quote mark that caused problems. -;; Save only if condition-case exits OK. -;; 2009-08-31 Fixes: Test for non-file bmk. Filename for Gnus bmks. -;; Compatibility of bookmark-alist with vanilla Emacs. -;; Require info.el and ffap.el when needed. -;; Add: *-line-number-at-pos (for Emacs 20), -;; *-bmenu-other-window (redefinition). -;; Rename *-propertize-bookmark-list to *-propertize-bmenu-item. -;; 2009-08-30 Fix: Increment *-alist-modification-count when relocate region, -;; and maybe save. -;; Move code adding properties to bookmarks out of *-bmenu-list. -;; mapc -> mapcar. *-bmenu-hide-filenames: Redefine. -;; 2009-08-29 Remove refresh code. -;; 2009-08-27 Added: *-local-directory-bookmark-p, *-local-file-alist-only, -;; *-non-file-alist-only. -;; *-file-bookmark-p: Redefined to exclude bmks with handlers. -;; Renamed fns and faces. -;; 2009-08-25 Fit frame after display menu list. -;; Refresh list when toggle filename visibility. -;; 2009-08-24 Fix: *-bmenu-list for remote files, bookmark-set, *-remote-file-bookmark-p. -;; Ensure arg to file-remote-p is not nil. -;; Recenter region only if it is visible. -;; 2009-08-23 Remove old *-location. *-bmenu-list: Add isw3m. -;; bookmark-set: -;; Redefine for older Emacs. Use a default prompt for gnus, w3m. -;; Use *-name-length-max for title when region is active. -;; Ensure bookmark is on one line. -;; 2009-08-22 Try to handle tramp ftp files. -;; Do not fail if bookmark has empty filename entry. -;; Show region end pos using exchange-point-and-mark. -;; 2009-08-21 Remove all cl stuff (list*, loop, etc.). Add *-remove-if(-not). -;; Remove compile-time require of cl. -;; Add predicates *-(region|gnus|w3m|info|(remote-|local-)file)-bookmark-p. -;; Redefine alist-only functions to optimize and use new preds. -;; 2009-08-20 *--jump-via: Fix to show relocated region before ask whether to save. -;; *-relocate-region: Fix ar-str. Rename a var. Add: *-region-activated-p. -;; Revert chgs. -;; 2009-08-19 Update/fix commentary: bookmark-alist, linkd. -;; *-default-handler, *-handle-region-default: -;; Get bmk record from name only once. -;; *-save-new-region-location: Move t inside progn. -;; 2009-08-16 Use prefix bookmarkp where appropriate. -;; 2009-08-15 Improve comments, doc strings. Rename fns, vars. -;; Add :group with prefix bookmarkp. -;; 2009-08-09 Fix doc strings. -;; 2009-08-08 bookmark-set: Update doc string. Show keys in C-h m. -;; 2009-08-07 *-jump: Fix to jump in same window (thx to Henry Atting). -;; *-at-bol/eol' -> line-*-position. -;; 2009-08-01 bookmark-store: Fix for Emacs 20. -;; 2009-07-27 Ensure we start on an empty w3m buffer. Add: *-w3m-allow-multi-tabs. -;; 2009-07-24 *-bmenu-mode-map: Define some new keys. -;; 2009-07-23 *-bmenu-list: Add path to file in help-echo. -;; 2009-07-19 Fix title underline. Highlight bookmark if root logged with tramp. -;; Add face for sudo. -;; 2009-07-18 Add: filter functions, option for bookmark-bmenu-list. -;; Remove toggle region. -;; *-bmenu-list-only-files-entries: Add prefix arg to show remote. -;; 2009-07-14 Add a forgotten test. -;; 2009-07-13 Fix errors. Give pos in msg even if no search. -;; *-from-bob/eob: Fixed like old strict. -;; Remove *-relocate-region-(method|from-limits). -;; Remove unused code in record fns. Add: *-relocate-region-function. -;; 2009-07-12 Do not pass args to relocation routines. Remove use of flet. -;; Use skip-chars-*ward. Use forward-line, not beginning-of-line. -;; Remove save-excursion around message. Correct typo f(ree var BMK). -;; 2009-07-11 Fix *-relocate-region-strict. Rename fns, adjust defcustom. -;; Save relocated region after pushing mark. Add comments. -;; 2009-07-10 New retrieve fn. Add looking-* fns. -;; 2009-07-08 Simplify record fns. Add doc strings. Add: *-save-relocated-position. -;; Fix: updating when relocate (wrt new record fns), string closing, -;; free vars, parens, names. -;; 2009-07-06 Fix: *-bmenu-list wrt windows, Info colors. -;; 2009-07-04 Rename fns to record, vars, args of retrieve fns. Big changes, fixes. -;; 2009-07-01 Fix comments. *-retrieve-region-strict: improve when out of context. -;; 2009-06-30 Fix: free vars, *-retrieve-region, provide (name). -;; 2009-06-29 Fix: w3m handler, file name for non-file, *-simple-retrieve-position. -;; Add: *-retrieve-region-strict. -;; 2009-06-28 Add: *-retrieve-region-method-is, *-retrieve-region-lax, -;; fns to retrieve regions. -;; Use buffer again, not buffer-name. -;; 2009-06-27 Fix wrong-type error no such file. Renamed faces. Add: *-prop-set. -;; Load gnus at compile time. Protect tramp-file-name-regexp with boundp. -;; 2009-06-25 Fixes for older Emacs compatibility. -;; 2009-06-24 Improve *-default-handler. -;; Add: *-always-save-relocated-position, *-prop-get. -;; 2009-06-23 Use search-regexp, not re-search-regexp. Add Gnus bmks. Add doc. -;; Fix *-bmenu-list. -;; 2009-06-21 Fix: *-default-handler for Info. Improve doc strings, commentary. -;; Fixes to be compatible with Emacs 20-22. -;; Use defcustom for *-list-only-regions-flag. -;; *jump: Put prefix arg in interactive spec. Use buffer-name, not buffer. -;; Remove require of Tramp and inline Tramp fns. -;; Remove tests for display-(color|mouse)-p. -;; w3m-bookmark-(jump|make-record): require w3m. -;; 2009-06-20 Update context strings when relocate. -;; Fix: bookmark-get-*: search from point-min. -;; 2009-06-19 Fix: *-make-record-default, *-toggle-use-only-regions, *-default-handler, -;; bookmarking Dired. -;; Handle 4 positions in *-default-handler. -;; 2009-06-17 Fix: case where some bookmarked text was removed, *-use-region. -;; 2009-06-15 Fix *-region-alist-only, *-get-buffername, *-location, -;; non-file (buffer) bookmarks. -;; Support w3m similar to Info. -;; 2009-06-14 Fix bookmark+version, region relocation. Info support. Error handling. -;; 2009-06-13 Fix: *-list-only-regions, *-region-handler, *-make-record, keymap, faces. -;; Put region & info handling in *-default-handler, not separate handlers. -;; Merge *-make-record-region to *-make-record-default. -;; *-jump now negates *-use-region if prefix arg. Raise error if bad bmk. -;; 2009-06-12 Add: *-get-endposition, *-region-alist-only-names. -;; Add filter to show only region bookmarks. -;; Faces for menu list. Change region color. -;; 2009-06-11 Add: *-region-search-size, *-get-buffername, *-use-region. -;; Redefine *-handle-bookmark, *-jump, to fit bookmark-use-region. -;; Add condtions to bookmark-make-record. Support w3m. Support t command. -;; 2009-06-10 Fix search regexp. Fix region in Info. Save bookmark if region moves. -;; 2009-06-09 Added: bookmark-make-record(-region), bookmark-region-handler. -;; Relocation. -;; 2009/05/25 dadams -;; Added redefinition of bookmark-get-bookmark-record. -;; 2008/10/16 dadams -;; bookmark-jump-other-window: Don't define it for Emacs 23+ (not needed). -;; 2008/04/04 dadams -;; bookmark-jump-other-window: Updated wrt Emacs 22.2. -;; 2007/10/07 dadams -;; Added: bookmark-completing-read, bookmark-delete, bookmark-insert(-location), -;; bookmark-jump, bookmark-relocate, bookmark-rename. -;; bookmark-jump-other-window: Use new bookmark-completing-read. -;; 2007/07/13 dadams -;; Replaced Emacs version tests to reflect Emacs 22 release. -;; 2006/03/08 dadams -;; bookmark-jump-other-window: Handle nil arg. -;; 2005/05/17 dadams -;; Updated to work with Emacs 22.x. -;; 2004/11/20 dadams -;; Refined to deal with Emacs 21 < 21.3.50 (soon to be 22.x) -;; 2004/10/26 dadams -;; Different menu-bar command, depending on Emacs version. -;; 2004/09/21 dadams -;; Only define bookmark-menu-jump-other-window if < Emacs 22. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 3, or -;; (at your option) any later version. -;; -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; see the file COPYING. If not, write to -;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth -;; Floor, Boston, MA 02110-1301, USA. -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Code: - -;; You need not load this file. It contains only documentation. - -(provide 'bookmark+-chg) ; Not used. - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; bookmark+-chg.el ends here - diff --git a/.emacs.d/elisp/icicle/bookmark+-doc.el b/.emacs.d/elisp/icicle/bookmark+-doc.el deleted file mode 100644 index 66811ae..0000000 --- a/.emacs.d/elisp/icicle/bookmark+-doc.el +++ /dev/null @@ -1,3345 +0,0 @@ -;;; bookmark+-doc.el - Documentation for package Bookmark+. -;; -;; Filename: bookmark+-doc.el -;; Description: Documentation for package Bookmark+ -;; Author: Drew Adams -;; Maintainer: Drew Adams (concat "drew.adams" "@" "oracle" ".com") -;; Copyright (C) 2000-2012, Drew Adams, all rights reserved. -;; Created: Fri Sep 15 07:58:41 2000 -;; Last-Updated: Tue May 1 08:58:36 2012 (-0700) -;; By: dradams -;; Update #: 14564 -;; URL: http://www.emacswiki.org/cgi-bin/wiki/bookmark+-doc.el -;; Keywords: bookmarks, bookmark+, placeholders, annotations, search, -;; info, url, w3m, gnus -;; Compatibility: GNU Emacs: 20.x, 21.x, 22.x, 23.x -;; -;; Features that might be required by this library: -;; -;; None -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;;; Commentary: -;; -;; Documentation for the Bookmark+ package, which provides -;; extensions to standard library `bookmark.el'. -;; -;; The Bookmark+ libraries are these: -;; -;; `bookmark+.el' - main (driver) library -;; `bookmark+-mac.el' - Lisp macros -;; `bookmark+-lit.el' - (optional) code for highlighting bookmarks -;; `bookmark+-bmu.el' - code for the `*Bookmark List*' (bmenu) -;; `bookmark+-1.el' - other required code (non-bmenu) -;; `bookmark+-key.el' - key and menu bindings -;; -;; `bookmark+-doc.el' - documentation (comment-only - this file) -;; `bookmark+-chg.el' - change log (comment-only file) -;; -;; The documentation includes how to byte-compile and install -;; Bookmark+. It is also available in these ways: -;; -;; 1. From the bookmark list (`C-x p e' or `C-x r l'): -;; Use `?' to show the current bookmark-list status and general -;; help, then click link `Doc in Commentary' or link `Doc on the -;; Web'. -;; -;; 2. From the Emacs-Wiki Web site: -;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus. -;; -;; 3. From the Bookmark+ group customization buffer: -;; `M-x customize-group bookmark-plus', then click link -;; `Commentary'. -;; -;; (The commentary links in #1 and #3 work only if put you this -;; library, `bookmark+-doc.el', in your `load-path'.) -;; -;; More description below. -;; -;; -;; ****** NOTE ****** -;; -;; On 2010-06-18, I changed the prefix used by package Bookmark+ -;; from `bookmarkp-' to `bmkp-'. THIS IS AN INCOMPATIBLE CHANGE. -;; I apologize for the inconvenience, but the new prefix is -;; preferable for a number of reasons, including easier -;; distinction from standard `bookmark.el' names. -;; -;; This change means that YOU MUST MANUALLY REPLACE ALL -;; OCCURRENCES of `bookmarkp-' by `bmkp-' in the following -;; places, if you used Bookmark+ prior to this change: -;; -;; 1. In your init file (`~/.emacs') or your `custom-file', if -;; you have one. This is needed if you customized any -;; Bookmark+ features. -;; -;; 2. In your default bookmark file, `bookmark-default-file' -;; (`.emacs.bmk'), and in any other bookmark files you might -;; have. -;; -;; 3. In your `*Bookmark List*' state file, -;; `bmkp-bmenu-state-file' (`~/.emacs-bmk-bmenu-state.el'). -;; -;; 4. In your `*Bookmark List*' commands file, -;; `bmkp-bmenu-commands-file' (`~/.emacs-bmk-bmenu-commands.el'), -;; if you have one. -;; -;; You can do this editing in a virgin Emacs session (`emacs -;; -Q'), that is, without loading Bookmark+. -;; -;; Alternatively, you can do this editing in an Emacs session -;; where Bookmark+ has been loaded, but in that case you must -;; TURN OFF AUTOMATIC SAVING of both your default bookmark file -;; and your `*Bookmark List*' state file. Otherwise, when you -;; quit Emacs your manually edits will be overwritten. -;; -;; To turn off this automatic saving, you can use `M-~' and -;; `C-M-~' in buffer `*Bookmark List*' (commands -;; `bmkp-toggle-saving-bookmark-file' and -;; `bmkp-toggle-saving-menu-list-state' - they are also in the -;; `Bookmark+' menu). -;; -;; -;; Again, sorry for this inconvenience. - -;;(@> "Index") -;; -;; Index -;; ----- -;; -;; If you have library `linkd.el' and Emacs 22 or later, load -;; `linkd.el' and turn on `linkd-mode' now. It lets you easily -;; navigate around the sections of this doc. Linkd mode will -;; highlight this Index, as well as the cross-references and section -;; headings throughout this file. You can get `linkd.el' here: -;; http://dto.freeshell.org/notebook/Linkd.html. -;; -;; (@> "Documentation") -;; (@> "Installing Bookmark+") -;; (@> "Bookmark+ Features") -;; (@> "Bookmark Basics") -;; (@> "Different Types of Jump Commands") -;; (@> "Bookmark Tags") -;; (@> "Bookmark Tags Can Have Values") -;; (@> "Function, Sequence, and Variable-List Bookmarks") -;; (@> "Editing Bookmarks") -;; (@> "Bookmark Records: What A Bookmark Looks Like") -;; (@> "Bookmark-List Views - Saving and Restoring State") -;; (@> "Quitting Saves the Bookmark-List State") -;; (@> "State-Restoring Commands and Bookmarks") -;; (@> "Bookmarking without Visiting the Target") -;; (@> "Bookmarking a File or a URL") -;; (@> "Bookmarking the Marked Files in Dired") -;; (@> "Bookmarking Compilation, Grep, and Occur Hits") -;; (@> "Bookmarking Files That You Cannot Visit with Emacs") -;; (@> "Opening Bookmarks Using Windows File Associations") -;; (@> "Autofile Bookmarks") -;; (@> "A Type-Aware `find-file'") -;; (@> "Tagging Files") -;; (@> "Using Multiple Bookmark Files") -;; (@> "Bookmark-File Bookmarks") -;; (@> "The Bookmark List Display") -;; (@> "Tag Commands and Keys") -;; (@> "Tags: Sets of Bookmarks") -;; (@> "Open Dired for the Marked File Bookmarks") -;; (@> "Marking and Unmarking Bookmarks") -;; (@> "Filtering Bookmarks (Hiding and Showing)") -;; (@> "Only Visible Bookmarks Are Affected") -;; (@> "Omitting Bookmarks from Display") -;; (@> "Sorting Bookmarks") -;; (@> "Bookmarks for Specific Files or Buffers") -;; (@> "Cycling, Navigation List") -;; (@> "The Bookmark Navigation List") -;; (@> "Cycling the Navigation List") -;; (@> "Cycling Dynamic Sets of Bookmarks") -;; (@> "Cycling in the Current File/Buffer") -;; (@> "Autonamed Bookmarks - Easy Come Easy Go") -;; (@> "Temporary Bookmarks") -;; (@> "Temporary Bookmarking Mode") -;; (@> "Making Bookmarks Temporary") -;; (@> "Automatic Bookmarking") -;; (@> "Highlighting Bookmark Locations") -;; (@> "Defining How to Highlight") -;; (@> "Highlighting On Demand") -;; (@> "Highlighting Automatically") -;; (@> "Using Highlighted Bookmarks") -;; (@> "Use Bookmark+ with Icicles") -;; (@> "If you use Emacs 20 and Also a More Recent Version") -;; (@> "Bookmark Compatibility with Vanilla Emacs (`bookmark.el')") -;; (@> "New Bookmark Structure") - -;;(@* "Documentation") -;; -;; Documentation -;; ------------- -;; -;;(@* "Installing Bookmark+") -;; ** Installing Bookmark+ ** -;; -;; The main Bookmark+ library is `bookmark+.el'. The other required -;; libraries are `bookmark+-mac.el', `bookmark+-bmu.el', -;; `bookmark+-1.el', and `bookmark+-key.el'. If you want to be able -;; to highlight bookmarks then you will also need library -;; `bookmark+-lit.el'. I recommend that you byte-compile all of the -;; libraries, after loading the source files (in particular, load -;; `bookmark+-mac.el'). -;; -;; Put the directory of these libraries in your `load-path' and add -;; this to your init file (~/.emacs): -;; -;; (require 'bookmark+) -;; -;; That will load all of the Bookmark+ libraries. If you do not care -;; about bookmark highlighting then simply do not put -;; `bookmark+-lit.el' in your `load-path'. -;; -;; By default (see option `bmkp-crosshairs-flag'), when you visit a -;; bookmark that has no region it is highlighted temporarily using -;; crosshairs, for easy recognition. (This temporary highlighting is -;; independent of the highlighting provided by `bookmark+-lit.el'.) -;; -;; For this optional crosshairs feature you also need library -;; `crosshairs.el', which in turn requires libraries `col-highlight', -;; `hl-line', `hl-line+', and `vline'. Library `hl-line' comes with -;; vanilla Emacs. The others are available from the Emacs Wiki web -;; site: http://www.emacswiki.org/. You also need Emacs 22 or later -;; for this feature. - -;;(@* "Bookmark+ Features") -;; ** Bookmark+ Features ** -;; -;; Here is an overview of some of the features that Bookmark+ -;; provides. Some of these are detailed in other sections, below. -;; -;; * Richer bookmarks. They record more. They are more accurate. -;; -;; - You can tag bookmarks, a la del.icio.us. In effect, tags -;; define bookmark sets. A bookmark can have any number of -;; tags, and multiple bookmarks can have the same tag. You can -;; sort, show/hide, or mark bookmarks based on their tags. -;; -;; - Bookmark+ tags can be more than just names. They can be -;; full-fledged user-defined attributes, with Emacs-Lisp objects -;; as their values. -;; -;; - You can have multiple bookmarks with the same name. This is -;; particularly useful for autofile bookmarks, which are -;; bookmarks that have the same name as their target files. -;; They give you the effect of using files themselves as -;; bookmarks. In particular, they let you, in effect, tag -;; files. See (@> "Autofile Bookmarks") and -;; (@> "Tagging Files"). -;; -;; (In vanilla Emacs you can also, in theory, have multiple -;; bookmarks with the same name. But you cannot really use them -;; in any practical way. Vanilla Emacs cannot distinguish among -;; them: the most recent one shadows all others with the same -;; name.) -;; -;; - Bookmarks record the number of times you have visited them -;; and the time of the last visit. You can sort, show/hide, or -;; mark bookmarks based on this info. -;; -;; - You can combine bookmarks, to make composite, or sequence, -;; bookmarks. Invoking a sequence bookmark invokes each of its -;; component bookmarks in turn. A component bookmark can itself -;; be a sequence bookmark. -;; -;; - You can bookmark a region of text, not just a position. When -;; you jump to a bookmark that records a region, the region is -;; activated (see option `bmkp-use-region'). (Region activation -;; is not supported for Gnus bookmarks.) -;; -;; - Bookmarks are relocated better than for vanilla Emacs when -;; the contextual text changes. -;; -;; * Additional types of bookmarks. -;; -;; - Autofile bookmarks. You can bookmark a file without visiting -;; it or naming the bookmark. The bookmark name is the same as -;; the file name (non-directory part). You can have multiple -;; such bookmarks with the same name, to bookmark files with the -;; same name but in different directories. -;; -;; - Dired bookmarks. You can bookmark a Dired buffer, recording -;; and restoring its `ls' switches, which files are marked, -;; which subdirectories are inserted, and which (sub)directories -;; are hidden. -;; -;; - Bookmark-list bookmarks. You can bookmark the current state -;; of buffer `*Bookmark List*' - a list of bookmarks. Jumping -;; to such a bookmark restores the recorded sort order, -;; markings, filter, title, and omit list. -;; See (@> "Omitting Bookmarks from Display"). -;; -;; - Bookmark-file bookmarks. You can bookmark a bookmark file. -;; Jumping to such a bookmark loads the bookmarks in the file. -;; See (@> "Bookmark-File Bookmarks"). -;; -;; - Desktop bookmarks. You can bookmark the current Emacs -;; desktop, as defined by library `desktop.el' - use command -;; `bmkp-set-desktop-bookmark' (`C-x p K'). You can "jump" to -;; (that is, restore) a saved desktop. A desktop includes: -;; -;; - Some global variables. To exclude variables normally -;; saved, see option `bmkp-desktop-no-save-vars'. -;; - The current set of buffers and their associated files. -;; For each: its mode, point, mark, & some local variables. -;; -;; - Gnus bookmarks. You can bookmark a Gnus article, a URL, a -;; PDF file (DocView), a UNIX manual page (from the output of -;; Emacs command `man' or `woman'), an image, or a piece of -;; music. -;; -;; - Non-file (buffer) bookmarks. You can bookmark a buffer that -;; is not associated with a file. -;; -;; - Function bookmarks. A bookmark can represent a Lisp -;; function, which is invoked when you "jump" to the bookmark. -;; -;; - Sequence (composite) bookmarks. A bookmark can represent a -;; sequence of other bookmarks. -;; -;; - Lisp variable bookmarks. A bookmark can represent a set of -;; variables and their values. -;; -;; In particular, note that you can use the following kinds of -;; bookmarks to quickly switch among different projects (sets of -;; bookmarks): Dired, bookmark-list, bookmark-file, and desktop -;; bookmarks. -;; -;; * Additional ways to bookmark. -;; -;; - You can bookmark the file or URL named at point (or any other -;; file or URL), without first visiting it. -;; -;; - You can bookmark the targets of the hits in a compilation -;; buffer or an `occur' buffer, without first visiting them. -;; -;; - You can bookmark all of the marked files in Dired at once. -;; -;; * Extensive menus. -;; -;; - In the `*Bookmark List*' display, a `mouse-3' popup menu has -;; actions for the individual bookmark that you point to when -;; you click the mouse. -;; -;; - In the `*Bookmark List*' display, a complete menu-bar menu, -;; `Bookmark+', is available. The same menu is available on -;; `C-mouse-3'. It has submenus `Jump To', `Mark', `Omit', -;; `Show', `Sort', `Tags', `Highlight' (needs library -;; `bookmark+-lit.el), and `Define Command'. -;; -;; - The vanilla `Bookmarks' menu, which is typically a submenu of -;; the menu-bar `Edit' menu, is modified by adding several items -;; from the `Bookmark+' menu, including submenus `Jump To', -;; `Tags', and `Highlight'. -;; -;; * Improvements for the bookmark-list display. -;; -;; This is buffer `*Bookmark List*', aka the bookmark "menu list" -;; (a misnomer), which you display using `C-x p e' (or `C-x r l'). -;; See (@> "The Bookmark List Display"). -;; -;; - The last display state is saved (by default), and is restored -;; the next time you show the list. (Tip: Use the bookmark list -;; as your "Home" page at Emacs startup.) -;; -;; - You can save the current bookmark-list state at any time and -;; return to it later. There are a few ways to do this, -;; including bookmarking the list itself. -;; See (@> "Bookmark-List Views - Saving and Restoring State"). -;; -;; - Marking/unmarking is enhanced. It is similar to Dired's. -;; -;; - You can easily mark or show different classes of bookmarks. -;; -;; - Faces distinguish bookmarks by type. -;; -;; - You can sort bookmarks in many ways. You can easily define -;; your own sort orders, even complex ones. -;; -;; - You can regexp-search (`M-a') or query-replace (`M-q') the -;; targets (destination file or buffers) of the marked -;; bookmarks, in the current bookmark-list sort order. For -;; Emacs 23 and later, you can even search incrementally (`M-s a -;; C-s', or `M-s a C-M-s' for regexp). -;; -;; - You can use `M-d >' to open Dired for just the local file -;; bookmarks that are marked (`>'). -;; -;; - If you use Emacs on Microsoft Windows, you can open bookmarks -;; according to Windows file associations. (You will also need -;; library `w32-browser.el'.) -;; -;; - You can use (lax) completion when you set a bookmark using -;; `bookmark-set' (`C-x r m'), choosing from existing bookmarks -;; for the same buffer. This makes it easy to update a nearby -;; bookmark (e.g. relocate it). With a numeric prefix argument -;; (or if there are no bookmarks for the buffer), you can choose -;; from all bookmarks. -;; -;; - You can edit a bookmark: its name and file name/location, its -;; tags, or its complete defining internal Lisp record. -;; -;; * Multiple bookmark files. -;; -;; - Although vanilla Emacs lets you load different bookmark -;; files, it does not support this feature well, and the -;; behavior can even be contradictory. With Bookmark+ you can -;; easily (a) switch among alternative bookmark files or (b) -;; load multiple files into the same session, accumulating their -;; bookmark definitions. The last file you used is the default -;; when you choose a file to switch to, so it is easy to go back -;; and forth between two bookmark files. -;; See (@> "Using Multiple Bookmark Files"). -;; -;; * Type-specific jump commands. -;; -;; - When you want to jump to a bookmark of a specific type -;; (e.g. Dired), you can use a command that offers only such -;; bookmarks as completion candidates. -;; -;; * Dedicated keymaps as prefix keys. -;; -;; - Prefix `C-x p' is used for bookmark keys, in general. The -;; vanilla keys on prefix `C-x r' are still available also, but -;; that prefix is shared with register commands, making it less -;; convenient for bookmarks. Using `C-x p' lets you focus on -;; bookmarks. -;; -;; - Prefix `C-x p c' is for setting various kinds of bookmarks. -;; -;; - Prefixes `C-x j' and `C-x 4 j' (for other-window) are used -;; for bookmark jump commands. Again, a dedicated prefix key -;; helps you focus on one kind of action (jumping). -;; -;; All of these prefix keys correspond to prefix-map variables, so -;; you need not use these particular prefixes. You can bind these -;; maps to any prefix keys you want. These are the maps, together -;; with their predefined bindings. (Note that the keymap for -;; setting bookmarks is bound to a prefix in `bookmark-map'.) -;; -;; `bookmark-map' - `C-x p' -;; `bmkp-set-map' - `C-x p c' -;; `bmkp-jump-map' - `C-x j' -;; `bmkp-jump-other-window-map' - `C-x 4 j' -;; -;; In addition, mode-specific bookmarking commands are bound in -;; some other modes: Occur, Compilation (including Grep), -;; Buffer-menu, Gnus, Info, Man, Woman, W3M, and Dired (if you use -;; Dired+). These keys let you set or jump to bookmarks specific -;; to the modes. -;; -;; * Helpful help. -;; -;; - Information about individual bookmarks. -;; -;; . Anywhere in Emacs, `C-x p ?' (command -;; `bmkp-describe-bookmark') describes any bookmark. With a -;; prefix argument, it shows you the full information that -;; defines it (internal form). -;; -;; . In the bookmark list, `C-h RET' (or `C-h C-RET') describes -;; the bookmark under the cursor. The description is as -;; complete as possible - for example, for an image-file -;; bookmark the complete EXIF image metadata is shown. (This -;; is only for Emacs 22 and later, and only if you have -;; command-line tool `exiftool' installed. See standard Emacs -;; library `image-dired.el' for more information about -;; `exiftool'.) -;; -;; And again, a prefix arg (`C-u C-h RET') means show the full -;; (internal) bookmark information. -;; -;; - General Bookmark+ documentation. -;; -;; . Anywhere in Emacs, `M-x bmkp-bmenu-mode-status-help' shows -;; detailed information about the current state of the -;; bookmark list. Click button `Doc in Commentary' or button -;; `Doc on the Web' to access the complete documentation. -;; -;; (Use button `Customize' to customize all '''Bookmark+''' -;; faces and options.) -;; -;; . In the bookmark list, `?' and `C-h m' are the same as `M-x -;; bmkp-bmenu-mode-status-help'. (`C-h m' in the bookmark -;; list does not show you info about minor modes. If you want -;; that, use `M-x describe-mode'.) -;; -;; . In the `bookmark-plus' group customization buffer (`M-x -;; customize-group bookmark-plus'), click button `Commentary'. -;; -;; . From the Emacs-Wiki Web site, -;; http://www.emacswiki.org/cgi-bin/wiki/BookmarkPlus. -;; -;; - It is easy to recognize orphaned and invalid bookmarks. -;; -;; . Invalid bookmarks are shown in a special face in the -;; bookmark-list display. -;; -;; . You can easily mark all of the orphaned bookmarks, that is, -;; those whose recorded files have been renamed or deleted. -;; You can then relocate or delete those bookmarks. -;; -;; - It is easy to recognize modified (i.e., unsaved) bookmarks. -;; They are marked with `*'. Likewise, bookmarks that have tags -;; (marked with `t'); bookmarks that have annotations (`a'); and -;; bookmarks that are temporary (`X'), meaning that they will -;; not be saved. -;; -;; * Jump-destination highlighting. -;; -;; - When you jump to a bookmark, the destination (position) is -;; highlighted temporarily using crosshairs, to make it stand -;; out. Option `bmkp-crosshairs-flag' controls this, and this -;; feature is available only if you also use library -;; `crosshairs.el'. -;; -;; * Visual bookmarks (highlighting). -;; -;; - You can highlight the locations of bookmarks, either -;; automatically or on demand. You control what kind of -;; highlighting, if any, is used for which bookmarks. This -;; feature requires that you have library `bookmark+-lit.el' in -;; your `load-path' (it will then be loaded by `bookmark+.el). -;; -;; * Better, user-configurable bookmark-name defaults. -;; -;; See the doc strings of command `bookmark-set' (Bookmark+ -;; version) and options `bmkp-new-bookmark-default-names' and -;; `bmkp-default-bookmark-name'. -;; -;; * Synergy with Icicles. -;; -;; - Icicles works with Bookmark+ to provide enhanced bookmark -;; jumping (visiting), setting, and help. It gives you a -;; bookmark browser, and lets you bookmark and tag files on the -;; fly. See (@> "Use Bookmark+ with Icicles") and -;; http://www.emacswiki.org/cgi-bin/wiki/Icicles. - -;;(@* "Bookmark Basics") -;; ** Bookmark Basics ** -;; -;; Bookmark+ builds on vanilla Emacs bookmarks. If you are familiar -;; with the latter, then you can skip this section, which mostly -;; reviews the former. However, this section also introduces some -;; Bookmark+ concepts and features that are detailed in other -;; sections. -;; -;; In Emacs bookmarking these three things are different but related: -;; -;; 1. the bookmark list -;; 2. the bookmark file -;; 3. the bookmark-list display (buffer `*Bookmark List*', aka the -;; bookmark "menu list", a misnomer) -;; -;; It is important to keep these three straight and understand their -;; differences in practice, in particular, when they do and do not -;; represent the same set of bookmarks. -;; -;; #1 is in memory. It is the current set of bookmarks. When you -;; add, rename, delete, etc. a bookmark, this list is updated. -;; -;; #2 is on disk. It is a persistent record of a set of bookmarks. -;; -;; The bookmark list (#1) is the current value of internal variable -;; `bookmark-alist'. The bookmark file (#2)can be anywhere. Its -;; default filename is the value of user option -;; `bookmark-default-file'. -;; -;; The bookmark list is typically initialized from the bookmark file -;; - referred to as loading your bookmarks, but you can also create -;; bookmarks (adding them to the list) without ever saving them to -;; disk. -;; -;; The bookmark list can be saved to the bookmark file - referred to -;; as saving your bookmarks - either automatically or on demand. But -;; it is not necessarily saved. Even if it has been saved in the -;; past, that does not mean that at any given time the bookmark list -;; corresponds exactly to the bookmark file. -;; -;; The list and the file can often become out of sync. In an Emacs -;; session, the bookmark list rules. After an Emacs session, the -;; bookmark file rules (it is all there is). You can use `C-x p L' -;; (`bmkp-switch-bookmark-file-create') to sync (revert) the list to -;; reflect the file - just accept the default value, "switching" to -;; the same file. -;; -;; The bookmark-list display (#3) is a snapshot view of the bookmarks -;; in the bookmark list. As such, what you see there reflects the -;; state of the bookmark list at some point in time. So here again, -;; the two, list and display, can be out of sync. Hitting `g' in the -;; bookmark-list display refreshes it to accurately reflect the -;; current bookmark list (#1). Some other operations in the display -;; also keep it synced with the list. -;; -;; Using a prefix argument (`C-u g') syncs the display (#3) and the -;; list (#1) to the file (#2). This can be useful when some other -;; process (e.g., another Emacs session) updates the bookmark file or -;; when you want to abandon changes to the current bookmark list and -;; any of the current bookmarks. Outside the bookmark-list display, -;; you can use command `bmkp-revert-bookmark-file' to do this. -;; -;; You can load different bookmark files, either adding their -;; bookmarks to those already in the current bookmark list or -;; replacing them. -;; -;; The most important takeaway from this section is that #1 (list), -;; #2 (file), and #3 (display) can be out of sync, and they often -;; are. And that can be useful. -;; -;; Until now, everything said in this section is true of vanilla -;; Emacs as well as Bookmark+. Bookmark+ adds some flexibility -;; regarding the use of multiple bookmark files, and it can save the -;; last state of the bookmark-list display for later reuse. -;; -;; The saved state of the display is restored when you show the -;; display after quitting it (`q') in the same session or quitting -;; Emacs, but only if the bookmark file whose location it recorded is -;; the same as the current bookmark file. -;; -;; It would not make sense to display a completely different set of -;; bookmarks from those that are currently loaded. The display must -;; always reflect the current bookmark list (even if it sometimes -;; reflects it imperfectly, because it is a snapshot). So if the -;; bookmark file that is loaded is different from the one that was -;; recorded for the display state, the recorded state is ignored. -;; -;;(@* "Automatic Saving") -;; *** Automatic Saving *** -;; -;; User option `bookmark-save-flag' controls whether and how often to -;; automatically save the bookmark list to the bookmark file, thus -;; syncing the two. You can toggle this option using `M-~' in the -;; bookmark-list display. -;; -;; In the bookmark-list display, you can tell whether individual -;; bookmarks have been modified since the last save: they are marked -;; with `*'. I believe that this indication is robust and accurate -;; (if not, please report a bug), but a word of caution: do not -;; depend on it. The only way to be sure that your bookmarks have -;; been saved is to save them. ;-) -;; -;; Is there a way to unmodify a single bookmark that you have -;; changed? No, not unless it is the only one you modified. If you -;; revert to the bookmarks as last saved, then all changes to all -;; bookmarks (including addition and removal of bookmarks) are lost. -;; If you want to work carefully when making multiple changes, then -;; save any modifications you are sure of before you move on to -;; others. If only one bookmark is modified then reverting to the -;; bookmark file effectively unmodifies that bookmark. -;; -;; When you consult the doc for option `bookmark-save-flag' you see -;; that besides values of `nil' and `t', meaning off and on, it can -;; have a value that is the number of bookmark modifications to allow -;; before automatically saving. If the value is 10, for instance, -;; then the 11th modification triggers automatic saving. -;; -;; But a modification means any change to any bookmark. Typically, -;; you are more interested in considering all of the changes caused -;; by a given command as one modification. Why? Suppose you use a -;; command such as `T > +' (`bmkp-bmenu-add-tags-to-marked'), which -;; adds a set of tags to each of the marked bookmarks. Even if there -;; have been no other modifications since you last saved bookmarks, -;; if there are more marked bookmarks than your setting of -;; `bookmark-save-flag' then automatic saving will kick in in the -;; middle of the command. Some of the bookmarks with the added tags -;; will be automatically saved. And that does not give you an -;; opportunity to cancel the changes (e.g., by quitting without -;; saving). -;; -;; This is the reason for option `bmkp-count-multi-mods-as-one-flag', -;; whose default value is `t', which means count all of a sequence of -;; modifications together as one modification, as far as -;; `bookmark-save-flag' is concerned. - -;;(@* "Different Types of Jump Commands") -;; ** Different Types of Jump Commands ** -;; -;; When you jump to a bookmark, you can use completion to specify the -;; bookmark name. `bookmark-jump' and `bookmark-jump-other-window', -;; bound to `C-x j j' and `C-x 4 j j', are general commands. Their -;; completion candidates include all of your bookmarks. With -;; Bookmark+ you can easily have a large number of bookmarks. -;; -;; To provide more specificity, Bookmark+ provides many different -;; bookmark jump commands. If you want to jump to a bookmark of a -;; specific type, such as Info, you can use a Bookmark+ command that -;; is specific to bookmarks of that type: only those bookmarks are -;; completion candidates. -;; -;; There are thus type-specific commands: `bmkp-dired-jump', -;; `bmkp-info-jump', and so on, bound to `C-x j d', `C-x j i', and so -;; on. There are also commands to jump to bookmarks for the current -;; buffer or for particular buffers or files -;; (see (@> "Bookmarks for Specific Files or Buffers")). -;; -;; All bookmark jump commands are bound to keys that have the prefix -;; `C-x j'. There is an other-window version of most jump commands, -;; and it is bound to the same key as the same-window command, except -;; the prefix is `C-x 4 j', not `C-x j'. For instance, -;; `bmkp-dired-jump-other-window' is bound to `C-x 4 j d'. -;; -;; More precisely, the bookmark jump commands are on the prefix maps -;; `bmkp-jump-map' and `bmkp-jump-other-window-map', which have the -;; default bindings `C-x j' and `C-x 4 j'. You can bind these maps -;; to any keys you like. -;; -;; If you do not remember the different type-specfic bindings, you -;; can use commands `bmkp-jump-to-type' and -;; `bmkp-jump-to-type-other-window' (`C-x j :' and `C-x 4 j :'). -;; They work for any type, prompting you first for the type, then for -;; a bookmark of that type (only). -;; -;; There are several commands for jumping to a bookmark with tags. -;; The completion candidates can be those bookmarks that have all -;; tags in a given set, some tags in a given set, all tags matching a -;; regexp, or some tags matching a regexp. You are prompted for the -;; set of tags or the regexp to match. -;; -;; These commands all have the prefix key `C-x j t'. The suffix key -;; is `*' for "all" and `+' for "some". The regexp-matching commands -;; precede the suffix key with `%'. For example, `C-x j t % +' jumps -;; to a bookmark you choose that has one or more tags that match the -;; regexp you input. -;; -;; There are some type-specific jump commands for bookmarks with -;; tags. The key sequences for these include a key that indicates -;; the bookmark type, after the `t' indicating tags. For example, -;; commands for jumping to a file or directory bookmark having -;; certain tags use the prefix `C-x j t f' (`f' for file). Similar -;; commands for autofile bookmarks have prefix `C-x j t a' (`a' for -;; autofile). -;; -;; For example, `C-x j t f % *' jumps to a file or directory bookmark -;; you choose, where all of its tags match a regexp, and `C-x j t a -;; +' finds a file tagged with at least one of the tags you input. -;; -;; In addition to the ordinary autofile "jump" commands, there are -;; `find-file' versions: they read a file name using -;; `read-file-name', instead of completing a bookmark name. - see -;; (@> "Autofile Bookmarks"). These commands are available starting -;; with Emacs 22. -;; -;; Bookmark names are global. File names are not; that is, the -;; non-directory portion is not. Suppose you have two similar -;; directories with some like-named files, perhaps tagged in similar -;; ways. Imagine image files of your vacations organized in -;; different directories by year. It is sometimes useful to narrow -;; your focus to the file bookmarks in one directory. -;; -;; Commands such as `bmkp-file-this-dir-jump' (`C-x j . f') offer as -;; completion candidates only bookmarks for files and subdirs in the -;; current directory (`default-directory'). For tags, there are -;; equivalent commands. For example, `C-x j t . % *' is the same as -;; `C-x j t f % *', but the destinations are limited to files in the -;; current directory. All of the "this-dir" file jump commands are -;; bound to the same keys as the general file jump commands, but with -;; `.' instead of `f'. -;; -;; Remember that Bookmark+ collects lots of commands on only a few -;; predefined prefix keys, primarily as a mnemonic device. Nothing -;; requires you to use the long key sequence `C-x j t f % *' to visit -;; a file that has a given set of tags. It is expected that you will -;; bind short key sequences to commands that you use often. -;; -;; The `C-x j' and `C-x 4 j' bindings are global. In addition, in -;; some modes `j' is bound to the corresponding type-specific jump -;; command. For example, in Info mode, `j' is bound to -;; `bmkp-info-jump'. (Dired is an exception here: `J' is used -;; instead of `j', since `j' is already taken for `dired-goto-file'.) -;; These commands are also added to the mode's menu-bar menu. -;; -;; In Dired mode, `C-j' is bound to a special Dired-specific jump -;; command, `bmkp-dired-this-dir-jump', whose destinations all use -;; the current directory (`default-directory'). The aim of `C-j' is -;; not to change directories but to change to a different set of -;; Dired markings, switches, inserted subdirectories, or hidden -;; subdirectories for the same Dired directory. -;; -;; In addition to the predefined bookmark types, which you can use as -;; described above, you can define a "type"-specific jump command for -;; any set of bookmarks. That is, you can use any specific set of -;; bookmarks as the completion candidates for a new jump command. -;; Such a set is really only a pseudo-type: the actual bookmarks can -;; each be of any type. -;; -;; You could use this feature, for example, to define a jump command -;; for the bookmarks that belong to a given project. -;; -;; One way to define such a command is to first mark the bookmarks -;; that you want to be the completion candidates, then use `M-c' -;; (command `bmkp-bmenu-define-jump-marked-command') in the bookmark -;; list. -;; -;; The `*Bookmark List*' display defines a set of bookmarks, even -;; without markings. So does each bookmark of type bookmark list, -;; that is, a bookmark corresponding to a particular `*Bookmark -;; List*' display state - see -;; (@> "State-Restoring Commands and Bookmarks"). -;; -;; You can capture the set of bookmarks corresponding to a `*Bookmark -;; List*' display for use in navigation, that is, as the current -;; "navigation list". Navigation here includes jumping and cycling -;; - see (@> "Cycling, Navigation List"). -;; -;; To capture in the navigation list the bookmarks corresponding to -;; either the current `*Bookmark List*' display or a bookmark-list -;; bookmark, use `C-x p B', which is bound to command -;; `bmkp-choose-navlist-from-bookmark-list'. To then jump to a -;; bookmark from such a navigation list, use `C-x j N' or `C-x 4 j N' -;; (`bmkp-jump-in-navlist' or `bmkp-jump-in-navlist-other-window'). - -;;(@* "Bookmark Tags") -;; ** Bookmark Tags ** -;; -;; With Bookmark+ you can bookmark many kinds of Emacs object. -;; Bookmarks record locations - that is their primary purpose. They -;; can also record annotations: general free-text descriptions of -;; your choosing. -;; -;; Bookmark+ bookmarks can also be tagged, as a way to organize them, -;; which also means as a way to organize the objects that are -;; bookmarked. -;; -;; By "tagging" and "tag" in this context is meant associating -;; keywords or other text with an object, typically in order to -;; classify or characterize it. Tags are metadata about an object. -;; This notion of tagging is sometimes called "delicious" tagging -;; after the Web site www.delicious.com that popularized it -;; (`http://en.wikipedia.org/wiki/Delicious_(website)'). -;; -;; Be aware that there is another notion of "tag" associated with -;; Emacs: that involving Emacs tags files, which record the locations -;; of function, variable, etc. definitions in source files. There is -;; no relation between the two notions of "tag". -;; -;; A bookmark tag is a string (or a cons whose car is a string - see -;; (@> "Bookmark Tags Can Have Values")). You can add as many tags -;; as you like to any bookmark, and multiple bookmarks can have the -;; same tag(s). In fact, that's the whole idea behind using them for -;; organizing. -;; -;; This feature is unrelated to the fact that bookmarks record -;; locations and are useful for navigating. You can, if you want, -;; use bookmarks to tag files in various ways purely for purposes of -;; organizing them (e.g. into projects), whether or not you ever use -;; the bookmarks as a way to visit them. -;; -;; For example, if you use Dired+ (library `dired+.el'), then you can -;; use `M-b' (`diredp-do-bookmark') in Dired to create an autofile -;; bookmark for each of the marked files in the Dired buffer. Even -;; if you never use those bookmarks for navigating to the files, you -;; can use them with tags to organize the files and thus operate on -;; subsets of them. -;; -;; By default, you create bookmarks without tags and add tags to them -;; later. If you prefer, you can customize option -;; `bmkp-prompt-for-tags-flag' to non-nil so that you are prompted to -;; add tags immediately whenever you set (create) a bookmark. There -;; are also some commands, such as `bmkp-tag-a-file' (`C-x p t + a') -;; and `bmkp-untag-a-file' (`C-x p t - a'), that always prompt for -;; tags to add or remove. (In general, the key `a' is used in key -;; sequences for autofile bookmarks.) -;; -;; When you are prompted to enter a tag, you type some text then hit -;; `RET'. If you want to include a newline character in the tag -;; itself, use `C-q C-j' (`C-j' is the newline character). You can -;; use `C-q' this way to enter any character. If you do use complex -;; strings as tags then you might prefer to simply edit a bookmark's -;; tags in a separate buffer. You can do that using `C-x p t e' (or -;; `T e' in the bookmark-list display). -;; -;; Whenever you are prompted for a tag you can use completion. The -;; completion candidates available are the tag names defined by -;; option `bmkp-tags-for-completion'. The default value of this -;; option is `current', meaning use only the tags from the bookmarks -;; in the current bookmark list as candidates. You can customize the -;; option to include specific tags or the tags from bookmarks in -;; specific bookmark files. -;; -;; You can use command `bmkp-list-all-tags' to list all of the tags -;; defined by option `bmkp-tags-for-completion' or, with a numeric -;; prefix argument, only the tags corresponding to the current -;; bookmark file. You can list the tag names only or (using a -;; non-negative prefix arg) show the full tag definitions, which -;; include any associated tag values (see (@> "Bookmark Tags Can Have Values") -;; for information about tag values). -;; -;; To make tags more useful, Bookmark+ provides *lots* of commands: -;; commands for adding, removing, copying, pasting, and renaming -;; tags; commands for jumping to bookmarks with particular sets of -;; tags; and commands for marking or unmarking (in buffer `*Bookmark -;; List*') bookmarks that are tagged in various ways. -;; -;; Most commands pertaining to tags are by default on prefix key `C-x -;; p t' - use `C-x p t C-h' to see them. In buffer `*Bookmark -;; List*', commands pertaining to tags are on prefix key `T' - use `T -;; C-h' to see them. -;; -;; When combined with other Bookmark+ commands (e.g. search, -;; query-replace) that apply to the marked bookmarks in the -;; `*Bookmark List*' window, you can really do quite a lot using -;; bookmark tags. Use your imagination! -;; -;; See Also: -;; -;; * (@> "Bookmark Records: What A Bookmark Looks Like") -;; * (@> "Bookmarking the Marked Files in Dired") -;; * (@> "Opening Bookmarks Using Windows File Associations") -;; * (@> "Tag Commands and Keys") - -;;(@* "Bookmark Tags Can Have Values") -;; ** Bookmark Tags Can Have Values ** -;; -;; Bookmark tags are simply names (strings) when you create them. -;; Nearly all of the predefined operations that use tags use these -;; names: sorting, marking, jumping, and so on. But you can in fact -;; add an associated value to any tag. This means that a tag can act -;; just like an object attribute or property: it can be a name/value -;; pair. -;; -;; To add a value to a tag that has none, or to change the current -;; value of a tag, you use command `bmkp-set-tag-value', which is -;; bound to `T v' in the bookmark list and bound to `C-x p t v' -;; globally. You are prompted for the bookmark, the tag, and the new -;; value. -;; -;; A tag value can be a number, symbol, string, list, vector, and so -;; on. It can be as complex as you like. It can be any Emacs-Lisp -;; object that has read syntax, that is, that is readable by the Lisp -;; reader. (Everything that is saved as part of a bookmark must be -;; readable; otherwise, your bookmark file could not be read -;; (loaded).) -;; -;; Because tag values can be pretty much anything, you are pretty -;; much on your own when it comes to making use of them. Bookmark+ -;; does not provide predefined functions for using tag values. In -;; general, tag values are something you will use with home-grown -;; Lisp code for your own purposes. -;; -;; However, you can easily make some interactive use of tag values -;; with little effort. You can, for example, define a predicate that -;; tests whether a bookmark has a tag value that satisfies some -;; property (e.g. is a number greater than 3.14159265358979), and -;; then you can use command `bmkp-bmenu-mark-bookmarks-satisfying' to -;; mark those bookmarks. -;; -;; Tags that have the prefix "bmkp-" are reserved - do not name your -;; own tags using this prefix. -;; -;; Currently, "bmkp-jump" is the only predefined bookmark tag. You -;; can give this tag a value that is a function - it is called -;; whenever the tagged bookmark is visited. Any Lisp-readable -;; function value is allowed: a symbol or a lambda expression. -;; -;; For example, to display `Hello!' when a bookmark is visited you -;; can use this: -;; -;; T v bookmark-jump RET (lambda () (message "Hello!")) -;; -;; The function that is the value of a "bmkp-jump" tag is called just -;; after the the standard hook `bookmark-after-jump-hook' is invoked. -;; You can use this tag to invoke functions that are specific to -;; individual bookmarks; bookmarks can thus have their own, extra -;; jump functions. - -;;(@* "Function, Sequence, and Variable-List Bookmarks") -;; ** Function, Sequence, and Variable-List Bookmarks ** -;; -;; Bookmarks are typically thought of only as recorded locations. -;; Invoking a bookmark, called "jumping" to it, traditionally means -;; just visiting its location. Bookmark+ looks at bookmarks in a -;; more general way than that. A bookmark is a shortcut of some -;; kind - nothing more. -;; -;; A given type of bookmark is defined by its handler function, which -;; really could do anything you like. We've already seen the -;; examples of region bookmarks, which restore the active region, and -;; Dired bookmarks, which restore a set of Dired markings, switches, -;; inserted subdirectories, and hidden (sub)directories. -;; -;; A "function bookmark" simply invokes some function - any function. -;; You can, for instance, define a window or frame configuration and -;; record that as a bookmark. Then jump to the bookmark to switch -;; contexts. (You can also bookmark a desktop and jump to that.) -;; -;; Function bookmarks might not seem too interesting, since we have -;; other ways of invoking functions in Emacs. But the other features -;; of Bookmark+ combine with this feature. You can, for instance, -;; tag such bookmarks. -;; -;; And you can combine them, invoking the functions sequentially. -;; This is just a particular case of using a "sequence bookmark", -;; which simply records a sequence of bookmarks. The bookmarks in a -;; sequence can be of any kind, including other sequence bookmarks. -;; -;; Command `bmkp-make-function-bookmark' creates a function bookmark -;; - you give it a function symbol or a lambda expression. Command -;; `bmkp-bmenu-make-sequence-from-marked' creates a sequence from the -;; marked bookmarks in the bookmark list, in their current order. -;; -;; A variable-list bookmark saves and restores the values of a set of -;; variables. Command `bmkp-set-variable-list-bookmark' prompts you -;; for the variables to include in the list and then sets the -;; bookmark. Command `bmkp-jump-variable-list' (`C-x j v') restores -;; the recorded variable values for the bookmark's buffer. You can -;; also create variable-list bookmarks non-interactively, using -;; function `bmkp-create-variable-list-bookmark'. -;; -;; If you use library `wide-n.el', then you can move among multiple -;; restrictions (narrowings) in a buffer. The restrictions are -;; stored in buffer-local variable `wide-n-restrictions'. Command -;; `bmkp-set-restrictions-bookmark' bookmarks this value for the -;; current buffer. Jumping to such a bookmark restores the saved -;; ring/stack of restrictions. - -;;(@* "Editing Bookmarks") -;; ** Editing Bookmarks ** -;; -;; In vanilla Emacs, you can edit the annotation associated with a -;; bookmark. And you can rename a bookmark. But that is all. There -;; is no easy way to really edit a bookmark. -;; -;; With Bookmark+: -;; -;; * You can use `r' in the bookmark-list display (or `C-x p r' -;; elsewhere) to edit the name and the target file name (bookmarked -;; location) of a bookmark. You are prompted for the new names. -;; -;; * You can use `e' in the bookmark-list display (or `C-x p E' -;; elsewhere) to edit a complete bookmark - all of its information. -;; You edit the internal Lisp sexp that represents the bookmark -;; record. This is the same internal