emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suggested new command `picture-mouse-set-point'


From: John Paul Wallington
Subject: Re: suggested new command `picture-mouse-set-point'
Date: Thu, 24 Oct 2002 10:18:29 +0100

> > 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.  

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]