aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-08-14 19:49:27 +0000
committerRichard M. Stallman1993-08-14 19:49:27 +0000
commit9aef3b213de6a3c2b45c99b093d414074461045f (patch)
tree3e459032f898f9fed6594b34a93b61da021933df
parente443f843a444ef7d18b8b0c8dcbbbba83be81794 (diff)
downloademacs-9aef3b213de6a3c2b45c99b093d414074461045f.tar.gz
emacs-9aef3b213de6a3c2b45c99b093d414074461045f.zip
Doc fixes.
-rw-r--r--lisp/bookmark.el195
1 files changed, 113 insertions, 82 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 5d8f252a4fc..095a4491ead 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -82,10 +82,11 @@
82 82
83;; define the map, so it can be bound by those who desire to do so: 83;; define the map, so it can be bound by those who desire to do so:
84 84
85(defvar bookmark-map nil "This is a keymap containing bookmark 85(defvar bookmark-map nil
86functions. It is not bound to any key by default: to bind it so 86 "Keymap containing bindings to bookmark functions.
87that you have a bookmark prefix, just use global-set-key and bind a 87It is not bound to any key by default: to bind it
88key of your choice to \`bookmark-map\'. All interactive bookmark 88so that you have a bookmark prefix, just use `global-set-key' and bind a
89key of your choice to `bookmark-map'. All interactive bookmark
89functions have a binding in this keymap.") 90functions have a binding in this keymap.")
90 91
91(define-prefix-command 'bookmark-map) 92(define-prefix-command 'bookmark-map)
@@ -96,7 +97,7 @@ functions have a binding in this keymap.")
96(define-key bookmark-map "j" 'bookmark-jump) 97(define-key bookmark-map "j" 'bookmark-jump)
97(define-key bookmark-map "i" 'bookmark-insert) 98(define-key bookmark-map "i" 'bookmark-insert)
98(define-key bookmark-map "f" 'bookmark-locate) ; "f" for "find" 99(define-key bookmark-map "f" 'bookmark-locate) ; "f" for "find"
99(define-key bookmark-map "n" 'bookmark-rename) ; "n" for "new name" 100(define-key bookmark-map "r" 'bookmark-rename)
100;; deletes bookmarks 101;; deletes bookmarks
101(define-key bookmark-map "d" 'bookmark-delete) 102(define-key bookmark-map "d" 'bookmark-delete)
102;; loads new file 103;; loads new file
@@ -118,47 +119,41 @@ functions have a binding in this keymap.")
118 119
119;; more stuff added by db. 120;; more stuff added by db.
120(defvar bookmark-current-bookmark nil 121(defvar bookmark-current-bookmark nil
121 "This variable stores the bookmark most recently set, jumped to, or 122 "Name of bookmark most recently used in the current file.
122renamed. It is buffer local, used to make moving a bookmark forward 123It is buffer local, used to make moving a bookmark forward
123through a file easier.") 124through a file easier.")
124 125
125(make-variable-buffer-local 'bookmark-current-bookmark) 126(make-variable-buffer-local 'bookmark-current-bookmark)
126 127
127(defvar bookmark-save-flag t 128(defvar bookmark-save-flag t
128 "*This variable determines when Emacs\' internal bookmark list will 129 "*Controls when Emacs saves bookmarks to a file.
129be saved to a file: 130--> Nil means never save bookmarks, except when `bookmark-save' is
130 131 explicitly called \(\\[bookmark-save]\).
131Nil means never save bookmarks, except when \`bookmark-save\' is 132--> t means save bookmarks when Emacs is killed.
132explicitly called \(\\[bookmark-save]\). 133--> Otherise, it should be a number that is the frequency with which
133 134 the bookmark list is saved \(i.e.: the number of times which
134t means save bookmarks when Emacs is killed. 135 Emacs' bookmark list may be modified before it is automatically
135 136 saved.\). If it is a number, Emacs will also automatically save
136Otherise, it should be a number that is the frequency with which the 137 bookmarks when it is killed.
137bookmark list is saved \(i.e.: the number of times which Emacs\'
138bookmark list may be modified before it is automatically saved.\). If
139it is a number, Emacs will also automatically save bookmarks when it
140is killed.
141 138
142Therefore, the way to get it to save every time you make or delete a 139Therefore, the way to get it to save every time you make or delete a
143bookmark is to set this variable to 1 \(or 0, which produces the same 140bookmark is to set this variable to 1 \(or 0, which produces the same
144behavior.\) 141behavior.\)
145 142
146To specify the file in which to save them, modify the variable 143To specify the file in which to save them, modify the variable
147bookmark-file, which is \`~/.emacs-bkmrks\' by default.") 144bookmark-file, which is `~/.emacs-bkmrks' by default.")
148 145
149(defvar bookmark-alist-modification-count 0 146(defvar bookmark-alist-modification-count 0
150 "Number of times the bookmark list has been modified since last 147 "Number of modifications to bookmark list since it was last saved.")
151saved.")
152 148
153(defvar bookmark-file "~/.emacs-bkmrks" 149(defvar bookmark-file "~/.emacs-bkmrks"
154 "*File in which to save bookmarks by default.") 150 "*File in which to save bookmarks by default.")
155 151
156(defvar bookmark-completion-ignore-case t 152(defvar bookmark-completion-ignore-case t
157 "*Non-nil means those bookmark functions which use completion will 153 "*Non-nil means bookmark functions ignore case in completion.")
158be case-insensitive in completion.")
159 154
160(defvar bookmark-search-size 500 "Length, in characters, of the 155(defvar bookmark-search-size 500
161context strings recorded on either side of a bookmark.") 156 "Length of the context strings recorded on either side of a bookmark.")
162 157
163(defvar bookmark-alist () 158(defvar bookmark-alist ()
164 "Association list of bookmarks. 159 "Association list of bookmarks.
@@ -170,15 +165,17 @@ instead, let the various bookmark functions do it for you.")
170(defvar bookmark-current-buffer nil) 165(defvar bookmark-current-buffer nil)
171 166
172(defun bookmark-set (&optional parg) 167(defun bookmark-set (&optional parg)
173 "Set a bookmark named NAME inside a file. With prefix arg, will not 168
174overwrite a bookmark that has the same name as NAME if such a bookmark 169 "Set a bookmark named NAME inside a file.
175already exists, but instead will \"push\" the new bookmark onto the 170With prefix arg, will not overwrite a bookmark that has the same name
176bookmark alist. Thus the most recently set bookmark with name NAME would 171as NAME if such a bookmark already exists, but instead will \"push\"
177be the one in effect at any given time, but the others are still there, 172the new bookmark onto the bookmark alist. Thus the most recently set
178should you decide to delete the most recent one. 173bookmark with name NAME would be the one in effect at any given time,
174but the others are still there, should you decide to delete the most
175recent one.
179 176
180To yank words from the text of the buffer and use them as part of the 177To yank words from the text of the buffer and use them as part of the
181bookmark name, type C-w while setting a bookmark. Successive C-w\'s 178bookmark name, type C-w while setting a bookmark. Successive C-w's
182yank successive words. 179yank successive words.
183 180
184Typing C-v inserts the name of the current file being visited. Typing 181Typing C-v inserts the name of the current file being visited. Typing
@@ -305,10 +302,10 @@ the list of bookmarks.\)"
305 (bookmark-load bookmark-file))) 302 (bookmark-load bookmark-file)))
306 303
307(defun bookmark-jump (str) 304(defun bookmark-jump (str)
308 "Jump to bookmark BOOKMARK (a point in some file). You may have a 305 "Jump to bookmark BOOKMARK (a point in some file).
309problem using this function if the value of variable 306You may have a problem using this function if the value of variable
310\`bookmark-alist\' is nil. If that happens, you need to load in some 307`bookmark-alist' is nil. If that happens, you need to load in some
311bookmarks. See help on function \`bookmark-load\' for more about 308bookmarks. See help on function `bookmark-load' for more about
312this." 309this."
313 (interactive (let ((completion-ignore-case 310 (interactive (let ((completion-ignore-case
314 bookmark-completion-ignore-case)) 311 bookmark-completion-ignore-case))
@@ -347,8 +344,8 @@ this."
347 "\"")))))) 344 "\""))))))
348 345
349(defun bookmark-locate (str) 346(defun bookmark-locate (str)
350 "Insert the name of the file associated with BOOKMARK \(as opposed 347 "Insert the name of the file associated with BOOKMARK.
351to the contents of that file\)." 348\(This is not the same as the contents of that file\)."
352 (interactive (let ((completion-ignore-case 349 (interactive (let ((completion-ignore-case
353 bookmark-completion-ignore-case)) 350 bookmark-completion-ignore-case))
354 (list (completing-read 351 (list (completing-read
@@ -358,11 +355,18 @@ to the contents of that file\)."
358 0)))) 355 0))))
359 (insert (car (car (cdr (assoc str bookmark-alist)))))) 356 (insert (car (car (cdr (assoc str bookmark-alist))))))
360 357
361(defun bookmark-rename (old) 358(defun bookmark-rename (old &optional new)
362 "Change the name of BOOKMARK to NEWNAME. While you are entering 359 "Change the name of BOOKMARK to NEWNAME.
363the new name, consecutive C-w\'s will insert consectutive words from 360If called from keyboard, prompts for OLD and NEWNAME.
364the text of the buffer into the new bookmark name, and C-v will insert 361If called from menubar, prompts for NEWNAME.
365the name of the file." 362If called from Lisp, prompts for NEWNAME if only BOOKMARK was passed
363as an argument. If called with two strings, then no prompting is
364done. You must pass at least BOOKMARK when calling from Lisp.
365
366While you are entering the new name, consecutive C-w's insert
367consectutive words from the text of the buffer into the new bookmark
368name, and C-v inserts the name of the file."
369
366 (interactive (let ((completion-ignore-case 370 (interactive (let ((completion-ignore-case
367 bookmark-completion-ignore-case)) 371 bookmark-completion-ignore-case))
368 (list (completing-read "Old bookmark name: " 372 (list (completing-read "Old bookmark name: "
@@ -375,15 +379,16 @@ the name of the file."
375 (setq bookmark-current-buffer (current-buffer)) 379 (setq bookmark-current-buffer (current-buffer))
376 (let ((cell (assoc old bookmark-alist)) 380 (let ((cell (assoc old bookmark-alist))
377 (str 381 (str
378 (read-from-minibuffer 382 (or new ; use second arg, if non-nil
379 "New name: " 383 (read-from-minibuffer
380 nil 384 "New name: "
381 (let ((now-map (copy-keymap minibuffer-local-map))) 385 nil
382 (progn (define-key now-map "\C-w" 386 (let ((now-map (copy-keymap minibuffer-local-map)))
383 'bookmark-yank-word) 387 (progn (define-key now-map "\C-w"
384 (define-key now-map "\C-v" 388 'bookmark-yank-word)
385 'bookmark-insert-current-file-name)) 389 (define-key now-map "\C-v"
386 now-map)))) 390 'bookmark-insert-current-file-name))
391 now-map)))))
387 (progn 392 (progn
388 (setcar cell str) 393 (setcar cell str)
389 (setq bookmark-current-bookmark str) 394 (setq bookmark-current-bookmark str)
@@ -393,10 +398,10 @@ the name of the file."
393 (bookmark-save)))))) 398 (bookmark-save))))))
394 399
395(defun bookmark-insert (str) 400(defun bookmark-insert (str)
396 "Insert the text of the file pointed to by bookmark BOOKMARK. You 401 "Insert the text of the file pointed to by bookmark BOOKMARK.
397may have a problem using this function if the value of variable 402You may have a problem using this function if the value of variable
398\`bookmark-alist\' is nil. If that happens, you need to load in some 403`bookmark-alist' is nil. If that happens, you need to load in some
399bookmarks. See help on function \`bookmark-load\' for more about 404bookmarks. See help on function `bookmark-load' for more about
400this." 405this."
401 (interactive (let ((completion-ignore-case 406 (interactive (let ((completion-ignore-case
402 bookmark-completion-ignore-case)) 407 bookmark-completion-ignore-case))
@@ -426,11 +431,12 @@ this."
426 "\"")))))) 431 "\""))))))
427 432
428(defun bookmark-delete (str) 433(defun bookmark-delete (str)
429 "Delete the bookmark named NAME from the bookmark list. Removes 434 "Delete the bookmark named NAME from the bookmark list.
430only the first instance of a bookmark with that name. If there are 435Removes only the first instance of a bookmark with that name. If
431one or more other bookmarks with the same name, they will not be 436there are one or more other bookmarks with the same name, they will
432deleted. Defaults to the \"current\" bookmark \(that is, the one most 437not be deleted. Defaults to the \"current\" bookmark \(that is, the
433recently used in this file, if any\)." 438one most recently used in this file, if any\)."
439
434 (interactive (let ((completion-ignore-case 440 (interactive (let ((completion-ignore-case
435 bookmark-completion-ignore-case)) 441 bookmark-completion-ignore-case))
436 (list 442 (list
@@ -471,8 +477,9 @@ recently used in this file, if any\)."
471 (bookmark-save t)) 477 (bookmark-save t))
472 478
473(defun bookmark-save (&optional parg file) 479(defun bookmark-save (&optional parg file)
474 "Save currently defined bookmarks in the file defined by the 480 "Save currently defined bookmarks.
475variable \`bookmark-file\'. With a prefix arg, save it in file FILE. 481Saves by default in the file defined by the variable
482`bookmark-file'. With a prefix arg, save it in file FILE.
476 483
477If you are calling this from Lisp, the two arguments are PREFIX-ARG 484If you are calling this from Lisp, the two arguments are PREFIX-ARG
478and FILE, and if you just want it to write to the default file, then 485and FILE, and if you just want it to write to the default file, then
@@ -481,9 +488,9 @@ instead. If you pass in one argument, and it is non-nil, then the
481user will be interactively queried for a file to save in. 488user will be interactively queried for a file to save in.
482 489
483When you want to load in the bookmarks from a file, use 490When you want to load in the bookmarks from a file, use
484\\`bookmark-load\\', \\[bookmark-load]. That function will prompt you 491\`bookmark-load\', \\[bookmark-load]. That function will prompt you
485for a file, defaulting to the file defined by variable 492for a file, defaulting to the file defined by variable
486\`bookmark-file\'." 493`bookmark-file'."
487 (interactive "P") 494 (interactive "P")
488 (cond 495 (cond
489 ((and (null parg) (null file)) 496 ((and (null parg) (null file))
@@ -514,15 +521,16 @@ for a file, defaulting to the file defined by variable
514 (kill-buffer (current-buffer)))) 521 (kill-buffer (current-buffer))))
515 522
516(defun bookmark-load (file &optional revert no-msg) 523(defun bookmark-load (file &optional revert no-msg)
517 "Loads bookmarks from FILE, appending loaded bookmarks to the front 524 "Load bookmarks from FILE (which must be in bookmark format).
518of the list of bookmarks. If optional second argument REVERT is 525Appends loaded bookmarks to the front of the list of bookmarks. If
519non-nil, existing bookmarks are destroyed. Optional third arg NO-MSG 526optional second argument REVERT is non-nil, existing bookmarks are
520means don't display any messages while loading. 527destroyed. Optional third arg NO-MSG means don't display any messages
528while loading.
521 529
522If you load a file that doesn't contain a proper bookmark alist, you 530If you load a file that doesn't contain a proper bookmark alist, you
523will corrupt Emacs\' bookmark list. Generally, you should only load 531will corrupt Emacs's bookmark list. Generally, you should only load
524in files that were created with the bookmark functions in the first 532in files that were created with the bookmark functions in the first
525place. Your own personal bookmark file, \`~/.emacs-bkmrks\', is 533place. Your own personal bookmark file, `~/.emacs-bkmrks', is
526maintained automatically by Emacs; you shouldn't need to load it 534maintained automatically by Emacs; you shouldn't need to load it
527explicitly." 535explicitly."
528 (interactive 536 (interactive
@@ -558,12 +566,13 @@ explicitly."
558 566
559;;;; bookmark menu bar stuff ;;;; 567;;;; bookmark menu bar stuff ;;;;
560 568
561(defvar bookmark-menu-bar-length 70 "*Maximum length of a bookmark name 569(defvar bookmark-menu-bar-length 70
562displayed on a popup menu.") 570 "*Maximum length of a bookmark name displayed on a popup menu.")
563 571
564(defvar bookmark-enable-menu-bar t 572(defvar bookmark-enable-menu-bar t
565 "*Non-nil means put a bookmark menu on the menu bar \(assuming that 573 "*Non-nil means put a bookmark menu on the menu bar.
566you are running Emacs under a windowing system, such as X\).") 574\(Assuming that you are running Emacs under a windowing system, such
575as X.\)")
567 576
568(defun bookmark-make-menu-bar-alist () 577(defun bookmark-make-menu-bar-alist ()
569 (if (not bookmark-alist) 578 (if (not bookmark-alist)
@@ -594,7 +603,11 @@ you are running Emacs under a windowing system, such as X\).")
594 (apply func-sym (list str))))) 603 (apply func-sym (list str)))))
595 604
596(defun bookmark-menu-bar-insert (event) 605(defun bookmark-menu-bar-insert (event)
597 ;; see bookmark-insert 606 "Insert the text of the file pointed to by bookmark BOOKMARK.
607You may have a problem using this function if the value of variable
608`bookmark-alist' is nil. If that happens, you need to load in some
609bookmarks. See help on function `bookmark-load' for more about
610this."
598 (interactive "e") 611 (interactive "e")
599 (bookmark-make-menu-bar-with-function 'bookmark-insert 612 (bookmark-make-menu-bar-with-function 'bookmark-insert
600 "Bookmark Insert Menu" 613 "Bookmark Insert Menu"
@@ -602,7 +615,11 @@ you are running Emacs under a windowing system, such as X\).")
602 event)) 615 event))
603 616
604(defun bookmark-menu-bar-jump (event) 617(defun bookmark-menu-bar-jump (event)
605 ;; see bookmark-jump 618 "Jump to bookmark BOOKMARK (a point in some file).
619You may have a problem using this function if the value of variable
620`bookmark-alist' is nil. If that happens, you need to load in some
621bookmarks. See help on function `bookmark-load' for more about
622this."
606 (interactive "e") 623 (interactive "e")
607 (bookmark-make-menu-bar-with-function 'bookmark-jump 624 (bookmark-make-menu-bar-with-function 'bookmark-jump
608 "Bookmark Jump Menu" 625 "Bookmark Jump Menu"
@@ -610,7 +627,8 @@ you are running Emacs under a windowing system, such as X\).")
610 event)) 627 event))
611 628
612(defun bookmark-menu-bar-locate (event) 629(defun bookmark-menu-bar-locate (event)
613 ;; see bookmark-locate 630 "Insert the name of the file associated with BOOKMARK.
631\(This is not the same as the contents of that file\)."
614 (interactive "e") 632 (interactive "e")
615 (bookmark-make-menu-bar-with-function 'bookmark-locate 633 (bookmark-make-menu-bar-with-function 'bookmark-locate
616 "Bookmark Locate Menu" 634 "Bookmark Locate Menu"
@@ -618,7 +636,16 @@ you are running Emacs under a windowing system, such as X\).")
618 event)) 636 event))
619 637
620(defun bookmark-menu-bar-rename (event) 638(defun bookmark-menu-bar-rename (event)
621 ;; see bookmark-rename 639 "Change the name of BOOKMARK to NEWNAME.
640If called from keyboard, prompts for OLD and NEWNAME.
641If called from menubar, prompts for NEWNAME.
642If called from Lisp, prompts for NEWNAME if only BOOKMARK was passed
643as an argument. If called with two strings, then no prompting is
644done. You must pass at least BOOKMARK when calling from Lisp.
645
646While you are entering the new name, consecutive C-w's insert
647consectutive words from the text of the buffer into the new bookmark
648name, and C-v inserts the name of the file."
622 (interactive "e") 649 (interactive "e")
623 (bookmark-make-menu-bar-with-function 'bookmark-rename 650 (bookmark-make-menu-bar-with-function 'bookmark-rename
624 "Bookmark Rename Menu" 651 "Bookmark Rename Menu"
@@ -626,7 +653,11 @@ you are running Emacs under a windowing system, such as X\).")
626 event)) 653 event))
627 654
628(defun bookmark-menu-bar-delete (event) 655(defun bookmark-menu-bar-delete (event)
629 ;; see bookmark-delete 656 "Delete the bookmark named NAME from the bookmark list.
657Removes only the first instance of a bookmark with that name. If
658there are one or more other bookmarks with the same name, they will
659not be deleted. Defaults to the \"current\" bookmark \(that is, the
660one most recently used in this file, if any\)."
630 (interactive "e") 661 (interactive "e")
631 (bookmark-make-menu-bar-with-function 'bookmark-delete 662 (bookmark-make-menu-bar-with-function 'bookmark-delete
632 "Bookmark Delete Menu" 663 "Bookmark Delete Menu"