[comp.archives] [list.epoch] Using mouse during a search

hws@ICSI.Berkeley.EDU (Heinz Schmidt) (05/09/91)

Archive-name: emacs/epoch/sky-mouse/1991-04-26
Archive-directory: icsi-ftp.berkeley.edu:/pub/ai/sky-mouse/ [128.32.201.55]
Original-posting-by: hws@ICSI.Berkeley.EDU (Heinz Schmidt)
Original-subject: Using mouse during a search
Reposted-by: emv@msen.com (Edward Vielmetti, MSEN)

    >   Date: 26 Apr 91 15:43:21 GMT
    >   From: olympus!chase@cis.ohio-state.edu  (Chris Chase)
    >   Sender: epoch-request@cs.uiuc.edu
    >
    >   Quite often during a search I use the mouse to place the point 
    >   or select a region. I often forget to exit the search and using 
    >   the mouse does not terminate the seach unlike using control keys
    >   which always terminate a search. Thus, if I place the point then
    >   type something the search command just continues. This continually 
    >   messes me up.
    >
    >   How can I make the mouse button commands terminate a search? So if 
    >   I place the point or select a region during a search the corresponding
    >   search terminates.
    >
    >   Thanks in advance,
    >   Chris Chase
    >   -- 
    >   EE Department
    >   Princeton University
    >   chase@ee.princeton.edu

Hi. 

Look for our mouse package, available via anonymous ftp. The recursive
edit problem you mention is solved by placing a 
mouse-exit-minibuffer command on C-Left.
We did not want to have every mouse-set-point exit the minibuffer
because it is often useful to yank some text from a buffer into the
minibuffer or vice versa.

Also the redisplay problem that was a subject of many recent mails is
solved there by having mouse-set-point do an explicit redisplay call.
So the cursor follows mouse pointing even if you have typed into
another screen (unsynchronized kbd and mouse input seems to be one
source of this problem, because the redisplay logic seems to go like:
'typein? oh we don't have to redisplay now, lets do the command
first.').

For more info on the package cf. the blurb below or the README file
on our ftp host.


--------------------------------------------------------------------------
Heinz W. Schmidt                                     hws@icsi.berkeley.edu
International Computer Science Institute, Berkeley   (415) 642-4274   x175


---------------------------------

FTP: icsi-ftp.berkeley.edu [Currently: 128.32.201.55]
 
VERSION
-------

The latest version on icsi-ftp (pub/ai/sky-mouse) is 

-rw-r--r--  1 hws         79811 Feb  4 14:45 sky-mouse-1-1.tar.Z

Replacement history:

-rw-r--r--  1 hws         59665 Dec 17 14:14 sky-mouse-1-0.tar.Z
-rw-r--r--  1 hws         56482 Dec 11 16:43 sky-mouse.tar.Z


FUNCTION & CONCEPTS
-------------------

The package started off as a substitute for a few Zmacs Mouse
functions for people that found the transition from Lisp machines to
Unix harsh with respect to source-level programming support.

In the meantime it has taken kind of a direction of its own.  The
typical mouse save/kill/yank operations are still there and based on
regions and the kill-ring. That is, what the mouse selects is the
Emacs region. Beyond this the package's syntax knowledge was
considerably improved. Beside its use of the syntax table by means of
an Dan Pierson's thing.el plus some enhancements by a set of
'language-tools', the package understands 'syntactic things' defined
by 'matching delimiters' like

 'if' 'end'
 'while' 'end'
 ...

In this way it carries over the selection capabilities known from Lisp
and C mode to languages like Eiffel/Sather that are moderate or even
poor in their use of parentheses. Yet, parsing is essentially
restricted to 'paren counting' like in the other modes.

In particular the command mouse-yank-thing-to-point allows to compose
code at the cursor point without moving the mouse back and forth
between source and destination.  While the mouse is 'searching for
good patterns', composition can be checked visually very fast while
the hand can rest on the mouse for a sequence of command invocations
and typically requires only small movements in the source
window/screen. For yanking across Epoch screens, the mouse can
be used to fix the focus (mouse-toggle-focus), iteratively yank
some pieces of code to the focus, and finally release the focus 
(mouse-toggle-focus) or simply set it to another screen.

Similarly a single mouse button can be used for a combination of
indentation and filling. The object 'can decide' which formatting
command is meaningful (comments fills, procedures indent etc.)
Operations like this decrease the number of times the hand has to move
back and forth between kbd and mouse, since a larger sequence of updating
operations can be performed fast with a series of clicks and drags
before the next typing becomes necessary.

The modifiers/button combination choses the command to be applied.
(C-M for instance, typically relates to a syntactic construct).

The mouse position chooses the object the command is applied to. Thus
selection and view/update are logically separated. Multi click hints
are supported with a multi-click-distance in microseconds.

The first dimension of a selection is its method: 'click', 'drag',
'extend', 'thing' and a few combinations thereof.  For instance some
formatting commands apply to the marked region with drag and to the
thing under the mouse with click. 

Thing clicks have a second dimension defined by the handle of objects
to which we click. The current 'thing selection' works uniformly
in all programming language modes that we use:

   You point to                       You mean

  end of line                        line
  comment-start                      comment up to the end of line
  word char                          word
  symbol char                        symbol
  punctuation char                   to end of next symbol
  open paren char                    group
  close paren char                   group
  whitespace                         whitespace
  keyword first char                 corresponding language construct

The methods can be easily customized by the syntax-table and the value
of matching-identifiers-alist.

Under Epoch, multi-click processing is supported. Actually the
underlying model is Multi-click hints. These allow mouse commands to
`extend their meaning' depending on the number of clicks that invoked
them.

For instance, the command mark-thing takes advantage of multi-click hints as
follows

	Click to	Multi-click-hint	Selection

        word                 nil                   word
        symbol               nil                  symbol

	word/symbol           2                   symbol
	word/symbol	      3                   line
	word/symbol           4                   sentence
        word/symbol           5                   paragraph

	paren                nil                  group
	paren                n=2,3,..          outward n levels


The current implementation is limited because timeouts and event times
are not visible to Emacs Lisp. This can lead to confusion when the
machine is busy or when commands have side-effects. [As soon as Epoch
allows we will change the logic. It is to collect multi-click
sequences while incrementally and visibly extending regions. Then the
command is run and ideally perhaps it is not even to interpret the
multi-click hint.]


TO RUN THE PACKAGE YOU NEED
===========================

Emacs 18.55-18.57 with x-mouse support.
or 
Epoch 3.2 upwards. 

We run it under olwm and twm. Watch out for the 'window' button event
definitions in your .twmrc! Suggestions for customizing X resources
and setting up twm mouse buttons are part of the documentation.

The package supports buffer local mouse command tables. For instance
with Epoch's contrib hyper-info or with our scroll-mode, different
mouse cursors and button are activated by just moving the mouse into
the corresponding window.  For Epoch this may be taken for granted. For
x-mouse we wrote our own mouse handling extension to this effect.

The basic functions for epoch + x-mouse are implemented in two
separate files that realize the same low-level abstraction of
region-oriented mouse commands.  The main body of commands builds on
the common abstraction and is shared in the two versions. The package
figures what to load at runtime. 

The Epoch + x-mouse versions are functionally equivalent. The only
disadvantage under x-mouse is missing visual feedback by underlining
(video-reverting) the region. Here the cursor just jumps back and
forth once to let you know the selection.


DOCUMENTATION
-------------

C-h z switches into a dialog similar to a combination of C-h c
(brief describe) and C-h d (document) known  for kbd commands:
You press the mouse buttons and see the online documentation until
you finally end the dialog with RET.

C-h Z brings up a verbose Mouse Tutorial (intended to be) written in
the style of the tutorial that you get with C-h T.

The mouse tutorial includes a section on mouse programming and mouse
modes.


WHAT'S ON THE MOUSE BY DEFAULT
==============================

The global mouse map includes the following functions by default.


Mod	Left 		Middle		Right               Options
	
--	Select		Extend		Paste	  	    wmgr = olwm 
--	Select		Paste		Extend		    wmgr /= olwm

S	Mark Thing	Save/Kill/Yank	-- (reserved)
C       Exit minibuffer Kill to point   Toggle Scroll Mode
M       Toggle Focus    Yank to point   Warp to point

M-S     Exec kbd macro  Exec point Fn   Exec region Fn      
C-S     Buffer menu     Help menu       -- (reserved)       only x-mouse
C-M     Mark Thing      Yank to point   Format (fill or indent)

C-M-S   Help Mouse      Help Mouse      Help Mouse



A minor scroll mode shows an example of how to define buffer local 
mice:

      |           Left              Middle             Right
----------------------------------------------------------------------
      |
  -   |        Line to top        Drag Scroll     Line to bottom
      |
  S   |          Page up          Page percent       Page down
      |
  M   |          All up              Help            All down
      |          
 M-S  |           Help               Help              Help
      |
  C   |       End scrolling     End scrolling     End scrolling
      |


RELATED PACKAGES
================

The ftp site contains a number of related Elisp files. In particular

language-tools.el     a number of generic commands for 
                      programming environments

scr-title.el          functions on screen title bars, such as
                      replacing the common tens of *scratch* titles
                      by other meaningful title bars.

a number of other files we grabbed from the Epoch mailing list.

-- comp.archives file verification
icsi-ftp.berkeley.edu
total 191
-rw-r--r--  1 hws          5073 Apr  1 17:11 #README-#
-rw-r--r--  1 hws          2447 Feb  5 22:15 scr-title.el.Z
-rw-r--r--  1 hws          2966 Feb  5 20:30 SAMPLE-DOT.epoch.Z
-rw-r--r--  1 hws          2881 Feb  5 20:06 BLURB
-rw-r--r--  1 hws          4999 Feb  5 17:15 README-
-rw-r--r--  1 hws         79997 Feb  4 23:57 sky-mouse-1-1.tar.Z
-rw-r--r--  1 hws         11538 Feb  4 01:30 mini-cl.el.Z
-rw-r--r--  1 hws         10754 Feb  4 01:09 language-tools.el.Z
-rw-r--r--  1 hws          2384 Feb  4 01:06 epoch-util.el.Z
-rw-r--r--  1 hws          1767 Feb  4 01:06 thing.el.Z
-rw-r--r--  1 hws          1426 Jan 30 23:20 hyper-man.patch.Z
-rw-r--r--  1 hws          1829 Jan 16 19:16 common-styles.el.Z
-rw-r--r--  1 hws         59665 Dec 17 22:14 sky-mouse-1-0.tar.Z
-rw-r--r--  1 hws          1816 Dec  1 23:17 bitmaps.el.Z
found sky-mouse ok
icsi-ftp.berkeley.edu:/pub/ai/sky-mouse/