diff options
| author | Stefan Monnier | 2008-03-09 21:01:54 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-03-09 21:01:54 +0000 |
| commit | fc22668d50f2c2d153fea1ec56cdb4f66a17370c (patch) | |
| tree | e35461b5c9b5cad86b8f2460736aa586f4142a93 | |
| parent | 84f089d3fb26708efdab41f823e65af718bb6cf8 (diff) | |
| download | emacs-fc22668d50f2c2d153fea1ec56cdb4f66a17370c.tar.gz emacs-fc22668d50f2c2d153fea1ec56cdb4f66a17370c.zip | |
Add spurious * in docstrings.
(bookmark-minibuffer-read-name-map): New var.
(bookmark-set): Use it. Also pass the default value as it should.
(bookmark-send-edited-annotation): Take no chances with text properties.
(bookmark-insert-current-bookmark): Inline bookmark-insert-buffer-name.
(bookmark-insert-buffer-name): Remove.
(bookmark-buffer-file-name): Signal an error rather than returning nil.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/bookmark.el | 63 |
2 files changed, 41 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e8fb07496a3..aa81a3d0780 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2008-03-09 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * bookmark.el: Add spurious * in docstrings. | ||
| 4 | (bookmark-minibuffer-read-name-map): New var. | ||
| 5 | (bookmark-set): Use it. Also pass the default value as it should. | ||
| 6 | (bookmark-send-edited-annotation): Take no chances with text properties. | ||
| 7 | (bookmark-insert-current-bookmark): Inline bookmark-insert-buffer-name. | ||
| 8 | (bookmark-insert-buffer-name): Remove. | ||
| 9 | (bookmark-buffer-file-name): Signal an error rather than returning nil. | ||
| 10 | |||
| 1 | 2008-03-09 Thomas H$(Q)q(Bhn <xf27@arcor.de> (tiny change) | 11 | 2008-03-09 Thomas H$(Q)q(Bhn <xf27@arcor.de> (tiny change) |
| 2 | 12 | ||
| 3 | * tutorial.el (tutorial--default-keys): Update `C-l' binding. | 13 | * tutorial.el (tutorial--default-keys): Update `C-l' binding. |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index be3156549c1..ada3f034580 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -100,13 +100,13 @@ | |||
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | (defcustom bookmark-use-annotations nil | 102 | (defcustom bookmark-use-annotations nil |
| 103 | "*If non-nil, saving a bookmark queries for an annotation in a buffer." | 103 | "If non-nil, saving a bookmark queries for an annotation in a buffer." |
| 104 | :type 'boolean | 104 | :type 'boolean |
| 105 | :group 'bookmark) | 105 | :group 'bookmark) |
| 106 | 106 | ||
| 107 | 107 | ||
| 108 | (defcustom bookmark-save-flag t | 108 | (defcustom bookmark-save-flag t |
| 109 | "*Controls when Emacs saves bookmarks to a file. | 109 | "Controls when Emacs saves bookmarks to a file. |
| 110 | --> nil means never save bookmarks, except when `bookmark-save' is | 110 | --> nil means never save bookmarks, except when `bookmark-save' is |
| 111 | explicitly called \(\\[bookmark-save]\). | 111 | explicitly called \(\\[bookmark-save]\). |
| 112 | --> t means save bookmarks when Emacs is killed. | 112 | --> t means save bookmarks when Emacs is killed. |
| @@ -139,13 +139,13 @@ To specify the file in which to save them, modify the variable | |||
| 139 | ;; In case user set `bookmark-file' in her .emacs: | 139 | ;; In case user set `bookmark-file' in her .emacs: |
| 140 | bookmark-file | 140 | bookmark-file |
| 141 | (convert-standard-filename "~/.emacs.bmk")) | 141 | (convert-standard-filename "~/.emacs.bmk")) |
| 142 | "*File in which to save bookmarks by default." | 142 | "File in which to save bookmarks by default." |
| 143 | :type 'file | 143 | :type 'file |
| 144 | :group 'bookmark) | 144 | :group 'bookmark) |
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | (defcustom bookmark-version-control 'nospecial | 147 | (defcustom bookmark-version-control 'nospecial |
| 148 | "*Whether or not to make numbered backups of the bookmark file. | 148 | "Whether or not to make numbered backups of the bookmark file. |
| 149 | It can have four values: t, nil, `never', and `nospecial'. | 149 | It can have four values: t, nil, `never', and `nospecial'. |
| 150 | The first three have the same meaning that they do for the | 150 | The first three have the same meaning that they do for the |
| 151 | variable `version-control', and the final value `nospecial' means just | 151 | variable `version-control', and the final value `nospecial' means just |
| @@ -156,13 +156,13 @@ use the value of `version-control'." | |||
| 156 | 156 | ||
| 157 | 157 | ||
| 158 | (defcustom bookmark-completion-ignore-case t | 158 | (defcustom bookmark-completion-ignore-case t |
| 159 | "*Non-nil means bookmark functions ignore case in completion." | 159 | "Non-nil means bookmark functions ignore case in completion." |
| 160 | :type 'boolean | 160 | :type 'boolean |
| 161 | :group 'bookmark) | 161 | :group 'bookmark) |
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | (defcustom bookmark-sort-flag t | 164 | (defcustom bookmark-sort-flag t |
| 165 | "*Non-nil means that bookmarks will be displayed sorted by bookmark name. | 165 | "Non-nil means that bookmarks will be displayed sorted by bookmark name. |
| 166 | Otherwise they will be displayed in LIFO order (that is, most | 166 | Otherwise they will be displayed in LIFO order (that is, most |
| 167 | recently set ones come first, oldest ones come last)." | 167 | recently set ones come first, oldest ones come last)." |
| 168 | :type 'boolean | 168 | :type 'boolean |
| @@ -170,20 +170,20 @@ recently set ones come first, oldest ones come last)." | |||
| 170 | 170 | ||
| 171 | 171 | ||
| 172 | (defcustom bookmark-automatically-show-annotations t | 172 | (defcustom bookmark-automatically-show-annotations t |
| 173 | "*Non-nil means show annotations when jumping to a bookmark." | 173 | "Non-nil means show annotations when jumping to a bookmark." |
| 174 | :type 'boolean | 174 | :type 'boolean |
| 175 | :group 'bookmark) | 175 | :group 'bookmark) |
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | (defcustom bookmark-bmenu-file-column 30 | 178 | (defcustom bookmark-bmenu-file-column 30 |
| 179 | "*Column at which to display filenames in a buffer listing bookmarks. | 179 | "Column at which to display filenames in a buffer listing bookmarks. |
| 180 | You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]." | 180 | You can toggle whether files are shown with \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-toggle-filenames]." |
| 181 | :type 'integer | 181 | :type 'integer |
| 182 | :group 'bookmark) | 182 | :group 'bookmark) |
| 183 | 183 | ||
| 184 | 184 | ||
| 185 | (defcustom bookmark-bmenu-toggle-filenames t | 185 | (defcustom bookmark-bmenu-toggle-filenames t |
| 186 | "*Non-nil means show filenames when listing bookmarks. | 186 | "Non-nil means show filenames when listing bookmarks. |
| 187 | This may result in truncated bookmark names. To disable this, put the | 187 | This may result in truncated bookmark names. To disable this, put the |
| 188 | following in your `.emacs' file: | 188 | following in your `.emacs' file: |
| 189 | 189 | ||
| @@ -193,7 +193,7 @@ following in your `.emacs' file: | |||
| 193 | 193 | ||
| 194 | 194 | ||
| 195 | (defcustom bookmark-menu-length 70 | 195 | (defcustom bookmark-menu-length 70 |
| 196 | "*Maximum length of a bookmark name displayed on a popup menu." | 196 | "Maximum length of a bookmark name displayed on a popup menu." |
| 197 | :type 'integer | 197 | :type 'integer |
| 198 | :group 'bookmark) | 198 | :group 'bookmark) |
| 199 | 199 | ||
| @@ -271,11 +271,11 @@ The format of the alist is | |||
| 271 | where each BOOKMARK is typically of the form | 271 | where each BOOKMARK is typically of the form |
| 272 | 272 | ||
| 273 | \(NAME | 273 | \(NAME |
| 274 | \(filename . FILE\) | 274 | (\(filename . FILE\) |
| 275 | \(front-context-string . FRONT-STR\) | 275 | \(front-context-string . FRONT-STR\) |
| 276 | \(rear-context-string . REAR-STR\) | 276 | \(rear-context-string . REAR-STR\) |
| 277 | \(position . POS\) | 277 | \(position . POS\) |
| 278 | \(annotation . ANNOTATION\)\) | 278 | \(annotation . ANNOTATION\)\)) |
| 279 | 279 | ||
| 280 | So the cdr of each bookmark is an alist too.") | 280 | So the cdr of each bookmark is an alist too.") |
| 281 | 281 | ||
| @@ -697,6 +697,16 @@ This expects to be called from `point-min' in a bookmark file." | |||
| 697 | 697 | ||
| 698 | ;;; Core code: | 698 | ;;; Core code: |
| 699 | 699 | ||
| 700 | (defvar bookmark-minibuffer-read-name-map | ||
| 701 | (let ((map (make-sparse-keymap))) | ||
| 702 | (set-keymap-parent map minibuffer-local-map) | ||
| 703 | (define-key map "\C-w" 'bookmark-yank-word) | ||
| 704 | ;; This C-u binding might not be very useful any more now that we | ||
| 705 | ;; provide access to the default via the standard M-n binding. | ||
| 706 | ;; Maybe we should just remove it? --Stef-08 | ||
| 707 | (define-key map "\C-u" 'bookmark-insert-current-bookmark) | ||
| 708 | map)) | ||
| 709 | |||
| 700 | ;;;###autoload | 710 | ;;;###autoload |
| 701 | (defun bookmark-set (&optional name parg) | 711 | (defun bookmark-set (&optional name parg) |
| 702 | "Set a bookmark named NAME inside a file. | 712 | "Set a bookmark named NAME inside a file. |
| @@ -738,10 +748,8 @@ the list of bookmarks.\)" | |||
| 738 | (read-from-minibuffer | 748 | (read-from-minibuffer |
| 739 | (format "Set bookmark (%s): " default) | 749 | (format "Set bookmark (%s): " default) |
| 740 | nil | 750 | nil |
| 741 | (let ((now-map (copy-keymap minibuffer-local-map))) | 751 | bookmark-minibuffer-read-name-map |
| 742 | (define-key now-map "\C-w" 'bookmark-yank-word) | 752 | nil nil default))) |
| 743 | (define-key now-map "\C-u" 'bookmark-insert-current-bookmark) | ||
| 744 | now-map)))) | ||
| 745 | (annotation nil)) | 753 | (annotation nil)) |
| 746 | (and (string-equal str "") (setq str default)) | 754 | (and (string-equal str "") (setq str default)) |
| 747 | ;; Ask for an annotation buffer for this bookmark | 755 | ;; Ask for an annotation buffer for this bookmark |
| @@ -890,7 +898,8 @@ Lines beginning with `#' are ignored." | |||
| 890 | (if (looking-at "^#") | 898 | (if (looking-at "^#") |
| 891 | (bookmark-kill-line t) | 899 | (bookmark-kill-line t) |
| 892 | (forward-line 1))) | 900 | (forward-line 1))) |
| 893 | (let ((annotation (buffer-string)) | 901 | ;; Take no chances with text properties. |
| 902 | (let ((annotation (buffer-substring-no-properties (point-min) (point-max))) | ||
| 894 | (bookmark bookmark-annotation-name)) | 903 | (bookmark bookmark-annotation-name)) |
| 895 | (bookmark-set-annotation bookmark annotation) | 904 | (bookmark-set-annotation bookmark annotation) |
| 896 | (bookmark-bmenu-surreptitiously-rebuild-list) | 905 | (bookmark-bmenu-surreptitiously-rebuild-list) |
| @@ -909,20 +918,9 @@ Lines beginning with `#' are ignored." | |||
| 909 | Default to file name if it's nil." | 918 | Default to file name if it's nil." |
| 910 | (interactive) | 919 | (interactive) |
| 911 | (let ((str | 920 | (let ((str |
| 912 | (save-excursion | 921 | (with-current-buffer bookmark-current-buffer |
| 913 | (set-buffer bookmark-current-buffer) | 922 | (or bookmark-current-bookmark |
| 914 | bookmark-current-bookmark))) | 923 | (bookmark-buffer-name))))) |
| 915 | (if str (insert str) (bookmark-insert-buffer-name)))) | ||
| 916 | |||
| 917 | |||
| 918 | (defun bookmark-insert-buffer-name () | ||
| 919 | "Insert the current file name into the bookmark name being set. | ||
| 920 | The directory part of the file name is not used." | ||
| 921 | (interactive) | ||
| 922 | (let ((str | ||
| 923 | (save-excursion | ||
| 924 | (set-buffer bookmark-current-buffer) | ||
| 925 | (bookmark-buffer-name)))) | ||
| 926 | (insert str))) | 924 | (insert str))) |
| 927 | 925 | ||
| 928 | 926 | ||
| @@ -984,7 +982,8 @@ For example, if this is a Info buffer, return the Info file's name." | |||
| 984 | ((and (boundp 'dired-directory) dired-directory) | 982 | ((and (boundp 'dired-directory) dired-directory) |
| 985 | (if (stringp dired-directory) | 983 | (if (stringp dired-directory) |
| 986 | dired-directory | 984 | dired-directory |
| 987 | (car dired-directory))))) | 985 | (car dired-directory))) |
| 986 | (t (error "Buffer not visiting a file or directory")))) | ||
| 988 | 987 | ||
| 989 | 988 | ||
| 990 | (defun bookmark-maybe-load-default-file () | 989 | (defun bookmark-maybe-load-default-file () |