summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-11-04 23:36:18 +0100
committerBastien Guerry <bzg@altern.org>2013-11-04 23:36:18 +0100
commit1fad782491d5065a39695c6668072775138a6532 (patch)
treeeeb94bf33cb72caaeec6208681622ee2b69469a3
parent2a95f5e40958d7b9e79e5ad64eb24507c9d638d5 (diff)
downloadorg-mode-1fad782491d5065a39695c6668072775138a6532.tar.gz
org-agenda.el (org-agenda-drag-line-forward): Fix bugs
* org-agenda.el (org-agenda-drag-line-forward) (org-agenda-drag-line-backward): Fix bugs: don't drag lines without text and don't drag lines before/after hidden lines. Thanks to Thomas Morgan for reporting bugs in this area.
-rw-r--r--lisp/org-agenda.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 8cfe858..bd19cc5 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9913,11 +9913,12 @@ current HH:MM time."
"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))
+ (if (or (not (get-text-property (point) 'txt))
+ (save-excursion
+ (dotimes (n arg)
+ (move-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))))
@@ -9925,11 +9926,12 @@ current HH:MM time."
"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))
+ (if (or (not (get-text-property (point) 'txt))
+ (save-excursion
+ (dotimes (n arg)
+ (move-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))))