From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?iso-8859-1?q?R=F6hler?= Newsgroups: gmane.emacs.devel Subject: Re: region-active-p Date: Fri, 26 Oct 2007 10:17:31 +0200 Message-ID: <200710261017.33513.andreas.roehler@online.de> References: <200710191149.59775.andreas.roehler@online.de> <87hckeigev.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1193386717 5688 80.91.229.12 (26 Oct 2007 08:18:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2007 08:18:37 +0000 (UTC) Cc: Richard Stallman , Reiner Steib , emacs-devel@gnu.org, Juri Linkov , Stefan Monnier , Stephen Turnbull , Miles Bader To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 26 10:18:37 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IlKOf-00078P-00 for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2007 10:18:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlKOW-0004hH-Cs for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2007 04:18:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IlKO5-0004QC-GN for emacs-devel@gnu.org; Fri, 26 Oct 2007 04:17:49 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IlKO4-0004PK-DR for emacs-devel@gnu.org; Fri, 26 Oct 2007 04:17:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlKO4-0004P3-1I for emacs-devel@gnu.org; Fri, 26 Oct 2007 04:17:48 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.186]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IlKNv-0005K2-JQ; Fri, 26 Oct 2007 04:17:39 -0400 Original-Received: from noname (p54BE8883.dip0.t-ipconnect.de [84.190.136.131]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis) id 0MKwpI-1IlKNQ2IiM-0005mP; Fri, 26 Oct 2007 10:17:11 +0200 User-Agent: KMail/1.9.5 In-Reply-To: <87hckeigev.fsf@uwakimon.sk.tsukuba.ac.jp> Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX1/Dz3VERprssPzM+RQ1p0/iyb3YsCth9gM+HuS hnk+r35+os7zgtdRolep2qKt6o1CzRuVBnxn3/Xkfp6dQbTpMT 9TgkEsbzCZwH3tlSx2eTA== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81754 Archived-At: Am Freitag, 26. Oktober 2007 07:38 schrieben Sie: > Richard Stallman writes: > > > When commands in XEmacs call [region-active-p], do they also te= st > > > for a nonempty region? Or do they operate on the region > > > when it is empty? > > > > Core commands defined in Lisp don't test (at least not within 3 > > lines, checked with grep -3), but they're generally wrappers for > > functions defined in C that do test (eg, the casefilling commands). > > > > I don't entirely understand the answer. Maybe I did not state the > > question clearly. When you say they "don't test", what precisely > > don't they test? > > They don't test "for a nonempty region". > > > Are you sayimg that they call `region-active-p' but do not test > > whether the region is nonempty? > > Yes. > > Specifically, the function that calls `region-active-p' does not. So my understanding ceased to exist... :) `region-active-p' reads and depends with `and' from variable `zmacs-region-extent'. (and ... zmacs-region-extent If there is no extension, just the mark set, `zmacs-region-extent' is nil and `region-active-p' returns nil therefor. I would qualify this behaviour as including a check. BTW quite other thing with `region-exist-p'. Maybe I miss the point? Cheers Andreas R=F6hler > However, in the cases I looked at, that function simply dispatches to > a more primitive function that acts on the region. The more primitive > function checks for non-empty in those cases. The typical idiom is > > (defun fill-paragraph-or-region (arg) > "Fill the current region, if it's active; otherwise, fill the paragraph. > See `fill-paragraph' and `fill-region' for more information." > (interactive "*P") > (if (region-active-p) > (call-interactively 'fill-region) > (call-interactively 'fill-paragraph))) > > `fill-region' *does* check that the region is nonempty before doing > any work.