| 1 |
Processing mode for Emacs. |
| 2 |
Written by Rudolf Olah. |
| 3 |
|
| 4 |
Licensed under the GNU GPL version 3 or later. |
| 5 |
|
| 6 |
== About == |
| 7 |
|
| 8 |
This mode is a derivative of the java-mode. It adds key-bindings for |
| 9 |
running/compiling Processing sketches and it also highlights keywords |
| 10 |
found in the Processing language, such as ``setup'', ``draw'', and |
| 11 |
``frameRate''. |
| 12 |
|
| 13 |
== Setup == |
| 14 |
|
| 15 |
In your .emacs file, add this: |
| 16 |
|
| 17 |
(add-to-list 'load-path "/path/to/processing-emacs/") |
| 18 |
(autoload 'processing-mode "processing-mode" "Processing mode" t) |
| 19 |
(add-to-list 'auto-mode-alist '("\\.pde$" . processing-mode)) |
| 20 |
(setq processing-location "/path/to/processing") |
| 21 |
|
| 22 |
== Usage == |
| 23 |
|
| 24 |
The key-bindings are: |
| 25 |
|
| 26 |
C-c C-b Preprocess, and compile a sketch into .class files. |
| 27 |
C-c C-r Preprocess, compile, and run a sketch. |
| 28 |
C-c C-p Preprocess, compile, and run a sketch full screen. |
| 29 |
|
| 30 |
The mode also includes helpful code snippets. To use them you must |
| 31 |
install the YASnippet package found here: |
| 32 |
|
| 33 |
http://code.google.com/p/yasnippet/ |
| 34 |
|
| 35 |
== Bugs == |
| 36 |
|
| 37 |
* Compilation...there is a bug in the compilation because the |
| 38 |
Commander class of Processing does not accept the ``--preferences'' |
| 39 |
option. The workaround is to copy your ``preferences.txt'' from your |
| 40 |
home directory (in Linux it can be found in ``~/.processing/'') to |
| 41 |
the sketch directory. You will have to create a sub-directory called |
| 42 |
``lib'' in the sketch directory which is where the |
| 43 |
``preferences.txt'' file will reside. Sym-linking also works. |
| 44 |
|
| 45 |
=== Using Processing Libraries === |
| 46 |
|
| 47 |
Processing allows developers to extend its functionality with |
| 48 |
libraries. These are collections of JAR (Java ARchive) files that can |
| 49 |
be included with a sketch. |
| 50 |
|
| 51 |
processing-mode handles the inclusion of libraries by opening up a |
| 52 |
file named ``libraries_required.txt'' in the sketch folder. On each |
| 53 |
line of that file will be the name of the library's folder. |
| 54 |
|
| 55 |
As an example, let's say we have a sketch that uses the JavaScript |
| 56 |
library. To include it with the sketch, our ``libraries_required.txt'' |
| 57 |
would look like: |
| 58 |
|
| 59 |
javascript |
| 60 |
|
| 61 |
Just a single line :D processing-mode will do some magic and use the |
| 62 |
following path when including the library with the sketch compilation: |
| 63 |
|
| 64 |
<processing_path>/libraries/javascript/library/ |
| 65 |
|
| 66 |
In the ``library'' sub-folder of all libraries there will be a set of |
| 67 |
JAR files. They will be added to the classpath when the sketch is |
| 68 |
compiled or run. |
| 69 |
|
| 70 |
== Fixed Bugs == |
| 71 |
|
| 72 |
* Compilation errors...The regular expression used to detect |
| 73 |
compilation error messages does indeed work. Unfortunately there is |
| 74 |
another regular expression that is interfering and being matched |
| 75 |
_before_ it. |
| 76 |
|
| 77 |
The fix is to shadow the global variable with a local one that |
| 78 |
narrows down the searchable regex list to a single regexp: |
| 79 |
'processing. |