[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109508: * lisp/bookmark.el: Add `def
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109508: * lisp/bookmark.el: Add `defaults' property to the bookmark record. |
Date: |
Wed, 08 Aug 2012 11:48:57 +0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109508
fixes bug: http://debbugs.gnu.org/12107
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-08-08 11:48:57 +0300
message:
* lisp/bookmark.el: Add `defaults' property to the bookmark record.
(bookmark-current-buffer): Doc fix.
(bookmark-make-record): Add `defaults' property with default values
to the bookmark record.
(bookmark-minibuffer-read-name-map): Remove key binding "\C-u"
with `bookmark-insert-current-bookmark'.
(bookmark-set): Get `defaults' property from the bookmark record
and use it in `read-from-minibuffer'.
(bookmark-insert-current-bookmark): Remove function.
* lisp/info.el (Info-bookmark-make-record): Add `defaults' property
with values of canonical Info node name, the current Info file name
and the current Info node name.
modified:
lisp/ChangeLog
lisp/bookmark.el
lisp/info.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-08-08 08:17:13 +0000
+++ b/lisp/ChangeLog 2012-08-08 08:48:57 +0000
@@ -1,5 +1,21 @@
2012-08-08 Juri Linkov <address@hidden>
+ * bookmark.el: Add `defaults' property to the bookmark record.
+ (bookmark-current-buffer): Doc fix.
+ (bookmark-make-record): Add `defaults' property with default values
+ to the bookmark record.
+ (bookmark-minibuffer-read-name-map): Remove key binding "\C-u"
+ with `bookmark-insert-current-bookmark'.
+ (bookmark-set): Get `defaults' property from the bookmark record
+ and use it in `read-from-minibuffer'.
+ (bookmark-insert-current-bookmark): Remove function.
+
+ * info.el (Info-bookmark-make-record): Add `defaults' property
+ with values of canonical Info node name, the current Info file
+ name and the current Info node name. (Bug#12107)
+
+2012-08-08 Juri Linkov <address@hidden>
+
* files.el (basic-save-buffer): Use `buffer-name' as the default
of `read-file-name' when buffer is not visiting a file (bug#12128).
=== modified file 'lisp/bookmark.el'
--- a/lisp/bookmark.el 2012-07-10 11:51:54 +0000
+++ b/lisp/bookmark.el 2012-08-08 08:48:57 +0000
@@ -277,8 +277,8 @@
(defvar bookmark-current-buffer nil
"The buffer in which a bookmark is currently being set or renamed.
Functions that insert strings into the minibuffer use this to know
-the source buffer for that information; see `bookmark-yank-word' and
-`bookmark-insert-current-bookmark' for example.")
+the source buffer for that information; see `bookmark-yank-word'
+for example.")
(defvar bookmark-yank-point 0
@@ -473,6 +473,12 @@
(defun bookmark-make-record ()
"Return a new bookmark record (NAME . ALIST) for the current location."
(let ((record (funcall bookmark-make-record-function)))
+ ;; Set up defaults.
+ (bookmark-prop-set
+ record 'defaults
+ (delq nil (delete-dups (append (bookmark-prop-get record 'defaults)
+ (list bookmark-current-bookmark
+ (bookmark-buffer-name))))))
;; Set up default name.
(if (stringp (car record))
;; The function already provided a default name.
@@ -738,10 +744,6 @@
(let ((map (make-sparse-keymap)))
(set-keymap-parent map minibuffer-local-map)
(define-key map "\C-w" 'bookmark-yank-word)
- ;; This C-u binding might not be very useful any more now that we
- ;; provide access to the default via the standard M-n binding.
- ;; Maybe we should just remove it? --Stef-08
- (define-key map "\C-u" 'bookmark-insert-current-bookmark)
map))
;;;###autoload
@@ -772,7 +774,19 @@
(interactive (list nil current-prefix-arg))
(unwind-protect
(let* ((record (bookmark-make-record))
- (default (car record)))
+ ;; `defaults' is a transient element of the
+ ;; extensible format described above in the section
+ ;; `File format stuff'. Bookmark record functions
+ ;; can use it to specify a list of default values
+ ;; accessible via M-n while reading a bookmark name.
+ (defaults (bookmark-prop-get record 'defaults))
+ (default (if (consp defaults) (car defaults) defaults)))
+
+ (if defaults
+ ;; Don't store default values in the record.
+ (setq record (assq-delete-all 'defaults record))
+ ;; When no defaults in the record, use its first element.
+ (setq defaults (car record) default defaults))
(bookmark-maybe-load-default-file)
;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
@@ -788,7 +802,7 @@
(format "Set bookmark (%s): " default)
nil
bookmark-minibuffer-read-name-map
- nil nil default))))
+ nil nil defaults))))
(and (string-equal str "") (setq str default))
(bookmark-store str (cdr record) no-overwrite)
@@ -888,18 +902,6 @@
(bookmark-edit-annotation-mode bookmark-name-or-record))
-(defun bookmark-insert-current-bookmark ()
- "Insert into the bookmark name currently being set the value of
-`bookmark-current-bookmark' in `bookmark-current-buffer', defaulting
-to the buffer's file name if `bookmark-current-bookmark' is nil."
- (interactive)
- (let ((str
- (with-current-buffer bookmark-current-buffer
- (or bookmark-current-bookmark
- (bookmark-buffer-name)))))
- (insert str)))
-
-
(defun bookmark-buffer-name ()
"Return the name of the current buffer in a form usable as a bookmark name.
If the buffer is associated with a file or directory, use that name."
=== modified file 'lisp/info.el'
--- a/lisp/info.el 2012-08-08 08:05:58 +0000
+++ b/lisp/info.el 2012-08-08 08:48:57 +0000
@@ -5020,11 +5020,18 @@
(defun Info-bookmark-make-record ()
"This implements the `bookmark-make-record-function' type (which see)
for Info nodes."
- `(,Info-current-node
- ,@(bookmark-make-record-default 'no-file)
- (filename . ,Info-current-file)
- (info-node . ,Info-current-node)
- (handler . Info-bookmark-jump)))
+ (let* ((file (and (stringp Info-current-file)
+ (file-name-nondirectory Info-current-file)))
+ (bookmark-name (if file
+ (concat "(" file ") " Info-current-node)
+ Info-current-node))
+ (defaults (delq nil (list bookmark-name file Info-current-node))))
+ `(,bookmark-name
+ ,@(bookmark-make-record-default 'no-file)
+ (filename . ,Info-current-file)
+ (info-node . ,Info-current-node)
+ (handler . Info-bookmark-jump)
+ (defaults . ,defaults))))
;;;###autoload
(defun Info-bookmark-jump (bmk)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109508: * lisp/bookmark.el: Add `defaults' property to the bookmark record.,
Juri Linkov <=