README revision 1.1.1.2 1 1.1.1.2 mrg Xedit is a simple text editor for X.
2 1.1.1.2 mrg
3 1.1.1.2 mrg Please check xedit(1) for information about resources and configurable
4 1.1.1.2 mrg options.
5 1.1.1.2 mrg
6 1.1.1.2 mrg The authors file should list the original authors of all files, but
7 1.1.1.2 mrg unfortunately most collaborators and people that changed portions of the
8 1.1.1.2 mrg code is not listed.
9 1.1.1.2 mrg
10 1.1.1.2 mrg
11 1.1.1.2 mrg List of default keyboard commands.
12 1.1.1.2 mrg Uppercase letters means both, uppercase and lowercase.
13 1.1.1.2 mrg Lowercase letter usually means Shift key is not pressed.
14 1.1.1.2 mrg C- Means Control key.
15 1.1.1.2 mrg M- Means Meta key.
16 1.1.1.2 mrg Usually Alt key has the same effect.
17 1.1.1.2 mrg S- Means Shift key.
18 1.1.1.2 mrg
19 1.1.1.2 mrg C-A Move cursor to beginning of line.
20 1.1.1.2 mrg C-B or Left
21 1.1.1.2 mrg Move cursor backwards one character.
22 1.1.1.2 mrg C-C Insert CUT_BUFFER0 selection at cursor position.
23 1.1.1.2 mrg C-D Delete next character.
24 1.1.1.2 mrg C-E Move cursor to end of line.
25 1.1.1.2 mrg C-F or Right
26 1.1.1.2 mrg Move cursor forwards one character.
27 1.1.1.2 mrg C-G Keyboard reset.
28 1.1.1.2 mrg Use it to switch direction in the Undo stack, i.e. switch between
29 1.1.1.2 mrg Undo and Redo.
30 1.1.1.2 mrg It can also be used to stop the lisp interpreter if it is executing
31 1.1.1.2 mrg code.
32 1.1.1.2 mrg C-H Deletes character before cursor.
33 1.1.1.2 mrg C-J Adds a newline and indent.
34 1.1.1.2 mrg If the current buffer is the *scratch* buffer, it will work
35 1.1.1.2 mrg like C-X,C-E, but print the lisp output directly to the scratch
36 1.1.1.2 mrg buffer. Examples:
37 1.1.1.2 mrg (list 1 2 3) C-J will print (1 2 3) and move the cursor to
38 1.1.1.2 mrg the next line.
39 1.1.1.2 mrg C-K Deletes text from cursor position to end of line.
40 1.1.1.2 mrg C-L Redraw text window.
41 1.1.1.2 mrg C-M Adds a newline.
42 1.1.1.2 mrg C-N or Down
43 1.1.1.2 mrg Move cursor to next line.
44 1.1.1.2 mrg C-O Adds one newline at cursor position without moving cursor.
45 1.1.1.2 mrg C-P or Up
46 1.1.1.2 mrg Move cursor to previous line.
47 1.1.1.2 mrg C-R Opens search dialog, searching backwards.
48 1.1.1.2 mrg C-S Opens search dialog, searching forwards.
49 1.1.1.2 mrg C-T Transpose characters.
50 1.1.1.2 mrg C-U Starts multiply mode.
51 1.1.1.2 mrg Multiply mode means that most keyboard commands will be repeated
52 1.1.1.2 mrg by its parameter. After pressing C-U type a number, that can be
53 1.1.1.2 mrg negative. Examples:
54 1.1.1.2 mrg C-U 10 C-F will move the cursor 10 characters forwards
55 1.1.1.2 mrg C-U -10 C-F will move the cursor 10 characters backwards
56 1.1.1.2 mrg If no number is specified, or if the number zero is specified,
57 1.1.1.2 mrg the default value is 4.
58 1.1.1.2 mrg C-V or PageDown
59 1.1.1.2 mrg Move cursor to next page.
60 1.1.1.2 mrg C-W Kills current selection.
61 1.1.1.2 mrg C-W is also useful when there is no active selection, to return to
62 1.1.1.2 mrg the previous position the left mouse was clicked in the text window.
63 1.1.1.2 mrg C-Y Inserts SECONDARY selection.
64 1.1.1.2 mrg This usually means text delete with commands other than by just
65 1.1.1.2 mrg pressing Backspace or Delete (that can be multiplied)
66 1.1.1.2 mrg C-Z Scroll one line up.
67 1.1.1.2 mrg M-B or C-Left
68 1.1.1.2 mrg Move cursor backwards one word.
69 1.1.1.2 mrg C-Left only moves over alphabetic or numeric characters
70 1.1.1.2 mrg M-C Capitalize word under cursor position, or next word.
71 1.1.1.2 mrg M-F or C-Right
72 1.1.1.2 mrg Move cursor forwards one word.
73 1.1.1.2 mrg C-Right only moves over alphabetic or numeric characters.
74 1.1.1.2 mrg M-I Opens a dialog prompting for a file name to be inserted at the
75 1.1.1.2 mrg cursor position.
76 1.1.1.2 mrg (This isn't very user friendly, this is a cavemen interface, you will
77 1.1.1.2 mrg love it, you will never use it).
78 1.1.1.2 mrg M-K Kills text from cursor position to end of paragraph.
79 1.1.1.2 mrg M-L Downcase word at cursor position or next word.
80 1.1.1.2 mrg M-Q Format paragraph.
81 1.1.1.2 mrg Xedit interfaces Xaw code that allows several types of text
82 1.1.1.2 mrg formatting. To use it, you need to Select "Auto Fill" in the
83 1.1.1.2 mrg "Edit Menu" and select values for "Break Columns". After that,
84 1.1.1.2 mrg Select "Edit Menu"->"Justification" for the available options.
85 1.1.1.2 mrg Text typed will usually be automatically corrected, but if you
86 1.1.1.2 mrg need to change text in the middle of a previous line, use M-Q
87 1.1.1.2 mrg to reformat, and C-_ to undo if required.
88 1.1.1.2 mrg Examples of text:
89 1.1.1.2 mrg
90 1.1.1.2 mrg This text with align
91 1.1.1.2 mrg left and break
92 1.1.1.2 mrg columns at 20 and
93 1.1.1.2 mrg 40.
94 1.1.1.2 mrg
95 1.1.1.2 mrg This text with align
96 1.1.1.2 mrg right and break
97 1.1.1.2 mrg columns at 25 and
98 1.1.1.2 mrg 45. Remember that
99 1.1.1.2 mrg Auto Fill must be
100 1.1.1.2 mrg selected. And it may
101 1.1.1.2 mrg be required to press
102 1.1.1.2 mrg M-Q when going back
103 1.1.1.2 mrg to edit previous
104 1.1.1.2 mrg lines.
105 1.1.1.2 mrg
106 1.1.1.2 mrg This text with align center
107 1.1.1.2 mrg and break columns at 40 and
108 1.1.1.2 mrg 70. A good tip is to make sure
109 1.1.1.2 mrg there are empty lines before
110 1.1.1.2 mrg and after the aligned text, so
111 1.1.1.2 mrg that M-Q will not format more
112 1.1.1.2 mrg text than it should.
113 1.1.1.2 mrg
114 1.1.1.2 mrg This text with full align,
115 1.1.1.2 mrg note that it will spread the
116 1.1.1.2 mrg words to fully fill the
117 1.1.1.2 mrg configured break columns, in
118 1.1.1.2 mrg this case 15 and 45. Also note
119 1.1.1.2 mrg that it doesn't remove any
120 1.1.1.2 mrg extra indentation from the
121 1.1.1.2 mrg first line. This may be
122 1.1.1.2 mrg considered a bug or feature,
123 1.1.1.2 mrg but it doesn't respect 2
124 1.1.1.2 mrg spaces after an '.' dot. And
125 1.1.1.2 mrg it doesn't align the last line
126 1.1.1.2 mrg of text.
127 1.1.1.2 mrg
128 1.1.1.2 mrg This text with Auto Fill disabled. When Auto Fill is disabled, tabs are
129 1.1.1.2 mrg usually preserved, like this, and this. But it
130 1.1.1.2 mrg will basically format the text to not be larger than the text widget screen
131 1.1.1.2 mrg width and. But it the screen is scrolled horizontally, it will not work as
132 1.1.1.2 mrg expected, the advantage over the above interface is that is considers font
133 1.1.1.2 mrg characters width, while the other interface assumes fixed width characters.
134 1.1.1.2 mrg
135 1.1.1.2 mrg Notice that "auto formatting" with Auto Fill mode is done when
136 1.1.1.2 mrg pressing enter, but information isn't saved per paragraph, so
137 1.1.1.2 mrg if values of align or break columns are changed, trying to edit
138 1.1.1.2 mrg a text block with different configuration will not give the expected
139 1.1.1.2 mrg results.
140 1.1.1.2 mrg Also notice that lines starting with non printable characters aren't
141 1.1.1.2 mrg automatically formatted. This is helpful for some editing modes
142 1.1.1.2 mrg where symbols can be used before lines in a paragraph. If you don't
143 1.1.1.2 mrg need this feature, usually pressing Space or Tab is enough to put the
144 1.1.1.2 mrg cursor at the proper position.
145 1.1.1.2 mrg M-U Upcase word at cursor position or next word.
146 1.1.1.2 mrg M-V or PageUp
147 1.1.1.2 mrg Move cursor to previous page.
148 1.1.1.2 mrg M-Y Kill ring yank feature. Basically it will circulate over all
149 1.1.1.2 mrg text that has been cut in the current session. Keep pressing it
150 1.1.1.2 mrg until happy :-)
151 1.1.1.2 mrg M-Z Scrolls one line down.
152 1.1.1.2 mrg M-D Kill word at cursor position or next word.
153 1.1.1.2 mrg S-M-D Delete word at cursor position or next word.
154 1.1.1.2 mrg Does not go to the kill ring.
155 1.1.1.2 mrg M-H or M-Delete or M-Backspace.
156 1.1.1.2 mrg Kill word at cursor position or previous word.
157 1.1.1.2 mrg S-M-H or S-M-Delete or S-M-Backspace
158 1.1.1.2 mrg Delete word at cursor position or previous word.
159 1.1.1.2 mrg Does not go to the kill ring.
160 1.1.1.2 mrg M-. Find definition/declaration of symbol string of selected text, and/or
161 1.1.1.2 mrg finds next tag when more than one definition exists for the symbol.
162 1.1.1.2 mrg M-< or Home
163 1.1.1.2 mrg Move cursor to beginning of file.
164 1.1.1.2 mrg M-> or End
165 1.1.1.2 mrg Move cursor to end of file.
166 1.1.1.2 mrg M-] or C-Down
167 1.1.1.2 mrg Move cursor to next paragraph.
168 1.1.1.2 mrg M-[ or C-Up
169 1.1.1.2 mrg Move cursor to previous paragraph.
170 1.1.1.2 mrg C-_ or C-X,U
171 1.1.1.2 mrg Undo.
172 1.1.1.2 mrg If enabled in the given textwidget. Not enabled by default in the
173 1.1.1.2 mrg message window and filename window, or any of the other text widgets
174 1.1.1.2 mrg in the several available dialogs.
175 1.1.1.2 mrg C-\ or C-Kanji
176 1.1.1.2 mrg Reconnect Input Method.
177 1.1.1.2 mrg In international mode (probably broken interface).
178 1.1.1.2 mrg S-Insert
179 1.1.1.2 mrg Insert PRIMARY selection from CUT_BUFFER0.
180 1.1.1.2 mrg C-Q
181 1.1.1.2 mrg Followed by any character, will insert the next typed character
182 1.1.1.2 mrg useful to insert control characters. For example C-Q,C-L will
183 1.1.1.2 mrg insert ^L at the cursor position.
184 1.1.1.2 mrg LeftMouseButton
185 1.1.1.2 mrg When pressed marks the start of a PRIMARY selection at CUTBUFFER0
186 1.1.1.2 mrg When moved while pressed extends the selection.
187 1.1.1.2 mrg MiddleMouseButton
188 1.1.1.2 mrg When pressed, inserts the PRIMARY selection at CUTBUFFER0 at
189 1.1.1.2 mrg the cursor position.
190 1.1.1.2 mrg RightMouseButton
191 1.1.1.2 mrg Can be used to adjust a selection done with LeftMouseButton.
192 1.1.1.2 mrg C-A,Tab
193 1.1.1.2 mrg If the loaded file has a indentation rules file, C or Lisp, xedit
194 1.1.1.2 mrg will reindent the line. Also, entering a fresh character on a
195 1.1.1.2 mrg newline should be enough to move the cursor to the proper position.
196 1.1.1.2 mrg To override it, you may need to use the C-U to multiply the action,
197 1.1.1.2 mrg as it will only indent if only one character was added.
198 1.1.1.2 mrg C-X,C-C or (Pressing the Quit button)
199 1.1.1.2 mrg Exits xedit.
200 1.1.1.2 mrg If there are unsaved files, a message will be printed asking to
201 1.1.1.2 mrg "exit" again, or save the files.
202 1.1.1.2 mrg C-X,C-E
203 1.1.1.2 mrg Execute lisp expression before the cursor position.
204 1.1.1.2 mrg C-X,C-F
205 1.1.1.2 mrg Changes keyboard input focus to the filename text input window.
206 1.1.1.2 mrg In this mode, pressing Tab will try to complete the filename
207 1.1.1.2 mrg being typed.
208 1.1.1.2 mrg When more than one match exists, pressing Tab again will display
209 1.1.1.2 mrg the directory navigation window.
210 1.1.1.2 mrg The initial search path usually is the basename of the file loaded
211 1.1.1.2 mrg in the current textwindow, or currently directory from where
212 1.1.1.2 mrg xedit was started if the *scratch* is the current "buffer".
213 1.1.1.2 mrg The character ~ can be used as a shortcut for the home directory
214 1.1.1.2 mrg and ~username will be replaced by the home directory of "username"
215 1.1.1.2 mrg if it exists.
216 1.1.1.2 mrg C-X,C-S or (Pressing the Save button)
217 1.1.1.2 mrg Saves the file in the current text window.
218 1.1.1.2 mrg C-X,Tab
219 1.1.1.2 mrg Indents the current paragraph.
220 1.1.1.2 mrg Use the C-U modifier to specify the number of spaces to insert
221 1.1.1.2 mrg or remove if the C-U parameter is negative.
222 1.1.1.2 mrg C-X,0
223 1.1.1.2 mrg Deletes the current window.
224 1.1.1.2 mrg The file being edited is not unloaded.
225 1.1.1.2 mrg C-X,1
226 1.1.1.2 mrg Deletes the other window.
227 1.1.1.2 mrg The file being edited is not unloaded.
228 1.1.1.2 mrg C-X,2
229 1.1.1.2 mrg Splits vertically the current window.
230 1.1.1.2 mrg C-X,3
231 1.1.1.2 mrg Splits vertically the current window.
232 1.1.1.2 mrg C-X,b
233 1.1.1.2 mrg Switch the contents of the current window to the next file in
234 1.1.1.2 mrg the list of loaded files.
235 1.1.1.2 mrg C-X,d
236 1.1.1.2 mrg Displays the directory listing window.
237 1.1.1.2 mrg In this window, it is possible to navigate in the file system
238 1.1.1.2 mrg to choose a file to edit.
239 1.1.1.2 mrg Usually, this is the same as pressing C-X,C-F,Tab
240 1.1.1.2 mrg See C-X,C-F for more information.
241 1.1.1.2 mrg C-X,k
242 1.1.1.2 mrg Unloads the file being edited.
243 1.1.1.2 mrg If the file has not been saved, a message will be displayed,
244 1.1.1.2 mrg asking to either press C-X,k again, or save the file
245 1.1.1.2 mrg The *scratch* buffer cannot be killed and will always
246 1.1.1.2 mrg prints a warning when exiting xedit. This is the expected behavior.
247 1.1.1.2 mrg C-X,o
248 1.1.1.2 mrg Switch input focus to the other window, making it the current one
249 1.1.1.2 mrg If the editor doesn't have splited windows, this command is ignored.
250 1.1.1.2 mrg Insert
251 1.1.1.2 mrg Switches between insert and overwrite mode.
252 1.1.1.2 mrg In overwrite mode text is typed over existing file contents,
253 1.1.1.2 mrg only extending the file contents when typing at the end of
254 1.1.1.2 mrg a line (or file).
255 1.1.1.2 mrg Escape
256 1.1.1.2 mrg Enters the line edit mode.
257 1.1.1.2 mrg In this mode it is possible to use regex expressions to search and
258 1.1.1.2 mrg replace the contents of the file loaded in the current text window.
259 1.1.1.2 mrg Refer to the xedit(1) manpage for more information of the regex
260 1.1.1.2 mrg expression format.
261 1.1.1.2 mrg Note that the regex used by xedit isn't IEEE Std 1003.2 compliant,
262 1.1.1.2 mrg and not compliant with most regex implementations in that it doesn't
263 1.1.1.2 mrg support some complex search patterns, usually involving patterns
264 1.1.1.2 mrg like ((.*)+)? that may require too much restarts or have several
265 1.1.1.2 mrg correct interpretations for multiple matches. Also, it always does
266 1.1.1.2 mrg minimal matching, and it is not configurable like in pcre, example:
267 1.1.1.2 mrg searching "a1a1a1" with the pattern "(.*)\d" will find "a1" and
268 1.1.1.2 mrg not "a1a1a1" as could be expected.
269 1.1.1.2 mrg Please refer to lisp/re/README for more information on the supported
270 1.1.1.2 mrg regex expressions.
271 1.1.1.2 mrg C-LeftMouseButton
272 1.1.1.2 mrg Displays the "File Menu" from where it is possible to select a
273 1.1.1.2 mrg new file to be edited in the current window.
274 1.1.1.2 mrg C-MiddleMouseButton
275 1.1.1.2 mrg Displays the "Edit Menu" that usually has the following options:
276 1.1.1.2 mrg +------------------+-------------+
277 1.1.1.2 mrg | Wrapping -> | Never |
278 1.1.1.2 mrg | | Line |
279 1.1.1.2 mrg | | Word |
280 1.1.1.2 mrg | Auto Fill +-------------+
281 1.1.1.2 mrg | +-------------+
282 1.1.1.2 mrg | Justification -> | Left |
283 1.1.1.2 mrg | | Right |
284 1.1.1.2 mrg | | Center |
285 1.1.1.2 mrg | | Full |
286 1.1.1.2 mrg | +-------------+
287 1.1.1.2 mrg | Break Columns... |
288 1.1.1.2 mrg | +-------------+
289 1.1.1.2 mrg | Scrollbars -> | Vertical |
290 1.1.1.2 mrg | | Horizontal |
291 1.1.1.2 mrg | +-------------+
292 1.1.1.2 mrg | +-------------+
293 1.1.1.2 mrg | Edit Mode -> | Plain/None |
294 1.1.1.2 mrg | | C/C++ |
295 1.1.1.2 mrg | | Lisp/Scheme |
296 1.1.1.2 mrg | | X imake |
297 1.1.1.2 mrg | | Makefile |
298 1.1.1.2 mrg | | Unix shell |
299 1.1.1.2 mrg | | SGML |
300 1.1.1.2 mrg | | HTML |
301 1.1.1.2 mrg | | Man page |
302 1.1.1.2 mrg | | X resource |
303 1.1.1.2 mrg | | XF86Config |
304 1.1.1.2 mrg | | RPM spec |
305 1.1.1.2 mrg | | XFree86 log |
306 1.1.1.2 mrg | | Patch file |
307 1.1.1.2 mrg +------------------+-------------+
308 1.1.1.2 mrg "Wrapping" is disabled if "Auto Fill" is enabled.
309 1.1.1.2 mrg "Justification" and "Break Columns..." are enabled if "Auto Fill"
310 1.1.1.2 mrg is also enabled.
311 1.1.1.2 mrg "Edit Mode" lists the available syntax highlight and indentation
312 1.1.1.2 mrg rules defined.
313 1.1.1.2 mrg Note that most of these options don't work in "international" mode.
314 1.1.1.2 mrg Several xedit interfaces works only with 8 bits encodings, and
315 1.1.1.2 mrg doesn't properly handle UTF-8.
316 1.1.1.2 mrg C-RightMouseButton
317 1.1.1.2 mrg Displays the "Option Menu".
318 1.1.1.2 mrg Currently the only option is an Ispell frontend.
319 1.1.1.2 mrg FourthMouseButton (usually also moving up the mouse wheel)
320 1.1.1.2 mrg Scroll one line down
321 1.1.1.2 mrg FifthMouseButton (usually also moving down the mouse wheel)
322 1.1.1.2 mrg Scroll one line up
323 1.1.1.2 mrg
324 1.1.1.2 mrg
325 1.1.1.2 mrg
326 1.1.1.2 mrg There is also some documentation in lisp/README, lisp/TODO,
327 1.1.1.2 mrg lisp/re/README, lisp/re/tests.txt, and comments/justifications/wishlists for
328 1.1.1.2 mrg the cases the interpreter fail to give the proper result for a given test.
329 1.1.1.2 mrg
330 1.1.1.2 mrg The lisp interpreter implements most of a standard COMMON LISP
331 1.1.1.2 mrg environment, but the compiler generates only byte code and not everything
332 1.1.1.2 mrg can be compiled, in those cases the interpreter does the work. Examples are
333 1.1.1.2 mrg constructs involving UNWIND-PROTECT or any kind of jump outside of the
334 1.1.1.2 mrg current function body.
335 1.1.1.2 mrg
336 1.1.1.2 mrg For more information please consult any COMMON LISP documentation or
337 1.1.1.2 mrg tutorial.
338 1.1.1.2 mrg
339 1.1.1.2 mrg
340 1.1.1.2 mrg
341 1.1.1.2 mrg Simple tutorial on writing a "foolang" syntax highlight mode for xedit.
342 1.1.1.2 mrg
343 1.1.1.2 mrg Create a file called foolang.lsp
344 1.1.1.2 mrg Add:
345 1.1.1.2 mrg --
346 1.1.1.2 mrg (require "syntax")
347 1.1.1.2 mrg (require "indent")
348 1.1.1.2 mrg (in-package "XEDIT")
349 1.1.1.2 mrg --
350 1.1.1.2 mrg to foolang.lsp
351 1.1.1.2 mrg Check the available files if you want a custom property, or to know about
352 1.1.1.2 mrg the available ones. One example is:
353 1.1.1.2 mrg --
354 1.1.1.2 mrg (defsynprop *prop-foolang*
355 1.1.1.2 mrg "foolang"
356 1.1.1.2 mrg :font "fixed"
357 1.1.1.2 mrg :foreground "rgb:a/b/c"
358 1.1.1.2 mrg :background "rgb:1/2/3"
359 1.1.1.2 mrg :underline t
360 1.1.1.2 mrg :overstrike t)
361 1.1.1.2 mrg --
362 1.1.1.2 mrg Check lisp/modules/xedit.lsp for the other options, like subscript,
363 1.1.1.2 mrg superscript and/or combining XLFD properties.
364 1.1.1.2 mrg Create a syntax definition for foolang. Check the definition of defsyntax in
365 1.1.1.2 mrg lisp/modules/syntax.lsp for more details. One example for foolang is:
366 1.1.1.2 mrg --
367 1.1.1.2 mrg (defsyntax *foolang-mode* :foolang nil nil nil
368 1.1.1.2 mrg ;; use the sample property created for foolang whenever the string
369 1.1.1.2 mrg ;; foolang is found at the toplevel
370 1.1.1.2 mrg (syntoken "\\<foolang\\>" :property *prop-foolang*)
371 1.1.1.2 mrg
372 1.1.1.2 mrg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
373 1.1.1.2 mrg ;; process C style comments
374 1.1.1.2 mrg (syntoken "/*" :nospec t :begin :comment :contained t)
375 1.1.1.2 mrg ;; contained is an option to not "export" this definition to child
376 1.1.1.2 mrg ;; tables
377 1.1.1.2 mrg
378 1.1.1.2 mrg (syntable :comment *prop-comment* #'default-indent
379 1.1.1.2 mrg ;; #'default-indent means a very simple indent that follows indentation
380 1.1.1.2 mrg ;; of previous line. Use nil for no indentation
381 1.1.1.2 mrg
382 1.1.1.2 mrg ;; Don't start a new table, instead flag as an error if nested
383 1.1.1.2 mrg (syntoken "/*" :nospec t :property *prop-error*)
384 1.1.1.2 mrg ;; :nospec t sets the RE_NOSPEC flag for the regex, i.e. searches
385 1.1.1.2 mrg ;; a literal string, and * will not be a special character
386 1.1.1.2 mrg
387 1.1.1.2 mrg (syntoken "XXX|TODO|FIXME" :property *prop-annotation*)
388 1.1.1.2 mrg ;; just to make it easier to flag some important comment
389 1.1.1.2 mrg
390 1.1.1.2 mrg (syntoken "*/" :nospec t :switch -1)
391 1.1.1.2 mrg ;; The :switch argument is the number of tables to "pop", in
392 1.1.1.2 mrg ;; this case, we are at table :comment, and :switch -1 returns
393 1.1.1.2 mrg ;; to table :foolang, that is the "root" table
394 1.1.1.2 mrg )
395 1.1.1.2 mrg
396 1.1.1.2 mrg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
397 1.1.1.2 mrg ;; Process lisp comments that can nest
398 1.1.1.2 mrg (syntable :lisp-comment *prop-comment* nil
399 1.1.1.2 mrg
400 1.1.1.2 mrg ;; Start a comment, possibly nested
401 1.1.1.2 mrg (syntoken "#|" :nospec t :begin :lisp-comment)
402 1.1.1.2 mrg
403 1.1.1.2 mrg ;; Returns to previous comment in stack or to main :foolang table
404 1.1.1.2 mrg (syntoken "|#" :nospec t :switch -1)
405 1.1.1.2 mrg
406 1.1.1.2 mrg ;; For easier flagging important comments
407 1.1.1.2 mrg (syntoken "XXX|FIXME|TODO" :property *prop-annotation*)
408 1.1.1.2 mrg )
409 1.1.1.2 mrg
410 1.1.1.2 mrg ;; This is usually in the end of the list, but can be anywhere,
411 1.1.1.2 mrg ;; just that if it isn't at the end, conflicting rules are resolved
412 1.1.1.2 mrg ;; by declaration order
413 1.1.1.2 mrg (synaugment :lisp-comment)
414 1.1.1.2 mrg ;; Adds the :lisp-comment table to :foolang table
415 1.1.1.2 mrg
416 1.1.1.2 mrg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
417 1.1.1.2 mrg ;; Lisp like strings that don't need a \ at the end of the line
418 1.1.1.2 mrg (syntable :lisp-string *prop-string* nil
419 1.1.1.2 mrg ;; ignore a escaped " in the middle of the string
420 1.1.1.2 mrg (syntoken "\\\\.")
421 1.1.1.2 mrg ;; Note that no options are used, just keep using the current
422 1.1.1.2 mrg ;; property. Unfortunately, backslashes must be escaped twice.
423 1.1.1.2 mrg ;; Once for the lisp reader and once for the regex compiler.
424 1.1.1.2 mrg
425 1.1.1.2 mrg (syntoken "\"" :nospec: t :switch -1)
426 1.1.1.2 mrg ;; :nospec is used just to create a faster regex. switch -1
427 1.1.1.2 mrg ;; returns to the previous syntax table. It isn't an error to
428 1.1.1.2 mrg ;; try to go down the "root" table, but if that happens, it
429 1.1.1.2 mrg ;; probably means either wrong syntax definition of malformed input.
430 1.1.1.2 mrg )
431 1.1.1.2 mrg
432 1.1.1.2 mrg (synaugment :lisp-string)
433 1.1.1.2 mrg ;; Adds the :lisp-string table to :foolang table
434 1.1.1.2 mrg ;; Note that since there isn't a rule to start a string in the
435 1.1.1.2 mrg ;; :lisp-string table, it cannot nest, maybe because the ending
436 1.1.1.2 mrg ;; character is the starting character ? :-))
437 1.1.1.2 mrg
438 1.1.1.2 mrg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
439 1.1.1.2 mrg ;; C style string rules
440 1.1.1.2 mrg (syntable :string *prop-string* nil
441 1.1.1.2 mrg ;; Ignore escaped characters
442 1.1.1.2 mrg (syntoken "\\\\.")
443 1.1.1.2 mrg
444 1.1.1.2 mrg ;; Match, most, printf arguments.
445 1.1.1.2 mrg (syntoken "%%|%([+-]?\\d+)?(l?[deEfgiouxX]|[cdeEfgiopsuxX])"
446 1.1.1.2 mrg :property *prop-format*)
447 1.1.1.2 mrg ;; Just for fun. This makes easier to see printf formats in strings
448 1.1.1.2 mrg ;; *prop-format* is *prop-string* with the :underline option
449 1.1.1.2 mrg
450 1.1.1.2 mrg (syntoken "\\\\$")
451 1.1.1.2 mrg ;; a backslash extends the string to the next line
452 1.1.1.2 mrg
453 1.1.1.2 mrg ;; A nonscaped " inside a string finishes it, since this table doesn't
454 1.1.1.2 mrg ;; have sub tables, and cannot nest, should return to :foolang table
455 1.1.1.2 mrg ;; from here
456 1.1.1.2 mrg (syntoken "\"" :nospec t :switch -1)
457 1.1.1.2 mrg
458 1.1.1.2 mrg ;; This token rule starts a new table called :error because end of line
459 1.1.1.2 mrg ;; has been matched. Note that it is defined last, so that a line
460 1.1.1.2 mrg ;; ending with " or \ will be processed first.
461 1.1.1.2 mrg (syntoken ".?$" :begin :error)
462 1.1.1.2 mrg
463 1.1.1.2 mrg (synaugment :string)
464 1.1.1.2 mrg ;; Adds the :string table to :foolang table
465 1.1.1.2 mrg
466 1.1.1.2 mrg ;; This table is used by :string, but could be shared for other patterns
467 1.1.1.2 mrg ;; like characters constants, etc.
468 1.1.1.2 mrg ;; It uses :switch -2 because it is started inside the :string table,
469 1.1.1.2 mrg ;; but it is also a table, so, pops two tables from the table stack
470 1.1.1.2 mrg (syntable :error *prop-error* nil
471 1.1.1.2 mrg (syntoken "^.*$" :switch -2)
472 1.1.1.2 mrg )
473 1.1.1.2 mrg )
474 1.1.1.2 mrg --
475 1.1.1.2 mrg
476 1.1.1.2 mrg Indentation rules are significantly more complex. I suggest looking at
477 1.1.1.2 mrg lisp/modules/indent.lsp for the macros and function definitions;
478 1.1.1.2 mrg and lisp/modules/progmodes/lisp.lsp and lisp/modules/progmodes/c.lsp for two
479 1.1.1.2 mrg sample implementations of indentation for Lisp/Scheme and C/C++
480 1.1.1.2 mrg respectively.
481 1.1.1.2 mrg
482 1.1.1.2 mrg Note also that indentation is parsed backwards, what can cause some
483 1.1.1.2 mrg confusion, and make "visualization" of order or precedence of evaluation for
484 1.1.1.2 mrg rules harder to understand.
485 1.1.1.2 mrg
486 1.1.1.2 mrg A simple indentation rules definition for foolang could be:
487 1.1.1.2 mrg
488 1.1.1.2 mrg --
489 1.1.1.2 mrg (defindent *foolang-mode-indent* :foolang
490 1.1.1.2 mrg ;; This must be the first token and usually the only token matching
491 1.1.1.2 mrg ;; BOL (Beginning of Line)
492 1.1.1.2 mrg (indtoken "^\\s*" :indent
493 1.1.1.2 mrg :code (or *offset* (setq *offset* (+ *ind-offset* *ind-length*))))
494 1.1.1.2 mrg ;; the keyword :indent is a pattern put on a list when there is
495 1.1.1.2 mrg ;; a match, so that later patterns can be "reduced" by some other
496 1.1.1.2 mrg ;; rule, i.e.: (:indent :indent) could be reduced to (:indent)
497 1.1.1.2 mrg
498 1.1.1.2 mrg (indtoken "//.*$" nil)
499 1.1.1.2 mrg ;; C++ style comment. Returning nil instead of a token basically
500 1.1.1.2 mrg ;; ignores the token, as it should not enter the reduction pattern
501 1.1.1.2 mrg ;; list
502 1.1.1.2 mrg
503 1.1.1.2 mrg ;; Sample C comment pattern
504 1.1.1.2 mrg (indtoken "*/" :ccomment :nospec t :begin :comment)
505 1.1.1.2 mrg ;; Note that the indaugment macro doesn't need to be used, and actually
506 1.1.1.2 mrg ;; would be an error. In this example, the indentation compiler checks
507 1.1.1.2 mrg ;; the :begin :comment and handles it internally, as it already needs
508 1.1.1.2 mrg ;; to check for things like typos, unreachable labels, detectable
509 1.1.1.2 mrg ;; non resolving rules, etc. There is runtime check also, so it should
510 1.1.1.2 mrg ;; never enter an infinite loop when trying to resolve reduction rules.
511 1.1.1.2 mrg ;; Check lisp/modules/indent.lsp:(compile-indent-table) for the
512 1.1.1.2 mrg ;; implementation and more comments.
513 1.1.1.2 mrg
514 1.1.1.2 mrg ;; Indentation rules also have stacked tables
515 1.1.1.2 mrg (indtable :comment
516 1.1.1.2 mrg (indtoken "/*" :ocomment :nospec t :switch -1))
517 1.1.1.2 mrg ;; Note that the name is :ocomment (open comment), but that the
518 1.1.1.2 mrg ;; the table is finished when matching the open comment pattern
519 1.1.1.2 mrg
520 1.1.1.2 mrg ;; A simple initialization of a variable used by the indentation rules
521 1.1.1.2 mrg (indinit (parens 0))
522 1.1.1.2 mrg ;; This variable can be declared anywhere in the body of defindent,
523 1.1.1.2 mrg ;; It will be properly moved to a "variables declaration section"
524 1.1.1.2 mrg ;; when expanding and compiling the table.
525 1.1.1.2 mrg
526 1.1.1.2 mrg (indtoken "(" :oparen :nospec t :code (incf parens))
527 1.1.1.2 mrg (indtoken ")" :cparen :nospec t :code (decf parens))
528 1.1.1.2 mrg ;; These two tokes add the patterns :oparen and :cparen to the
529 1.1.1.2 mrg ;; "pattern list", and also have code to remember the balancing
530 1.1.1.2 mrg ;; of parenthesis.
531 1.1.1.2 mrg
532 1.1.1.2 mrg
533 1.1.1.2 mrg ;; One of the simplest reduction rules :-)
534 1.1.1.2 mrg (indreduce nil
535 1.1.1.2 mrg t
536 1.1.1.2 mrg ((:comment)))
537 1.1.1.2 mrg ;; Once the boundings of a comment are found, just ignore it, like
538 1.1.1.2 mrg ;; what was done with the // pattern, but in that case, the boundings
539 1.1.1.2 mrg ;; were readily available.
540 1.1.1.2 mrg ;; The t (True) parameter means that this rule is always evaluated,
541 1.1.1.2 mrg ;; but conditional code may be used, and implicit code may be added
542 1.1.1.2 mrg ;; to the end of the indreduce macro.
543 1.1.1.2 mrg ;; Since it is a macro, code can be compiled to optimized bytecode
544 1.1.1.2 mrg ;; after the macro is expanded.
545 1.1.1.2 mrg
546 1.1.1.2 mrg (indinit (indent 0))
547 1.1.1.2 mrg ;; Note that there is a special *indent* variable that should hold the
548 1.1.1.2 mrg ;; proper indentation value, but it may be required to "overwrite"
549 1.1.1.2 mrg ;; without forgetting that value, for things like:
550 1.1.1.2 mrg ;;
551 1.1.1.2 mrg ;; foo(bar(baz(blah
552 1.1.1.2 mrg ;; ^ ^
553 1.1.1.2 mrg ;; | |
554 1.1.1.2 mrg ;; indent |
555 1.1.1.2 mrg ;; effective indentation to be used
556 1.1.1.2 mrg ;;
557 1.1.1.2 mrg ;; where it is desirable to align the code in the next line with the
558 1.1.1.2 mrg ;; last open parenthesis.
559 1.1.1.2 mrg
560 1.1.1.2 mrg
561 1.1.1.2 mrg Since the interface is, unfortunately, complex enough to not expect
562 1.1.1.2 mrg casual users to have something like a $HOME/.xedit file, if you want to add
563 1.1.1.2 mrg new modes, please check lisp/modules/xedit.lsp:*auto-modes*
564 1.1.1.2 mrg
565 1.1.1.2 mrg There is some documentation about the variable. It should be possible to
566 1.1.1.2 mrg change/update the variable from the lisp interface in the *scratch* buffer,
567 1.1.1.2 mrg but for safety, it is suggested that if you add new rules, you should
568 1.1.1.2 mrg restart xedit after it. Also note that there is compiled code in
569 1.1.1.2 mrg lisp/xedit.c that expects that variable to follow an specific format.
570 1.1.1.2 mrg
571 1.1.1.2 mrg You may notice that several .lsp files aren't "properly indented"; this
572 1.1.1.2 mrg is because the lisp indentation rules file was made long after most of the
573 1.1.1.2 mrg other files were done, and it was considered a bad practice to gratuitously
574 1.1.1.2 mrg reindent all files.
575 1.1.1.2 mrg
576 1.1.1.2 mrg
577 1.1.1.2 mrg
578 1.1.1.2 mrg At the time of this writing, the ispell interface should be again
579 1.1.1.2 mrg functional, but it may be required to use some old ispell program to handle
580 1.1.1.2 mrg non utf8 text. But it should work properly for the english language, and in
581 1.1.1.2 mrg international mode, should work with any language. But there are problems in
582 1.1.1.2 mrg international mode not fixed.
583 1.1.1.2 mrg
584 1.1.1.2 mrg I (Paulo Cesar) considered several times to extend the normal
585 1.1.1.2 mrg textwidget to handle utf8, but this is probably a lot of work/time badly
586 1.1.1.2 mrg spent and I prefer to work on other personal projects, but still xedit is
587 1.1.1.2 mrg the editor I use for programming. The XPRINT support unfortunately is broken
588 1.1.1.2 mrg due to it. Note that xedit, like pretty much any other Xaw application can
589 1.1.1.2 mrg be linked against Xaw with XPRINT support. In the case of xedit, a flag
590 1.1.1.2 mrg could be used, like the "international" variable to, at runtime, disable all
591 1.1.1.2 mrg the related code, if required.
592 1.1.1.2 mrg
593 1.1.1.2 mrg Also at the time of this writing, the tags interface was added, as well
594 1.1.1.2 mrg as several other bug fixes. The tags interface is documented in the manpage,
595 1.1.1.2 mrg but the action shortcut may not be clear. The default shortcut is M-. .
596 1.1.1.2 mrg There is no support for more than one tags file, or changing the tags file
597 1.1.1.2 mrg at runtime. But the code should be easy to adapt for this case, as all
598 1.1.1.2 mrg related functions receive pointers to the appropriate structures. One option
599 1.1.1.2 mrg could be to descend from the directory of the loaded file searching for a
600 1.1.1.2 mrg tags file, and then associate the file with the tags definition, if it isn't
601 1.1.1.2 mrg already loaded. Shouldn't be hard to implement. For "inter project" files,
602 1.1.1.2 mrg it should be better to have one xedit window per "project", i.e. searching
603 1.1.1.2 mrg the definition of something like a libc symbol should probably be done in
604 1.1.1.2 mrg another xedit window.
605