Made some corrections in the text below (marked with red). Also, removed the unnecessary "some text" from the body of baz1 item, as the issue can reproduce without it. On Sun, 16 Aug 2020 at 16:01, Dinnyés Dániel wrote: > I have tried reproducing it with a minimal example, and this works for me: > > * FOO > ** TODO baz1 > SCHEDULED: <2020-08-16 Sun> > > * BAR > ** TODO baz2 > SCHEDULED: <2020-08-16 Sun> > *** DONE baz3 > SCHEDULED: <2020-08-16 Sun> > *** TODO baz4 > SCHEDULED: <2020-08-16 Sun> > > When in the agenda, on the front line of item baz1, setting it to DONE > state works fine. > OTOH, when going to the end of the line on the item baz1, trying to set > it to DONE results in the error message: > TODO state change from TODO to DONE blocked (by "TODO baz4") > > Also, I have (org-enforce-todo-dependencies t), which causes the blocking, > and (org-agenda-dim-blocked-tasks (quote invisible)), which hides baz2 > from the agenda... because of this baz1 is followed directly by baz4 in > my agenda window. > > Since baz4 is not a direct / transitive dependency to baz1, this blocking > shouldn't happen. > I assume this happening has something to do with their closeness in the > agenda ordering, and the cursor position. > Maybe the org-agenda-todo function somehow gets "confused" by running it at > the end of the line in the agenda. > Just for completeness, this is a snapshot of my lengthy org configuration: > (use-package org > :init > (defun org-archive-done-tasks () > "Archive all DONE and CANCELED tasks in the subtree of the current > entry" > (interactive) > (org-map-entries > (lambda () > (org-archive-subtree) > (setq org-map-continue-from (outline-previous-heading))) > "//DONE|CANCELED" 'agenda)) > :bind > (("C-c a" . org-agenda) > ("C-c k" . org-capture) > :map org-mode-map > ("C-c H" . org-archive-done-tasks) > ("C-c e" . org-babel-execute-src-block)) > :hook > (text-mode . visual-line-mode) > :config > (custom-set-variables > '(org-agenda-span 'day) > '(org-startup-indented t) > '(org-startup-folded nil) > '(org-directory "~/Workspace/org/") > '(org-agenda-files (list org-directory)) > '(org-archive-location "archives.org::datetree/* %s") > '(org-agenda-diary-file (concat org-directory "diary.org")) > '(org-agenda-include-diary t) > '(org-deadline-warning-days 7) > '(org-agenda-skip-deadline-prewarning-if-scheduled 'pre-scheduled) > '(org-agenda-skip-scheduled-if-deadline-is-shown t) > '(org-agenda-skip-scheduled-if-done t) > '(org-agenda-todo-ignore-scheduled 'future) > '(org-agenda-tags-todo-honor-ignore-options t) > ;; set SCHEDULED and DEADLINE leaders in agenda view > '(org-agenda-deadline-leaders (quote ("Deadline! " "In %d days: " > "Late %d days: "))) > '(org-agenda-scheduled-leaders (quote ("Scheduled! " "For %d days: "))) > '(org-agenda-window-setup 'only-window) > '(org-todo-keywords > (quote ((sequence "TODO(t!)" "ONGOING(o!)" "WAITING(w@)" "|" "DONE(d@)" > "CANCELED(c@)")))) > '(org-todo-keyword-faces > (quote (("WAITING" . "purple") > ("ONGOING" . "orange") > ("CANCELED" . "firebrick")))) > ;; set ARCHIVE tag when todo state is set to CANCELED, and remove when > reset to TODO > `(org-todo-state-tags-triggers > (quote > ((todo . ((,org-archive-tag . nil))) > ("CANCELED" . ((,org-archive-tag . t)))))) > '(org-tag-persistent-alist > '(("TARGET" . ?t))) > '(org-tags-exclude-from-inheritance (quote ("TARGET"))) > ;; REFILE BEHAVIOUR > '(org-refile-targets > '((nil . (:level . 1)) > (nil . (:tag . "TARGET")))) > '(org-refile-use-outline-path t) > '(org-goto-interface 'outline-path-completion) > '(org-outline-path-complete-in-steps t) > ;; prefer in-steps that ido for refile completion > ;; '(org-completion-use-ido t) > '(org-reverse-note-order t) > > ;; LOGGING > ;; todo state changes should be logged into drawer > '(org-log-into-drawer t) > ;; log when schedule or deadline changes > '(org-log-redeadline (quote time)) > '(org-log-reschedule (quote time)) > ;;'(org-log-refile (quote time)) ; logs even when refiled during capture > > ;; PRIORITIES > '(org-priority-start-cycle-with-default t) > '(org-default-priority 70) > '(org-lowest-priority 70) > '(org-highest-priority 65) > '(org-agenda-sorting-strategy > '((agenda time-up todo-state-down priority-down) > (todo category-up priority-down) > (tags category-up priority-down) > (search category-up))) > > ;; DEPENDENCIES > '(org-enforce-todo-dependencies t) > '(org-enforce-todo-checkbox-dependencies t) > '(org-agenda-dim-blocked-tasks (quote invisible)) > > ;; CUSTOM COMMANDS > '(org-agenda-custom-commands > '(("c" . "Custom commands") > ("cb" "Backlog (tasks not scheduled)" todo "TODO" > ((org-agenda-skip-function > '(org-agenda-skip-entry-if 'scheduled)))) > ("cc" . "Filter tasks by CATEGORY") > ("cci" "INBOX tasks" > ((alltodo "")) > ((org-agenda-category-filter-preset '("+INBOX")))) > ("ccf" "INFRA tasks" > ((alltodo "")) > ((org-agenda-category-filter-preset '("+INFRA")))) > ("ccr" "ROLES tasks" > ((alltodo "")) > ((org-agenda-category-filter-preset '("+ROLES")))))) > > ;; CAPTURE TEMPLATES > '(org-capture-templates > (quote > (("t" "Task") > ("tt" "Task (Scheduled)" entry > (file+headline "tasks.org" "INBOX") > "* TODO %^{Title}\nSCHEDULED: %t\n%?") > ("td" "Task (Scheduled, with Deadline)" entry > (file+headline "tasks.org" "INBOX") > "* TODO %^{Title}\nSCHEDULED: %^{Schedule}t DEADLINE: %^{Deadline}t\n%?") > ("e" "Event") > ("et" "Event (with single datetime)" entry > (file+headline "events.org" "INBOX") > "* %^{Title}\n%^T\n%?") > ("er" "Event (with date range)" entry > (file+headline "events.org" "INBOX") > "* %^{Title}\n%^t--%^t\n%?") > ("m" "Memo" entry > (file+headline "memo.org" "INBOX") > "* %?\n%T\n") > ("x" "Example" entry > (file+headline "example.org" "INBOX") > "* %?\n%^t\n")))))) > > Regards, > Daniel > > On Sun, 16 Aug 2020 at 12:38, Ihor Radchenko wrote: > >> > Using Emacs 26.3 with a vanilla configuration and the Org repo checked >> > out at 5e4542d69 (the commit reported in the subject line), I didn't see >> > the behavior you describe. With point at the end of the agenda line for >> > A, the state was changed for A. >> >> I think that may happen when you have agenda filter active and an entry >> hidden by filter is between the current and next line. >> >> Best, >> Ihor >> >> >> Kyle Meyer writes: >> >> > Dinnyés Dániel writes: >> > >> >> While in the Org Agenda, and navigating to the end of line for a given >> item >> >> (assuming more than one todo items), and calling org-agenda-todo (with >> >> keybindings t, or C-c C-t)... this result in the call being applied to >> the >> >> next line item, instead of the one the cursor is on. >> >> >> >> This only happens when the cursor is at the end of the line. >> >> >> >> I would consider this to be a bug. >> > >> > I tried using the following content as the agenda file: >> > >> > * TODO A >> > * TODO B >> > >> > Using Emacs 26.3 with a vanilla configuration and the Org repo checked >> > out at 5e4542d69 (the commit reported in the subject line), I didn't see >> > the behavior you describe. With point at the end of the agenda line for >> > A, the state was changed for A. >> > >> > I also can't trigger the behavior with the master branch checked out. >> >