From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: [PATCH] Change to next/previous-line in org agenda Date: Mon, 06 Aug 2012 17:40:44 +0800 Message-ID: <873940z7c3.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:55338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyJoB-0007Re-Od for emacs-orgmode@gnu.org; Mon, 06 Aug 2012 05:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyJoA-0005AS-HK for emacs-orgmode@gnu.org; Mon, 06 Aug 2012 05:41:07 -0400 Received: from plane.gmane.org ([80.91.229.3]:35944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyJoA-000598-Aa for emacs-orgmode@gnu.org; Mon, 06 Aug 2012 05:41:06 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SyJo7-0006X0-O9 for emacs-orgmode@gnu.org; Mon, 06 Aug 2012 11:41:03 +0200 Received: from 114.250.125.12 ([114.250.125.12]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Aug 2012 11:41:03 +0200 Received: from eric by 114.250.125.12 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Aug 2012 11:41:03 +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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit I'm not sure people will actually want this change, but I like it, so I'm providing a patch. All this does is change org-agenda-next-line and org-agenda-previous-line so that they move by agenda items, and not by actual lines. The only real drawback I can see is that, since `substitute-key-definition' is being used to rewire *all* next/previous-line definitions, it becomes a little difficult to actually move by single lines. But if that's not a big deal… Eric --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Next-previous-line-in-agenda-only-go-to-agenda-items.patch >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 --=-=-= Content-Type: text/plain -- GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.11) of 2012-08-06 on pellet 7.8.11 --=-=-=--