The context included when you create a task and the context included when you create a note are gained the same way. It sounds like black magic, but it turns out not to be.
All that happens is, Planner has a list of functions,
planner-annotation-functions
. When you create a task from a
buffer, or remember a note from a buffer, Planner goes through
this list from top to bottom. The first one that returns true is the
one it uses.
For example, if you're in Wanderlust, and you hit the key you've bound
to planner-create-task-from-buffer
, it looks at this list and
does something like this. Is it an ERC buffer? No. Is it a BBDB
buffer? No. Are we in w3m? No. Are we in Wanderlust? Yes. So this
function succeeds. It stops searching and runs the annotation function
for Wanderlust, which in this case finds out who the message is from
and what the message ID of the message is. It then takes those and
constructs a link back to that message, with a link title something
like ‘Email from Joe Blogs’.
So, you've read the email from Joe Blogs. He's asked you to do something and you've hit your key to add that task to your list of things to do. So what you end up with is a description of the task, and a link back to what made you create the task in the first place.
The same happens with remembering notes, except that it ends up in the ‘* Notes’ section of your page instead.
To change the behavior of annotations, customize the following options:
A list of functions tried in order by planner-create-task-from-buffer and other functions that pick up context. The first non-nil value returned is used as the annotation. To cause an item to not be annotated, return the empty string ‘""’.
File links are usually generated with the full path to the file so that you can easily tell apart files with the same base name. If
planner-annotation-strip-directory
is non-nil, though, only the base name of the file will be displayed. For example, a link to ‘/foo/bar/baz’ will be displayed as ‘baz’ and hyperlinked to the file.
If t, always use relative filenames.
planner-annotation-use-relative-file
can also be a function that takes the filename and returns non-nil if the link should be relative. Filenames are resolved relative to the first directory of your Planner project inmuse-project-alist
. That is, the created link will be of the form ‘../../somefile’ instead of ‘/absolute/path/to/file’. This can be helpful if you publish your planner files to the Net and your directory structure ensures that relative links resolve the same from your Plan pages and their respective publishing directory.