From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: question about org-region-active-p Date: Wed, 17 Dec 2008 09:13:55 +0100 Message-ID: References: <494709A4.1000703@sift.info> <9F73C60D-A8B2-4D0B-AFE0-DE210312A021@uva.nl> <4947CC95.60900@sift.info> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LCrXh-0000nc-CO for emacs-orgmode@gnu.org; Wed, 17 Dec 2008 03:14:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LCrXe-0000nQ-2o for emacs-orgmode@gnu.org; Wed, 17 Dec 2008 03:14:04 -0500 Received: from [199.232.76.173] (port=49987 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LCrXd-0000nN-PD for emacs-orgmode@gnu.org; Wed, 17 Dec 2008 03:14:01 -0500 Received: from mx20.gnu.org ([199.232.41.8]:45068) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LCrXd-0003Ps-C2 for emacs-orgmode@gnu.org; Wed, 17 Dec 2008 03:14:01 -0500 Received: from nf-out-0910.google.com ([64.233.182.190]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCrXc-0007tp-H0 for emacs-orgmode@gnu.org; Wed, 17 Dec 2008 03:14:00 -0500 Received: by nf-out-0910.google.com with SMTP id c7so595608nfi.26 for ; Wed, 17 Dec 2008 00:13:58 -0800 (PST) In-Reply-To: <4947CC95.60900@sift.info> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Robert Goldman Cc: emacs-orgmode@gnu.org Hi Robert, no, I do not think this would make sense, to step out with an error, because all the commands that need a region will also work without one. This is how regions work in Emacs. If you find places in the documentation where this could be made clearer, let me know. Thanks. - Carsten On Dec 16, 2008, at 4:43 PM, Robert Goldman wrote: > Carsten Dominik wrote: >> Hi Robert, >> >> Samuel has it right, let me add this: >> >> In Emacs, you do never remove the mark from the buffer, it is always >> there, wherever you or some command last left it. The only way to >> tell >> if the user intends to apply a command to a region is therefore the >> state of a flag that says if the mark is "active". Setting the mark >> activates the mark, most commands besides cursor motion and search >> deactivate it. >> The state flag does only exist if transient-mark-mode is active. > > Thank you both for the clarification. Here's a question: would it be > worth adding a message to warn a user when org-region-active-p is > called > and transient-mark-mode is off? > > So should we have something like > > (and (or transient-mark-mode > (error "Transient mark mode must be active for this command to > work.") > mark-active) > > Error is likely not the right thing here, but on the other hand it > seems > to me that the user should somehow know that the current command will > not work as expected, because an expectation of the org-mode code has > been violated. > > As I said, I discovered this because I was trying to publish a subtree > of an org file as HTML, and instead of publishing the subtree, I got > the > whole file, and the output went to an unexpected location (because my > export file setting, attached to the heading, was ignored). > > So the above is a case where the software quietly does something > radically different from what I expected (and what was documented) > because an expectation (really a code precondition) was violated. > That > seems to me to be an exception condition that should be brought to the > user's attention. > > A complicating issue is that the system should just go ahead and > publish > the whole file if there is no region selected, but there doesn't > seem to > me to be any way for the system to tell that the user intended to > publish only a region if transient-mark-mode is off. > > Maybe the user should just be told not to use org-mode without t-m-m? > Even this seems too extreme, because the user might never intend to > publish anything.... Or the user might never intend to publish > anything > except a whole file, in which case who cares if tmm is off? > > A very knotty issue.... > > Best, > r > >> >> - Carsten >> >> On Dec 16, 2008, at 2:51 AM, Robert Goldman wrote: >> >>> The definition of org-region-active-p in my copy of org-mode is as >>> follows: >>> >>> >>> (defun org-region-active-p () >>> "Is `transient-mark-mode' on and the region active? >>> Works on both Emacs and XEmacs." >>> (if org-ignore-region >>> nil >>> (if (featurep 'xemacs) >>> (and zmacs-regions (region-active-p)) >>> (if (fboundp 'use-region-p) >>> (use-region-p) >>> (and transient-mark-mode mark-active))))) >>> >>> What seems odd to me is that this command will only work on an >>> emacs 22 >>> (like my Aquamacs) if transient-mark-mode is enabled. Is that >>> correct, >>> and is that what's desired? >>> >>> [I found this because I tried to publish a subtree of an org file, >>> and I >>> found that org-region-active-p was NIL even after C-c @ >>> (outline-mark-subtree).] >>> >>> This may be an oddity of aquamacs -- it seems to prefer cua-mode and >>> turn off transient-mark-mode by default. I confess to not really >>> understanding that decision or its implications. >>> >>> thanks, >>> r >>> >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Remember: use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> >