A few weeks ago I learnt about bug-reference-mode, a neat little Emacs
minor-mode that automatically links text to a bug tracker. A few of my projects
use bug trackers or GitHub issues, and different clients often have their own
systems.
There are two variables that I usually want to set for bug-reference-mode:
bug-reference-url-format- The URL of an individual bug, with
%sused as a placeholder for the bug ID. bug-reference-bug-regexp- The regular expression that finds bug ID
references. This is usually something like
#1234.
I use directory local variables1 for a lot of projects, but Emacs also
supports file local variables for more fine-grained settings. org-mode has its
own syntax for setting file local variables, so I needed to adjust things
slightly to get it all working.
Setting local variables for a bug tracker looks like this:
# Local Variables:
# mode: org
# bug-reference-url-format: "https://example.org/tasks/%s"
# bug-reference-bug-regexp: "\\(#\\)\\([0-9]\\{8\\}\\)"
# End:
On my first attempt I skipped the Local Variables: and End: keywords, but
they are needed for org to pick these variables up.
Footnotes:
These are variables that are set for all files in a directory and its sub-directories.
3 Comments
Nice! Do you know of any way to make
bug-reference-modelinks show up also when exporting fromorg-mode?Hi jco,
As far as I know there's no way to do that with the standard
org-modeexporter. It might be possible with a bit of elisp, but it's not something I've ever done.This article has some info on customizing the exporter which might be helpful: https://www.gonsie.com/blorg/org-highlight.html
Cheers, Phil
Neat trick with the local variables, it makes
bug-reference-modeeven more useful! I might have to steal that :-)