summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Paul Wallington <jpw@pobox.com>2002-10-26 22:40:40 +0000
committerJohn Paul Wallington <jpw@pobox.com>2002-10-26 22:40:40 +0000
commit15693bc3acb9e46f217401488b96b87f7e96fdb3 (patch)
tree52d4dd6f14add773656015fde08c103a4090472c
parent4f01718584e0f704ee6129547f700af3f56efa7d (diff)
downloademacs-15693bc3acb9e46f217401488b96b87f7e96fdb3.tar.gz
emacs-15693bc3acb9e46f217401488b96b87f7e96fdb3.tar.bz2
emacs-15693bc3acb9e46f217401488b96b87f7e96fdb3.zip
* textmodes/picture.el (picture-mouse-set-point): New command.
(picture-mode-map): Bind it. (picture-motion-reverse): Doc fix.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/textmodes/picture.el17
2 files changed, 21 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 84368bbfc02..26a05c06a61 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,12 @@
* pcvs.el (cvs-checkout): Use read-directory-name.
(cvs-query-directory): Likewise.
+2002-10-26 John Paul Wallington <jpw@shootybangbang.com>
+
+ * textmodes/picture.el (picture-mouse-set-point): New command.
+ (picture-mode-map): Bind it.
+ (picture-motion-reverse): Doc fix.
+
2002-10-25 Stefan Monnier <monnier@cs.yale.edu>
* textmodes/outline.el (outline-next-heading): Make sure the match-data
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index e3a5a89f079..031341e75e0 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -1,6 +1,6 @@
;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model
-;; Copyright (C) 1985, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2002 Free Software Foundation, Inc.
;; Author: K. Shane Hartman
;; Maintainer: FSF
@@ -222,10 +222,22 @@ Do \\[command-apropos] picture-movement to see commands which control motion."
"Move point in direction opposite of current picture motion in Picture mode.
With ARG do it that many times. Useful for delineating rectangles in
conjunction with diagonal picture motion.
-Do \\[command-apropos] `picture-movement' to see commands which control motion."
+Do \\[command-apropos] picture-movement to see commands which control motion."
(interactive "p")
(picture-motion (- arg)))
+(defun picture-mouse-set-point (event)
+ "Move point to the position clicked on, making whitespace if necessary."
+ (interactive "e")
+ (let* ((pos (posn-col-row (event-start event)))
+ (x (car pos))
+ (y (cdr pos))
+ (current-row (count-lines (window-start) (line-beginning-position))))
+ (unless (equal x (current-column))
+ (picture-forward-column (- x (current-column))))
+ (unless (equal y current-row)
+ (picture-move-down (- y current-row)))))
+
;; Picture insertion and deletion.
@@ -602,6 +614,7 @@ Leaves the region surrounding the rectangle."
(picture-substitute 'previous-line 'picture-move-up)
(picture-substitute 'beginning-of-line 'picture-beginning-of-line)
(picture-substitute 'end-of-line 'picture-end-of-line)
+ (picture-substitute 'mouse-set-point 'picture-mouse-set-point)
(define-key picture-mode-map "\C-c\C-d" 'delete-char)
(define-key picture-mode-map "\e\t" 'picture-toggle-tab-state)