From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: jpw@shootybangbang.com (John Paul Wallington) Newsgroups: gmane.emacs.devel Subject: Re: suggested new command `picture-mouse-set-point' Date: Thu, 24 Oct 2002 10:18:29 +0100 Sender: emacs-devel-admin@gnu.org Message-ID: References: <5xn0p4znhw.fsf@kfs2.cua.dk> NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1035450804 11317 80.91.224.249 (24 Oct 2002 09:13:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 24 Oct 2002 09:13:24 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 184e3P-0002wI-00 for ; Thu, 24 Oct 2002 11:13:23 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 184e5W-0008Li-00 for ; Thu, 24 Oct 2002 11:15:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 184e2n-0001Jr-00; Thu, 24 Oct 2002 05:12:45 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 184e1x-0000ub-00 for emacs-devel@gnu.org; Thu, 24 Oct 2002 05:11:53 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 184e1v-0000tl-00 for emacs-devel@gnu.org; Thu, 24 Oct 2002 05:11:53 -0400 Original-Received: from cmailm2.svr.pol.co.uk ([195.92.193.210]) by monty-python.gnu.org with esmtp (Exim 4.10) id 184e1v-0000th-00 for emacs-devel@gnu.org; Thu, 24 Oct 2002 05:11:51 -0400 Original-Received: from modem-54.caranthir.dialup.pol.co.uk ([62.136.145.54] helo=bundalo.shootybangbang.com) by cmailm2.svr.pol.co.uk with esmtp (Exim 3.35 #1) id 184e1s-0003j4-00; Thu, 24 Oct 2002 10:11:48 +0100 Original-Received: from jpw by bundalo.shootybangbang.com with local (Exim 3.32 #1 (Debian)) id 184e8L-0006rr-00; Thu, 24 Oct 2002 10:18:29 +0100 Original-To: storm@cua.dk In-reply-to: <5xn0p4znhw.fsf@kfs2.cua.dk> (storm@cua.dk) X-Attribution: jpw X-Face: R(_z-rF:grdKO.*u`n);p.i $Eiz=h^CO5eDYv"4:K@#\HN09*Ykx}}B{kF/KH}%f_o^Wp > suggested by Kai and others. It seems okay, but isn't great. > > > > Is it worth installing as is? Can anyone suggest improvements? > > I don't think this is specifically related to picture mode, as it may > be generally useful. Agreed. >Here is the code I've written to do this: > > (defun mouse-set-point-rigidly (event) > "Set mouse position at window position clicked on. > If window position does not correspond to a buffer position, the > buffer is modified (unless it is a read-only buffer)." > (interactive "e") > (let* ((line (cdr (posn-col-row (event-end event)))) > (moved (move-to-window-line line))) > (when (and (not buffer-read-only) (< moved line)) > (end-of-line) > (insert-char ?\n (- line moved)))) > (move-to-column (car (posn-col-row (event-end event))) (not buffer-read-only))) Cool. Any ideas how to better integrate it? For example, it would be nice if `mouse-drag-region' would call it instead of `mouse-set-point'; presently, the cursor will "bounce". Maybe there could be a `mouse-set-point-function' variable that would be funcalled where `mouse-set-point' is presently called directly, or `mouse-set-point' could call `mouse-set-point-rigidly' iff `mouse-set-point-rigidly' variable was non-nil, or something like that? -- John Paul Wallington