* [PATCH] Change to next/previous-line in org agenda
@ 2012-08-06 9:40 Eric Abrahamsen
2012-08-07 21:13 ` Bastien
0 siblings, 1 reply; 3+ messages in thread
From: Eric Abrahamsen @ 2012-08-06 9:40 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Next-previous-line-in-agenda-only-go-to-agenda-items.patch --]
[-- Type: text/x-patch, Size: 1607 bytes --]
From dbb39680097b21882f6bafb65b3fc6548de93496 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
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
[-- Attachment #3: Type: text/plain, Size: 100 bytes --]
--
GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.11)
of 2012-08-06 on pellet
7.8.11
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Change to next/previous-line in org agenda
2012-08-06 9:40 [PATCH] Change to next/previous-line in org agenda Eric Abrahamsen
@ 2012-08-07 21:13 ` Bastien
2012-08-08 4:25 ` Eric Abrahamsen
0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2012-08-07 21:13 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hi Eric,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> 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.
I like it too -- I implemented it differently, but this is the same
idea. You can now use ̀N' and `P' to go to the next/previous agenda
item. `2 N' will move by two agenda items down.
Thanks for this idea,
--
Bastien
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Change to next/previous-line in org agenda
2012-08-07 21:13 ` Bastien
@ 2012-08-08 4:25 ` Eric Abrahamsen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2012-08-08 4:25 UTC (permalink / raw)
To: emacs-orgmode
On Wed, Aug 08 2012, Bastien wrote:
> Hi Eric,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> 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.
>
> I like it too -- I implemented it differently, but this is the same
> idea. You can now use ̀N' and `P' to go to the next/previous agenda
> item. `2 N' will move by two agenda items down.
>
> Thanks for this idea,
Great! Looks like I have more to learn about org internals…
--
GNU Emacs 24.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.11)
of 2012-08-06 on pellet
7.8.11
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-08-08 4:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 9:40 [PATCH] Change to next/previous-line in org agenda Eric Abrahamsen
2012-08-07 21:13 ` Bastien
2012-08-08 4:25 ` Eric Abrahamsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).