Inasmuch as `imenu-generic-expression` makes using Emacs’ “Imenu” simpler, it’s this triennial’s “Obscure Emacs variable of the week“.
Continue reading
Category Archives: Emacs
xslide alive!
Inasmuch as you, like me, may have missed xslide’s “Template” menu when editing XSLT using Emacs’ nXML-mode, I’ve made available my “xslide2″ XSLT mode for Emacs that I’ve been using for a while. This new xslide is a derived mode that uses nXML-mode for nearly everything and adds back some of the XSLT-specific parts of xslide.
Future development is happening on the Trac and Subversion for the xslide SourceForge project. See https://sourceforge.net/apps/trac/xslide/wiki/WikiStart.
X11 connection rejected because of wrong authentication
Inasmuch as using a frame from Emacs running on the laptop on the larger screen of the desktop machine using `make-frame-on-display' is one of life’s pleasures, it was less than a pleasure when it stopped working with a “X11 connection rejected because of wrong authentication” message after an upgrade of one of the machines.
Several upgrades and much thrashing later, the solution by Gregory Grubbs at http://gregorygrubbs.com/development/get-remote-x-working-in-karmic/ works for me, and the script in the fifth comment by Ben Hyde for running emacsclient makes things even easier than I was used to. Continue reading
Converting RNG to RNC
Inasmuch as the customised version of the “xmlspec” schema being used for the next version of the XSL spec is maintained in RELAX NG XML syntax (RNG) and Emacs’s nXML-mode only uses RELAX NG compact syntax (RNC), I yet again wanted to convert a schema from RNG to RNC. As you would expect, there’s more than one way to do it. Continue reading
xml-model processing instruction with nXML mode
Inasmuch as the <?xml-model?> processing instruction (jointly developed by W3C and ISO/IEC JTC1/SC34) is the new, standard way to associate schemas with XML documents and I already had code for using a similar, oXygen-specific PI, it was easy to make a hook function to put in your .emacs file so nXML mode will use <?xml-model?> to find a RNC schema: Continue reading
Opening EPUB in Emacs
Inasmuch as there’s not, yet, an EPUB reader for Emacs, you can still set up Emacs to be able to open .epub files to see what’s inside them, since they are, after all, just ZIP files:
(setq auto-mode-alist
(append
(list
'("\\.epub$" . archive-mode))
auto-mode-alist))
(setq auto-coding-alist
(append
(list
'("\\.epub$" . no-conversion))
auto-coding-alist))
Obscure Emacs variable of the week
`fancy-splash-image’ points to the image to show when Emacs starts up. I can think of only two groups who’d need this: the Emacs maintainers and the XEmacs maintainers who’d set it to their respective logos. So naturally I customized mine:
Linking to Trac tickets in email
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.
Emacs at 100% CPU usage with Semantic
Another computer, another instance of the Emacs 22 snapshot heading towards 100% CPU usage when Semantic is active.
The solution I tried before makes the Synaptic package manager complain about the Semantic version whenever I install any package. This time, I followed advice from the Emacs wiki and applied a patch to semantic-idle.el in place, byte-compiled the file, and moved the new .elc file over the existing .elc file (in a different directory).
It’s working fine, and Synaptic isn’t complaining.
First xslide update in years
I recently checked into CVS the addition of a sub-menu for locating xsl:function elements. It is, as the title notes, the first update of the xslide XSL mode for Emacs in literally years.
xslide itself may be a dead end since its based on neither nXML nor Semantic, so it doesn’t quite work the same as the other modes that people use (nor does it matter that it predates nXML). I still use xslide (which is why I updated it), and I even copied it to make an Emacs mode for Ant build files, but it would be more useful if it could indicate when the XSLT stylesheet is not well-formed. Then again, perhaps that problem could be solved with Flymake mode and an XML parser.