emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why do org-agenda-switch-to and org-agenda-goto put the point in dif


From: Ihor Radchenko
Subject: Re: Why do org-agenda-switch-to and org-agenda-goto put the point in different spots in the target buffer?
Date: Fri, 09 Sep 2022 18:25:43 +0800

"Rohit Patnaik" <quanticle@quanticle.net> writes:

> I've gotten back into using org-agenda to manage my todos, and I noticed an 
> odd discrepancy in behavior. When I hit RET in the agenda buffer to go to the 
> TODO entry in the original org file, I see that the point is on the DEADLINE 
> line. However, when I hit TAB, I find that the point is placed at the 
> beginning of the heading. Looking at the source of org-agenda.el, I find that 
> TAB is bound to `org-agenda-goto', which does the following:
>
> (recenter (/ (window-height) 2))
> (org-back-to-heading t)
>
> RET, on the other hand, is bound to `org-agenda-switch-to', which does not 
> have these lines, and thus does not place the point on the heading.
>
> Is there a reason for this discrepancy between the two functions? I'm
> asking because I prefer the point placement behavior of
> `org-agenda-goto', but I use `org-agenda-switch-to' because switches
> to the target org file in the current window rather than opening a new
> window.

org-agenda-switch-to jumps to the actual agenda match (usually a
timestamp). It may or may not be close to the headline (think of active
timestamp inside notes). Such behaviour, albeit undocumented, may be
useful for some users. I'd rather not change it.

If you want to force org-agenda-switch-to to jump back to headline, you
can modify org-agenda-after-show-hook.

> Would there be any issues with me taking the recentering and point
> placement behavior from `org-agenda-goto' and adding it to
> `org-agenda-switch-to`?

Recentering is purely a visual thing. It should be safe to add.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



reply via email to

[Prev in Thread] Current Thread [Next in Thread]