unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* suggested new command `picture-mouse-set-point'
@ 2002-10-23 18:04 John Paul Wallington
  2002-10-24  0:31 ` Kim F. Storm
  2002-10-24 16:55 ` Richard Stallman
  0 siblings, 2 replies; 35+ messages in thread
From: John Paul Wallington @ 2002-10-23 18:04 UTC (permalink / raw)


Here is a patch providing a mouse command to set point to the position
clicked on in `picture-mode' making whitespace if necessary, as
suggested by Kai and others.  It seems okay, but isn't great.

Is it worth installing as is?  Can anyone suggest improvements?


--- /build-emacs/emacs/lisp/textmodes/picture.el.~1.40.~	Mon Jul  1 08:47:22 2002
+++ /build-emacs/emacs/lisp/textmodes/picture.el	Wed Oct 23 18:56:22 2002
@@ -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
@@ -226,6 +226,18 @@
   (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)))))
+
 \f
 ;; Picture insertion and deletion.
 
@@ -602,6 +614,7 @@
       (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)

-- 
John Paul Wallington

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2002-11-05  5:13 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-23 18:04 suggested new command `picture-mouse-set-point' John Paul Wallington
2002-10-24  0:31 ` Kim F. Storm
2002-10-24  9:18   ` John Paul Wallington
2002-10-24 21:42     ` Kim F. Storm
2002-10-24 23:18       ` John Paul Wallington
2002-10-24 23:37         ` Stefan Monnier
2002-10-25  1:42           ` John Paul Wallington
2002-10-25 14:19             ` Stefan Monnier
2002-10-25 22:50               ` Kevin Ryde
2002-10-25 22:57               ` John Paul Wallington
2002-10-25  9:16           ` Kim F. Storm
2002-10-25 14:11             ` Stefan Monnier
2002-10-26 12:34               ` Kai Großjohann
2002-10-26 20:14         ` Richard Stallman
2002-10-28 15:20           ` Juanma Barranquero
2002-10-28 18:26             ` Eli Zaretskii
2002-10-29  7:23               ` Juanma Barranquero
2002-10-29 19:38                 ` Eli Zaretskii
2002-10-29  3:01             ` Richard Stallman
2002-10-28 15:31           ` Juanma Barranquero
2002-10-29  3:02             ` Richard Stallman
2002-10-29 17:59               ` Juanma Barranquero
2002-10-30 11:55                 ` Kim F. Storm
2002-10-30 12:47                   ` Juanma Barranquero
2002-10-30 17:18                 ` Richard Stallman
2002-10-30 17:51                   ` Juanma Barranquero
2002-11-04 11:13                   ` Juanma Barranquero
2002-11-04 15:02                     ` Juanma Barranquero
2002-11-05  5:13                       ` Richard Stallman
2002-10-26 20:13       ` Richard Stallman
2002-10-25  5:35   ` Richard Stallman
2002-10-25  9:49     ` Kim F. Storm
2002-10-26 20:15       ` Richard Stallman
2002-10-24 16:55 ` Richard Stallman
2002-10-24 23:21   ` John Paul Wallington

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).