elisp
Compilation queue (cq.el)
By voyager - Posted on October 6th, 2008
The following is part of my home-grown compilation environment in emacs.
(defvar funclist) (defvar cq-compilation-started 'nil) (defun cg-init () (setq compilation-finish-functions 'cq-call) ;; this function called when compilation has finished - see compile.el (setq compilation-exit-message-function (lambda (status code msg) ;; If M-x compile exists with a 0 (when (and (eq status 'exit) (zerop code)) ;; then bury the *compilation* buffer, so that C-x b doesn't go there (bury-buffer "*compilation*")
XML processing in Elisp
By voyager - Posted on August 26th, 2008
Recent versions Emacs has built in xml support, and there are libraries available that give you DOM and even XPath capabilities. I've started experimenting with it as I want to process Eclipse Workspaces. Ideally, I should be using XPath, but that has too many dependencies for now (it depends on parts of Semantic).
So, using the xml-parse examples on EmacsWiki.org, here is some simple code to get a the "userid" attibutes from all the "to" elements of the following xml data:
<?xml version="1.0" encoding="ISO-8859-1"?> <note topic="weekend plans"> <to userid="1">Tove</to> <from userid="2">Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> <to userid="3">Bob</to> <from userid="4">Sammy</from> <heading>Alas!</heading> <body>A new week!</body> </note>
Get list of files referenced in tags table
By voyager - Posted on August 10th, 2008
(defun tagutils-get-file-list ()
"Returns a list of files referenced in the tags table"
(interactive)
(if (visit-tags-table-buffer)
(progn
(tags-table-files)
(mapcar 'expand-file-name (tags-table-files))))
)
