Subject: Re: vile 7.0h patch

From: Paul Fox <[email-masked]>
Date: Wed, 23 Apr 1997 07:56:16 -0400

> I don't think I received it - the only contrib thing I've in my queue is
 > the patched c-filt.c from last week.
 > 
oh -- he sent it to vile-users last night, about 10 minutes before
we exchanged mail.  here it is.  it's cute.

; Mapped to ^A-e (and M-e), a simple dired
; "Brendan O'Dea" <[email-masked]>
; one keystroke:
;   if in a [dired] buffer, edit directory or file on line under cursor
;   if not in a [dired] buffer, edit current directory
4 store-macro
    ~if &seq $cbufname "[dired]"
	; if already in dired, find the name from the current line
	beginning-of-line
	~if &equ $char 100
	    set-variable %dired-type "dir"
	~elseif &equ $char 45
	    set-variable %dired-type "file"
	~else
	    write-message "Not on a file/directory"
	    ~return
	~endif

	end-of-line
	back-word
	set-variable %dired-selection $pathname
    ~else
	; otherwise choose current directory
	set-variable %dired-type "dir"
	set-variable %dired-selection "."
    ~endif

    ~if &seq %dired-type "dir"
	~if &seq $status TRUE
	    ; Create list
	    edit-file &cat "!ls -la " %dired-selection
	    ~if &seq $identifier "total"
		change-directory %dired-selection
		1 delete-til lines
		delete-to-eol
		insert-string &cat &cat "[" $cwd "]"
		next-line
		end-of-line
		back-word
		unmark-buffer
		set-mode view
		~force kill-buffer "[dired]"
		~force rename-buffer "[dired]"
		write-message $cwd
		delete-other-windows
	    ~else
		~force next-word
		set-variable %error $line
		~force kill-buffer "!ls"
		write-message %error
	    ~endif
	~endif
    ~else
	; prepend `.' to ensure we don't pick up an old buffer
	edit-file &cat "./" %dired-selection
    ~endif
~endm

bind-key execute-macro-4 ^A-e
bind-key execute-macro-4 M-e