summaryrefslogtreecommitdiff
path: root/lisp/textmodes/page-ext.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1998-12-30 00:44:59 +0000
committerRichard M. Stallman <rms@gnu.org>1998-12-30 00:44:59 +0000
commit39d4e337bf661afbc87175dc925cbbc88a2e5a69 (patch)
treeaa42506774e9a4c337e4a8c8e42bc22e02a05c65 /lisp/textmodes/page-ext.el
parent4f8b7e22bf7de31e356e82e6eb8353261fd09014 (diff)
downloademacs-39d4e337bf661afbc87175dc925cbbc88a2e5a69.tar.gz
Added mouse-selection feature for pages directory buffer.
(pages-directory-map): Bind mouse-2 (pages-copy-header-and-position): Put text property. (pages-directory-goto-with-mouse): New function.
Diffstat (limited to 'lisp/textmodes/page-ext.el')
-rw-r--r--lisp/textmodes/page-ext.el20
1 files changed, 17 insertions, 3 deletions
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index 2718aea094b..9c830b87b2f 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -480,7 +480,8 @@ contain matches to the regexp.\)")
(setq pages-directory-map (make-sparse-keymap))
(define-key pages-directory-map "\C-c\C-c"
'pages-directory-goto)
- (define-key pages-directory-map "\C-c\C-p\C-a" 'add-new-page))
+ (define-key pages-directory-map "\C-c\C-p\C-a" 'add-new-page)
+ (define-key pages-directory-map [mouse-2] 'pages-directory-goto-with-mouse))
(defvar original-page-delimiter "^\f"
"Default page delimiter.")
@@ -666,13 +667,18 @@ Used by `pages-directory' function."
(setq position (make-marker))
(set-marker position (point))
(let ((start (point))
- (end (save-excursion (end-of-line) (point))))
+ (end (save-excursion (end-of-line) (point)))
+ inserted-at)
;; change to directory buffer
(set-buffer standard-output)
;; record page position
(setq pages-pos-list (cons position pages-pos-list))
;; insert page header
- (insert-buffer-substring target-buffer start end))
+ (setq inserted-at (point))
+ (insert-buffer-substring target-buffer start end)
+ (put-text-property inserted-at (point)
+ 'mouse-face 'highlight)
+ (put-text-property inserted-at (point) 'rear-nonsticky 'highlight)))
(if count-lines-p
(save-excursion
@@ -720,6 +726,14 @@ to the same line in the pages buffer."
(goto-char (marker-position pos)))
(if narrowing-p (narrow-to-page))))
+(defun pages-directory-goto-with-mouse (event)
+ "Go to the corresponding line under the mouse pointer in the pages buffer."
+ (interactive "e")
+ (save-excursion
+ (set-buffer (window-buffer (posn-window (event-end event))))
+ (save-excursion
+ (goto-char (posn-point (event-end event)))
+ (pages-directory-goto))))
;;; The `pages-directory-for-addresses' function and ancillary code