[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog bookmark.el
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog bookmark.el |
Date: |
Sat, 21 Nov 2009 06:43:51 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Stefan Monnier <monnier> 09/11/21 06:43:50
Modified files:
lisp : ChangeLog bookmark.el
Log message:
(bookmark-bmenu-bookmark-column): Remove var.
(bookmark-bmenu-list): Save name on `bookmark-name-prop' text-prop.
(bookmark-bmenu-show-filenames): Use push.
(bookmark-bmenu-hide-filenames): Use local var instead of
bookmark-bmenu-bookmark-column. Use pop. Don't save window-excursion.
(bookmark-bmenu-bookmark): Use the new `bookmark-name-prop' text-prop.
(bookmark-bmenu-execute-deletions): Don't bother adding/removing the
filenames now that the bookmark names are always available.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16694&r2=1.16695
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/bookmark.el?cvsroot=emacs&r1=1.144&r2=1.145
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16694
retrieving revision 1.16695
diff -u -b -r1.16694 -r1.16695
--- ChangeLog 21 Nov 2009 04:43:10 -0000 1.16694
+++ ChangeLog 21 Nov 2009 06:43:45 -0000 1.16695
@@ -1,3 +1,15 @@
+2009-11-21 Thierry Volpiatto <address@hidden>
+ Stefan Monnier <address@hidden>
+
+ * bookmark.el (bookmark-bmenu-bookmark-column): Remove var.
+ (bookmark-bmenu-list): Save name on `bookmark-name-prop' text-prop.
+ (bookmark-bmenu-show-filenames): Use push.
+ (bookmark-bmenu-hide-filenames): Use local var instead of
+ bookmark-bmenu-bookmark-column. Use pop. Don't save window-excursion.
+ (bookmark-bmenu-bookmark): Use the new `bookmark-name-prop' text-prop.
+ (bookmark-bmenu-execute-deletions): Don't bother adding/removing the
+ filenames now that the bookmark names are always available.
+
2009-11-21 Stefan Monnier <address@hidden>
* bookmark.el (bookmark-search-prompt, bookmark-search-timer): Remove.
Index: bookmark.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/bookmark.el,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -b -r1.144 -r1.145
--- bookmark.el 21 Nov 2009 04:43:15 -0000 1.144
+++ bookmark.el 21 Nov 2009 06:43:50 -0000 1.145
@@ -1493,9 +1493,6 @@
;; Prefix is "bookmark-bmenu" for "buffer-menu":
-(defvar bookmark-bmenu-bookmark-column nil)
-
-
(defvar bookmark-bmenu-hidden-bookmarks ())
@@ -1579,29 +1576,29 @@
(add-text-properties (point-min) (point)
'(font-lock-face bookmark-menu-heading))
(dolist (full-record (bookmark-maybe-sort-alist))
+ (let ((name (bookmark-name-from-full-record full-record))
+ (annotation (bookmark-get-annotation full-record))
+ (start (point))
+ end)
;; if a bookmark has an annotation, prepend a "*"
;; in the list of bookmarks.
- (let ((annotation (bookmark-get-annotation full-record)))
(insert (if (and annotation (not (string-equal annotation "")))
- " *" " "))
- (let ((start (point)))
- (insert (bookmark-name-from-full-record full-record))
- (if (display-mouse-p)
+ " *" " ")
+ name)
+ (setq end (point))
+ (put-text-property start (+ 2 start) 'bookmark-name-prop name)
+ (when (display-mouse-p)
(add-text-properties
- start
- (save-excursion (re-search-backward
- "[^ \t]")
- (1+ (point)))
+ (+ 2 start) end
'(mouse-face highlight
follow-link t
help-echo "mouse-2: go to this bookmark in other window")))
- (insert "\n")))))
-
+ (insert "\n")))
(goto-char (point-min))
(forward-line 2)
(bookmark-bmenu-mode)
(if bookmark-bmenu-toggle-filenames
- (bookmark-bmenu-toggle-filenames t)))
+ (bookmark-bmenu-toggle-filenames t))))
;;;###autoload
(defalias 'list-bookmarks 'bookmark-bmenu-list)
@@ -1683,8 +1680,7 @@
(let ((inhibit-read-only t))
(while (< (point) (point-max))
(let ((bmrk (bookmark-bmenu-bookmark)))
- (setq bookmark-bmenu-hidden-bookmarks
- (cons bmrk bookmark-bmenu-hidden-bookmarks))
+ (push bmrk bookmark-bmenu-hidden-bookmarks)
(let ((start (save-excursion (end-of-line) (point))))
(move-to-column bookmark-bmenu-file-column t)
;; Strip off `mouse-face' from the white spaces region.
@@ -1702,39 +1698,33 @@
"In an interactive bookmark list, hide the filenames of the bookmarks.
Non-nil FORCE forces a redisplay showing the filenames. FORCE is used
mainly for debugging, and should not be necessary in normal use."
- (if (and (not force) bookmark-bmenu-toggle-filenames)
+ (when (and (not force) bookmark-bmenu-toggle-filenames)
;; nothing to hide if above is nil
(save-excursion
- (save-window-excursion
(goto-char (point-min))
(forward-line 2)
(setq bookmark-bmenu-hidden-bookmarks
(nreverse bookmark-bmenu-hidden-bookmarks))
- (save-excursion
+ (let ((inhibit-read-only t)
+ (column (save-excursion
(goto-char (point-min))
(search-forward "Bookmark")
(backward-word 1)
- (setq bookmark-bmenu-bookmark-column (current-column)))
- (save-excursion
- (let ((inhibit-read-only t))
+ (setq bookmark-bmenu-bookmark-column (current-column)))))
(while bookmark-bmenu-hidden-bookmarks
- (move-to-column bookmark-bmenu-bookmark-column t)
+ (move-to-column column t)
(bookmark-kill-line)
- (let ((start (point)))
- (insert (car bookmark-bmenu-hidden-bookmarks))
+ (let ((name (pop bookmark-bmenu-hidden-bookmarks))
+ (start (point)))
+ (insert name)
(if (display-mouse-p)
(add-text-properties
- start
- (save-excursion (re-search-backward
- "[^ \t]")
- (1+ (point)))
+ start (point)
'(mouse-face highlight
follow-link t
help-echo
"mouse-2: go to this bookmark in other window"))))
- (setq bookmark-bmenu-hidden-bookmarks
- (cdr bookmark-bmenu-hidden-bookmarks))
- (forward-line 1))))))))
+ (forward-line 1))))))
(defun bookmark-bmenu-check-position ()
@@ -1761,27 +1751,8 @@
(defun bookmark-bmenu-bookmark ()
"Return the bookmark for this line in an interactive bookmark list buffer."
- (if (bookmark-bmenu-check-position)
- (save-excursion
- (save-window-excursion
- (goto-char (point-min))
- (search-forward "Bookmark")
- (backward-word 1)
- (setq bookmark-bmenu-bookmark-column (current-column)))))
- (if bookmark-bmenu-toggle-filenames
- (bookmark-bmenu-hide-filenames))
- (save-excursion
- (save-window-excursion
- (beginning-of-line)
- (forward-char bookmark-bmenu-bookmark-column)
- (prog1
- (buffer-substring-no-properties (point)
- (progn
- (end-of-line)
- (point)))
- ;; well, this is certainly crystal-clear:
- (if bookmark-bmenu-toggle-filenames
- (bookmark-bmenu-toggle-filenames t))))))
+ (when (bookmark-bmenu-check-position)
+ (get-text-property (line-beginning-position) 'bookmark-name-prop)))
(defun bookmark-show-annotation (bookmark)
@@ -2023,26 +1994,19 @@
"Delete bookmarks marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-delete]
commands."
(interactive)
(message "Deleting bookmarks...")
- (let ((hide-em bookmark-bmenu-toggle-filenames)
- (o-point (point))
+ (let ((o-point (point))
(o-str (save-excursion
(beginning-of-line)
- (if (looking-at "^D")
- nil
+ (unless (looking-at "^D")
(buffer-substring
(point)
(progn (end-of-line) (point))))))
(o-col (current-column)))
- (if hide-em (bookmark-bmenu-hide-filenames))
- (setq bookmark-bmenu-toggle-filenames nil)
(goto-char (point-min))
(forward-line 1)
(while (re-search-forward "^D" (point-max) t)
(bookmark-delete (bookmark-bmenu-bookmark) t)) ; pass BATCH arg
(bookmark-bmenu-list)
- (setq bookmark-bmenu-toggle-filenames hide-em)
- (if bookmark-bmenu-toggle-filenames
- (bookmark-bmenu-toggle-filenames t))
(if o-str
(progn
(goto-char (point-min))