emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Point jumps when changing timestamps
@ 2011-08-03 14:18 Matt Lundin
  2011-08-04 16:01 ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Lundin @ 2011-08-03 14:18 UTC (permalink / raw)
  To: Org Mode

I often change timestamps  with S-Left or S-Right when the cursor is at
the point immediately following the timestamp:

<2011-08-03 Wed .+1d>
                     ^ cursor here

When I call S-Left or S-Right at this point, the cursor jumps to the
last character of the day of week abbreviation:

<2011-08-04 Thu .+1d>
              ^ cursor now here

The cursor does not jump if it is already located within the brackets.

Best,
Matt

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

* Re: Point jumps when changing timestamps
  2011-08-03 14:18 Point jumps when changing timestamps Matt Lundin
@ 2011-08-04 16:01 ` Nicolas Goaziou
  2011-08-04 16:39   ` Matt Lundin
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2011-08-04 16:01 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Hello,

Matt Lundin <mdl@imapmail.org> writes:

> I often change timestamps  with S-Left or S-Right when the cursor is at
> the point immediately following the timestamp:
>
> <2011-08-03 Wed .+1d>
>                      ^ cursor here
>
> When I call S-Left or S-Right at this point, the cursor jumps to the
> last character of the day of week abbreviation:
>
> <2011-08-04 Thu .+1d>
>               ^ cursor now here
>
> The cursor does not jump if it is already located within the brackets.

I understand your point but I think Org shouldn't let you use
`org-shiftleft' at this place in the first place. In my opinion,
`org-at-timestamp-p' is faulty here.

I know there is currently in that function a workaround to return t when
point is at the char just after the time-stamp, but it just doesn't
sound right to me.

What do you think about it?

Regards,

-- 
Nicolas Goaziou

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

* Re: Point jumps when changing timestamps
  2011-08-04 16:01 ` Nicolas Goaziou
@ 2011-08-04 16:39   ` Matt Lundin
  2011-08-04 18:06     ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Lundin @ 2011-08-04 16:39 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Matt Lundin <mdl@imapmail.org> writes:
>
>> I often change timestamps  with S-Left or S-Right when the cursor is at
>> the point immediately following the timestamp:
>>
>> <2011-08-03 Wed .+1d>
>>                      ^ cursor here
>>
>> When I call S-Left or S-Right at this point, the cursor jumps to the
>> last character of the day of week abbreviation:
>>
>> <2011-08-04 Thu .+1d>
>>               ^ cursor now here
>>
>> The cursor does not jump if it is already located within the brackets.
>
> I understand your point but I think Org shouldn't let you use
> `org-shiftleft' at this place in the first place. In my opinion,
> `org-at-timestamp-p' is faulty here.

A bit more generous org-at-timestamp-p does have some practical
advantages: it can save cursor movement when navigating an org document.
For instance, when navigating the following headline, I would typically
type C-n C-e to go to the end of the scheduled line. That puts the
cursor at the point directly after the scheduled timestamp:

* A headline
  SCHEDULED: <2011-08-04 Thu>
                             ^ i.e., here

Having to move the cursor backwards one point would add a little bit of
inconvenience.

> I know there is currently in that function a workaround to return t when
> point is at the char just after the time-stamp, but it just doesn't
> sound right to me.

I believe the current behavior of org-at-timestamp-p is consistent with
that of the *-at-point functions. For instance if I call M-:
(word-at-point) on the example below with the cursor immediately
following the word, emacs returns "word".

word
    ^ cursor here

Best,
Matt

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

* Re: Point jumps when changing timestamps
  2011-08-04 16:39   ` Matt Lundin
@ 2011-08-04 18:06     ` Nicolas Goaziou
  2011-08-04 18:45       ` Matt Lundin
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2011-08-04 18:06 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Matt Lundin <mdl@imapmail.org> writes:

> A bit more generous org-at-timestamp-p does have some practical
> advantages: it can save cursor movement when navigating an org document.
> For instance, when navigating the following headline, I would typically
> type C-n C-e to go to the end of the scheduled line. That puts the
> cursor at the point directly after the scheduled timestamp:
>
> * A headline
>   SCHEDULED: <2011-08-04 Thu>
>                              ^ i.e., here
>
> Having to move the cursor backwards one point would add a little bit of
> inconvenience.

C-c C-s on the headline lets you modify more quickly the
time-stamp. I may be missing the point, but that position has no
particular interest.

> I believe the current behavior of org-at-timestamp-p is consistent with
> that of the *-at-point functions.

Agreed. But, on the other hand, it isn't consistent with any similar Org
function. Try `org-footnote-at-reference-p' just after a footnote
reference or `org-context' just after a link. In both cases, point will
be considered outside of the element.

Regards,

-- 
Nicolas Goaziou

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

* Re: Point jumps when changing timestamps
  2011-08-04 18:06     ` Nicolas Goaziou
@ 2011-08-04 18:45       ` Matt Lundin
  2011-08-05  8:47         ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Lundin @ 2011-08-04 18:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>
>> A bit more generous org-at-timestamp-p does have some practical
>> advantages: it can save cursor movement when navigating an org document.
>> For instance, when navigating the following headline, I would typically
>> type C-n C-e to go to the end of the scheduled line. That puts the
>> cursor at the point directly after the scheduled timestamp:
>>
>> * A headline
>>   SCHEDULED: <2011-08-04 Thu>
>>                              ^ i.e., here
>>
>> Having to move the cursor backwards one point would add a little bit of
>> inconvenience.
>
> C-c C-s on the headline lets you modify more quickly the
> time-stamp. I may be missing the point, but that position has no
> particular interest.

I realize that I can change a scheduled timestamp with C-s C-s, and I
often do. But I often find myself needing to move appointments such as
the following back and forward a day:

* An appointment
  <2011-08-04 Thu +1w>

If I am on the headline, the easiest way (for me) to navigate to the
headline is C-n C-e. Then I can type S-left or S-right and quickly move
through the dates; the cursor, moreover, will be in a convenient
position for typing RET and adding a line of notes. This, for me, is a
bit more convenient than typing C-n C-3 C-f or C-s <, etc.

>> I believe the current behavior of org-at-timestamp-p is consistent with
>> that of the *-at-point functions.
>
> Agreed. But, on the other hand, it isn't consistent with any similar Org
> function. Try `org-footnote-at-reference-p' just after a footnote
> reference or `org-context' just after a link. In both cases, point will
> be considered outside of the element.

True. (Thanks for pointing out org-context! I wasn't aware of that
function.) From a UI perspective, however, I would suggest that a bit
looser behavior adds some convenience to org-mode. For instance C-c C-o
will currently open a link if the cursor is at the point before or after
it.

  [[http://www.google.com]]
 ^ here                    ^ here

Best,
Matt

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

* Re: Point jumps when changing timestamps
  2011-08-04 18:45       ` Matt Lundin
@ 2011-08-05  8:47         ` Nicolas Goaziou
  2011-08-05 14:08           ` Matt Lundin
  2011-08-15  8:11           ` Bastien
  0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2011-08-05  8:47 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode

Matt Lundin <mdl@imapmail.org> writes:

> I realize that I can change a scheduled timestamp with C-s C-s, and I
> often do. But I often find myself needing to move appointments such as
> the following back and forward a day:
>
> * An appointment
>   <2011-08-04 Thu +1w>
>
> If I am on the headline, the easiest way (for me) to navigate to the
> headline is C-n C-e. Then I can type S-left or S-right and quickly move
> through the dates; the cursor, moreover, will be in a convenient
> position for typing RET and adding a line of notes. This, for me, is a
> bit more convenient than typing C-n C-3 C-f or C-s <, etc.

Ok, it may be convenient in that specific case, but it still looks like
a hack to me. Another solution would be to implement a function to
navigate between time-stamps, similar to `org-next-link'. One can even
generalize this function to move to the next non-structural element
(time-stamp, link, footnote, latex snippet, emphasized text)[1].

> From a UI perspective, however, I would suggest that a bit looser
> behavior adds some convenience to org-mode. For instance C-c C-o will
> currently open a link if the cursor is at the point before or after
> it.
>
>   [[http://www.google.com]]
>  ^ here                    ^ here

This is different. `org-open-at-point' is an end-user function, whereas
`org-at-timestamp-p' isn't. I don't think predicates should be sloppy:
I don't want to implement `org-really-at-timestamp-p'.

Furthermore, being loose isn't always convenient. In the following
example, where will I go if I use C-c C-o on the space between the two
links?

    [[http://www.google.com][Google]] [[http://www.bing.com][Bing]]

I'd suggest to fix `org-at-timestamp-p', and allow, if it must be,
sloppiness in `org-shiftleft' and friends.

    
Regards,


Footnotes:

[1] This and a convenient paragraph motion command could be the roots
of an interesting Org parser.


-- 
Nicolas Goaziou

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

* Re: Point jumps when changing timestamps
  2011-08-05  8:47         ` Nicolas Goaziou
@ 2011-08-05 14:08           ` Matt Lundin
  2011-08-15  8:22             ` Bastien
  2011-08-15  8:11           ` Bastien
  1 sibling, 1 reply; 9+ messages in thread
From: Matt Lundin @ 2011-08-05 14:08 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>>
>> If I am on the headline, the easiest way (for me) to navigate to the
>> headline is C-n C-e. Then I can type S-left or S-right and quickly move
>> through the dates; the cursor, moreover, will be in a convenient
>> position for typing RET and adding a line of notes. This, for me, is a
>> bit more convenient than typing C-n C-3 C-f or C-s <, etc.
>
> Ok, it may be convenient in that specific case, but it still looks like
> a hack to me. Another solution would be to implement a function to
> navigate between time-stamps, similar to `org-next-link'. One can even
> generalize this function to move to the next non-structural element
> (time-stamp, link, footnote, latex snippet, emphasized text)[1].

That sounds like a good idea.

>> From a UI perspective, however, I would suggest that a bit looser
>> behavior adds some convenience to org-mode. For instance C-c C-o will
>> currently open a link if the cursor is at the point before or after
>> it.
>>
>>   [[http://www.google.com]]
>>  ^ here                    ^ here
>
> This is different. `org-open-at-point' is an end-user function, whereas
> `org-at-timestamp-p' isn't. I don't think predicates should be sloppy:
> I don't want to implement `org-really-at-timestamp-p'.
>
> Furthermore, being loose isn't always convenient. In the following
> example, where will I go if I use C-c C-o on the space between the two
> links?
>
>     [[http://www.google.com][Google]] [[http://www.bing.com][Bing]]

It seems that google wins in this instance. :)

> I'd suggest to fix `org-at-timestamp-p', and allow, if it must be,
> sloppiness in `org-shiftleft' and friends.

Thanks for the detailed explanation. That sounds fine.

My concern here is not with the cleanness of the code but with
usability. For years, org users have been able to use S-left and S-right
when the cursor immediately follows the timestamp. This has felt, to me,
both deliberate and natural -- it has become a fundamental part of the
way I use org-mode. If the underlying code can be made cleaner, that's
fine, so long as the usability remains.

But it is also very likely that I am the only person who changes
timestamps in this way. Are there any others?

Best,
Matt

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

* Re: Point jumps when changing timestamps
  2011-08-05  8:47         ` Nicolas Goaziou
  2011-08-05 14:08           ` Matt Lundin
@ 2011-08-15  8:11           ` Bastien
  1 sibling, 0 replies; 9+ messages in thread
From: Bastien @ 2011-08-15  8:11 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Matt Lundin, Org Mode

Hi Nicolas and Matt,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> I'd suggest to fix `org-at-timestamp-p', and allow, if it must be,
> sloppiness in `org-shiftleft' and friends.

I've just pushed a fix to `org-at-timestamp-p' so that `org-ts-what'
considers your "on the bracket" when point is right after it.

This fixes Matt's initial issue.

Thanks,

-- 
 Bastien

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

* Re: Point jumps when changing timestamps
  2011-08-05 14:08           ` Matt Lundin
@ 2011-08-15  8:22             ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2011-08-15  8:22 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Org Mode, Nicolas Goaziou

Hi Matt,

Matt Lundin <mdl@imapmail.org> writes:

>> Ok, it may be convenient in that specific case, but it still looks like
>> a hack to me. Another solution would be to implement a function to
>> navigate between time-stamps, similar to `org-next-link'. One can even
>> generalize this function to move to the next non-structural element
>> (time-stamp, link, footnote, latex snippet, emphasized text)[1].
>
> That sounds like a good idea.

+1

>> Furthermore, being loose isn't always convenient. In the following
>> example, where will I go if I use C-c C-o on the space between the two
>> links?
>>
>>     [[http://www.google.com][Google]] [[http://www.bing.com][Bing]]
>
> It seems that google wins in this instance. :)

Indeed :)

> My concern here is not with the cleanness of the code but with
> usability. For years, org users have been able to use S-left and S-right
> when the cursor immediately follows the timestamp. This has felt, to me,
> both deliberate and natural -- it has become a fundamental part of the
> way I use org-mode. If the underlying code can be made cleaner, that's
> fine, so long as the usability remains.

I also think the way it has worked so far is natural.

> But it is also very likely that I am the only person who changes
> timestamps in this way. Are there any others?

Yes, me!

-- 
 Bastien

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

end of thread, other threads:[~2011-08-15  8:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-03 14:18 Point jumps when changing timestamps Matt Lundin
2011-08-04 16:01 ` Nicolas Goaziou
2011-08-04 16:39   ` Matt Lundin
2011-08-04 18:06     ` Nicolas Goaziou
2011-08-04 18:45       ` Matt Lundin
2011-08-05  8:47         ` Nicolas Goaziou
2011-08-05 14:08           ` Matt Lundin
2011-08-15  8:22             ` Bastien
2011-08-15  8:11           ` Bastien

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