annotate lisp/bookmark.el @ 92568:f91d9f543b0a

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