Mercurial > emacs
annotate lisp/bookmark.el @ 112380:aa1e27e3a554
Revert changes adding format args to yes-or-no-p and y-or-n-p.
See discussion on emacs-devel at
http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00388.html
* src/fns.c (Fyes_or_no_p): Revert 2011-01-07 change, removing ARGS.
* lisp/subr.el (y-or-n-p): Revert 2011-01-07 change, removing ARGS.
* lisp/files.el (find-alternate-file, basic-save-buffer)
(basic-save-buffer-2, revert-buffer, recover-file)
(kill-buffer-ask, abort-if-file-too-large)
(set-visited-file-name, write-file, backup-buffer)
(basic-save-buffer, save-some-buffers):
* lisp/dired-aux.el (dired-compress-file): Callers changed.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 19 Jan 2011 21:55:36 -0500 |
parents | 61f7601898b1 |
children |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38173
diff
changeset
|
1 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later |
4537 | 2 |
112284
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003, 2004, |
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
4 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
61f7601898b1
Refill some copyright headers.
Glenn Morris <rgm@gnu.org>
parents:
112228
diff
changeset
|
5 ;; Free Software Foundation, Inc. |
4537 | 6 |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
7 ;; Author: Karl Fogel <kfogel@red-bean.com> |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
8 ;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
4537 | 9 ;; Created: July, 1993 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
10 ;; Keywords: bookmarks, placeholders, annotations |
4537 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93705
diff
changeset
|
14 ;; GNU Emacs is free software: you can redistribute it and/or modify |
4537 | 15 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93705
diff
changeset
|
16 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93705
diff
changeset
|
17 ;; (at your option) any later version. |
4537 | 18 |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93705
diff
changeset
|
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
14169 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; This package is for setting "bookmarks" in files. A bookmark | |
30 ;; associates a string with a location in a certain file. Thus, you | |
31 ;; can navigate your way to that location by providing the string. | |
32 ;; See the "User Variables" section for customizations. | |
4537 | 33 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
34 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38173
diff
changeset
|
35 ;;; Code: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
36 |
14169 | 37 (require 'pp) |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
38 (eval-when-compile (require 'cl)) |
14169 | 39 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
40 ;;; Misc comments: |
4537 | 41 ;; |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
42 ;; If variable bookmark-use-annotations is non-nil, an annotation is |
35283 | 43 ;; queried for when setting a bookmark. |
4595 | 44 ;; |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
45 ;; The bookmark list is sorted lexically by default, but you can turn |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
46 ;; this off by setting bookmark-sort-flag to nil. If it is nil, then |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
47 ;; the list will be presented in the order it is recorded |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
48 ;; (chronologically), which is actually fairly useful as well. |
4537 | 49 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
50 ;;; User Variables |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
51 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
52 (defgroup bookmark nil |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
53 "Setting, annotation and jumping to bookmarks." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
54 :group 'matching) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
55 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
56 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
57 (defcustom bookmark-use-annotations nil |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
58 "If non-nil, saving a bookmark queries for an annotation in a buffer." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
59 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
60 :group 'bookmark) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
61 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
62 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
63 (defcustom bookmark-save-flag t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
64 "Controls when Emacs saves bookmarks to a file. |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
65 --> nil means never save bookmarks, except when `bookmark-save' is |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
66 explicitly called (\\[bookmark-save]). |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
67 --> t means save bookmarks when Emacs is killed. |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
68 --> Otherwise, it should be a number that is the frequency with which |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
69 the bookmark list is saved (i.e.: the number of times which |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
70 Emacs' bookmark list may be modified before it is automatically |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
71 saved.). If it is a number, Emacs will also automatically save |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
72 bookmarks when it is killed. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
73 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
74 Therefore, the way to get it to save every time you make or delete a |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
75 bookmark is to set this variable to 1 (or 0, which produces the same |
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
76 behavior.) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
77 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
78 To specify the file in which to save them, modify the variable |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
79 `bookmark-default-file', which is `~/.emacs.bmk' by default." |
22568
5682c77dce71
(bookmark-save-flag, bookmark-version-control): Use
Andreas Schwab <schwab@suse.de>
parents:
22251
diff
changeset
|
80 :type '(choice (const nil) integer (other t)) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
81 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
82 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
83 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
84 (defconst bookmark-old-default-file "~/.emacs-bkmrks" |
100171 | 85 "The `.emacs.bmk' file used to be called this name.") |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
86 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
87 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
88 ;; defvarred to avoid a compilation warning: |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
89 (defvar bookmark-file nil |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
90 "Old name for `bookmark-default-file'.") |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
91 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
92 (defcustom bookmark-default-file |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
93 (if bookmark-file |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
94 ;; In case user set `bookmark-file' in her .emacs: |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
95 bookmark-file |
107838
f50f5478ec53
Clean up last bookmark changes for man/woman/gnus-summary.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107192
diff
changeset
|
96 (locate-user-emacs-file "bookmarks" ".emacs.bmk")) |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
97 "File in which to save bookmarks by default." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
98 :type 'file |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
99 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
100 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
101 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
102 (defcustom bookmark-version-control 'nospecial |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
103 "Whether or not to make numbered backups of the bookmark file. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
104 It can have four values: t, nil, `never', and `nospecial'. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
105 The first three have the same meaning that they do for the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
106 variable `version-control', and the final value `nospecial' means just |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
107 use the value of `version-control'." |
22568
5682c77dce71
(bookmark-save-flag, bookmark-version-control): Use
Andreas Schwab <schwab@suse.de>
parents:
22251
diff
changeset
|
108 :type '(choice (const nil) (const never) (const nospecial) |
5682c77dce71
(bookmark-save-flag, bookmark-version-control): Use
Andreas Schwab <schwab@suse.de>
parents:
22251
diff
changeset
|
109 (other t)) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
110 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
111 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
112 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
113 (defcustom bookmark-completion-ignore-case t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
114 "Non-nil means bookmark functions ignore case in completion." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
115 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
116 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
117 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
118 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
119 (defcustom bookmark-sort-flag t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
120 "Non-nil means that bookmarks will be displayed sorted by bookmark name. |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
121 Otherwise they will be displayed in LIFO order (that is, most |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
122 recently set ones come first, oldest ones come last)." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
123 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
124 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
125 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
126 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
127 (defcustom bookmark-automatically-show-annotations t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
128 "Non-nil means show annotations when jumping to a bookmark." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
129 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
130 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
131 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
132 |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
133 (defconst bookmark-bmenu-header-height 2 |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
134 "Number of lines used for the *Bookmark List* header.") |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
135 |
106714
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
136 (defconst bookmark-bmenu-marks-width 2 |
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
137 "Number of columns (chars) used for the *Bookmark List* marks column, |
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
138 including the annotations column.") |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
139 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
140 (defcustom bookmark-bmenu-file-column 30 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
141 "Column at which to display filenames in a buffer listing bookmarks. |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
142 You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
143 :type 'integer |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
144 :group 'bookmark) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
145 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
146 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
147 (defcustom bookmark-bmenu-toggle-filenames t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
148 "Non-nil means show filenames when listing bookmarks. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
149 This may result in truncated bookmark names. To disable this, put the |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
150 following in your `.emacs' file: |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
151 |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
152 \(setq bookmark-bmenu-toggle-filenames nil)" |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
153 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
154 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
155 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
156 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
157 (defcustom bookmark-menu-length 70 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
158 "Maximum length of a bookmark name displayed on a popup menu." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
159 :type 'integer |
48393
68aa78bf3f63
(bookmark-menu-length): Fix typo in group name.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
45793
diff
changeset
|
160 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
161 |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
162 ;; FIXME: Is it really worth a customization option? |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
163 (defcustom bookmark-search-delay 0.2 |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
164 "Time before `bookmark-bmenu-search' updates the display." |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
165 :group 'bookmark |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
166 :type 'integer) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
167 |
66201
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
168 (defface bookmark-menu-heading |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
169 '((t (:inherit font-lock-type-face))) |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
170 "Face used to highlight the heading in bookmark menu buffers." |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
171 :group 'bookmark |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
172 :version "22.1") |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
173 |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
174 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
175 ;;; No user-serviceable parts beyond this point. |
4537 | 176 |
177 ;; Added for lucid emacs compatibility, db | |
178 (or (fboundp 'defalias) (fset 'defalias 'fset)) | |
179 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
180 ;; suggested for lucid compatibility by david hughes: |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
181 (or (fboundp 'frame-height) (defalias 'frame-height 'screen-height)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
182 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
183 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
184 ;;; Keymap stuff: |
18709
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
185 |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
186 ;; Set up these bindings dumping time *only*; |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
187 ;; if the user alters them, don't override the user when loading bookmark.el. |
4537 | 188 |
96438
5efd78aaea5b
Rebind three global `C-x r' keys "b", "m", "l" to the new map
Juri Linkov <juri@jurta.org>
parents:
96280
diff
changeset
|
189 ;;;###autoload (define-key ctl-x-r-map "b" 'bookmark-jump) |
5efd78aaea5b
Rebind three global `C-x r' keys "b", "m", "l" to the new map
Juri Linkov <juri@jurta.org>
parents:
96280
diff
changeset
|
190 ;;;###autoload (define-key ctl-x-r-map "m" 'bookmark-set) |
5efd78aaea5b
Rebind three global `C-x r' keys "b", "m", "l" to the new map
Juri Linkov <juri@jurta.org>
parents:
96280
diff
changeset
|
191 ;;;###autoload (define-key ctl-x-r-map "l" 'bookmark-bmenu-list) |
4537 | 192 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
193 ;;;###autoload |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
194 (defvar bookmark-map |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
195 (let ((map (make-sparse-keymap))) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
196 ;; Read the help on all of these functions for details... |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
197 (define-key map "x" 'bookmark-set) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
198 (define-key map "m" 'bookmark-set) ;"m"ark |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
199 (define-key map "j" 'bookmark-jump) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
200 (define-key map "g" 'bookmark-jump) ;"g"o |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
201 (define-key map "o" 'bookmark-jump-other-window) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
202 (define-key map "i" 'bookmark-insert) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
203 (define-key map "e" 'edit-bookmarks) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
204 (define-key map "f" 'bookmark-insert-location) ;"f"ind |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
205 (define-key map "r" 'bookmark-rename) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
206 (define-key map "d" 'bookmark-delete) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
207 (define-key map "l" 'bookmark-load) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
208 (define-key map "w" 'bookmark-write) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
209 (define-key map "s" 'bookmark-save) |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
210 map) |
4633 | 211 "Keymap containing bindings to bookmark functions. |
212 It is not bound to any key by default: to bind it | |
213 so that you have a bookmark prefix, just use `global-set-key' and bind a | |
214 key of your choice to `bookmark-map'. All interactive bookmark | |
4537 | 215 functions have a binding in this keymap.") |
216 | |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
217 ;;;###autoload (fset 'bookmark-map bookmark-map) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
218 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
219 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
220 ;;; Core variables and data structures: |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
221 (defvar bookmark-alist () |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
222 "Association list of bookmarks and their records. |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
223 Bookmark functions update the value automatically. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
224 You probably do NOT want to change the value yourself. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
225 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
226 The value is an alist with entries of the form |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
227 |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
228 (BOOKMARK-NAME . PARAM-ALIST) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
229 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
230 or the deprecated form (BOOKMARK-NAME PARAM-ALIST). |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
231 |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
232 BOOKMARK-NAME is the name you gave to the bookmark when creating it. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
233 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
234 PARAM-ALIST is an alist of bookmark information. The order of the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
235 entries in PARAM-ALIST is not important. The possible entries are |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
236 described below. An entry with a key but null value means the entry |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
237 is not used. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
238 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
239 (filename . FILENAME) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
240 (position . POS) |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
241 (front-context-string . STR-AFTER-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
242 (rear-context-string . STR-BEFORE-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
243 (handler . HANDLER) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
244 (annotation . ANNOTATION) |
105444
51af2a71a0d6
(bookmark-alist): Document the new `handler' element in the param alist.
Karl Fogel <kfogel@red-bean.com>
parents:
105372
diff
changeset
|
245 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
246 FILENAME names the bookmarked file. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
247 POS is the bookmarked buffer position (position in the file). |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
248 STR-AFTER-POS is buffer text that immediately follows POS. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
249 STR-BEFORE-POS is buffer text that immediately precedes POS. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
250 ANNOTATION is a string that describes the bookmark. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
251 See options `bookmark-use-annotations' and |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
252 `bookmark-automatically-show-annotations'. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
253 HANDLER is a function that provides the bookmark-jump behavior for a |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
254 specific kind of bookmark. This is the case for Info bookmarks, |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
255 for instance. HANDLER must accept a bookmark as argument.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
256 |
105540 | 257 (defvar bookmarks-already-loaded nil |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
258 "Non-nil if and only if bookmarks have been loaded from `bookmark-default-file'.") |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
259 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
260 |
4537 | 261 ;; more stuff added by db. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
262 |
35283 | 263 (defvar bookmark-current-bookmark nil |
4633 | 264 "Name of bookmark most recently used in the current file. |
265 It is buffer local, used to make moving a bookmark forward | |
4631 | 266 through a file easier.") |
4537 | 267 |
268 (make-variable-buffer-local 'bookmark-current-bookmark) | |
269 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
270 |
4537 | 271 (defvar bookmark-alist-modification-count 0 |
4633 | 272 "Number of modifications to bookmark list since it was last saved.") |
4537 | 273 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
274 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
275 (defvar bookmark-search-size 16 |
4633 | 276 "Length of the context strings recorded on either side of a bookmark.") |
4537 | 277 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
278 |
105540 | 279 (defvar bookmark-current-buffer nil |
280 "The buffer in which a bookmark is currently being set or renamed. | |
281 Functions that insert strings into the minibuffer use this to know | |
282 the source buffer for that information; see `bookmark-yank-word' and | |
283 `bookmark-insert-current-bookmark' for example.") | |
4537 | 284 |
105540 | 285 |
286 (defvar bookmark-yank-point 0 | |
287 "The next point from which to pull source text for `bookmark-yank-word'. | |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
288 This point is in `bookmark-current-buffer'.") |
105540 | 289 |
290 | |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
291 (defvar bookmark-quit-flag nil |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
292 "Non nil make `bookmark-bmenu-search' quit immediately.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
293 |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
294 ;; Helper functions and macros. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
295 |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
296 (defmacro with-buffer-modified-unmodified (&rest body) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
297 "Run BODY while preserving the buffer's `buffer-modified-p' state." |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
298 (let ((was-modified (make-symbol "was-modified"))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
299 `(let ((,was-modified (buffer-modified-p))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
300 (unwind-protect |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
301 (progn ,@body) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
302 (set-buffer-modified-p ,was-modified))))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
303 |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
304 ;; Only functions below, in this page and the next one (file formats), |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
305 ;; need to know anything about the format of bookmark-alist entries. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
306 ;; Everyone else should go through them. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
307 |
111883
e6c418577289
* lisp/bookmark.el (bookmark-name-from-full-record): Rename back to
Karl Fogel <kfogel@red-bean.com>
parents:
111851
diff
changeset
|
308 (defun bookmark-name-from-full-record (bookmark-record) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
309 "Return the name of BOOKMARK-RECORD. BOOKMARK-RECORD is, e.g., |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
310 one element from `bookmark-alist'." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
311 (car bookmark-record)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
312 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
313 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
314 (defun bookmark-all-names () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
315 "Return a list of all current bookmark names." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
316 (bookmark-maybe-load-default-file) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
317 (mapcar 'bookmark-name-from-full-record bookmark-alist)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
318 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
319 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
320 (defun bookmark-get-bookmark (bookmark-name-or-record &optional noerror) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
321 "Return the bookmark record corresponding to BOOKMARK-NAME-OR-RECORD. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
322 If BOOKMARK-NAME-OR-RECORD is a string, look for the corresponding |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
323 bookmark record in `bookmark-alist'; return it if found, otherwise |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
324 error. Else if BOOKMARK-NAME-OR-RECORD is already a bookmark record, |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
325 just return it." |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
326 (cond |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
327 ((consp bookmark-name-or-record) bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
328 ((stringp bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
329 (or (assoc-string bookmark-name-or-record bookmark-alist |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
330 bookmark-completion-ignore-case) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
331 (unless noerror (error "Invalid bookmark %s" |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
332 bookmark-name-or-record)))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
333 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
334 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
335 (defun bookmark-get-bookmark-record (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
336 "Return the record portion of the entry for BOOKMARK-NAME-OR-RECORD in |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
337 `bookmark-alist' (that is, all information but the name)." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
338 (let ((alist (cdr (bookmark-get-bookmark bookmark-name-or-record)))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
339 ;; The bookmark objects can either look like (NAME ALIST) or |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
340 ;; (NAME . ALIST), so we have to distinguish the two here. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
341 (if (and (null (cdr alist)) (consp (caar alist))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
342 (car alist) alist))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
343 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
344 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
345 (defun bookmark-set-name (bookmark-name-or-record newname) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
346 "Set BOOKMARK-NAME-OR-RECORD's name to NEWNAME." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
347 (setcar (bookmark-get-bookmark bookmark-name-or-record) newname)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
348 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
349 (defun bookmark-prop-get (bookmark-name-or-record prop) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
350 "Return the property PROP of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
351 (cdr (assq prop (bookmark-get-bookmark-record bookmark-name-or-record)))) |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
352 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
353 (defun bookmark-prop-set (bookmark-name-or-record prop val) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
354 "Set the property PROP of BOOKMARK-NAME-OR-RECORD to VAL." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
355 (let ((cell (assq |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
356 prop (bookmark-get-bookmark-record bookmark-name-or-record)))) |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
357 (if cell |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
358 (setcdr cell val) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
359 (nconc (bookmark-get-bookmark-record bookmark-name-or-record) |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
360 (list (cons prop val)))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
361 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
362 (defun bookmark-get-annotation (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
363 "Return the annotation of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
364 (bookmark-prop-get bookmark-name-or-record 'annotation)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
365 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
366 (defun bookmark-set-annotation (bookmark-name-or-record ann) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
367 "Set the annotation of BOOKMARK-NAME-OR-RECORD to ANN." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
368 (bookmark-prop-set bookmark-name-or-record 'annotation ann)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
369 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
370 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
371 (defun bookmark-get-filename (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
372 "Return the full filename of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
373 (bookmark-prop-get bookmark-name-or-record 'filename)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
374 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
375 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
376 (defun bookmark-set-filename (bookmark-name-or-record filename) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
377 "Set the full filename of BOOKMARK-NAME-OR-RECORD to FILENAME." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
378 (bookmark-prop-set bookmark-name-or-record 'filename filename)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
379 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
380 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
381 (defun bookmark-get-position (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
382 "Return the position (i.e.: point) of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
383 (bookmark-prop-get bookmark-name-or-record 'position)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
384 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
385 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
386 (defun bookmark-set-position (bookmark-name-or-record position) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
387 "Set the position (i.e.: point) of BOOKMARK-NAME-OR-RECORD to POSITION." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
388 (bookmark-prop-set bookmark-name-or-record 'position position)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
389 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
390 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
391 (defun bookmark-get-front-context-string (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
392 "Return the front-context-string of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
393 (bookmark-prop-get bookmark-name-or-record 'front-context-string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
394 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
395 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
396 (defun bookmark-set-front-context-string (bookmark-name-or-record string) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
397 "Set the front-context-string of BOOKMARK-NAME-OR-RECORD to STRING." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
398 (bookmark-prop-set bookmark-name-or-record 'front-context-string string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
399 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
400 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
401 (defun bookmark-get-rear-context-string (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
402 "Return the rear-context-string of BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
403 (bookmark-prop-get bookmark-name-or-record 'rear-context-string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
404 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
405 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
406 (defun bookmark-set-rear-context-string (bookmark-name-or-record string) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
407 "Set the rear-context-string of BOOKMARK-NAME-OR-RECORD to STRING." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
408 (bookmark-prop-set bookmark-name-or-record 'rear-context-string string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
409 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
410 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
411 (defun bookmark-get-handler (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
412 "Return the handler function for BOOKMARK-NAME-OR-RECORD, or nil if none." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
413 (bookmark-prop-get bookmark-name-or-record 'handler)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
414 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
415 (defvar bookmark-history nil |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
416 "The history list for bookmark functions.") |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
417 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
418 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
419 (defun bookmark-completing-read (prompt &optional default) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
420 "Prompting with PROMPT, read a bookmark name in completion. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
421 PROMPT will get a \": \" stuck on the end no matter what, so you |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
422 probably don't want to include one yourself. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
423 Optional second arg DEFAULT is a string to return if the user enters |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
424 the empty string." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
425 (bookmark-maybe-load-default-file) ; paranoia |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
426 (if (listp last-nonmenu-event) |
105920
0a019b48e945
* bookmark.el (bookmark-completing-read): Sort bookmark names if
Chong Yidong <cyd@stupidchicken.com>
parents:
105787
diff
changeset
|
427 (bookmark-menu-popup-paned-menu t prompt |
0a019b48e945
* bookmark.el (bookmark-completing-read): Sort bookmark names if
Chong Yidong <cyd@stupidchicken.com>
parents:
105787
diff
changeset
|
428 (if bookmark-sort-flag |
0a019b48e945
* bookmark.el (bookmark-completing-read): Sort bookmark names if
Chong Yidong <cyd@stupidchicken.com>
parents:
105787
diff
changeset
|
429 (sort (bookmark-all-names) |
0a019b48e945
* bookmark.el (bookmark-completing-read): Sort bookmark names if
Chong Yidong <cyd@stupidchicken.com>
parents:
105787
diff
changeset
|
430 'string-lessp) |
0a019b48e945
* bookmark.el (bookmark-completing-read): Sort bookmark names if
Chong Yidong <cyd@stupidchicken.com>
parents:
105787
diff
changeset
|
431 (bookmark-all-names))) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
432 (let* ((completion-ignore-case bookmark-completion-ignore-case) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
433 (default default) |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
434 (prompt (concat prompt (if default |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
435 (format " (%s): " default) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
436 ": "))) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
437 (str |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
438 (completing-read prompt |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
439 bookmark-alist |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
440 nil |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
441 0 |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
442 nil |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
443 'bookmark-history))) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
444 (if (string-equal "" str) default str)))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
445 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
446 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
447 (defmacro bookmark-maybe-historicize-string (string) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
448 "Put STRING into the bookmark prompt history, if caller non-interactive. |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
449 We need this because sometimes bookmark functions are invoked from |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
450 menus, so `completing-read' never gets a chance to set `bookmark-history'." |
35283 | 451 `(or |
105372
bd2966850aac
Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents:
105124
diff
changeset
|
452 (called-interactively-p 'interactive) |
35283 | 453 (setq bookmark-history (cons ,string bookmark-history)))) |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
454 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
455 (defvar bookmark-make-record-function 'bookmark-make-record-default |
92556
5944be8c8211
Change a return type, for greater extensibility. See
Karl Fogel <kfogel@red-bean.com>
parents:
92550
diff
changeset
|
456 "A function that should be called to create a bookmark record. |
5944be8c8211
Change a return type, for greater extensibility. See
Karl Fogel <kfogel@red-bean.com>
parents:
92550
diff
changeset
|
457 Modes may set this variable buffer-locally to enable bookmarking of |
5944be8c8211
Change a return type, for greater extensibility. See
Karl Fogel <kfogel@red-bean.com>
parents:
92550
diff
changeset
|
458 locations that should be treated specially, such as Info nodes, |
5944be8c8211
Change a return type, for greater extensibility. See
Karl Fogel <kfogel@red-bean.com>
parents:
92550
diff
changeset
|
459 news posts, images, pdf documents, etc. |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
460 |
92674
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
461 The function will be called with no arguments. |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
462 It should signal a user error if it is unable to construct a record for |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
463 the current location. |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
464 |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
465 The returned record should be a cons cell of the form (NAME . ALIST) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
466 where ALIST is as described in `bookmark-alist' and may typically contain |
105444
51af2a71a0d6
(bookmark-alist): Document the new `handler' element in the param alist.
Karl Fogel <kfogel@red-bean.com>
parents:
105372
diff
changeset
|
467 a special cons (handler . HANDLER-FUNC) which specifies the handler function |
51af2a71a0d6
(bookmark-alist): Document the new `handler' element in the param alist.
Karl Fogel <kfogel@red-bean.com>
parents:
105372
diff
changeset
|
468 that should be used instead of `bookmark-default-handler' to open this |
51af2a71a0d6
(bookmark-alist): Document the new `handler' element in the param alist.
Karl Fogel <kfogel@red-bean.com>
parents:
105372
diff
changeset
|
469 bookmark. See the documentation for `bookmark-alist' for more. |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
470 |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
471 NAME is a suggested name for the constructed bookmark. It can be nil |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
472 in which case a default heuristic will be used. The function can also |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
473 equivalently just return ALIST without NAME.") |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
474 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
475 (defun bookmark-make-record () |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
476 "Return a new bookmark record (NAME . ALIST) for the current location." |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
477 (let ((record (funcall bookmark-make-record-function))) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
478 ;; Set up default name. |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
479 (if (stringp (car record)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
480 ;; The function already provided a default name. |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
481 record |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
482 (if (car record) (push nil record)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
483 (setcar record (or bookmark-current-bookmark (bookmark-buffer-name))) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
484 record))) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
485 |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
486 (defun bookmark-store (name alist no-overwrite) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
487 "Store the bookmark NAME with data ALIST. |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
488 If NO-OVERWRITE is non-nil and another bookmark of the same name already |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
489 exists in `bookmark-alist', record the new bookmark without throwing away the |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
490 old one." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
491 (bookmark-maybe-load-default-file) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
492 (let ((stripped-name (copy-sequence name))) |
84777
68033fec6867
(bookmark-xemacsp): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82140
diff
changeset
|
493 (or (featurep 'xemacs) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
494 ;; XEmacs's `set-text-properties' doesn't work on |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
495 ;; free-standing strings, apparently. |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
496 (set-text-properties 0 (length stripped-name) nil stripped-name)) |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
497 (if (and (not no-overwrite) |
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
498 (bookmark-get-bookmark stripped-name 'noerror)) |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
499 ;; already existing bookmark under that name and |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
500 ;; no prefix arg means just overwrite old bookmark |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
501 ;; Use the new (NAME . ALIST) format. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
502 (setcdr (bookmark-get-bookmark stripped-name) alist) |
35283 | 503 |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
504 ;; otherwise just cons it onto the front (either the bookmark |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
505 ;; doesn't exist already, or there is no prefix arg. In either |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
506 ;; case, we want the new bookmark consed onto the alist...) |
35283 | 507 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
508 (push (cons stripped-name alist) bookmark-alist)) |
35283 | 509 |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
510 ;; Added by db |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
511 (setq bookmark-current-bookmark stripped-name) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
512 (setq bookmark-alist-modification-count |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
513 (1+ bookmark-alist-modification-count)) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
514 (if (bookmark-time-to-save-p) |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
515 (bookmark-save)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
516 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
517 (setq bookmark-current-bookmark stripped-name) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
518 (bookmark-bmenu-surreptitiously-rebuild-list))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
519 |
109395
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
520 (defun bookmark-make-record-default (&optional no-file no-context posn) |
92674
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
521 "Return the record describing the location of a new bookmark. |
109395
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
522 Point should be at the buffer in which the bookmark is being set, |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
523 and normally should be at the position where the bookmark is desired, |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
524 but see the optional arguments for other possibilities. |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
525 |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
526 If NO-FILE is non-nil, then only return the subset of the |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
527 record that pertains to the location within the buffer, leaving off |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
528 the part that records the filename. |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
529 |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
530 If NO-CONTEXT is non-nil, do not include the front- and rear-context |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
531 strings in the record -- the position is enough. |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
532 |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
533 If POSN is non-nil, record POSN as the point instead of `(point)'." |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
534 `(,@(unless no-file `((filename . ,(bookmark-buffer-file-name)))) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
535 ,@(unless no-context `((front-context-string |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
536 . ,(if (>= (- (point-max) (point)) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
537 bookmark-search-size) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
538 (buffer-substring-no-properties |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
539 (point) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
540 (+ (point) bookmark-search-size)) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
541 nil)))) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
542 ,@(unless no-context `((rear-context-string |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
543 . ,(if (>= (- (point) (point-min)) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
544 bookmark-search-size) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
545 (buffer-substring-no-properties |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
546 (point) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
547 (- (point) bookmark-search-size)) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
548 nil)))) |
fa4400531412
Preparation for setting bookmarks in Gnus article buffers (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109384
diff
changeset
|
549 (position . ,(or posn (point))))) |
35283 | 550 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
551 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
552 ;;; File format stuff |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
553 |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
554 ;; *IMPORTANT NOTICE* If you are thinking about modifying (redefining) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
555 ;; the bookmark file format -- please don't. The current format |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
556 ;; should be extensible enough. If you feel the need to change it, |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
557 ;; please discuss it with other Emacs developers first. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
558 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
559 ;; The format of `bookmark-alist' has changed twice in its lifetime. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
560 ;; This comment describes the three formats, FIRST, SECOND, and |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
561 ;; CURRENT. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
562 ;; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
563 ;; The FIRST format was used prior to Emacs 20: |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
564 ;; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
565 ;; ((BOOKMARK-NAME (FILENAME |
93705
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
566 ;; STRING-IN-FRONT |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
567 ;; STRING-BEHIND |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
568 ;; POINT)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
569 ;; ...) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
570 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
571 ;; The SECOND format was introduced in Emacs 20: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
572 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
573 ;; ((BOOKMARK-NAME ((filename . FILENAME) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
574 ;; (position . POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
575 ;; (front-context-string . STR-AFTER-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
576 ;; (rear-context-string . STR-BEFORE-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
577 ;; (annotation . ANNOTATION) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
578 ;; (whatever . VALUE) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
579 ;; ... |
93705
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
580 ;; )) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
581 ;; ...) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
582 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
583 ;; The CURRENT format was introduced in Emacs 22: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
584 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
585 ;; ((BOOKMARK-NAME (filename . FILENAME) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
586 ;; (position . POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
587 ;; (front-context-string . STR-AFTER-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
588 ;; (rear-context-string . STR-BEFORE-POS) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
589 ;; (annotation . ANNOTATION) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
590 ;; (whatever . VALUE) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
591 ;; ... |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
592 ;; ) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
593 ;; ...) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
594 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
595 ;; Both FIRST and SECOND have the same level of nesting: the cadr of a |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
596 ;; bookmark record is a list of entry information. FIRST and SECOND |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
597 ;; differ in the form of the record information: FIRST uses a list of |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
598 ;; atoms, and SECOND uses an alist. In the FIRST format, the order of |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
599 ;; the list elements matters. In the SECOND format, the order of the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
600 ;; alist elements is unimportant. The SECOND format facilitates the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
601 ;; addition of new kinds of elements, to support new kinds of |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
602 ;; bookmarks or code evolution. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
603 ;; |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
604 ;; The CURRENT format removes a level of nesting wrt FIRST and SECOND, |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
605 ;; saving one cons cell per bookmark: the cadr of a bookmark record is |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
606 ;; no longer a cons. Why that change was made remains a mystery -- |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
607 ;; just be aware of it. (Be aware too that this explanatory comment |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
608 ;; was incorrect in Emacs 22 and Emacs 23.1.) |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
609 ;; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
610 ;; To deal with the change from FIRST format to SECOND, conversion |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
611 ;; code was added, and it is still in use. See |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
612 ;; `bookmark-maybe-upgrade-file-format'. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
613 ;; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
614 ;; No conversion from SECOND to CURRENT is done. Instead, the code |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
615 ;; handles both formats OK. It must continue to do so. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
616 ;; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
617 ;; See the doc string of `bookmark-alist' for information about the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
618 ;; elements that define a bookmark (e.g. `filename'). |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
619 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
620 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
621 (defconst bookmark-file-format-version 1 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
622 "The current version of the format used by bookmark files. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
623 You should never need to change this.") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
624 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
625 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
626 (defconst bookmark-end-of-version-stamp-marker |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
627 "-*- End Of Bookmark File Format Version Stamp -*-\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
628 "This string marks the end of the version stamp in a bookmark file.") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
629 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
630 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
631 (defun bookmark-alist-from-buffer () |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
632 "Return a `bookmark-alist' (in any format) from the current buffer. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
633 The buffer must of course contain bookmark format information. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
634 Does not care from where in the buffer it is called, and does not |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
635 affect point." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
636 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
637 (goto-char (point-min)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
638 (if (search-forward bookmark-end-of-version-stamp-marker nil t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
639 (read (current-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
640 ;; Else we're dealing with format version 0 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
641 (if (search-forward "(" nil t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
642 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
643 (forward-char -1) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
644 (read (current-buffer))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
645 ;; Else no hope of getting information here. |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
646 (error "Not bookmark format"))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
647 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
648 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
649 (defun bookmark-upgrade-version-0-alist (old-list) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
650 "Upgrade a version 0 alist OLD-LIST to the current version." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
651 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
652 (lambda (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
653 (let* ((name (car bookmark)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
654 (record (car (cdr bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
655 (filename (nth 0 record)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
656 (front-str (nth 1 record)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
657 (rear-str (nth 2 record)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
658 (position (nth 3 record)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
659 (ann (nth 4 record))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
660 (list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
661 name |
41608
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
662 `((filename . ,filename) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
663 (front-context-string . ,(or front-str "")) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
664 (rear-context-string . ,(or rear-str "")) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
665 (position . ,position) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
666 (annotation . ,ann))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
667 old-list)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
668 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
669 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
670 (defun bookmark-upgrade-file-format-from-0 () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
671 "Upgrade a bookmark file of format 0 (the original format) to format 1. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
672 This expects to be called from `point-min' in a bookmark file." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
673 (message "Upgrading bookmark format from 0 to %d..." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
674 bookmark-file-format-version) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
675 (let* ((old-list (bookmark-alist-from-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
676 (new-list (bookmark-upgrade-version-0-alist old-list))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
677 (delete-region (point-min) (point-max)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
678 (bookmark-insert-file-format-version-stamp) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
679 (pp new-list (current-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
680 (save-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
681 (goto-char (point-min)) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
682 (message "Upgrading bookmark format from 0 to %d...done" |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
683 bookmark-file-format-version) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
684 ) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
685 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
686 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
687 (defun bookmark-grok-file-format-version () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
688 "Return an integer which is the file-format version of this bookmark file. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
689 This expects to be called from `point-min' in a bookmark file." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
690 (if (looking-at "^;;;;") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
691 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
692 (save-match-data |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
693 (re-search-forward "[0-9]") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
694 (forward-char -1) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
695 (read (current-buffer)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
696 ;; Else this is format version 0, the original one, which didn't |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
697 ;; even have version stamps. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
698 0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
699 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
700 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
701 (defun bookmark-maybe-upgrade-file-format () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
702 "Check the file-format version of this bookmark file. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
703 If the version is not up-to-date, upgrade it automatically. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
704 This expects to be called from `point-min' in a bookmark file." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
705 (let ((version (bookmark-grok-file-format-version))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
706 (cond |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
707 ((= version bookmark-file-format-version) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
708 ) ; home free -- version is current |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
709 ((= version 0) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
710 (bookmark-upgrade-file-format-from-0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
711 (t |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
712 (error "Bookmark file format version strangeness"))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
713 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
714 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
715 (defun bookmark-insert-file-format-version-stamp () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
716 "Insert text indicating current version of bookmark file format." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
717 (insert |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
718 (format ";;;; Emacs Bookmark Format Version %d ;;;;\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
719 bookmark-file-format-version)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
720 (insert ";;; This format is meant to be slightly human-readable;\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
721 ";;; nevertheless, you probably don't want to edit it.\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
722 ";;; " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
723 bookmark-end-of-version-stamp-marker)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
724 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
725 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
726 ;;; end file-format stuff |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
727 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
728 |
66835
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
729 ;;; Generic helpers. |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
730 |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
731 (defun bookmark-maybe-message (fmt &rest args) |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
732 "Apply `message' to FMT and ARGS, but only if the display is fast enough." |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
733 (if (>= baud-rate 9600) |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
734 (apply 'message fmt args))) |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
735 |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
736 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
737 ;;; Core code: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
738 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
739 (defvar bookmark-minibuffer-read-name-map |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
740 (let ((map (make-sparse-keymap))) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
741 (set-keymap-parent map minibuffer-local-map) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
742 (define-key map "\C-w" 'bookmark-yank-word) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
743 ;; This C-u binding might not be very useful any more now that we |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
744 ;; provide access to the default via the standard M-n binding. |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
745 ;; Maybe we should just remove it? --Stef-08 |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
746 (define-key map "\C-u" 'bookmark-insert-current-bookmark) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
747 map)) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
748 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
749 ;;;###autoload |
105445 | 750 (defun bookmark-set (&optional name no-overwrite) |
105446
0532c364480a
* bookmark.el (bookmark-set, bookmark-buffer-name): Improve doc strings.
Karl Fogel <kfogel@red-bean.com>
parents:
105445
diff
changeset
|
751 "Set a bookmark named NAME at the current location. |
105445 | 752 If name is nil, then prompt the user. |
753 | |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
754 With a prefix arg (non-nil NO-OVERWRITE), do not overwrite any |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
755 existing bookmark that has the same name as NAME, but instead push the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
756 new bookmark onto the bookmark alist. The most recently set bookmark |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
757 with name NAME is thus the one in effect at any given time, but the |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
758 others are still there, should the user decide to delete the most |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
759 recent one. |
4537 | 760 |
761 To yank words from the text of the buffer and use them as part of the | |
4633 | 762 bookmark name, type C-w while setting a bookmark. Successive C-w's |
4537 | 763 yank successive words. |
764 | |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
765 Typing C-u inserts (at the bookmark name prompt) the name of the last |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
766 bookmark used in the document where the new bookmark is being set; |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
767 this helps you use a single bookmark name to track progress through a |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
768 large document. If there is no prior bookmark for this document, then |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
769 C-u inserts an appropriate name based on the buffer or file. |
4537 | 770 |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
771 Use \\[bookmark-delete] to remove bookmarks (you give it a name and |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
772 it removes only the first instance of a bookmark with that name from |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
773 the list of bookmarks.)" |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
774 (interactive (list nil current-prefix-arg)) |
109397
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
775 (unwind-protect |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
776 (let* ((record (bookmark-make-record)) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
777 (default (car record))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
778 |
109397
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
779 (bookmark-maybe-load-default-file) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
780 ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer' |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
781 ;; if they have been already set in another buffer. (e.g gnus-art). |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
782 (unless (and bookmark-yank-point |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
783 bookmark-current-buffer) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
784 (setq bookmark-yank-point (point)) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
785 (setq bookmark-current-buffer (current-buffer))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
786 |
109397
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
787 (let ((str |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
788 (or name |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
789 (read-from-minibuffer |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
790 (format "Set bookmark (%s): " default) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
791 nil |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
792 bookmark-minibuffer-read-name-map |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
793 nil nil default)))) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
794 (and (string-equal str "") (setq str default)) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
795 (bookmark-store str (cdr record) no-overwrite) |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
796 |
109397
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
797 ;; Ask for an annotation buffer for this bookmark |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
798 (when bookmark-use-annotations |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
799 (bookmark-edit-annotation str)))) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
800 (setq bookmark-yank-point nil) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
801 (setq bookmark-current-buffer nil))) |
4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
Karl Fogel <kfogel@red-bean.com>
parents:
109395
diff
changeset
|
802 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
803 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
804 (defun bookmark-kill-line (&optional newline-too) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
805 "Kill from point to end of line. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
806 If optional arg NEWLINE-TOO is non-nil, delete the newline too. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
807 Does not affect the kill ring." |
111429
249a1455856a
Use line-end-position rather than end-of-line, etc.
Glenn Morris <rgm@gnu.org>
parents:
109399
diff
changeset
|
808 (let ((eol (line-end-position))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
809 (delete-region (point) eol) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
810 (if (and newline-too (looking-at "\n")) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
811 (delete-char 1)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
812 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
813 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
814 ;; Defvars to avoid compilation warnings: |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
815 (defvar bookmark-annotation-name nil |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
816 "Variable holding the name of the bookmark. |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
817 This is used in `bookmark-edit-annotation' to record the bookmark |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
818 whose annotation is being edited.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
819 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
820 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
821 (defun bookmark-default-annotation-text (bookmark-name) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
822 "Return default annotation text for BOOKMARK-NAME. |
105445 | 823 The default annotation text is simply some text explaining how to use |
824 annotations." | |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
825 (concat "# Type the annotation for bookmark '" bookmark-name "' here.\n" |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
826 "# All lines which start with a '#' will be deleted.\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
827 "# Type C-c C-c when done.\n#\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
828 "# Author: " (user-full-name) " <" (user-login-name) "@" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
829 (system-name) ">\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
830 "# Date: " (current-time-string) "\n")) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
831 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
832 |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
833 (defvar bookmark-edit-annotation-text-func 'bookmark-default-annotation-text |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
834 "Function to return default text to use for a bookmark annotation. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
835 It takes one argument, the name of the bookmark, as a string.") |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
836 (define-obsolete-variable-alias 'bookmark-read-annotation-text-func |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
837 'bookmark-edit-annotation-text-func "23.1") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
838 |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
839 (defvar bookmark-edit-annotation-mode-map |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
840 (let ((map (make-sparse-keymap))) |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
841 (set-keymap-parent map text-mode-map) |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
842 (define-key map "\C-c\C-c" 'bookmark-send-edited-annotation) |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
843 map) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
844 "Keymap for editing an annotation of a bookmark.") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
845 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
846 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
847 (defun bookmark-edit-annotation-mode (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
848 "Mode for editing the annotation of bookmark BOOKMARK-NAME-OR-RECORD. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
849 When you have finished composing, type \\[bookmark-send-annotation]. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
850 |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
851 \\{bookmark-edit-annotation-mode-map}" |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
852 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
853 (kill-all-local-variables) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
854 (make-local-variable 'bookmark-annotation-name) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
855 (setq bookmark-annotation-name bookmark-name-or-record) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
856 (use-local-map bookmark-edit-annotation-mode-map) |
54906
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
857 (setq major-mode 'bookmark-edit-annotation-mode |
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
858 mode-name "Edit Bookmark Annotation") |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
859 (insert (funcall bookmark-edit-annotation-text-func bookmark-name-or-record)) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
860 (let ((annotation (bookmark-get-annotation bookmark-name-or-record))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
861 (if (and annotation (not (string-equal annotation ""))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
862 (insert annotation))) |
62718
d00be6e651cd
(bookmark-read-annotation-mode, bookmark-edit-annotation-mode)
Lute Kamstra <lute@gnu.org>
parents:
61454
diff
changeset
|
863 (run-mode-hooks 'text-mode-hook)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
864 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
865 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
866 (defun bookmark-send-edited-annotation () |
54906
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
867 "Use buffer contents as annotation for a bookmark. |
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
868 Lines beginning with `#' are ignored." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
869 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
870 (if (not (eq major-mode 'bookmark-edit-annotation-mode)) |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
871 (error "Not in bookmark-edit-annotation-mode")) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
872 (goto-char (point-min)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
873 (while (< (point) (point-max)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
874 (if (looking-at "^#") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
875 (bookmark-kill-line t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
876 (forward-line 1))) |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
877 ;; Take no chances with text properties. |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
878 (let ((annotation (buffer-substring-no-properties (point-min) (point-max))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
879 (bookmark-name bookmark-annotation-name)) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
880 (bookmark-set-annotation bookmark-name annotation) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
881 (setq bookmark-alist-modification-count |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
882 (1+ bookmark-alist-modification-count)) |
105540 | 883 (bookmark-bmenu-surreptitiously-rebuild-list)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
884 (kill-buffer (current-buffer))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
885 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
886 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
887 (defun bookmark-edit-annotation (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
888 "Pop up a buffer for editing bookmark BOOKMARK-NAME-OR-RECORD's annotation." |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
889 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
890 (bookmark-edit-annotation-mode bookmark-name-or-record)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
891 |
4537 | 892 |
893 (defun bookmark-insert-current-bookmark () | |
105541 | 894 "Insert into the bookmark name currently being set the value of |
895 `bookmark-current-bookmark' in `bookmark-current-buffer', defaulting | |
896 to the buffer's file name if `bookmark-current-bookmark' is nil." | |
4537 | 897 (interactive) |
898 (let ((str | |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
899 (with-current-buffer bookmark-current-buffer |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
900 (or bookmark-current-bookmark |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
901 (bookmark-buffer-name))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
902 (insert str))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
903 |
4537 | 904 |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
905 (defun bookmark-buffer-name () |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
906 "Return the name of the current buffer in a form usable as a bookmark name. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
907 If the buffer is associated with a file or directory, use that name." |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
908 (cond |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
909 ;; Or are we a file? |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
910 (buffer-file-name (file-name-nondirectory buffer-file-name)) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
911 ;; Or are we a directory? |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
912 ((and (boundp 'dired-directory) dired-directory) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
913 (let* ((dirname (if (stringp dired-directory) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
914 dired-directory |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
915 (car dired-directory))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
916 (idx (1- (length dirname)))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
917 ;; Strip the trailing slash. |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
918 (if (= ?/ (aref dirname idx)) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
919 (file-name-nondirectory (substring dirname 0 idx)) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
920 ;; Else return the current-buffer |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
921 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
922 ;; If all else fails, use the buffer's name. |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
923 (t |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
924 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
925 |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
926 |
4537 | 927 (defun bookmark-yank-word () |
105541 | 928 "Get the next word from buffer `bookmark-current-buffer' and append |
929 it to the name of the bookmark currently being set, advancing | |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
930 `bookmark-yank-point' by one word." |
4537 | 931 (interactive) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
932 (let ((string (with-current-buffer bookmark-current-buffer |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
933 (goto-char bookmark-yank-point) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
934 (buffer-substring-no-properties |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
935 (point) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
936 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
937 (forward-word 1) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
938 (setq bookmark-yank-point (point))))))) |
4537 | 939 (insert string))) |
940 | |
941 (defun bookmark-buffer-file-name () | |
92789
61c661dac856
(Info-current-node): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92690
diff
changeset
|
942 "Return the current buffer's file in a way useful for bookmarks." |
99773
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
943 ;; Abbreviate the path, both so it's shorter and so it's more |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
944 ;; portable. E.g., the user's home dir might be a different |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
945 ;; path on different machines, but "~/" will still reach it. |
100171 | 946 (abbreviate-file-name |
99773
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
947 (cond |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
948 (buffer-file-name buffer-file-name) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
949 ((and (boundp 'dired-directory) dired-directory) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
950 (if (stringp dired-directory) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
951 dired-directory |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
952 (car dired-directory))) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
953 (t (error "Buffer not visiting a file or directory"))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
954 |
4537 | 955 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
956 (defun bookmark-maybe-load-default-file () |
105445 | 957 "If bookmarks have not been loaded from the default place, load them." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
958 (and (not bookmarks-already-loaded) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
959 (null bookmark-alist) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
960 (prog2 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
961 (and |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
962 ;; Possibly the old bookmark file, "~/.emacs-bkmrks", needs |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
963 ;; to be renamed. |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
964 (file-exists-p bookmark-old-default-file) |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
965 (not (file-exists-p bookmark-default-file)) |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
966 (rename-file bookmark-old-default-file |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
967 bookmark-default-file)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
968 ;; return t so the `and' will continue... |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
969 t) |
35283 | 970 |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
971 (file-readable-p bookmark-default-file) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
972 (bookmark-load bookmark-default-file t t) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
973 (setq bookmarks-already-loaded t))) |
4631 | 974 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
975 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
976 (defun bookmark-maybe-sort-alist () |
105445 | 977 "Return `bookmark-alist' for display. |
978 If `bookmark-sort-flag' is non-nil, then return a sorted copy of the alist." | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
979 (if bookmark-sort-flag |
78160
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
980 (sort (copy-alist bookmark-alist) |
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
981 (function |
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
982 (lambda (x y) (string-lessp (car x) (car y))))) |
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
983 bookmark-alist)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
984 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
985 |
65087
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
986 (defvar bookmark-after-jump-hook nil |
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
987 "Hook run after `bookmark-jump' jumps to a bookmark. |
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
988 Useful for example to unhide text in `outline-mode'.") |
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
989 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
990 (defun bookmark--jump-via (bookmark-name-or-record display-function) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
991 "Handle BOOKMARK-NAME-OR-RECORD, then call DISPLAY-FUNCTION with |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
992 current buffer as argument. |
105445 | 993 |
994 After calling DISPLAY-FUNCTION, set window point to the point specified | |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
995 by BOOKMARK-NAME-OR-RECORD, if necessary, run `bookmark-after-jump-hook', |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
996 and then show any annotations for this bookmark." |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
997 (bookmark-handle-bookmark bookmark-name-or-record) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
998 (save-current-buffer |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
999 (funcall display-function (current-buffer))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1000 (let ((win (get-buffer-window (current-buffer) 0))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1001 (if win (set-window-point win (point)))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1002 ;; FIXME: we used to only run bookmark-after-jump-hook in |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1003 ;; `bookmark-jump' itself, but in none of the other commands. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1004 (run-hooks 'bookmark-after-jump-hook) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1005 (if bookmark-automatically-show-annotations |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1006 ;; if there is an annotation for this bookmark, |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1007 ;; show it in a buffer. |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1008 (bookmark-show-annotation bookmark-name-or-record))) |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
1009 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1010 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1011 ;;;###autoload |
105530
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1012 (defun bookmark-jump (bookmark &optional display-func) |
35283 | 1013 "Jump to bookmark BOOKMARK (a point in some file). |
4633 | 1014 You may have a problem using this function if the value of variable |
1015 `bookmark-alist' is nil. If that happens, you need to load in some | |
1016 bookmarks. See help on function `bookmark-load' for more about | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1017 this. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1018 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1019 If the file pointed to by BOOKMARK no longer exists, you will be asked |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1020 if you wish to give the bookmark a new location, and `bookmark-jump' |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1021 will then jump to the new location, as well as recording it in place |
105445 | 1022 of the old one in the permanent bookmark record. |
1023 | |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1024 BOOKMARK is usually a bookmark name (a string). It can also be a |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1025 bookmark record, but this is usually only done by programmatic callers. |
105530
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1026 |
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1027 If DISPLAY-FUNC is non-nil, it is a function to invoke to display the |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1028 bookmark. It defaults to `switch-to-buffer'. A typical value for |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1029 DISPLAY-FUNC would be `switch-to-buffer-other-window'." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1030 (interactive |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1031 (list (bookmark-completing-read "Jump to bookmark" |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1032 bookmark-current-bookmark))) |
59133
55f8ffb8e523
(bookmark-jump): Nice error if BOOKMARK is nil.
Richard M. Stallman <rms@gnu.org>
parents:
56059
diff
changeset
|
1033 (unless bookmark |
55f8ffb8e523
(bookmark-jump): Nice error if BOOKMARK is nil.
Richard M. Stallman <rms@gnu.org>
parents:
56059
diff
changeset
|
1034 (error "No bookmark specified")) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1035 (bookmark-maybe-historicize-string bookmark) |
105530
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1036 (bookmark--jump-via bookmark (or display-func 'switch-to-buffer))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1037 |
4537 | 1038 |
81844
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
1039 ;;;###autoload |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
1040 (defun bookmark-jump-other-window (bookmark) |
105445 | 1041 "Jump to BOOKMARK in another window. See `bookmark-jump' for more." |
81844
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
1042 (interactive |
105530
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1043 (list (bookmark-completing-read "Jump to bookmark (in another window)" |
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1044 bookmark-current-bookmark))) |
e5035c6df58d
* lisp/bookmark.el (bookmark-jump): Add new `display-func' parameter.
Karl Fogel <kfogel@red-bean.com>
parents:
105449
diff
changeset
|
1045 (bookmark-jump bookmark 'switch-to-buffer-other-window)) |
81844
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
1046 |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
1047 |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
1048 (defun bookmark-jump-noselect (bookmark) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1049 "Return the location pointed to by BOOKMARK (see `bookmark-jump'). |
99725
d067d683a1bc
(bookmark-jump-noselect): Move the deprecation notice into the doc
Karl Fogel <kfogel@red-bean.com>
parents:
99228
diff
changeset
|
1050 The return value has the form (BUFFER . POINT). |
d067d683a1bc
(bookmark-jump-noselect): Move the deprecation notice into the doc
Karl Fogel <kfogel@red-bean.com>
parents:
99228
diff
changeset
|
1051 |
d067d683a1bc
(bookmark-jump-noselect): Move the deprecation notice into the doc
Karl Fogel <kfogel@red-bean.com>
parents:
99228
diff
changeset
|
1052 Note: this function is deprecated and is present for Emacs 22 |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
1053 compatibility only." |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1054 (save-excursion |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1055 (bookmark-handle-bookmark bookmark) |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1056 (cons (current-buffer) (point)))) |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1057 |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
1058 (make-obsolete 'bookmark-jump-noselect 'bookmark-handle-bookmark "23.1") |
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
1059 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1060 (defun bookmark-handle-bookmark (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1061 "Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler' |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1062 if it has none. This changes current buffer and point and returns nil, |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1063 or signals a `file-error'. |
105445 | 1064 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1065 If BOOKMARK-NAME-OR-RECORD has no file, this is a no-op. If |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1066 BOOKMARK-NAME-OR-RECORD has a file, but that file no longer exists, |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1067 then offer interactively to relocate BOOKMARK-NAME-OR-RECORD." |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1068 (condition-case err |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1069 (funcall (or (bookmark-get-handler bookmark-name-or-record) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1070 'bookmark-default-handler) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1071 (bookmark-get-bookmark bookmark-name-or-record)) |
107125
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1072 (bookmark-error-no-filename ;file-error |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1073 ;; We were unable to find the marked file, so ask if user wants to |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1074 ;; relocate the bookmark, else remind them to consider deletion. |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1075 (when (stringp bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1076 ;; `bookmark-name-or-record' can be either a bookmark name |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1077 ;; (from `bookmark-alist') or a bookmark object. If it's an |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1078 ;; object, we assume it's a bookmark used internally by some |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1079 ;; other package. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1080 (let ((file (bookmark-get-filename bookmark-name-or-record))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1081 (when file ;Don't know how to relocate if there's no `file'. |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1082 ;; If file is not a dir, directory-file-name just returns file. |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1083 (let ((display-name (directory-file-name file))) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1084 (ding) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1085 ;; Dialog boxes can accept a file target, but usually don't |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1086 ;; know how to accept a directory target (at least, this |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1087 ;; is true in Gnome on GNU/Linux, and Bug#4230 says it's |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1088 ;; true on Windows as well). So we suppress file dialogs |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1089 ;; when relocating. |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1090 (let ((use-dialog-box nil) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1091 (use-file-dialog nil)) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1092 (if (y-or-n-p (concat display-name " nonexistent. Relocate \"" |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1093 bookmark-name-or-record "\"? ")) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1094 (progn |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1095 (bookmark-relocate bookmark-name-or-record) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1096 ;; Try again. |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1097 (funcall (or (bookmark-get-handler bookmark-name-or-record) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1098 'bookmark-default-handler) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1099 (bookmark-get-bookmark bookmark-name-or-record))) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1100 (message |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1101 "Bookmark not relocated; consider removing it (%s)." |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1102 bookmark-name-or-record) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1103 (signal (car err) (cdr err)))))))))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1104 ;; Added by db. |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1105 (when (stringp bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1106 (setq bookmark-current-bookmark bookmark-name-or-record)) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1107 nil) |
28013
b8291d86b5fd
(bookmark-file-or-variation-thereof): New func, for
Gerd Moellmann <gerd@gnu.org>
parents:
26773
diff
changeset
|
1108 |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1109 (put 'bookmark-error-no-filename |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1110 'error-conditions |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1111 '(error bookmark-errors bookmark-error-no-filename)) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1112 (put 'bookmark-error-no-filename |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1113 'error-message |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1114 "Bookmark has no associated file (or directory)") |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1115 |
105445 | 1116 (defun bookmark-default-handler (bmk-record) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1117 "Default handler to jump to a particular bookmark location. |
105445 | 1118 BMK-RECORD is a bookmark record, not a bookmark name (i.e., not a string). |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1119 Changes current buffer and point and returns nil, or signals a `file-error'." |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1120 (let ((file (bookmark-get-filename bmk-record)) |
107125
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1121 (buf (bookmark-prop-get bmk-record 'buffer)) |
105449
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1122 (forward-str (bookmark-get-front-context-string bmk-record)) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1123 (behind-str (bookmark-get-rear-context-string bmk-record)) |
4d75e3e0f1ea
* bookmark.el (bookmark-handle-bookmark): If bookmark has no file,
Karl Fogel <kfogel@red-bean.com>
parents:
105448
diff
changeset
|
1124 (place (bookmark-get-position bmk-record))) |
107125
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1125 (set-buffer |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1126 (cond |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1127 ((and file (file-readable-p file) (not (buffer-live-p buf))) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1128 (find-file-noselect file)) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1129 ;; No file found. See if buffer BUF have been created. |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1130 ((and buf (get-buffer buf))) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1131 (t ;; If not, raise error. |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1132 (signal 'bookmark-error-no-filename (list 'stringp file))))) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1133 (if place (goto-char place)) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1134 ;; Go searching forward first. Then, if forward-str exists and |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1135 ;; was found in the file, we can search backward for behind-str. |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1136 ;; Rationale is that if text was inserted between the two in the |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1137 ;; file, it's better to be put before it so you can read it, |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1138 ;; rather than after and remain perhaps unaware of the changes. |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1139 (when (and forward-str (search-forward forward-str (point-max) t)) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1140 (goto-char (match-beginning 0))) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1141 (when (and behind-str (search-backward behind-str (point-min) t)) |
063e00f61d0f
(bookmark-handle-bookmark): Catch the right error.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106821
diff
changeset
|
1142 (goto-char (match-end 0))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1143 nil)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1144 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1145 ;;;###autoload |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1146 (defun bookmark-relocate (bookmark-name) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1147 "Relocate BOOKMARK-NAME to another file, reading file name with minibuffer. |
105445 | 1148 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1149 This makes an already existing bookmark point to that file, instead of |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1150 the one it used to point at. Useful when a file has been renamed |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1151 after a bookmark was set in it." |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1152 (interactive (list (bookmark-completing-read "Bookmark to relocate"))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1153 (bookmark-maybe-historicize-string bookmark-name) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1154 (bookmark-maybe-load-default-file) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1155 (let* ((bmrk-filename (bookmark-get-filename bookmark-name)) |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1156 (newloc (abbreviate-file-name |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1157 (expand-file-name |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1158 (read-file-name |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1159 (format "Relocate %s to: " bookmark-name) |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1160 (file-name-directory bmrk-filename)))))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1161 (bookmark-set-filename bookmark-name newloc) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1162 (setq bookmark-alist-modification-count |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1163 (1+ bookmark-alist-modification-count)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1164 (if (bookmark-time-to-save-p) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1165 (bookmark-save)) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1166 (bookmark-bmenu-surreptitiously-rebuild-list))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1167 |
4537 | 1168 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1169 ;;;###autoload |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1170 (defun bookmark-insert-location (bookmark-name &optional no-history) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1171 "Insert the name of the file associated with BOOKMARK-NAME. |
105445 | 1172 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1173 Optional second arg NO-HISTORY means don't record this in the |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1174 minibuffer history list `bookmark-history'." |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1175 (interactive (list (bookmark-completing-read "Insert bookmark location"))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1176 (or no-history (bookmark-maybe-historicize-string bookmark-name)) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1177 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1178 (prog1 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1179 (insert (bookmark-location bookmark-name)) |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1180 (if (display-mouse-p) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1181 (add-text-properties |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1182 start |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1183 (save-excursion (re-search-backward |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1184 "[^ \t]") |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1185 (1+ (point))) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1186 '(mouse-face highlight |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1187 follow-link t |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1188 help-echo "mouse-2: go to this bookmark in other window")))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1189 |
15189
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1190 ;;;###autoload |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
1191 (defalias 'bookmark-locate 'bookmark-insert-location) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1192 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1193 (defun bookmark-location (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1194 "Return a description of the location of BOOKMARK-NAME-OR-RECORD." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1195 (bookmark-maybe-load-default-file) |
107855
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107840
diff
changeset
|
1196 ;; We could call the `handler' and ask for it to construct a description |
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107840
diff
changeset
|
1197 ;; dynamically: it would open up several new possibilities, but it |
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107840
diff
changeset
|
1198 ;; would have the major disadvantage of forcing to load each and |
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107840
diff
changeset
|
1199 ;; every handler when the user calls bookmark-menu. |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1200 (or (bookmark-prop-get bookmark-name-or-record 'location) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1201 (bookmark-get-filename bookmark-name-or-record) |
107855
d9895f87d758
Add a new field `location' to bookmarks for non-file bookmarks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107840
diff
changeset
|
1202 "-- Unknown location --")) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1203 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1204 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1205 ;;;###autoload |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1206 (defun bookmark-rename (old-name &optional new-name) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1207 "Change the name of OLD-NAME bookmark to NEW-NAME name. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1208 If called from keyboard, prompt for OLD-NAME and NEW-NAME. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1209 If called from menubar, select OLD-NAME from a menu and prompt for NEW-NAME. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1210 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1211 If called from Lisp, prompt for NEW-NAME if only OLD-NAME was passed |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1212 as an argument. If called with two strings, then no prompting is done. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1213 You must pass at least OLD-NAME when calling from Lisp. |
4633 | 1214 |
1215 While you are entering the new name, consecutive C-w's insert | |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
1216 consecutive words from the text of the buffer into the new bookmark |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1217 name." |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1218 (interactive (list (bookmark-completing-read "Old bookmark name"))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1219 (bookmark-maybe-historicize-string old-name) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1220 (bookmark-maybe-load-default-file) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1221 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1222 (setq bookmark-yank-point (point)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1223 (setq bookmark-current-buffer (current-buffer)) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1224 (let ((final-new-name |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1225 (or new-name ; use second arg, if non-nil |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1226 (read-from-minibuffer |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1227 "New name: " |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1228 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1229 (let ((now-map (copy-keymap minibuffer-local-map))) |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1230 (define-key now-map "\C-w" 'bookmark-yank-word) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1231 now-map) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1232 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1233 'bookmark-history)))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1234 (bookmark-set-name old-name final-new-name) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1235 (setq bookmark-current-bookmark final-new-name) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1236 (bookmark-bmenu-surreptitiously-rebuild-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1237 (setq bookmark-alist-modification-count |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1238 (1+ bookmark-alist-modification-count)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1239 (if (bookmark-time-to-save-p) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1240 (bookmark-save)))) |
4537 | 1241 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1242 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1243 ;;;###autoload |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1244 (defun bookmark-insert (bookmark-name) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1245 "Insert the text of the file pointed to by bookmark BOOKMARK-NAME. |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1246 BOOKMARK-NAME is a bookmark name (a string), not a bookmark record. |
105445 | 1247 |
4633 | 1248 You may have a problem using this function if the value of variable |
1249 `bookmark-alist' is nil. If that happens, you need to load in some | |
1250 bookmarks. See help on function `bookmark-load' for more about | |
4631 | 1251 this." |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1252 (interactive (list (bookmark-completing-read "Insert bookmark contents"))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1253 (bookmark-maybe-historicize-string bookmark-name) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1254 (bookmark-maybe-load-default-file) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1255 (let ((orig-point (point)) |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
1256 (str-to-insert |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1257 (save-current-buffer |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1258 (bookmark-handle-bookmark bookmark-name) |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
1259 (buffer-string)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1260 (insert str-to-insert) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1261 (push-mark) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1262 (goto-char orig-point))) |
4537 | 1263 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1264 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1265 ;;;###autoload |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1266 (defun bookmark-delete (bookmark-name &optional batch) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1267 "Delete BOOKMARK-NAME from the bookmark list. |
105445 | 1268 |
4633 | 1269 Removes only the first instance of a bookmark with that name. If |
1270 there are one or more other bookmarks with the same name, they will | |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1271 not be deleted. Defaults to the \"current\" bookmark (that is, the |
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1272 one most recently used in this file, if any). |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1273 Optional second arg BATCH means don't update the bookmark list buffer, |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1274 probably because we were called from there." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1275 (interactive |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1276 (list (bookmark-completing-read "Delete bookmark" |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1277 bookmark-current-bookmark))) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1278 (bookmark-maybe-historicize-string bookmark-name) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1279 (bookmark-maybe-load-default-file) |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1280 (let ((will-go (bookmark-get-bookmark bookmark-name 'noerror))) |
4595 | 1281 (setq bookmark-alist (delq will-go bookmark-alist)) |
1282 ;; Added by db, nil bookmark-current-bookmark if the last | |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
1283 ;; occurrence has been deleted |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
1284 (or (bookmark-get-bookmark bookmark-current-bookmark 'noerror) |
4595 | 1285 (setq bookmark-current-bookmark nil))) |
105532
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1286 (unless batch |
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1287 (bookmark-bmenu-surreptitiously-rebuild-list)) |
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1288 (setq bookmark-alist-modification-count |
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1289 (1+ bookmark-alist-modification-count)) |
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1290 (when (bookmark-time-to-save-p) |
cb911fe6af8f
* lisp/bookmark.el (bookmark-delete): Don't let batch arg prevent saving.
Karl Fogel <kfogel@red-bean.com>
parents:
105530
diff
changeset
|
1291 (bookmark-save))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1292 |
4537 | 1293 |
105445 | 1294 (defun bookmark-time-to-save-p (&optional final-time) |
1295 "Return t if it is time to save bookmarks to disk, nil otherwise. | |
1296 Optional argument FINAL-TIME means this is being called when Emacs | |
1297 is being killed, so save even if `bookmark-save-flag' is a number and | |
1298 is greater than `bookmark-alist-modification-count'." | |
1299 ;; By Gregory M. Saunders <saunders{_AT_}cis.ohio-state.edu> | |
1300 (cond (final-time | |
4537 | 1301 (and (> bookmark-alist-modification-count 0) |
1302 bookmark-save-flag)) | |
1303 ((numberp bookmark-save-flag) | |
1304 (>= bookmark-alist-modification-count bookmark-save-flag)) | |
1305 (t | |
1306 nil))) | |
1307 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1308 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1309 ;;;###autoload |
4537 | 1310 (defun bookmark-write () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1311 "Write bookmarks to a file (reading the file name with the minibuffer). |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1312 Don't use this in Lisp programs; use `bookmark-save' instead." |
4537 | 1313 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1314 (bookmark-maybe-load-default-file) |
4537 | 1315 (bookmark-save t)) |
1316 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1317 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1318 ;;;###autoload |
35283 | 1319 (defun bookmark-save (&optional parg file) |
4633 | 1320 "Save currently defined bookmarks. |
1321 Saves by default in the file defined by the variable | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1322 `bookmark-default-file'. With a prefix arg, save it in file FILE |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1323 \(second argument). |
4537 | 1324 |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1325 If you are calling this from Lisp, the two arguments are PARG and |
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1326 FILE, and if you just want it to write to the default file, then |
4537 | 1327 pass no arguments. Or pass in nil and FILE, and it will save in FILE |
1328 instead. If you pass in one argument, and it is non-nil, then the | |
1329 user will be interactively queried for a file to save in. | |
1330 | |
4595 | 1331 When you want to load in the bookmarks from a file, use |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1332 `bookmark-load', \\[bookmark-load]. That function will prompt you |
4595 | 1333 for a file, defaulting to the file defined by variable |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1334 `bookmark-default-file'." |
4537 | 1335 (interactive "P") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1336 (bookmark-maybe-load-default-file) |
4537 | 1337 (cond |
1338 ((and (null parg) (null file)) | |
1339 ;;whether interactive or not, write to default file | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1340 (bookmark-write-file bookmark-default-file)) |
4537 | 1341 ((and (null parg) file) |
1342 ;;whether interactive or not, write to given file | |
1343 (bookmark-write-file file)) | |
1344 ((and parg (not file)) | |
1345 ;;have been called interactively w/ prefix arg | |
1346 (let ((file (read-file-name "File to save bookmarks in: "))) | |
1347 (bookmark-write-file file))) | |
1348 (t ; someone called us with prefix-arg *and* a file, so just write to file | |
1349 (bookmark-write-file file))) | |
1350 ;; signal that we have synced the bookmark file by setting this to | |
1351 ;; 0. If there was an error at any point before, it will not get | |
1352 ;; set, which is what we want. | |
1353 (setq bookmark-alist-modification-count 0)) | |
1354 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1355 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1356 |
4537 | 1357 (defun bookmark-write-file (file) |
105445 | 1358 "Write `bookmark-alist' to FILE." |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1359 (bookmark-maybe-message "Saving bookmarks to file %s..." file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1360 (with-current-buffer (get-buffer-create " *Bookmarks*") |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1361 (goto-char (point-min)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1362 (delete-region (point-min) (point-max)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1363 (let ((print-length nil) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1364 (print-level nil)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1365 (bookmark-insert-file-format-version-stamp) |
105124
ff7266798210
(bookmark-write-file): Avoid calling `pp' with large
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1366 (insert "(") |
ff7266798210
(bookmark-write-file): Avoid calling `pp' with large
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1367 ;; Rather than a single call to `pp' we make one per bookmark. |
ff7266798210
(bookmark-write-file): Avoid calling `pp' with large
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1368 ;; Apparently `pp' has a poor algorithmic complexity, so this |
ff7266798210
(bookmark-write-file): Avoid calling `pp' with large
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1369 ;; scales a lot better. bug#4485. |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1370 (dolist (i bookmark-alist) (pp i (current-buffer))) |
105124
ff7266798210
(bookmark-write-file): Avoid calling `pp' with large
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
1371 (insert ")") |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1372 (let ((version-control |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1373 (cond |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1374 ((null bookmark-version-control) nil) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1375 ((eq 'never bookmark-version-control) 'never) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1376 ((eq 'nospecial bookmark-version-control) version-control) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1377 (t t)))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1378 (condition-case nil |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1379 (write-region (point-min) (point-max) file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1380 (file-error (message "Can't write %s" file))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1381 (kill-buffer (current-buffer)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1382 (bookmark-maybe-message |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1383 "Saving bookmarks to file %s...done" file))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1384 |
4537 | 1385 |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1386 (defun bookmark-import-new-list (new-list) |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1387 "Add NEW-LIST of bookmarks to `bookmark-alist'. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1388 Rename new bookmarks as needed using suffix \"<N>\" (N=1,2,3...), when |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1389 they conflict with existing bookmark names." |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1390 (let ((names (bookmark-all-names))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1391 (dolist (full-record new-list) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1392 (bookmark-maybe-rename full-record names) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1393 (setq bookmark-alist (nconc bookmark-alist (list full-record))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1394 (push (bookmark-name-from-full-record full-record) names)))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1395 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1396 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1397 (defun bookmark-maybe-rename (full-record names) |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1398 "Rename bookmark FULL-RECORD if its current name is already used. |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1399 This is a helper for `bookmark-import-new-list'." |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1400 (let ((found-name (bookmark-name-from-full-record full-record))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1401 (if (member found-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1402 ;; We've got a conflict, so generate a new name |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1403 (let ((count 2) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1404 (new-name found-name)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1405 (while (member new-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1406 (setq new-name (concat found-name (format "<%d>" count))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1407 (setq count (1+ count))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1408 (bookmark-set-name full-record new-name))))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1409 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1410 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1411 ;;;###autoload |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1412 (defun bookmark-load (file &optional overwrite no-msg) |
4633 | 1413 "Load bookmarks from FILE (which must be in bookmark format). |
1414 Appends loaded bookmarks to the front of the list of bookmarks. If | |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1415 optional second argument OVERWRITE is non-nil, existing bookmarks are |
4633 | 1416 destroyed. Optional third arg NO-MSG means don't display any messages |
1417 while loading. | |
4537 | 1418 |
1419 If you load a file that doesn't contain a proper bookmark alist, you | |
4633 | 1420 will corrupt Emacs's bookmark list. Generally, you should only load |
4537 | 1421 in files that were created with the bookmark functions in the first |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1422 place. Your own personal bookmark file, `~/.emacs.bmk', is |
4631 | 1423 maintained automatically by Emacs; you shouldn't need to load it |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1424 explicitly. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1425 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1426 If you load a file containing bookmarks with the same names as |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1427 bookmarks already present in your Emacs, the new bookmarks will get |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1428 unique numeric suffixes \"<2>\", \"<3>\", ... following the same |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1429 method buffers use to resolve name collisions." |
4537 | 1430 (interactive |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1431 (list (read-file-name |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1432 (format "Load bookmarks from: (%s) " |
35283 | 1433 bookmark-default-file) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1434 ;;Default might not be used often, |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1435 ;;but there's no better default, and |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1436 ;;I guess it's better than none at all. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1437 "~/" bookmark-default-file 'confirm))) |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1438 (setq file (abbreviate-file-name (expand-file-name file))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1439 (if (not (file-readable-p file)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1440 (error "Cannot read bookmark file %s" file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1441 (if (null no-msg) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1442 (bookmark-maybe-message "Loading bookmarks from %s..." file)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1443 (with-current-buffer (let ((enable-local-variables nil)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1444 (find-file-noselect file)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1445 (goto-char (point-min)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1446 (bookmark-maybe-upgrade-file-format) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1447 (let ((blist (bookmark-alist-from-buffer))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1448 (if (listp blist) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1449 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1450 (if overwrite |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1451 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1452 (setq bookmark-alist blist) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1453 (setq bookmark-alist-modification-count 0)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1454 ;; else |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1455 (bookmark-import-new-list blist) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1456 (setq bookmark-alist-modification-count |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1457 (1+ bookmark-alist-modification-count))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1458 (if (string-equal |
107192
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1459 (abbreviate-file-name |
3c9f81253d07
Use abbreviated file names in bookmarks (bug#5591).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107125
diff
changeset
|
1460 (expand-file-name bookmark-default-file)) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1461 file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1462 (setq bookmarks-already-loaded t)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1463 (bookmark-bmenu-surreptitiously-rebuild-list)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1464 (error "Invalid bookmark list in %s" file))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1465 (kill-buffer (current-buffer))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1466 (if (null no-msg) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1467 (bookmark-maybe-message "Loading bookmarks from %s...done" file)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1468 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1469 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1470 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1471 ;;; Code supporting the dired-like bookmark menu. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1472 ;; Prefix is "bookmark-bmenu" for "buffer-menu": |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1473 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1474 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1475 (defvar bookmark-bmenu-hidden-bookmarks ()) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1476 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1477 |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1478 (defvar bookmark-bmenu-mode-map |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1479 (let ((map (make-keymap))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1480 (suppress-keymap map t) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1481 (define-key map "q" 'quit-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1482 (define-key map "v" 'bookmark-bmenu-select) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1483 (define-key map "w" 'bookmark-bmenu-locate) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1484 (define-key map "2" 'bookmark-bmenu-2-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1485 (define-key map "1" 'bookmark-bmenu-1-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1486 (define-key map "j" 'bookmark-bmenu-this-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1487 (define-key map "\C-c\C-c" 'bookmark-bmenu-this-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1488 (define-key map "f" 'bookmark-bmenu-this-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1489 (define-key map "\C-m" 'bookmark-bmenu-this-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1490 (define-key map "o" 'bookmark-bmenu-other-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1491 (define-key map "\C-o" 'bookmark-bmenu-switch-other-window) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1492 (define-key map "s" 'bookmark-bmenu-save) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1493 (define-key map "k" 'bookmark-bmenu-delete) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1494 (define-key map "\C-d" 'bookmark-bmenu-delete-backwards) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1495 (define-key map "x" 'bookmark-bmenu-execute-deletions) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1496 (define-key map "d" 'bookmark-bmenu-delete) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1497 (define-key map " " 'next-line) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1498 (define-key map "n" 'next-line) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1499 (define-key map "p" 'previous-line) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1500 (define-key map "\177" 'bookmark-bmenu-backup-unmark) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1501 (define-key map "?" 'describe-mode) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1502 (define-key map "u" 'bookmark-bmenu-unmark) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1503 (define-key map "m" 'bookmark-bmenu-mark) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1504 (define-key map "l" 'bookmark-bmenu-load) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1505 (define-key map "r" 'bookmark-bmenu-rename) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1506 (define-key map "R" 'bookmark-bmenu-relocate) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1507 (define-key map "t" 'bookmark-bmenu-toggle-filenames) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1508 (define-key map "a" 'bookmark-bmenu-show-annotation) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1509 (define-key map "A" 'bookmark-bmenu-show-all-annotations) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1510 (define-key map "e" 'bookmark-bmenu-edit-annotation) |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
1511 ;; The original binding of M-g hides the M-g prefix map. |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
1512 ;; If someone has a better idea than M-g s, I'm open to suggestions. |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
1513 (define-key map [?\M-g ?s] 'bookmark-bmenu-search) |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1514 (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1515 map)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1516 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1517 ;; Bookmark Buffer Menu mode is suitable only for specially formatted |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1518 ;; data. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1519 (put 'bookmark-bmenu-mode 'mode-class 'special) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1520 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1521 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1522 ;; todo: need to display whether or not bookmark exists as a buffer in |
35283 | 1523 ;; flag column. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1524 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1525 ;; Format: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1526 ;; FLAGS BOOKMARK [ LOCATION ] |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1527 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1528 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1529 (defun bookmark-bmenu-surreptitiously-rebuild-list () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1530 "Rebuild the Bookmark List if it exists. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1531 Don't affect the buffer ring order." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1532 (if (get-buffer "*Bookmark List*") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1533 (save-excursion |
35283 | 1534 (save-window-excursion |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1535 (bookmark-bmenu-list))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1536 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1537 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1538 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1539 (defun bookmark-bmenu-list () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1540 "Display a list of existing bookmarks. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1541 The list is displayed in a buffer named `*Bookmark List*'. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1542 The leftmost column displays a D if the bookmark is flagged for |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1543 deletion, or > if it is flagged for displaying." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1544 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1545 (bookmark-maybe-load-default-file) |
105761
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1546 (let ((buf (get-buffer-create "*Bookmark List*"))) |
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1547 (if (called-interactively-p 'interactive) |
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1548 (if (or (window-dedicated-p) (window-minibuffer-p)) |
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1549 (pop-to-buffer buf) |
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1550 (switch-to-buffer buf)) |
2a4b89270020
(bookmark-bmenu-list): Don't use switch-to-buffer if
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105759
diff
changeset
|
1551 (set-buffer buf))) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1552 (let ((inhibit-read-only t)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1553 (erase-buffer) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1554 (insert "% Bookmark\n- --------\n") |
66201
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
1555 (add-text-properties (point-min) (point) |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
1556 '(font-lock-face bookmark-menu-heading)) |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1557 (dolist (full-record (bookmark-maybe-sort-alist)) |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1558 (let ((name (bookmark-name-from-full-record full-record)) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1559 (annotation (bookmark-get-annotation full-record)) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1560 (start (point)) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1561 end) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1562 ;; if a bookmark has an annotation, prepend a "*" |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1563 ;; in the list of bookmarks. |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1564 (insert (if (and annotation (not (string-equal annotation ""))) |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1565 " *" " ") |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1566 name) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1567 (setq end (point)) |
106714
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
1568 (put-text-property |
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
1569 (+ bookmark-bmenu-marks-width start) end 'bookmark-name-prop name) |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1570 (when (display-mouse-p) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1571 (add-text-properties |
106714
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
1572 (+ bookmark-bmenu-marks-width start) end |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1573 '(mouse-face highlight |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1574 follow-link t |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1575 help-echo "mouse-2: go to this bookmark in other window"))) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1576 (insert "\n"))) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1577 (set-buffer-modified-p (not (= bookmark-alist-modification-count 0))) |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1578 (goto-char (point-min)) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1579 (forward-line 2) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1580 (bookmark-bmenu-mode) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1581 (if bookmark-bmenu-toggle-filenames |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1582 (bookmark-bmenu-toggle-filenames t)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1583 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1584 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1585 (defalias 'list-bookmarks 'bookmark-bmenu-list) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1586 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1587 (defalias 'edit-bookmarks 'bookmark-bmenu-list) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1588 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1589 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1590 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1591 (defun bookmark-bmenu-mode () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1592 "Major mode for editing a list of bookmarks. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1593 Each line describes one of the bookmarks in Emacs. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1594 Letters do not insert themselves; instead, they are commands. |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
1595 Bookmark names preceded by a \"*\" have annotations. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1596 \\<bookmark-bmenu-mode-map> |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1597 \\[bookmark-bmenu-mark] -- mark bookmark to be displayed. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1598 \\[bookmark-bmenu-select] -- select bookmark of line point is on. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1599 Also show bookmarks marked using m in other windows. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1600 \\[bookmark-bmenu-toggle-filenames] -- toggle displaying of filenames (they may obscure long bookmark names). |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1601 \\[bookmark-bmenu-locate] -- display (in minibuffer) location of this bookmark. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1602 \\[bookmark-bmenu-1-window] -- select this bookmark in full-frame window. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1603 \\[bookmark-bmenu-2-window] -- select this bookmark in one window, |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1604 together with bookmark selected before this one in another window. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1605 \\[bookmark-bmenu-this-window] -- select this bookmark in place of the bookmark menu buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1606 \\[bookmark-bmenu-other-window] -- select this bookmark in another window, |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1607 so the bookmark menu bookmark remains visible in its window. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1608 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark. |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1609 \\[bookmark-bmenu-rename] -- rename this bookmark (prompts for new name). |
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
1610 \\[bookmark-bmenu-relocate] -- relocate this bookmark's file (prompts for new file). |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1611 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down. |
35283 | 1612 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1613 \\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1614 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1615 With a prefix arg, prompts for a file to save in. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1616 \\[bookmark-bmenu-load] -- load in a file of bookmarks (prompts for file.) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1617 \\[bookmark-bmenu-unmark] -- remove all kinds of marks from current line. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1618 With prefix argument, also move up one line. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1619 \\[bookmark-bmenu-backup-unmark] -- back up a line and remove marks. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1620 \\[bookmark-bmenu-show-annotation] -- show the annotation, if it exists, for the current bookmark |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1621 in another buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1622 \\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1623 \\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1624 (kill-all-local-variables) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1625 (use-local-map bookmark-bmenu-mode-map) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1626 (setq truncate-lines t) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1627 (setq buffer-read-only t) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1628 (setq major-mode 'bookmark-bmenu-mode) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1629 (setq mode-name "Bookmark Menu") |
62718
d00be6e651cd
(bookmark-read-annotation-mode, bookmark-edit-annotation-mode)
Lute Kamstra <lute@gnu.org>
parents:
61454
diff
changeset
|
1630 (run-mode-hooks 'bookmark-bmenu-mode-hook)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1631 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1632 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1633 (defun bookmark-bmenu-toggle-filenames (&optional show) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1634 "Toggle whether filenames are shown in the bookmark list. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1635 Optional argument SHOW means show them unconditionally." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1636 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1637 (cond |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1638 (show |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1639 (setq bookmark-bmenu-toggle-filenames nil) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1640 (bookmark-bmenu-show-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1641 (setq bookmark-bmenu-toggle-filenames t)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1642 (bookmark-bmenu-toggle-filenames |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1643 (bookmark-bmenu-hide-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1644 (setq bookmark-bmenu-toggle-filenames nil)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1645 (t |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1646 (bookmark-bmenu-show-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1647 (setq bookmark-bmenu-toggle-filenames t)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1648 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1649 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1650 (defun bookmark-bmenu-show-filenames (&optional force) |
105445 | 1651 "In an interactive bookmark list, show filenames along with bookmarks. |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1652 Non-nil FORCE forces a redisplay showing the filenames. FORCE is used |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1653 mainly for debugging, and should not be necessary in normal use." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1654 (if (and (not force) bookmark-bmenu-toggle-filenames) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1655 nil ;already shown, so do nothing |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1656 (with-buffer-modified-unmodified |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1657 (save-excursion |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1658 (save-window-excursion |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1659 (goto-char (point-min)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1660 (forward-line 2) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1661 (setq bookmark-bmenu-hidden-bookmarks ()) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1662 (let ((inhibit-read-only t)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1663 (while (< (point) (point-max)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1664 (let ((bmrk (bookmark-bmenu-bookmark))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1665 (push bmrk bookmark-bmenu-hidden-bookmarks) |
111429
249a1455856a
Use line-end-position rather than end-of-line, etc.
Glenn Morris <rgm@gnu.org>
parents:
109399
diff
changeset
|
1666 (let ((start (line-end-position))) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1667 (move-to-column bookmark-bmenu-file-column t) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1668 ;; Strip off `mouse-face' from the white spaces region. |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1669 (if (display-mouse-p) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1670 (remove-text-properties start (point) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1671 '(mouse-face nil help-echo nil)))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1672 (delete-region (point) (progn (end-of-line) (point))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1673 (insert " ") |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1674 ;; Pass the NO-HISTORY arg: |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1675 (bookmark-insert-location bmrk t) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1676 (forward-line 1))))))))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1677 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1678 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1679 (defun bookmark-bmenu-hide-filenames (&optional force) |
105445 | 1680 "In an interactive bookmark list, hide the filenames of the bookmarks. |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1681 Non-nil FORCE forces a redisplay showing the filenames. FORCE is used |
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1682 mainly for debugging, and should not be necessary in normal use." |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1683 (when (and (not force) bookmark-bmenu-toggle-filenames) |
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1684 ;; nothing to hide if above is nil |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1685 (with-buffer-modified-unmodified |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1686 (save-excursion |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1687 (goto-char (point-min)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1688 (forward-line 2) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1689 (setq bookmark-bmenu-hidden-bookmarks |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1690 (nreverse bookmark-bmenu-hidden-bookmarks)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1691 (let ((inhibit-read-only t)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1692 (while bookmark-bmenu-hidden-bookmarks |
106714
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
1693 (move-to-column bookmark-bmenu-marks-width t) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1694 (bookmark-kill-line) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1695 (let ((name (pop bookmark-bmenu-hidden-bookmarks)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1696 (start (point))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1697 (insert name) |
106714
396a004a924b
* lisp/bookmark.el: Consistently put the text property on the bookmark name.
Karl Fogel <kfogel@red-bean.com>
parents:
106713
diff
changeset
|
1698 (put-text-property start (point) 'bookmark-name-prop name) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1699 (if (display-mouse-p) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1700 (add-text-properties |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1701 start (point) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1702 '(mouse-face |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1703 highlight follow-link t help-echo |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1704 "mouse-2: go to this bookmark in other window")))) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1705 (forward-line 1))))))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1706 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1707 |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1708 (defun bookmark-bmenu-ensure-position () |
105759
110c55336723
* bookmark.el: Update documentation, especially documentation
Karl Fogel <kfogel@red-bean.com>
parents:
105744
diff
changeset
|
1709 "If point is not on a bookmark line, move it to one. |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1710 If before the first bookmark line, move to the first; if after the |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1711 last full line, move to the last full line. The return value is undefined." |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1712 (cond ((< (count-lines (point-min) (point)) bookmark-bmenu-header-height) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1713 (goto-char (point-min)) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1714 (forward-line bookmark-bmenu-header-height)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1715 ((and (bolp) (eobp)) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1716 (beginning-of-line 0)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1717 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1718 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1719 (defun bookmark-bmenu-bookmark () |
105445 | 1720 "Return the bookmark for this line in an interactive bookmark list buffer." |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1721 (bookmark-bmenu-ensure-position) |
106701
a3eff1130b76
* lisp/bookmark.el (bookmark-bmenu-marks-width): Define to 1, not 2.
Karl Fogel <kfogel@red-bean.com>
parents:
106700
diff
changeset
|
1722 (save-excursion |
a3eff1130b76
* lisp/bookmark.el (bookmark-bmenu-marks-width): Define to 1, not 2.
Karl Fogel <kfogel@red-bean.com>
parents:
106700
diff
changeset
|
1723 (beginning-of-line) |
a3eff1130b76
* lisp/bookmark.el (bookmark-bmenu-marks-width): Define to 1, not 2.
Karl Fogel <kfogel@red-bean.com>
parents:
106700
diff
changeset
|
1724 (forward-char bookmark-bmenu-marks-width) |
a3eff1130b76
* lisp/bookmark.el (bookmark-bmenu-marks-width): Define to 1, not 2.
Karl Fogel <kfogel@red-bean.com>
parents:
106700
diff
changeset
|
1725 (get-text-property (point) 'bookmark-name-prop))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1726 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1727 |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1728 (defun bookmark-show-annotation (bookmark-name-or-record) |
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1729 "Display the annotation for BOOKMARK-NAME-OR-RECORD in a buffer, |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1730 if an annotation exists." |
111851
dd83cbcddf69
Adjust parameter names and doc strings to resolve confusion over
Karl Fogel <kfogel@red-bean.com>
parents:
111429
diff
changeset
|
1731 (let ((annotation (bookmark-get-annotation bookmark-name-or-record))) |
109384
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1732 (when (and annotation (not (string-equal annotation ""))) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1733 (save-excursion |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1734 (let ((old-buf (current-buffer))) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1735 (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1736 (delete-region (point-min) (point-max)) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1737 (insert annotation) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1738 (goto-char (point-min)) |
32e3de61d8a0
* lisp/bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
Karl Fogel <kfogel@red-bean.com>
parents:
109383
diff
changeset
|
1739 (switch-to-buffer-other-window old-buf)))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1740 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1741 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1742 (defun bookmark-show-all-annotations () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1743 "Display the annotations for all bookmarks in a buffer." |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1744 (save-selected-window |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1745 (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1746 (delete-region (point-min) (point-max)) |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1747 (dolist (full-record bookmark-alist) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1748 (let* ((name (bookmark-name-from-full-record full-record)) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1749 (ann (bookmark-get-annotation full-record))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1750 (insert (concat name ":\n")) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1751 (if (and ann (not (string-equal ann ""))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1752 ;; insert the annotation, indented by 4 spaces. |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1753 (progn |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1754 (save-excursion (insert ann) (unless (bolp) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1755 (insert "\n"))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1756 (while (< (point) (point-max)) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1757 (beginning-of-line) ; paranoia |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1758 (insert " ") |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1759 (forward-line) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1760 (end-of-line)))))) |
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
1761 (goto-char (point-min)))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1762 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1763 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1764 (defun bookmark-bmenu-mark () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1765 "Mark bookmark on this line to be displayed by \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-select]." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1766 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1767 (beginning-of-line) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1768 (bookmark-bmenu-ensure-position) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1769 (with-buffer-modified-unmodified |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1770 (let ((inhibit-read-only t)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1771 (delete-char 1) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1772 (insert ?>) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1773 (forward-line 1) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1774 (bookmark-bmenu-ensure-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1775 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1776 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1777 (defun bookmark-bmenu-select () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1778 "Select this line's bookmark; also display bookmarks marked with `>'. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1779 You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mark] command." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1780 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1781 (let ((bmrk (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1782 (menu (current-buffer)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1783 (others ()) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1784 tem) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1785 (goto-char (point-min)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1786 (while (re-search-forward "^>" nil t) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1787 (setq tem (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1788 (let ((inhibit-read-only t)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1789 (delete-char -1) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1790 (insert ?\s)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1791 (or (string-equal tem bmrk) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1792 (member tem others) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1793 (setq others (cons tem others)))) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1794 (setq others (nreverse others) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1795 tem (/ (1- (frame-height)) (1+ (length others)))) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1796 (delete-other-windows) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1797 (bookmark-jump bmrk) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1798 (bury-buffer menu) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1799 (if others |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1800 (while others |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1801 (split-window nil tem) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1802 (other-window 1) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1803 (bookmark-jump (car others)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1804 (setq others (cdr others))) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1805 (other-window 1)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1806 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1807 |
106702
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1808 (defun bookmark-bmenu-any-marks () |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1809 "Return non-nil if any bookmarks are marked in the marks column." |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1810 (save-excursion |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1811 (goto-char (point-min)) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1812 (bookmark-bmenu-ensure-position) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1813 (catch 'found-mark |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1814 (while (not (eobp)) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1815 (beginning-of-line) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1816 (if (looking-at "^\\S-") |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1817 (throw 'found-mark t) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1818 (forward-line 1))) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1819 nil))) |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1820 |
d4fd57e5eafd
* lisp/bookmark.el (bookmark-bmenu-any-marks): New function
Karl Fogel <kfogel@red-bean.com>
parents:
106701
diff
changeset
|
1821 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1822 (defun bookmark-bmenu-save (parg) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1823 "Save the current list into a bookmark file. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1824 With a prefix arg, prompts for a file to save them in." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1825 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1826 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1827 (save-window-excursion |
106712
ba9ed2ec36e5
* lisp/bookmark.el (bookmark-bmenu-save): Just depend on the new logic
Karl Fogel <kfogel@red-bean.com>
parents:
106710
diff
changeset
|
1828 (bookmark-save parg) |
ba9ed2ec36e5
* lisp/bookmark.el (bookmark-bmenu-save): Just depend on the new logic
Karl Fogel <kfogel@red-bean.com>
parents:
106710
diff
changeset
|
1829 (set-buffer-modified-p nil)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1830 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1831 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1832 (defun bookmark-bmenu-load () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1833 "Load the bookmark file and rebuild the bookmark menu-buffer." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1834 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1835 (bookmark-bmenu-ensure-position) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1836 (save-excursion |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1837 (save-window-excursion |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1838 ;; This will call `bookmark-bmenu-list' |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1839 (call-interactively 'bookmark-load)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1840 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1841 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1842 (defun bookmark-bmenu-1-window () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1843 "Select this line's bookmark, alone, in full frame." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1844 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1845 (bookmark-jump (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1846 (bury-buffer (other-buffer)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1847 (delete-other-windows)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1848 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1849 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1850 (defun bookmark-bmenu-2-window () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1851 "Select this line's bookmark, with previous buffer in second window." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1852 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1853 (let ((bmrk (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1854 (menu (current-buffer)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1855 (pop-up-windows t)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1856 (delete-other-windows) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1857 (switch-to-buffer (other-buffer)) |
109281
81cfe104e929
Remove unnecessary let-bindings in bookmark.el (Bug#6515)
Chong Yidong <cyd@stupidchicken.com>
parents:
107192
diff
changeset
|
1858 (bookmark--jump-via bmrk 'pop-to-buffer) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1859 (bury-buffer menu))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1860 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1861 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1862 (defun bookmark-bmenu-this-window () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1863 "Select this line's bookmark in this window." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1864 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1865 (bookmark-jump (bookmark-bmenu-bookmark))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1866 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1867 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1868 (defun bookmark-bmenu-other-window () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1869 "Select this line's bookmark in other window, leaving bookmark menu visible." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1870 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1871 (let ((bookmark (bookmark-bmenu-bookmark))) |
109281
81cfe104e929
Remove unnecessary let-bindings in bookmark.el (Bug#6515)
Chong Yidong <cyd@stupidchicken.com>
parents:
107192
diff
changeset
|
1872 (bookmark--jump-via bookmark 'switch-to-buffer-other-window))) |
11021
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1873 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1874 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1875 (defun bookmark-bmenu-switch-other-window () |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1876 "Make the other window select this line's bookmark. |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1877 The current window remains selected." |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1878 (interactive) |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1879 (let ((bookmark (bookmark-bmenu-bookmark)) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1880 (pop-up-windows t) |
35283 | 1881 same-window-buffer-names |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1882 same-window-regexps) |
109281
81cfe104e929
Remove unnecessary let-bindings in bookmark.el (Bug#6515)
Chong Yidong <cyd@stupidchicken.com>
parents:
107192
diff
changeset
|
1883 (bookmark--jump-via bookmark 'display-buffer))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1884 |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1885 (defun bookmark-bmenu-other-window-with-mouse (event) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1886 "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible." |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1887 (interactive "e") |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1888 (with-current-buffer (window-buffer (posn-window (event-end event))) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1889 (save-excursion |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1890 (goto-char (posn-point (event-end event))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1891 (bookmark-bmenu-other-window)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1892 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1893 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1894 (defun bookmark-bmenu-show-annotation () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1895 "Show the annotation for the current bookmark in another window." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1896 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1897 (let ((bookmark (bookmark-bmenu-bookmark))) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1898 (bookmark-show-annotation bookmark))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1899 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1900 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1901 (defun bookmark-bmenu-show-all-annotations () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1902 "Show the annotation for all bookmarks in another window." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1903 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1904 (bookmark-show-all-annotations)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1905 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1906 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1907 (defun bookmark-bmenu-edit-annotation () |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1908 "Edit the annotation for the current bookmark in another window." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1909 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1910 (let ((bookmark (bookmark-bmenu-bookmark))) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1911 (bookmark-edit-annotation bookmark))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1912 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1913 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1914 (defun bookmark-bmenu-unmark (&optional backup) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1915 "Cancel all requested operations on bookmark on this line and move down. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1916 Optional BACKUP means move up." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1917 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1918 (beginning-of-line) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1919 (bookmark-bmenu-ensure-position) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1920 (with-buffer-modified-unmodified |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1921 (let ((inhibit-read-only t)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1922 (delete-char 1) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1923 ;; any flags to reset according to circumstances? How about a |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1924 ;; flag indicating whether this bookmark is being visited? |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1925 ;; well, we don't have this now, so maybe later. |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1926 (insert " ")) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1927 (forward-line (if backup -1 1)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1928 (bookmark-bmenu-ensure-position))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1929 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1930 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1931 (defun bookmark-bmenu-backup-unmark () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1932 "Move up and cancel all requested operations on bookmark on line above." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1933 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1934 (forward-line -1) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1935 (bookmark-bmenu-ensure-position) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1936 (bookmark-bmenu-unmark) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1937 (forward-line -1) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1938 (bookmark-bmenu-ensure-position)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1939 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1940 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1941 (defun bookmark-bmenu-delete () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1942 "Mark bookmark on this line to be deleted. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1943 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1944 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1945 (beginning-of-line) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1946 (bookmark-bmenu-ensure-position) |
106710
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1947 (with-buffer-modified-unmodified |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1948 (let ((inhibit-read-only t)) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1949 (delete-char 1) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1950 (insert ?D) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1951 (forward-line 1) |
a96887ed3368
* lisp/bookmark.el: Show modified state of bookmark buffer more accurately.
Karl Fogel <kfogel@red-bean.com>
parents:
106709
diff
changeset
|
1952 (bookmark-bmenu-ensure-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1953 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1954 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1955 (defun bookmark-bmenu-delete-backwards () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1956 "Mark bookmark on this line to be deleted, then move up one line. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1957 To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-execute-deletions]." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1958 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1959 (bookmark-bmenu-delete) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1960 (forward-line -2) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1961 (bookmark-bmenu-ensure-position) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1962 (forward-line 1) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1963 (bookmark-bmenu-ensure-position)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1964 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1965 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1966 (defun bookmark-bmenu-execute-deletions () |
106821
203a882ff4c0
* lisp/bookmark.el (bookmark-bmenu-execute-deletions): Doc fix (Bug#5276).
Karl Fogel <karl.fogel@canonical.com>
parents:
106815
diff
changeset
|
1967 "Delete bookmarks flagged `D'." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1968 (interactive) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1969 (message "Deleting bookmarks...") |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1970 (let ((o-point (point)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1971 (o-str (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1972 (beginning-of-line) |
106181
36947fb87ecd
(bookmark-bmenu-bookmark-column): Remove var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106179
diff
changeset
|
1973 (unless (looking-at "^D") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1974 (buffer-substring |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1975 (point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1976 (progn (end-of-line) (point)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1977 (o-col (current-column))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1978 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1979 (forward-line 1) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1980 (while (re-search-forward "^D" (point-max) t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1981 (bookmark-delete (bookmark-bmenu-bookmark) t)) ; pass BATCH arg |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1982 (bookmark-bmenu-list) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1983 (if o-str |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1984 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1985 (goto-char (point-min)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1986 (search-forward o-str) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1987 (beginning-of-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1988 (forward-char o-col)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1989 (goto-char o-point)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1990 (beginning-of-line) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1991 (message "Deleting bookmarks...done") |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1992 )) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1993 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1994 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1995 (defun bookmark-bmenu-rename () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1996 "Rename bookmark on current line. Prompts for a new name." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1997 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1998 (let ((bmrk (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
1999 (thispoint (point))) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2000 (bookmark-rename bmrk) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2001 (goto-char thispoint))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2002 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2003 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2004 (defun bookmark-bmenu-locate () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2005 "Display location of this bookmark. Displays in the minibuffer." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2006 (interactive) |
106709
f497db0aba00
* lisp/bookmark.el (bookmark-bmenu-select, bookmark-bmenu-1-window,
Karl Fogel <kfogel@red-bean.com>
parents:
106703
diff
changeset
|
2007 (let ((bmrk (bookmark-bmenu-bookmark))) |
f497db0aba00
* lisp/bookmark.el (bookmark-bmenu-select, bookmark-bmenu-1-window,
Karl Fogel <kfogel@red-bean.com>
parents:
106703
diff
changeset
|
2008 (message "%s" (bookmark-location bmrk)))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2009 |
56059
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2010 (defun bookmark-bmenu-relocate () |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2011 "Change the file path of the bookmark on the current line, |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2012 prompting with completion for the new path." |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2013 (interactive) |
106700
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2014 (let ((bmrk (bookmark-bmenu-bookmark)) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2015 (thispoint (point))) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2016 (bookmark-relocate bmrk) |
dc3fdb0cfdc7
* lisp/bookmark.el: Improvements suggested by Drew Adams:
Karl Fogel <kfogel@red-bean.com>
parents:
106697
diff
changeset
|
2017 (goto-char thispoint))) |
4537 | 2018 |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2019 ;;; Bookmark-bmenu search |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2020 |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2021 ;; Store keyboard input for incremental search. |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2022 (defvar bookmark-search-pattern) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2023 |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2024 (defun bookmark-read-search-input () |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2025 "Read each keyboard input and add it to `bookmark-search-pattern'." |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2026 (let ((prompt (propertize "Pattern: " 'face 'minibuffer-prompt)) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2027 ;; (inhibit-quit t) ; inhibit-quit is evil. Use it with extreme care! |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2028 (tmp-list ())) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2029 (while |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2030 (let ((char (read-key (concat prompt bookmark-search-pattern)))) |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2031 (case char |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2032 ((?\e ?\r) nil) ; RET or ESC break the search loop. |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2033 (?\C-g (setq bookmark-quit-flag t) nil) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2034 (?\d (pop tmp-list) t) ; Delete last char of pattern with DEL |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2035 (t |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2036 (if (characterp char) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2037 (push char tmp-list) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2038 (setq unread-command-events |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2039 (nconc (mapcar 'identity |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2040 (this-single-command-raw-keys)) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2041 unread-command-events)) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2042 nil)))) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2043 (setq bookmark-search-pattern |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2044 (apply 'string (reverse tmp-list)))))) |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2045 |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2046 |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2047 (defun bookmark-bmenu-filter-alist-by-regexp (regexp) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2048 "Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list." |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2049 (let ((bookmark-alist |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2050 (loop for i in bookmark-alist |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2051 when (string-match regexp (car i)) collect i into new |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2052 finally return new))) |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2053 (bookmark-bmenu-list))) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2054 |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2055 |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2056 ;;;###autoload |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2057 (defun bookmark-bmenu-search () |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2058 "Incremental search of bookmarks, hiding the non-matches as we go." |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2059 (interactive) |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2060 (let ((bmk (bookmark-bmenu-bookmark)) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2061 (bookmark-search-pattern "") |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2062 (timer (run-with-idle-timer |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2063 bookmark-search-delay 'repeat |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2064 #'(lambda () |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2065 (bookmark-bmenu-filter-alist-by-regexp |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2066 bookmark-search-pattern))))) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2067 (unwind-protect |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2068 (bookmark-read-search-input) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2069 (cancel-timer timer) |
106209
d82b527709ef
(bookmark-bmenu-search): Clear echo area when exiting.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106181
diff
changeset
|
2070 (message nil) |
106179
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2071 (when bookmark-quit-flag ; C-g hit restore menu list. |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2072 (bookmark-bmenu-list) (bookmark-bmenu-goto-bookmark bmk)) |
0cc25cd9870d
(bookmark-search-prompt, bookmark-search-timer): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106172
diff
changeset
|
2073 (setq bookmark-quit-flag nil)))) |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
2074 |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2075 (defun bookmark-bmenu-goto-bookmark (name) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2076 "Move point to bookmark with name NAME." |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2077 (goto-char (point-min)) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2078 (while (not (equal name (bookmark-bmenu-bookmark))) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2079 (forward-line 1)) |
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2080 (forward-line 0)) |
106697
ac408704629c
lisp/*: Fix typos in docstrings and messages.
Juanma Barranquero <lekktu@gmail.com>
parents:
106210
diff
changeset
|
2081 |
106166
858a083ed2f0
* bookmark.el (bookmark-search-delay, bookmark-search-prompt): New options.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105920
diff
changeset
|
2082 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2083 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2084 ;;; Menu bar stuff. Prefix is "bookmark-menu". |
4537 | 2085 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2086 (defun bookmark-menu-popup-paned-menu (event name entries) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2087 "Pop up multi-paned menu at EVENT, return string chosen from ENTRIES. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2088 That is, ENTRIES is a list of strings which appear as the choices |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2089 in the menu. |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2090 The number of panes depends on the number of entries. |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2091 The visible entries are truncated to `bookmark-menu-length', but the |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2092 strings returned are not." |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2093 (let ((f-height (/ (frame-height) 2)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2094 (pane-list nil) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2095 (iter 0)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2096 (while entries |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2097 (let (lst |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2098 (count 0)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2099 (while (and (< count f-height) entries) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2100 (let ((str (car entries))) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2101 (push (cons |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2102 (if (> (length str) bookmark-menu-length) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2103 (substring str 0 bookmark-menu-length) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2104 str) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2105 str) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2106 lst) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2107 (setq entries (cdr entries)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2108 (setq count (1+ count)))) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2109 (setq iter (1+ iter)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2110 (push (cons |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2111 (format "-*- %s (%d) -*-" name iter) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2112 (nreverse lst)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2113 pane-list))) |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2114 |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2115 ;; Popup the menu and return the string. |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2116 (x-popup-menu event (cons (concat "-*- " name " -*-") |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2117 (nreverse pane-list))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2118 |
4537 | 2119 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2120 ;; Thanks to Roland McGrath for fixing menubar.el so that the |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2121 ;; following works, and for explaining what to do to make it work. |
4537 | 2122 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2123 ;; We MUST autoload EACH form used to set up this variable's value, so |
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2124 ;; that the whole job is done in loaddefs.el. |
4537 | 2125 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
2126 ;; Emacs menubar stuff. |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2127 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2128 ;;;###autoload |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2129 (defvar menu-bar-bookmark-map |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2130 (let ((map (make-sparse-keymap "Bookmark functions"))) |
105744
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2131 (define-key map [load] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2132 `(menu-item ,(purecopy "Load a Bookmark File...") bookmark-load |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2133 :help ,(purecopy "Load bookmarks from a bookmark file)"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2134 (define-key map [write] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2135 `(menu-item ,(purecopy "Save Bookmarks As...") bookmark-write |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2136 :help ,(purecopy "Write bookmarks to a file (reading the file name with the minibuffer)"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2137 (define-key map [save] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2138 `(menu-item ,(purecopy "Save Bookmarks") bookmark-save |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2139 :help ,(purecopy "Save currently defined bookmarks"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2140 (define-key map [edit] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2141 `(menu-item ,(purecopy "Edit Bookmark List") bookmark-bmenu-list |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2142 :help ,(purecopy "Display a list of existing bookmarks"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2143 (define-key map [delete] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2144 `(menu-item ,(purecopy "Delete Bookmark...") bookmark-delete |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2145 :help ,(purecopy "Delete a bookmark from the bookmark list"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2146 (define-key map [rename] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2147 `(menu-item ,(purecopy "Rename Bookmark...") bookmark-rename |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2148 :help ,(purecopy "Change the name of a bookmark"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2149 (define-key map [locate] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2150 `(menu-item ,(purecopy "Insert Location...") bookmark-locate |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2151 :help ,(purecopy "Insert the name of the file associated with a bookmark"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2152 (define-key map [insert] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2153 `(menu-item ,(purecopy "Insert Contents...") bookmark-insert |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2154 :help ,(purecopy "Insert the text of the file pointed to by a bookmark"))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2155 (define-key map [set] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2156 `(menu-item ,(purecopy "Set Bookmark...") bookmark-set |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2157 :help ,(purecopy "Set a bookmark named inside a file."))) |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2158 (define-key map [jump] |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2159 `(menu-item ,(purecopy "Jump to Bookmark...") bookmark-jump |
b0a732611398
* keymap.c (Fmake_sparse_keymap): Purecopy the name.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105541
diff
changeset
|
2160 :help ,(purecopy "Jump to a bookmark (a point in some file)"))) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2161 map)) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2162 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2163 ;;;###autoload |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2164 (defalias 'menu-bar-bookmark-map menu-bar-bookmark-map) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2165 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2166 ;; make bookmarks appear toward the right side of the menu. |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2167 (if (boundp 'menu-bar-final-items) |
35283 | 2168 (if menu-bar-final-items |
105787
d5f02d259103
(bookmark-insert-location, bookmark-bmenu-list)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105761
diff
changeset
|
2169 (push 'bookmark menu-bar-final-items)) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2170 (setq menu-bar-final-items '(bookmark))) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2171 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2172 ;;;; end bookmark menu stuff ;;;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2173 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2174 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
2175 ;; Load Hook |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2176 (defvar bookmark-load-hook nil |
109399
3fcc8637a887
* lisp/bookmark.el (bookmark-load-hook): Fix doc string as suggested
Karl Fogel <kfogel@red-bean.com>
parents:
109397
diff
changeset
|
2177 "Hook run at the end of loading library `bookmark.el'.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2178 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
2179 ;; Exit Hook, called from kill-emacs-hook |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2180 (defvar bookmark-exit-hook nil |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2181 "Hook run when Emacs exits.") |
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2182 |
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2183 (define-obsolete-variable-alias 'bookmark-exit-hooks 'bookmark-exit-hook "22.1") |
35283 | 2184 |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2185 (defun bookmark-exit-hook-internal () |
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2186 "Save bookmark state, if necessary, at Emacs exit time. |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2187 This also runs `bookmark-exit-hook'." |
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2188 (run-hooks 'bookmark-exit-hook) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2189 (and bookmark-alist |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2190 (bookmark-time-to-save-p t) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2191 (bookmark-save))) |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2192 |
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2193 (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) |
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2194 |
98537
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2195 (defun bookmark-unload-function () |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2196 "Unload the Bookmark library." |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2197 (when bookmark-save-flag (bookmark-save)) |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2198 ;; continue standard unloading |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2199 nil) |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2200 |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2201 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2202 (run-hooks 'bookmark-load-hook) |
4537 | 2203 |
2204 (provide 'bookmark) | |
35283 | 2205 |
4595 | 2206 ;;; bookmark.el ends here |