diff options
| author | Richard M. Stallman | 1993-08-14 11:04:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-14 11:04:06 +0000 |
| commit | 8027e2ad909683ea7c5de04186ee8a423fd84228 (patch) | |
| tree | 70c0013316ec5fb89b3707e7643f199756e9ea04 | |
| parent | 6dba18584c174f450cb16e6c9ff3843d99fbc8d9 (diff) | |
| download | emacs-8027e2ad909683ea7c5de04186ee8a423fd84228.tar.gz emacs-8027e2ad909683ea7c5de04186ee8a423fd84228.zip | |
New version from Fogel.
| -rw-r--r-- | lisp/bookmark.el | 79 |
1 files changed, 33 insertions, 46 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index e68835480d6..5d8f252a4fc 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | ;; Copyright (C) 1993 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1993 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Karl Fogel <kfogel@cs.oberlin.edu> | 5 | ;; Author: Karl Fogel <kfogel@cs.oberlin.edu> |
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: Karl Fogel <kfogel@cs.oberlin.edu> |
| 7 | ;; Created: July, 1993 | 7 | ;; Created: July, 1993 |
| 8 | ;; Version: 1.7.3 (interim) | 8 | ;; Version: 1.7.3 (interim) |
| 9 | ;; Keywords: bookmarks, placeholders | 9 | ;; Keywords: bookmarks, placeholders |
| @@ -118,14 +118,17 @@ functions have a binding in this keymap.") | |||
| 118 | 118 | ||
| 119 | ;; more stuff added by db. | 119 | ;; more stuff added by db. |
| 120 | (defvar bookmark-current-bookmark nil | 120 | (defvar bookmark-current-bookmark nil |
| 121 | "Store the bookmark most recently set, jumped to, or renamed. | 121 | "This variable stores the bookmark most recently set, jumped to, or |
| 122 | Buffer local, used to make moving a bookmark forward through a | 122 | renamed. It is buffer local, used to make moving a bookmark forward |
| 123 | file easier.") | 123 | through a file easier.") |
| 124 | 124 | ||
| 125 | (make-variable-buffer-local 'bookmark-current-bookmark) | 125 | (make-variable-buffer-local 'bookmark-current-bookmark) |
| 126 | 126 | ||
| 127 | (defvar bookmark-save-flag t | 127 | (defvar bookmark-save-flag t |
| 128 | "*Nil means never save bookmarks, except when \`bookmark-save\' is | 128 | "*This variable determines when Emacs\' internal bookmark list will |
| 129 | be saved to a file: | ||
| 130 | |||
| 131 | Nil means never save bookmarks, except when \`bookmark-save\' is | ||
| 129 | explicitly called \(\\[bookmark-save]\). | 132 | explicitly called \(\\[bookmark-save]\). |
| 130 | 133 | ||
| 131 | t means save bookmarks when Emacs is killed. | 134 | t means save bookmarks when Emacs is killed. |
| @@ -151,15 +154,11 @@ saved.") | |||
| 151 | "*File in which to save bookmarks by default.") | 154 | "*File in which to save bookmarks by default.") |
| 152 | 155 | ||
| 153 | (defvar bookmark-completion-ignore-case t | 156 | (defvar bookmark-completion-ignore-case t |
| 154 | "*Non-nil means that the various bookmark functions that | 157 | "*Non-nil means those bookmark functions which use completion will |
| 155 | do completion will be case-insensitive in completion.") | 158 | be case-insensitive in completion.") |
| 156 | 159 | ||
| 157 | (defvar bookmark-search-size 500 "Number of chars resolution used | 160 | (defvar bookmark-search-size 500 "Length, in characters, of the |
| 158 | in creating tag strings to record a bookmark. Bookmark functions will | 161 | context strings recorded on either side of a bookmark.") |
| 159 | search for these strings in deciding where to jump to, to deal with | ||
| 160 | changing values of point. I can\'t think of any reason you would want | ||
| 161 | to modify this, and doing so might have side effects, so on your own | ||
| 162 | head be it...") | ||
| 163 | 162 | ||
| 164 | (defvar bookmark-alist () | 163 | (defvar bookmark-alist () |
| 165 | "Association list of bookmarks. | 164 | "Association list of bookmarks. |
| @@ -304,12 +303,13 @@ the list of bookmarks.\)" | |||
| 304 | (if (and (null bookmark-alist) | 303 | (if (and (null bookmark-alist) |
| 305 | (file-readable-p (expand-file-name bookmark-file))) | 304 | (file-readable-p (expand-file-name bookmark-file))) |
| 306 | (bookmark-load bookmark-file))) | 305 | (bookmark-load bookmark-file))) |
| 307 | 306 | ||
| 308 | (defun bookmark-jump (str) | 307 | (defun bookmark-jump (str) |
| 309 | "Go to the location saved in the bookmark BOOKMARK. You may have a | 308 | "Jump to bookmark BOOKMARK (a point in some file). You may have a |
| 310 | problem using this function if the value of variable \`bookmark-alist\' | 309 | problem using this function if the value of variable |
| 311 | is nil. If that happens, you need to load in some bookmarks. See | 310 | \`bookmark-alist\' is nil. If that happens, you need to load in some |
| 312 | help on function \`bookmark-load\' for more about this." | 311 | bookmarks. See help on function \`bookmark-load\' for more about |
| 312 | this." | ||
| 313 | (interactive (let ((completion-ignore-case | 313 | (interactive (let ((completion-ignore-case |
| 314 | bookmark-completion-ignore-case)) | 314 | bookmark-completion-ignore-case)) |
| 315 | (list (completing-read | 315 | (list (completing-read |
| @@ -395,8 +395,9 @@ the name of the file." | |||
| 395 | (defun bookmark-insert (str) | 395 | (defun bookmark-insert (str) |
| 396 | "Insert the text of the file pointed to by bookmark BOOKMARK. You | 396 | "Insert the text of the file pointed to by bookmark BOOKMARK. You |
| 397 | may have a problem using this function if the value of variable | 397 | 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 | 398 | \`bookmark-alist\' is nil. If that happens, you need to load in some |
| 399 | bookmarks. See help on function \`bookmark-load\' for more about this." | 399 | bookmarks. See help on function \`bookmark-load\' for more about |
| 400 | this." | ||
| 400 | (interactive (let ((completion-ignore-case | 401 | (interactive (let ((completion-ignore-case |
| 401 | bookmark-completion-ignore-case)) | 402 | bookmark-completion-ignore-case)) |
| 402 | (list (completing-read | 403 | (list (completing-read |
| @@ -426,11 +427,10 @@ bookmarks. See help on function \`bookmark-load\' for more about this." | |||
| 426 | 427 | ||
| 427 | (defun bookmark-delete (str) | 428 | (defun bookmark-delete (str) |
| 428 | "Delete the bookmark named NAME from the bookmark list. Removes | 429 | "Delete the bookmark named NAME from the bookmark list. Removes |
| 429 | only the first instance of a bookmark with that name. If there is | 430 | only the first instance of a bookmark with that name. If there are |
| 430 | another bookmark with the same name, it will take effect as soon as | 431 | one or more other bookmarks with the same name, they will not be |
| 431 | the old one is removed from the bookmark list. Defaults to the | 432 | deleted. Defaults to the \"current\" bookmark \(that is, the one most |
| 432 | \"current\" bookmark \(that is, the one most recently used in this | 433 | recently used in this file, if any\)." |
| 433 | file, if any\)." | ||
| 434 | (interactive (let ((completion-ignore-case | 434 | (interactive (let ((completion-ignore-case |
| 435 | bookmark-completion-ignore-case)) | 435 | bookmark-completion-ignore-case)) |
| 436 | (list | 436 | (list |
| @@ -471,7 +471,7 @@ file, if any\)." | |||
| 471 | (bookmark-save t)) | 471 | (bookmark-save t)) |
| 472 | 472 | ||
| 473 | (defun bookmark-save (&optional parg file) | 473 | (defun bookmark-save (&optional parg file) |
| 474 | "Saves currently defined bookmarks in the file defined by the | 474 | "Save currently defined bookmarks in the file defined by the |
| 475 | variable \`bookmark-file\'. With a prefix arg, save it in file FILE. | 475 | variable \`bookmark-file\'. With a prefix arg, save it in file FILE. |
| 476 | 476 | ||
| 477 | If you are calling this from Lisp, the two arguments are PREFIX-ARG | 477 | If you are calling this from Lisp, the two arguments are PREFIX-ARG |
| @@ -523,7 +523,7 @@ If you load a file that doesn't contain a proper bookmark alist, you | |||
| 523 | will corrupt Emacs\' bookmark list. Generally, you should only load | 523 | will corrupt Emacs\' bookmark list. Generally, you should only load |
| 524 | in files that were created with the bookmark functions in the first | 524 | in files that were created with the bookmark functions in the first |
| 525 | place. Your own personal bookmark file, \`~/.emacs-bkmrks\', is | 525 | place. Your own personal bookmark file, \`~/.emacs-bkmrks\', is |
| 526 | maintained automatically by Emacs; you should never need to load it | 526 | maintained automatically by Emacs; you shouldn't need to load it |
| 527 | explicitly." | 527 | explicitly." |
| 528 | (interactive | 528 | (interactive |
| 529 | (list (read-file-name | 529 | (list (read-file-name |
| @@ -559,7 +559,7 @@ explicitly." | |||
| 559 | ;;;; bookmark menu bar stuff ;;;; | 559 | ;;;; bookmark menu bar stuff ;;;; |
| 560 | 560 | ||
| 561 | (defvar bookmark-menu-bar-length 70 "*Maximum length of a bookmark name | 561 | (defvar bookmark-menu-bar-length 70 "*Maximum length of a bookmark name |
| 562 | displayed on a menu.") | 562 | displayed on a popup menu.") |
| 563 | 563 | ||
| 564 | (defvar bookmark-enable-menu-bar t | 564 | (defvar bookmark-enable-menu-bar t |
| 565 | "*Non-nil means put a bookmark menu on the menu bar \(assuming that | 565 | "*Non-nil means put a bookmark menu on the menu bar \(assuming that |
| @@ -594,10 +594,7 @@ you are running Emacs under a windowing system, such as X\).") | |||
| 594 | (apply func-sym (list str))))) | 594 | (apply func-sym (list str))))) |
| 595 | 595 | ||
| 596 | (defun bookmark-menu-bar-insert (event) | 596 | (defun bookmark-menu-bar-insert (event) |
| 597 | "Insert the text of the file pointed to by bookmark BOOKMARK. You | 597 | ;; see bookmark-insert |
| 598 | may have a problem using this function if the value of variable | ||
| 599 | \`bookmark-alist\' is nil. If that happens, you need to load in some | ||
| 600 | bookmarks. See help on function \`bookmark-load\' for more about this." | ||
| 601 | (interactive "e") | 598 | (interactive "e") |
| 602 | (bookmark-make-menu-bar-with-function 'bookmark-insert | 599 | (bookmark-make-menu-bar-with-function 'bookmark-insert |
| 603 | "Bookmark Insert Menu" | 600 | "Bookmark Insert Menu" |
| @@ -605,10 +602,7 @@ bookmarks. See help on function \`bookmark-load\' for more about this." | |||
| 605 | event)) | 602 | event)) |
| 606 | 603 | ||
| 607 | (defun bookmark-menu-bar-jump (event) | 604 | (defun bookmark-menu-bar-jump (event) |
| 608 | "Go to the location saved in the bookmark BOOKMARK. You may have a | 605 | ;; see bookmark-jump |
| 609 | problem using this function if the value of variable \`bookmark-alist\' | ||
| 610 | is nil. If that happens, you need to load in some bookmarks. See | ||
| 611 | help on function \`bookmark-load\' for more about this." | ||
| 612 | (interactive "e") | 606 | (interactive "e") |
| 613 | (bookmark-make-menu-bar-with-function 'bookmark-jump | 607 | (bookmark-make-menu-bar-with-function 'bookmark-jump |
| 614 | "Bookmark Jump Menu" | 608 | "Bookmark Jump Menu" |
| @@ -616,8 +610,7 @@ help on function \`bookmark-load\' for more about this." | |||
| 616 | event)) | 610 | event)) |
| 617 | 611 | ||
| 618 | (defun bookmark-menu-bar-locate (event) | 612 | (defun bookmark-menu-bar-locate (event) |
| 619 | "Insert the name of the file associated with BOOKMARK \(as opposed | 613 | ;; see bookmark-locate |
| 620 | to the contents of that file\)." | ||
| 621 | (interactive "e") | 614 | (interactive "e") |
| 622 | (bookmark-make-menu-bar-with-function 'bookmark-locate | 615 | (bookmark-make-menu-bar-with-function 'bookmark-locate |
| 623 | "Bookmark Locate Menu" | 616 | "Bookmark Locate Menu" |
| @@ -625,10 +618,7 @@ to the contents of that file\)." | |||
| 625 | event)) | 618 | event)) |
| 626 | 619 | ||
| 627 | (defun bookmark-menu-bar-rename (event) | 620 | (defun bookmark-menu-bar-rename (event) |
| 628 | "Change the name of BOOKMARK to NEWNAME. While you are entering | 621 | ;; see bookmark-rename |
| 629 | the new name, consecutive C-w\'s will insert consectutive words from | ||
| 630 | the text of the buffer into the new bookmark name, and C-v will insert | ||
| 631 | the name of the file." | ||
| 632 | (interactive "e") | 622 | (interactive "e") |
| 633 | (bookmark-make-menu-bar-with-function 'bookmark-rename | 623 | (bookmark-make-menu-bar-with-function 'bookmark-rename |
| 634 | "Bookmark Rename Menu" | 624 | "Bookmark Rename Menu" |
| @@ -636,10 +626,7 @@ the name of the file." | |||
| 636 | event)) | 626 | event)) |
| 637 | 627 | ||
| 638 | (defun bookmark-menu-bar-delete (event) | 628 | (defun bookmark-menu-bar-delete (event) |
| 639 | "Delete the bookmark named NAME from the bookmark list. Removes | 629 | ;; see bookmark-delete |
| 640 | only the first instance of a bookmark with that name. If there is | ||
| 641 | another bookmark with the same name, it will take effect as soon as | ||
| 642 | the old one is removed from the bookmark list." | ||
| 643 | (interactive "e") | 630 | (interactive "e") |
| 644 | (bookmark-make-menu-bar-with-function 'bookmark-delete | 631 | (bookmark-make-menu-bar-with-function 'bookmark-delete |
| 645 | "Bookmark Delete Menu" | 632 | "Bookmark Delete Menu" |