emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-agenda-switch-to switches to weird place
@ 2011-10-11 15:57 Antoine Levitt
  2011-10-11 16:45 ` Sebastien Vauban
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Levitt @ 2011-10-11 15:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I use org-capture to store information (such as appointments), then view
them in the agenda. I use RET (org-agenda-switch-to) in the agenda
view to modify them. For instance, for an entry like

* TODO Some task
SCHEDULED: !<2011-10-11 Tue>

, point is at "!", which is inconvenient, because most of the time I
want to modify the heading of the entry ("Some task"). A nice place to
put the point would be at the %? specifier of org-capture-templates, if
specified. Apparently, org-capture does the job of inserting a marker
for org-agenda-switch-to to come back to, so it should be able to figure
out if %? was specified, and if yes, where. I couldn't manage to do it,
though. Could someone take a look at this?

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

* Re: org-agenda-switch-to switches to weird place
  2011-10-11 15:57 org-agenda-switch-to switches to weird place Antoine Levitt
@ 2011-10-11 16:45 ` Sebastien Vauban
  2011-10-11 17:15   ` Antoine Levitt
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2011-10-11 16:45 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Antoine,

Antoine Levitt wrote:
> I use org-capture to store information (such as appointments), then view
> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
> modify them. For instance, for an entry like
>
> * TODO Some task
> SCHEDULED: !<2011-10-11 Tue>
>
> , point is at "!", which is inconvenient, because most of the time I want to
> modify the heading of the entry ("Some task"). A nice place to put the point
> would be at the %? specifier of org-capture-templates, if specified.
> Apparently, org-capture does the job of inserting a marker for
> org-agenda-switch-to to come back to, so it should be able to figure out if
> %? was specified, and if yes, where. I couldn't manage to do it, though.
> Could someone take a look at this?

I guess one could imagine that it should be possible to customize a point to
land on when switching from the agenda to the source buffer.

But I don't see how org-capture templates would come into play: your different
capture templates can have very different positions for %?, and once captured,
a note or TODO is no different than free text that the user would have written
manually.

So, you can't get a behavior depending on any template, IIUC.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: org-agenda-switch-to switches to weird place
  2011-10-11 16:45 ` Sebastien Vauban
@ 2011-10-11 17:15   ` Antoine Levitt
  2011-10-11 19:35     ` Sebastien Vauban
  0 siblings, 1 reply; 5+ messages in thread
From: Antoine Levitt @ 2011-10-11 17:15 UTC (permalink / raw)
  To: emacs-orgmode

11/10/11 18:45, Sebastien Vauban
> Hi Antoine,
>
> Antoine Levitt wrote:
>> I use org-capture to store information (such as appointments), then view
>> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
>> modify them. For instance, for an entry like
>>
>> * TODO Some task
>> SCHEDULED: !<2011-10-11 Tue>
>>
>> , point is at "!", which is inconvenient, because most of the time I want to
>> modify the heading of the entry ("Some task"). A nice place to put the point
>> would be at the %? specifier of org-capture-templates, if specified.
>> Apparently, org-capture does the job of inserting a marker for
>> org-agenda-switch-to to come back to, so it should be able to figure out if
>> %? was specified, and if yes, where. I couldn't manage to do it, though.
>> Could someone take a look at this?
>
> I guess one could imagine that it should be possible to customize a point to
> land on when switching from the agenda to the source buffer.

That seems a bit overkill. But then again, this is org. :-)

> But I don't see how org-capture templates would come into play: your different
> capture templates can have very different positions for %?, and once captured,
> a note or TODO is no different than free text that the user would have written
> manually.

If I understand correctly, org-agenda-switch-to goes to the org-marker
marker that is set by capture. If capture inserts this marker right
after the template insertion, org-agenda can then switch back to it. In
theory at least. I can't make sense of org-capture's code.

Anyway, pretty much anything is better than the current behavior, which
is not very user friendly when SCHEDULED info is present.

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

* Re: org-agenda-switch-to switches to weird place
  2011-10-11 17:15   ` Antoine Levitt
@ 2011-10-11 19:35     ` Sebastien Vauban
  2011-10-11 20:24       ` Antoine Levitt
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastien Vauban @ 2011-10-11 19:35 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Antoine,

Antoine Levitt wrote:
> 11/10/11 18:45, Sebastien Vauban
>> Antoine Levitt wrote:
>>> I use org-capture to store information (such as appointments), then view
>>> them in the agenda. I use RET (org-agenda-switch-to) in the agenda view to
>>> modify them. For instance, for an entry like
>>>
>>> * TODO Some task
>>> SCHEDULED: !<2011-10-11 Tue>
>>>
>>> , point is at "!", which is inconvenient, because most of the time I want to
>>> modify the heading of the entry ("Some task"). A nice place to put the point
>>> would be at the %? specifier of org-capture-templates, if specified.
>>> Apparently, org-capture does the job of inserting a marker for
>>> org-agenda-switch-to to come back to, so it should be able to figure out if
>>> %? was specified, and if yes, where. I couldn't manage to do it, though.
>>> Could someone take a look at this?
>>
>> [...] I don't see how org-capture templates would come into play: your
>> different capture templates can have very different positions for %?, and
>> once captured, a note or TODO is no different than free text that the user
>> would have written manually.

Please consider what follows as doubtful, as I absolutely don't have enough
experience on this subject... but let's try...

> If I understand correctly, org-agenda-switch-to goes to the org-marker
> marker that is set by capture.

No, I absolutely don't think so. Org files are plain text files: what you
don't see in there, is simply not there. So, how could such markers be stored
in the Org file, when capturing something, and not be visible?

IIUC, the markers are simply some sort of regexp search to find certain
typical positions:

- org-marker matches the timestamp which is at the origin of the presence of
  the entry in the agenda

- org-hd-marker is the beginning of the heading.

> If capture inserts this marker right after the template insertion,
> org-agenda can then switch back to it. In theory at least. I can't make
> sense of org-capture's code.

So, no, capture does not insert any biscuit for later. It simply is the agenda
functions which scan all the agenda buffers, and remember where the important
elements are, to be used when jumping.

> Anyway, pretty much anything is better than the current behavior, which is
> not very user friendly when SCHEDULED info is present.

You say:

>>> , point is at "!", which is inconvenient, because most of the time I want to
>>> modify the heading of the entry ("Some task").

Do you really modify the title more often than the date? You have luck!
Because of procrastination, I'd say I much, much more often change the date, to
reprogram the entry at a later date, and so on, and so on.

Anyway, would you jump onto the beginning of the heading, just where the `***'
start, I think you can change the line:

    (org-get-at-bol 'org-marker))

with:

    (org-get-at-bol 'org-hd-marker))

to get another behavior. Now, from that, adding a constant number, or --
better -- moving forward a couple of times, or -- certainly there are still
better options -- ... would allow you to land on whichever component of the
heading.

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: org-agenda-switch-to switches to weird place
  2011-10-11 19:35     ` Sebastien Vauban
@ 2011-10-11 20:24       ` Antoine Levitt
  0 siblings, 0 replies; 5+ messages in thread
From: Antoine Levitt @ 2011-10-11 20:24 UTC (permalink / raw)
  To: emacs-orgmode

11/10/11 21:35, Sebastien Vauban
>> If I understand correctly, org-agenda-switch-to goes to the org-marker
>> marker that is set by capture.
>
> No, I absolutely don't think so. Org files are plain text files: what you
> don't see in there, is simply not there. So, how could such markers be stored
> in the Org file, when capturing something, and not be visible?

Via markers, see
http://www.chemie.fu-berlin.de/chemnet/use/info/elisp/elisp_29.html. I
don't know much about it either, I just know it exists :-)

> IIUC, the markers are simply some sort of regexp search to find
> certain typical positions:
>
> - org-marker matches the timestamp which is at the origin of the presence of
>   the entry in the agenda
>
> - org-hd-marker is the beginning of the heading.

That doesn't seem likely. See this (simplified) code from
org-agenda-switch-to:

    (let* ((marker (org-get-at-bol 'org-marker))
	   (pos (marker-position marker)))

So apparently there is a marker.

> Do you really modify the title more often than the date? You have luck!
> Because of procrastination, I'd say I much, much more often change the date, to
> reprogram the entry at a later date, and so on, and so on.

I change the date directly from the agenda with C-c C-s or S-right. So
when I press RET, it's that I want to edit the title.

>
> Anyway, would you jump onto the beginning of the heading, just where the `***'
> start, I think you can change the line:
>
>     (org-get-at-bol 'org-marker))
>
> with:
>
>     (org-get-at-bol 'org-hd-marker))
>
> to get another behavior. Now, from that, adding a constant number, or --
> better -- moving forward a couple of times, or -- certainly there are still
> better options -- ... would allow you to land on whichever component of the
> heading.

Right. I can hack something up that'll be specific to my case, I just
wanted to know if there was a proper way to do it that'd benefit everybody.

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

end of thread, other threads:[~2011-10-11 20:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 15:57 org-agenda-switch-to switches to weird place Antoine Levitt
2011-10-11 16:45 ` Sebastien Vauban
2011-10-11 17:15   ` Antoine Levitt
2011-10-11 19:35     ` Sebastien Vauban
2011-10-11 20:24       ` Antoine Levitt

Code repositories for project(s) associated with this 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).