Mercurial > emacs
annotate lisp/bookmark.el @ 105014:ef4e71ead2e8
* configure.bat: Add #define PROFILING to config.h.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 14 Sep 2009 23:00:52 +0000 |
parents | a9dc0e7c3f2b |
children | ff7266798210 |
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 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64634
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003, |
100908 | 4 ;; 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
4537 | 5 |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
6 ;; 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
|
7 ;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
4537 | 8 ;; 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
|
9 ;; Keywords: bookmarks, placeholders, annotations |
4537 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93705
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
4537 | 14 ;; 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
|
15 ;; 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
|
16 ;; (at your option) any later version. |
4537 | 17 |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; 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
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
14169 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; This package is for setting "bookmarks" in files. A bookmark | |
29 ;; associates a string with a location in a certain file. Thus, you | |
30 ;; can navigate your way to that location by providing the string. | |
31 ;; See the "User Variables" section for customizations. | |
4537 | 32 |
33 ;; Thanks to David Bremner <bremner@cs.sfu.ca> for thinking of and | |
34 ;; then implementing the bookmark-current-bookmark idea. He even | |
4891 | 35 ;; sent *patches*, bless his soul... |
4537 | 36 |
37 ;; Thanks to Gregory M. Saunders <saunders@cis.ohio-state.edu> for | |
38 ;; fixing and improving bookmark-time-to-save-p. | |
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 ;; Thanks go to Andrew V. Klein <avk@cig.mot.com> for the code that |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
41 ;; sorts the alist before presenting it to the user (in bookmark-bmenu-list |
4891 | 42 ;; and the menu-bar). |
43 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
44 ;; And much thanks to David Hughes <djh@harston.cv.com> for many small |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
45 ;; suggestions and the code to implement them (like |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
46 ;; bookmark-bmenu-check-position, and some of the Lucid compatibility |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
47 ;; stuff). |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
48 |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
49 ;; Kudos (whatever they are) go to Jim Blandy <jimb@red-bean.com> |
4891 | 50 ;; for his eminently sensible suggestion to separate bookmark-jump |
51 ;; into bookmark-jump and bookmark-jump-noselect, which made many | |
52 ;; other things cleaner as well. | |
53 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
54 ;; Thanks to Roland McGrath for encouragement and help with defining |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
55 ;; autoloads on the menu-bar. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
56 |
12880 | 57 ;; Jonathan Stigelman <stig@hackvan.com> gave patches for default |
4891 | 58 ;; values in bookmark-jump and bookmark-set. Everybody please keep |
59 ;; all the keystrokes they save thereby and send them to him at the | |
60 ;; end of each year :-) (No, seriously, thanks Jonathan!) | |
61 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
62 ;; Buckets of gratitude to John Grabowski <johng@media.mit.edu> for |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
63 ;; thinking up the annotations feature and implementing it so well. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
64 |
4537 | 65 ;; Based on info-bookmark.el, by Karl Fogel and Ken Olstad |
66 ;; <olstad@msc.edu>. | |
67 | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
68 ;; Thanks to Mikio Nakajima <PBC01764@niftyserve.or.jp> for many bugs |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
69 ;; reported and fixed. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
70 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
71 ;; Thank you, Michael Kifer, for contributing the XEmacs support. |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
72 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
73 ;; Enough with the credits already, get on to the good stuff: |
4537 | 74 |
35283 | 75 ;; FAVORITE CHINESE RESTAURANT: |
4537 | 76 ;; Boy, that's a tough one. Probably Hong Min, or maybe Emperor's |
77 ;; Choice (both in Chicago's Chinatown). Well, both. How about you? | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
78 |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
38173
diff
changeset
|
79 ;;; Code: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
80 |
14169 | 81 (require 'pp) |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
82 (eval-when-compile (require 'cl)) |
14169 | 83 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
84 ;;; Misc comments: |
4537 | 85 ;; |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
86 ;; If variable bookmark-use-annotations is non-nil, an annotation is |
35283 | 87 ;; queried for when setting a bookmark. |
4595 | 88 ;; |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
89 ;; 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
|
90 ;; 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
|
91 ;; 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
|
92 ;; (chronologically), which is actually fairly useful as well. |
4537 | 93 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
94 ;;; User Variables |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
95 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
96 (defgroup bookmark nil |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
97 "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
|
98 :group 'matching) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
99 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
100 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
101 (defcustom bookmark-use-annotations nil |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
102 "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
|
103 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
104 :group 'bookmark) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
105 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
106 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
107 (defcustom bookmark-save-flag t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
108 "Controls when Emacs saves bookmarks to a file. |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
109 --> nil means never save bookmarks, except when `bookmark-save' is |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
110 explicitly called \(\\[bookmark-save]\). |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
111 --> 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
|
112 --> Otherwise, it should be a number that is the frequency with which |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
113 the bookmark list is saved \(i.e.: the number of times which |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
114 Emacs' bookmark list may be modified before it is automatically |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
115 saved.\). If it is a number, Emacs will also automatically save |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
116 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
|
117 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
118 Therefore, the way to get it to save every time you make or delete a |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
119 bookmark is to set this variable to 1 \(or 0, which produces the same |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
120 behavior.\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
121 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
122 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
|
123 `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
|
124 :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
|
125 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
126 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
127 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
128 (defconst bookmark-old-default-file "~/.emacs-bkmrks" |
100171 | 129 "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
|
130 |
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 ;; 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
|
133 (defvar bookmark-file nil |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
134 "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
|
135 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
136 (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
|
137 (if bookmark-file |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
138 ;; 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
|
139 bookmark-file |
16036
a9ced5af8a15
(bookmark-default-file): Use convert-standard-filename.
Richard M. Stallman <rms@gnu.org>
parents:
15193
diff
changeset
|
140 (convert-standard-filename "~/.emacs.bmk")) |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
141 "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
|
142 :type 'file |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
143 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
144 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
145 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
146 (defcustom bookmark-version-control 'nospecial |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
147 "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
|
148 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
|
149 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
|
150 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
|
151 use the value of `version-control'." |
22568
5682c77dce71
(bookmark-save-flag, bookmark-version-control): Use
Andreas Schwab <schwab@suse.de>
parents:
22251
diff
changeset
|
152 :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
|
153 (other t)) |
17411
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-completion-ignore-case t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
158 "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
|
159 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
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 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
162 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
163 (defcustom bookmark-sort-flag t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
164 "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
|
165 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
|
166 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
|
167 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
168 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
169 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
170 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
171 (defcustom bookmark-automatically-show-annotations t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
172 "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
|
173 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
174 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
175 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
176 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
177 (defcustom bookmark-bmenu-file-column 30 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
178 "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
|
179 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
|
180 :type 'integer |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
181 :group 'bookmark) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
182 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
183 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
184 (defcustom bookmark-bmenu-toggle-filenames t |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
185 "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
|
186 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
|
187 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
|
188 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
189 \(setq bookmark-bmenu-toggle-filenames nil\)" |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
190 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
191 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
192 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
193 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
194 (defcustom bookmark-menu-length 70 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
195 "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
|
196 :type 'integer |
48393
68aa78bf3f63
(bookmark-menu-length): Fix typo in group name.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
45793
diff
changeset
|
197 :group 'bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
198 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
199 |
66201
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
200 (defface bookmark-menu-heading |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
201 '((t (:inherit font-lock-type-face))) |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
202 "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
|
203 :group 'bookmark |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
204 :version "22.1") |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
205 |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
206 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
207 ;;; No user-serviceable parts beyond this point. |
4537 | 208 |
209 ;; Added for lucid emacs compatibility, db | |
210 (or (fboundp 'defalias) (fset 'defalias 'fset)) | |
211 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
212 ;; 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
|
213 (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
|
214 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
215 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
216 ;;; Keymap stuff: |
18709
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
217 |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
218 ;; 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
|
219 ;; if the user alters them, don't override the user when loading bookmark.el. |
4537 | 220 |
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
|
221 ;;;###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
|
222 ;;;###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
|
223 ;;;###autoload (define-key ctl-x-r-map "l" 'bookmark-bmenu-list) |
4537 | 224 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
225 ;;;###autoload |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
226 (defvar bookmark-map |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
227 (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
|
228 ;; 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
|
229 (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
|
230 (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
|
231 (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
|
232 (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
|
233 (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
|
234 (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
|
235 (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
|
236 (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
|
237 (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
|
238 (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
|
239 (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
|
240 (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
|
241 (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
|
242 map) |
4633 | 243 "Keymap containing bindings to bookmark functions. |
244 It is not bound to any key by default: to bind it | |
245 so that you have a bookmark prefix, just use `global-set-key' and bind a | |
246 key of your choice to `bookmark-map'. All interactive bookmark | |
4537 | 247 functions have a binding in this keymap.") |
248 | |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
249 ;;;###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
|
250 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
251 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
252 ;;; Core variables and data structures: |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
253 (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
|
254 "Association list of bookmarks and their records. |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
255 You probably don't want to change the value of this alist yourself; |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
256 instead, let the various bookmark functions do it for you. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
257 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
258 The format of the alist is |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
259 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
260 \(BOOKMARK1 BOOKMARK2 ...\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
261 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
262 where each BOOKMARK is of the form |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
263 |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
264 (NAME PARAM-ALIST) or (NAME . PARAM-ALIST) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
265 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
266 where the first form is the old deprecated one and the second is |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
267 the new favored one. PARAM-ALIST is typically of the form: |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
268 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
269 ((filename . FILE) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
270 (front-context-string . FRONT-STR) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
271 (rear-context-string . REAR-STR) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
272 (position . POS) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
273 (annotation . ANNOTATION)))") |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
274 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
275 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
276 (defvar bookmarks-already-loaded nil) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
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 |
4537 | 279 ;; 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
|
280 |
35283 | 281 (defvar bookmark-current-bookmark nil |
4633 | 282 "Name of bookmark most recently used in the current file. |
283 It is buffer local, used to make moving a bookmark forward | |
4631 | 284 through a file easier.") |
4537 | 285 |
286 (make-variable-buffer-local 'bookmark-current-bookmark) | |
287 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
288 |
4537 | 289 (defvar bookmark-alist-modification-count 0 |
4633 | 290 "Number of modifications to bookmark list since it was last saved.") |
4537 | 291 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
292 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
293 (defvar bookmark-search-size 16 |
4633 | 294 "Length of the context strings recorded on either side of a bookmark.") |
4537 | 295 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
296 |
4537 | 297 (defvar bookmark-current-point 0) |
298 (defvar bookmark-yank-point 0) | |
299 (defvar bookmark-current-buffer nil) | |
300 | |
63931
a166968798fa
(Info-current-node, Info-suffix-list): Add defvars.
Richard M. Stallman <rms@gnu.org>
parents:
62718
diff
changeset
|
301 (defvar Info-suffix-list) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
302 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
303 ;; Helper functions. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
304 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
305 ;; Only functions on this page and the next one (file formats) need to |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
306 ;; know anything about the format of bookmark-alist entries. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
307 ;; 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
|
308 |
92568
f91d9f543b0a
* bookmark.el (bookmark-set): Don't check for
Bastien Guerry <bzg@altern.org>
parents:
92567
diff
changeset
|
309 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
310 (defun bookmark-name-from-full-record (full-record) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
311 "Return name of FULL-RECORD \(an alist element instead of a string\)." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
312 (car full-record)) |
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 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
315 (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
|
316 "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
|
317 (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
|
318 (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
|
319 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
320 |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
321 (defun bookmark-get-bookmark (bookmark &optional noerror) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
322 "Return the bookmark record corresponding to BOOKMARK. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
323 If BOOKMARK is already a bookmark record, just return it, |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
324 Otherwise look for the corresponding bookmark in `bookmark-alist'." |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
325 (cond |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
326 ((consp bookmark) bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
327 ((stringp bookmark) |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
328 (or (assoc-string bookmark bookmark-alist bookmark-completion-ignore-case) |
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
329 (unless noerror (error "Invalid bookmark %s" bookmark)))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
330 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
331 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
332 (defun bookmark-get-bookmark-record (bookmark) |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
333 "Return the guts of the entry for BOOKMARK in `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
|
334 That is, all information but the name." |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
335 (let ((alist (cdr (bookmark-get-bookmark bookmark)))) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
336 ;; 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
|
337 ;; (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
|
338 (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
|
339 (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
|
340 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
341 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
342 (defun bookmark-set-name (bookmark newname) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
343 "Set BOOKMARK's name to NEWNAME." |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
344 (setcar |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
345 (if (stringp bookmark) (bookmark-get-bookmark bookmark) bookmark) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
346 newname)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
347 |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
348 (defun bookmark-prop-get (bookmark prop) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
349 "Return the property PROP of BOOKMARK, or nil if none." |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
350 (cdr (assq prop (bookmark-get-bookmark-record bookmark)))) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
351 |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
352 (defun bookmark-prop-set (bookmark prop val) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
353 "Set the property PROP of BOOKMARK to VAL." |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
354 (let ((cell (assq prop (bookmark-get-bookmark-record bookmark)))) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
355 (if cell |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
356 (setcdr cell val) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
357 (nconc (bookmark-get-bookmark-record bookmark) |
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
358 (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
|
359 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
360 (defun bookmark-get-annotation (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
361 "Return the annotation of BOOKMARK, or nil if none." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
362 (bookmark-prop-get bookmark 'annotation)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
363 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
364 (defun bookmark-set-annotation (bookmark ann) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
365 "Set the annotation of BOOKMARK to ANN." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
366 (bookmark-prop-set bookmark '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
|
367 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
368 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
369 (defun bookmark-get-filename (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
370 "Return the full filename of BOOKMARK." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
371 (bookmark-prop-get bookmark 'filename)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
372 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
373 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
374 (defun bookmark-set-filename (bookmark filename) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
375 "Set the full filename of BOOKMARK to FILENAME." |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
376 (bookmark-prop-set bookmark '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
|
377 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
378 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
379 (defun bookmark-get-position (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
380 "Return the position \(i.e.: point\) of BOOKMARK." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
381 (bookmark-prop-get bookmark 'position)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
382 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
383 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
384 (defun bookmark-set-position (bookmark position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
385 "Set the position \(i.e.: point\) of BOOKMARK to POSITION." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
386 (bookmark-prop-set bookmark '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
|
387 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
388 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
389 (defun bookmark-get-front-context-string (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
390 "Return the front-context-string of BOOKMARK." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
391 (bookmark-prop-get bookmark '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
|
392 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
393 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
394 (defun bookmark-set-front-context-string (bookmark string) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
395 "Set the front-context-string of BOOKMARK to STRING." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
396 (bookmark-prop-set bookmark '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
|
397 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
398 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
399 (defun bookmark-get-rear-context-string (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
400 "Return the rear-context-string of BOOKMARK." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
401 (bookmark-prop-get bookmark '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
|
402 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
403 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
404 (defun bookmark-set-rear-context-string (bookmark string) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
405 "Set the rear-context-string of BOOKMARK to STRING." |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
406 (bookmark-prop-set bookmark '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
|
407 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
408 |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
409 (defun bookmark-get-handler (bookmark) |
92661
c8674d7009d4
* bookmark.el (bookmark-prop-get, bookmark-prop-set): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92568
diff
changeset
|
410 (bookmark-prop-get bookmark 'handler)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
411 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
412 (defvar bookmark-history nil |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
413 "The history list for bookmark functions.") |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
414 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
415 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
416 (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
|
417 "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
|
418 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
|
419 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
|
420 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
|
421 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
|
422 (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
|
423 (if (listp last-nonmenu-event) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
424 (bookmark-menu-popup-paned-menu t prompt (bookmark-all-names)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
425 (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
|
426 (default default) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
427 (prompt (if default |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
428 (concat prompt (format " (%s): " default)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
429 (concat prompt ": "))) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
430 (str |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
431 (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
|
432 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
|
433 nil |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
434 0 |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
435 nil |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
436 '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
|
437 (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
|
438 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
439 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
440 (defmacro bookmark-maybe-historicize-string (string) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
441 "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
|
442 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
|
443 menus, so `completing-read' never gets a chance to set `bookmark-history'." |
35283 | 444 `(or |
445 (interactive-p) | |
446 (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
|
447 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
448 (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
|
449 "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
|
450 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
|
451 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
|
452 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
|
453 |
92674
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
454 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
|
455 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
|
456 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
|
457 |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
458 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
|
459 where ALIST is as described in `bookmark-alist' and may typically contain |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
460 a special cons (handler . SOME-FUNCTION) which sets the handler function |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
461 that should be used to open this bookmark instead of |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
462 `bookmark-default-handler'. The handler should follow the same calling |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
463 convention as the one used by `bookmark-default-handler'. |
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 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
|
466 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
|
467 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
|
468 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
469 (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
|
470 "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
|
471 (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
|
472 ;; 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
|
473 (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
|
474 ;; 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
|
475 record |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
476 (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
|
477 (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
|
478 record))) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
479 |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
480 (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
|
481 "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
|
482 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
|
483 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
|
484 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
|
485 (bookmark-maybe-load-default-file) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
486 (let ((stripped-name (copy-sequence name))) |
84777
68033fec6867
(bookmark-xemacsp): Remove.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
82140
diff
changeset
|
487 (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
|
488 ;; 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
|
489 ;; 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
|
490 (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
|
491 (if (and (not no-overwrite) |
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
492 (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
|
493 ;; 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
|
494 ;; 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
|
495 ;; 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
|
496 (setcdr (bookmark-get-bookmark stripped-name) alist) |
35283 | 497 |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
498 ;; 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
|
499 ;; 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
|
500 ;; case, we want the new bookmark consed onto the alist...) |
35283 | 501 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
502 (push (cons stripped-name alist) bookmark-alist)) |
35283 | 503 |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
504 ;; Added by db |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
505 (setq bookmark-current-bookmark stripped-name) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
506 (setq bookmark-alist-modification-count |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
507 (1+ bookmark-alist-modification-count)) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
508 (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
|
509 (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
|
510 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
511 (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
|
512 (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
|
513 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
514 (defun bookmark-make-record-default (&optional point-only) |
92674
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
515 "Return the record describing the location of a new bookmark. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
516 Must be at the correct position in the buffer in which the bookmark is |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
517 being set. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
518 If POINT-ONLY is non-nil, then only return the subset of the |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
519 record that pertains to the location within the buffer." |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
520 `(,@(unless point-only `((filename . ,(bookmark-buffer-file-name)))) |
92674
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
521 (front-context-string |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
522 . ,(if (>= (- (point-max) (point)) bookmark-search-size) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
523 (buffer-substring-no-properties |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
524 (point) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
525 (+ (point) bookmark-search-size)) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
526 nil)) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
527 (rear-context-string |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
528 . ,(if (>= (- (point) (point-min)) bookmark-search-size) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
529 (buffer-substring-no-properties |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
530 (point) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
531 (- (point) bookmark-search-size)) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
532 nil)) |
ac3c6c3e119c
* bookmark.el (bookmark-make): Don't pass the `annotation' to the
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92661
diff
changeset
|
533 (position . ,(point)))) |
35283 | 534 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
535 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
536 ;;; 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
|
537 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
538 ;; The OLD format of the bookmark-alist was: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
539 ;; |
93705
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
540 ;; ((BOOKMARK-NAME . (FILENAME |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
541 ;; STRING-IN-FRONT |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
542 ;; STRING-BEHIND |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
543 ;; POINT)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
544 ;; ...) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
545 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
546 ;; The NEW format of the bookmark-alist is: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
547 ;; |
93705
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
548 ;; ((BOOKMARK-NAME (filename . FILENAME) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
549 ;; (front-context-string . STRING-IN-FRONT) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
550 ;; (rear-context-string . STRING-BEHIND) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
551 ;; (position . POINT) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
552 ;; (annotation . ANNOTATION) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
553 ;; (whatever . VALUE) |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
554 ;; ... |
442e2ad714cd
Minor docstring a comment improvements.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92789
diff
changeset
|
555 ;; )) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
556 ;; ...) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
557 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
558 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
559 ;; I switched to using an internal as well as external alist because I |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
560 ;; felt that would be a more flexible framework in which to add |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
561 ;; features. It means that the order in which values appear doesn't |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
562 ;; matter, and it means that arbitrary values can be added without |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
563 ;; risk of interfering with existing ones. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
564 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
565 ;; BOOKMARK-NAME is the string the user gives the bookmark and |
35283 | 566 ;; accesses it by from then on. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
567 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
568 ;; FILENAME is the location of the file in which the bookmark is set. |
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 ;; STRING-IN-FRONT is a string of `bookmark-search-size' chars of |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
571 ;; context in front of the point at which the bookmark is set. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
572 ;; |
35283 | 573 ;; STRING-BEHIND is the same thing, but after the point. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
574 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
575 ;; The context strings exist so that modifications to a file don't |
35283 | 576 ;; necessarily cause a bookmark's position to be invalidated. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
577 ;; bookmark-jump will search for STRING-BEHIND and STRING-IN-FRONT in |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
578 ;; case the file has changed since the bookmark was set. It will |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
579 ;; attempt to place the user before the changes, if there were any. |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
580 ;; ANNOTATION is the annotation for the bookmark; it may not exist |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
581 ;; (for backward compatibility), be nil (no annotation), or be a |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
582 ;; string. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
583 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
584 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
585 (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
|
586 "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
|
587 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
|
588 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
589 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
590 (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
|
591 "-*- 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
|
592 "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
|
593 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
594 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
595 (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
|
596 "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
|
597 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
|
598 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
|
599 affect point." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
600 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
601 (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
|
602 (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
|
603 (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
|
604 ;; 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
|
605 (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
|
606 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
607 (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
|
608 (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
|
609 ;; 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
|
610 (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
|
611 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
612 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
613 (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
|
614 "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
|
615 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
616 (lambda (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
617 (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
|
618 (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
|
619 (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
|
620 (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
|
621 (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
|
622 (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
|
623 (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
|
624 (list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
625 name |
41608
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
626 `((filename . ,filename) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
627 (front-context-string . ,(or front-str "")) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
628 (rear-context-string . ,(or rear-str "")) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
629 (position . ,position) |
45db352a0971
Converted backquote to the new style.
Sam Steingold <sds@gnu.org>
parents:
39122
diff
changeset
|
630 (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
|
631 old-list)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
632 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
633 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
634 (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
|
635 "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
|
636 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
|
637 (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
|
638 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
|
639 (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
|
640 (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
|
641 (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
|
642 (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
|
643 (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
|
644 (save-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
645 (goto-char (point-min)) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
646 (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
|
647 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
|
648 ) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
649 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
650 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
651 (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
|
652 "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
|
653 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
|
654 (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
|
655 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
656 (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
|
657 (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
|
658 (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
|
659 (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
|
660 ;; 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
|
661 ;; 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
|
662 0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
663 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
664 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
665 (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
|
666 "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
|
667 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
|
668 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
|
669 (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
|
670 (cond |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
671 ((= 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
|
672 ) ; 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
|
673 ((= version 0) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
674 (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
|
675 (t |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
676 (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
|
677 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
678 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
679 (defun bookmark-insert-file-format-version-stamp () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
680 "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
|
681 (insert |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
682 (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
|
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 (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
|
685 ";;; 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
|
686 ";;; " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
687 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
|
688 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
689 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
690 ;;; 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
|
691 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
692 |
66835
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
693 ;;; Generic helpers. |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
694 |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
695 (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
|
696 "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
|
697 (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
|
698 (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
|
699 |
96e7147004a8
* bookmark.el (bookmark-maybe-message): New function to reduce code
Karl Fogel <kfogel@red-bean.com>
parents:
66834
diff
changeset
|
700 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
701 ;;; Core code: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
702 |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
703 (defvar bookmark-minibuffer-read-name-map |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
704 (let ((map (make-sparse-keymap))) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
705 (set-keymap-parent map minibuffer-local-map) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
706 (define-key map "\C-w" 'bookmark-yank-word) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
707 ;; 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
|
708 ;; 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
|
709 ;; Maybe we should just remove it? --Stef-08 |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
710 (define-key map "\C-u" 'bookmark-insert-current-bookmark) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
711 map)) |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
712 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
713 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
714 (defun bookmark-set (&optional name parg) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
715 "Set a bookmark named NAME inside a file. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
716 If name is nil, then the user will be prompted. |
4633 | 717 With prefix arg, will not overwrite a bookmark that has the same name |
718 as NAME if such a bookmark already exists, but instead will \"push\" | |
719 the new bookmark onto the bookmark alist. Thus the most recently set | |
720 bookmark with name NAME would be the one in effect at any given time, | |
721 but the others are still there, should you decide to delete the most | |
722 recent one. | |
4537 | 723 |
724 To yank words from the text of the buffer and use them as part of the | |
4633 | 725 bookmark name, type C-w while setting a bookmark. Successive C-w's |
4537 | 726 yank successive words. |
727 | |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
728 Typing C-u inserts the name of the last bookmark used in the buffer |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
729 \(as an aid in using a single bookmark name to track your progress |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
730 through a large file\). If no bookmark was used, then C-u inserts the |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
731 name of the file being visited. |
4537 | 732 |
733 Use \\[bookmark-delete] to remove bookmarks \(you give it a name, | |
734 and it removes only the first instance of a bookmark with that name from | |
735 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
|
736 (interactive (list nil current-prefix-arg)) |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
737 (let* ((record (bookmark-make-record)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
738 (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
|
739 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
740 (bookmark-maybe-load-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
|
741 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
742 (setq bookmark-current-point (point)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
743 (setq bookmark-yank-point (point)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
744 (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
|
745 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
746 (let ((str |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
747 (or name |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
748 (read-from-minibuffer |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
749 (format "Set bookmark (%s): " default) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
750 nil |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
751 bookmark-minibuffer-read-name-map |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
752 nil nil default)))) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
753 (and (string-equal str "") (setq str default)) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
754 (bookmark-store str (cdr record) parg) |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
755 |
92690
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
756 ;; Ask for an annotation buffer for this bookmark |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
757 (if bookmark-use-annotations |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
758 (bookmark-edit-annotation str) |
ae00481eacc1
* bookmark.el (bookmark-make-record-function): Change expected return value
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92689
diff
changeset
|
759 (goto-char bookmark-current-point))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
760 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
761 (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
|
762 "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
|
763 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
|
764 Does not affect the kill ring." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
765 (let ((eol (save-excursion (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
|
766 (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
|
767 (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
|
768 (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
|
769 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
770 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
771 ;; 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
|
772 (defvar bookmark-annotation-name nil |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
773 "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
|
774 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
|
775 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
|
776 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
777 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
778 (defun bookmark-default-annotation-text (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
779 (concat "# Type the annotation for bookmark '" bookmark "' here.\n" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
780 "# 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
|
781 "# 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
|
782 "# 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
|
783 (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
|
784 "# 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
|
785 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
786 |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
787 (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
|
788 "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
|
789 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
|
790 (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
|
791 '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
|
792 |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
793 (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
|
794 (let ((map (make-sparse-keymap))) |
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
795 (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
|
796 (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
|
797 map) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
798 "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
|
799 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
800 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
801 (defun bookmark-edit-annotation-mode (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
802 "Mode for editing the annotation of bookmark BOOKMARK. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
803 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
|
804 |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
805 \\{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
|
806 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
807 (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
|
808 (make-local-variable 'bookmark-annotation-name) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
809 (setq bookmark-annotation-name bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
810 (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
|
811 (setq major-mode 'bookmark-edit-annotation-mode |
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
812 mode-name "Edit Bookmark Annotation") |
92689
570c098b116d
(bookmark-set): Make the bookmark before reading annotations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92688
diff
changeset
|
813 (insert (funcall bookmark-edit-annotation-text-func bookmark)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
814 (let ((annotation (bookmark-get-annotation bookmark))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
815 (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
|
816 (insert annotation))) |
62718
d00be6e651cd
(bookmark-read-annotation-mode, bookmark-edit-annotation-mode)
Lute Kamstra <lute@gnu.org>
parents:
61454
diff
changeset
|
817 (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
|
818 |
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 (defun bookmark-send-edited-annotation () |
54906
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
821 "Use buffer contents as annotation for a bookmark. |
dfa3317697a0
(bookmark-send-edited-annotation): Fix docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
53398
diff
changeset
|
822 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
|
823 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
824 (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
|
825 (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
|
826 (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
|
827 (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
|
828 (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
|
829 (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
|
830 (forward-line 1))) |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
831 ;; Take no chances with text properties. |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
832 (let ((annotation (buffer-substring-no-properties (point-min) (point-max))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
833 (bookmark bookmark-annotation-name)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
834 (bookmark-set-annotation bookmark annotation) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
835 (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
|
836 (goto-char bookmark-current-point)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
837 (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
|
838 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
839 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
840 (defun bookmark-edit-annotation (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
841 "Pop up a buffer for editing bookmark BOOKMARK'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
|
842 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
843 (bookmark-edit-annotation-mode bookmark)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
844 |
4537 | 845 |
846 (defun bookmark-insert-current-bookmark () | |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
847 "Insert this buffer's value of `bookmark-current-bookmark'. |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
848 Default to file name if it's nil." |
4537 | 849 (interactive) |
850 (let ((str | |
92688
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
851 (with-current-buffer bookmark-current-buffer |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
852 (or bookmark-current-bookmark |
0524053618bf
Add spurious * in docstrings.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92674
diff
changeset
|
853 (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
|
854 (insert str))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
855 |
4537 | 856 |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
857 (defun bookmark-buffer-name () |
92789
61c661dac856
(Info-current-node): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92690
diff
changeset
|
858 "Return the name of the current buffer's file, non-directory." |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
859 (cond |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
860 ;; 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
|
861 (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
|
862 ;; 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
|
863 ((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
|
864 (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
|
865 dired-directory |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
866 (car dired-directory))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
867 (idx (1- (length dirname)))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
868 ;; Strip the trailing slash. |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
869 (if (= ?/ (aref dirname idx)) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
870 (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
|
871 ;; 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
|
872 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
873 ;; 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
|
874 (t |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
875 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
876 |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
877 |
4537 | 878 (defun bookmark-yank-word () |
879 (interactive) | |
880 ;; get the next word from the buffer and append it to the name of | |
881 ;; the bookmark currently being set. | |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
882 (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
|
883 (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
|
884 (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
|
885 (point) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
886 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
887 (forward-word 1) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
888 (setq bookmark-yank-point (point))))))) |
4537 | 889 (insert string))) |
890 | |
891 (defun bookmark-buffer-file-name () | |
92789
61c661dac856
(Info-current-node): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92690
diff
changeset
|
892 "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
|
893 ;; 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
|
894 ;; 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
|
895 ;; path on different machines, but "~/" will still reach it. |
100171 | 896 (abbreviate-file-name |
99773
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
897 (cond |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
898 (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
|
899 ((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
|
900 (if (stringp dired-directory) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
901 dired-directory |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
902 (car dired-directory))) |
0bb446839781
(bookmark-buffer-file-name): Also abbreviate dired-dir.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99766
diff
changeset
|
903 (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
|
904 |
4537 | 905 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
906 (defun 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
|
907 (and (not bookmarks-already-loaded) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
908 (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
|
909 (prog2 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
910 (and |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
911 ;; 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
|
912 ;; to be renamed. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
913 (file-exists-p (expand-file-name bookmark-old-default-file)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
914 (not (file-exists-p (expand-file-name bookmark-default-file))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
915 (rename-file (expand-file-name bookmark-old-default-file) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
916 (expand-file-name bookmark-default-file))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
917 ;; 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
|
918 t) |
35283 | 919 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
920 (file-readable-p (expand-file-name bookmark-default-file)) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
921 (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
|
922 (setq bookmarks-already-loaded t))) |
4631 | 923 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
924 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
925 (defun bookmark-maybe-sort-alist () |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
926 ;;Return the bookmark-alist for display. If the bookmark-sort-flag |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
927 ;;is non-nil, then return a sorted copy of the alist. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
928 (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
|
929 (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
|
930 (function |
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
931 (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
|
932 bookmark-alist)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
933 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
934 |
65087
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
935 (defvar bookmark-after-jump-hook nil |
83940123c4b3
(bookmark-after-jump-hook): New hook.
Carsten Dominik <dominik@science.uva.nl>
parents:
64800
diff
changeset
|
936 "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
|
937 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
|
938 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
939 (defun bookmark--jump-via (bookmark display-function) |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
940 (bookmark-handle-bookmark bookmark) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
941 (save-current-buffer |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
942 (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
|
943 (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
|
944 (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
|
945 ;; 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
|
946 ;; `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
|
947 (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
|
948 (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
|
949 ;; 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
|
950 ;; show it in a buffer. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
951 (bookmark-show-annotation bookmark))) |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
952 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
953 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
954 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
955 (defun bookmark-jump (bookmark) |
35283 | 956 "Jump to bookmark BOOKMARK (a point in some file). |
4633 | 957 You may have a problem using this function if the value of variable |
958 `bookmark-alist' is nil. If that happens, you need to load in some | |
959 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
|
960 this. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
961 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
962 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
|
963 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
|
964 will then jump to the new location, as well as recording it in place |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
965 of the old one in the permanent bookmark record." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
966 (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
|
967 (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
|
968 bookmark-current-bookmark))) |
59133
55f8ffb8e523
(bookmark-jump): Nice error if BOOKMARK is nil.
Richard M. Stallman <rms@gnu.org>
parents:
56059
diff
changeset
|
969 (unless bookmark |
55f8ffb8e523
(bookmark-jump): Nice error if BOOKMARK is nil.
Richard M. Stallman <rms@gnu.org>
parents:
56059
diff
changeset
|
970 (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
|
971 (bookmark-maybe-historicize-string bookmark) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
972 (bookmark--jump-via bookmark '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
|
973 |
4537 | 974 |
81844
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
975 ;;;###autoload |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
976 (defun bookmark-jump-other-window (bookmark) |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
977 "Jump to BOOKMARK (a point in some file) in another window. |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
978 See `bookmark-jump'." |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
979 (interactive |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
980 (let ((bkm (bookmark-completing-read "Jump to bookmark (in another window)" |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
981 bookmark-current-bookmark))) |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
982 (if (> emacs-major-version 21) |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
983 (list bkm) bkm))) |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
984 (when bookmark |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
985 (bookmark-maybe-historicize-string bookmark) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
986 (bookmark--jump-via 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
|
987 |
805e8454783b
* bookmark.el (bookmark-jump-other-window): New function.
Karl Fogel <kfogel@red-bean.com>
parents:
81843
diff
changeset
|
988 |
28013
b8291d86b5fd
(bookmark-file-or-variation-thereof): New func, for
Gerd Moellmann <gerd@gnu.org>
parents:
26773
diff
changeset
|
989 (defun bookmark-file-or-variation-thereof (file) |
45793
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
990 "Return FILE (a string) if it exists, or return a reasonable |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
991 variation of FILE if that exists. Reasonable variations are checked |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
992 by appending suffixes defined in `Info-suffix-list'. If cannot find FILE |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
993 nor a reasonable variation thereof, then still return FILE if it can |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
994 be retrieved from a VC backend, else return nil." |
45673
fc6d3747add1
* bookmark.el (bookmark-file-or-variation-thereof): Just use
Karl Fogel <kfogel@red-bean.com>
parents:
42206
diff
changeset
|
995 (if (file-exists-p file) |
fc6d3747add1
* bookmark.el (bookmark-file-or-variation-thereof): Just use
Karl Fogel <kfogel@red-bean.com>
parents:
42206
diff
changeset
|
996 file |
45793
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
997 (or |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
998 (progn (require 'info) ; ensure Info-suffix-list is bound |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
999 (catch 'found |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1000 (mapc (lambda (elt) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1001 (let ((suffixed-file (concat file (car elt)))) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1002 (if (file-exists-p suffixed-file) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1003 (throw 'found suffixed-file)))) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1004 Info-suffix-list) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1005 nil)) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1006 ;; Last possibility: try VC |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1007 (if (vc-backend file) file)))) |
4bcea799d0bd
* bookmark.el (bookmark-file-or-variation-thereof): Restore vc-backend
Karl Fogel <kfogel@red-bean.com>
parents:
45674
diff
changeset
|
1008 |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
1009 (defun bookmark-jump-noselect (bookmark) |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1010 "Return the location pointed to by the bookmark BOOKMARK. |
99725
d067d683a1bc
(bookmark-jump-noselect): Move the deprecation notice into the doc
Karl Fogel <kfogel@red-bean.com>
parents:
99228
diff
changeset
|
1011 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
|
1012 |
d067d683a1bc
(bookmark-jump-noselect): Move the deprecation notice into the doc
Karl Fogel <kfogel@red-bean.com>
parents:
99228
diff
changeset
|
1013 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
|
1014 compatibility only." |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1015 (save-excursion |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1016 (bookmark-handle-bookmark bookmark) |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1017 (cons (current-buffer) (point)))) |
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1018 |
99766
f1062fe6487f
* bookmark.el (bookmark-jump-noselect): Add obsolescence declaration
Juanma Barranquero <lekktu@gmail.com>
parents:
99725
diff
changeset
|
1019 (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
|
1020 |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1021 (defun bookmark-handle-bookmark (bookmark) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1022 "Call BOOKMARK's handler or `bookmark-default-handler' if it has none. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1023 Changes current buffer and point and returns nil, or signals a `file-error'. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1024 BOOKMARK can be a bookmark record used internally by some other |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1025 elisp package, or the name of a bookmark to be found in `bookmark-alist'." |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1026 (condition-case err |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1027 (funcall (or (bookmark-get-handler bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1028 'bookmark-default-handler) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1029 (bookmark-get-bookmark bookmark)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1030 (file-error |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1031 ;; 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
|
1032 ;; relocate the bookmark, else remind them to consider deletion. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1033 (when (stringp bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1034 ;; `bookmark' can either be a bookmark name (found in |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1035 ;; `bookmark-alist') or a bookmark object. If it's an object, we |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1036 ;; assume it's a bookmark used internally by some other package. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1037 (let ((file (bookmark-get-filename bookmark))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1038 (when file ;Don't know how to relocate if there's no `file'. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1039 (setq file (expand-file-name file)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1040 (ding) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1041 (if (y-or-n-p (concat (file-name-nondirectory file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1042 " nonexistent. Relocate \"" |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1043 bookmark |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1044 "\"? ")) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1045 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1046 (bookmark-relocate bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1047 ;; Try again. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1048 (funcall (or (bookmark-get-handler bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1049 'bookmark-default-handler) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1050 (bookmark-get-bookmark bookmark))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1051 (message |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1052 "Bookmark not relocated; consider removing it \(%s\)." bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1053 (signal (car err) (cdr err)))))))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1054 ;; Added by db. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1055 (when (stringp bookmark) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1056 (setq bookmark-current-bookmark bookmark)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1057 nil) |
28013
b8291d86b5fd
(bookmark-file-or-variation-thereof): New func, for
Gerd Moellmann <gerd@gnu.org>
parents:
26773
diff
changeset
|
1058 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1059 (defun bookmark-default-handler (bmk) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1060 "Default handler to jump to a particular bookmark location. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1061 BMK is a bookmark record. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1062 Changes current buffer and point and returns nil, or signals a `file-error'." |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1063 (let* ((file (bookmark-get-filename bmk)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1064 (buf (bookmark-prop-get bmk 'buffer)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1065 (forward-str (bookmark-get-front-context-string bmk)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1066 (behind-str (bookmark-get-rear-context-string bmk)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1067 (place (bookmark-get-position bmk))) |
92550
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
1068 ;; FIXME: bookmark-file-or-variation-thereof was needed for Info files, |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
1069 ;; but now that Info bookmarks are handled elsewhere it seems that we |
4170d4a36502
* bookmark.el (bookmark-map, bookmark-read-annotation-mode-map):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87566
diff
changeset
|
1070 ;; should be able to get rid of it. --Stef |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1071 (if (not (if buf (buffer-live-p buf) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1072 (setq file (bookmark-file-or-variation-thereof file)))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1073 (signal 'file-error |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1074 `("Jumping to bookmark" "No such file or directory" |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1075 (bookmark-get-filename bmk))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1076 (set-buffer (or buf (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
|
1077 (if place (goto-char place)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1078 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1079 ;; Go searching forward first. Then, if forward-str exists and |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1080 ;; was found in the file, we can search backward for behind-str. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1081 ;; Rationale is that if text was inserted between the two in the |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1082 ;; file, it's better to be put before it so you can read it, |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1083 ;; rather than after and remain perhaps unaware of the changes. |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1084 (if forward-str |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1085 (if (search-forward forward-str (point-max) t) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1086 (goto-char (match-beginning 0)))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1087 (if behind-str |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1088 (if (search-backward behind-str (point-min) t) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1089 (goto-char (match-end 0))))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1090 nil)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1091 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1092 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1093 (defun bookmark-relocate (bookmark) |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1094 "Relocate BOOKMARK to another file (reading file name with minibuffer). |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1095 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
|
1096 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
|
1097 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
|
1098 (interactive (list (bookmark-completing-read "Bookmark to relocate"))) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1099 (bookmark-maybe-historicize-string bookmark) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1100 (bookmark-maybe-load-default-file) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1101 (let* ((bmrk-filename (bookmark-get-filename bookmark)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1102 (newloc (expand-file-name |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1103 (read-file-name |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1104 (format "Relocate %s to: " bookmark) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1105 (file-name-directory bmrk-filename))))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1106 (bookmark-set-filename bookmark newloc) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1107 (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
|
1108 (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
|
1109 (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
|
1110 (bookmark-save)) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1111 (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
|
1112 |
4537 | 1113 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1114 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1115 (defun bookmark-insert-location (bookmark &optional no-history) |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1116 "Insert the name of the file associated with BOOKMARK. |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1117 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
|
1118 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
|
1119 (interactive (list (bookmark-completing-read "Insert bookmark location"))) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1120 (or no-history (bookmark-maybe-historicize-string bookmark)) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1121 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1122 (prog1 |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1123 (insert (bookmark-location bookmark)) ; *Return this line* |
29476
0797cad76554
Applied this patch from Eli Zaretskii. Pretty much taking on faith
Karl Fogel <kfogel@red-bean.com>
parents:
28013
diff
changeset
|
1124 (if (and (display-color-p) (display-mouse-p)) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1125 (add-text-properties |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1126 start |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1127 (save-excursion (re-search-backward |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1128 "[^ \t]") |
38173
fe0513d0f974
(bookmark-insert-location, bookmark-bmenu-list)
Eli Zaretskii <eliz@gnu.org>
parents:
37041
diff
changeset
|
1129 (1+ (point))) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1130 '(mouse-face highlight |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1131 follow-link t |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1132 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
|
1133 |
15189
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1134 ;;;###autoload |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
1135 (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
|
1136 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1137 (defun bookmark-location (bookmark) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1138 "Return the name of the file associated with BOOKMARK." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1139 (bookmark-maybe-load-default-file) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1140 (bookmark-get-filename bookmark)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1141 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1142 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1143 ;;;###autoload |
4633 | 1144 (defun bookmark-rename (old &optional new) |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1145 "Change the name of OLD bookmark to NEW name. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1146 If called from keyboard, prompt for OLD and NEW. If called from |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1147 menubar, select OLD from a menu and prompt for NEW. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1148 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1149 If called from Lisp, prompt for NEW if only OLD was passed as an |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1150 argument. If called with two strings, then no prompting is done. You |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1151 must pass at least OLD when calling from Lisp. |
4633 | 1152 |
1153 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
|
1154 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
|
1155 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
|
1156 (interactive (list (bookmark-completing-read "Old bookmark name"))) |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1157 (bookmark-maybe-historicize-string old) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1158 (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
|
1159 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1160 (setq bookmark-current-point (point)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1161 (setq bookmark-yank-point (point)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1162 (setq bookmark-current-buffer (current-buffer)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1163 (let ((newname |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1164 (or new ; use second arg, if non-nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1165 (read-from-minibuffer |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1166 "New name: " |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1167 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1168 (let ((now-map (copy-keymap minibuffer-local-map))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1169 (define-key now-map "\C-w" 'bookmark-yank-word) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1170 now-map) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1171 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1172 'bookmark-history)))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1173 (bookmark-set-name old newname) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1174 (setq bookmark-current-bookmark newname) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1175 (bookmark-bmenu-surreptitiously-rebuild-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1176 (setq bookmark-alist-modification-count |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1177 (1+ bookmark-alist-modification-count)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1178 (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
|
1179 (bookmark-save)))) |
4537 | 1180 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1181 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1182 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1183 (defun bookmark-insert (bookmark) |
35283 | 1184 "Insert the text of the file pointed to by bookmark BOOKMARK. |
4633 | 1185 You may have a problem using this function if the value of variable |
1186 `bookmark-alist' is nil. If that happens, you need to load in some | |
1187 bookmarks. See help on function `bookmark-load' for more about | |
4631 | 1188 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
|
1189 (interactive (list (bookmark-completing-read "Insert bookmark contents"))) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1190 (bookmark-maybe-historicize-string bookmark) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1191 (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
|
1192 (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
|
1193 (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
|
1194 (save-current-buffer |
99224
e666721fb443
(bookmark-handle-bookmark): Rename from bookmark-jump-noselect.
Chong Yidong <cyd@stupidchicken.com>
parents:
98537
diff
changeset
|
1195 (bookmark-handle-bookmark bookmark) |
87411
9ac481bc897b
2007-12-26 Tassilo Horn <tassilo@member.fsf.org>
Tassilo Horn <tassilo@member.fsf.org>
parents:
84858
diff
changeset
|
1196 (buffer-string)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1197 (insert str-to-insert) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1198 (push-mark) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1199 (goto-char orig-point))) |
4537 | 1200 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1201 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1202 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1203 (defun bookmark-delete (bookmark &optional batch) |
35283 | 1204 "Delete BOOKMARK from the bookmark list. |
4633 | 1205 Removes only the first instance of a bookmark with that name. If |
1206 there are one or more other bookmarks with the same name, they will | |
1207 not be deleted. Defaults to the \"current\" bookmark \(that is, the | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1208 one most recently used in this file, if any\). |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1209 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
|
1210 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
|
1211 (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
|
1212 (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
|
1213 bookmark-current-bookmark))) |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1214 (bookmark-maybe-historicize-string bookmark) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1215 (bookmark-maybe-load-default-file) |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
1216 (let ((will-go (bookmark-get-bookmark bookmark 'noerror))) |
4595 | 1217 (setq bookmark-alist (delq will-go bookmark-alist)) |
1218 ;; 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
|
1219 ;; occurrence has been deleted |
99774
b53beb0ef91c
(bookmark-get-bookmark): Add `noerror' arg.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
99773
diff
changeset
|
1220 (or (bookmark-get-bookmark bookmark-current-bookmark 'noerror) |
4595 | 1221 (setq bookmark-current-bookmark nil))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1222 ;; Don't rebuild the list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1223 (if batch |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1224 nil |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1225 (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
|
1226 (setq bookmark-alist-modification-count |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1227 (1+ bookmark-alist-modification-count)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1228 (if (bookmark-time-to-save-p) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1229 (bookmark-save)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1230 |
4537 | 1231 |
1232 (defun bookmark-time-to-save-p (&optional last-time) | |
1233 ;; By Gregory M. Saunders <saunders@cis.ohio-state.edu> | |
1234 ;; finds out whether it's time to save bookmarks to a file, by | |
1235 ;; examining the value of variable bookmark-save-flag, and maybe | |
1236 ;; bookmark-alist-modification-count. Returns t if they should be | |
1237 ;; saved, nil otherwise. if last-time is non-nil, then this is | |
1238 ;; being called when emacs is killed. | |
35283 | 1239 (cond (last-time |
4537 | 1240 (and (> bookmark-alist-modification-count 0) |
1241 bookmark-save-flag)) | |
1242 ((numberp bookmark-save-flag) | |
1243 (>= bookmark-alist-modification-count bookmark-save-flag)) | |
1244 (t | |
1245 nil))) | |
1246 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1247 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1248 ;;;###autoload |
4537 | 1249 (defun bookmark-write () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1250 "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
|
1251 Don't use this in Lisp programs; use `bookmark-save' instead." |
4537 | 1252 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1253 (bookmark-maybe-load-default-file) |
4537 | 1254 (bookmark-save t)) |
1255 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1256 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1257 ;;;###autoload |
35283 | 1258 (defun bookmark-save (&optional parg file) |
4633 | 1259 "Save currently defined bookmarks. |
1260 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
|
1261 `bookmark-default-file'. With a prefix arg, save it in file FILE |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1262 \(second argument\). |
4537 | 1263 |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1264 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
|
1265 FILE, and if you just want it to write to the default file, then |
4537 | 1266 pass no arguments. Or pass in nil and FILE, and it will save in FILE |
1267 instead. If you pass in one argument, and it is non-nil, then the | |
1268 user will be interactively queried for a file to save in. | |
1269 | |
4595 | 1270 When you want to load in the bookmarks from a file, use |
4633 | 1271 \`bookmark-load\', \\[bookmark-load]. That function will prompt you |
4595 | 1272 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
|
1273 `bookmark-default-file'." |
4537 | 1274 (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
|
1275 (bookmark-maybe-load-default-file) |
4537 | 1276 (cond |
1277 ((and (null parg) (null file)) | |
1278 ;;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
|
1279 (bookmark-write-file bookmark-default-file)) |
4537 | 1280 ((and (null parg) file) |
1281 ;;whether interactive or not, write to given file | |
1282 (bookmark-write-file file)) | |
1283 ((and parg (not file)) | |
1284 ;;have been called interactively w/ prefix arg | |
1285 (let ((file (read-file-name "File to save bookmarks in: "))) | |
1286 (bookmark-write-file file))) | |
1287 (t ; someone called us with prefix-arg *and* a file, so just write to file | |
1288 (bookmark-write-file file))) | |
1289 ;; signal that we have synced the bookmark file by setting this to | |
1290 ;; 0. If there was an error at any point before, it will not get | |
1291 ;; set, which is what we want. | |
1292 (setq bookmark-alist-modification-count 0)) | |
1293 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1294 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1295 |
4537 | 1296 (defun bookmark-write-file (file) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1297 (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
|
1298 (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
|
1299 (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
|
1300 (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
|
1301 (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
|
1302 (print-level nil)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1303 (bookmark-insert-file-format-version-stamp) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1304 (pp bookmark-alist (current-buffer)) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1305 (let ((version-control |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1306 (cond |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1307 ((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
|
1308 ((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
|
1309 ((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
|
1310 (t t)))) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1311 (condition-case nil |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1312 (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
|
1313 (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
|
1314 (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
|
1315 (bookmark-maybe-message |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1316 "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
|
1317 |
4537 | 1318 |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1319 (defun bookmark-import-new-list (new-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1320 ;; Walk over the new list, adding each individual bookmark |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1321 ;; carefully. "Carefully" means checking against the existing |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1322 ;; bookmark-alist and renaming the new bookmarks with <N> extensions |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1323 ;; as necessary. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1324 (let ((lst new-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1325 (names (bookmark-all-names))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1326 (while lst |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1327 (let* ((full-record (car lst))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1328 (bookmark-maybe-rename full-record names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1329 (setq bookmark-alist (nconc bookmark-alist (list full-record))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1330 (setq names (cons (bookmark-name-from-full-record full-record) names)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1331 (setq lst (cdr lst)))))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1332 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1333 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1334 (defun bookmark-maybe-rename (full-record names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1335 ;; just a helper for bookmark-import-new-list; it is only for |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1336 ;; readability that this is not inlined. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1337 ;; |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1338 ;; Once this has found a free name, it sets full-record to that |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1339 ;; name. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1340 (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
|
1341 (if (member found-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1342 ;; 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
|
1343 (let ((count 2) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1344 (new-name found-name)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1345 (while (member new-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1346 (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
|
1347 (setq count (1+ count))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1348 (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
|
1349 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1350 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1351 ;;;###autoload |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1352 (defun bookmark-load (file &optional overwrite no-msg) |
4633 | 1353 "Load bookmarks from FILE (which must be in bookmark format). |
1354 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
|
1355 optional second argument OVERWRITE is non-nil, existing bookmarks are |
4633 | 1356 destroyed. Optional third arg NO-MSG means don't display any messages |
1357 while loading. | |
4537 | 1358 |
1359 If you load a file that doesn't contain a proper bookmark alist, you | |
4633 | 1360 will corrupt Emacs's bookmark list. Generally, you should only load |
4537 | 1361 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
|
1362 place. Your own personal bookmark file, `~/.emacs.bmk', is |
4631 | 1363 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
|
1364 explicitly. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1365 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1366 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
|
1367 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
|
1368 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
|
1369 method buffers use to resolve name collisions." |
4537 | 1370 (interactive |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1371 (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
|
1372 (format "Load bookmarks from: (%s) " |
35283 | 1373 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
|
1374 ;;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
|
1375 ;;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
|
1376 ;;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
|
1377 "~/" bookmark-default-file 'confirm))) |
4537 | 1378 (setq file (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
|
1379 (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
|
1380 (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
|
1381 (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
|
1382 (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
|
1383 (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
|
1384 (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
|
1385 (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
|
1386 (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
|
1387 (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
|
1388 (if (listp blist) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1389 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1390 (if overwrite |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1391 (progn |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1392 (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
|
1393 (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
|
1394 ;; else |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1395 (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
|
1396 (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
|
1397 (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
|
1398 (if (string-equal |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1399 (expand-file-name bookmark-default-file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1400 file) |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1401 (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
|
1402 (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
|
1403 (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
|
1404 (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
|
1405 (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
|
1406 (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
|
1407 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1408 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1409 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1410 ;;; 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
|
1411 ;; 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
|
1412 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1413 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1414 (defvar bookmark-bmenu-bookmark-column nil) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1415 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1416 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1417 (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
|
1418 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1419 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1420 (defvar bookmark-bmenu-mode-map nil) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1421 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1422 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1423 (if bookmark-bmenu-mode-map |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1424 nil |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1425 (setq bookmark-bmenu-mode-map (make-keymap)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1426 (suppress-keymap bookmark-bmenu-mode-map t) |
21094
10363c2d994a
(bookmark-bmenu-mode-map): Use quit-window for q.
Richard M. Stallman <rms@gnu.org>
parents:
19472
diff
changeset
|
1427 (define-key bookmark-bmenu-mode-map "q" 'quit-window) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1428 (define-key bookmark-bmenu-mode-map "v" 'bookmark-bmenu-select) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1429 (define-key bookmark-bmenu-mode-map "w" 'bookmark-bmenu-locate) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1430 (define-key bookmark-bmenu-mode-map "2" 'bookmark-bmenu-2-window) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1431 (define-key bookmark-bmenu-mode-map "1" 'bookmark-bmenu-1-window) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1432 (define-key bookmark-bmenu-mode-map "j" 'bookmark-bmenu-this-window) |
15189
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1433 (define-key bookmark-bmenu-mode-map "\C-c\C-c" 'bookmark-bmenu-this-window) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1434 (define-key bookmark-bmenu-mode-map "f" 'bookmark-bmenu-this-window) |
26773
2f62700913ab
(bookmark-bmenu-mode-map): Bind RET like f.
Richard M. Stallman <rms@gnu.org>
parents:
24763
diff
changeset
|
1435 (define-key bookmark-bmenu-mode-map "\C-m" 'bookmark-bmenu-this-window) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1436 (define-key bookmark-bmenu-mode-map "o" 'bookmark-bmenu-other-window) |
15189
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1437 (define-key bookmark-bmenu-mode-map "\C-o" |
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1438 'bookmark-bmenu-switch-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
|
1439 (define-key bookmark-bmenu-mode-map "s" 'bookmark-bmenu-save) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1440 (define-key bookmark-bmenu-mode-map "k" 'bookmark-bmenu-delete) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1441 (define-key bookmark-bmenu-mode-map "\C-d" 'bookmark-bmenu-delete-backwards) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1442 (define-key bookmark-bmenu-mode-map "x" 'bookmark-bmenu-execute-deletions) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1443 (define-key bookmark-bmenu-mode-map "d" 'bookmark-bmenu-delete) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1444 (define-key bookmark-bmenu-mode-map " " 'next-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1445 (define-key bookmark-bmenu-mode-map "n" 'next-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1446 (define-key bookmark-bmenu-mode-map "p" 'previous-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1447 (define-key bookmark-bmenu-mode-map "\177" 'bookmark-bmenu-backup-unmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1448 (define-key bookmark-bmenu-mode-map "?" 'describe-mode) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1449 (define-key bookmark-bmenu-mode-map "u" 'bookmark-bmenu-unmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1450 (define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark) |
35283 | 1451 (define-key bookmark-bmenu-mode-map "l" 'bookmark-bmenu-load) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1452 (define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename) |
56059
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1453 (define-key bookmark-bmenu-mode-map "R" 'bookmark-bmenu-relocate) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1454 (define-key bookmark-bmenu-mode-map "t" '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
|
1455 (define-key bookmark-bmenu-mode-map "a" '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
|
1456 (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1457 (define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1458 (define-key bookmark-bmenu-mode-map [mouse-2] |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1459 'bookmark-bmenu-other-window-with-mouse)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1460 |
35283 | 1461 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1462 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1463 ;; 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
|
1464 ;; data. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1465 (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
|
1466 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1467 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1468 ;; todo: need to display whether or not bookmark exists as a buffer in |
35283 | 1469 ;; flag column. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1470 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1471 ;; Format: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1472 ;; 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
|
1473 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1474 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1475 (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
|
1476 "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
|
1477 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
|
1478 (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
|
1479 (save-excursion |
35283 | 1480 (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
|
1481 (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
|
1482 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1483 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1484 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1485 (defun bookmark-bmenu-list () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1486 "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
|
1487 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
|
1488 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
|
1489 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
|
1490 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1491 (bookmark-maybe-load-default-file) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1492 (if (interactive-p) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1493 (switch-to-buffer (get-buffer-create "*Bookmark List*")) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1494 (set-buffer (get-buffer-create "*Bookmark List*"))) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1495 (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
|
1496 (erase-buffer) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1497 (insert "% Bookmark\n- --------\n") |
66201
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
1498 (add-text-properties (point-min) (point) |
54d9518d9113
(bookmark-menu-heading): New face.
Romain Francoise <romain@orebokech.com>
parents:
66192
diff
changeset
|
1499 '(font-lock-face bookmark-menu-heading)) |
84858
e745533cff59
(bookmark-bmenu-list, bookmark-show-all-annotations):
Juanma Barranquero <lekktu@gmail.com>
parents:
84777
diff
changeset
|
1500 (mapc |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1501 (lambda (full-record) |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
1502 ;; if a bookmark has an annotation, prepend a "*" |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1503 ;; in the list of bookmarks. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1504 (let ((annotation (bookmark-get-annotation |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1505 (bookmark-name-from-full-record full-record)))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1506 (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
|
1507 (insert " *") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1508 (insert " ")) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1509 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1510 (insert (bookmark-name-from-full-record full-record)) |
29476
0797cad76554
Applied this patch from Eli Zaretskii. Pretty much taking on faith
Karl Fogel <kfogel@red-bean.com>
parents:
28013
diff
changeset
|
1511 (if (and (display-color-p) (display-mouse-p)) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1512 (add-text-properties |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1513 start |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1514 (save-excursion (re-search-backward |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1515 "[^ \t]") |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1516 (1+ (point))) |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1517 '(mouse-face highlight |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1518 follow-link t |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1519 help-echo "mouse-2: go to this bookmark in other window"))) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1520 (insert "\n") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1521 ))) |
78160
ba35decf8cc1
(bookmark-maybe-sort-alist): Don't modify bookmark-alist.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
78159
diff
changeset
|
1522 (bookmark-maybe-sort-alist))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1523 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1524 (forward-line 2) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1525 (bookmark-bmenu-mode) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1526 (if 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
|
1527 (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
|
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 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1530 (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
|
1531 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1532 (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
|
1533 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1534 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1535 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1536 (defun bookmark-bmenu-mode () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1537 "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
|
1538 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
|
1539 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
|
1540 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
|
1541 \\<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
|
1542 \\[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
|
1543 \\[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
|
1544 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
|
1545 \\[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
|
1546 \\[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
|
1547 \\[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
|
1548 \\[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
|
1549 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
|
1550 \\[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
|
1551 \\[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
|
1552 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
|
1553 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark. |
35283 | 1554 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\). |
56059
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1555 \\[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
|
1556 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down. |
35283 | 1557 \\[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
|
1558 \\[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
|
1559 \\[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
|
1560 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
|
1561 \\[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
|
1562 \\[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
|
1563 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
|
1564 \\[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
|
1565 \\[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
|
1566 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
|
1567 \\[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
|
1568 \\[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
|
1569 (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
|
1570 (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
|
1571 (setq truncate-lines t) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1572 (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
|
1573 (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
|
1574 (setq mode-name "Bookmark Menu") |
62718
d00be6e651cd
(bookmark-read-annotation-mode, bookmark-edit-annotation-mode)
Lute Kamstra <lute@gnu.org>
parents:
61454
diff
changeset
|
1575 (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
|
1576 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1577 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1578 (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
|
1579 "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
|
1580 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
|
1581 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1582 (cond |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1583 (show |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1584 (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
|
1585 (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
|
1586 (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
|
1587 (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
|
1588 (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
|
1589 (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
|
1590 (t |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1591 (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
|
1592 (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
|
1593 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1594 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1595 (defun bookmark-bmenu-show-filenames (&optional force) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1596 (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
|
1597 nil ;already shown, so do nothing |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1598 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1599 (save-window-excursion |
4537 | 1600 (goto-char (point-min)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1601 (forward-line 2) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1602 (setq bookmark-bmenu-hidden-bookmarks ()) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1603 (let ((inhibit-read-only t)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1604 (while (< (point) (point-max)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1605 (let ((bmrk (bookmark-bmenu-bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1606 (setq 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
|
1607 (cons bmrk bookmark-bmenu-hidden-bookmarks)) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1608 (let ((start (save-excursion (end-of-line) (point)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1609 (move-to-column bookmark-bmenu-file-column t) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1610 ;; Strip off `mouse-face' from the white spaces region. |
29476
0797cad76554
Applied this patch from Eli Zaretskii. Pretty much taking on faith
Karl Fogel <kfogel@red-bean.com>
parents:
28013
diff
changeset
|
1611 (if (and (display-color-p) (display-mouse-p)) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1612 (remove-text-properties start (point) |
38173
fe0513d0f974
(bookmark-insert-location, bookmark-bmenu-list)
Eli Zaretskii <eliz@gnu.org>
parents:
37041
diff
changeset
|
1613 '(mouse-face nil help-echo nil)))) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1614 (delete-region (point) (progn (end-of-line) (point))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1615 (insert " ") |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1616 ;; Pass the NO-HISTORY arg: |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1617 (bookmark-insert-location bmrk t) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1618 (forward-line 1)))))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1619 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1620 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1621 (defun bookmark-bmenu-hide-filenames (&optional force) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1622 (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
|
1623 ;; nothing to hide if above is nil |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1624 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1625 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1626 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1627 (forward-line 2) |
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 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
|
1629 (nreverse bookmark-bmenu-hidden-bookmarks)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1630 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1631 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1632 (search-forward "Bookmark") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1633 (backward-word 1) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1634 (setq bookmark-bmenu-bookmark-column (current-column))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1635 (save-excursion |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1636 (let ((inhibit-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
|
1637 (while 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
|
1638 (move-to-column bookmark-bmenu-bookmark-column t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1639 (bookmark-kill-line) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1640 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1641 (insert (car bookmark-bmenu-hidden-bookmarks)) |
29476
0797cad76554
Applied this patch from Eli Zaretskii. Pretty much taking on faith
Karl Fogel <kfogel@red-bean.com>
parents:
28013
diff
changeset
|
1642 (if (and (display-color-p) (display-mouse-p)) |
66192
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1643 (add-text-properties |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1644 start |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1645 (save-excursion (re-search-backward |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1646 "[^ \t]") |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1647 (1+ (point))) |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1648 '(mouse-face highlight |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1649 follow-link t |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1650 help-echo |
16f7998a8424
* bookmark.el (bookmark-insert-location, bookmark-bmenu-list)
Romain Francoise <romain@orebokech.com>
parents:
66185
diff
changeset
|
1651 "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
|
1652 (setq 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
|
1653 (cdr bookmark-bmenu-hidden-bookmarks)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1654 (forward-line 1)))))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1655 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1656 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1657 (defun bookmark-bmenu-check-position () |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1658 ;; Returns non-nil if on a line with a bookmark. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1659 ;; (The actual value returned is bookmark-alist). |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1660 ;; Else reposition and try again, else return nil. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1661 (cond ((< (count-lines (point-min) (point)) 2) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1662 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1663 (forward-line 2) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1664 bookmark-alist) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1665 ((and (bolp) (eobp)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1666 (beginning-of-line 0) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1667 bookmark-alist) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1668 (t |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1669 bookmark-alist))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1670 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1671 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1672 (defun bookmark-bmenu-bookmark () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1673 ;; return a string which is bookmark of this line. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1674 (if (bookmark-bmenu-check-position) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1675 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1676 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1677 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1678 (search-forward "Bookmark") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1679 (backward-word 1) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1680 (setq bookmark-bmenu-bookmark-column (current-column))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1681 (if 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
|
1682 (bookmark-bmenu-hide-filenames)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1683 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1684 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1685 (beginning-of-line) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1686 (forward-char bookmark-bmenu-bookmark-column) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1687 (prog1 |
35283 | 1688 (buffer-substring-no-properties (point) |
1689 (progn | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1690 (end-of-line) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1691 (point))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1692 ;; well, this is certainly crystal-clear: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1693 (if 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
|
1694 (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
|
1695 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1696 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1697 (defun bookmark-show-annotation (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1698 "Display the annotation for bookmark named BOOKMARK in a buffer, |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1699 if an annotation exists." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1700 (let ((annotation (bookmark-get-annotation bookmark))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1701 (if (and annotation (not (string-equal annotation ""))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1702 (save-excursion |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1703 (let ((old-buf (current-buffer))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1704 (pop-to-buffer (get-buffer-create "*Bookmark Annotation*") t) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1705 (delete-region (point-min) (point-max)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1706 ;; (insert (concat "Annotation for bookmark '" bookmark "':\n\n")) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1707 (insert annotation) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1708 (goto-char (point-min)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1709 (pop-to-buffer 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
|
1710 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1711 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1712 (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
|
1713 "Display the annotations for all bookmarks in a buffer." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1714 (let ((old-buf (current-buffer))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1715 (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
|
1716 (delete-region (point-min) (point-max)) |
84858
e745533cff59
(bookmark-bmenu-list, bookmark-show-all-annotations):
Juanma Barranquero <lekktu@gmail.com>
parents:
84777
diff
changeset
|
1717 (mapc |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1718 (lambda (full-record) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1719 (let* ((name (bookmark-name-from-full-record full-record)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1720 (ann (bookmark-get-annotation name))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1721 (insert (concat name ":\n")) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1722 (if (and ann (not (string-equal ann ""))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1723 ;; insert the annotation, indented by 4 spaces. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1724 (progn |
78159
639d3d9bce58
(bookmark-show-all-annotations):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
1725 (save-excursion (insert ann) (unless (bolp) |
639d3d9bce58
(bookmark-show-all-annotations):
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
75347
diff
changeset
|
1726 (insert "\n"))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1727 (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
|
1728 (beginning-of-line) ; paranoia |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1729 (insert " ") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1730 (forward-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1731 (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
|
1732 bookmark-alist) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1733 (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
|
1734 (pop-to-buffer old-buf))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1735 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1736 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1737 (defun bookmark-bmenu-mark () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1738 "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
|
1739 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1740 (beginning-of-line) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1741 (if (bookmark-bmenu-check-position) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1742 (let ((inhibit-read-only t)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1743 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1744 (insert ?>) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1745 (forward-line 1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1746 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1747 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1748 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1749 (defun bookmark-bmenu-select () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1750 "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
|
1751 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
|
1752 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1753 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1754 (let ((bmrk (bookmark-bmenu-bookmark)) |
35283 | 1755 (menu (current-buffer)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1756 (others ()) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1757 tem) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1758 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1759 (while (re-search-forward "^>" nil t) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1760 (setq tem (bookmark-bmenu-bookmark)) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1761 (let ((inhibit-read-only t)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1762 (delete-char -1) |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
1763 (insert ?\s)) |
35283 | 1764 (or (string-equal tem bmrk) |
1765 (member tem others) | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1766 (setq others (cons tem others)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1767 (setq others (nreverse others) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1768 tem (/ (1- (frame-height)) (1+ (length others)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1769 (delete-other-windows) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1770 (bookmark-jump bmrk) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1771 (bury-buffer menu) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1772 (if others |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1773 (while others |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1774 (split-window nil tem) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1775 (other-window 1) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1776 (bookmark-jump (car others)) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1777 (setq others (cdr others))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1778 (other-window 1))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1779 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1780 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1781 (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
|
1782 "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
|
1783 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
|
1784 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1785 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1786 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1787 (bookmark-save parg)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1788 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1789 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1790 (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
|
1791 "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
|
1792 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1793 (if (bookmark-bmenu-check-position) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1794 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1795 (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
|
1796 ;; This will call `bookmark-bmenu-list' |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1797 (call-interactively 'bookmark-load))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1798 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1799 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1800 (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
|
1801 "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
|
1802 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1803 (if (bookmark-bmenu-check-position) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1804 (progn |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1805 (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
|
1806 (bury-buffer (other-buffer)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1807 (delete-other-windows)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1808 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1809 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1810 (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
|
1811 "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
|
1812 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1813 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1814 (let ((bmrk (bookmark-bmenu-bookmark)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1815 (menu (current-buffer)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1816 (pop-up-windows t)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1817 (delete-other-windows) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1818 (switch-to-buffer (other-buffer)) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1819 (let ((bookmark-automatically-show-annotations nil)) ;FIXME: needed? |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1820 (bookmark--jump-via bmrk 'pop-to-buffer)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1821 (bury-buffer menu)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1822 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1823 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1824 (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
|
1825 "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
|
1826 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1827 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1828 (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
|
1829 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1830 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1831 (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
|
1832 "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
|
1833 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1834 (let ((bookmark (bookmark-bmenu-bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1835 (if (bookmark-bmenu-check-position) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1836 (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1837 (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
|
1838 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1839 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1840 (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
|
1841 "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
|
1842 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
|
1843 (interactive) |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1844 (let ((bookmark (bookmark-bmenu-bookmark)) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1845 (pop-up-windows t) |
35283 | 1846 same-window-buffer-names |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1847 same-window-regexps) |
11021
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1848 (if (bookmark-bmenu-check-position) |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1849 (let ((bookmark-automatically-show-annotations t)) ;FIXME: needed? |
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1850 (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
|
1851 |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1852 (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
|
1853 "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
|
1854 (interactive "e") |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
1855 (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
|
1856 (save-excursion |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1857 (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
|
1858 (bookmark-bmenu-other-window)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1859 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1860 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1861 (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
|
1862 "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
|
1863 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1864 (let ((bookmark (bookmark-bmenu-bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1865 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1866 (bookmark-show-annotation bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1867 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1868 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1869 (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
|
1870 "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
|
1871 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1872 (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
|
1873 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1874 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1875 (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
|
1876 "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
|
1877 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1878 (let ((bookmark (bookmark-bmenu-bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1879 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1880 (bookmark-edit-annotation bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1881 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1882 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1883 (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
|
1884 "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
|
1885 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
|
1886 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1887 (beginning-of-line) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1888 (if (bookmark-bmenu-check-position) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1889 (progn |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1890 (let ((inhibit-read-only t)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1891 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1892 ;; any flags to reset according to circumstances? How about a |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1893 ;; flag indicating whether this bookmark is being visited? |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1894 ;; well, we don't have this now, so maybe later. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1895 (insert " ")) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1896 (forward-line (if backup -1 1)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1897 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1898 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1899 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1900 (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
|
1901 "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
|
1902 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1903 (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
|
1904 (if (bookmark-bmenu-check-position) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1905 (progn |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1906 (bookmark-bmenu-unmark) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1907 (forward-line -1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1908 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1909 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1910 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1911 (defun bookmark-bmenu-delete () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1912 "Mark bookmark on this line to be deleted. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1913 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
|
1914 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1915 (beginning-of-line) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1916 (if (bookmark-bmenu-check-position) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
1917 (let ((inhibit-read-only t)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1918 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1919 (insert ?D) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1920 (forward-line 1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1921 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1922 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1923 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1924 (defun bookmark-bmenu-delete-backwards () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1925 "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
|
1926 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
|
1927 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1928 (bookmark-bmenu-delete) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1929 (forward-line -2) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1930 (if (bookmark-bmenu-check-position) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1931 (forward-line 1)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1932 (bookmark-bmenu-check-position)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1933 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1934 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1935 (defun bookmark-bmenu-execute-deletions () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1936 "Delete bookmarks marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1937 (interactive) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1938 (message "Deleting bookmarks...") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1939 (let ((hide-em 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
|
1940 (o-point (point)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1941 (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
|
1942 (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
|
1943 (if (looking-at "^D") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1944 nil |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1945 (buffer-substring |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1946 (point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1947 (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
|
1948 (o-col (current-column))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1949 (if hide-em (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
|
1950 (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
|
1951 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1952 (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
|
1953 (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
|
1954 (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
|
1955 (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
|
1956 (setq bookmark-bmenu-toggle-filenames hide-em) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1957 (if 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
|
1958 (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
|
1959 (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
|
1960 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1961 (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
|
1962 (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
|
1963 (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
|
1964 (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
|
1965 (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
|
1966 (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
|
1967 (setq bookmark-alist-modification-count |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1968 (1+ bookmark-alist-modification-count)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1969 (if (bookmark-time-to-save-p) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1970 (bookmark-save)) |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1971 (message "Deleting bookmarks...done") |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1972 )) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1973 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1974 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1975 (defun bookmark-bmenu-rename () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1976 "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
|
1977 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1978 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1979 (let ((bmrk (bookmark-bmenu-bookmark)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1980 (thispoint (point))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1981 (bookmark-rename bmrk) |
10952
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) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1983 (goto-char thispoint)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1984 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1985 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1986 (defun bookmark-bmenu-locate () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1987 "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
|
1988 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1989 (if (bookmark-bmenu-check-position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1990 (let ((bmrk (bookmark-bmenu-bookmark))) |
65582
4d1085b02d64
Message format spec fixes (1)
Deepak Goel <deego@gnufans.org>
parents:
65112
diff
changeset
|
1991 (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
|
1992 |
56059
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1993 (defun bookmark-bmenu-relocate () |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1994 "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
|
1995 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
|
1996 (interactive) |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1997 (if (bookmark-bmenu-check-position) |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1998 (let ((bmrk (bookmark-bmenu-bookmark)) |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
1999 (thispoint (point))) |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2000 (bookmark-relocate bmrk) |
4e04e776fb5e
* bookmark.el (bookmark-bmenu-relocate): New function, as
Karl Fogel <kfogel@red-bean.com>
parents:
54906
diff
changeset
|
2001 (goto-char thispoint)))) |
4537 | 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 ;;; Menu bar stuff. Prefix is "bookmark-menu". |
4537 | 2005 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2006 (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
|
2007 "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
|
2008 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
|
2009 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
|
2010 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
|
2011 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
|
2012 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
|
2013 (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
|
2014 (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
|
2015 (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
|
2016 (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
|
2017 (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
|
2018 (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
|
2019 (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
|
2020 (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
|
2021 (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
|
2022 (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
|
2023 (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
|
2024 str) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2025 str) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2026 lst) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2027 (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
|
2028 (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
|
2029 (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
|
2030 (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
|
2031 (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
|
2032 (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
|
2033 pane-list))) |
64634
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2034 |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2035 ;; 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
|
2036 (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
|
2037 (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
|
2038 |
4537 | 2039 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2040 ;; 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
|
2041 ;; following works, and for explaining what to do to make it work. |
4537 | 2042 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2043 ;; 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
|
2044 ;; that the whole job is done in loaddefs.el. |
4537 | 2045 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
2046 ;; 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
|
2047 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2048 ;;;###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
|
2049 (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
|
2050 (let ((map (make-sparse-keymap "Bookmark functions"))) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2051 (define-key map [load] '("Load a Bookmark File..." . bookmark-load)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2052 (define-key map [write] '("Save Bookmarks As..." . bookmark-write)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2053 (define-key map [save] '("Save Bookmarks" . bookmark-save)) |
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2054 (define-key map [edit] '("Edit Bookmark List" . bookmark-bmenu-list)) |
61028
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2055 (define-key map [delete] '("Delete Bookmark..." . bookmark-delete)) |
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2056 (define-key map [rename] '("Rename Bookmark..." . bookmark-rename)) |
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2057 (define-key map [locate] '("Insert Location..." . bookmark-locate)) |
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2058 (define-key map [insert] '("Insert Contents..." . bookmark-insert)) |
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2059 (define-key map [set] '("Set Bookmark..." . bookmark-set)) |
8b4c93f5bcf1
(menu-bar-bookmark-map): Add ellipsis to "Jump to
Juri Linkov <juri@jurta.org>
parents:
59133
diff
changeset
|
2060 (define-key map [jump] '("Jump to Bookmark..." . bookmark-jump)) |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2061 map)) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2062 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2063 ;;;###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
|
2064 (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
|
2065 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2066 ;; 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
|
2067 (if (boundp 'menu-bar-final-items) |
35283 | 2068 (if 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
|
2069 (setq menu-bar-final-items |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2070 (cons 'bookmark menu-bar-final-items))) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2071 (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
|
2072 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2073 ;;;; 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
|
2074 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2075 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
2076 ;; 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
|
2077 (defvar bookmark-load-hook nil |
52171
03075c276aac
(bookmark-completing-read): Use a popup menu if activated from the mouse.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52103
diff
changeset
|
2078 "Hook run at the end of loading bookmark.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2079 |
96280
bfca3297fa0b
* bookmark.el (bookmark-alist): Allow the 2 slightly different formats
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94678
diff
changeset
|
2080 ;; 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
|
2081 (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
|
2082 "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
|
2083 |
4045a1b1a5c9
(bookmark-automatically-show-annotations, bookmark-read-annotation-text-func): Doc fixes.
Juanma Barranquero <lekktu@gmail.com>
parents:
64091
diff
changeset
|
2084 (define-obsolete-variable-alias 'bookmark-exit-hooks 'bookmark-exit-hook "22.1") |
35283 | 2085 |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2086 (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
|
2087 "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
|
2088 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
|
2089 (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
|
2090 (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
|
2091 (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
|
2092 (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
|
2093 |
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2094 (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
|
2095 |
98537
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2096 (defun bookmark-unload-function () |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2097 "Unload the Bookmark library." |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2098 (when bookmark-save-flag (bookmark-save)) |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2099 ;; continue standard unloading |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2100 nil) |
acd509f38a6a
* bookmark.el (bookmark-unload-function): New function.
Juanma Barranquero <lekktu@gmail.com>
parents:
96438
diff
changeset
|
2101 |
34529
8e38e93616a7
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Karl Fogel <kfogel@red-bean.com>
parents:
29476
diff
changeset
|
2102 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2103 (run-hooks 'bookmark-load-hook) |
4537 | 2104 |
2105 (provide 'bookmark) | |
35283 | 2106 |
87566
0c4a74c24677
* progmodes/ada-xref.el (ada-prj-find-prj-file):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87521
diff
changeset
|
2107 ;; arch-tag: 139f519a-dd0c-4b8d-8b5d-f9fcf53ca8f6 |
4595 | 2108 ;;; bookmark.el ends here |