org-agenda.el: Fix bug when using `org-agenda-do-date-later' in filtered agendas

* org-agenda.el (org-agenda-filter-hide-line): Hide from the
beginning of the line to the beginning of the next line.
(org-agenda-show-new-time): Use `move-beginning-of-line' and
`move-end-of-line'.
(org-agenda-drag-line-forward): Adapt to the new definition of
hidden filtered lines.

Thanks to Igor Sosa Mayor for reporting this bug and to Nick Dokos
and Matt Lundin for providing further information.
This commit is contained in:
Bastien Guerry 2014-03-20 17:07:03 +01:00
parent a3ec854cab
commit 3559ff84b2

View file

@ -7658,8 +7658,8 @@ When NO-OPERATOR is non-nil, do not add the + operator to returned tags."
(defun org-agenda-filter-hide-line (type) (defun org-agenda-filter-hide-line (type)
"Hide lines with TYPE in the agenda buffer." "Hide lines with TYPE in the agenda buffer."
(let (ov) (let (ov)
(setq ov (make-overlay (max (point-min) (1- (point-at-bol))) (setq ov (make-overlay (max (point-min) (point-at-bol))
(point-at-eol))) (1+ (point-at-eol))))
(overlay-put ov 'invisible t) (overlay-put ov 'invisible t)
(overlay-put ov 'type type) (overlay-put ov 'type type)
(cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays)) (cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays))
@ -9177,8 +9177,8 @@ Called with a universal prefix arg, show the priority instead of setting it."
(1- (point)) (point-at-eol) (1- (point)) (point-at-eol)
(list 'display (org-add-props stamp nil (list 'display (org-add-props stamp nil
'face 'secondary-selection)))) 'face 'secondary-selection))))
(beginning-of-line 1)) (move-beginning-of-line 1))
(beginning-of-line 0))))) (move-beginning-of-line 0)))))
(defun org-agenda-date-prompt (arg) (defun org-agenda-date-prompt (arg)
"Change the date of this item. Date is prompted for, with default today. "Change the date of this item. Date is prompted for, with default today.
@ -9940,23 +9940,25 @@ current HH:MM time."
"Drag an agenda line forward by ARG lines. "Drag an agenda line forward by ARG lines.
When the optional argument `backward' is non-nil, move backward." When the optional argument `backward' is non-nil, move backward."
(interactive "p") (interactive "p")
(let ((inhibit-read-only t) lst line) (let ((inhibit-read-only t) lst)
(if (or (not (get-text-property (point) 'txt)) (if (or (not (get-text-property (point) 'txt))
(save-excursion (save-excursion
(dotimes (n arg) (dotimes (n arg)
(move-beginning-of-line (if backward 0 2)) (move-beginning-of-line (if backward 0 2))
(forward-char 1)
(push (not (get-text-property (point) 'txt)) lst)) (push (not (get-text-property (point) 'txt)) lst))
(delq nil lst))) (delq nil lst)))
(message "Cannot move line forward") (message "Cannot move line %s" (if backward "backward" "forward"))
(let ((end (save-excursion (move-beginning-of-line 2) (point)))) (let ((end (save-excursion (move-end-of-line 1) (point)))
(col (current-column)) line)
(move-beginning-of-line 1) (move-beginning-of-line 1)
(setq line (buffer-substring (point) end)) (setq line (buffer-substring (point) end))
(delete-region (point) end) (delete-region (point) (1+ end))
(move-beginning-of-line (funcall (if backward '1- '1+) arg)) (move-end-of-line (funcall (if backward '1- '1+) (1- arg)))
(insert line) (insert "\n" line)
(org-move-to-column col)
(org-agenda-reapply-filters) (org-agenda-reapply-filters)
(org-agenda-mark-clocking-task) (org-agenda-mark-clocking-task)))))
(move-beginning-of-line 0)))))
(defun org-agenda-drag-line-backward (arg) (defun org-agenda-drag-line-backward (arg)
"Drag an agenda line backward by ARG lines." "Drag an agenda line backward by ARG lines."