emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* question about org-region-active-p
@ 2008-12-16  1:51 Robert Goldman
  2008-12-16  2:20 ` Samuel Wales
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Robert Goldman @ 2008-12-16  1:51 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-16  1:51 question about org-region-active-p Robert Goldman
@ 2008-12-16  2:20 ` Samuel Wales
  2008-12-16  7:53 ` Carsten Dominik
  2008-12-16 15:52 ` William Henney
  2 siblings, 0 replies; 13+ messages in thread
From: Samuel Wales @ 2008-12-16  2:20 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode

My limited understanding is this:

Without the concept of activeness, you can't tell whether to operate
on a single thing or a region.
Old workarounds were to have -region commands, which polluted the key
space; or C-u,  which polluted the prefix space.  t-m-m came along and
solved it.  Region versions of many emacs commands won't be available
if you don't turn it on.

Carbon emacs, and probably the default emacs, have t-m-m on by default.

-- 
Myalgic encephalomyelitis denialists are knowingly causing further
suffering and death by opposing biomedical research on this serious
infectious disease.  Do you care about the world?
http://www.meactionuk.org.uk/What_Is_ME_What_Is_CFS.htm

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-16  1:51 question about org-region-active-p Robert Goldman
  2008-12-16  2:20 ` Samuel Wales
@ 2008-12-16  7:53 ` Carsten Dominik
  2008-12-16 15:43   ` Robert Goldman
  2008-12-16 15:52 ` William Henney
  2 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2008-12-16  7:53 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode

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.

- 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-16  7:53 ` Carsten Dominik
@ 2008-12-16 15:43   ` Robert Goldman
  2008-12-17  8:13     ` Carsten Dominik
  0 siblings, 1 reply; 13+ messages in thread
From: Robert Goldman @ 2008-12-16 15:43 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

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
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-16  1:51 question about org-region-active-p Robert Goldman
  2008-12-16  2:20 ` Samuel Wales
  2008-12-16  7:53 ` Carsten Dominik
@ 2008-12-16 15:52 ` William Henney
  2 siblings, 0 replies; 13+ messages in thread
From: William Henney @ 2008-12-16 15:52 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode

Hi Robert

On Mon, Dec 15, 2008 at 7:51 PM, Robert Goldman <rpgoldman@sift.info> wrote:
> [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.

I use Aquamacs with org-mode every day, and I have never run into this
problem. I just checked by turning off my customizations and
transient-mark-mode is indeed on by default. After doing "C-c @" in an
org file, then "M-: (org-region-active-p)" gives "t", as expected.
Maybe it is a problem with your customizations. You can check by
running "M-x start-vanilla-aquamacs".

I am running Aquamacs 1.5, org-mode 6.12b

Cheers

Will


-- 

  Dr William Henney, Centro de Radioastronomía y Astrofísica,
  Universidad Nacional Autónoma de México, Campus Morelia

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-16 15:43   ` Robert Goldman
@ 2008-12-17  8:13     ` Carsten Dominik
  2008-12-17 14:12       ` Robert Goldman
  0 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2008-12-17  8:13 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode

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
>>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17  8:13     ` Carsten Dominik
@ 2008-12-17 14:12       ` Robert Goldman
  2008-12-17 16:29         ` Carsten Dominik
  0 siblings, 1 reply; 13+ messages in thread
From: Robert Goldman @ 2008-12-17 14:12 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik wrote:
> 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.

Thank you Carsten for the response.  I am still inclined to think that
this case is one where the user should get some warning because it's in
that bad class of bug-like situations where code quietly does something
that the user does not expect and that contradicts the documentation.

On the other hand, I can't see where one would raise an error.  It's not
an error to call org-region-active-p without transient-mark-mode; indeed
some libraries turn this on and off, and the user is entitled not to use it.

The call to export isn't right, because the export command does not give
the system any opportunity to infer whether the user intended to operate
on a region or on the whole.  So there's no way to tell that the user's
expectations are going to be violated.

The loading of org-mode isn't the right place, either, since the vast
majority of org-mode works just fine with t-m-m turned off.

I'm inclined to think that the answer is simply that one shouldn't turn
transient-mark-mode off, ever.  This works for me, but I hate to think
of the next person coming along to fall into this same trap, from which
the only means of escape is to inspect the source code and use the debugger.

I would suggest a modification to the manual and will submit one, but
need clarification about one issue:  the use of t-m-m seems to be a
fallback for older emacsen that don't have region-active-p.  I have such
an emacs, so I don't know --- does this mean that on newer emacsen
org-region-active-p will work even without transient-mark-mode?

Best,
Robert

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17 14:12       ` Robert Goldman
@ 2008-12-17 16:29         ` Carsten Dominik
  2008-12-17 16:38           ` Robert Goldman
  2008-12-17 16:44           ` Bernt Hansen
  0 siblings, 2 replies; 13+ messages in thread
From: Carsten Dominik @ 2008-12-17 16:29 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode

Dear Robert,

also region-active-p requires transient-mark-mode to be active, if you  
look
at the definition of the region-active-p function, you will see that.

transient-mark-mode is on by default in Emacs.  Why did you turn it  
*off* in the
first place?????

- Carsten

On Dec 17, 2008, at 3:12 PM, Robert Goldman wrote:

> Carsten Dominik wrote:
>> 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.
>
> Thank you Carsten for the response.  I am still inclined to think that
> this case is one where the user should get some warning because it's  
> in
> that bad class of bug-like situations where code quietly does  
> something
> that the user does not expect and that contradicts the documentation.
>
> On the other hand, I can't see where one would raise an error.  It's  
> not
> an error to call org-region-active-p without transient-mark-mode;  
> indeed
> some libraries turn this on and off, and the user is entitled not to  
> use it.
>
> The call to export isn't right, because the export command does not  
> give
> the system any opportunity to infer whether the user intended to  
> operate
> on a region or on the whole.  So there's no way to tell that the  
> user's
> expectations are going to be violated.
>
> The loading of org-mode isn't the right place, either, since the vast
> majority of org-mode works just fine with t-m-m turned off.
>
> I'm inclined to think that the answer is simply that one shouldn't  
> turn
> transient-mark-mode off, ever.  This works for me, but I hate to think
> of the next person coming along to fall into this same trap, from  
> which
> the only means of escape is to inspect the source code and use the  
> debugger.
>
> I would suggest a modification to the manual and will submit one, but
> need clarification about one issue:  the use of t-m-m seems to be a
> fallback for older emacsen that don't have region-active-p.  I have  
> such
> an emacs, so I don't know --- does this mean that on newer emacsen
> org-region-active-p will work even without transient-mark-mode?
>
> Best,
> Robert

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17 16:29         ` Carsten Dominik
@ 2008-12-17 16:38           ` Robert Goldman
  2008-12-17 16:44           ` Bernt Hansen
  1 sibling, 0 replies; 13+ messages in thread
From: Robert Goldman @ 2008-12-17 16:38 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik wrote:
> Dear Robert,
> 
> also region-active-p requires transient-mark-mode to be active, if you look
> at the definition of the region-active-p function, you will see that.
> 
> transient-mark-mode is on by default in Emacs.  Why did you turn it
> *off* in the
> first place?????

I suspect that this is an aquamacs oddity.  Aquamacs (I believe) turns
on cua-mode by default and at least in the past, cua-mode was
incompatible with transient-mark-mode, and there was even an order
dependency (you had to turn cua-mode off before turning
transient-mark-mode on).  There's a fair amount of discussion about this
that one can find by googling.  I believe that this has changed,
however, since looking at a modern copy of cua-mode.el doesn't seem to
reveal any disabling of t-m-m.

I'll be honest with you --- I don't even know HOW I turned t-m-m off,
much less why!  When I explicitly turn it ON in .emacs, all is well.
When I run aquamacs without my init files, it's on.  But nothing
directly in my .emacs turns it off, nor do I have any customizations.
This suggests that some library I'm using, somewhere, interferes with
it, but as yet I have not found it.

Best,
r

> 
> - Carsten
> 
> On Dec 17, 2008, at 3:12 PM, Robert Goldman wrote:
> 
>> Carsten Dominik wrote:
>>> 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.
>>
>> Thank you Carsten for the response.  I am still inclined to think that
>> this case is one where the user should get some warning because it's in
>> that bad class of bug-like situations where code quietly does something
>> that the user does not expect and that contradicts the documentation.
>>
>> On the other hand, I can't see where one would raise an error.  It's not
>> an error to call org-region-active-p without transient-mark-mode; indeed
>> some libraries turn this on and off, and the user is entitled not to
>> use it.
>>
>> The call to export isn't right, because the export command does not give
>> the system any opportunity to infer whether the user intended to operate
>> on a region or on the whole.  So there's no way to tell that the user's
>> expectations are going to be violated.
>>
>> The loading of org-mode isn't the right place, either, since the vast
>> majority of org-mode works just fine with t-m-m turned off.
>>
>> I'm inclined to think that the answer is simply that one shouldn't turn
>> transient-mark-mode off, ever.  This works for me, but I hate to think
>> of the next person coming along to fall into this same trap, from which
>> the only means of escape is to inspect the source code and use the
>> debugger.
>>
>> I would suggest a modification to the manual and will submit one, but
>> need clarification about one issue:  the use of t-m-m seems to be a
>> fallback for older emacsen that don't have region-active-p.  I have such
>> an emacs, so I don't know --- does this mean that on newer emacsen
>> org-region-active-p will work even without transient-mark-mode?
>>
>> Best,
>> Robert
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17 16:29         ` Carsten Dominik
  2008-12-17 16:38           ` Robert Goldman
@ 2008-12-17 16:44           ` Bernt Hansen
  2008-12-17 17:01             ` Carsten Dominik
  1 sibling, 1 reply; 13+ messages in thread
From: Bernt Hansen @ 2008-12-17 16:44 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Robert Goldman

Hi Carsten,

Just to add to the discussion, transient-mark-mode is off for me in GNU
Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
2008-11-09 on raven, modified by Debian.

If I start with emacs -q transient-mark-mode is nil.

I've explicitly set it on in my .emacs (as of the beginning of this
discussion) and that makes things work better for me.

,----[ end of my .emacs ]
| (transient-mark-mode 1)
`----

Regards,
Bernt

Carsten Dominik <dominik@science.uva.nl> writes:

> Dear Robert,
>
> also region-active-p requires transient-mark-mode to be active, if you
> look
> at the definition of the region-active-p function, you will see that.
>
> transient-mark-mode is on by default in Emacs.  Why did you turn it
> *off* in the
> first place?????
>
> - Carsten
>
> On Dec 17, 2008, at 3:12 PM, Robert Goldman wrote:
>
>> Carsten Dominik wrote:
>>> 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.
>>
>> Thank you Carsten for the response.  I am still inclined to think that
>> this case is one where the user should get some warning because it's
>> in
>> that bad class of bug-like situations where code quietly does
>> something
>> that the user does not expect and that contradicts the documentation.
>>
>> On the other hand, I can't see where one would raise an error.  It's
>> not
>> an error to call org-region-active-p without transient-mark-mode;
>> indeed
>> some libraries turn this on and off, and the user is entitled not to
>> use it.
>>
>> The call to export isn't right, because the export command does not
>> give
>> the system any opportunity to infer whether the user intended to
>> operate
>> on a region or on the whole.  So there's no way to tell that the
>> user's
>> expectations are going to be violated.
>>
>> The loading of org-mode isn't the right place, either, since the vast
>> majority of org-mode works just fine with t-m-m turned off.
>>
>> I'm inclined to think that the answer is simply that one shouldn't
>> turn
>> transient-mark-mode off, ever.  This works for me, but I hate to think
>> of the next person coming along to fall into this same trap, from
>> which
>> the only means of escape is to inspect the source code and use the
>> debugger.
>>
>> I would suggest a modification to the manual and will submit one, but
>> need clarification about one issue:  the use of t-m-m seems to be a
>> fallback for older emacsen that don't have region-active-p.  I have
>> such
>> an emacs, so I don't know --- does this mean that on newer emacsen
>> org-region-active-p will work even without transient-mark-mode?
>>
>> Best,
>> Robert
>
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17 16:44           ` Bernt Hansen
@ 2008-12-17 17:01             ` Carsten Dominik
  2008-12-18 16:48               ` Robert Goldman
  0 siblings, 1 reply; 13+ messages in thread
From: Carsten Dominik @ 2008-12-17 17:01 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Robert Goldman, emacs-orgmode

Ah, so maybe Robert did not turn it off....

Anyway, in Emacs 23 the default will be ON.  It was always my  
understanding
that in order to use regions efficiently, you needed to turn on that  
mode.

Anyway, Robert, could you please try to identify a location in the  
docs where I should put this information?  Ask yourself:  "Where would  
I have seen this, had i been there....".

- Carsten

On Dec 17, 2008, at 5:44 PM, Bernt Hansen wrote:

> Hi Carsten,
>
> Just to add to the discussion, transient-mark-mode is off for me in  
> GNU
> Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
> 2008-11-09 on raven, modified by Debian.
>
> If I start with emacs -q transient-mark-mode is nil.
>
> I've explicitly set it on in my .emacs (as of the beginning of this
> discussion) and that makes things work better for me.
>
> ,----[ end of my .emacs ]
> | (transient-mark-mode 1)
> `----
>
> Regards,
> Bernt
>
> Carsten Dominik <dominik@science.uva.nl> writes:
>
>> Dear Robert,
>>
>> also region-active-p requires transient-mark-mode to be active, if  
>> you
>> look
>> at the definition of the region-active-p function, you will see that.
>>
>> transient-mark-mode is on by default in Emacs.  Why did you turn it
>> *off* in the
>> first place?????
>>
>> - Carsten
>>
>> On Dec 17, 2008, at 3:12 PM, Robert Goldman wrote:
>>
>>> Carsten Dominik wrote:
>>>> 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.
>>>
>>> Thank you Carsten for the response.  I am still inclined to think  
>>> that
>>> this case is one where the user should get some warning because it's
>>> in
>>> that bad class of bug-like situations where code quietly does
>>> something
>>> that the user does not expect and that contradicts the  
>>> documentation.
>>>
>>> On the other hand, I can't see where one would raise an error.  It's
>>> not
>>> an error to call org-region-active-p without transient-mark-mode;
>>> indeed
>>> some libraries turn this on and off, and the user is entitled not to
>>> use it.
>>>
>>> The call to export isn't right, because the export command does not
>>> give
>>> the system any opportunity to infer whether the user intended to
>>> operate
>>> on a region or on the whole.  So there's no way to tell that the
>>> user's
>>> expectations are going to be violated.
>>>
>>> The loading of org-mode isn't the right place, either, since the  
>>> vast
>>> majority of org-mode works just fine with t-m-m turned off.
>>>
>>> I'm inclined to think that the answer is simply that one shouldn't
>>> turn
>>> transient-mark-mode off, ever.  This works for me, but I hate to  
>>> think
>>> of the next person coming along to fall into this same trap, from
>>> which
>>> the only means of escape is to inspect the source code and use the
>>> debugger.
>>>
>>> I would suggest a modification to the manual and will submit one,  
>>> but
>>> need clarification about one issue:  the use of t-m-m seems to be a
>>> fallback for older emacsen that don't have region-active-p.  I have
>>> such
>>> an emacs, so I don't know --- does this mean that on newer emacsen
>>> org-region-active-p will work even without transient-mark-mode?
>>>
>>> Best,
>>> Robert
>>
>>
>>
>> _______________________________________________
>> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-17 17:01             ` Carsten Dominik
@ 2008-12-18 16:48               ` Robert Goldman
  2008-12-19  8:39                 ` Carsten Dominik
  0 siblings, 1 reply; 13+ messages in thread
From: Robert Goldman @ 2008-12-18 16:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 663 bytes --]

Carsten Dominik wrote:
> Ah, so maybe Robert did not turn it off....
> 
> Anyway, in Emacs 23 the default will be ON.  It was always my understanding
> that in order to use regions efficiently, you needed to turn on that mode.
> 
> Anyway, Robert, could you please try to identify a location in the docs
> where I should put this information?  Ask yourself:  "Where would I have
> seen this, had i been there....".

Attached please find a patch file that gives a proposed set of additions
to the manual on this topic, for your review.  Interestingly enough,
there was already an index entry for transient mark mode at the html
export commands page.

Best,
Robert

[-- Attachment #2: send-to-carsten.patch --]
[-- Type: text/plain, Size: 4052 bytes --]

diff --git a/doc/org.texi b/doc/org.texi
index 39c94aa..f8a5ea2 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -7061,6 +7061,7 @@ is normal.
 @node Exporting, Publishing, Embedded LaTeX, Top
 @chapter Exporting
 @cindex exporting
+@cindex Transient mark mode
 
 Org mode documents can be exported into a variety of other formats.  For
 printing and sharing of notes, ASCII export produces a readable and
@@ -7073,6 +7074,10 @@ deadlines or appointments into a desktop calendar program like iCal,
 Org mode can also produce extracts in the iCalendar format.  Currently
 Org mode only supports export, not import of these different formats.
 
+Org supports export of selected regions when @code{transient mark mode} is
+enabled.  This should always be enabled in default emacs configurations.
+
+
 @menu
 * Markup rules::                Which structures are recognized?
 * Selective export::            Using tags to select and exclude trees
@@ -7605,7 +7610,11 @@ file.
 Export as ASCII file.  For an org file @file{myfile.org}, the ASCII file
 will be @file{myfile.txt}.  The file will be overwritten without
 warning.  If there is an active region, only the region will be
-exported. If the selected region is a single tree@footnote{To select the
+exported.@footnote{Exporting by active region will only work if @code{transient mark
+  mode} is enabled.  This should almost always be enabled.  However, if it is
+not enabled, attempts to export a region will result in exporting the entire
+org file.  If this happens, check the setting of the variable
+@code{transient-mark-mode} in your emacs.} If the selected region is a single tree@footnote{To select the
 current subtree, use @kbd{C-c @@}.}, the tree head will
 become the document title.  If the tree head entry has or inherits an
 @code{EXPORT_FILE_NAME} property, that name will be used for the
@@ -7662,11 +7671,16 @@ language, but with additional support for tables.
 @item C-c C-e h
 Export as HTML file @file{myfile.html}.  For an org file @file{myfile.org},
 the ASCII file will be @file{myfile.html}.  The file will be overwritten
-without warning.  If there is an active region, only the region will be
+without warning.  If there is an active region,@footnote{Exporting by active region will only work if @code{transient mark
+  mode} is enabled.  This should almost always be enabled.  However, if it is
+not enabled, attempts to export a region will result in exporting the entire
+org file.  If this happens, check the setting of the variable
+@code{transient-mark-mode} in your emacs.} only the region will be
 exported. If the selected region is a single tree@footnote{To select the
 current subtree, use @kbd{C-c @@}.}, the tree head will become the document
 title.  If the tree head entry has or inherits an @code{EXPORT_FILE_NAME}
 property, that name will be used for the export.
+
 @kindex C-c C-e b
 @item C-c C-e b
 Export as HTML file and immediately open it with a browser.
@@ -7911,8 +7925,12 @@ references, the PDF output file will be fully linked.
 Export as La@TeX{} file @file{myfile.tex}.  For an org file
 @file{myfile.org}, the ASCII file will be @file{myfile.tex}.  The file will
 be overwritten without warning.  If there is an active region, only the
-region will be exported. If the selected region is a single tree@footnote{To
-select the current subtree, use @kbd{C-c @@}.}, the tree head will become the
+region will be exported.@footnote{Exporting by active region will only work if @code{transient mark
+  mode} is enabled.  This should almost always be enabled.  However, if it is
+not enabled, attempts to export a region will result in exporting the entire
+org file.  If this happens, check the setting of the variable
+@code{transient-mark-mode} in your emacs.} If the selected region is a single tree,@footnote{To
+select the current subtree, use @kbd{C-c @@}.} the tree head will become the
 document title.  If the tree head entry has or inherits an
 @code{EXPORT_FILE_NAME} property, that name will be used for the export.
 @kindex C-c C-e L

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: question about org-region-active-p
  2008-12-18 16:48               ` Robert Goldman
@ 2008-12-19  8:39                 ` Carsten Dominik
  0 siblings, 0 replies; 13+ messages in thread
From: Carsten Dominik @ 2008-12-19  8:39 UTC (permalink / raw)
  To: Robert Goldman; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 5182 bytes --]

Hi Robert,

I have added documentation in the places you suggested.  Also, I added  
a remark in the Activation section.

Thanks.

- Carsten

On Dec 18, 2008, at 5:48 PM, Robert Goldman wrote:

> Carsten Dominik wrote:
>> Ah, so maybe Robert did not turn it off....
>>
>> Anyway, in Emacs 23 the default will be ON.  It was always my  
>> understanding
>> that in order to use regions efficiently, you needed to turn on  
>> that mode.
>>
>> Anyway, Robert, could you please try to identify a location in the  
>> docs
>> where I should put this information?  Ask yourself:  "Where would I  
>> have
>> seen this, had i been there....".
>
> Attached please find a patch file that gives a proposed set of  
> additions
> to the manual on this topic, for your review.  Interestingly enough,
> there was already an index entry for transient mark mode at the html
> export commands page.
>
> Best,
> Robert
> diff --git a/doc/org.texi b/doc/org.texi
> index 39c94aa..f8a5ea2 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -7061,6 +7061,7 @@ is normal.
> @node Exporting, Publishing, Embedded LaTeX, Top
> @chapter Exporting
> @cindex exporting
> +@cindex Transient mark mode
>
> Org mode documents can be exported into a variety of other formats.   
> For
> printing and sharing of notes, ASCII export produces a readable and
> @@ -7073,6 +7074,10 @@ deadlines or appointments into a desktop  
> calendar program like iCal,
> Org mode can also produce extracts in the iCalendar format.  Currently
> Org mode only supports export, not import of these different formats.
>
> +Org supports export of selected regions when @code{transient mark  
> mode} is
> +enabled.  This should always be enabled in default emacs  
> configurations.
> +
> +
> @menu
> * Markup rules::                Which structures are recognized?
> * Selective export::            Using tags to select and exclude trees
> @@ -7605,7 +7610,11 @@ file.
> Export as ASCII file.  For an org file @file{myfile.org}, the ASCII  
> file
> will be @file{myfile.txt}.  The file will be overwritten without
> warning.  If there is an active region, only the region will be
> -exported. If the selected region is a single tree@footnote{To  
> select the
> +exported.@footnote{Exporting by active region will only work if  
> @code{transient mark
> +  mode} is enabled.  This should almost always be enabled.   
> However, if it is
> +not enabled, attempts to export a region will result in exporting  
> the entire
> +org file.  If this happens, check the setting of the variable
> +@code{transient-mark-mode} in your emacs.} If the selected region  
> is a single tree@footnote{To select the
> current subtree, use @kbd{C-c @@}.}, the tree head will
> become the document title.  If the tree head entry has or inherits an
> @code{EXPORT_FILE_NAME} property, that name will be used for the
> @@ -7662,11 +7671,16 @@ language, but with additional support for  
> tables.
> @item C-c C-e h
> Export as HTML file @file{myfile.html}.  For an org file  
> @file{myfile.org},
> the ASCII file will be @file{myfile.html}.  The file will be  
> overwritten
> -without warning.  If there is an active region, only the region  
> will be
> +without warning.  If there is an active region,@footnote{Exporting  
> by active region will only work if @code{transient mark
> +  mode} is enabled.  This should almost always be enabled.   
> However, if it is
> +not enabled, attempts to export a region will result in exporting  
> the entire
> +org file.  If this happens, check the setting of the variable
> +@code{transient-mark-mode} in your emacs.} only the region will be
> exported. If the selected region is a single tree@footnote{To select  
> the
> current subtree, use @kbd{C-c @@}.}, the tree head will become the  
> document
> title.  If the tree head entry has or inherits an  
> @code{EXPORT_FILE_NAME}
> property, that name will be used for the export.
> +
> @kindex C-c C-e b
> @item C-c C-e b
> Export as HTML file and immediately open it with a browser.
> @@ -7911,8 +7925,12 @@ references, the PDF output file will be fully  
> linked.
> Export as La@TeX{} file @file{myfile.tex}.  For an org file
> @file{myfile.org}, the ASCII file will be @file{myfile.tex}.  The  
> file will
> be overwritten without warning.  If there is an active region, only  
> the
> -region will be exported. If the selected region is a single  
> tree@footnote{To
> -select the current subtree, use @kbd{C-c @@}.}, the tree head will  
> become the
> +region will be exported.@footnote{Exporting by active region will  
> only work if @code{transient mark
> +  mode} is enabled.  This should almost always be enabled.   
> However, if it is
> +not enabled, attempts to export a region will result in exporting  
> the entire
> +org file.  If this happens, check the setting of the variable
> +@code{transient-mark-mode} in your emacs.} If the selected region  
> is a single tree,@footnote{To
> +select the current subtree, use @kbd{C-c @@}.} the tree head will  
> become the
> document title.  If the tree head entry has or inherits an
> @code{EXPORT_FILE_NAME} property, that name will be used for the  
> export.
> @kindex C-c C-e L


[-- Attachment #1.2: Type: text/html, Size: 6056 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-12-19  8:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-16  1:51 question about org-region-active-p Robert Goldman
2008-12-16  2:20 ` Samuel Wales
2008-12-16  7:53 ` Carsten Dominik
2008-12-16 15:43   ` Robert Goldman
2008-12-17  8:13     ` Carsten Dominik
2008-12-17 14:12       ` Robert Goldman
2008-12-17 16:29         ` Carsten Dominik
2008-12-17 16:38           ` Robert Goldman
2008-12-17 16:44           ` Bernt Hansen
2008-12-17 17:01             ` Carsten Dominik
2008-12-18 16:48               ` Robert Goldman
2008-12-19  8:39                 ` Carsten Dominik
2008-12-16 15:52 ` William Henney

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).