help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] check is mark is active


From: Christopher J. White
Subject: Re: [h-e-w] check is mark is active
Date: 10 Oct 2001 12:45:33 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "jeff" == Jeff Rancier <address@hidden> writes:

jeff> Hello,
jeff> Is there a way to use (interactive "r") and within a function, check to 
see
jeff> if the mark is active, and if its not, set it?  Currently, if it is not
jeff> active, I'm assuming the interactive statement above fails when evaluated,
jeff> and exits the function?

I think I understand what you want, but if the mark is not set, then
there is no region identified.  If you set it in the function, as you
suggest, then point and mark will be identical and the region size
will be zero.

I could extrapolate that you want to choose some region, say from
(point-min) to (point), if the mark is not set.  To accomplish
something like this, you could write your own argument evaluation code
for (interactive):

(defun test (s e)
  (interactive 
   (let ((x (if mark-active (mark) (point-min)))
         (y (point)))
     (list (min x y) (max x y))))
  (message "region: %d %d" s e))

...cj

-- 
------------------------------------------------------------------------------
 Christopher J. White                                    address@hidden
------------------------------------------------------------------------------ 




reply via email to

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