From 4a93f1218adc7258386a38224ee2955e44c8d028 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Tue, 31 Jul 2018 16:04:05 +0200 Subject: [PATCH] [Timeline] Allow jumping to headlines in corresponding org-mode files --- site-lisp/timeline-tools.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/site-lisp/timeline-tools.el b/site-lisp/timeline-tools.el index 5ca57dd..9a8b213 100644 --- a/site-lisp/timeline-tools.el +++ b/site-lisp/timeline-tools.el @@ -56,6 +56,7 @@ Filter are applied in the order they are given in this list." (define-key map "f" #'timeline-tools-forward-day) (define-key map "b" #'timeline-tools-backward-day) (define-key map "s" #'timeline-tools-skip-short-entries) + (define-key map (kbd "RET") #'timeline-tools-jump-to-headline) (define-key map "q" #'quit-window) map)) @@ -468,6 +469,21 @@ Interactively query for the exact value of \"short\"." (timeline-tools-remove-short-entries timeline-tools--current-timeline threshold)) (timeline-tools-redraw-timeline))) +(defun timeline-tools-jump-to-headline () + "Jump to headline of current entry, if available." + (interactive) + (unless (eq major-mode 'timeline-tools-mode) + (user-error "Not in Timeline buffer")) + (let ((marker (save-mark-and-excursion + (end-of-line) + (org-table-previous-field) + (get-text-property (point) 'marker)))) + (unless marker + (user-error "Not on headline to jump to")) + (switch-to-buffer (marker-buffer marker)) + (goto-char marker) + (org-reveal))) + ;;; Manipulating Clocklines