UP | HOME

Emacs

Home Up

Tips and Tricks

by Lang 2010-03-31 Wed

I just use this to keep a stack of things I've learned recently about emacs. I've only been using it for 8 years, so this happens all the time.

VC Annotate
C-x v g for line-by-line history.
URL Encoding
org-link-unescape and org-link-escape.
eshell pipe to buffer
diff > #<buffer *scratch*>
iBuffer multi-occur
O operates on tagged files. I for replace.
GNUS Gmail Search
G G in the Group buffer. See Gnus Gmail on Emacswiki for more detail.
GNUS Gmail Keeping in Sync
Catching Up on that same page.

Utilities

SRFI-1 List Utilities

by Lang 2009-12-07 Mon

Emacs-lisp implementations of a few functions from SRFI-1, srfi-1.el. I've also included intersperse, which is useful for string manipulation.

SRFI-2 and-let*

by Lang. 2009-07-17 Fri

An emacs-lisp implementation of SRFI-2, srfi-2.el. and-let* is a combination of and and let, which (optionally) binds the result of each form in the let block. It stops on the first false result, and executes the body only if all the forms are true.

(and-let* ((val (member 'foo '(a b c foo d e)))
           ((listp val))
           (val (car val)))
  val)

If foo was not found in the list, the form would return false rather than raising an error.

Hacked Packages

html-script.el

by Lang. 2009-10-07 Wed

My version of html-script.el. This code is originally from http://www.dur.ac.uk/p.j.heslin/Software/Emacs/, and is a simplified alternative to the various multi-modes.

Using the region definitions (each a list of starting regexp, ending regexp, and mode symbols) the keystroke (by default F12) will narrow to the region and invoke the first bound function. F12 a second time will widen the buffer and return to HTML mode.

I hacked up the code a bit to exclude the text matched by the starting and ending expressions. js2-mode flags any invalid syntax, and the script tags are certainly that. This seems like a workable solution for mixed javascript, at least until js2-mode can play nicely with multi-modes.

Date: 2010-06-11 11:41:45

HTML generated by org-mode 6.33x in emacs 23