The state change is done by the function org-agenda-todo
which goes to the buffer and does (org-show-context 'agenda)
. The doc string for org-show-context
says:
Make sure point and context are visible.
Optional argument KEY, when non-nil, is a symbol. See
‘org-show-context-detail’ for allowed values and how much is to
be shown.
That leads us to the variable org-show-context-detail
whose doc string in turn says:
org-show-context-detail is a variable defined in ‘org.el’.
Its value is
((agenda . local)
(bookmark-jump . lineage)
(isearch . lineage)
(default . ancestors))
You can customize this variable.
This variable was introduced, or its default value was changed, in
version 26.1 of Emacs.
Documentation:
Alist between context and visibility span when revealing a location.
Some actions may move point into invisible
locations. As a consequence, Org always expose a neighborhood
around point. How much is shown depends on the initial action,
or context. Valid contexts are
agenda when exposing an entry from the agenda
org-goto when using the command ‘org-goto’ (‘C-c C-j’)
occur-tree when using the command ‘org-occur’ (‘C-c / /’)
tags-tree when constructing a sparse tree based on tags matches
link-search when exposing search matches associated with a link
mark-goto when exposing the jump goal of a mark
bookmark-jump when exposing a bookmark location
isearch when exiting from an incremental search
default default for all contexts not set explicitly
Allowed visibility spans are
minimal show current headline; if point is not on headline,
also show entry
local show current headline, entry and next headline
ancestors show current headline and its direct ancestors; if
point is not on headline, also show entry
lineage show current headline, its direct ancestors and all
their children; if point is not on headline, also show
entry and first child
tree show current headline, its direct ancestors and all
their children; if point is not on headline, also show
entry and all children
canonical show current headline, its direct ancestors along with
their entries and children; if point is not located on
the headline, also show current entry and all children
As special cases, a nil or t value means show all contexts in
‘minimal’ or ‘canonical’ view, respectively.
Some views can make displayed information very compact, but also
make it harder to edit the location of the match. In such
a case, use the command ‘org-reveal’ (‘C-c C-r’) to show
more context.
So you can customize the agenda
pair and make the visibility span of the agenda context something other than local
. E.g. you can make it minimal
with something like this:
(setq org-show-context-detail (assq-delete-all 'agenda org-show-context-detail))
(add-to-list 'org-show-context-detail '(agenda . minimal))
The listed visibility spans are the only values provided however, so if you don't like any of them, you will have to implement your own.