summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-04-17 18:25:02 (GMT)
committer Bastien Guerry <bzg@altern.org>2013-04-17 18:25:02 (GMT)
commit937b4484c6a825b42529b774b8a98206119e5cd8 (patch)
treed3d2d3b46ab0c3b614e5b8521e471d4715ff8063
parentb335a4fa34dd33850c9c077943f3bd88eb6894b7 (diff)
downloadorg-mode-937b4484c6a825b42529b774b8a98206119e5cd8.zip
org-mode-937b4484c6a825b42529b774b8a98206119e5cd8.tar.gz
org-agenda.el: New commands for dragging a line forward/backward
* org-agenda.el (org-agenda-drag-line-forward) (org-agenda-drag-line-backward): New commands. (org-agenda-mode-map): Bind the new commands to M-<down> and M-<up> respectively. * org.texi (Agenda commands): Add a table heading for dragging agenda lines forward/backward.
-rw-r--r--doc/org.texi11
-rw-r--r--lisp/org-agenda.el28
2 files changed, 39 insertions, 0 deletions
diff --git a/doc/org.texi b/doc/org.texi
index 4e6c2db..69d70bd 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8913,6 +8913,17 @@ the default behavior of @code{org-capture}.
@cindex capturing, from agenda
@vindex org-capture-use-agenda-date
+@tsubheading{Dragging agenda lines forward/backward}
+@cindex dragging, agenda lines
+
+@orgcmd{M-<up>,org-agenda-drag-line-backward}
+Drag the line at point backward one line. With a numeric prefix argument,
+drag backward by that many lines.
+
+@orgcmd{M-<down>,org-agenda-drag-line-forward}
+Drag the line at point forward one line. With a numeric prefix argument,
+drag forward by that many lines.
+
@tsubheading{Bulk remote editing selected entries}
@cindex remote editing, bulk, from agenda
@vindex org-agenda-bulk-custom-functions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index f13e6ed..607269d 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -2182,6 +2182,8 @@ The following commands are available:
(org-defkey org-agenda-mode-map "\C-m" 'org-agenda-switch-to)
(org-defkey org-agenda-mode-map "\C-k" 'org-agenda-kill)
(org-defkey org-agenda-mode-map "\C-c\C-w" 'org-agenda-refile)
+(org-defkey org-agenda-mode-map [(meta down)] 'org-agenda-drag-line-forward)
+(org-defkey org-agenda-mode-map [(meta up)] 'org-agenda-drag-line-backward)
(org-defkey org-agenda-mode-map "m" 'org-agenda-bulk-mark)
(org-defkey org-agenda-mode-map "\M-m" 'org-agenda-bulk-toggle)
(org-defkey org-agenda-mode-map "*" 'org-agenda-bulk-mark-all)
@@ -9880,6 +9882,32 @@ current HH:MM time."
(org-get-cursor-date (equal with-time 1))))
(call-interactively 'org-capture))))
+;;; Dragging agenda lines forward/backward
+
+(defun org-agenda-drag-line-forward (arg)
+ "Drag an agenda line forward by ARG lines."
+ (interactive "p")
+ (let ((inhibit-read-only t) lst)
+ (if (save-excursion
+ (dotimes (n arg)
+ (beginning-of-line 2)
+ (push (not (get-text-property (point) 'txt)) lst))
+ (delq nil lst))
+ (message "Cannot move line forward")
+ (org-drag-line-forward arg))))
+
+(defun org-agenda-drag-line-backward (arg)
+ "Drag an agenda line backward by ARG lines."
+ (interactive "p")
+ (let ((inhibit-read-only t) lst)
+ (if (save-excursion
+ (dotimes (n arg)
+ (beginning-of-line 0)
+ (push (not (get-text-property (point) 'txt)) lst))
+ (delq nil lst))
+ (message "Cannot move line backward")
+ (org-drag-line-backward arg))))
+
;;; Flagging notes
(defun org-agenda-show-the-flagging-note ()