From: Marco Wahl <marcowahlsoft@gmail.com>
To: Detlef Steuer <steuer@unibw-hamburg.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC] org-agenda: Jump directly to line in case of a timestamp
Date: Wed, 11 Oct 2017 13:42:22 +0200 [thread overview]
Message-ID: <84zi8xykpt.fsf@gmail.com> (raw)
In-Reply-To: <20171011130116.68ed4cce@gaia> (Detlef Steuer's message of "Wed, 11 Oct 2017 13:01:16 +0200")
Detlef Steuer <steuer@unibw-hamburg.de> writes:
> Am Mon, 09 Oct 2017 10:29:39 +0200
> schrieb Alan Schmitt <alan.schmitt@polytechnique.org>:
>
>> On 2017-10-09 09:19, Eric S Fraga <esflists@gmail.com> writes:
>>
>> > On Monday, 9 Oct 2017 at 08:54, Alan Schmitt wrote:
>> >> One thing I would really like is the timestamp behavior of
>> >> org-agenda-goto with the windows behavior of
>> >> org-agenda-switch-to.
>> >
>> > You could "advise" the function?
>> > https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html
>>
>> Yes, this is something I could do. Thanks for the suggestion.
>
> ... and maybe share the solution? I would like the same as you, but
> emacs lisp is still unexplored territory to me.
I don't see how to realize the issue by using 'advise' but you could
use a new function which does it.
Put the code
--8<---------------cut here---------------start------------->8---
(defun org-agenda-switch-to-in-other-window (&optional delete-other-windows)
"Go to the Org mode file which contains the item at point in other window.
When optional argument DELETE-OTHER-WINDOWS is non-nil, the
displayed Org file fills the frame."
(interactive)
(if (and org-return-follows-link
(not (org-get-at-bol 'org-marker))
(org-in-regexp org-bracket-link-regexp))
(org-open-link-from-string (match-string 0))
(let* ((marker (or (org-get-at-bol 'org-marker)
(org-agenda-error)))
(buffer (marker-buffer marker))
(pos (marker-position marker)))
(unless buffer (user-error "Trying to switch to non-existent buffer"))
(switch-to-buffer-other-window buffer)
(when delete-other-windows (delete-other-windows))
(widen)
(goto-char pos)
(when (derived-mode-p 'org-mode)
(org-show-context 'agenda)
(run-hooks 'org-agenda-after-show-hook)))))
(org-defkey org-agenda-mode-map "\C-u\C-m" #'org-agenda-switch-to-in-other-window)
--8<---------------cut here---------------end--------------->8---
into your emacs init file to get the the behavior you want with the key
C-u RET.
The function above is almost the same as `org-agenda-switch-to' which is
currently bound to RET in org agenda.
HTH
Marco
prev parent reply other threads:[~2017-10-11 11:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-07 14:45 [RFC] org-agenda: Jump directly to line in case of a timestamp Marco Wahl
2017-10-07 15:14 ` Nicolas Goaziou
2017-10-07 16:05 ` Marco Wahl
2017-10-08 3:23 ` Matt Lundin
2017-10-08 6:25 ` Marco Wahl
2017-10-09 6:54 ` Alan Schmitt
2017-10-09 8:19 ` Eric S Fraga
2017-10-09 8:29 ` Alan Schmitt
2017-10-11 11:01 ` Detlef Steuer
2017-10-11 11:42 ` Marco Wahl [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84zi8xykpt.fsf@gmail.com \
--to=marcowahlsoft@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=steuer@unibw-hamburg.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.