From cccaf5bf4badeafddc3c0b76d512d08dda8ff2a6 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 26 Jan 2020 20:54:34 +0100 Subject: [PATCH] Move up timeline functions for moving the cursor They are more fundamental than other functions, and should thus be closer to the top. --- site-lisp/timeline-tools.el | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/site-lisp/timeline-tools.el b/site-lisp/timeline-tools.el index 77da068..c29ff4b 100644 --- a/site-lisp/timeline-tools.el +++ b/site-lisp/timeline-tools.el @@ -502,6 +502,32 @@ current values of the relevant buffer local variables." (goto-char (point-min)) (timeline-tools-next-line)))) +(defun timeline-tools-next-line () + "Move point to next line in timetable, if possible." + (interactive) + (unless (eq major-mode 'timeline-tools-mode) + (user-error "Not in Timeline buffer")) + (beginning-of-line) + (let ((point (point))) + (when (looking-at "^| ") + (forward-line)) + (unless (re-search-forward "^| " nil 'no-error) + (goto-char point) + (user-error "No next line")) + (beginning-of-line))) + +(defun timeline-tools-previous-line () + "Move point to previous line in timetable, if possible." + (interactive) + (unless (eq major-mode 'timeline-tools-mode) + (user-error "Not in Timeline buffer")) + (beginning-of-line) + (let ((point (point))) + (unless (re-search-backward "^| " nil 'no-error) + (goto-char point) + (user-error "No previous line")) + (beginning-of-line))) + (defun timeline-tools--get-timeline-from-buffer () "Extract current timeline from buffer and return it. This function expects the individual lines of a timeline to be @@ -589,32 +615,6 @@ Updates category properties before constructing the new timeline." (goto-char (point-min)) (forward-line (1- linenum)))) -(defun timeline-tools-next-line () - "Move point to next line in timetable, if possible." - (interactive) - (unless (eq major-mode 'timeline-tools-mode) - (user-error "Not in Timeline buffer")) - (beginning-of-line) - (let ((point (point))) - (when (looking-at "^| ") - (forward-line)) - (unless (re-search-forward "^| " nil 'no-error) - (goto-char point) - (user-error "No next line")) - (beginning-of-line))) - -(defun timeline-tools-previous-line () - "Move point to previous line in timetable, if possible." - (interactive) - (unless (eq major-mode 'timeline-tools-mode) - (user-error "Not in Timeline buffer")) - (beginning-of-line) - (let ((point (point))) - (unless (re-search-backward "^| " nil 'no-error) - (goto-char point) - (user-error "No previous line")) - (beginning-of-line))) - ;;; Manipulating Clocklines