org-agenda-before-sorting-filter-function

org-agenda-before-sorting-filter-function is a variable defined in `org-agenda.el'.
Its value is
nil

  • This variable may be risky if used as a file-local variable.

Documentation:
Function to be applied to agenda items prior to sorting.
Prior to sorting also means just before they are inserted into the agenda.

To aid sorting, you may revisit the original entries and add more text
properties which will later be used by the sorting functions.

The function should take a string argument, an agenda line.
It has access to the text properties in that line, which contain among
other things, the property `org-hd-marker' that points to the entry
where the line comes from. Note that not all lines going into the agenda
have this property, only most.

The function should return the modified string. It is probably best
to ONLY change text properties.

You can also use this function as a filter, by returning nil for lines
you don't want to have in the agenda at all. For this application, you
could bind the variable in the options section of a custom command.