From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marco Wahl Subject: Re: [RFC] org-agenda: Jump directly to line in case of a timestamp Date: Wed, 11 Oct 2017 13:42:22 +0200 Message-ID: <84zi8xykpt.fsf@gmail.com> References: <84y3onggp3.fsf@gmail.com> <87mv53gfci.fsf@nicolasgoaziou.fr> <84r2uf54fx.fsf@gmail.com> <87a812tja0.fsf@fastmail.fm> <87efqcohr5.fsf@pinto.chemeng.ucl.ac.uk> <20171011130116.68ed4cce@gaia> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2FPD-00021H-7U for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 07:42:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2FPA-0004e2-4w for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 07:42:31 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:44267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e2FP9-0004dF-Ut for emacs-orgmode@gnu.org; Wed, 11 Oct 2017 07:42:28 -0400 Received: by mail-wm0-x232.google.com with SMTP id 196so19376319wma.1 for ; Wed, 11 Oct 2017 04:42:26 -0700 (PDT) In-Reply-To: <20171011130116.68ed4cce@gaia> (Detlef Steuer's message of "Wed, 11 Oct 2017 13:01:16 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Detlef Steuer Cc: emacs-orgmode@gnu.org Detlef Steuer writes: > Am Mon, 09 Oct 2017 10:29:39 +0200 > schrieb Alan Schmitt : > >> On 2017-10-09 09:19, Eric S Fraga 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