ichernyshovvv / org-timeblock

Schedule your day visually, using timeblocking technique inside Emacs
GNU General Public License v3.0
275 stars 18 forks source link

same window for following links on a timeblock #10

Closed balaramadurai closed 1 year ago

balaramadurai commented 1 year ago

What TAB does is to split a window and work. Similar to org-agenda, we could do the same functionality with RET, but will use the same window as the org-timeblock.

ichernyshovvv commented 1 year ago

Why such a big diff?

balaramadurai commented 1 year ago

I tried it twice using the github code editor. Same results. The warning I got is CR and LF from the format and it was automatically changing those. arrgghhh...

The code diff is the following: (define-key map (kbd "<RET>") 'ot-goto-same-window)

(define-key map (kbd "<RET>") 'ot-list-goto-same-window)

(defun ot-list-goto-same-window () "Jump to the org heading of the entry at point in the same window." (interactive) (unless (eq major-mode 'org-timeblock-list-mode) (user-error "Not in *org-timeblock-list* buffer")) (let ((marker (get-text-property (point) 'marker))) (pop-to-buffer-same-window (marker-buffer marker)) (goto-char (marker-position marker)) (ot-show-context) (recenter)))

(defun ot-goto-same-window () "Jump to the org heading of selected timeblock in the same window." (interactive) (unless (eq major-mode 'org-timeblock-mode) (user-error "Not in *org-timeblock* buffer")) (goto-char (point-min)) (search-forward "</rect>" nil t) (when (re-search-forward (format "<rect .*? id=\"\\([^\"]+\\)\" fill=\"%s\"" ot-sel-block-color) nil t) (when-let ((inhibit-read-only t) (id (match-string-no-properties 1)) (m (cadr (seq-find (lambda (x) (string= (car x) id)) ot-data)))) (pop-to-buffer-same-window (marker-buffer m)) (goto-char (marker-position m)) (ot-show-context) (recenter))))

Hope this helps

ichernyshovvv commented 1 year ago

Thanks for the suggestion. See https://github.com/ichernyshovvv/org-timeblock/commit/06cf24f5db68e84869e6931c30698ba4ead6bc22