changeset 23957:71fe29ccef4c

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.
author Richard M. Stallman <rms@gnu.org>
date Wed, 30 Dec 1998 00:44:59 +0000
parents 45f4accedecb
children 7094b74ce0a6
files lisp/textmodes/page-ext.el
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/page-ext.el	Tue Dec 29 22:54:57 1998 +0000
+++ b/lisp/textmodes/page-ext.el	Wed Dec 30 00:44:59 1998 +0000
@@ -480,7 +480,8 @@
   (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 @@
       (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 @@
       (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