More Elisp posts
May 24, 2002
Saving time with Emacs

The best thing about Emacs is the ease with which it can be extended. Here's a simple function that I wrote in a couple of minutes to add <span> tags round the currently selected region. Saved me a lot of boring copy and paste or typing.

(defun ajm-ref (s e)
  "Add <span class=\"ref\"> </span> round the text in the region
 and then call fill-paragraph to reformat."
  (interactive "r")
  (goto-char e)
  (let ((end (point-marker)))
    (goto-char s)
    (insert "<span class=\"ref\">")
    (goto-char end)
    (insert "</span>"))
  (fill-paragraph nil))
Posted by Alex at May 24, 2002 10:00 PM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?