From dbb39680097b21882f6bafb65b3fc6548de93496 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Mon, 6 Aug 2012 17:31:52 +0800 Subject: [PATCH] Next/previous-line in agenda only go to agenda items. --- lisp/org-agenda.el | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index dd2c98e..1e2cbfd 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7245,17 +7245,21 @@ When called with a prefix argument, include all archive files as well." (get-text-property (max (point-min) (1- (point))) 'org-agenda-type)))) -(defun org-agenda-next-line () - "Move cursor to the next line, and show if follow mode is active." - (interactive) - (call-interactively 'next-line) - (org-agenda-do-context-action)) - -(defun org-agenda-previous-line () - "Move cursor to the previous line, and show if follow-mode is active." - (interactive) - (call-interactively 'previous-line) - (org-agenda-do-context-action)) +(defun org-agenda-next-line (n) + "Move cursor to next agenda item." + (interactive "p") + (let ((backward (< n 0)) + (count (or (abs n) 1))) + (while (> count 0) + (next-line (when backward -1)) + (org-agenda-do-context-action) + (when (org-get-at-bol 'org-marker) + (setq count (1- count)))))) + +(defun org-agenda-previous-line (n) + "Move cursor to next agenda item." + (interactive "p") + (org-agenda-next-line (- n))) (defun org-agenda-do-context-action () "Show outline path and, maybe, follow mode window." -- 1.7.11.4