Mercurial > emacs
comparison lisp/bookmark.el @ 7510:9f361177d70c
Doc fixes.
(bookmark-relocate): Rename arg.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 16 May 1994 07:24:45 +0000 |
parents | cc7cd83ccf3f |
children | d1a839615554 |
comparison
equal
deleted
inserted
replaced
7509:dd0db01bc9f4 | 7510:9f361177d70c |
---|---|
177 | 177 |
178 (make-variable-buffer-local 'bookmark-current-bookmark) | 178 (make-variable-buffer-local 'bookmark-current-bookmark) |
179 | 179 |
180 (defvar bookmark-save-flag t | 180 (defvar bookmark-save-flag t |
181 "*Controls when Emacs saves bookmarks to a file. | 181 "*Controls when Emacs saves bookmarks to a file. |
182 --> Nil means never save bookmarks, except when `bookmark-save' is | 182 --> nil means never save bookmarks, except when `bookmark-save' is |
183 explicitly called \(\\[bookmark-save]\). | 183 explicitly called \(\\[bookmark-save]\). |
184 --> t means save bookmarks when Emacs is killed. | 184 --> t means save bookmarks when Emacs is killed. |
185 --> Otherise, it should be a number that is the frequency with which | 185 --> Otherise, it should be a number that is the frequency with which |
186 the bookmark list is saved \(i.e.: the number of times which | 186 the bookmark list is saved \(i.e.: the number of times which |
187 Emacs' bookmark list may be modified before it is automatically | 187 Emacs' bookmark list may be modified before it is automatically |
200 | 200 |
201 (defvar bookmark-file "~/.emacs-bkmrks" | 201 (defvar bookmark-file "~/.emacs-bkmrks" |
202 "*File in which to save bookmarks by default.") | 202 "*File in which to save bookmarks by default.") |
203 | 203 |
204 (defvar bookmark-version-control 'nospecial | 204 (defvar bookmark-version-control 'nospecial |
205 "This variable controls whether or not to make numbered backups of | 205 "Control whether to make numbered backups of the master bookmark file. |
206 the master bookmark file. It can have four values: t, nil, never, and | 206 This variable can have four values: t, nil, `never', and `nospecial'. |
207 nospecial. The first three have the same meaning that they do for the | 207 The first three have the same meaning that they do for the |
208 variable version-control, and the final value nospecial means just use | 208 variable `version-control'. |
209 the value of version-control.") | 209 The value `nospecial' means just use the value of `version-control'.") |
210 | 210 |
211 (defvar bookmark-completion-ignore-case t | 211 (defvar bookmark-completion-ignore-case t |
212 "*Non-nil means bookmark functions ignore case in completion.") | 212 "*Non-nil means bookmark functions ignore case in completion.") |
213 | 213 |
214 (defvar bookmark-sort-flag t | 214 (defvar bookmark-sort-flag t |
215 "*Non-nil means that bookmarks will be displayed sorted by bookmark | 215 "*Non-nil means display bookmarks sorted by name. |
216 name. Otherwise they will be displayed in LIFO order (that is, most | 216 Otherwise they are displayed in LIFO order (that is, most |
217 recently set ones come first, oldest ones come last).") | 217 recently set ones come first, oldest ones come last).") |
218 | 218 |
219 (defvar bookmark-search-size 500 | 219 (defvar bookmark-search-size 500 |
220 "Length of the context strings recorded on either side of a bookmark.") | 220 "Length of the context strings recorded on either side of a bookmark.") |
221 | 221 |
223 (defvar bookmark-yank-point 0) | 223 (defvar bookmark-yank-point 0) |
224 (defvar bookmark-current-buffer nil) | 224 (defvar bookmark-current-buffer nil) |
225 | 225 |
226 ;;;###autoload | 226 ;;;###autoload |
227 (defun bookmark-set (&optional parg) | 227 (defun bookmark-set (&optional parg) |
228 "Set a bookmark named NAME inside a file. | 228 "Set a bookmark named NAME inside the visited file. |
229 With prefix arg, will not overwrite a bookmark that has the same name | 229 With prefix arg, will not overwrite a bookmark that has the same name |
230 as NAME if such a bookmark already exists, but instead will \"push\" | 230 as NAME if such a bookmark already exists, but instead will \"push\" |
231 the new bookmark onto the bookmark alist. Thus the most recently set | 231 the new bookmark onto the bookmark alist. Thus the most recently set |
232 bookmark with name NAME would be the one in effect at any given time, | 232 bookmark with name NAME would be the one in effect at any given time, |
233 but the others are still there, should you decide to delete the most | 233 but the others are still there, should you decide to delete the most |
235 | 235 |
236 To yank words from the text of the buffer and use them as part of the | 236 To yank words from the text of the buffer and use them as part of the |
237 bookmark name, type C-w while setting a bookmark. Successive C-w's | 237 bookmark name, type C-w while setting a bookmark. Successive C-w's |
238 yank successive words. | 238 yank successive words. |
239 | 239 |
240 Typing C-v inserts the name of the current file being visited. Typing | 240 Typing C-v inserts the name of the current file being visited. Typing |
241 C-u inserts the name of the last bookmark used in the buffer \(as an | 241 C-u inserts the name of the last bookmark used in the buffer \(as an |
242 aid in using a single bookmark name to track your progress through a | 242 aid in using a single bookmark name to track your progress through a |
243 large file\). If no bookmark was used, then C-u behaves like C-v and | 243 large file\). If no bookmark was used, then C-u behaves like C-v and |
244 inserts the name of the file being visited. | 244 inserts the name of the file being visited. |
245 | 245 |
386 You may have a problem using this function if the value of variable | 386 You may have a problem using this function if the value of variable |
387 `bookmark-alist' is nil. If that happens, you need to load in some | 387 `bookmark-alist' is nil. If that happens, you need to load in some |
388 bookmarks. See help on function `bookmark-load' for more about | 388 bookmarks. See help on function `bookmark-load' for more about |
389 this. | 389 this. |
390 | 390 |
391 If the file pointed to by BOOKMARK no longer exists, you will be asked | 391 If the file pointed to by BOOKMARK no longer exists, `bookmark-jump' |
392 if you wish to give the bookmark a new location, and bookmark-jump | 392 asks you to specify a different file to use instead. If you specify |
393 will then jump to the new location, as well as recording it in place | 393 one, it also updates BOOKMARK to refer to that file." |
394 of the old one in the permanent bookmark record." | |
395 (interactive (progn (bookmark-try-default-file) | 394 (interactive (progn (bookmark-try-default-file) |
396 (let* ((completion-ignore-case | 395 (let* ((completion-ignore-case |
397 bookmark-completion-ignore-case) | 396 bookmark-completion-ignore-case) |
398 (default | 397 (default |
399 (or (and | 398 (or (and |
474 (message | 473 (message |
475 "Bookmark not relocated, but deleting it would be a good idea.") | 474 "Bookmark not relocated, but deleting it would be a good idea.") |
476 nil)))))) | 475 nil)))))) |
477 | 476 |
478 ;;;###autoload | 477 ;;;###autoload |
479 (defun bookmark-relocate (str) | 478 (defun bookmark-relocate (bookmark) |
480 "Relocate BOOKMARK -- prompts for a filename, and makes an already | 479 "Relocate bookmark BOOKMARK. |
481 existing bookmark point to that file, instead of the one it used to | 480 Prompt for a filename, and makes the bookmark BOOKMARK point to that |
482 point at. Useful when a file has been renamed after a bookmark was | 481 file, instead of the one it used to point at. Useful when a file has |
483 set in it." | 482 been renamed after a bookmark was set in it." |
484 (interactive (let ((completion-ignore-case | 483 (interactive (let ((completion-ignore-case |
485 bookmark-completion-ignore-case)) | 484 bookmark-completion-ignore-case)) |
486 (progn (bookmark-try-default-file) | 485 (progn (bookmark-try-default-file) |
487 (list (completing-read | 486 (list (completing-read |
488 "Bookmark to relocate: " | 487 "Bookmark to relocate: " |
489 bookmark-alist | 488 bookmark-alist |
490 nil | 489 nil |
491 0))))) | 490 0))))) |
492 (let* ((bmrk (assoc str bookmark-alist)) | 491 (let* ((bmrk (assoc bookmark bookmark-alist)) |
493 (bmrk-filename (car (car (cdr bmrk)))) | 492 (bmrk-filename (car (car (cdr bmrk)))) |
494 (newloc (expand-file-name | 493 (newloc (expand-file-name |
495 (read-file-name | 494 (read-file-name |
496 (format "Relocate %s to: " str) | 495 (format "Relocate %s to: " bookmark) |
497 (file-name-directory bmrk-filename))))) | 496 (file-name-directory bmrk-filename))))) |
498 (setcar (car (cdr bmrk)) newloc))) | 497 (setcar (car (cdr bmrk)) newloc))) |
499 | 498 |
500 ;;;###autoload | 499 ;;;###autoload |
501 (defun bookmark-locate (str &optional no-insertion) | 500 (defun bookmark-locate (str &optional no-insertion) |
630 (t | 629 (t |
631 nil))) | 630 nil))) |
632 | 631 |
633 ;;;###autoload | 632 ;;;###autoload |
634 (defun bookmark-write () | 633 (defun bookmark-write () |
635 "Write bookmarks to a file \(for which the user will be prompted | 634 "Write bookmarks to a specified file. |
636 interactively\). Don't use this in Lisp programs; use bookmark-save | 635 Don't use this in Lisp programs; use `bookmark-save' instead." |
637 instead." | |
638 (interactive) | 636 (interactive) |
639 (bookmark-try-default-file) | 637 (bookmark-try-default-file) |
640 (bookmark-save t)) | 638 (bookmark-save t)) |
641 | 639 |
642 ;;;###autoload | 640 ;;;###autoload |
809 | 807 |
810 ;;;###autoload | 808 ;;;###autoload |
811 (defun list-bookmarks () | 809 (defun list-bookmarks () |
812 "Display a list of existing bookmarks. | 810 "Display a list of existing bookmarks. |
813 The list is displayed in a buffer named `*Bookmark List*'. | 811 The list is displayed in a buffer named `*Bookmark List*'. |
814 The leftmost column displays a D if the bookmark is flagged for | 812 The leftmost column displays a `D' if the bookmark is flagged for |
815 deletion, or > if it is flagged for displaying." | 813 deletion, or `>' if it is flagged for displaying." |
816 (interactive) | 814 (interactive) |
817 (bookmark-try-default-file) | 815 (bookmark-try-default-file) |
818 (switch-to-buffer (get-buffer-create "*Bookmark List*")) | 816 (switch-to-buffer (get-buffer-create "*Bookmark List*")) |
819 (let ((buffer-read-only nil)) | 817 (let ((buffer-read-only nil)) |
820 (delete-region (point-max) (point-min)) | 818 (delete-region (point-max) (point-min)) |
837 Each line describes one of the bookmarks in Emacs. | 835 Each line describes one of the bookmarks in Emacs. |
838 Letters do not insert themselves; instead, they are commands. | 836 Letters do not insert themselves; instead, they are commands. |
839 \\<Bookmark-menu-mode-map> | 837 \\<Bookmark-menu-mode-map> |
840 \\[Bookmark-menu-mark] -- mark bookmark to be displayed. | 838 \\[Bookmark-menu-mark] -- mark bookmark to be displayed. |
841 \\[Bookmark-menu-select] -- select bookmark of line point is on. | 839 \\[Bookmark-menu-select] -- select bookmark of line point is on. |
842 Also show bookmarks marked using m in other windows. | 840 Also show bookmarks marked using `m' in other windows. |
843 \\[Bookmark-menu-toggle-filenames] -- toggle displaying of filenames (they may obscure long bookmark names). | 841 \\[Bookmark-menu-toggle-filenames] -- toggle displaying of filenames (they may obscure long bookmark names). |
844 \\[Bookmark-menu-locate] -- display (in minibuffer) location of this bookmark. | 842 \\[Bookmark-menu-locate] -- display (in minibuffer) location of this bookmark. |
845 \\[Bookmark-menu-1-window] -- select this bookmark in full-frame window. | 843 \\[Bookmark-menu-1-window] -- select this bookmark in full-frame window. |
846 \\[Bookmark-menu-2-window] -- select this bookmark in one window, | 844 \\[Bookmark-menu-2-window] -- select this bookmark in one window, |
847 together with bookmark selected before this one in another window. | 845 together with bookmark selected before this one in another window. |
1108 (delete-char 1) | 1106 (delete-char 1) |
1109 (insert ?D) | 1107 (insert ?D) |
1110 (forward-line 1)))) | 1108 (forward-line 1)))) |
1111 | 1109 |
1112 (defun Bookmark-menu-delete-backwards () | 1110 (defun Bookmark-menu-delete-backwards () |
1113 "Mark bookmark on this line to be deleted by \\<Bookmark-menu-mode-map>\\[Bookmark-menu-execute] command | 1111 "Mark bookmark on this line to be deleted by \\<Bookmark-menu-mode-map>\\[Bookmark-menu-execute] command. |
1114 and then move up one line" | 1112 Then move up one line" |
1115 (interactive) | 1113 (interactive) |
1116 (Bookmark-menu-delete) | 1114 (Bookmark-menu-delete) |
1117 (forward-line -2) | 1115 (forward-line -2) |
1118 (if (Bookmark-menu-check-position) | 1116 (if (Bookmark-menu-check-position) |
1119 (forward-line 1))) | 1117 (forward-line 1))) |
1213 "--- Jump to Bookmark ---" | 1211 "--- Jump to Bookmark ---" |
1214 event)) | 1212 event)) |
1215 | 1213 |
1216 ;;;###autoload | 1214 ;;;###autoload |
1217 (defun bookmark-menu-bar-locate (event) | 1215 (defun bookmark-menu-bar-locate (event) |
1218 "Insert the name of the file associated with BOOKMARK. | 1216 "Insert the name of the file associated with BOOKMARK. |
1219 \(This is not the same as the contents of that file\)." | 1217 \(This is not the same as the contents of that file\)." |
1220 (interactive "e") | 1218 (interactive "e") |
1221 (bookmark-make-menu-bar-with-function 'bookmark-locate | 1219 (bookmark-make-menu-bar-with-function 'bookmark-locate |
1222 "Bookmark Locate Menu" | 1220 "Bookmark Locate Menu" |
1223 "--- Insert Location ---" | 1221 "--- Insert Location ---" |