All Manuals > LispWorks Editor User Guide > 3 Command Reference

NextPrevUpTopContentsIndex

3.7 Directory mode

A buffer in Directory mode presents a list of files, and allows you to easily edit any of them, copy or move some of them to another directory, or delete some of them. It also makes it easy to keep a record of which files you already edited.

You open a Directory mode buffer by invoking one of:

The editor opens a buffer in Directory mode, listing all the matching files.

Note: If you are opening a directory path (without filename) and there is already a buffer opened with this directory, it finds this buffer, rather than creating another one. You can prevent this by first renaming the existing buffer. Opening a wild path with the Find File command always creates a new buffer.

A Directory mode buffer can be saved to a file, and because it contains the mode in its attribute line, when you re-open the file it will open in Directory mode. Thus it can be used as a record of what you have done. For example, if you need to visit all the files in some directory and the task will span multiple sessions, you can edit the directory and visit the files from the Directory mode buffer. You periodically save this buffer to a file. Then after quitting your session and restarting you can open the file and have a record of which files you already visited. For this kind of task, Directory mode is probably the simplest method.

The operations that you can do in Directory mode include:

3.7.1 Directory mode buffer display

The first 2 lines of a Directory mode buffer are the "header", including the attribute line. The following lines each represent one file. The line starts with spaces for optional marks, followed by the file size in bytes (decimal), followed by the name of the file.

Each of the optional marks in the beginning of a line is either Space for "off", or a specific character for "on" as shown in Meaning of "on" characters at start of lines in Directory mode

Meaning of "on" characters at start of lines in Directory mode

Offset

Character

Meaning

0

+

Edited

1

*

Marked

1

D

Delete

The remainder of this section contains details of the Directory mode commands.

3.7.1 Directory mode commands

In general the buffer in Directory mode is read-only, and can be modified only by the commands below. Commands that do not modify the text can be used as in other buffers. You should not edit the buffer in other ways, because the editor expects a specific structure of the buffer. Commands that just change the contents of the buffer without affecting the file system can be undone as usual. Commands that affect the file system clear the undo information, so it is not possible to undo these.

Directory Mode Next Line

Editor Command

Arguments: None
Key sequence: Space, N, Ctrl+N or Down

The command Directory Mode Next Line moves to the next line in the buffer, with the point on the filename.

Directory Mode Previous Line

Editor Command

Arguments: None
Key sequence: P, Ctrl+P or Up

The command Directory Mode Previous Line moves to the previous line in the buffer, with the point on the filename.

Directory Mode Edit File

Editor Command

Arguments: None
Key sequence: Enter, F or E

The command Directory Mode Edit File edits the file on the current line, and also automatically marks it as edited. The file is opened in the same window.

Directory Mode Edit File In Other Window

Editor Command

Arguments: None
Key sequence: O

The command Directory Mode Edit File In Other Window edits the file on the current line, and also automatically marks it as edited. The file is opened in another window.

Note: a convenient setup for visiting files is to use Split Window Horizontally (Ctrl+X 5) to display the Directory mode buffer, and then editing a file by O appears in the other editor window inside the same interface.

Directory Mode Mark

Editor Command

Arguments: None
Key sequence: M

The command Directory Mode Mark switches on the mark (the second character) on the current line.

Marks are used by other commands, but do not have any effect otherwise.

After marking the cursor moves to the next line.

With a prefix argument argument it does as many lines as specified by the prefix, while a negative prefix causes lines above the current line to be marked.

Directory Mode Unmark

Editor Command

Arguments: None
Key sequence: U

The command Directory Mode Unmark switches off the mark (the second character) on the current line.

Marks are used by other commands, but do not have any effect otherwise.

After unmarking the cursor moves to the next line.

With a prefix argument argument it does as many lines as specified by the prefix, while a negative prefix causes lines above the current one to be unmarked.

Directory Mode Unmark Backward

Editor Command

Arguments: None
Key sequence: Backspace

The command Directory Mode Unmark Backward moves to the previous line and switches off the mark. This is equivalent to Directory Mode Unmark with the prefix argument negated (or supplied as -1).

Directory Mode Unflag Edited

Editor Command

Arguments: None
Key sequence: None

The command Directory Mode Unflag Edited switches off the edited flag (+ in the first character) on the current line.

Directory Mode Flag Edited

Editor Command

Arguments: None
Key sequence: None

The command Directory Mode Flag Edited switches on the edited flag (+ in the first character) on the current line.

Directory Mode Toggle Edited

Editor Command

Arguments: None
Key sequence: -

The command Directory Mode Toggle Edited changes the state of the edited flag (+ in the first character) on the current line. The edited flag is merely recorded in the buffer, not stored anywhere else.

Since the flag is switched on automatically when you edit a file from the Directory mode buffer, you normally do not need to change it, but sometimes you may find it useful.

Directory Mode Mark Matches

Directory Mode Unmark Matches

Directory Mode Mark Regexp Matches

Directory Mode Unmark Regexp Matches

Editor Commands

Arguments: None
Key sequence: None

The commands Directory Mode Mark Matches, Directory Mode Unmark Matches, Directory Mode Mark Regexp Matches and Directory Mode Unmark Regexp Matches mark or unmark the matching filenames. With a prefix argument, these commands mark the non-matching filenames. These commands first prompt for a string or regexp to match, and then mark or unmark all the matches (non-matches with prefix argument).

See also: Directory Mode Mark All

Directory Mode Mark All

Editor Command

Arguments: None
Key sequence: None

The command Directory Mode Mark All marks all filenames. With a prefix argument, this command unmarks all filenames.

See also: Directory Mode Mark Matches

Directory Mode Mark When Edited

Directory Mode Unmark When Edited

Editor Commands

Arguments: None
Key sequence: None

The commands Directory Mode Mark When Edited and Directory Mode Unmark When Edited mark and unmark all edited filenames. With a prefix argument, these commands operate on all unedited filenames.

See also: Directory Mode Mark All

Directory Mode Flag Delete

Editor Command

Arguments: None
Key sequence: D

The command Directory Mode Flag Delete switches on the Delete flag (D in the second character) on the current line.

The Delete flag is used by the command Directory Mode Delete, otherwise nothing uses it.

After marking the cursor moves to the next line.

With a prefix argument it does as many lines as specified by the prefix. A negative prefix argument causes lines above the current one to be marked for deletion.

Directory Mode Flag Delete When Marked

Editor Command

Arguments: None
Key sequence: None

The command Directory Mode Flag Delete When Marked flags for deletion all the marked filenames. With a prefix argument, it flags all the unmarked filenames.

3.7.2 Explicit editing of the Directory mode buffer

Directory Mode Kill Line

Editor Command

Arguments: None
Key sequence: Ctrl+K

The command Directory Mode Kill Line kills the current line. This is like the ordinary Kill Line command, except that it always removes complete lines (rather than from the point), and it gives an editor error if you try to delete part of the header.

Force Undo

Editor Command

Arguments: None
Key sequence: Ctrl+_ or Ctrl+X U

The command Force Undo is the same as Undo, but works for a read-only buffer too.

Note: This command can be used in other modes too.

3.7.3 Modifying the file system from the Directory mode buffer

Directory Mode Delete

Editor Command

Arguments: None
Key sequence: X

The command Directory Mode Delete deletes the files that are marked for deleting (D in second character).

It first confirms that you really want to delete the files, and then deletes them.

It also deletes the corresponding lines and clears the undo information in the Directory mode buffer.

Note: Like anything that deletes files, you need to be careful when using this command.

Note: When deleting many files, it is convenient to first create a buffer with only the marked files using Directory Mode New Buffer With Flagged Delete. That makes it easy to see which files you are going to delete.

See also: Directory Mode Flag Delete

Directory Mode Copy Marked

Editor Command

Arguments: None
Key sequence: C

The command Directory Mode Copy Marked copies the marked files to another directory. First it prompts for a directory, and then copies the marked files to that directory.

This command clears the undo information in the Directory mode buffer.

Note: When copying many files, it is convenient to first create a buffer with only the marked files using Directory Mode New Buffer With Marked (keystroke T)..That makes it easy to see which files you are going to copy.

Directory Mode Move Marked

Editor Command

Arguments: None
Key sequence: Y

The command Directory Mode Move Marked moves the marked files to another directory. First it prompts for a directory, and then moves the marked files to that directory.

This command also removes the corresponding lines and clears the undo information in the Directory mode buffer.

Note: When moving many files, it is convenient to first create a buffer with only the marked files using Directory Mode New Buffer With Marked (keystroke T). That makes it easy to see which files you are going to move.

Directory Mode Rename

Editor Command

Arguments: None
Key sequence: R

The command Directory Mode Rename renames the file on the current line.

This prompts for a new name for the file, and then renames the file. It then changes the line to contain the new name.

This command clears the undo information in the Directory mode buffer.

3.7.4 Creating new Directory mode buffers

Directory Mode New Buffer With Marked

Editor Command

Arguments: None
Key sequence: T

The command Directory Mode New Buffer With Marked creates a new buffer in Directory mode, containing only the marked lines (that is, those with *). With a prefix argument, it creates a buffer with only the unmarked lines.

This command does not affect the current buffer.

Note: This is especially useful before doing a batch operation (delete, copy or move) to first check that you are operating on the correct set of files.

Directory Mode New Buffer With Edited

Editor Command

Arguments: None
Key sequence: Ctrl+T

The command Directory Mode New Buffer With Edited creates a new buffer in Directory mode, containing only the edited lines (that is, those with +).

With a prefix argument, it creates a buffer with only the un-edited lines.

This command does not affect the current buffer.

Directory Mode New Buffer With Flagged Delete

Editor Command

Arguments: None
Key sequence: Meta+T

The command Directory Mode New Buffer With Flagged Delete creates a new buffer in Directory mode, containing only the "delete" lines (that is, those with D).

With a prefix argument, it creates a buffer with only the lines that are not flagged for deletion.

This command does not affect the current buffer.

Directory Mode New Buffer With Matches

Editor Command

Arguments: None
Key sequence: S

The command Directory Mode New Buffer With Matches prompts for a string, and then creates a buffer containing only the lines that match this string. With a prefix argument it creates a buffer with only the non-matching lines.

This command does not affect the current buffer.

Directory Mode New Buffer With Regexp Matches

Editor Command

Arguments: None
Key sequence: Meta+S

The command Directory Mode New Buffer With Regexp Matches prompts for a regular expression, and then creates a buffer containing only the lines that match this regular expression. With a prefix argument it creates a buffer with only the non-matching lines.

This command does not affect the current buffer.


LispWorks Editor User Guide (Windows version) - 9 Dec 2014

NextPrevUpTopContentsIndex