Mercurial > emacs
annotate lisp/bookmark.el @ 24693:7d78745d1195
(display-time-update): Allow for wrap-around when
checking against display-time-server-down-time.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Tue, 04 May 1999 17:34:36 +0000 |
parents | 5682c77dce71 |
children | c9362ef0817a |
rev | line source |
---|---|
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later. |
4537 | 2 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
3 ;; Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation |
4537 | 4 |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
5 ;; 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
|
6 ;; Maintainer: Karl Fogel <kfogel@red-bean.com> |
4537 | 7 ;; 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
|
8 ;; Keywords: bookmarks, placeholders, annotations |
4537 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; This package is for setting "bookmarks" in files. A bookmark | |
30 ;; associates a string with a location in a certain file. Thus, you | |
31 ;; can navigate your way to that location by providing the string. | |
32 ;; See the "User Variables" section for customizations. | |
4537 | 33 |
34 ;; Thanks to David Bremner <bremner@cs.sfu.ca> for thinking of and | |
35 ;; then implementing the bookmark-current-bookmark idea. He even | |
4891 | 36 ;; sent *patches*, bless his soul... |
4537 | 37 |
38 ;; Thanks to Gregory M. Saunders <saunders@cis.ohio-state.edu> for | |
39 ;; fixing and improving bookmark-time-to-save-p. | |
40 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
41 ;; 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
|
42 ;; sorts the alist before presenting it to the user (in bookmark-bmenu-list |
4891 | 43 ;; and the menu-bar). |
44 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
45 ;; 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
|
46 ;; 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
|
47 ;; 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
|
48 ;; stuff). |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
49 |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
50 ;; Kudos (whatever they are) go to Jim Blandy <jimb@red-bean.com> |
4891 | 51 ;; for his eminently sensible suggestion to separate bookmark-jump |
52 ;; into bookmark-jump and bookmark-jump-noselect, which made many | |
53 ;; other things cleaner as well. | |
54 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
55 ;; 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
|
56 ;; autoloads on the menu-bar. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
57 |
12880 | 58 ;; Jonathan Stigelman <stig@hackvan.com> gave patches for default |
4891 | 59 ;; values in bookmark-jump and bookmark-set. Everybody please keep |
60 ;; all the keystrokes they save thereby and send them to him at the | |
61 ;; end of each year :-) (No, seriously, thanks Jonathan!) | |
62 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
63 ;; 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
|
64 ;; 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
|
65 |
4537 | 66 ;; Based on info-bookmark.el, by Karl Fogel and Ken Olstad |
67 ;; <olstad@msc.edu>. | |
68 | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
69 ;; 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
|
70 ;; reported and fixed. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
71 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
72 ;; 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
|
73 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
74 ;; Enough with the credits already, get on to the good stuff: |
4537 | 75 |
76 ;; FAVORITE CHINESE RESTAURANT: | |
77 ;; Boy, that's a tough one. Probably Hong Min, or maybe Emperor's | |
78 ;; 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
|
79 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
80 ;;;; Code: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
81 |
14169 | 82 (require 'pp) |
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 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
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 |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
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 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
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" |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
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")) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
141 "*File in which to save bookmarks by default." |
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 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
147 "*Whether or not to make numbered backups of the bookmark file. |
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 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
158 "*Non-nil means bookmark functions ignore case in completion." |
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 |
17412
cd7152c1ca13
(bookmark, bookmark-use-annotations)
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
164 "*Non-nil means that bookmarks will be displayed sorted by bookmark name. |
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 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
172 "*Nil means don't show annotations when jumping to a bookmark." |
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 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
178 "*Column at which to display filenames in a buffer listing bookmarks. |
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 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
185 "*Non-nil means show filenames when listing bookmarks. |
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 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
195 "*Maximum length of a bookmark name displayed on a popup menu." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
196 :type 'integer |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17265
diff
changeset
|
197 :group 'boolean) |
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 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
200 ;;; No user-serviceable parts beyond this point. |
4537 | 201 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
202 ;; Is it XEmacs? |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
203 (defconst bookmark-xemacsp |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
204 (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
205 |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
206 |
4537 | 207 ;; Added for lucid emacs compatibility, db |
208 (or (fboundp 'defalias) (fset 'defalias 'fset)) | |
209 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
210 ;; 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
|
211 (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
|
212 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
213 ;; This variable is probably obsolete now... |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
214 (or (boundp 'baud-rate) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
215 ;; some random value higher than 9600 |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
216 (setq baud-rate 19200)) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
217 |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
218 ;; XEmacs apparently call this `buffer-substring-without-properties', |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
219 ;; sigh. |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
220 (or (fboundp 'buffer-substring-no-properties) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
221 (if (fboundp 'buffer-substring-without-properties) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
222 (fset 'buffer-substring-no-properties |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
223 'buffer-substring-without-properties) |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
224 (fset 'buffer-substring-no-properties 'buffer-substring))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
225 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
226 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
227 ;;; Keymap stuff: |
18709
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
228 |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
229 ;; 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
|
230 ;; if the user alters them, don't override the user when loading bookmark.el. |
4537 | 231 |
18709
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
232 ;;;###autoload (define-key ctl-x-map "rb" 'bookmark-jump) |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
233 ;;;###autoload (define-key ctl-x-map "rm" 'bookmark-set) |
a82b89790f9c
Make global bindings only via loaddefs.el.
Richard M. Stallman <rms@gnu.org>
parents:
17412
diff
changeset
|
234 ;;;###autoload (define-key ctl-x-map "rl" 'bookmark-bmenu-list) |
4537 | 235 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
236 ;;;###autoload |
4633 | 237 (defvar bookmark-map nil |
238 "Keymap containing bindings to bookmark functions. | |
239 It is not bound to any key by default: to bind it | |
240 so that you have a bookmark prefix, just use `global-set-key' and bind a | |
241 key of your choice to `bookmark-map'. All interactive bookmark | |
4537 | 242 functions have a binding in this keymap.") |
243 | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
244 ;;;###autoload |
4537 | 245 (define-prefix-command 'bookmark-map) |
246 | |
247 ;; Read the help on all of these functions for details... | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
248 ;;;###autoload |
4537 | 249 (define-key bookmark-map "x" 'bookmark-set) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
250 ;;;###autoload |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
251 (define-key bookmark-map "m" 'bookmark-set) ; "m" for "mark" |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
252 ;;;###autoload |
4537 | 253 (define-key bookmark-map "j" 'bookmark-jump) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
254 ;;;###autoload |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
255 (define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go" |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
256 ;;;###autoload |
4537 | 257 (define-key bookmark-map "i" 'bookmark-insert) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
258 ;;;###autoload |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
259 (define-key bookmark-map "e" 'edit-bookmarks) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
260 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
261 (define-key bookmark-map "f" 'bookmark-insert-location) ; "f" for "find" |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
262 ;;;###autoload |
4633 | 263 (define-key bookmark-map "r" 'bookmark-rename) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
264 ;;;###autoload |
4537 | 265 (define-key bookmark-map "d" 'bookmark-delete) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
266 ;;;###autoload |
4537 | 267 (define-key bookmark-map "l" 'bookmark-load) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
268 ;;;###autoload |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
269 (define-key bookmark-map "w" 'bookmark-write) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
270 ;;;###autoload |
4537 | 271 (define-key bookmark-map "s" 'bookmark-save) |
272 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
273 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
274 ;;; The annotation maps. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
275 (defvar bookmark-read-annotation-mode-map (copy-keymap text-mode-map) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
276 "Keymap for composing an annotation for a bookmark.") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
277 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
278 (define-key bookmark-read-annotation-mode-map "\C-c\C-c" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
279 '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
|
280 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
281 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
282 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
283 ;;; Core variables and data structures: |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
284 (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
|
285 "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
|
286 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
|
287 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
|
288 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
289 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
|
290 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
291 \(BOOKMARK1 BOOKMARK2 ...\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
292 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
293 where each BOOKMARK is of the form |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
294 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
295 \(NAME |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
296 \(filename . FILE\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
297 \(front-context-string . FRONT-STR\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
298 \(rear-context-string . REAR-STR\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
299 \(position . POS\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
300 \(info-node . POS\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
301 \(annotation . ANNOTATION\)\) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
302 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
303 So the cdr of each bookmark is an alist too. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
304 `info-node' is optional, by the way.") |
4634
cd8eef9ec0c4
(bookmark-alist): Move defvar before first use.
Richard M. Stallman <rms@gnu.org>
parents:
4633
diff
changeset
|
305 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
306 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
307 (defvar bookmarks-already-loaded nil) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
308 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
309 |
4537 | 310 ;; just add the hook to make sure that people don't lose bookmarks |
311 ;; when they kill Emacs, unless they don't want to save them. | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
312 ;;;###autoload |
4537 | 313 (add-hook 'kill-emacs-hook |
314 (function | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
315 (lambda () (and (featurep 'bookmark) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
316 bookmark-alist |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
317 (bookmark-time-to-save-p t) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
318 (bookmark-save))))) |
4537 | 319 |
320 ;; 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
|
321 |
4537 | 322 (defvar bookmark-current-bookmark nil |
4633 | 323 "Name of bookmark most recently used in the current file. |
324 It is buffer local, used to make moving a bookmark forward | |
4631 | 325 through a file easier.") |
4537 | 326 |
327 (make-variable-buffer-local 'bookmark-current-bookmark) | |
328 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
329 |
4537 | 330 (defvar bookmark-alist-modification-count 0 |
4633 | 331 "Number of modifications to bookmark list since it was last saved.") |
4537 | 332 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
333 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
334 (defvar bookmark-search-size 16 |
4633 | 335 "Length of the context strings recorded on either side of a bookmark.") |
4537 | 336 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
337 |
4537 | 338 (defvar bookmark-current-point 0) |
339 (defvar bookmark-yank-point 0) | |
340 (defvar bookmark-current-buffer nil) | |
341 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
342 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
343 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
344 ;; Helper functions. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
345 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
346 ;; 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
|
347 ;; 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
|
348 ;; 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
|
349 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
350 (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
|
351 "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
|
352 (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
|
353 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
354 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
355 (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
|
356 "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
|
357 (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
|
358 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
359 (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
|
360 (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
|
361 bookmark-alist)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
362 |
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-get-bookmark (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
365 "Return the full entry for BOOKMARK in bookmark-alist." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
366 (assoc bookmark bookmark-alist)) |
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-bookmark-record (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 guts of the entry for BOOKMARK in bookmark-alist. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
371 That is, all information but the name." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
372 (car (cdr (bookmark-get-bookmark bookmark)))) |
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 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
375 (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
|
376 "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
|
377 (setcar |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
378 (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
|
379 newname)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
380 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
381 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
382 (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
|
383 "Return the annotation of BOOKMARK, or nil if none." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
384 (cdr (assq 'annotation (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
385 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
386 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
387 (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
|
388 "Set the annotation of BOOKMARK to ANN." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
389 (let ((cell (assq 'annotation (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
390 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
391 (setcdr cell ann) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
392 (nconc (bookmark-get-bookmark-record bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
393 (list (cons 'annotation ann)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
394 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
395 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
396 (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
|
397 "Return the full filename of BOOKMARK." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
398 (cdr (assq 'filename (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
399 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
400 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
401 (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
|
402 "Set the full filename of BOOKMARK to FILENAME." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
403 (let ((cell (assq 'filename (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
404 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
405 (setcdr cell filename) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
406 (nconc (bookmark-get-bookmark-record bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
407 (list (cons 'filename filename)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
408 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
409 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
410 (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
|
411 "Return the position \(i.e.: point\) of BOOKMARK." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
412 (cdr (assq 'position (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
413 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
414 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
415 (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
|
416 "Set the position \(i.e.: point\) of BOOKMARK to POSITION." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
417 (let ((cell (assq 'position (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
418 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
419 (setcdr cell position) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
420 (nconc (bookmark-get-bookmark-record bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
421 (list (cons 'position position)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
422 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
423 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
424 (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
|
425 "Return the front-context-string of BOOKMARK." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
426 (cdr (assq 'front-context-string (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
427 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
428 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
429 (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
|
430 "Set the front-context-string of BOOKMARK to STRING." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
431 (let ((cell (assq 'front-context-string |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
432 (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
433 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
434 (setcdr cell string) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
435 (nconc (bookmark-get-bookmark-record bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
436 (list (cons 'front-context-string string)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
437 |
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 (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
|
440 "Return the rear-context-string of BOOKMARK." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
441 (cdr (assq 'rear-context-string (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
442 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
443 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
444 (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
|
445 "Set the rear-context-string of BOOKMARK to STRING." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
446 (let ((cell (assq 'rear-context-string |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
447 (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
448 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
449 (setcdr cell string) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
450 (nconc (bookmark-get-bookmark-record bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
451 (list (cons 'rear-context-string string)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
452 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
453 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
454 (defun bookmark-get-info-node (bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
455 "Get the info node associated with BOOKMARK." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
456 (cdr (assq 'info-node (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
457 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
458 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
459 (defun bookmark-set-info-node (bookmark node) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
460 "Set the Info node of BOOKMARK to NODE." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
461 (let ((cell (assq 'info-node |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
462 (bookmark-get-bookmark-record bookmark)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
463 (if cell |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
464 (setcdr cell node) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
465 (nconc (bookmark-get-bookmark-record bookmark) |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
466 (list (cons 'info-node node))))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
467 |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
468 (message "%S" (assq 'info-node (bookmark-get-bookmark-record bookmark))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
469 (sit-for 4) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
470 ) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
471 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
472 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
473 (defvar bookmark-history nil |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
474 "The history list for bookmark functions.") |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
475 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
476 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
477 (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
|
478 "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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 (bookmark-maybe-load-default-file) ; paranoia |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
484 (let* ((completion-ignore-case bookmark-completion-ignore-case) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
485 (default default) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
486 (prompt (if default |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
487 (concat prompt (format " (%s): " default)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
488 (concat prompt ": "))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
489 (str |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
490 (completing-read prompt |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
491 bookmark-alist |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
492 nil |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
493 0 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
494 nil |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
495 'bookmark-history))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
496 (if (string-equal "" str) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
497 (list default) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
498 (list str)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
499 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
500 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
501 (defmacro bookmark-maybe-historicize-string (string) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
502 "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
|
503 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
|
504 menus, so `completing-read' never gets a chance to set `bookmark-history'." |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
505 (` (or |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
506 (interactive-p) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
507 (setq bookmark-history (cons (, string) bookmark-history))))) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
508 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
509 |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
510 (defun bookmark-make (name &optional annotation overwrite info-node) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
511 "Make a bookmark named NAME. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
512 Optional second arg ANNOTATION gives it an annotation. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
513 Optional third arg OVERWRITE means replace any existing bookmarks with |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
514 this name. |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
515 Optional fourth arg INFO-NODE means this bookmark is at info node |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
516 INFO-NODE, so record this fact in the bookmark's entry." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
517 (bookmark-maybe-load-default-file) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
518 (let ((stripped-name (copy-sequence name))) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
519 (or bookmark-xemacsp |
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
520 ;; 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
|
521 ;; 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
|
522 (set-text-properties 0 (length stripped-name) nil stripped-name)) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
523 (if (and (bookmark-get-bookmark stripped-name) (not overwrite)) |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
524 ;; 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
|
525 ;; no prefix arg means just overwrite old bookmark |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
526 (setcdr (bookmark-get-bookmark stripped-name) |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
527 (list (bookmark-make-cell annotation info-node))) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
528 |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
529 ;; 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
|
530 ;; 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
|
531 ;; case, we want the new bookmark consed onto the alist...) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
532 |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
533 (setq bookmark-alist |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
534 (cons |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
535 (list stripped-name |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
536 (bookmark-make-cell annotation info-node)) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
537 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
|
538 |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
539 ;; Added by db |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
540 (setq bookmark-current-bookmark stripped-name) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
541 (setq bookmark-alist-modification-count |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
542 (1+ bookmark-alist-modification-count)) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
543 (if (bookmark-time-to-save-p) |
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
544 (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
|
545 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
546 |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
547 (defun bookmark-make-cell (annotation &optional info-node) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
548 "Return the record part of a new bookmark, given ANNOTATION. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
549 Must be at the correct position in the buffer in which the bookmark is |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
550 being set. This might change someday. |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
551 Optional second arg INFO-NODE means this bookmark is at info node |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
552 INFO-NODE, so record this fact in the bookmark's entry." |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
553 (let ((the-record |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
554 (` ((filename . (, (bookmark-buffer-file-name))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
555 (front-context-string |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
556 . (, (if (>= (- (point-max) (point)) bookmark-search-size) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
557 (buffer-substring-no-properties |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
558 (point) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
559 (+ (point) bookmark-search-size)) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
560 nil))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
561 (rear-context-string |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
562 . (, (if (>= (- (point) (point-min)) bookmark-search-size) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
563 (buffer-substring-no-properties |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
564 (point) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
565 (- (point) bookmark-search-size)) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
566 nil))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
567 (position . (, (point))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
568 )))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
569 |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
570 ;; Now fill in the optional parts: |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
571 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
572 ;; Take no chances with text properties |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
573 (set-text-properties 0 (length annotation) nil annotation) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
574 (set-text-properties 0 (length info-node) nil info-node) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
575 |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
576 (if annotation |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
577 (nconc the-record (list (cons 'annotation annotation)))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
578 (if info-node |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
579 (nconc the-record (list (cons 'info-node info-node)))) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
580 |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
581 ;; Finally, return the completed record. |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
582 the-record)) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
583 |
10952
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 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
586 ;;; 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
|
587 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
588 ;; 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
|
589 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
590 ;; ((bookmark-name (filename |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
591 ;; string-in-front |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
592 ;; string-behind |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
593 ;; point)) |
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 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
596 ;; 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
|
597 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
598 ;; ((bookmark-name ((filename . FILENAME) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
599 ;; (front-context-string . string-in-front) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
600 ;; (rear-context-string . string-behind) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
601 ;; (position . POINT) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
602 ;; (annotation . annotation) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
603 ;; (whatever . VALUE) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
604 ;; ... |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
605 ;; )) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
606 ;; ...) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
607 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
608 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
609 ;; 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
|
610 ;; 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
|
611 ;; 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
|
612 ;; 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
|
613 ;; 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
|
614 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
615 ;; BOOKMARK-NAME is the string the user gives the bookmark and |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
616 ;; accesses it by from then on. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
617 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
618 ;; 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
|
619 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
620 ;; 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
|
621 ;; 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
|
622 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
623 ;; STRING-BEHIND is the same thing, but after the point. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
624 ;; |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
625 ;; The context strings exist so that modifications to a file don't |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
626 ;; necessarily cause a bookmark's position to be invalidated. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
627 ;; 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
|
628 ;; 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
|
629 ;; 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
|
630 ;; 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
|
631 ;; (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
|
632 ;; string. |
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 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
635 (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
|
636 "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
|
637 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
|
638 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
639 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
640 (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
|
641 "-*- 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
|
642 "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
|
643 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
644 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
645 (defun 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
|
646 "Return a bookmark-alist (in any format) from the current buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
647 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
|
648 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
|
649 affect point." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
650 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
651 (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
|
652 (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
|
653 (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
|
654 ;; 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
|
655 (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
|
656 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
657 (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
|
658 (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
|
659 ;; 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
|
660 (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
|
661 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
662 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
663 (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
|
664 "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
|
665 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
666 (lambda (bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
667 (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
|
668 (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
|
669 (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
|
670 (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
|
671 (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
|
672 (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
|
673 (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
|
674 (list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
675 name |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
676 (` ((filename . (, filename)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
677 (front-context-string . (, (or front-str ""))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
678 (rear-context-string . (, (or rear-str ""))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
679 (position . (, position)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
680 (annotation . (, ann))))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
681 old-list)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
682 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
683 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
684 (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
|
685 "Upgrade a bookmark file of format 0 (the original format) to format 1. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
686 This expects to be called from point-min 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
|
687 (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
|
688 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
|
689 (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
|
690 (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
|
691 (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
|
692 (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
|
693 (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
|
694 (save-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
695 (goto-char (point-min)) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
696 (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
|
697 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
|
698 ) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
699 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
700 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
701 (defun bookmark-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
|
702 "Return an integer which is the file-format version of this bookmark file. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
703 This expects to be called from point-min 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
|
704 (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
|
705 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
706 (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
|
707 (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
|
708 (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
|
709 (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
|
710 ;; 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
|
711 ;; 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
|
712 0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
713 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
714 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
715 (defun bookmark-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
|
716 "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
|
717 If the version is not up-to-date, upgrade it automatically. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
718 This expects to be called from point-min 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
|
719 (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
|
720 (cond |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
721 ((= 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
|
722 ) ; 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
|
723 ((= version 0) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
724 (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
|
725 (t |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
726 (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
|
727 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
728 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
729 (defun bookmark-insert-file-format-version-stamp () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
730 "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
|
731 (insert |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
732 (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
|
733 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
|
734 (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
|
735 ";;; 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
|
736 ";;; " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
737 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
|
738 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
739 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
740 ;;; 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
|
741 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
742 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
743 ;;; Core code: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
744 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
745 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
746 (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
|
747 "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
|
748 If name is nil, then the user will be prompted. |
4633 | 749 With prefix arg, will not overwrite a bookmark that has the same name |
750 as NAME if such a bookmark already exists, but instead will \"push\" | |
751 the new bookmark onto the bookmark alist. Thus the most recently set | |
752 bookmark with name NAME would be the one in effect at any given time, | |
753 but the others are still there, should you decide to delete the most | |
754 recent one. | |
4537 | 755 |
756 To yank words from the text of the buffer and use them as part of the | |
4633 | 757 bookmark name, type C-w while setting a bookmark. Successive C-w's |
4537 | 758 yank successive words. |
759 | |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
760 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
|
761 \(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
|
762 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
|
763 name of the file being visited. |
4537 | 764 |
765 Use \\[bookmark-delete] to remove bookmarks \(you give it a name, | |
766 and it removes only the first instance of a bookmark with that name from | |
767 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
|
768 (interactive (list nil current-prefix-arg)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
769 (or |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
770 (bookmark-buffer-file-name) |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
771 (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
|
772 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
773 (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
|
774 |
4537 | 775 (setq bookmark-current-point (point)) |
776 (setq bookmark-yank-point (point)) | |
777 (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
|
778 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
779 (let* ((default (or bookmark-current-bookmark |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
780 (bookmark-buffer-name))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
781 (str |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
782 (or name |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
783 (read-from-minibuffer |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
784 (format "Set bookmark (%s): " default) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
785 nil |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
786 (let ((now-map (copy-keymap minibuffer-local-map))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
787 (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
|
788 (define-key now-map "\C-u" 'bookmark-insert-current-bookmark) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
789 now-map)))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
790 (annotation nil)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
791 (and (string-equal str "") (setq str default)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
792 ;; Ask for an annotation buffer for this bookmark |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
793 (if bookmark-use-annotations |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
794 (bookmark-read-annotation parg str) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
795 (bookmark-make str annotation parg (bookmark-info-current-node)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
796 (setq bookmark-current-bookmark str) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
797 (bookmark-bmenu-surreptitiously-rebuild-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
798 (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
|
799 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
800 |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
801 (defun bookmark-info-current-node () |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
802 "If in Info-mode, return current node name (a string), else nil." |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
803 (if (eq major-mode 'Info-mode) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
804 Info-current-node)) |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
805 |
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
806 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
807 (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
|
808 "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
|
809 If optional arg NEWLINE-TOO is non-nil, delete the newline too. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
810 Does not affect the kill-ring." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
811 (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
|
812 (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
|
813 (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
|
814 (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
|
815 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
816 |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
817 ;; Defvars to avoid compilation warnings: |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
818 (defvar bookmark-annotation-paragraph nil) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
819 (defvar bookmark-annotation-name nil) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
820 (defvar bookmark-annotation-buffer nil) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
821 (defvar bookmark-annotation-file nil) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
822 (defvar bookmark-annotation-point nil) |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
823 |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
824 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
825 (defun bookmark-send-annotation () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
826 "Use buffer contents as the annotation for a bookmark. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
827 Exclude lines that begin with `#'. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
828 Store the annotation text in the bookmark list with |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
829 the bookmark (and file, and point) specified in buffer local variables." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
830 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
831 (if (not (eq major-mode 'bookmark-read-annotation-mode)) |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
832 (error "Not in bookmark-read-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
|
833 (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
|
834 (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
|
835 (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
|
836 (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
|
837 (forward-line 1))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
838 (let ((annotation (buffer-string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
839 (parg bookmark-annotation-paragraph) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
840 (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
|
841 (pt bookmark-annotation-point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
842 (buf bookmark-annotation-buffer)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
843 ;; for bookmark-make-cell to work, we need to be |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
844 ;; in the relevant buffer, at the relevant point. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
845 ;; Actually, bookmark-make-cell should probably be re-written, |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
846 ;; to avoid this need. Should I handle the error if a buffer is |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
847 ;; killed between "C-x r m" and a "C-c C-c" in the annotation buffer? |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
848 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
849 (pop-to-buffer buf) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
850 (goto-char pt) |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
851 (bookmark-make bookmark annotation parg (bookmark-info-current-node)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
852 (setq bookmark-current-bookmark bookmark)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
853 (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
|
854 (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
|
855 (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
|
856 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
857 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
858 (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
|
859 (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
|
860 "# 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
|
861 "# 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
|
862 "# 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
|
863 (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
|
864 "# 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
|
865 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
866 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
867 (defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
868 "Function to return default text to use for a bookmark annotation. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
869 It takes the name of the bookmark, as a string, as an arg.") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
870 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
871 (defun bookmark-read-annotation-mode (buf point parg bookmark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
872 "Mode for composing annotations for a bookmark. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
873 Wants BUF POINT PARG and BOOKMARK. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
874 When you have finished composing, type \\[bookmark-send-annotation] to send |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
875 the annotation. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
876 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
877 \\{bookmark-read-annotation-mode-map} |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
878 " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
879 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
880 (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
|
881 (make-local-variable 'bookmark-annotation-paragraph) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
882 (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
|
883 (make-local-variable 'bookmark-annotation-buffer) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
884 (make-local-variable 'bookmark-annotation-file) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
885 (make-local-variable 'bookmark-annotation-point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
886 (setq bookmark-annotation-paragraph parg) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
887 (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
|
888 (setq bookmark-annotation-buffer buf) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
889 (setq bookmark-annotation-file (buffer-file-name buf)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
890 (setq bookmark-annotation-point point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
891 (use-local-map bookmark-read-annotation-mode-map) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
892 (setq major-mode 'bookmark-read-annotation-mode) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
893 (insert (funcall bookmark-read-annotation-text-func bookmark)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
894 (run-hooks 'text-mode-hook)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
895 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
896 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
897 (defun bookmark-read-annotation (parg bookmark) |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
898 "Pop up a buffer for entering a bookmark annotation. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
899 Text surrounding the bookmark is PARG; the bookmark name is BOOKMARK." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
900 (let ((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
|
901 (point (point))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
902 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
903 (bookmark-read-annotation-mode buf point parg bookmark))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
904 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
905 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
906 (defvar bookmark-edit-annotation-mode-map (copy-keymap text-mode-map) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
907 "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
|
908 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
909 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
910 (define-key bookmark-edit-annotation-mode-map "\C-c\C-c" |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
911 'bookmark-send-edited-annotation) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
912 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
913 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
914 (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
|
915 "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
|
916 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
|
917 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
918 \\{bookmark-edit-annotation-mode-map} |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
919 " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
920 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
921 (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
|
922 (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
|
923 (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
|
924 (use-local-map bookmark-edit-annotation-mode-map) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
925 (setq major-mode 'bookmark-edit-annotation-mode) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
926 (insert (funcall bookmark-read-annotation-text-func bookmark)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
927 (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
|
928 (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
|
929 (insert annotation))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
930 (run-hooks 'text-mode-hook)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
931 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
932 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
933 (defun bookmark-send-edited-annotation () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
934 "Use buffer contents (minus beginning with `#' as annotation for a bookmark." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
935 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
936 (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
|
937 (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
|
938 (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
|
939 (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
|
940 (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
|
941 (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
|
942 (forward-line 1))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
943 (let ((annotation (buffer-string)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
944 (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
|
945 (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
|
946 (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
|
947 (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
|
948 (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
|
949 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
950 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
951 (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
|
952 "Pop up a buffer for editing bookmark BOOKMARK's annotation." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
953 (let ((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
|
954 (point (point))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
955 (pop-to-buffer (generate-new-buffer-name "*Bookmark Annotation Compose*")) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
956 (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
|
957 |
4537 | 958 |
959 (defun bookmark-insert-current-bookmark () | |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
960 "Insert this buffer's value of bookmark-current-bookmark. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
961 Default to file name if it's nil." |
4537 | 962 (interactive) |
963 (let ((str | |
964 (save-excursion | |
965 (set-buffer bookmark-current-buffer) | |
966 bookmark-current-bookmark))) | |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
967 (if str (insert str) (bookmark-insert-buffer-name)))) |
4537 | 968 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
969 |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
970 (defun bookmark-insert-buffer-name () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
971 "Insert the current file name into the bookmark name being set. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
972 The directory part of the file name is not used." |
4537 | 973 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
974 (let ((str |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
975 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
976 (set-buffer bookmark-current-buffer) |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
977 (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
|
978 (insert str))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
979 |
4537 | 980 |
10960
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
981 (defun bookmark-buffer-name () |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
982 "Return the name of the current buffer's file, non-directory. |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
983 In Info, return the current node." |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
984 (cond |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
985 ;; Are we in Info? |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
986 ((string-equal mode-name "Info") Info-current-node) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
987 ;; 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
|
988 (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
|
989 ;; 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
|
990 ((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
|
991 (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
|
992 dired-directory |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
993 (car dired-directory))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
994 (idx (1- (length dirname)))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
995 ;; Strip the trailing slash. |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
996 (if (= ?/ (aref dirname idx)) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
997 (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
|
998 ;; 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
|
999 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
1000 ;; 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
|
1001 (t |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
1002 (buffer-name (current-buffer))))) |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
1003 |
d6d3905ec550
(bookmark-buffer-name): Be smarter about deducing a name.
Richard M. Stallman <rms@gnu.org>
parents:
10952
diff
changeset
|
1004 |
4537 | 1005 (defun bookmark-yank-word () |
1006 (interactive) | |
1007 ;; get the next word from the buffer and append it to the name of | |
1008 ;; the bookmark currently being set. | |
1009 (let ((string (save-excursion | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1010 (set-buffer bookmark-current-buffer) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1011 (goto-char bookmark-yank-point) |
12569
1297698116a8
(bookmark-make): Strip text properties off name.
Karl Heuer <kwzh@gnu.org>
parents:
12310
diff
changeset
|
1012 (buffer-substring-no-properties |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1013 (point) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1014 (progn |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1015 (forward-word 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1016 (setq bookmark-yank-point (point))))))) |
4537 | 1017 (insert string))) |
1018 | |
1019 | |
1020 (defun bookmark-buffer-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
|
1021 "Return the current buffer's file in a way useful for bookmarks. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1022 For example, if this is a Info buffer, return the Info file's name." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1023 (if (eq major-mode 'Info-mode) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1024 Info-current-file |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1025 (or |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1026 buffer-file-name |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1027 (if (and (boundp 'dired-directory) dired-directory) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1028 (if (stringp dired-directory) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1029 dired-directory |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1030 (car dired-directory)))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1031 |
4537 | 1032 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1033 (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
|
1034 (and (not bookmarks-already-loaded) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1035 (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
|
1036 (prog2 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1037 (and |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1038 ;; 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
|
1039 ;; 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
|
1040 (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
|
1041 (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
|
1042 (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
|
1043 (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
|
1044 ;; 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
|
1045 t) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1046 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1047 (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
|
1048 (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
|
1049 (setq bookmarks-already-loaded t))) |
4631 | 1050 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1051 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1052 (defun bookmark-maybe-sort-alist () |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1053 ;;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
|
1054 ;;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
|
1055 (if bookmark-sort-flag |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1056 (setq bookmark-alist |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1057 (sort (copy-alist bookmark-alist) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1058 (function |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1059 (lambda (x y) (string-lessp (car x) (car y)))))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1060 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1061 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1062 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1063 (defun bookmark-jump (bookmark) |
4633 | 1064 "Jump to bookmark BOOKMARK (a point in some file). |
1065 You may have a problem using this function if the value of variable | |
1066 `bookmark-alist' is nil. If that happens, you need to load in some | |
1067 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
|
1068 this. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1069 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1070 If the file pointed to by BOOKMARK no longer exists, you will be asked |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1071 if you wish to give the bookmark a new location, and bookmark-jump |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1072 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
|
1073 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
|
1074 (interactive |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1075 (bookmark-completing-read "Jump to bookmark" bookmark-current-bookmark)) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1076 (bookmark-maybe-historicize-string bookmark) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1077 (let ((cell (bookmark-jump-noselect bookmark))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1078 (and cell |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1079 (switch-to-buffer (car cell)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1080 (goto-char (cdr cell)) |
11070
ebee80744a06
(bookmark-automatically-show-annotations): new var.
Karl Fogel <kfogel@red-bean.com>
parents:
11021
diff
changeset
|
1081 (if bookmark-automatically-show-annotations |
ebee80744a06
(bookmark-automatically-show-annotations): new var.
Karl Fogel <kfogel@red-bean.com>
parents:
11021
diff
changeset
|
1082 ;; if there is an annotation for this bookmark, |
ebee80744a06
(bookmark-automatically-show-annotations): new var.
Karl Fogel <kfogel@red-bean.com>
parents:
11021
diff
changeset
|
1083 ;; show it in a buffer. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1084 (bookmark-show-annotation bookmark))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1085 |
4537 | 1086 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1087 (defun bookmark-jump-noselect (str) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1088 ;; a leetle helper for bookmark-jump :-) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1089 ;; returns (BUFFER . POINT) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1090 (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
|
1091 (let* ((file (expand-file-name (bookmark-get-filename str))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1092 (forward-str (bookmark-get-front-context-string str)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1093 (behind-str (bookmark-get-rear-context-string str)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1094 (place (bookmark-get-position str)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1095 (info-node (bookmark-get-info-node str)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1096 (orig-file file) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1097 ) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1098 (if (or |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1099 (file-exists-p file) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1100 ;; else try some common compression extensions |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1101 ;; and Emacs better handle it right! |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1102 ;; Sigh: I think it may *not* be handled at the moment. What |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1103 ;; to do about this? |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1104 (setq file |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1105 (or |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1106 (let ((altname (concat file ".Z"))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1107 (and (file-exists-p altname) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1108 altname)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1109 (let ((altname (concat file ".gz"))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1110 (and (file-exists-p altname) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1111 altname)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1112 (let ((altname (concat file ".z"))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1113 (and (file-exists-p altname) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1114 altname))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1115 (save-excursion |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1116 (save-window-excursion |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1117 (if info-node |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1118 ;; Info nodes must be visited with care. |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1119 (progn |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1120 (require 'info) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1121 (Info-find-node file info-node)) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1122 ;; Else no Info. Can do an ordinary find-file: |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1123 (set-buffer (find-file-noselect file)) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1124 (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
|
1125 |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1126 ;; Go searching forward first. Then, if forward-str exists and |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1127 ;; was found in the file, we can search backward for behind-str. |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1128 ;; Rationale is that if text was inserted between the two in the |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1129 ;; file, it's better to be put before it so you can read it, |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1130 ;; rather than after and remain perhaps unaware of the changes. |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1131 (if forward-str |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1132 (if (search-forward forward-str (point-max) t) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1133 (goto-char (match-beginning 0)))) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1134 (if behind-str |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1135 (if (search-backward behind-str (point-min) t) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1136 (goto-char (match-end 0)))) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1137 ;; added by db |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1138 (setq bookmark-current-bookmark str) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1139 (cons (current-buffer) (point)))) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1140 |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1141 ;; Else unable to find the marked file, so ask if user wants to |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1142 ;; relocate the bookmark, else remind them to consider deletion. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1143 (ding) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1144 (if (y-or-n-p (concat (file-name-nondirectory orig-file) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1145 " nonexistent. Relocate \"" |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1146 str |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1147 "\"? ")) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1148 (progn |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1149 (bookmark-relocate str) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1150 ;; gasp! It's a recursive function call in Emacs Lisp! |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1151 (bookmark-jump-noselect str)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1152 (message |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1153 "Bookmark not relocated; consider removing it \(%s\)." str) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1154 nil)))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1155 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1156 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1157 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1158 (defun bookmark-relocate (bookmark) |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1159 "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
|
1160 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
|
1161 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
|
1162 after a bookmark was set in it." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1163 (interactive (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
|
1164 (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
|
1165 (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
|
1166 (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
|
1167 (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
|
1168 (read-file-name |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1169 (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
|
1170 (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
|
1171 (bookmark-set-filename bookmark newloc) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1172 (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
|
1173 |
4537 | 1174 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1175 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1176 (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
|
1177 "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
|
1178 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
|
1179 minibuffer history list `bookmark-history'." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1180 (interactive (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
|
1181 (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
|
1182 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1183 (prog1 |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1184 (insert (bookmark-location bookmark)) ; *Return this line* |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1185 (if window-system |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1186 (put-text-property start |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1187 (save-excursion (re-search-backward |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1188 "[^ \t]") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1189 (1+ (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1190 'mouse-face 'highlight))))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1191 |
15189
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1192 ;;;###autoload |
15183
9c770d2b753f
(bookmark-make): take optional arg `info-node', pass it on to
Karl Fogel <kfogel@red-bean.com>
parents:
14734
diff
changeset
|
1193 (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
|
1194 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1195 (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
|
1196 "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
|
1197 (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
|
1198 (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
|
1199 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1200 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1201 ;;;###autoload |
4633 | 1202 (defun bookmark-rename (old &optional new) |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1203 "Change the name of OLD bookmark to NEW name. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1204 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
|
1205 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
|
1206 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1207 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
|
1208 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
|
1209 must pass at least OLD when calling from Lisp. |
4633 | 1210 |
1211 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
|
1212 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
|
1213 name." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1214 (interactive (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
|
1215 (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
|
1216 (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
|
1217 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1218 (setq bookmark-current-point (point)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1219 (setq bookmark-yank-point (point)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1220 (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
|
1221 (let ((newname |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1222 (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
|
1223 (read-from-minibuffer |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1224 "New name: " |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1225 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1226 (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
|
1227 (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
|
1228 now-map) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1229 nil |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1230 'bookmark-history)))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1231 (bookmark-set-name old newname) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1232 (setq bookmark-current-bookmark newname) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1233 (bookmark-bmenu-surreptitiously-rebuild-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1234 (setq bookmark-alist-modification-count |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1235 (1+ bookmark-alist-modification-count)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1236 (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
|
1237 (bookmark-save)))) |
4537 | 1238 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1239 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1240 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1241 (defun bookmark-insert (bookmark) |
4633 | 1242 "Insert the text of the file pointed to by bookmark BOOKMARK. |
1243 You may have a problem using this function if the value of variable | |
1244 `bookmark-alist' is nil. If that happens, you need to load in some | |
1245 bookmarks. See help on function `bookmark-load' for more about | |
4631 | 1246 this." |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1247 (interactive (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
|
1248 (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
|
1249 (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
|
1250 (let ((orig-point (point)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1251 (str-to-insert |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1252 (save-excursion |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1253 (set-buffer (car (bookmark-jump-noselect bookmark))) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1254 (buffer-string)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1255 (insert str-to-insert) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1256 (push-mark) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1257 (goto-char orig-point))) |
4537 | 1258 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1259 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1260 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1261 (defun bookmark-delete (bookmark &optional batch) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1262 "Delete BOOKMARK from the bookmark list. |
4633 | 1263 Removes only the first instance of a bookmark with that name. If |
1264 there are one or more other bookmarks with the same name, they will | |
1265 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
|
1266 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
|
1267 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
|
1268 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
|
1269 (interactive |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1270 (bookmark-completing-read "Delete bookmark" bookmark-current-bookmark)) |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1271 (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
|
1272 (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
|
1273 (let ((will-go (bookmark-get-bookmark bookmark))) |
4595 | 1274 (setq bookmark-alist (delq will-go bookmark-alist)) |
1275 ;; 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
|
1276 ;; occurrence has been deleted |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1277 (or (bookmark-get-bookmark bookmark-current-bookmark) |
4595 | 1278 (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
|
1279 ;; 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
|
1280 (if batch |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1281 nil |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1282 (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
|
1283 (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
|
1284 (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
|
1285 (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
|
1286 (bookmark-save)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1287 |
4537 | 1288 |
1289 (defun bookmark-time-to-save-p (&optional last-time) | |
1290 ;; By Gregory M. Saunders <saunders@cis.ohio-state.edu> | |
1291 ;; finds out whether it's time to save bookmarks to a file, by | |
1292 ;; examining the value of variable bookmark-save-flag, and maybe | |
1293 ;; bookmark-alist-modification-count. Returns t if they should be | |
1294 ;; saved, nil otherwise. if last-time is non-nil, then this is | |
1295 ;; being called when emacs is killed. | |
1296 (cond (last-time | |
1297 (and (> bookmark-alist-modification-count 0) | |
1298 bookmark-save-flag)) | |
1299 ((numberp bookmark-save-flag) | |
1300 (>= bookmark-alist-modification-count bookmark-save-flag)) | |
1301 (t | |
1302 nil))) | |
1303 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1304 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1305 ;;;###autoload |
4537 | 1306 (defun bookmark-write () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1307 "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
|
1308 Don't use this in Lisp programs; use `bookmark-save' instead." |
4537 | 1309 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1310 (bookmark-maybe-load-default-file) |
4537 | 1311 (bookmark-save t)) |
1312 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1313 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1314 ;;;###autoload |
4595 | 1315 (defun bookmark-save (&optional parg file) |
4633 | 1316 "Save currently defined bookmarks. |
1317 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
|
1318 `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
|
1319 \(second argument\). |
4537 | 1320 |
1321 If you are calling this from Lisp, the two arguments are PREFIX-ARG | |
1322 and FILE, and if you just want it to write to the default file, then | |
1323 pass no arguments. Or pass in nil and FILE, and it will save in FILE | |
1324 instead. If you pass in one argument, and it is non-nil, then the | |
1325 user will be interactively queried for a file to save in. | |
1326 | |
4595 | 1327 When you want to load in the bookmarks from a file, use |
4633 | 1328 \`bookmark-load\', \\[bookmark-load]. That function will prompt you |
4595 | 1329 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
|
1330 `bookmark-default-file'." |
4537 | 1331 (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
|
1332 (bookmark-maybe-load-default-file) |
4537 | 1333 (cond |
1334 ((and (null parg) (null file)) | |
1335 ;;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
|
1336 (bookmark-write-file bookmark-default-file)) |
4537 | 1337 ((and (null parg) file) |
1338 ;;whether interactive or not, write to given file | |
1339 (bookmark-write-file file)) | |
1340 ((and parg (not file)) | |
1341 ;;have been called interactively w/ prefix arg | |
1342 (let ((file (read-file-name "File to save bookmarks in: "))) | |
1343 (bookmark-write-file file))) | |
1344 (t ; someone called us with prefix-arg *and* a file, so just write to file | |
1345 (bookmark-write-file file))) | |
1346 ;; signal that we have synced the bookmark file by setting this to | |
1347 ;; 0. If there was an error at any point before, it will not get | |
1348 ;; set, which is what we want. | |
1349 (setq bookmark-alist-modification-count 0)) | |
1350 | |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1351 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1352 |
4537 | 1353 (defun bookmark-write-file (file) |
1354 (save-excursion | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1355 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1356 (if (>= baud-rate 9600) |
14339
f2dfcd4d4b9b
(bookmark-write-file, bookmark-load): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1357 (message "Saving bookmarks to file %s..." file)) |
4893
c4bab885aa8d
(bookmark-load, bookmark-write-file):
Richard M. Stallman <rms@gnu.org>
parents:
4891
diff
changeset
|
1358 (set-buffer (let ((enable-local-variables nil)) |
4891 | 1359 (find-file-noselect file))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1360 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1361 (delete-region (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
|
1362 (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
|
1363 (pp bookmark-alist (current-buffer)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1364 (let ((version-control |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1365 (cond |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1366 ((null bookmark-version-control) nil) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1367 ((eq 'never bookmark-version-control) 'never) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1368 ((eq 'nospecial bookmark-version-control) version-control) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1369 (t |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1370 t)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1371 (write-file file) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1372 (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
|
1373 (if (>= baud-rate 9600) |
14339
f2dfcd4d4b9b
(bookmark-write-file, bookmark-load): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1374 (message "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
|
1375 )))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1376 |
4537 | 1377 |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1378 (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
|
1379 ;; 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
|
1380 ;; 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
|
1381 ;; 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
|
1382 ;; as necessary. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1383 (let ((lst new-list) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1384 (names (bookmark-all-names))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1385 (while lst |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1386 (let* ((full-record (car lst))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1387 (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
|
1388 (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
|
1389 (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
|
1390 (setq lst (cdr lst)))))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1391 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1392 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1393 (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
|
1394 ;; 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
|
1395 ;; 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
|
1396 ;; |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1397 ;; 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
|
1398 ;; name. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1399 (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
|
1400 (if (member found-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1401 ;; 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
|
1402 (let ((count 2) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1403 (new-name found-name)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1404 (while (member new-name names) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1405 (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
|
1406 (setq count (1+ count))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1407 (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
|
1408 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1409 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1410 ;;;###autoload |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1411 (defun bookmark-load (file &optional overwrite no-msg) |
4633 | 1412 "Load bookmarks from FILE (which must be in bookmark format). |
1413 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
|
1414 optional second argument OVERWRITE is non-nil, existing bookmarks are |
4633 | 1415 destroyed. Optional third arg NO-MSG means don't display any messages |
1416 while loading. | |
4537 | 1417 |
1418 If you load a file that doesn't contain a proper bookmark alist, you | |
4633 | 1419 will corrupt Emacs's bookmark list. Generally, you should only load |
4537 | 1420 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
|
1421 place. Your own personal bookmark file, `~/.emacs.bmk', is |
4631 | 1422 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
|
1423 explicitly. |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1424 |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1425 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
|
1426 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
|
1427 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
|
1428 method buffers use to resolve name collisions." |
4537 | 1429 (interactive |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1430 (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
|
1431 (format "Load bookmarks from: (%s) " |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1432 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
|
1433 ;;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
|
1434 ;;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
|
1435 ;;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
|
1436 "~/" bookmark-default-file 'confirm))) |
4537 | 1437 (setq file (expand-file-name file)) |
1438 (if (file-readable-p file) | |
1439 (save-excursion | |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1440 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1441 (if (and (null no-msg) (>= baud-rate 9600)) |
14339
f2dfcd4d4b9b
(bookmark-write-file, bookmark-load): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1442 (message "Loading bookmarks from %s..." file)) |
4893
c4bab885aa8d
(bookmark-load, bookmark-write-file):
Richard M. Stallman <rms@gnu.org>
parents:
4891
diff
changeset
|
1443 (set-buffer (let ((enable-local-variables nil)) |
4891 | 1444 (find-file-noselect file))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1445 (goto-char (point-min)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1446 (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
|
1447 (let ((blist (bookmark-alist-from-buffer))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1448 (if (listp blist) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1449 (progn |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1450 (if overwrite |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1451 (progn |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1452 (setq bookmark-alist blist) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1453 (setq bookmark-alist-modification-count 0)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1454 ;; else |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1455 (bookmark-import-new-list blist) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1456 (setq bookmark-alist-modification-count |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1457 (1+ bookmark-alist-modification-count))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1458 (if (string-equal |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1459 (expand-file-name bookmark-default-file) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1460 file) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1461 (setq bookmarks-already-loaded t)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1462 (bookmark-bmenu-surreptitiously-rebuild-list)) |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
1463 (error "Invalid bookmark list in %s" file))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1464 (kill-buffer (current-buffer))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1465 (if (and (null no-msg) (>= baud-rate 9600)) |
14339
f2dfcd4d4b9b
(bookmark-write-file, bookmark-load): Delete format call inside message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
1466 (message "Loading bookmarks from %s...done" file))) |
14354
f1035d934a7a
(bookmark-alist-from-buffer): Fix error text.
Karl Heuer <kwzh@gnu.org>
parents:
14339
diff
changeset
|
1467 (error "Cannot read bookmark file %s" file))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1468 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1469 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1470 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1471 ;;; Code supporting the dired-like bookmark menu. Prefix is |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1472 ;;; "bookmark-bmenu" for "buffer-menu": |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1473 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1474 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1475 (defvar bookmark-bmenu-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
|
1476 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1477 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1478 (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
|
1479 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1480 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1481 (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
|
1482 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1483 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1484 (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
|
1485 nil |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1486 (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
|
1487 (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
|
1488 (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
|
1489 (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
|
1490 (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
|
1491 (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
|
1492 (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
|
1493 (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
|
1494 (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
|
1495 (define-key bookmark-bmenu-mode-map "f" 'bookmark-bmenu-this-window) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1496 (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
|
1497 (define-key bookmark-bmenu-mode-map "\C-o" |
dd74ff8dad0b
(bookmark-locate): ;;;###autoload this alias.
Karl Fogel <kfogel@red-bean.com>
parents:
15183
diff
changeset
|
1498 '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
|
1499 (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
|
1500 (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
|
1501 (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
|
1502 (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
|
1503 (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
|
1504 (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
|
1505 (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
|
1506 (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
|
1507 (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
|
1508 (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
|
1509 (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
|
1510 (define-key bookmark-bmenu-mode-map "m" 'bookmark-bmenu-mark) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1511 (define-key bookmark-bmenu-mode-map "l" '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
|
1512 (define-key bookmark-bmenu-mode-map "r" 'bookmark-bmenu-rename) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1513 (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
|
1514 (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
|
1515 (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
|
1516 (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
|
1517 (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
|
1518 '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
|
1519 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1520 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1521 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1522 ;; 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
|
1523 ;; data. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1524 (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
|
1525 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1526 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1527 ;; todo: need to display whether or not bookmark exists as a buffer in |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1528 ;; flag column. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1529 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1530 ;; Format: |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1531 ;; 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
|
1532 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1533 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1534 (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
|
1535 "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
|
1536 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
|
1537 (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
|
1538 (save-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1539 (save-window-excursion |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1540 (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
|
1541 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1542 |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1543 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1544 (defun bookmark-bmenu-list () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1545 "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
|
1546 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
|
1547 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
|
1548 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
|
1549 (interactive) |
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-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
|
1551 (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
|
1552 (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
|
1553 (set-buffer (get-buffer-create "*Bookmark List*"))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1554 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1555 (delete-region (point-max) (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1556 (goto-char (point-min)) ;sure are playing it safe... |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1557 (insert "% Bookmark\n- --------\n") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1558 (bookmark-maybe-sort-alist) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1559 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1560 (lambda (full-record) |
13969
8fd836e88aec
(bookmark-save-flag, bookmark-read-annotation-text-func,
Karl Heuer <kwzh@gnu.org>
parents:
13895
diff
changeset
|
1561 ;; 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
|
1562 ;; 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
|
1563 (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
|
1564 (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
|
1565 (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
|
1566 (insert " *") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1567 (insert " ")) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1568 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1569 (insert (bookmark-name-from-full-record full-record)) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1570 (if window-system |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1571 (put-text-property start |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1572 (save-excursion (re-search-backward |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1573 "[^ \t]") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1574 (1+ (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1575 'mouse-face 'highlight)) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1576 (insert "\n") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1577 ))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1578 bookmark-alist)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1579 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1580 (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
|
1581 (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
|
1582 (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
|
1583 (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
|
1584 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1585 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1586 (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
|
1587 ;;;###autoload |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1588 (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
|
1589 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1590 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1591 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1592 (defun bookmark-bmenu-mode () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1593 "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
|
1594 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
|
1595 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
|
1596 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
|
1597 \\<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
|
1598 \\[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
|
1599 \\[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
|
1600 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
|
1601 \\[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
|
1602 \\[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
|
1603 \\[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
|
1604 \\[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
|
1605 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
|
1606 \\[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
|
1607 \\[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
|
1608 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
|
1609 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this bookmark. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1610 \\[bookmark-bmenu-rename] -- rename this bookmark \(prompts for new name\). |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1611 \\[bookmark-bmenu-delete] -- mark this bookmark to be deleted, and move down. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1612 \\[bookmark-bmenu-delete-backwards] -- mark this bookmark to be deleted, and move up. |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
1613 \\[bookmark-bmenu-execute-deletions] -- delete bookmarks marked with `\\[bookmark-bmenu-delete]'. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1614 \\[bookmark-bmenu-save] -- save the current bookmark list in the default file. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1615 With a prefix arg, prompts for a file to save in. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1616 \\[bookmark-bmenu-load] -- load in a file of bookmarks (prompts for file.) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1617 \\[bookmark-bmenu-unmark] -- remove all kinds of marks from current line. |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1618 With prefix argument, also move up one line. |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1619 \\[bookmark-bmenu-backup-unmark] -- back up a line and remove marks. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1620 \\[bookmark-bmenu-show-annotation] -- show the annotation, if it exists, for the current bookmark |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1621 in another buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1622 \\[bookmark-bmenu-show-all-annotations] -- show the annotations of all bookmarks in another buffer. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1623 \\[bookmark-bmenu-edit-annotation] -- edit the annotation for the current bookmark." |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1624 (kill-all-local-variables) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1625 (use-local-map bookmark-bmenu-mode-map) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1626 (setq truncate-lines t) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1627 (setq buffer-read-only t) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1628 (setq major-mode 'bookmark-bmenu-mode) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1629 (setq mode-name "Bookmark Menu") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1630 (run-hooks 'bookmark-bmenu-mode-hook)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1631 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1632 |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1633 (defun bookmark-bmenu-toggle-filenames (&optional show) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1634 "Toggle whether filenames are shown in the bookmark list. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1635 Optional argument SHOW means show them unconditionally." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1636 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1637 (cond |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1638 (show |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1639 (setq bookmark-bmenu-toggle-filenames nil) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1640 (bookmark-bmenu-show-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1641 (setq bookmark-bmenu-toggle-filenames t)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1642 (bookmark-bmenu-toggle-filenames |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1643 (bookmark-bmenu-hide-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1644 (setq bookmark-bmenu-toggle-filenames nil)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1645 (t |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1646 (bookmark-bmenu-show-filenames) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1647 (setq bookmark-bmenu-toggle-filenames t)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1648 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1649 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1650 (defun bookmark-bmenu-show-filenames (&optional force) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1651 (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
|
1652 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
|
1653 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1654 (save-window-excursion |
4537 | 1655 (goto-char (point-min)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1656 (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
|
1657 (setq bookmark-bmenu-hidden-bookmarks ()) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1658 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1659 (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
|
1660 (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
|
1661 (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
|
1662 (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
|
1663 (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
|
1664 (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
|
1665 ;; Strip off `mouse-face' from the white spaces region. |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1666 (if window-system |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1667 (remove-text-properties start (point) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1668 '(mouse-face)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1669 (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
|
1670 (insert " ") |
10994
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1671 ;; Pass the NO-HISTORY arg: |
d173d21f14e2
Removed C-v bindings; they were inconsistent.
Karl Fogel <kfogel@red-bean.com>
parents:
10960
diff
changeset
|
1672 (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
|
1673 (forward-line 1)))))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1674 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1675 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1676 (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
|
1677 (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
|
1678 ;; 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
|
1679 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1680 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1681 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1682 (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
|
1683 (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
|
1684 (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
|
1685 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1686 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1687 (search-forward "Bookmark") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1688 (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
|
1689 (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
|
1690 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1691 (let ((buffer-read-only nil)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1692 (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
|
1693 (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
|
1694 (bookmark-kill-line) |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1695 (let ((start (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1696 (insert (car bookmark-bmenu-hidden-bookmarks)) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1697 (if window-system |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1698 (put-text-property start |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1699 (save-excursion (re-search-backward |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1700 "[^ \t]") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1701 (1+ (point))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1702 'mouse-face 'highlight))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1703 (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
|
1704 (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
|
1705 (forward-line 1)))))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1706 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1707 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1708 (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
|
1709 ;; 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
|
1710 ;; (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
|
1711 ;; 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
|
1712 (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
|
1713 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1714 (forward-line 2) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1715 bookmark-alist) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1716 ((and (bolp) (eobp)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1717 (beginning-of-line 0) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1718 bookmark-alist) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1719 (t |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1720 bookmark-alist))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1721 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1722 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1723 (defun bookmark-bmenu-bookmark () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1724 ;; 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
|
1725 (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
|
1726 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1727 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1728 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1729 (search-forward "Bookmark") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1730 (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
|
1731 (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
|
1732 (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
|
1733 (bookmark-bmenu-hide-filenames)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1734 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1735 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1736 (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
|
1737 (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
|
1738 (prog1 |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1739 (buffer-substring-no-properties (point) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1740 (progn |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1741 (end-of-line) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1742 (point))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1743 ;; 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
|
1744 (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
|
1745 (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
|
1746 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1747 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1748 (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
|
1749 "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
|
1750 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
|
1751 (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
|
1752 (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
|
1753 (save-excursion |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1754 (let ((old-buf (current-buffer))) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1755 (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
|
1756 (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
|
1757 ;; (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
|
1758 (insert annotation) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1759 (goto-char (point-min)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1760 (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
|
1761 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1762 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1763 (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
|
1764 "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
|
1765 (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
|
1766 (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
|
1767 (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
|
1768 (mapcar |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1769 (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
|
1770 (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
|
1771 (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
|
1772 (insert (concat name ":\n")) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1773 (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
|
1774 ;; 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
|
1775 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1776 (save-excursion (insert ann)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1777 (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
|
1778 (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
|
1779 (insert " ") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1780 (forward-line) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1781 (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
|
1782 bookmark-alist) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1783 (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
|
1784 (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
|
1785 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1786 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1787 (defun bookmark-bmenu-mark () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1788 "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
|
1789 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1790 (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
|
1791 (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
|
1792 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1793 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1794 (insert ?>) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1795 (forward-line 1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1796 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1797 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1798 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1799 (defun bookmark-bmenu-select () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1800 "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
|
1801 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
|
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) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1804 (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
|
1805 (menu (current-buffer)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1806 (others ()) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1807 tem) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1808 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1809 (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
|
1810 (setq tem (bookmark-bmenu-bookmark)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1811 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1812 (delete-char -1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1813 (insert ?\ )) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1814 (or (string-equal tem bmrk) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1815 (member tem others) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1816 (setq others (cons tem others)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1817 (setq others (nreverse others) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1818 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
|
1819 (delete-other-windows) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1820 (bookmark-jump bmrk) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1821 (bury-buffer menu) |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1822 (if others |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1823 (while others |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1824 (split-window nil tem) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1825 (other-window 1) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1826 (bookmark-jump (car others)) |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
1827 (setq others (cdr others))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1828 (other-window 1))))) |
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-save (parg) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1832 "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
|
1833 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
|
1834 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1835 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1836 (save-window-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1837 (bookmark-save parg)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1838 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1839 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1840 (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
|
1841 "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
|
1842 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1843 (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
|
1844 (save-excursion |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1845 (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
|
1846 ;; 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
|
1847 (call-interactively 'bookmark-load))))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1848 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1849 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1850 (defun bookmark-bmenu-1-window () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1851 "Select this line's bookmark, alone, in full frame." |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1852 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1853 (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
|
1854 (progn |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1855 (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
|
1856 (bury-buffer (other-buffer)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1857 (delete-other-windows)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1858 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1859 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1860 (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
|
1861 "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
|
1862 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1863 (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
|
1864 (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
|
1865 (menu (current-buffer)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1866 (pop-up-windows t)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1867 (delete-other-windows) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1868 (switch-to-buffer (other-buffer)) |
11021
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1869 (let* ((pair (bookmark-jump-noselect bmrk)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1870 (buff (car pair)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1871 (pos (cdr pair))) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1872 (pop-to-buffer buff) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1873 (goto-char pos)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1874 (bury-buffer menu)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1875 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1876 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1877 (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
|
1878 "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
|
1879 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1880 (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
|
1881 (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
|
1882 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1883 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1884 (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
|
1885 "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
|
1886 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1887 (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
|
1888 (if (bookmark-bmenu-check-position) |
11021
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1889 (let* ((pair (bookmark-jump-noselect bookmark)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1890 (buff (car pair)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1891 (pos (cdr pair))) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1892 (switch-to-buffer-other-window buff) |
11021
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1893 (goto-char pos) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1894 (set-window-point (get-buffer-window buff) pos) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1895 (bookmark-show-annotation bookmark))))) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1896 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1897 |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1898 (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
|
1899 "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
|
1900 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
|
1901 (interactive) |
22251
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1902 (let ((bookmark (bookmark-bmenu-bookmark)) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1903 (pop-up-windows t) |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1904 same-window-buffer-names |
5989fa41cda6
Changes so bookmark list mode works with Info:
Richard M. Stallman <rms@gnu.org>
parents:
21094
diff
changeset
|
1905 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
|
1906 (if (bookmark-bmenu-check-position) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1907 (let* ((pair (bookmark-jump-noselect bookmark)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1908 (buff (car pair)) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1909 (pos (cdr pair))) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1910 (display-buffer buff) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1911 (let ((o-buffer (current-buffer))) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1912 ;; save-excursion won't do |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1913 (set-buffer buff) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1914 (goto-char pos) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1915 (set-window-point (get-buffer-window buff) pos) |
83b6c53268c3
(bookmark-bmenu-2-window): go to correct position as well as
Karl Fogel <kfogel@red-bean.com>
parents:
10994
diff
changeset
|
1916 (set-buffer o-buffer)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1917 (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
|
1918 |
17265
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1919 (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
|
1920 "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
|
1921 (interactive "e") |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1922 (save-excursion |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1923 (set-buffer (window-buffer (posn-window (event-end event)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1924 (save-excursion |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1925 (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
|
1926 (bookmark-bmenu-other-window)))) |
ddbe17ae5280
Added mouse-selection feature for bookmark list buffer.
Richard M. Stallman <rms@gnu.org>
parents:
17076
diff
changeset
|
1927 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1928 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1929 (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
|
1930 "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
|
1931 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1932 (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
|
1933 (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
|
1934 (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
|
1935 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1936 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1937 (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
|
1938 "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
|
1939 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1940 (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
|
1941 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1942 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1943 (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
|
1944 "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
|
1945 (interactive) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1946 (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
|
1947 (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
|
1948 (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
|
1949 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1950 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1951 (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
|
1952 "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
|
1953 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
|
1954 (interactive "P") |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1955 (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
|
1956 (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
|
1957 (progn |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1958 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1959 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1960 ;; 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
|
1961 ;; 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
|
1962 ;; 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
|
1963 (insert " ")) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1964 (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
|
1965 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1966 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1967 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1968 (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
|
1969 "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
|
1970 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1971 (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
|
1972 (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
|
1973 (progn |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1974 (bookmark-bmenu-unmark) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1975 (forward-line -1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1976 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1977 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1978 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1979 (defun bookmark-bmenu-delete () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1980 "Mark bookmark on this line to be deleted. |
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1981 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
|
1982 (interactive) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1983 (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
|
1984 (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
|
1985 (let ((buffer-read-only nil)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1986 (delete-char 1) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1987 (insert ?D) |
19472
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1988 (forward-line 1) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
1989 (bookmark-bmenu-check-position)))) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1990 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1991 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1992 (defun bookmark-bmenu-delete-backwards () |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
1993 "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
|
1994 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
|
1995 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
1996 (bookmark-bmenu-delete) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
1997 (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
|
1998 (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
|
1999 (forward-line 1)) |
6324d603cf6e
(bookmark-load): Use `bookmark-import-new-list' to
Richard M. Stallman <rms@gnu.org>
parents:
18709
diff
changeset
|
2000 (bookmark-bmenu-check-position)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2001 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2002 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2003 (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
|
2004 "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
|
2005 (interactive) |
14039
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
2006 (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
|
2007 (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
|
2008 (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
|
2009 (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
|
2010 (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
|
2011 (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
|
2012 nil |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2013 (buffer-substring |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2014 (point) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2015 (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
|
2016 (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
|
2017 (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
|
2018 (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
|
2019 (goto-char (point-min)) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2020 (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
|
2021 (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
|
2022 (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
|
2023 (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
|
2024 (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
|
2025 (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
|
2026 (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
|
2027 (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
|
2028 (progn |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2029 (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
|
2030 (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
|
2031 (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
|
2032 (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
|
2033 (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
|
2034 (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
|
2035 (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
|
2036 (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
|
2037 (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
|
2038 (bookmark-save)) |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
2039 (message "Deleting bookmarks...done") |
831c5fda97f4
"cyclic.com" addresses changed to "red-bean.com".
Karl Fogel <kfogel@red-bean.com>
parents:
13969
diff
changeset
|
2040 )) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2041 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2042 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2043 (defun bookmark-bmenu-rename () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2044 "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
|
2045 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2046 (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
|
2047 (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
|
2048 (thispoint (point))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2049 (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
|
2050 (bookmark-bmenu-list) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2051 (goto-char thispoint)))) |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2052 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2053 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2054 (defun bookmark-bmenu-locate () |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2055 "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
|
2056 (interactive) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2057 (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
|
2058 (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
|
2059 (message (bookmark-location bmrk))))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2060 |
4537 | 2061 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2062 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2063 ;;; Menu bar stuff. Prefix is "bookmark-menu". |
4537 | 2064 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2065 (defun bookmark-menu-build-paned-menu (name entries) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2066 "Build a multi-paned menu named NAME from the strings in ENTRIES. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2067 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
|
2068 in the menu. The number of panes depends on the number of entries. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2069 The visible entries are truncated to `bookmark-menu-length', but the |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2070 strings returned are not." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2071 (let* ((f-height (/ (frame-height) 2)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2072 (pane-list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2073 (let (temp-pane-list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2074 (iter 0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2075 (while entries |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2076 (let (lst |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2077 (count 0)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2078 (while (and (< count f-height) entries) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2079 (let ((str (car entries))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2080 (setq lst (cons |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2081 (cons |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2082 (if (> (length str) bookmark-menu-length) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2083 (substring str 0 bookmark-menu-length) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2084 str) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2085 str) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2086 lst)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2087 (setq entries (cdr entries)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2088 (setq count (1+ count)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2089 (setq iter (1+ iter)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2090 (setq |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2091 temp-pane-list |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2092 (cons |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2093 (cons |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2094 (format "-*- %s (%d) -*-" name iter) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2095 (nreverse lst)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2096 temp-pane-list)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2097 (nreverse temp-pane-list)))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2098 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2099 ;; Return the menu: |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2100 (cons (concat "-*- " name " -*-") pane-list))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2101 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2102 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2103 (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
|
2104 "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
|
2105 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
|
2106 in the menu. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2107 The number of panes depends on the number of entries." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2108 (interactive "e") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2109 (x-popup-menu event (bookmark-menu-build-paned-menu name entries))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2110 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2111 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2112 (defun bookmark-menu-popup-paned-bookmark-menu (event name) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2113 "Pop up menu of bookmarks, return chosen bookmark. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2114 Pop up at EVENT, menu's name is NAME. |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2115 The number of panes depends on the number of bookmarks." |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2116 (bookmark-menu-popup-paned-menu event name (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
|
2117 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2118 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2119 (defun bookmark-popup-menu-and-apply-function (func-sym menu-label event) |
4537 | 2120 ;; help function for making menus that need to apply a bookmark |
2121 ;; function to 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
|
2122 (let* ((choice (bookmark-menu-popup-paned-bookmark-menu |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2123 event menu-label))) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2124 (if choice (apply func-sym (list choice))))) |
4537 | 2125 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2126 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2127 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2128 (defun bookmark-menu-insert (event) |
4633 | 2129 "Insert the text of the file pointed to by bookmark BOOKMARK. |
2130 You may have a problem using this function if the value of variable | |
2131 `bookmark-alist' is nil. If that happens, you need to load in some | |
2132 bookmarks. See help on function `bookmark-load' for more about | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2133 this. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2134 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2135 Warning: this function only takes an EVENT as argument. Use the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2136 corresponding bookmark function from Lisp \(the one without the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2137 \"-menu-\" in its name\)." |
4537 | 2138 (interactive "e") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2139 (bookmark-popup-menu-and-apply-function |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2140 'bookmark-insert "Insert Bookmark Contents" event)) |
4537 | 2141 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2142 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2143 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2144 (defun bookmark-menu-jump (event) |
4633 | 2145 "Jump to bookmark BOOKMARK (a point in some file). |
2146 You may have a problem using this function if the value of variable | |
2147 `bookmark-alist' is nil. If that happens, you need to load in some | |
2148 bookmarks. See help on function `bookmark-load' for more about | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2149 this. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2150 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2151 Warning: this function only takes an EVENT as argument. Use the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2152 corresponding bookmark function from Lisp \(the one without the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2153 \"-menu-\" in its name\)." |
4537 | 2154 (interactive "e") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2155 (bookmark-popup-menu-and-apply-function |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2156 'bookmark-jump "Jump to Bookmark" event)) |
4537 | 2157 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2158 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2159 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2160 (defun bookmark-menu-locate (event) |
7510 | 2161 "Insert the name of the file associated with BOOKMARK. |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2162 \(This is not the same as the contents of that file\). |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2163 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2164 Warning: this function only takes an EVENT as argument. Use the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2165 corresponding bookmark function from Lisp \(the one without the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2166 \"-menu-\" in its name\)." |
4537 | 2167 (interactive "e") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2168 (bookmark-popup-menu-and-apply-function |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2169 'bookmark-insert-location "Insert Bookmark Location" event)) |
4537 | 2170 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2171 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2172 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2173 (defun bookmark-menu-rename (event) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2174 "Change the name of OLD-BOOKMARK to NEWNAME. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2175 If called from keyboard, prompts for OLD-BOOKMARK and NEWNAME. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2176 If called from menubar, OLD-BOOKMARK is selected from a menu, and |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2177 prompts for NEWNAME. |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2178 If called from Lisp, prompts for NEWNAME if only OLD-BOOKMARK was |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2179 passed as an argument. If called with two strings, then no prompting |
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2180 is done. You must pass at least OLD-BOOKMARK when calling from Lisp. |
4633 | 2181 |
2182 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
|
2183 consecutive words from the text of the buffer into the new bookmark |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2184 name. |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2185 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2186 Warning: this function only takes an EVENT as argument. Use the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2187 corresponding bookmark function from Lisp \(the one without the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2188 \"-menu-\" in its name\)." |
4537 | 2189 (interactive "e") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2190 (bookmark-popup-menu-and-apply-function |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2191 'bookmark-rename "Rename Bookmark" event)) |
4537 | 2192 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2193 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2194 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2195 (defun bookmark-menu-delete (event) |
4633 | 2196 "Delete the bookmark named NAME from the bookmark list. |
2197 Removes only the first instance of a bookmark with that name. If | |
2198 there are one or more other bookmarks with the same name, they will | |
2199 not be deleted. Defaults to the \"current\" bookmark \(that is, the | |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2200 one most recently used in this file, if any\). |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2201 |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2202 Warning: this function only takes an EVENT as argument. Use the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2203 corresponding bookmark function from Lisp \(the one without the |
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2204 \"-menu-\" in its name\)." |
4537 | 2205 (interactive "e") |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2206 (bookmark-popup-menu-and-apply-function |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2207 'bookmark-delete "Delete Bookmark" event)) |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2208 |
4537 | 2209 |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2210 ;; 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
|
2211 ;; following works, and for explaining what to do to make it work. |
4537 | 2212 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2213 ;; 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
|
2214 ;; that the whole job is done in loaddefs.el. |
4537 | 2215 |
15193
4df75cda7e5b
(bookmark-bmenu-delete-backwards)
Richard M. Stallman <rms@gnu.org>
parents:
15189
diff
changeset
|
2216 ;; 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
|
2217 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2218 ;;;###autoload |
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2219 (defvar menu-bar-bookmark-map (make-sparse-keymap "Bookmark functions")) |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2220 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2221 ;;;###autoload |
12310
afad1c3ce9bd
Make doc strings and argument names consistent where necessary.
Richard M. Stallman <rms@gnu.org>
parents:
12033
diff
changeset
|
2222 (defalias 'menu-bar-bookmark-map (symbol-value '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
|
2223 |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2224 ;; 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
|
2225 (if (boundp '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
|
2226 (if 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
|
2227 (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
|
2228 (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
|
2229 (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
|
2230 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2231 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2232 (define-key menu-bar-bookmark-map [load] |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2233 '("Load a Bookmark File..." . bookmark-load)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2234 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2235 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2236 (define-key menu-bar-bookmark-map [write] |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2237 '("Save Bookmarks As..." . bookmark-write)) |
4537 | 2238 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2239 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2240 (define-key menu-bar-bookmark-map [save] |
13895
0c12b3398d37
Removed all `bookmark-xemacsp' conditional code relating to menus. Do
Karl Fogel <kfogel@red-bean.com>
parents:
12880
diff
changeset
|
2241 '("Save Bookmarks" . bookmark-save)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2242 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2243 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2244 (define-key menu-bar-bookmark-map [edit] |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2245 '("Edit Bookmark List" . bookmark-bmenu-list)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2246 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2247 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2248 (define-key menu-bar-bookmark-map [delete] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2249 '("Delete Bookmark" . bookmark-menu-delete)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2250 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2251 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2252 (define-key menu-bar-bookmark-map [rename] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2253 '("Rename Bookmark" . bookmark-menu-rename)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2254 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2255 ;;;###autoload |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2256 (define-key menu-bar-bookmark-map [locate] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2257 '("Insert Location" . bookmark-menu-locate)) |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2258 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2259 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2260 (define-key menu-bar-bookmark-map [insert] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2261 '("Insert Contents" . bookmark-menu-insert)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2262 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2263 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2264 (define-key menu-bar-bookmark-map [set] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2265 '("Set Bookmark" . bookmark-set)) |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2266 |
11218
fc73b8f750f1
(menu-bar-bookmark-map): Autoload each form
Richard M. Stallman <rms@gnu.org>
parents:
11070
diff
changeset
|
2267 ;;;###autoload |
4848
511c83aee4ae
(bookmark-write): Add numbered backups for bookmark file.
Richard M. Stallman <rms@gnu.org>
parents:
4634
diff
changeset
|
2268 (define-key menu-bar-bookmark-map [jump] |
12033
f7638ab47de7
Fix capitalization in menu bar.
Karl Heuer <kwzh@gnu.org>
parents:
11218
diff
changeset
|
2269 '("Jump to Bookmark" . bookmark-menu-jump)) |
4537 | 2270 |
10952
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2271 ;;;; 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
|
2272 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2273 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2274 ;;; Load Hook |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2275 (defvar bookmark-load-hook nil |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2276 "Hook to run at the end of loading bookmark.") |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2277 |
6069707b1151
Insure that all entry points call `bookmark-maybe-load-default-file'.
Richard M. Stallman <rms@gnu.org>
parents:
9775
diff
changeset
|
2278 (run-hooks 'bookmark-load-hook) |
4537 | 2279 |
2280 (provide 'bookmark) | |
2281 | |
4595 | 2282 ;;; bookmark.el ends here |