summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* linenoise: undo feature.Kaz Kylheku2015-09-201-0/+26
| | | | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (LINENOISE_MAX_UNDO): New preprocessor symbol. (struct lino_state): New member, undo_stack. (struct lino_undo): New struct type. (free_undo, record_undo, record_triv_undo, restore_undo): New static functions. (edit_insert): Record trivial undo item with record_triv_undo. (edit_insert_str, edit_history_next, edit_delete, edit_backspace, edit_delete_prev_all, edit_delete_prev_word, edit_in_editor): Record undo item. (edit): Record undo item before Ctrl-R history recall and Ctrl-T twiddle. Also record one final undo item upon Enter, as well as Ctrl-C. New Ctrl-O command to undo. (lino_copy): Do not copy undo_stack, to prevent double freeing. (lino_free): Free the undo history. * txr.1: Documented.
* linenoise: visual select and clipboard copy/paste.Kaz Kylheku2015-09-201-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (struc lino_state): New member, clip, sel, end, dsel, dend, need_refresh, selmode. (sync_data_to_buf): Update the sel and end members of the structure based on dsel and dend, the way pos is being updated from dpos. (refresh_singleline, refresh_multiline): If visual selection mode is in effect, show the selected region in inverse video. (update_sel, clear_sel, yank_sel, delete_sel): New static function. (edit_insert): Delete the selection before inserting, so that the character appears to replace the selection. Set need_refresh flag instead of calling refresh_line. (edit_insert_str): New static function. Inserts string, replacing existing selection, if any. (paren_jump, edit_move_left, edit_move_right, edit_move_home, edit_move_end, edit_history_next): Set new need_refresh flag instead of calling refresh_line directly. (edit_delete): If selection is in effect, just delete the selection and return. Set need_refresh flag instead of calling refresh_line. (edit_backspace): If selection is in effect, and selection is not inverted (cursor is to the right of selection) then just delete the selection. Otherwise delete the selection, and perform the backspace. Set need_refresh flag instead of calling refresh_line. (edit_delete_prev_word): Delete the selection and the word before the selection. Set need_refresh flag instead of calling refresh_line. (edit_in_editor): Set need_refresh_flag instead of calling refresh_line, and cancel visual selection mode. (edit): Clear selection mode on entry. Update the selection variables on each loop iteration. Honor the need_refresh flag. New commands implemented: Ctrl-S, Ctrl-Q, Ctrl-X Ctrl-Q. Some commands need to set need_refresh flag. Some need to cancel selection mode. (lino_copy): Set the clip member of the cloned structure to null, otherwise there will be a double free of the clipboard buffer. (lino_cleanup): Free the clipboard and null out the pointer. * txr.1: Documented visual select.
* Adding flatcar* function.Kaz Kylheku2015-09-191-9/+13
| | | | | | | | | | | | * eval.c (eval_init): Registered flatcar* intrinsic. * lib.c (lazy_flatcar_scan, lazy_flatcar_func): New static functions. (lazy_flatcar): New function. * lib.h (lazy_flatcar): Declared. * txr.1: Documented, also touching flatten documentation.
* Atom insert feature.Kaz Kylheku2015-09-181-0/+19
| | | | | | | | * parser.c (provide_atom): New static function. (repl): Register provide_atom with linenoise as atom callback. * txr.1: Documented.
* New function: flatcar.Kaz Kylheku2015-09-181-0/+34
| | | | | | | | | | * eval.c (eval_init): Register flatcar intrinsic. * lib.c (flatcar): New function. * lib.h (flatcar): Declared. * txr.1: Documented.
* linenoise: insert previous word featureKaz Kylheku2015-09-181-0/+13
| | | | | | | | * linenoise/linenoise.c (edit): Ctrl-X Ctrl-W, or Ctrl-X w, with an optional number in between, cause a word from the previous line to be inserted. * txr.1: Documented.
* Doc fix under getpwnam.Kaz Kylheku2015-09-181-1/+1
| | | | * txr.1: Description wrongly refers to getpwuid.
* Improved ~/.txr_profile checks, with security.Kaz Kylheku2015-09-181-2/+12
| | | | | | | | | | * parser.c (load_rcfile): Use path-exists-p for the existence check. Since that doesn't throw, it's outside of the catch section. Use path-private-to-me-p to impose a security check on the profile file. If an error exception is caught, show the details. * txr.1: Added notes about security check.
* New function path-private-to-me.Kaz Kylheku2015-09-171-0/+35
| | | | | | | | | * lisplib.c (path_test_set_entries: "path-private-to-me-p" addred to name array. * share/txr/stdlib/path-test.tl (path-private-to-me-p): New function. * txr.1: Documented path-private-to-me.
* Add unix group database functions.Kaz Kylheku2015-09-171-0/+78
| | | | | | | | | | | | | | | | | | * configure (have_grgid): New variable. New tests added for getgrent and the rest. (HAVE_GRGID, HAVE_GRGID_R): New preprocessor symbols conditionally deposited into config/config.h. * sysif.c (group_s, mem_s): New global symbol variables. (setgrent_wrap, endgrent_wrap, fill_group, make_grstruct, get_grent_wrap, getgrgid_wrap, getgrnam_wrap): New static functions. (sysif_init): New global symbol variables initialized. New group struct type instantiated. Intrinsic functions setgrent, endgrent, getgrent, getgrgid and getgrnam registered. * txr.1: Documented group structure and functions.
* linenoise: Ctrl-X Ctrl-V super verbatim mode.Kaz Kylheku2015-09-171-0/+11
| | | | | | | | * linenoise/linenoise.c (edit): Support a verbatim entry mode with limited commands, in which most characters self-insert, including Enter. * txr.1: Documented.
* Version 116.txr-116Kaz Kylheku2015-09-171-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Listener configuration variables.Kaz Kylheku2015-09-171-7/+39
| | | | | | | | | | | | | | | | | | * linenoise/linenoise.c (lino_get_multiline): New function. * linenoise/linenoise.h (lino_get_multiline): Declared. * parser.c (listener_hist_len, listener_multi_line_p_s): New symbol global variables. (repl): Set linenoise history length and multi-line mode from the *listener-hist-len* and *listener-multi-line-p* variables on each call. Set the *listener-multi-line* variable from the lino_t object's current state after each linenoise call. (parse_init): Initialize new global variables and register them as special variables. * txr.1: Update sentence which says that history is fixed at 100 lines. Document listener configuration variables.
* Describe listener limitations.Kaz Kylheku2015-09-161-0/+7
| | | | * txr.1: New section about line length limit and other restrictions.
* Rearrange some subsections.Kaz Kylheku2015-09-161-36/+37
| | | | | * txr.1: Clear Screen, Suspend, and History Persistence are not editing commands. They get their own sections.
* linenoise: edit command line in external editor.Kaz Kylheku2015-09-161-0/+24
| | | | | | | | * linenoise/linenoise.c (tr, edit_in_editor): New static functions. (edit): edit_in_editor hooked in under Ctrl-X Ctrl-E. * txr.1: Documented.
* linenoise: enhanced multi-line mode with line breaks.Kaz Kylheku2015-09-161-3/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The linenoise multi-line mode is just a glorified line wrapper, and not actualy a multi-line editor, like in GNU Readline and others. This commit fixes it. The edit buffer can now contain line breaks, separated by carriage return characters. (In single-line mode, these characters continue to be displayed as ^M). The row and column calculations in the multi-line refresh follow this data representation. * linenoise/linenoise.c (sync_data_to_buf): This function now takes an extra argument telling it whether multi-line mode is in effect for the rendering. In multi-line mode, the prompt is now added to the display data, so that multi-line refresh is simplified by not having to account for the prompt length in various calculations. Also, in multi-line mode, carriage returns are rendered to display as CR-LF pairs, since they denote embedded line breaks. (complete_line): Pass mlmode to sync_data_to_buf. (struct row_values): New struct, for returning multiple row values out of a function. (screen_rows, col_offset_in_str): New static functions. (refresh_multiline): Modified to use screen_rows and col_offset_in_str for its calculations, and not to deal with the prompt at all, since the prompt is rolled into the display data. (refresh_line, edit_insert): Pass mlmode to sync_data_to_buf. * txr.1: Documented multi-line mode.
* linenoise: parenthesis-matching backward jump.Kaz Kylheku2015-09-151-0/+22
| | | | | | | | | | | * linenoise/linenoise.c (LINENOISE_PAREN_DELAY): New preprocessor symbol. (scan_match_rev, scan_rev, usec_delay, paren_jump): New static functions. (edit): Handle closing parenthesis, bracket and brace by inserting and calling paren_jump. * txr.1: Documented.
* Wording and grammar fix under permutationsKaz Kylheku2015-09-151-3/+3
| | | | | * txr.1: Fix inappropriately copy and pasted ungrammatical text "permutations is of zero length".
* Implement ~/.txr_profile mechanism.Kaz Kylheku2015-09-131-0/+22
| | | | | | | | | | | | * parser.c (load_rcfile): New function. (repl): Compute profile file name and try to load it before entering loop. * sysif.c (statp): Linkage becomes external. * sysif.h (statp): Declaration updated. * txr.1: Documented.
* linenoise: recognize additional commands in search.Kaz Kylheku2015-09-131-3/+7
| | | | | | | | | * linenoise/linenoise.c (history_search): Editing keys should leave search mode and be processed in command mode. Also, let's have Ctrl-L and Ctrl-Z work, but stay in search mode. * txr.1: Documented.
* linenoise: support completion in the middle of line.Kaz Kylheku2015-09-121-5/+3
| | | | | | | | | * linenoise/linenoise.c (compare_completions): Restructure with help of new lino_copy function to collect completions just for the prefix of the line up to the cursor position, and recombine those with the suffix. * txr.1: Doc updated.
* linenoise: incorrect ESC treatment in completion.Kaz Kylheku2015-09-121-12/+1
| | | | | | | | | | * linenoise/linenoise.c (complete_line): ESC must not be treated specially when leaving completion mode; it must accept the completed line. The original code did this wrong in my opinion and I propagated the error. * txr.1: Remove all mention of special ESC treatment in completion mode.
* linenoise: Suppress unknown control characters.Kaz Kylheku2015-09-121-5/+7
| | | | | | | * linenoise/linenoise.c (edit): Don't let characters less than 32 be inserted. * txr.1: Documented that control characters are rejected.
* linenoise: Ctrl-R searchKaz Kylheku2015-09-121-0/+45
| | | | | | | | | | | * linenoise/linenoise.c (next_hist_match, history_search): New static function. (edit): New Ctrl-R case added to early switch that also handles Tab completion, and calls history_search. (lino_free): Adding null check, so we can safely call lino_free(0). history_search relies on this. * txr.1: Documented search.
* Treat comment lines in repl, and plug memory leak.Kaz Kylheku2015-09-111-2/+10
| | | | | | | | | | * parser.c (repl): If we continue the loop due to detecting a blank line, we must free that line, since we are outside of the unwind block (and continue would violate that block if we were). If a line contains nothing but a comment, then enter that line into the history. * txr.1: Documented treatment of commented lines.
* New :read command in repl for direct stdin parse.Kaz Kylheku2015-09-111-0/+25
| | | | | | | | * parser.c (read_eval_ret_last): New function. (repl): Use read_eval_ret_last for :read command. * txr.1: Document :read in new section on direct read from the terminal.
* Quit if input form is :quit not its value.Kaz Kylheku2015-09-111-1/+1
| | | | | | | | * parser.c (repl): Subtle difference. Test form's syntax for equality to :quit, not its value. The REPL should not terminate if a form happens to calculate :quit as a value. * txr.1: Updated.
* Document some special keys supported by linenoise.Kaz Kylheku2015-09-111-2/+5
| | | | * txr.1: document Home, End and Delete support.
* linenoise: Ctrl-C cleanly cancels completion.Kaz Kylheku2015-09-111-3/+15
| | | | | | | | | | * linenoise/linenoise.c (complete_line): If Ctrl-C is pressed in completion mode, we cancel completion and return 0 so the command loop reads a new character. * txr.1: Documented Ctrl-C in completion mode, and removed the falsehood that ESC is a cancel command, adding instead an explanation about the ESC handling is really for.
* Version 115.txr-115Kaz Kylheku2015-09-101-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Fix misspelled :toinger filter.Kaz Kylheku2015-09-101-1/+1
| | | | | | | | | | | | | | | | | | | The manual documents a filter called :tointeger, but it has never existed. The keyword was misspelled in the source code from the beginning as :toinger. I'm fixing the typo and renaming the filter to :toint at the same time. * filter.c (tointeger_k, toint_k): Former renamed to latter. (filter_init): Initialize toint_k with correctly spelled symbol. Register filter under toint_k. * filter.h (tointeger_k, toint_k): Former renamed to latter. * txr.1: Changed mention of :tointeger to :toint.
* Bugfix: *args* not bound for command line expressions.Kaz Kylheku2015-09-101-8/+14
| | | | | | | | | | | | | | | | The documentation says that *args* is bound to nil, but actually it is not bound at all. Let us fix this by actualy binding *args* to the remaining arguments, and by also allowing modification of *args* to dynamically take effect. * txr.c: Set up value of *args* prior to processing any option which evaluates TXR Lisp. Afterwards, reload the argument list from that variable. * txr.1: Documented semantics of *args* during command line processing.
* Don't scan C source code for Lisp symbols.Kaz Kylheku2015-09-101-0/+38
| | | | | | | | | | | | | | * eval.c (eval_init): Register package-alist, package-name and package-symbols intrinsics. * genvim.txr: Rather than scanning C sources for TXR Lisp symbols, iterate over the packages and their symbols, collecting anything which has a binding or is self-evaluating. To get the stdlib symbols, we trigger the autoloads by doing boundp queries on a few symbols. * txr.1: Document package-alist, package-name and package-symbols.
* Bugfix: make self-path visible to Lisp.Kaz Kylheku2015-09-101-0/+21
| | | | | | | | | | | | | | | The self-path variable is not bound in TXR Lisp scripts or the command line. * txr.c (txr_main): Set self-path to "cmdline-expr" before command line Lisp evaluations. (For TXR pattern language syntax invoked in a -c, it continues to be "cmdline"). Set self-path to the file name when reading a Lisp file. Also, the legacy, undocumented *self-path* is only set for TXR scripts, and is reverted to being a special variable, not a global lexical. * txr.1: Documented self-path in more detail.
* Formatting under new macro.Kaz Kylheku2015-09-091-0/+1
| | | | * txr.1: Missing .desc added.
* Documented interactive listener.Kaz Kylheku2015-09-081-0/+343
|
* New functions, subtypep and typep.Kaz Kylheku2015-09-081-0/+144
| | | | | | | | | | | | | | | | * eval.c (eval_init): Register subtypep and typep. * eval.h (list_s): Existing variable declared. * lib.c (atom_s, integer_s, number_s, sequence_s, string_s): new symbol variables. (subtypep, typep): New functions. (obj_init): Initialize new symbol variables. * lib.c (atom_s, integer_s, number_s, sequence_s, string_s): Declared. * txr.1: Documented type hierarchy and the new functions.
* Random states of type random-state, not *random-state*.Kaz Kylheku2015-09-081-0/+8
| | | | | | | | | | | | | | | * lib.c (compat_fixup): Call rand_compat_fixup. * rand.c (random_state_var_s): New global symbol variable. (rand_compat_fixup): New static function. (rand_init): Initialize random_state_var_s by intering the earmuffed symbol *random-state*. Initialize random_state_s to the non-earmuffed symbol random-state. * rand.h (random_state_var_s): Declared. (random_state): Macro updated to look up the special variable using random_state_var_s, rather than random_state_s. (rand_compat_fixup): Declared.
* Debugger and compatibility now major sections.Kaz Kylheku2015-09-071-5/+7
| | | | | * txr.1: Debugger and Compatibility are moved out of the TXR library description, into their own major sections.
* kill function returns boolean rather than integer.Kaz Kylheku2015-09-071-1/+11
| | | | | | | | * signal.c (kill_wrap): Return boolean indication of success, with compatibility to previous behavior. * txr.1: Document return value of kill, and put in compatibility note.
* Adding raise function.Kaz Kylheku2015-09-071-0/+17
| | | | | | | * signal.c (raise_wrap): New static function (sig_init): Register raise intrinsic. * txr.1: Documented raise.
* Parse errors lose program prefix and parens.Kaz Kylheku2015-09-061-0/+10
| | | | | | | | | | | * parser.l (yyerrorf): Don't print the program prefix and parenthes, except if compatibility to 114 or older is requested. The main motivation for this is the repl, where the program prefix is not informative. The new format is also a de facto standard which is compatible with other parsers. Vim understands it directly. * txr.1: Documented.
* Version 114.txr-114Kaz Kylheku2015-09-021-2/+2
| | | | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * genvim.txr: Scan struct.c, path-test.tl and struct.tl files. * txr.vim, tl.vim: Regenerated.
* Unix password database access.Kaz Kylheku2015-09-011-0/+79
| | | | | | | | | | | | | | | * configure: Detect getpwuid, getpwuid_r and others. * sysif.c (passwd_s, name_s, gecos_s, dir_s, shell_s): New symbol variables. (setpwent_wrap, endpwent_wrap, fill_passwd, make_pwstruct, getpwent_wrap, getpwuid_wrap, getpwnam_wrap): New static functions. (sysif_init): Initialize new symbol variables. Create passwd structure type. Register setpwent, endpwent, getpwent, getpwuid and getpwnam intrinsics. * txr.1: Documented passwd structure and functions.
* Document new time structure and functions.Kaz Kylheku2015-09-011-0/+65
| | | | | * txr.1: Document time struct, time-struct-local and time-struct-utc.
* Documenting stat structure.Kaz Kylheku2015-09-011-25/+47
| | | | | | * txr.1: stat structure described; places updated to refer to it rather than the old propertly list. Compatibility note added.
* Fix bad .meta/.metn formatting.Kaz Kylheku2015-09-011-5/+5
| | | | | * txr.1: Fixed incorrect macro use under in, mapdo, set, and getenv.
* Fix wrong description of :wholeKaz Kylheku2015-09-011-2/+32
| | | | | * txr.1: :whole doesn't bind the entire macro form. Added Dialect Note to compare with CL.
* Struct documentation.Kaz Kylheku2015-08-311-5/+750
| | | | * txr.1: New section on structs documenting functions and macros.