Ver Fonte

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.
Bastien Guerry há 11 anos atrás
pai
commit
1fad782491
1 ficheiros alterados com 12 adições e 10 exclusões
  1. 12 10
      lisp/org-agenda.el

+ 12 - 10
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))))