3

Is there a way to integrate Trac and Emacs? e.g. edit Wiki pages in org mode, edit and manage tickets from within emacs?

3

There is a Trac Wiki page editing mode for Emacs. It is supposed to ease editing Trac Wiki pages but also help with diffing, merging, highlighting and completion.

It is also mentioned at the EmacsWiki and in a blog post.

0

Personally for ticket management I use a dirty script in org-babel-python that would retrieve the list of tickets inline, into my org page:

#+begin_src python :results output
base_url = "http://your.trac.site.url"
ticket_list_url = "http://your.trac.site/query?..."
headers = {"Cookie": "trac_form_token=token-from-browser-session; trac_auth=your-auth-from-browser-session"}

import requests
tasks_html = requests.get(ticket_list_url, headers=headers)

from HTMLParser import HTMLParser

class MyHtmlParser(HTMLParser):
  in_link = False
  link_href = None

  def handle_starttag(self, tag, attrs):
    attrs = dict(attrs)
    if tag == "a" and attrs["href"].startswith("/ticket"):
      self.in_link = True
      self.link_href = attrs["href"]
    else:
      self.in_link = False

  def handle_data(self, data):
    data = data.strip()
    if self.in_link and data and not data.startswith("#"):
      ticket_num = self.link_href[8:]
      print "*** #" + ticket_num + " [[" + base_url + self.link_href + "][" + data + "]]"

MyHtmlParser().feed(tasks_html.text)

#+end_src

The script requires pip install requests plus org-babel with python enabled. Plus you need to set your *_url & set auth headers from your browser session.

Org-babel scripts can be run with C-c C-c

Just in case someone needs a dirty solution for listing tickets from trac in an org page..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.