From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: suggested new command `picture-mouse-set-point' Date: 24 Oct 2002 02:31:07 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <5xn0p4znhw.fsf@kfs2.cua.dk> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035416339 24882 80.91.224.249 (23 Oct 2002 23:38:59 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 23:38:59 +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 184V5W-0006TB-00 for ; Thu, 24 Oct 2002 01:38:58 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 184V7Q-0004EO-00 for ; Thu, 24 Oct 2002 01:40:56 +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 184V3o-0008Th-00; Wed, 23 Oct 2002 19:37:12 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 184V2j-0008Ex-00 for emacs-devel@gnu.org; Wed, 23 Oct 2002 19:36:05 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 184V2g-0008EK-00 for emacs-devel@gnu.org; Wed, 23 Oct 2002 19:36:04 -0400 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10) id 184Uxm-0007hD-00 for emacs-devel@gnu.org; Wed, 23 Oct 2002 19:30:58 -0400 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 436F07C012; Wed, 23 Oct 2002 23:30:57 +0000 (GMT) Original-To: jpw@shootybangbang.com (John Paul Wallington) In-Reply-To: Original-Lines: 26 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:8705 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:8705 jpw@shootybangbang.com (John Paul Wallington) writes: > 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? I don't think this is specifically related to picture mode, as it may be generally useful. 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))) -- Kim F. Storm http://www.cua.dk