[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Handy Emacs Lisp code
From: |
Tom Tromey |
Subject: |
Handy Emacs Lisp code |
Date: |
14 Jul 2001 14:44:37 -0600 |
Today I got tired of continually saving files from GNUS to a file and
then going to the right directory to apply a patch.
So I wrote this Emacs lisp code, which lets you easily run a mail
buffer through the appropriate patch sequence. Since I work with a
relatively small number (it is never unmanageable anyway) of
frequently-updated source trees, I wrote this code to use an alist of
my common projects. That way I don't have to continually type in
paths which remain fixed anyway -- I just use the project name.
I figured this would be useful for others on this list.
It relies on the nice clcleanup/fixpatch/cl2patch scripts to work.
Should I check it in?
How to use:
* Use GNUS to read email
* Put code somewhere it can be seen by Emacs, like ~/.gnus
* Set up tjt-gnus-patch-alist to reflect your work environment.
The settings below are just the few trees I entered as my most
common work areas.
* Hack PATH setting in tjt-gnus-summary-save-as-patch
This is just plain ugly :-(
* Use `O c' binding in Summary mode to apply a patch.
Now I just have to set up the cvs hacking code in Emacs...
Has anybody contemplated changing VC and/or pcl-cvs to be more
friendly to remote/disconnected use?
Tom
(defvar tjt-gnus-patch-alist
'(("automake" . "~/gnu/egcs/automake/automake/")
("egcs" . "/x1/egcs/gcc")
("gcc3" . "/x1/gcc3/gcc")))
(defun tjt-gnus-summary-save-as-patch (location)
"Patch LOCATION using the current article as the patch."
(if (eq location 'default)
(setq location nil))
(or location
(setq location
(completing-read "Project to patch: "
tjt-gnus-patch-alist nil 'require)))
(if (string-equal location "")
(error "No project specified"))
(let ((path (cdr (assoc location tjt-gnus-patch-alist))))
(gnus-eval-in-buffer-window gnus-article-buffer
(save-restriction
(widen)
(shell-command-on-region
(point-min) (point-max)
(concat "PATH=/usr/local/cvs/bin:$PATH; cd "
(expand-file-name path)
"; clcleanup | fixpatch | cl2patch | patch -p0")
nil)))))
(defun tjt-gnus-summary-patch (&optional arg)
"Patch a project with the current article.
If N is a positive number, pipe the N next articles.
If N is a negative number, pipe the N previous articles.
If N is nil and any articles have been marked with the process mark,
pipe those articles instead."
(interactive "P")
(let ((gnus-default-article-saver 'tjt-gnus-summary-save-as-patch))
(gnus-summary-save-article arg t))
(gnus-configure-windows 'pipe))
(defun tjt-add-summary-keys ()
(local-set-key "Oc" 'tjt-gnus-summary-patch))
(add-hook 'gnus-summary-mode-hook 'tjt-add-summary-keys)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Handy Emacs Lisp code,
Tom Tromey <=