# Org agenda - toggle TODO state backwards?

In org agenda mode, pressing t advances the TODO state of the item one step forward (to the next TODO keyword in order).

How can I add a binding to move the TODO state backwards by one step? I have a setup with several states, and advancing one step too far is very annoying as I have to toggle all states until I restore the previous state.

org-agenda-todo-previousset should do what you want by shifting the TODO state backwards. From the docstring:

Switch TODO entry to previous sequence.

By default it's bound to C-S-left. You can set it to a different binding with

(require 'org-agenda) (define-key org-agenda-mode-map "y" 'org-agenda-todo-previousset)

which would set y to call the function (note y is already bound to org-agenda-year-view by default, you may want to choose another key).

• Unfortunately this is not accurate. Given this setting: (setq org-todo-keywords '((sequence "TODO" "PENDING" "NEXT" "DOING" "|" "VERIFY" "DONE" "DELEGATED"))), and the state of DOING, C-S-<left> resets the state to TODO... – vmalloc Mar 8 '17 at 7:16

You can also use org-use-fast-todo-selection and define shortcut keys to your TODO states. Then when you hit t in your agenda you'll be prompted for a second character to pick the specific TODO state you want.

I believe fast selection is enabled by default, so you may just need to tweak the definition of your TODO states. See Fast access to TODO states in the org manual for more -- you can either configure your org-todo-states globally or use the in-buffer #TODO setting,

With the default bindings, that would allow you to use t followed by another key to jump to a specific state; or you can use C-S-left and C-S-right to switch states according to the defined sequence.