[plt-scheme] Specifying directory sandbox evalutes file requires relative to

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Aug 31 20:07:23 EDT 2008

On Aug 31, Neil Van Dyke wrote:
> Emacs keyboard macros are also often a good one-off way to do this
> sort of thing.

Keyboard macros are wonderful, but still, using them with a single
file is much easier than doing the one macro-per-file thing.
Especially if you have your files nested in some hierarchy.

For those cases I use `i' first to include the whole hierarchy, and
then combine the macro-per-file with more macros that move to the next
file in the dired buffer.  You need further hacking to deal with
failed searches -- many keyboard macros begin with a search, but you
need to take care of the case where the string is not found.

So all of this requires careful composition of the keyboard macros,
and I got tired of doing the same thing over and over.  Plus, the
pack-edit-unpack cycle is better in that it's more robust since it's
easier to see the transformation beforehand.


> And if you can formulate the edits as one keyboard macro activation
> per file, then you can open a Dired showing the files to be
> modified, and launch your keyboard macro on the file under point in
> Dired (so the keyboard macro opens the file, does the edit, saves
> and closes the file, moves point to the next file in the list for
> you to invoke the keyboard macro again).

(As an example for the trickery that is involved -- because most
macros begin with a search, I make these macros: save and close the
buffer, move to the next line, open that file, then search for the
beginning string and do the editing.  This way a failed search does
not mess things up.)


On Aug 31, Neil Van Dyke wrote:
> I almost forgot, if your Emacs isn't set up to have one-keypress
> execution of a keyboard macro, you might want something like this:
> 
> (global-set-key [f5]            'call-last-kbd-macro)
> 
> (global-set-key [(control f5)]  'my-macro-record-toggle)
> 
> (defun my-macro-record-toggle ()
>   (interactive)
>   (if defining-kbd-macro
>       (end-kbd-macro)
>     (start-kbd-macro nil)))

Given how useful keyboard macros are, I have a much better hack for
them.  I use a single key to start/end recording a macro key and
assign the resulting macro to that key.  Something like this:

  M-z <KEY> ...macro body... M-z

and then <KEY> is bound to that macro.  This is crucial in making it
convenient to "program" with keyboard macros -- where keys can serve
as a kind of a procedure that is used by other keyboard macros.

[The absolute real fun is to make a keyboard macro that records other
keyboard macros and uses them.  You know you're insane if you want to
do this, and you didn't think about writing a real function instead.]

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.