Dear Log,
The learning curve for writing Lisp goes around, and up, and into hyperbolic space, and thru a Bathsheba Grossman industrial art piece and then after a decade or two of time spent in rooms with soft walls, you can start to manage basic things.
And so, twelve years after I started using emacs, I can now automate some of my more common tasks.
Back in the days when I had to use PFE under MSWin, the one thing I liked being able to do was that, when I would be running a command line, I could use "%f" in the command line and that would be replaced with the current file's filename.
I found nothing quite so convenient for Emacs. So I wrote it.
With this you can run command lines like "xslbong !! thingywhoozits" and it'll replace "!!" with the current buffer's filename. And incidentally, it'll save the output to a new scratch buffer, instead of the usual functions that just overwrite "*Shell Command Output*".
I'm a sophistatronic programmder!
(I chose "!!" as a string that I just happen never to use in command lines. Change it as you like.)
defadvice
to define some before advice on shell-command
. It's similiar to this Perl:sub foo {
print "foo";
}
# Later on...
{
my $orig = \&foo;
*foo = sub {
print "before foo";
$orig->(@_);
};
}
More information on elisp advice.
-Dom
Re:Advice
TorgoX on 2006-01-08T03:54:39
This is snazzy! I suspected elisp must have some sort of around-ing like this, but I had no idea where or how to access it. Thanks!Re:Advice
Dom2 on 2006-01-08T20:57:46
I picked it up from Writing GNU Emacs Extensions. I don't think it's in print any more, but if you can find a copy, it's a good read.-Dom