Since I do a lot of referring to Trac ticket numbers in email messages, most visibly on the xmlroff-list mailing list, I wrote an Emacs function that finds the Trac ticket references in the current buffer and inserts a sorted list of the ticket references and their URLs at the end of the buffer.
The code (if WordPress hasn’t done too much damage to it) is:
(defvar trac-base "http://xmlroff.org" "Base to use when inserting links to trac tickets in email.") (defun trac-base-xmlroff () (interactive) (setq trac-base "http://xmlroff.org") (message trac-base)) (defun insert-trac-links () "Insert links for Trac links." (interactive) (let ((ticket-alist) (changeset-alist '())) (goto-char (point-min)) (while (re-search-forward "#([0-9]+)" nil t) (setq ticket-alist (add-to-list 'ticket-alist (string-to-number (buffer-substring-no-properties (match-beginning 1) (match-end 1)))))) (goto-char (point-max)) (insert "\\n") (dolist (ticket (sort ticket-alist '<)) (insert (format "#%s %s/ticket/%s\\n" ticket trac-base ticket)))))
I have a separate
`trac-base-xxx' function for setting
`trac-base' for each Trac that I regularly use, and I use GNUS customizations to call the appropriate
`trac-base-xxx' function when I enter specific email folders.