From xemacs-m  Wed Apr 30 08:42:23 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id IAA06801
	for <xemacs-beta@xemacs.org>; Wed, 30 Apr 1997 08:42:21 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id PAA28227; Wed, 30 Apr 1997 15:42:18 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Fixing C-g; zmacs-region woes
X-URL: ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/
X-Save-Project-Gutenberg: <URL:http://www.promo.net/pg/nl/pgny_nov96.html>
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 30 Apr 1997 15:42:18 +0200
Message-ID: <kigrafsk4p1.fsf@jagor.srce.hr>
Lines: 64

I have a gripe about the behaviour of C-g.  I like the fact that it
deactivates the region if a region is active, otherwise signals QUIT.
I hate the fact that it does this in a stupid fashion.

For example, I mark a region, and press `M-:'.  Then I remember I
didn't really want to press M-:, but M-x.  I press C-g, but I lose the
region.  I must press C-g one more time, and then press `C-x C-x' to
reactivate the region, followed by the desired M-x.

IMHO this is wrong.  The right thing is for M-g to deactivate the
region *if* the region is active in the current window.  So, in my
minibuffer, C-g would just signal QUIT without deactivating the
region.

Implementation of `keyboard-quit' is pretty straight-forward, so I
thought I might hack it:

(defun keyboard-quit ()
  "Docstring SNIPPED."
  (interactive)
  (if (and zmacs-regions (zmacs-deactivate-region))
      ;; pseudo-zmacs compatibility: don't beep if this ^G is simply
      ;; deactivating the region.  If it is inactive, beep.
      nil
    (signal 'quit nil)))

I'd like to change this into something like this:

(defun keyboard-quit ()
  "Docstring SNIPPED."
  (interactive)
  (if (and zmacs-regions (region-active-p (selected-window))
           (zmacs-deactivate-region))
      ;; pseudo-zmacs compatibility: don't beep if this ^G is simply
      ;; deactivating the region.  If it is inactive, beep.
      nil
    (signal 'quit nil)))

The only trouble is that `region-active-p' won't accept a WINDOW
argument.

If the zmacs regions had no notion of window-dependence, I would shut
up now, or have to rewrite the whole thing.  But it's not as bad as
that.

Splitting a window can demonstrate that you can have different regions
in the different windows displaying the same buffer (even if the
redisplay can be misleading, showing one region in both windows).

The only thing that remains to be done is to add the WINDOW argument
to all the region-* functions (instead of BUFFER, as used currently),
and use it intelligently (as in the keyboard-quit example).  I'd like
to give it a try one of these days.  I'd like to hear opinions on how
much work it would be.

Besides, are there any obvious things I'm missing?  Reasons why the
proposed implementation would be bad?

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
WWW:  World-Wide-Waste.  Waste management corporation, which
      handles the billions of tons of garbage generated by just
      about everybody these days.

