Answers for nagging little questions

July 26, 2016

The https://discuss.gradle.org/t/tips-for-gradle-emacs-compilation-mode-integration/357" regexp didn't work for me. This one seems to be a bit better:

(add-to-list 'compilation-error-regexp-alist '("^:\\w+:\\w+\\(/.+\\):\\([0-9]+\\)" 1 2 3))

December 25, 2015

To restore something similar to the old hg glog command in Mercurial, add the following to <file:///~/.hgrc>

: [alias] glog = log --style compact -G
September 8, 2015

When running Emacs under screen, the C-s can invoke the old TTY control flow mechanism. To disable in a given screen session enter the following sequence:

C-a :flow off

To disable permanently place:

defflow off

in the ~/.screenrc

March 29, 2010

The base Java distribution (as of JRE6) does not include a method to URI decode a string, a common enough operation in these web-centric times. Or at least it doesn't include such functionality documented explicitly even though the algorithim for decoding non-URI scheme specific encodings is present in the java.net.URI. The following function will work for most of what one typically needs decoded in WWW forms by getting this builtin class to decode a given string string:

import java.net.URI; import java.net.URISyntaxException; public String decodeURIString(String encoded) { try { URI uri = new URI("?" + encoded); return uri.getQuery(); } catch (URISyntaxException e) {} return null; // Error }

Input to this method of the form "space%20between%0a%0dthe%20lines" comes back as "space between\n\rthe lines".

Encoding a URI string may be accomplished with the toASCIIString() method by calling the constructor which takes the query argument implicitly:

import java.net.URI; import java.net.URISyntaxException; public String encodeURIString(String decoded) { try { URI uri = new URI(null, null, null, decoded, null); return uri.toASCIIString().substring(1); // skip prefixed "?" } catch (URISyntaxException e) {} return null; // Error }

January 4, 2010

Even though nXML mode is now included by default in emacs-23, it isn't always activated as the mode for visiting XML files. The following snippet increasing Emacs's default use of nXML for a) files with begin with a '<<?xml' declaration, b) for files that have the extensions '.xml', '.wsdd', '.wsdl', '.xsd', and '.xslt', and c) replaces the default invocation of xml-mode with nxml-mode in all files.

(add-to-list 'magic-mode-alist '("<\\?xml" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.wsdd$" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.wsdl$" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.xsd$" . nxml-mode)) (add-to-list 'auto-mode-alist '("\\.xslt$" . nxml-mode)) (setcdr (rassoc 'xml-mode auto-mode-alist) 'nxml-mode)

May 14, 2009

Following the 'Everything Emacs' for tooling in developing for Common Lisp entails browsing the Hyperspec from within Emacs as well. Using MacPorts install 'lisp-hyperspec' and 'emacs-w3m' ('emacs-w3m' will install 'w3m' as a dependency) via:

osx$ sudo port install lisp-hyperspec emacs-w3m

Then the following code in '.emacs' ocurring after the relevant SLIME initialization code, will invoke the W3m browser on the local Hyperspec when SLIME-HYPERSPEC-LOOKUP is invoked:

(require 'cl) (pushnew "/opt/local/share/emacs/site-lisp/w3m" load-path) (require 'w3m-load) (setq common-lisp-hyperspec-root "file:///opt/local/share/doc/lisp/HyperSpec-7-0/HyperSpec/") (setq browse-url-browser-function '(("hyperspec" . w3m-browse-url) ("," . browse-url-default-browser)))

November 5, 2008

A tip from http://www.skybert.nu/cgi-bin/viewpage.py.cgi?computers+emacs+maven on how to get Emacs to parse Maven2 (aka 'Maven' and 'mvn') to parse source code error locations.

(require 'compile) (setq compilation-error-regexp-alist (append (list ;; works for maven '("^\\(.*\\):\\[\\([0-9]*\\),\\([0-9]*\\)\\]" 1 2 3)) compilation-error-regexp-alist))

September 18, 2008

For updating OpenSolaris 2008.05 (aka build 86), after updating the initial install the GRUB entry needs to manually rewritten as described in OpenSolaris bug 6725513 http://bugs.opensolaris.org/view_bug.do?bug_id=6725513 , the symptom being the unbootablity of the updated image.

I found that I had to issue an addition commmand before getting this to work:

opensolaris$ pfexec beadm mount opensolaris-1 /mnt opensolaris$ pfexec /mnt/boot/solaris/bin/update_grub -R /mnt

Other than that

August 21, 2008

CLISP running ASDF easily.

First, download [asdf.lisp], stashing it somewhere on the local filesystem (here I stored it as "$HOME/work/asdf/asdf.lisp". Then, create a file named $HOME/.clisprc.lisp, and place the following code in it:


;;; -*- MODE: LISP; Syntax: COMMON-LISP -*-
(load "~/work/asdf/asdf.lisp")
(push '(merge-pathnames ".sbcl/systems/" (user-homedir-pathname))
      asdf:*central-registry*)
(nreverse asdf:*central-registry*)

[asdf.lisp]: ASDF as asdf.lisp CVS version 1.123
July 15, 2008

How to use openrdf to translate between RDF formats from a question on the semantic-web@w3c.org list [needs to be cleaned up].

1. Download the openrdf-sesame-2.1-sdk.tar.gz 1.1 Extract this somewhere to a directory (OPENRDF_ROOT) 2. Get a copy of [Apache Tomcat][apache-tomcat] running locally on your machine. I used apache-tomcat-6.0.16. Alternatively you could use any Java Servlet container. [apache-tomcat]: http://tomcat.apache.org/download-60.cgi 2.1 Unpack the apache-tomcat-6.0.16 to a directory (TOMCAT_ROOT) 3. Deploy the openrdf into Tomcat, after unpacking the openrdf-sesame-2.1-sdk.tar.gz archive somwhere 3.1 Copy the openrdf-workbench.war file to TOMCAT_ROOT/webapps 3.2 Copy the openrdf-sesame.war file to TOMCAT_ROOT/webapps 3.3 Start the Tomcat process via unix$ cd TOMCAT_ROOT && ./bin/startup.sh && tail -f logs/catalina.out Log messages will fill your screen, eventually (after something like 30 secs. they should stop, you should see a summary of the elapsed time since startup, and the Tomcat container is now listening for requests.) Now the Tomcat server is running on your machine, listening on port 8080, with openrdf-workbench and openrdf-sesame deployed as applications. 'openrdf-sesame' is the server exposed as REST web service; 'openrdf-workbench' is a graphical frontend. 4.0 Visit [the local openrdf-workbench][local openrdf-workbench] in a web browser. [local openrdf-workbench]: http://localhost:8080/openrdf-workbench Now you have to create a new repository, load your files into it, and then 'extract' via the 'openrdf-workbench' You can do all of the above from the browser *except* create a repository, so first create a scratch repository from the comand line. 4.1 Run the console application: unix$ cd OPENRDF_ROOT && /console.sh 4.2 Now you are in a command line interface. You need to connect to the sesame instance running in Tomcat: unix:~/openrdf-sesame-2.1/bin$ ./console.sh Connected to default data directory Commands end with '.' at the end of a line Type 'help.' for help > connect http://localhost:8080/openrdf-sesame . Disconnecting from default data directory Connected to http://localhost:8080/openrdf-sesame Note that the commands must end in '.' (a period). 4.2 Now create a repository. > create native. Please specify values for the following variables: Repository ID [native]: data Repository title [Native store]: Scratch space for RDF. Triple indexes [spoc,posc]: Repository created 5.0 Now you can use the local openrdf workbench web interface running on http://localhost:8080/openrdf-workbench to upload data, choosing to extract it in whatever format you wish.

October 24, 2007

FreeBSD 6.2 with the sysutils/fuesfs-wdfs WebDAV filesystem using the user-space FUSE filesystem, won't allow mounts to occur for an unprivileged user. One needs to modify the devfs rulesets as somthing like:

     freebsd$ sudo devfs ruleset 10
     freebsd$ sudo devfs rule add path fuse\* mode 666

If you use FUSE ("Filesystem in User Space") for other filesystem types, you might want to consider the implications of making all such mounts globablly read/writable.