[Top][All Lists]

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

Re: transient region-awareness

From: Stefan Monnier
Subject: Re: transient region-awareness
Date: Mon, 02 Oct 2000 00:22:07 -0400

> The functionality embedded in `keep-lines-read-args' --
>       * replace.el (keep-lines-read-args): New function.
> seems like a good candidate for a new interactive spec, analogous to
> `%r' (returning two arguments), but with the above functionality; `%R'
> perhaps?
> I'm not sure what you would call the lisp-function equivalents....
> something like `operating-region-beginning' and `operating-region-end'?

How about a "modifier" (kind of like the "*" thing).  Instead of
setting two arguments (like "r" does), it would simply wrap
the function within (save-restriction (narrow-to-region (point) (mark)) ...)
if the mark is active (in transient mark mode).

Along the same lines, a prefix command that would make the next
command apply only to the region.  It would even be possible to use C-x n
for that.  Something like

        (global-set-key [?\C-x ?n t] 'narrow-next-cmd)

        (defun narrow-next-cmd ()
          (add-hook 'pre-command-hook (lambda () (narrow-to-region....))
          (add-hook 'post-command-hook (lambda () (widen....))
          (setq unread-command-events (vector (aref (this-command-keys) 2))))

Sadly, it interacts poorly with M-x.

-- Stefan

reply via email to

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