Lugaru's Epsilon

Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Starting and Stopping Epsilon
         Session Files
         File Associations
         Sending Files to a Prior Instance
         MS-Windows Integration Features
      Running Other Programs
         The Concurrent Process
         Compiling From Epsilon
      Repeating Commands
         Repeating a Single Command
         Keyboard Macros
      . . .

Previous   Up    Next
The Concurrent Process  Commands by Topic   Repeating a Single Command

Epsilon User's Manual and Reference > Commands by Topic > Running Other Programs >

Compiling From Epsilon

Many compilers produce error messages in a format that Epsilon can interpret with its next-error command on Ctrl-X Ctrl-N. The command searches in the process buffer (beginning at the place it reached last time, or at the beginning of the last command) for a line that contains a file name, a line number, and an error message. If it finds one, it uses the find-file command to retrieve the file (if not already in a window), then goes to the appropriate line in the file. With a numeric argument, it finds the nth next error message, or the nth previous one if negative. In particular, a numeric argument of 0 repeats the last message. The previous-error command on Ctrl-X Ctrl-P works similarly, except that it searches backward instead of forward.

The Ctrl-X Ctrl-N and Ctrl-X Ctrl-P keys move back and forth over the list of errors. If you move point around in a process buffer, it doesn't change the current error message. You can use the find-linked-file command on Ctrl-X Ctrl-L to reset the current error message to the one shown on the current line. (The command also goes to the indicated source file and line, like Ctrl-X Ctrl-N would.)

Actually, Ctrl-X Ctrl-N runs the next-position command, not next-error. The next-position command usually calls next-error. After you use the grep command (see Searching Multiple Files), however, next-position calls next-match instead, to move to the next match of the pattern you searched for. If you use any command that runs a process, or run next-error explicitly, then next-position will again call next-error to move to the next error message.

Similarly, Ctrl-X Ctrl-P actually runs previous-position, which decides whether to call previous-error or previous-match based on whether you last ran a compiler or searched across files.

To locate error messages, the next-error command performs a regular-expression search using a pattern that matches most compiler error messages. See Regular Expressions for an explanation of regular expressions. The command uses the ERROR_PATTERN macro and others, defined in the file nexterr.e. You can change these patterns if they don't match your compiler's error message format. The next-error command also uses another regular-expression pattern to filter out any error messages Epsilon should skip over, even if they match ERROR_PATTERN. The variable ignore-error stores this regular expression. For example, if ignore-error contains the pattern ".*warning", Epsilon will skip over any error messages that contain the word "warning".

The next-error command knows how to use the Java CLASSPATH to locate Java source files, and has special logic for running Cygwin-based programs under Windows. (See the cygwin-filenames variable for more information on the latter.) You can set the process-next-error-options variable to control how this command looks for a file.

If you run a compiler via telnet or a similar process in an Epsilon buffer, you can set up next-error to translate file names in the telnet buffer into URL-style file names that Epsilon can use to access the file. See Internet Support.

The command view-process on Shift-F3 can be convenient when there are many long error messages in a compilation. It pops up a window showing the process buffer and its error messages, and lets you move to a particular line with an error message and press <Enter>. It then goes to the source file and line in error. You can also use it to see the complete error message from the compiler, when next-error's one-line display is inadequate.

An alternative to using view-process is setting the process-view-error-lines variable nonzero. It tells the next-error and previous-error commands to ensure the error in the process buffer is visible in a window each time it moves to a source line.

The make command on Ctrl-X M runs a program and scans its output for error messages using next-error. In some environments, it runs the program in the background, displaying a "Compiling" message while it runs. If you don't start other editing before it finishes, it automatically goes to the first error message. If you do, it skips this step; you can press Ctrl-X Ctrl-N as usual to go to the first error. In other environments, Epsilon may run the program in a concurrent process buffer, or non-concurrently. See the variables compile-in-separate-buffer and concurrent-make for more details.

By default, it runs a program called "make", but with a numeric argument it will prompt for the command line to execute. It will use that command line from then on, if you invoke make without a numeric argument. See the variable start-make-in-buffer-directory to control which directory the new process starts in.

Epsilon uses a template for the command line (stored in the push-cmd variable), so you can define a command line that depends on the current file name. See Backup Files for information on templates. For example, cl %f runs the cl command, passing it the current file name.

If a concurrent process already exists, Epsilon will attempt to run the program concurrently by typing its name at the end of the process buffer (in those environments where Epsilon isn't capable of creating more than one process buffer). When Epsilon uses an existing process buffer in this way, it will run next-error only if you've typed no keys during the execution of the concurrent program. You can set the variable concurrent-make to 0 to force Epsilon to exit any concurrent process, before running the "make" command. Set it to 2 to force Epsilon to run the command concurrently, starting a new concurrent process if it needs to. When the variable is 1 (the default), the make command runs the compiler concurrently if a concurrent process is already running, non-concurrently otherwise.

Whenever push or make exit from a concurrent process to run a command non-concurrently, they will restart the concurrent process once the command finishes. Set the restart-concurrent variable to zero if you don't want Epsilon to restart the concurrent process in this case.

Before make runs the program, it checks to see if you have any unsaved buffers. If you do, it asks if it should save them first, displaying the buffers using the bufed command. If you say yes, then the make command saves all of your unsaved buffers using the save-all-buffers command (which you can also invoke yourself with Ctrl-X S). You can modify the save-when-making variable to change this behavior. If it has a value of 0, Epsilon won't warn you that you have unsaved buffers. If it has a value of 1, Epsilon will automatically save all the buffers without asking. If it has a value of 2 (as it has normally), Epsilon asks.

The compile-buffer command on Alt-F3 is somewhat similar to make, but tries to compile only the current file, based on its extension. There are several variables like compile-cpp-cmd you can set to tell Epsilon the appropriate compilation command for each extension. If Epsilon doesn't know how to compile a certain type of file, it will prompt for a command line. While Epsilon's make command is good for compiling entire projects, compile-buffer is handy for compiling simple, one-file programs.

The command is especially convenient for EEL programmers because compile-buffer automatically loads the EEL program into Epsilon after compiling it. The EEL compiler is integrated into Epsilon, so Epsilon doesn't need to run another program to compile. When Epsilon compiles EEL code using its internal EEL compiler, it looks in the compile-eel-dll-flags variable for EEL command line flags.

The buffer-specific concurrent-compile variable tells compile-buffer whether to run the compiler concurrently. The value 2 means always run the compiler concurrently, 0 means never run concurrently, and 1 means run concurrently if and only if a concurrent process is already running. The value 3 (the default) means use the value of the variable concurrent-make instead. (The concurrent-make variable tells the make command whether to run its program concurrently, and takes on values of 0, 1, or 2 with the same meaning as for concurrent-compile.)

A file can use a file variable named "compile-command" (see File Variables) to tell compile-buffer to use a specific command to compile that file, not the usual one implied by its file name extension. The command line must be surrounded with " characters if it contains a semicolon. For instance,

-*- compile-command: "gcc -I/usr/local/include %r" -*-

on the first line of a file tells Epsilon to use that command to compile that file. Unlike other file variables, Epsilon doesn't scan for a compile command when you first load the file; it does this each time you use the compile-buffer command. Also see the variable use-compile-command-file-variable.

Standard bindings:

  Ctrl-X Ctrl-N  next-position
 Ctrl-X Ctrl-P  previous-position
 Shift-F3  view-process
 Ctrl-X M  make
 Alt-F3  compile-buffer

Previous   Up    Next
The Concurrent Process  Commands by Topic   Repeating a Single Command

Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.