aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-03-30 21:38:43 +0000
committerRichard M. Stallman1997-03-30 21:38:43 +0000
commit7e510a5e2234a10e50f2c8a0b2baa702ad452332 (patch)
tree732dfb69aeb55d7c082f19e02666216248bb69c5
parent97ae4b89479b9eec8f7b020404c6435e7a752f5b (diff)
downloademacs-7e510a5e2234a10e50f2c8a0b2baa702ad452332.tar.gz
emacs-7e510a5e2234a10e50f2c8a0b2baa702ad452332.zip
Added mouse-selection feature for bookmark list buffer.
(bookmark-bmenu-other-window-with-mouse): New function. (bookmark-bmenu-mode-map): Bind mouse-2. (bookmark-bmenu-list, bookmark-insert-location, bookmark-bmenu-hide-filenames): Put text property on bookmarks. (bookmark-bmenu-show-filenames): Remove text property from white spaces generated by `move-to-column'. (bookmark-bmenu-bookmark): Use `buffer-substring-no-properties' instead of `buffer-substring'.
-rw-r--r--lisp/bookmark.el54
1 files changed, 47 insertions, 7 deletions
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 5d4b86ca388..2905447681c 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1160,7 +1160,15 @@ Optional second arg NO-HISTORY means don't record this in the
1160minibuffer history list `bookmark-history'." 1160minibuffer history list `bookmark-history'."
1161 (interactive (bookmark-completing-read "Insert bookmark location")) 1161 (interactive (bookmark-completing-read "Insert bookmark location"))
1162 (or no-history (bookmark-maybe-historicize-string bookmark)) 1162 (or no-history (bookmark-maybe-historicize-string bookmark))
1163 (insert (bookmark-location bookmark))) 1163 (let ((start (point)))
1164 (prog1
1165 (insert (bookmark-location bookmark)) ; *Return this line*
1166 (if window-system
1167 (put-text-property start
1168 (save-excursion (re-search-backward
1169 "[^ \t]")
1170 (1+ (point)))
1171 'mouse-face 'highlight)))))
1164 1172
1165;;;###autoload 1173;;;###autoload
1166(defalias 'bookmark-locate 'bookmark-insert-location) 1174(defalias 'bookmark-locate 'bookmark-insert-location)
@@ -1444,7 +1452,9 @@ explicitly."
1444 (define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames) 1452 (define-key bookmark-bmenu-mode-map "t" 'bookmark-bmenu-toggle-filenames)
1445 (define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation) 1453 (define-key bookmark-bmenu-mode-map "a" 'bookmark-bmenu-show-annotation)
1446 (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations) 1454 (define-key bookmark-bmenu-mode-map "A" 'bookmark-bmenu-show-all-annotations)
1447 (define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation)) 1455 (define-key bookmark-bmenu-mode-map "e" 'bookmark-bmenu-edit-annotation)
1456 (define-key bookmark-bmenu-mode-map [mouse-2]
1457 'bookmark-bmenu-other-window-with-mouse))
1448 1458
1449 1459
1450 1460
@@ -1495,7 +1505,16 @@ deletion, or > if it is flagged for displaying."
1495 (not (string-equal annotation ""))) 1505 (not (string-equal annotation "")))
1496 (insert " *") 1506 (insert " *")
1497 (insert " ")) 1507 (insert " "))
1498 (insert (concat (bookmark-name-from-full-record full-record) "\n")))) 1508 (let ((start (point)))
1509 (insert (bookmark-name-from-full-record full-record))
1510 (if window-system
1511 (put-text-property start
1512 (save-excursion (re-search-backward
1513 "[^ \t]")
1514 (1+ (point)))
1515 'mouse-face 'highlight))
1516 (insert "\n")
1517 )))
1499 bookmark-alist)) 1518 bookmark-alist))
1500 (goto-char (point-min)) 1519 (goto-char (point-min))
1501 (forward-line 2) 1520 (forward-line 2)
@@ -1581,8 +1600,13 @@ Optional argument SHOW means show them unconditionally."
1581 (let ((bmrk (bookmark-bmenu-bookmark))) 1600 (let ((bmrk (bookmark-bmenu-bookmark)))
1582 (setq bookmark-bmenu-hidden-bookmarks 1601 (setq bookmark-bmenu-hidden-bookmarks
1583 (cons bmrk bookmark-bmenu-hidden-bookmarks)) 1602 (cons bmrk bookmark-bmenu-hidden-bookmarks))
1584 (move-to-column bookmark-bmenu-file-column t) 1603 (let ((start (save-excursion (end-of-line) (point))))
1585 (delete-region (point) (progn (end-of-line) (point))) 1604 (move-to-column bookmark-bmenu-file-column t)
1605 ;; Strip off `mouse-face' from the white spaces region.
1606 (if window-system
1607 (remove-text-properties start (point)
1608 '(mouse-face))))
1609 (delete-region (point) (progn (end-of-line) (point)))
1586 (insert " ") 1610 (insert " ")
1587 ;; Pass the NO-HISTORY arg: 1611 ;; Pass the NO-HISTORY arg:
1588 (bookmark-insert-location bmrk t) 1612 (bookmark-insert-location bmrk t)
@@ -1608,7 +1632,14 @@ Optional argument SHOW means show them unconditionally."
1608 (while bookmark-bmenu-hidden-bookmarks 1632 (while bookmark-bmenu-hidden-bookmarks
1609 (move-to-column bookmark-bmenu-bookmark-column t) 1633 (move-to-column bookmark-bmenu-bookmark-column t)
1610 (bookmark-kill-line) 1634 (bookmark-kill-line)
1611 (insert (car bookmark-bmenu-hidden-bookmarks)) 1635 (let ((start (point)))
1636 (insert (car bookmark-bmenu-hidden-bookmarks))
1637 (if window-system
1638 (put-text-property start
1639 (save-excursion (re-search-backward
1640 "[^ \t]")
1641 (1+ (point)))
1642 'mouse-face 'highlight)))
1612 (setq bookmark-bmenu-hidden-bookmarks 1643 (setq bookmark-bmenu-hidden-bookmarks
1613 (cdr bookmark-bmenu-hidden-bookmarks)) 1644 (cdr bookmark-bmenu-hidden-bookmarks))
1614 (forward-line 1)))))))) 1645 (forward-line 1))))))))
@@ -1648,7 +1679,7 @@ Optional argument SHOW means show them unconditionally."
1648 (beginning-of-line) 1679 (beginning-of-line)
1649 (forward-char bookmark-bmenu-bookmark-column) 1680 (forward-char bookmark-bmenu-bookmark-column)
1650 (prog1 1681 (prog1
1651 (buffer-substring (point) 1682 (buffer-substring-no-properties (point)
1652 (progn 1683 (progn
1653 (end-of-line) 1684 (end-of-line)
1654 (point))) 1685 (point)))
@@ -1826,6 +1857,15 @@ The current window remains selected."
1826 (set-buffer o-buffer)) 1857 (set-buffer o-buffer))
1827 (bookmark-show-annotation bookmark))))) 1858 (bookmark-show-annotation bookmark)))))
1828 1859
1860(defun bookmark-bmenu-other-window-with-mouse (event)
1861 "Select bookmark at the mouse pointer in other window, leaving bookmark menu visible."
1862 (interactive "e")
1863 (save-excursion
1864 (set-buffer (window-buffer (posn-window (event-end event))))
1865 (save-excursion
1866 (goto-char (posn-point (event-end event)))
1867 (bookmark-bmenu-other-window))))
1868
1829 1869
1830(defun bookmark-bmenu-show-annotation () 1870(defun bookmark-bmenu-show-annotation ()
1831 "Show the annotation for the current bookmark in another window." 1871 "Show the annotation for the current bookmark in another window."