├── .gitignore ├── .prev-version ├── .travis.yml ├── .x-update-copyright ├── AUTHORS ├── COPYING ├── FAQ ├── NEWS ├── README.md ├── THANKS ├── bin ├── zmacs └── zz ├── bootstrap ├── bootstrap.conf ├── build-aux ├── config.ld.in ├── git-log-fix └── sanity-cfg.mk ├── configure.ac ├── gl └── top │ └── README-release.diff ├── lib ├── zile │ ├── Cons.lua │ ├── FileString.lua │ ├── MutableString.lua │ ├── Set.lua │ ├── Symbol.lua │ ├── bind.lua │ ├── buffer.lua │ ├── completion.lua │ ├── editfns.lua │ ├── file.lua │ ├── funcs.lua │ ├── getkey.lua │ ├── history.lua │ ├── keycode.lua │ ├── killring.lua │ ├── lib.lua │ ├── line.lua │ ├── macro.lua │ ├── marker.lua │ ├── minibuf.lua │ ├── redisplay.lua │ ├── search.lua │ ├── term_curses.lua │ ├── term_minibuf.lua │ ├── term_redisplay.lua │ ├── undo.lua │ ├── version.lua.in │ ├── window.lua │ ├── zile.mk │ └── zlisp.lua ├── zmacs │ ├── .gitignore │ ├── bind.lua │ ├── callbacks.lua │ ├── default-bindings-el.lua │ ├── eval.lua │ ├── help2man-wrapper │ ├── keymaps.lua │ ├── main.lua │ ├── man-extras │ ├── mkdotzmacs.lua │ ├── specs │ │ ├── spec_helper.lua │ │ ├── specs.mk │ │ ├── zlisp_bind_spec.yaml │ │ ├── zlisp_move_backward_spec.yaml │ │ └── zlisp_move_forward_spec.yaml │ ├── zlc │ ├── zlisp │ │ ├── bind.zl │ │ ├── buffer.zl │ │ ├── edit.zl │ │ ├── file.zl │ │ ├── help.zl │ │ ├── killring.zl │ │ ├── line.zl │ │ ├── lisp.zl │ │ ├── macro.zl │ │ ├── marker.zl │ │ ├── minibuf.zl │ │ ├── move.zl │ │ ├── registers.zl │ │ ├── search.zl │ │ ├── undo.zl │ │ ├── variables.zl │ │ └── window.zl │ ├── zmacs.in │ └── zmacs.mk └── zz │ ├── .gitignore │ ├── bind.lua │ ├── callbacks.lua │ ├── commands.lua │ ├── commands │ ├── bind.lua │ ├── buffer.lua │ ├── edit.lua │ ├── file.lua │ ├── help.lua │ ├── killring.lua │ ├── line.lua │ ├── lua.lua │ ├── macro.lua │ ├── marker.lua │ ├── minibuf.lua │ ├── move.lua │ ├── registers.lua │ ├── search.lua │ ├── undo.lua │ ├── variables.lua │ └── window.lua │ ├── default-bindings.lua │ ├── eval.lua │ ├── keymaps.lua │ ├── main.lua │ ├── man-extras │ ├── mkdotzz.lua │ ├── tests │ ├── message.at │ ├── testsuite.at │ └── write-file.at │ ├── zz.in │ └── zz.mk ├── local.mk ├── rockspec.conf ├── tests ├── backward-delete-char.el ├── backward-delete-char.output ├── backward-kill-word.el ├── backward-kill-word.output ├── backward-paragraph.el ├── backward-paragraph.output ├── backward-sexp.el ├── backward-sexp.output ├── backward-word.el ├── backward-word.output ├── beginning-of-buffer.el ├── beginning-of-buffer.output ├── beginning-of-line.el ├── beginning-of-line.output ├── capitalize-word.el ├── capitalize-word.output ├── copy-region-as-kill.el ├── copy-region-as-kill.output ├── copy-to-register.el ├── copy-to-register.output ├── delete-blank-lines.el ├── delete-blank-lines.output ├── delete-char.el ├── delete-char.output ├── delete-horizontal-space.el ├── delete-horizontal-space.output ├── delete-region.el ├── delete-region.output ├── describe-bindings.el ├── describe-bindings.output ├── describe-function.el ├── describe-function.output ├── describe-key.el ├── describe-key.output ├── describe-variable.el ├── describe-variable.output ├── downcase-region.el ├── downcase-region.output ├── downcase-word.el ├── downcase-word.output ├── end-of-buffer.el ├── end-of-buffer.output ├── end-of-line.el ├── end-of-line.output ├── exchange-point-and-mark.el ├── exchange-point-and-mark.output ├── fill-paragraph.el ├── fill-paragraph.output ├── find-file-read-only.el ├── find-file-read-only.output ├── find-file.el ├── find-file.output ├── forward-line.el ├── forward-line.output ├── forward-paragraph.el ├── forward-paragraph.output ├── forward-sexp.el ├── forward-sexp.output ├── forward-word.el ├── forward-word.output ├── goto-char.el ├── goto-char.output ├── goto-line.el ├── goto-line.output ├── indent-for-tab-command.el ├── indent-for-tab-command.output ├── indent-relative.el ├── indent-relative.output ├── insert-buffer.el ├── insert-buffer.output ├── insert-char.el ├── insert-char.output ├── insert-file.el ├── insert-file.output ├── interactive │ ├── backward-delete-char.el │ ├── backward-delete-char.output │ ├── backward-paragraph.el │ ├── backward-paragraph.output │ ├── backward-sexp.el │ ├── backward-sexp.output │ ├── beginning-of-buffer.el │ ├── beginning-of-buffer.output │ ├── beginning-of-line.el │ ├── beginning-of-line.output │ ├── capitalize-word.el │ ├── capitalize-word.output │ ├── cd.el │ ├── cd.output │ ├── copy-region-as-kill.el │ ├── copy-region-as-kill.output │ ├── copy-to-register.el │ ├── copy-to-register.output │ ├── delete-blank-lines.el │ ├── delete-blank-lines.output │ ├── delete-char.el │ ├── delete-char.output │ ├── delete-horizontal-space.el │ ├── delete-horizontal-space.output │ ├── delete-region.el │ ├── delete-region.output │ ├── describe-bindings.el │ ├── describe-bindings.output │ ├── describe-function.el │ ├── describe-function.output │ ├── describe-key.el │ ├── describe-key.output │ ├── describe-variable.el │ ├── describe-variable.output │ ├── downcase-word.el │ ├── downcase-word.output │ ├── end-of-buffer.el │ ├── end-of-buffer.output │ ├── exchange-point-and-mark.el │ ├── exchange-point-and-mark.output │ ├── execute-extended-command.el │ ├── execute-extended-command.output │ ├── find-file-read-only.el │ ├── find-file-read-only.output │ ├── find-file.el │ ├── find-file.output │ ├── forward-paragraph.el │ ├── forward-paragraph.output │ ├── forward-sexp.el │ ├── forward-sexp.output │ ├── forward-word.el │ ├── forward-word.output │ ├── goto-line.el │ ├── goto-line.output │ ├── indent-for-tab-command.el │ ├── indent-for-tab-command.output │ ├── insert-file.el │ ├── insert-file.output │ ├── isearch-backward-regexp.el │ ├── isearch-backward-regexp.output │ ├── isearch-backward.el │ ├── isearch-backward.output │ ├── isearch-forward-regexp.el │ ├── isearch-forward-regexp.output │ ├── isearch-forward.el │ ├── isearch-forward.output │ ├── just-one-space.el │ ├── just-one-space.output │ ├── kill-buffer.el │ ├── kill-buffer.output │ ├── kill-line.el │ ├── kill-line.output │ ├── kill-region.el │ ├── kill-region.output │ ├── kill-sexp.el │ ├── kill-sexp.output │ ├── kill-word.el │ ├── kill-word.output │ ├── list-registers.el │ ├── list-registers.output │ ├── mark-paragraph.el │ ├── mark-paragraph.output │ ├── mark-sexp.el │ ├── mark-sexp.output │ ├── mark-whole-buffer.el │ ├── mark-whole-buffer.output │ ├── mark-word.el │ ├── mark-word.output │ ├── newline-and-indent.el │ ├── newline-and-indent.output │ ├── newline.el │ ├── newline.output │ ├── open-line.el │ ├── open-line.output │ ├── prefix-argument.el │ ├── prefix-argument.output │ ├── query-replace.el │ ├── query-replace.output │ ├── quoted-insert.el │ ├── quoted-insert.output │ ├── resume_search.el │ ├── resume_search.output │ ├── save-some-buffers.el │ ├── save-some-buffers.output │ ├── search-backward-regexp.el │ ├── search-backward-regexp.output │ ├── search-backward.el │ ├── search-backward.output │ ├── search-forward-regexp.el │ ├── search-forward-regexp.output │ ├── search-forward.el │ ├── search-forward.output │ ├── set-fill-column.el │ ├── set-fill-column.output │ ├── set-variable.el │ ├── set-variable.output │ ├── shell-command-on-region.el │ ├── shell-command-on-region.output │ ├── shell-command.el │ ├── shell-command.output │ ├── switch-to-buffer.el │ ├── switch-to-buffer.output │ ├── tab-to-tab-stop.el │ ├── tab-to-tab-stop.output │ ├── transpose-chars.el │ ├── transpose-chars.output │ ├── transpose-lines.el │ ├── transpose-lines.output │ ├── transpose-sexps.el │ ├── transpose-sexps.output │ ├── transpose-words.el │ ├── transpose-words.output │ ├── universal-argument.el │ ├── universal-argument.output │ ├── upcase-word.el │ ├── upcase-word.output │ ├── yank.el │ └── yank.output ├── just-one-space.el ├── just-one-space.output ├── kill-buffer.el ├── kill-buffer.output ├── kill-line.el ├── kill-line.output ├── kill-region.el ├── kill-region.output ├── kill-sexp.el ├── kill-sexp.output ├── kill-word.el ├── kill-word.output ├── list-registers.el ├── list-registers.output ├── mark-paragraph.el ├── mark-paragraph.output ├── mark-sexp.el ├── mark-sexp.output ├── mark-whole-buffer.el ├── mark-whole-buffer.output ├── mark-word.el ├── mark-word.output ├── newline-and-indent.el ├── newline-and-indent.output ├── newline.el ├── newline.output ├── next-line.el ├── next-line.output ├── open-line.el ├── open-line.output ├── previous-line.el ├── previous-line.output ├── quit.el ├── quit.output ├── regression │ ├── 33910_execute-kbd-macro_with_quoted-insert.el │ ├── 33910_execute-kbd-macro_with_quoted-insert.output │ ├── 34080_buffer-name-suffix.el │ ├── 34080_buffer-name-suffix.output │ ├── 34086_call-last-kbd-macro.el │ ├── 34086_call-last-kbd-macro.output │ ├── 34087_undo_macro.el │ ├── 34087_undo_macro.output │ ├── 34193_interactive_insert.el │ ├── 34193_interactive_insert.output │ ├── 35053_eob_upcase-word.el │ ├── 35053_eob_upcase-word.output │ ├── 35560_find-file_completion.el │ ├── 35560_find-file_completion.output │ ├── 35562_search-backward.el │ ├── 35562_search-backward.output │ ├── 35567_minibuffer_ding_non_printable.el │ ├── 35567_minibuffer_ding_non_printable.output │ ├── forward-char_at_end.el │ ├── forward-char_at_end.output │ ├── goto-char_large.el │ └── goto-char_large.output ├── run-lisp-tests.lua ├── search-backward-regexp.el ├── search-backward-regexp.output ├── search-backward.el ├── search-backward.output ├── search-forward-regexp.el ├── search-forward-regexp.output ├── search-forward.el ├── search-forward.output ├── set-fill-column.el ├── set-fill-column.output ├── set-variable.el ├── set-variable.output ├── setq_nonexistent_variable.el ├── setq_nonexistent_variable.output ├── shell-command-on-region-2.el ├── shell-command-on-region-2.output ├── shell-command-on-region.el ├── shell-command-on-region.output ├── shell-command.el ├── shell-command.output ├── switch-to-buffer.el ├── switch-to-buffer.output ├── tab-to-tab-stop.el ├── tab-to-tab-stop.output ├── test.input ├── tests.mk ├── toggle-read-only.el ├── toggle-read-only.output ├── transpose-chars.el ├── transpose-chars.output ├── transpose-lines.el ├── transpose-lines.output ├── transpose-sexps.el ├── transpose-sexps.output ├── transpose-words.el ├── transpose-words.output ├── upcase-region.el ├── upcase-region.output ├── upcase-word.el ├── upcase-word.output ├── yank.el ├── yank.output └── zile-only │ ├── backward-word.el │ ├── backward-word.output │ ├── end-of-line.el │ ├── end-of-line.output │ ├── fill-paragraph.el │ ├── fill-paragraph.output │ ├── fill-paragraph_2.el │ ├── fill-paragraph_2.output │ ├── fixed-screen │ ├── scroll-down.el │ ├── scroll-down.output │ ├── scroll-up.el │ └── scroll-up.output │ ├── global-set-key.el │ ├── global-set-key.output │ ├── global-unset-key.el │ ├── global-unset-key.output │ ├── goal-column.el │ ├── goal-column.output │ ├── interactive │ ├── backward-kill-word.el │ ├── backward-kill-word.output │ ├── call-last-kbd-macro.el │ ├── call-last-kbd-macro.output │ ├── downcase-region.el │ ├── downcase-region.output │ ├── fill-paragraph_2.el │ ├── fill-paragraph_2.output │ ├── global-set-key.el │ ├── global-set-key.output │ ├── global-unset-key.el │ ├── global-unset-key.output │ ├── goal-column.el │ ├── goal-column.output │ ├── keyboard-quit.el │ ├── keyboard-quit.output │ ├── list-buffers.el │ ├── list-buffers.output │ ├── negative_prefix-argument.el │ ├── negative_prefix-argument.output │ ├── next-line.el │ ├── next-line.output │ ├── previous-line.el │ ├── previous-line.output │ ├── revert-buffer.el │ ├── revert-buffer.output │ ├── undo.el │ ├── undo.output │ ├── upcase-region.el │ └── upcase-region.output │ ├── list-buffers.el │ ├── list-buffers.output │ ├── revert-buffer.el │ ├── revert-buffer.output │ ├── undo.el │ ├── undo.output │ ├── undo_2.el │ └── undo_2.output └── travis.yml.in /.gitignore: -------------------------------------------------------------------------------- 1 | *.[1234567890].in 2 | *.patch 3 | *~ 4 | .autom4te.cfg 5 | .dirstamp 6 | .gitmodules 7 | .sc-start* 8 | .version 9 | /ChangeLog 10 | /GNUmakefile 11 | /HACKING 12 | /INSTALL 13 | /Makefile.am 14 | /README 15 | /README-release 16 | /aclocal.m4 17 | /autom4te.cache 18 | /build-aux/ 19 | !/build-aux/config.ld.in 20 | !/build-aux/git-log-fix 21 | !/build-aux/sanity-cfg.mk 22 | /config.cache 23 | /config.log 24 | /config.status 25 | /config.status.lineno 26 | /configure 27 | /configure.lineno 28 | /doc 29 | /lib/zile/version.lua 30 | /m4/ 31 | /maint.mk 32 | /zile*.tar.gz 33 | /zile*.tar.gz.directive* 34 | /zile*.tar.gz.sig 35 | /zile-*.rockspec 36 | Makefile 37 | Makefile.in 38 | atconfig 39 | testsuite 40 | testsuite.log 41 | -------------------------------------------------------------------------------- /.prev-version: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Lua is not officially supported, but an erlang environment will do. 2 | language: erlang 3 | 4 | env: 5 | global: 6 | - PACKAGE=zile 7 | - ROCKSPEC=zile-git-1.rockspec 8 | - LUAROCKS_CONFIG=build-aux/luarocks-config.lua 9 | - LUAROCKS_BASE=luarocks-2.1.1 10 | - LUAROCKS="$LUA $HOME/bin/luarocks" 11 | matrix: 12 | - LUA=lua5.2 LUA_INCDIR=/usr/include/lua5.2 LUA_SUFFIX=5.2 13 | 14 | # Tool setup. 15 | install: 16 | # Put back the links for libyaml, which went missing on recent Travis VMs 17 | - test -f /usr/lib/libyaml.so || 18 | sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; 19 | 20 | - sudo apt-get install help2man 21 | - sudo apt-get install lua5.2 22 | - sudo apt-get install liblua5.2-dev 23 | 24 | # Install a recent luarocks release locally. 25 | - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz 26 | - tar zxvpf $LUAROCKS_BASE.tar.gz 27 | - ( cd $LUAROCKS_BASE; 28 | ./configure 29 | --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX 30 | --with-lua-include=$LUA_INCDIR; 31 | make; 32 | sudo make install; ) 33 | 34 | # Configure and build. 35 | script: 36 | # Initial bootstrap to build luarocks-config.lua, before we've 37 | # installed our rocks. 38 | - ./bootstrap --skip-rock-checks 39 | - ./configure LUA="$LUA" 40 | - make $LUAROCKS_CONFIG 41 | LUA="$LUA" LUA_INCDIR="$LUA_INCDIR" V=1 42 | || cat $LUAROCKS_CONFIG config.log 43 | 44 | # Set Lua and Shell paths up for local luarocks tree. 45 | # this package depends on will be installed. 46 | - eval `$LUAROCKS path` 47 | - export PATH=`pwd`/luarocks/bin:$PATH 48 | 49 | # Install extra rocks into $LUAROCKS_CONFIG rocks tree. 50 | - $LUAROCKS install lyaml; $LUAROCKS install specl; $LUAROCKS install ldoc 51 | 52 | # Make git rockspec for zile 53 | - make rockspecs LUAROCKS="$LUAROCKS" V=1 54 | || { $LUAROCKS path; cat $ROCKSPEC; } 55 | 56 | # The git rockspec will rerun bootstrap, and check any rock versions 57 | # in bootstrap.conf:buildreq this time. 58 | - $LUAROCKS make $ROCKSPEC LUA="$LUA" 59 | - luarocks/bin/zmacs --version 60 | - luarocks/bin/zz --version 61 | 62 | # Check specifications. 63 | - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" make check V=1 64 | 65 | # Check autotools installation. 66 | - $LUAROCKS remove $PACKAGE 67 | - ./configure LUA="$LUA" --prefix=`pwd`/_inst 68 | - make clean all install || lib/zz/zz --version 69 | - _inst/bin/zmacs --help 70 | - _inst/bin/zz --help 71 | -------------------------------------------------------------------------------- /.x-update-copyright: -------------------------------------------------------------------------------- 1 | ^COPYING$ 2 | ^bootstrap$ 3 | ^bootstrap.slingshot$ 4 | ^build-aux/extract-trace$ 5 | ^build-aux/options-parser$ 6 | ^m4/ax_.*\.m4$ 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | The authors of Zile: 2 | 3 | * Sandro Sigala conceived and wrote Zile 4 | single-handed up to version 1.6.1. 5 | 6 | * Scott Lawrence wrote the "lithp" interpreter 7 | which was used as the basis for the tiny Lisp interpreter in C Zile. 8 | 9 | * Reuben Thomas maintained C Zile from version 1.6.1, 10 | to version 2.4.9, and translated the code from C that formed the 11 | foundation of Lua Zile. 12 | 13 | * David A. Capello contributed to Zile 14 | from version 1.7 to 2.0, adding many new features such as regex 15 | search. 16 | 17 | * Gary V. Vaughan began work on Lua Zile just before 18 | C Zile 2.4.0 was released; took over maintenance as C Zile was 19 | moth-balled after 2.4.9; and moved Lua Zile into the new "Zile 20 | Implements Lua Editors" era. 21 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garnaiksumeet/zile/2efce6483e0be4404432a21da5b912b2d15d58ee/THANKS -------------------------------------------------------------------------------- /build-aux/config.ld.in: -------------------------------------------------------------------------------- 1 | -- -*- lua -*- 2 | title = "GNU Zile @VERSION@ Reference" 3 | project = "GNU Zile @VERSION@" 4 | description = "Zile Implements Lua Editors" 5 | boilerplate = true 6 | dir = "." 7 | 8 | file = { 9 | -- Classes 10 | "../lib/zile/Cons.lua", 11 | "../lib/zile/FileString.lua", 12 | "../lib/zile/MutableString.lua", 13 | "../lib/zile/Set.lua", 14 | "../lib/zile/Symbol.lua", 15 | 16 | -- Modules 17 | "../lib/zile/zlisp.lua", 18 | "../lib/zmacs/eval.lua", 19 | "../lib/zz/eval.lua", 20 | } 21 | 22 | format = "markdown" 23 | sort = true 24 | -------------------------------------------------------------------------------- /build-aux/git-log-fix: -------------------------------------------------------------------------------- 1 | # This file is expected to be used via gitlog-to-changelog's --amend=FILE 2 | # option. It specifies what changes to make to each given SHA1's commit 3 | # log and metadata, using Perl-eval'able expressions. 4 | 5 | # For example: 6 | # 7 | # 0fe4d0740effaec9d08ee9683fb493d8ad0bd8b5 8 | # # Date: Mon Oct 17 16:43:18 2011 +0700 9 | # # Use canonical gnu email address. 10 | # s|vaughan\.pe|gnu.org|g; 11 | # # No empty lines in a single commit. 12 | # s|\n\n|\n|g; 13 | # # Fix a typo. 14 | # s|soure|source| 15 | -------------------------------------------------------------------------------- /build-aux/sanity-cfg.mk: -------------------------------------------------------------------------------- 1 | # Configuration for maintainer-makefile 2 | # 3 | # Copyright (c) 2011-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | # Don't check test outputs or diffs 21 | VC_LIST_ALWAYS_EXCLUDE_REGEX = \.(output|diff)$$ 22 | 23 | # Allow errors to start with a capital (they are displayed on a 24 | # separate line, interactively) 25 | local-checks-to-skip = sc_error_message_uppercase 26 | 27 | # Allow AM_V machinery for ZLC with AM_SILENT_RULES 28 | _makefile_at_at_check_exceptions = '&& !/AM(_DEFAULT)?_V/' 29 | 30 | define _sc_search_regexp_or_exclude 31 | files=$$($(VC_LIST_EXCEPT)); \ 32 | if test -n "$$files"; then \ 33 | grep -nE "$$prohibit" $$files | grep -v -- '-- exclude from $@' \ 34 | && { msg="$$halt" $(_sc_say_and_exit) } || :; \ 35 | else :; \ 36 | fi || :; 37 | endef 38 | 39 | # Prohibit rvalues on LHS of a comparison in Lua. 40 | sc_lua_prohibit_LHS_rvalue: 41 | @prohibit='if *(false|nil|true|"[^"]*"|'"'[^']*'"'|[1-9][0-9]*) *[~=]=' \ 42 | halt='found useless `"rhs" == lhs'\'' transposed comparison' \ 43 | $(_sc_search_regexp_or_exclude) 44 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl configure.ac 2 | dnl 3 | dnl Copyright (c) 1997-2014 Free Software Foundation, Inc. 4 | dnl 5 | dnl This file is part of GNU Zile. 6 | dnl 7 | dnl This program is free software; you can redistribute it and/or modify 8 | dnl it under the terms of the GNU General Public License as published 9 | dnl by the Free Software Foundation; either version 3, or (at your 10 | dnl option) any later version. 11 | dnl 12 | dnl This program is distributed in the hope that it will be useful, but 13 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of 14 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | dnl General Public License for more details. 16 | dnl 17 | dnl You should have received a copy of the GNU General Public License 18 | dnl along with this program. If not, see . 19 | 20 | AC_PREREQ([2.61]) 21 | 22 | dnl Initialise autoconf and automake 23 | AC_INIT([Zile], [3.1], [bug-zile@gnu.org]) 24 | AC_CONFIG_AUX_DIR([build-aux]) 25 | AC_CONFIG_MACRO_DIR([m4]) 26 | 27 | AS_BOX([Configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION]) 28 | echo 29 | 30 | AM_INIT_AUTOMAKE([-Wall std-options]) 31 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 32 | 33 | dnl Lua 5.2 34 | AX_PROG_LUA([5.2]) 35 | AC_PATH_PROG([LDOC], [ldoc], [:]) 36 | AC_PATH_PROG([SPECL], [specl], [:]) 37 | 38 | dnl help2man 39 | AC_PATH_PROG([HELP2MAN], [help2man], [false]) 40 | 41 | dnl Emacs >= 23.1 (optional) 42 | AC_PATH_PROG([EMACSPROG], [emacs]) 43 | if test -n "$EMACSPROG"; then 44 | emacs_min_version=23.1 45 | emacs_version=$($EMACSPROG --version 2>&1 | head -n 1 | cut -d' ' -f3) 46 | AC_MSG_CHECKING([Emacs version $emacs_version >= $emacs_min_version]) 47 | AX_COMPARE_VERSION([$emacs_version], [ge], [$emacs_min_version], 48 | [AC_MSG_RESULT([yes])], 49 | [AC_MSG_RESULT([no]) 50 | unset EMACSPROG]) 51 | fi 52 | 53 | AC_PROG_SED 54 | AC_PROG_EGREP 55 | 56 | dnl Generate output 57 | SS_CONFIG_TRAVIS([ldoc]) 58 | AC_CONFIG_FILES([Makefile], [chmod 444 Makefile]) 59 | AC_CONFIG_FILES([build-aux/config.ld], [chmod 444 build-aux/config.ld]) 60 | AC_CONFIG_FILES([lib/zile/version.lua], [chmod 444 lib/zile/version.lua]) 61 | AC_CONFIG_FILES([lib/zmacs/zmacs], [chmod 555 lib/zmacs/zmacs]) 62 | AC_CONFIG_FILES([lib/zz/zz], [chmod 555 lib/zz/zz]) 63 | AC_OUTPUT 64 | -------------------------------------------------------------------------------- /lib/zile/Set.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) 2013-2014 Free Software Foundation, Inc. 2 | -- 3 | -- This file is part of GNU Zile. 4 | -- 5 | -- This program is free software; you can redistribute it and/or modify it 6 | -- under the terms of the GNU General Public License as published by 7 | -- the Free Software Foundation; either version 3, or (at your option) 8 | -- any later version. 9 | -- 10 | -- This program is distributed in the hope that it will be useful, but 11 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | -- General Public License for more details. 14 | -- 15 | -- You should have received a copy of the GNU General Public License 16 | -- along with this program. If not, see . 17 | 18 | --[[-- 19 | Set container. 20 | 21 | A set is a table who's keys are the elements, all with value `true` 22 | 23 | Create a new sets with: 24 | 25 | new = Set {"e1", "e2", ... "en"} 26 | 27 | Add new elements with: 28 | 29 | union = new + {"f1", "f2", ... "fn"} 30 | 31 | Test membership with: 32 | 33 | new["e2"] => true 34 | new["x"] => nil 35 | 36 | @classmod zile.Set 37 | ]] 38 | 39 | local Set -- forward declaration 40 | 41 | 42 | local functions = { 43 | --- Find the union of two sets. 44 | -- @static 45 | -- @tparam Set set1 a set 46 | -- @tparam table|Set set2 another set, or table 47 | -- @treturn Set union of `set1` and `set2` 48 | union = function (set1, set2) 49 | local r = Set () 50 | for k in pairs (set1) do rawset (r, k, true) end 51 | for k in pairs (set2) do rawset (r, k, true) end 52 | return r 53 | end, 54 | } 55 | 56 | 57 | local metamethods = { 58 | --- Union operator. 59 | -- union = set + table 60 | -- @function __add 61 | -- @tparam Set self set 62 | -- @tparam table|Set table another set or table 63 | -- @treturn Set union of those sets 64 | __add = functions.union, 65 | 66 | 67 | -- Object methods: 68 | -- u = s:union (t) 69 | __index = functions, 70 | } 71 | 72 | 73 | Set = setmetatable (functions, { 74 | --- Return a new Set containing values from t. 75 | -- @function __call 76 | -- @static 77 | -- @tparam table t a list of elements 78 | -- @treturn Set a new set containing those elements 79 | __call = function (self, t) 80 | local r = setmetatable ({}, metamethods) 81 | if t ~= nil then 82 | for _, v in pairs (t) do rawset (r, v, true) end 83 | end 84 | return r 85 | end, 86 | }) 87 | 88 | 89 | return Set 90 | -------------------------------------------------------------------------------- /lib/zile/editfns.lua: -------------------------------------------------------------------------------- 1 | -- Useful editing functions 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | -- Signal an error, and abort any ongoing macro definition. 21 | function ding () 22 | if thisflag.defining_macro then 23 | cancel_kbd_macro () 24 | end 25 | 26 | if eval.get_variable ("ring_bell") and cur_wp then 27 | term_beep () 28 | end 29 | -- enable call chaining with `return ding ()' 30 | return false 31 | end 32 | 33 | 34 | function is_empty_line () 35 | return buffer_line_len (cur_bp) == 0 36 | end 37 | 38 | function is_blank_line () 39 | return tostring (get_buffer_region (cur_bp, region_new (get_buffer_line_o (cur_bp), buffer_end_of_line (cur_bp, get_buffer_pt (cur_bp))))):match ("^%s*$") ~= nil 40 | end 41 | 42 | -- Returns the character following point in the current buffer. 43 | function following_char () 44 | if eobp () then 45 | return nil 46 | elseif eolp () then 47 | return '\n' 48 | else 49 | return get_buffer_char (cur_bp, get_buffer_pt (cur_bp)) 50 | end 51 | end 52 | 53 | -- Return the character preceding point in the current buffer. 54 | function preceding_char () 55 | if bobp () then 56 | return nil 57 | elseif bolp () then 58 | return '\n' 59 | else 60 | return get_buffer_char (cur_bp, get_buffer_pt (cur_bp) - 1) 61 | end 62 | end 63 | 64 | -- Return true if point is at the beginning of the buffer. 65 | function bobp () 66 | return get_buffer_pt (cur_bp) == 1 67 | end 68 | 69 | -- Return true if point is at the end of the buffer. 70 | function eobp (void) 71 | return get_buffer_pt (cur_bp) > get_buffer_size (cur_bp) 72 | end 73 | 74 | -- Return true if point is at the beginning of a line. 75 | function bolp () 76 | return get_buffer_pt (cur_bp) == get_buffer_line_o (cur_bp) 77 | end 78 | 79 | -- Return true if point is at the end of a line. 80 | function eolp () 81 | return get_buffer_pt (cur_bp) - get_buffer_line_o (cur_bp) == buffer_line_len (cur_bp) 82 | end 83 | -------------------------------------------------------------------------------- /lib/zile/getkey.lua: -------------------------------------------------------------------------------- 1 | -- Getting and ungetting key strokes 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | -- Maximum time to avoid screen updates when catching up with buffered 21 | -- input, in milliseconds. 22 | local MAX_RESYNC_MS = 500 23 | 24 | local _last_key 25 | 26 | -- Return last key pressed 27 | function lastkey () 28 | return _last_key 29 | end 30 | 31 | -- Get a keystroke, waiting for up to delay ms, and translate it into a 32 | -- keycode. 33 | function getkeystroke (delay) 34 | _last_key = term_getkey (delay) 35 | 36 | if _last_key and thisflag.defining_macro then 37 | add_key_to_cmd (_last_key) 38 | end 39 | 40 | return _last_key 41 | end 42 | 43 | -- Return the next keystroke, refreshing the screen only when the input 44 | -- buffer is empty, or MAX_RESYNC_MS have elapsed since the last 45 | -- screen refresh. 46 | local next_refresh = {} 47 | local refresh_wait = { 48 | sec = math.floor (MAX_RESYNC_MS / 1000), 49 | usec = (MAX_RESYNC_MS % 1000) * 1000, 50 | } 51 | 52 | function getkey (delay) 53 | local now = posix.gettimeofday () 54 | local keycode = getkeystroke (0) 55 | 56 | if not keycode or posix.timercmp (now, next_refresh) >= 0 then 57 | term_redisplay () 58 | term_refresh () 59 | next_refresh = posix.timeradd (now, refresh_wait) 60 | end 61 | 62 | if not keycode then 63 | keycode = getkeystroke (delay) 64 | end 65 | 66 | return keycode 67 | end 68 | 69 | function getkey_unfiltered (delay) 70 | local c = term_getkey_unfiltered (delay) 71 | _last_key = c 72 | if thisflag.defining_macro then 73 | add_key_to_cmd (c) 74 | end 75 | return c 76 | end 77 | 78 | -- Wait for GETKEY_DELAYED ms or until a key is pressed. 79 | -- The key is then available with getkey. 80 | function waitkey () 81 | ungetkey (getkey (GETKEY_DELAYED)) 82 | end 83 | 84 | -- Push a key into the input buffer. 85 | function pushkey (key) 86 | term_ungetkey (key) 87 | end 88 | 89 | -- Unget a key as if it had not been fetched. 90 | function ungetkey (key) 91 | pushkey (key) 92 | 93 | if thisflag.defining_macro then 94 | remove_key_from_cmd () 95 | end 96 | end 97 | -------------------------------------------------------------------------------- /lib/zile/history.lua: -------------------------------------------------------------------------------- 1 | -- History facility functions 2 | -- 3 | -- Copyright (c) 2007, 2009-2010, 2012-2014 Free Software Foundation, 4 | -- Inc. 5 | -- 6 | -- This file is part of GNU Zile. 7 | -- 8 | -- This program is free software; you can redistribute it and/or modify it 9 | -- under the terms of the GNU General Public License as published by 10 | -- the Free Software Foundation; either version 3, or (at your option) 11 | -- any later version. 12 | -- 13 | -- This program is distributed in the hope that it will be useful, but 14 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 15 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | -- General Public License for more details. 17 | -- 18 | -- You should have received a copy of the GNU General Public License 19 | -- along with this program. If not, see . 20 | 21 | function history_new () 22 | return history_prepare ({}) 23 | end 24 | 25 | function history_prepare (hp) 26 | hp.sel = 0 27 | return hp 28 | end 29 | 30 | function add_history_element (hp, s) 31 | if hp[#hp] ~= s then 32 | table.insert (hp, s) 33 | end 34 | end 35 | 36 | function previous_history_element (hp) 37 | if hp.sel == 0 then -- First call for this history 38 | -- Select last element 39 | if #hp > 0 then 40 | hp.sel = #hp 41 | return hp[hp.sel] 42 | end 43 | minibuf_error ("Beginning of history; no preceding item") 44 | waitkey () 45 | elseif hp.sel > 1 then 46 | -- If there is there another element, select it 47 | hp.sel = hp.sel - 1 48 | return hp[hp.sel] 49 | end 50 | end 51 | 52 | function next_history_element (hp) 53 | -- Next element 54 | if hp.sel < #hp then 55 | hp.sel = hp.sel + 1 56 | return hp[hp.sel] 57 | else -- No more elements (back to original status) 58 | minibuf_error ("End of history; no defaults available") 59 | waitkey () 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /lib/zile/killring.lua: -------------------------------------------------------------------------------- 1 | -- Kill ring facility functions 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local FileString = require "zile.FileString" 21 | 22 | local kill_ring_text 23 | 24 | function killring_empty () 25 | return not kill_ring_text 26 | end 27 | 28 | function killring_yank () 29 | insert_estr (kill_ring_text) 30 | end 31 | 32 | function maybe_free_kill_ring () 33 | if not command.was_labelled ":kill_ring_push" then 34 | kill_ring_text = nil 35 | end 36 | end 37 | 38 | local function kill_ring_push (es) 39 | kill_ring_text = (kill_ring_text or FileString ("")):cat (es) 40 | command.attach_label ":kill_ring_push" 41 | end 42 | 43 | function copy_region (rp) 44 | kill_ring_push (get_buffer_region (cur_bp, rp)) 45 | 46 | deactivate_mark () 47 | 48 | return true 49 | end 50 | 51 | function kill_region (rp) 52 | kill_ring_push (get_buffer_region (cur_bp, rp)) 53 | 54 | if cur_bp.readonly then 55 | minibuf_error ("Read only text copied to kill ring") 56 | else 57 | assert (delete_region (rp)) 58 | end 59 | 60 | deactivate_mark () 61 | 62 | return true 63 | end 64 | 65 | function kill_to_bol () 66 | return bolp () or 67 | kill_region (region_new (get_buffer_line_o (cur_bp), get_buffer_pt (cur_bp))) 68 | end 69 | 70 | function kill_line (whole_line) 71 | local ok = true 72 | local only_blanks_to_end_of_line = true 73 | 74 | if not whole_line then 75 | for i = get_buffer_pt (cur_bp) - get_buffer_line_o (cur_bp), buffer_line_len (cur_bp) - 1 do 76 | local c = get_buffer_char (cur_bp, get_buffer_line_o (cur_bp) + i) 77 | if not (c == ' ' or c == '\t') then 78 | only_blanks_to_end_of_line = false 79 | break 80 | end 81 | end 82 | end 83 | 84 | if eobp () then 85 | minibuf_error ("End of buffer") 86 | return false 87 | end 88 | 89 | undo_start_sequence () 90 | 91 | if not eolp () then 92 | ok = kill_region (region_new (get_buffer_pt (cur_bp), get_buffer_line_o (cur_bp) + buffer_line_len (cur_bp))) 93 | end 94 | 95 | if ok and (whole_line or only_blanks_to_end_of_line) and not eobp () then 96 | if not delete_char () then 97 | return false 98 | end 99 | 100 | kill_ring_push (FileString ("\n")) 101 | end 102 | 103 | undo_end_sequence () 104 | 105 | return ok 106 | end 107 | 108 | function kill_whole_line () 109 | return kill_line (true) 110 | end 111 | 112 | function kill_line_backward () 113 | return previous_line () and kill_whole_line () 114 | end 115 | -------------------------------------------------------------------------------- /lib/zile/lib.lua: -------------------------------------------------------------------------------- 1 | -- Zile-specific library functions 2 | -- 3 | -- Copyright (c) 2006-2010, 2012-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | 21 | -- Lookup `with` in the `branches` table, and return the result of 22 | -- running the function found there. If there is no explicit match, 23 | -- then use the default branch at index 1. otherwise raise an error 24 | -- because there was no match. 25 | function case (with, branches) 26 | local fn = branches[with] or branches[1] 27 | if fn then return fn () end 28 | error ("unmatched case branch", 2) 29 | end 30 | 31 | 32 | -- Return true if x is a function, or is a Symbol with a __call metamethod. 33 | function iscallable (x) 34 | if type (x) == "function" then return true end 35 | local mt = getmetatable (x) 36 | return mt and mt.__call and mt._type == "Symbol" 37 | end 38 | 39 | -- Recase str according to newcase. 40 | function recase (s, newcase) 41 | local bs = "" 42 | local i, len 43 | 44 | if newcase == "capitalized" or newcase == "upper" then 45 | bs = bs .. string.upper (s[1]) 46 | else 47 | bs = bs .. string.lower (s[1]) 48 | end 49 | 50 | for i = 2, #s do 51 | bs = bs .. (newcase == "upper" and string.upper or string.lower) (s[i]) 52 | end 53 | 54 | return bs 55 | end 56 | -------------------------------------------------------------------------------- /lib/zile/macro.lua: -------------------------------------------------------------------------------- 1 | -- Macro facility functions 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | cmd_mp = {} 21 | cur_mp = {} 22 | 23 | function add_cmd_to_macro () 24 | cur_mp = list.concat (cur_mp, cmd_mp) 25 | cmd_mp = {} 26 | end 27 | 28 | function add_key_to_cmd (key) 29 | table.insert (cmd_mp, key) 30 | end 31 | 32 | function remove_key_from_cmd () 33 | table.remove (cmd_mp) 34 | end 35 | 36 | function cancel_kbd_macro () 37 | cmd_mp = {} 38 | cur_mp = {} 39 | thisflag.defining_macro = false 40 | end 41 | 42 | local function process_keys (keys) 43 | local cur = term_buf_len () 44 | 45 | for i = #keys, 1, -1 do 46 | term_ungetkey (keys[i]) 47 | end 48 | 49 | undo_start_sequence () 50 | while term_buf_len () > cur do 51 | get_and_run_command () 52 | end 53 | undo_end_sequence () 54 | end 55 | 56 | macro_keys = {} 57 | 58 | function call_macro () 59 | process_keys (macro_keys) 60 | return true 61 | end 62 | -------------------------------------------------------------------------------- /lib/zile/marker.lua: -------------------------------------------------------------------------------- 1 | -- Marker facility functions 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | 21 | -- Marker datatype 22 | 23 | local function marker_new (bp, o) 24 | local marker = {bp = bp, o = o} 25 | bp.markers[marker] = true 26 | return marker 27 | end 28 | 29 | function copy_marker (m) 30 | return marker_new (m.bp, m.o) 31 | end 32 | 33 | function point_marker () 34 | return marker_new (cur_bp, get_buffer_pt (cur_bp)) 35 | end 36 | 37 | function unchain_marker (marker) 38 | if marker.bp then 39 | marker.bp.markers[marker] = nil 40 | end 41 | end 42 | 43 | 44 | -- Mark ring 45 | 46 | local mark_ring = {} -- Mark ring. 47 | 48 | -- Push the current mark to the mark-ring. 49 | function push_mark () 50 | -- Save the mark. 51 | if cur_bp.mark then 52 | table.insert (mark_ring, copy_marker (cur_bp.mark)) 53 | else 54 | -- Save an invalid mark. 55 | table.insert (mark_ring, marker_new (cur_bp, 0)) 56 | end 57 | 58 | set_mark () 59 | activate_mark () 60 | end 61 | 62 | -- Pop a mark from the mark-ring and make it the current mark. 63 | function pop_mark () 64 | local m = mark_ring[#mark_ring] 65 | 66 | -- Replace the mark. 67 | if m.bp.mark then 68 | unchain_marker (m.bp.mark) 69 | end 70 | m.bp.mark = copy_marker (m) 71 | 72 | table.remove (mark_ring, #mark_ring) 73 | unchain_marker (m) 74 | end 75 | 76 | -- Set the mark to point. 77 | function set_mark () 78 | if cur_bp.mark then 79 | unchain_marker (cur_bp.mark) 80 | end 81 | cur_bp.mark = point_marker () 82 | end 83 | -------------------------------------------------------------------------------- /lib/zile/redisplay.lua: -------------------------------------------------------------------------------- 1 | -- Terminal independent redisplay routines 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | function recenter (wp) 21 | local n = offset_to_line (wp.bp, window_o (wp)) 22 | 23 | if n > wp.eheight / 2 then 24 | wp.topdelta = math.floor (wp.eheight / 2) 25 | else 26 | wp.topdelta = n 27 | end 28 | end 29 | 30 | function interactive_recenter () 31 | recenter (cur_wp) 32 | term_clear () 33 | term_redisplay () 34 | term_refresh () 35 | return true 36 | end 37 | 38 | function resize_windows () 39 | local wp 40 | 41 | -- Resize windows horizontally. 42 | for _, wp in ipairs (windows) do 43 | wp.fwidth = term_width () 44 | wp.ewidth = wp.fwidth 45 | end 46 | 47 | -- Work out difference in window height; windows may be taller than 48 | -- terminal if the terminal was very short. 49 | local hdelta = term_height () - 1 50 | for _, wp in ipairs (windows) do 51 | hdelta = hdelta - wp.fheight 52 | end 53 | 54 | -- Resize windows vertically. 55 | if hdelta > 0 then 56 | -- Increase windows height. 57 | local w = #windows 58 | while hdelta > 0 do 59 | windows[w].fheight = windows[w].fheight + 1 60 | windows[w].eheight = windows[w].eheight + 1 61 | hdelta = hdelta - 1 62 | w = w - 1 63 | if w == 0 then 64 | w = #windows 65 | end 66 | end 67 | else 68 | -- Decrease windows' height, and close windows if necessary. 69 | local decreased 70 | repeat 71 | local w = #windows 72 | decreased = false 73 | while w > 0 and hdelta < 0 do 74 | local wp = windows[w] 75 | if wp.fheight > 2 then 76 | wp.fheight = wp.fheight - 1 77 | wp.eheight = wp.eheight - 1 78 | hdelta = hdelta + 1 79 | decreased = true 80 | elseif #windows > 1 then 81 | delete_window (wp) 82 | w = w - 1 83 | decreased = true 84 | end 85 | end 86 | until decreased == false 87 | end 88 | 89 | interactive_recenter () 90 | end 91 | -------------------------------------------------------------------------------- /lib/zile/undo.lua: -------------------------------------------------------------------------------- 1 | -- Undo facility functions 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | -- Save a reverse delta for doing undo. 21 | local function undo_save (ty, o, osize, size) 22 | if cur_bp.noundo then 23 | return 24 | end 25 | 26 | local up = {type = ty, next = cur_bp.last_undop, o = o} 27 | 28 | if ty == "replace block" then 29 | up.size = size 30 | up.text = get_buffer_region (cur_bp, region_new (o, o + osize)) 31 | up.unchanged = not cur_bp.modified 32 | end 33 | 34 | cur_bp.last_undop = up 35 | end 36 | 37 | 38 | function undo_start_sequence () 39 | undo_save ("start sequence", get_buffer_pt (cur_bp), 0, 0) 40 | end 41 | 42 | function undo_end_sequence () 43 | undo_save ("end sequence", 0, 0, 0) 44 | end 45 | 46 | function undo_save_block (o, osize, size) 47 | undo_save ("replace block", o, osize, size) 48 | end 49 | 50 | -- Set unchanged flags to false. 51 | function undo_set_unchanged (up) 52 | while up do 53 | up.unchanged = false 54 | up = up.next 55 | end 56 | end 57 | 58 | -- Revert an action. Return the next undo entry. 59 | function revert_action (up) 60 | if up.type == "end sequence" then 61 | undo_start_sequence () 62 | up = up.next 63 | while up.type ~= "start sequence" do 64 | up = revert_action (up) 65 | end 66 | undo_end_sequence () 67 | end 68 | 69 | if up.type ~= "end sequence" then 70 | goto_offset (up.o) 71 | end 72 | if up.type == "replace block" then 73 | replace_estr (up.size, up.text) 74 | goto_offset (up.o) 75 | end 76 | 77 | if up.unchanged then 78 | cur_bp.modified = false 79 | end 80 | 81 | return up.next 82 | end 83 | -------------------------------------------------------------------------------- /lib/zile/version.lua.in: -------------------------------------------------------------------------------- 1 | -- Configure constants 2 | -- 3 | -- Copyright (c) 2013-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local M = { 21 | PACKAGE = "@PACKAGE@", 22 | PACKAGE_NAME = "@PACKAGE_NAME@", 23 | PACKAGE_BUGREPORT = "@PACKAGE_BUGREPORT@", 24 | VERSION = "@VERSION@", 25 | } 26 | 27 | -- Derived constants. 28 | M.name = arg[0] and arg[0]:gsub (".*/", "") or M.PACKAGE 29 | M.Name = string.upper (M.name:sub (1, 1)) .. M.name:sub (2) 30 | M.program = M.Name .. " (GNU " .. M.PACKAGE_NAME .. ")" 31 | M.version = M.program .. " " .. M.VERSION 32 | 33 | -- Copyright messages. 34 | M.COPYRIGHT_STRING = "Copyright (C) 2014 Free Software Foundation, Inc." 35 | M.COPYRIGHT_NOTICE = "GNU " .. M.Name .. " comes with ABSOLUTELY NO WARRANTY.\n" .. 36 | "You may redistribute copies of " .. M.Name .. "\n" .. 37 | "under the terms of the GNU General Public License.\n" .. 38 | "For more information about these matters, see the file named COPYING.\n" .. 39 | "Report bugs to " .. M.PACKAGE_BUGREPORT .. "." 40 | 41 | return M 42 | -------------------------------------------------------------------------------- /lib/zile/zile.mk: -------------------------------------------------------------------------------- 1 | # Source Makefile.am 2 | # 3 | # Copyright (c) 1997-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | dist_pkgdata_DATA = \ 21 | lib/zile/Cons.lua \ 22 | lib/zile/FileString.lua \ 23 | lib/zile/MutableString.lua \ 24 | lib/zile/Set.lua \ 25 | lib/zile/Symbol.lua \ 26 | lib/zile/bind.lua \ 27 | lib/zile/buffer.lua \ 28 | lib/zile/completion.lua \ 29 | lib/zile/editfns.lua \ 30 | lib/zile/file.lua \ 31 | lib/zile/funcs.lua \ 32 | lib/zile/getkey.lua \ 33 | lib/zile/history.lua \ 34 | lib/zile/keycode.lua \ 35 | lib/zile/killring.lua \ 36 | lib/zile/lib.lua \ 37 | lib/zile/line.lua \ 38 | lib/zile/macro.lua \ 39 | lib/zile/marker.lua \ 40 | lib/zile/minibuf.lua \ 41 | lib/zile/redisplay.lua \ 42 | lib/zile/search.lua \ 43 | lib/zile/term_curses.lua \ 44 | lib/zile/term_minibuf.lua \ 45 | lib/zile/term_redisplay.lua \ 46 | lib/zile/undo.lua \ 47 | lib/zile/version.lua \ 48 | lib/zile/window.lua \ 49 | lib/zile/zlisp.lua \ 50 | $(NOTHING_ELSE) 51 | 52 | EXTRA_DIST += \ 53 | lib/zile/version.lua \ 54 | $(NOTHING_ELSE) 55 | 56 | ldoc_DEPS += $(dist_pkgdata_DATA) 57 | -------------------------------------------------------------------------------- /lib/zmacs/.gitignore: -------------------------------------------------------------------------------- 1 | /commands.lua 2 | /doc/ 3 | /tests/package.m4 4 | /zmacs 5 | -------------------------------------------------------------------------------- /lib/zmacs/bind.lua: -------------------------------------------------------------------------------- 1 | -- Key bindings and extended commands 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zmacs.eval" 21 | 22 | -- gather_bindings_state: 23 | -- { 24 | -- f: symbol to match 25 | -- bindings: bindings 26 | -- } 27 | 28 | local function gather_bindings (key, p, g) 29 | if p == g.f then table.insert (g.bindings, key) end 30 | end 31 | 32 | 33 | --- Find key bindings to a command. 34 | -- @string name name of a command 35 | -- @treturn table a table of key bindings for `name`, or nil. 36 | local function where_is (name) 37 | if name and eval.intern_soft (name) then 38 | local g = { f = eval.intern_soft (name), bindings = {} } 39 | walk_bindings (root_bindings, gather_bindings, g) 40 | return g.bindings 41 | end 42 | end 43 | 44 | return { 45 | where_is = where_is, 46 | } 47 | -------------------------------------------------------------------------------- /lib/zmacs/callbacks.lua: -------------------------------------------------------------------------------- 1 | -- Callbacks required by Zile. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zmacs.eval" 21 | 22 | local call_command, mapatoms = eval.call_command, eval.mapatoms 23 | 24 | -- Used to process keyboard macros, and to maintain identical behaviour 25 | -- between the user typing and a keyboard macro sending keys, also used 26 | -- for the main loop after initialization. 27 | function get_and_run_command () 28 | local keys = get_key_sequence () 29 | local func = get_function_by_keys (keys) 30 | 31 | minibuf_clear () 32 | 33 | if func then 34 | call_command (func, lastflag.set_uniarg and (prefix_arg or 1)) 35 | else 36 | minibuf_error (tostring (keys) .. " is undefined") 37 | end 38 | 39 | unwind_buffer_stack () 40 | end 41 | 42 | 43 | -- Read a function name from the minibuffer. 44 | local functions_history = history_new () 45 | 46 | function minibuf_read_function_name (fmt) 47 | local cp = completion_new () 48 | 49 | local function gather_interactive (symbol) 50 | if symbol["interactive-form"] then 51 | table.insert (cp.completions, symbol.name) 52 | end 53 | end 54 | mapatoms (gather_interactive) 55 | 56 | return minibuf_vread_completion (fmt, "", cp, functions_history, 57 | "No function name given", 58 | "Undefined function name `%s'") 59 | end 60 | 61 | 62 | -- Read a variable name from the minibuffer. 63 | function minibuf_read_variable_name (fmt) 64 | local cp = completion_new () 65 | 66 | local function gather_value (symbol) 67 | if symbol.value ~= nil then 68 | table.insert (cp.completions, symbol.name) 69 | end 70 | end 71 | mapatoms (gather_value) 72 | 73 | return minibuf_vread_completion (fmt, "", cp, nil, 74 | "No variable name given", 75 | "Undefined variable name `%s'") 76 | end 77 | -------------------------------------------------------------------------------- /lib/zmacs/help2man-wrapper: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Wrap zmacs for help2man 3 | # Add two spaces before options so they will be processed properly. 4 | # 5 | # Copyright (c) 2009, 2012-2014 Free Software Foundation, Inc. 6 | # 7 | # Copying and distribution of this file, with or without 8 | # modification, are permitted in any medium without royalty 9 | # provided the copyright notice and this notice are preserved. 10 | 11 | if test "$1" = "--help"; then 12 | $builddir/lib/zmacs/zmacs $1 | sed 's/^\([-+F]\)/ \1/' 13 | else 14 | $builddir/lib/zmacs/zmacs $1 15 | fi 16 | -------------------------------------------------------------------------------- /lib/zmacs/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- Zmacs key mappings 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local posix = require "posix" 21 | 22 | local lisp = require "zmacs.eval" 23 | local intern_soft = lisp.intern_soft 24 | 25 | root_bindings = tree.new () 26 | 27 | function init_default_bindings () 28 | -- Bind all printing keys to self-insert-command 29 | for i = 0, 0xff do 30 | if posix.isprint (string.char (i)) then 31 | root_bindings[{keycode (string.char (i))}] = intern_soft "self-insert-command" 32 | end 33 | end 34 | 35 | -- Bind special key names to self-insert-command 36 | list.map (function (e) 37 | root_bindings[{keycode (e)}] = intern_soft "self-insert-command" 38 | end, 39 | {"\\SPC", "\\TAB", "\\RET", "\\\\"}) 40 | 41 | -- Search package.path for default-bindings.el, and load it. 42 | local ok, errmsg 43 | package.path:gsub ("[^;]+", 44 | function (path) 45 | if ok == nil then 46 | path = path:gsub ("%?", "zmacs/default-bindings-el", 1) 47 | ok, errmsg = lisp.eval_file (path) 48 | end 49 | end) 50 | return ok, errmsg 51 | end 52 | -------------------------------------------------------------------------------- /lib/zmacs/man-extras: -------------------------------------------------------------------------------- 1 | [description] 2 | Zmacs is a lightweight Emacs clone that provides a subset of Emacs's 3 | functionality suitable for basic editing. 4 | 5 | /then go to/ 6 | Exit status is 0 if OK, 1 if it cannot start up, for example because 7 | of an invalid command-line argument, and 2 if it crashes or runs out 8 | of memory. 9 | 10 | [files] 11 | ~/.zmacs \(em user's Zmacs init file 12 | 13 | [author] 14 | Zmacs was written by Reuben Thomas and Gary V. Vaughan, based on the 15 | C version by Sandro Sigala, Reuben Thomas, David A. Capello and Scott 16 | Lawrence. 17 | 18 | [see also] 19 | .BR emacs (1), 20 | .BR lua (1) 21 | -------------------------------------------------------------------------------- /lib/zmacs/mkdotzmacs.lua: -------------------------------------------------------------------------------- 1 | -- Produce dotzmacs.sample 2 | -- 3 | -- Copyright (c) 2012-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | require "std" 21 | require "zile.lib" 22 | 23 | -- required to load zmacs.commands 24 | require "zile.history" 25 | 26 | -- Load variables 27 | require "zmacs.commands" 28 | 29 | io.stdout:write ( 30 | [[ 31 | ;;;; .]] .. os.getenv ("PACKAGE") .. [[ configuration 32 | 33 | ;; Rebind keys with: 34 | ;; (global-set-key "key" 'func) 35 | 36 | ]]) 37 | 38 | -- Don't note where the contents of this file comes from or that it's 39 | -- auto-generated, because it's ugly in a user configuration file. 40 | 41 | function document_variables (symbol) 42 | if symbol.value then 43 | io.stdout:writelines ( 44 | "; " .. symbol["variable-documentation"]:gsub ("\n", "\n; "), 45 | "; Default value is " .. symbol.value .. ".", 46 | "(setq " .. symbol.name .. " " .. symbol.value .. ")", 47 | "" 48 | ) 49 | end 50 | end 51 | (require "zmacs.eval").mapatoms (document_variables) 52 | -------------------------------------------------------------------------------- /lib/zmacs/specs/specs.mk: -------------------------------------------------------------------------------- 1 | # Specl specs make rules. 2 | # Writter by Gary V. Vaughan, 2014 3 | # 4 | # Copyright (c) 2014 Free Software Foundation, Inc. 5 | # 6 | # This file is part of GNU Zile. 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 3, or (at your option) 11 | # any later version. 12 | # 13 | # This program is distributed in the hope that it will be useful, but 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with this program. If not, see . 20 | 21 | 22 | ## ------------ ## 23 | ## Environment. ## 24 | ## ------------ ## 25 | 26 | SPECL_ENV = EMACSPROG=$(EMACSPROG) $(LUA_ENV) 27 | 28 | 29 | ## ------ ## 30 | ## Specs. ## 31 | ## ------ ## 32 | 33 | specdir = $(srcdir)/lib/zmacs/specs 34 | 35 | specl_SPECS = \ 36 | $(specdir)/zlisp_bind_spec.yaml \ 37 | $(specdir)/zlisp_move_backward_spec.yaml \ 38 | $(specdir)/zlisp_move_forward_spec.yaml \ 39 | $(NOTHING_ELSE) 40 | 41 | EXTRA_DIST += \ 42 | $(specdir)/spec_helper.lua \ 43 | $(NOTHING_ELSE) 44 | 45 | include build-aux/specl.mk 46 | -------------------------------------------------------------------------------- /lib/zmacs/specs/zlisp_bind_spec.yaml: -------------------------------------------------------------------------------- 1 | before: 2 | require "spec_helper" 3 | 4 | 5 | specify where-is: 6 | - context in batch mode: 7 | - before: 8 | zmacs = Zmacs {"--batch"} 9 | # Lisp context only - you can't send keystrokes in batch mode! 10 | - context with lisp: 11 | - it writes bindings to minibuf: 12 | expect (zmacs:edit [[(where-is 'where-is)]]). 13 | should_write_to_minibuf.all_of {"where-is", "C-h w", " w"} 14 | - it writes unbound command to minibuf: 15 | expect (zmacs:edit [[(where-is 'auto-fill-mode)]]). 16 | should_write_to_minibuf "auto-fill-mode is not on any key" 17 | - it writes bindings to current buffer: 18 | expect (zmacs:edit [[(where-is 'where-is t)]]). 19 | should_write_to_buffer.all_of {"where-is", "C-h w", " w"} 20 | - it writes unbound command to current buffer: 21 | expect (zmacs:edit [[(where-is 'auto-fill-mode t)]]). 22 | should_write_to_buffer "M-x auto-fill-mode RET" 23 | 24 | - context in interactive mode: 25 | - before: 26 | zmacs = Zmacs {"--no-init-file"} 27 | - context with lisp: 28 | - it writes bindings to minibuf: 29 | expect (zmacs:edit [[(where-is 'where-is)]]). 30 | should_write_to_minibuf.all_of {"where-is", "C-h w", " w"} 31 | - it writes unbound command to minibuf: 32 | expect (zmacs:edit [[(where-is 'auto-fill-mode)]]). 33 | should_write_to_minibuf "auto-fill-mode is not on any key" 34 | - it writes bindings to current buffer: 35 | expect (zmacs:edit [[(where-is 'where-is t)]]). 36 | should_write_to_buffer.all_of {"where-is", "C-h w", " w"} 37 | - it writes unbound command to current buffer: 38 | expect (zmacs:edit [[(where-is 'auto-fill-mode t)]]). 39 | should_write_to_buffer "M-x auto-fill-mode RET" 40 | - context with keystrokes: 41 | - it writes bindings to minibuf: 42 | expect (zmacs:edit [[\C-hwwhere-is\r]]). 43 | should_write_to_minibuf.all_of {"where-is", "C-h w", " w"} 44 | - it writes unbound command to minibuf: 45 | expect (zmacs:edit [[\C-hwauto-fill-mode\r]]). 46 | should_write_to_minibuf "auto-fill-mode is not on any key" 47 | - it writes bindings to current buffer: 48 | expect (zmacs:edit [[\C-u\C-hwwhere-is\r]]). 49 | should_write_to_buffer.all_of {"where-is", "C-h w", " w"} 50 | - it writes unbound command to current buffer: 51 | expect (zmacs:edit [[\C-u\C-hwauto-fill-mode\r]]). 52 | should_write_to_buffer "M-x auto-fill-mode RET" 53 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/lisp.zl: -------------------------------------------------------------------------------- 1 | ;; Zile Lisp commands. 2 | ;; 3 | ;; Copyright (c) 2009-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program; see the file COPYING. If not, write to the 19 | ;; Free Software Foundation, Fifth Floor, 51 Franklin Street, Boston, 20 | ;; MA 02111-1301, USA. 21 | 22 | 23 | (defsubr load (file) 24 | "Execute a file of Lisp code named FILE." 25 | (interactive) 26 | "if file then 27 | return lisp.eval_file (file) 28 | end") 29 | 30 | 31 | (defsubr setq (...) 32 | "(setq [sym val]...) 33 | 34 | Set each sym to the value of its val. 35 | The symbols sym are variables; they are literal (not evaluated). 36 | The values val are expressions; they are evaluated." 37 | "local ret 38 | local l = {...} 39 | for i = 1, #l/2 do 40 | ret = lisp.eval_expression (l[i + 1]) 41 | lisp.set_variable (l[i], ret) 42 | end 43 | return ret") 44 | 45 | 46 | (defsubr execute-extended-command (prefixarg) 47 | "Read function name, then read its arguments and call it." 48 | (interactive) 49 | "local msg = '' 50 | 51 | if lastflag.set_uniarg then 52 | if lastflag.uniarg_empty then 53 | msg = 'C-u ' 54 | else 55 | msg = string.format ('%d ', current_prefix_arg) 56 | end 57 | end 58 | msg = msg .. 'M-x ' 59 | 60 | local name = minibuf_read_function_name (msg) 61 | local command = name and lisp.intern_soft (name) 62 | return command and lisp.execute_function (command, prefixarg) or nil") 63 | 64 | 65 | (defsubr eval-buffer (&optional buffer) 66 | "Execute the current buffer as Lisp code. 67 | When called from a Lisp program (i.e., not interactively), this 68 | function accepts an optional argument, the BUFFER to evaluate (nil 69 | means use current buffer)." 70 | (interactive) 71 | "local bp = (buffer and buffer ~= '') and get_buffer (buffer) or cur_bp 72 | return lisp.eval_string (get_buffer_pre_point (bp) .. get_buffer_post_point (bp))") 73 | 74 | 75 | (localvar exprs_history 76 | "history_new ()") 77 | 78 | (defsubr eval-expression (exp) 79 | "Evaluate EXP and print result in the echo area. 80 | When called interactively, read a ZLisp expression and 81 | evaluate it." 82 | (interactive) 83 | "if not exp then 84 | exp = minibuf_read ('Eval: ', '', nil, exprs_history) 85 | end 86 | 87 | lisp.eval_string (exp) 88 | 89 | if exp then 90 | add_history_element (exprs_history, exp) 91 | end") 92 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/macro.zl: -------------------------------------------------------------------------------- 1 | ;; Macro facility commands. 2 | ;; 3 | ;; Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | (defsubr start-kbd-macro () 22 | "Record subsequent keyboard input, defining a keyboard macro. 23 | The commands are recorded even as they are executed. 24 | Use \\[end-kbd-macro] to finish recording and make the macro available." 25 | (interactive) 26 | "if thisflag.defining_macro then 27 | minibuf_error ('Already defining a keyboard macro') 28 | return false 29 | end 30 | 31 | if cur_mp ~= nil then 32 | cancel_kbd_macro () 33 | end 34 | 35 | minibuf_write ('Defining keyboard macro...') 36 | 37 | thisflag.defining_macro = true 38 | cur_mp = {}") 39 | 40 | 41 | (defsubr end-kbd-macro () 42 | "Finish defining a keyboard macro. 43 | The definition was started by \\[start-kbd-macro]. 44 | The macro is now available for use via \\[execute-kbd-macro]." 45 | (interactive) 46 | "if not thisflag.defining_macro then 47 | minibuf_error ('Not defining a keyboard macro') 48 | return false 49 | end 50 | 51 | thisflag.defining_macro = false") 52 | 53 | 54 | (defsubr call-last-kbd-macro () 55 | "Call the last keyboard macro that you defined with \\[start-kbd-macro]. 56 | A prefix argument serves as a repeat count." 57 | (interactive) 58 | "if cur_mp == nil then 59 | minibuf_error ('No kbd macro has been defined') 60 | return false 61 | end 62 | 63 | -- FIXME: Call execute-kbd-macro (needs a way to reverse keystrtovec) 64 | macro_keys = cur_mp 65 | execute_with_uniarg (true, current_prefix_arg, call_macro)") 66 | 67 | 68 | (defsubr execute-kbd-macro (keystr) 69 | "Execute macro as string of editor command characters." 70 | "local keys = keystrtovec (keystr) 71 | if keys ~= nil then 72 | macro_keys = keys 73 | execute_with_uniarg (true, current_prefix_arg, call_macro) 74 | return true 75 | end") 76 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/marker.zl: -------------------------------------------------------------------------------- 1 | ;; Marker facility commands. 2 | ;; 3 | ;; Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | (defsubr mark () 22 | "Return this buffer's mark value as an integer, or nil if never set." 23 | "if not cur_bp.mark then return nil end 24 | return cur_bp.mark.o") 25 | 26 | 27 | (defsubr exchange-point-and-mark () 28 | "Put the mark where point is now, and point where the mark is now." 29 | (interactive) 30 | "if not cur_bp.mark then 31 | return minibuf_error ('No mark set in this buffer') 32 | end 33 | 34 | local tmp = get_buffer_pt (cur_bp) 35 | goto_offset (cur_bp.mark.o) 36 | cur_bp.mark.o = tmp 37 | activate_mark () 38 | thisflag.need_resync = true") 39 | 40 | 41 | (defsubr set-mark () 42 | "Set this buffer's mark to point." 43 | "set_mark () 44 | activate_mark ()") 45 | 46 | 47 | (defsubr set-mark-command () 48 | "Set the mark where point is." 49 | (interactive) 50 | "lisp.execute_function ('set-mark') 51 | minibuf_echo ('Mark set')") 52 | 53 | 54 | (localfun mark (uniarg func) 55 | "lisp.execute_function ('set-mark') 56 | local ret = lisp.execute_function (func, uniarg) 57 | if ret then 58 | lisp.execute_function ('exchange-point-and-mark') 59 | end 60 | return ret") 61 | 62 | 63 | (defsubr mark-word (arg) 64 | "Set mark ARG words away from point. 65 | The place mark goes is the same place \\[forward-word] would 66 | move to with the same argument." 67 | (interactive) 68 | "return mark (arg, 'forward-word')") 69 | 70 | 71 | (defsubr mark-sexp (arg) 72 | "Set mark ARG sexps from point. 73 | The place mark goes is the same place \\[forward-sexp] would 74 | move to with the same argument." 75 | (interactive) 76 | "return mark (arg, 'forward-sexp')") 77 | 78 | 79 | (defsubr mark-paragraph () 80 | "Put point at beginning of this paragraph, mark at end. 81 | The paragraph marked is the one that contains point or follows point." 82 | (interactive) 83 | "if command.was_labelled ':mark-paragraph' then 84 | lisp.execute_function ('exchange-point-and-mark') 85 | lisp.execute_function ('forward-paragraph') 86 | lisp.execute_function ('exchange-point-and-mark') 87 | else 88 | lisp.execute_function ('forward-paragraph') 89 | lisp.execute_function ('set-mark') 90 | lisp.execute_function ('backward-paragraph') 91 | end 92 | 93 | command.attach_label ':mark-paragraph'") 94 | 95 | 96 | (defsubr mark-whole-buffer () 97 | "Put point at beginning and mark at end of buffer." 98 | (interactive) 99 | "goto_offset (get_buffer_size (cur_bp) + 1) 100 | lisp.execute_function ('set-mark-command') 101 | goto_offset (1)") 102 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/minibuf.zl: -------------------------------------------------------------------------------- 1 | ;; Minibuf commands. 2 | ;; 3 | ;; Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | (defvar message-log-max 1000 22 | "Maximum number of lines to keep in the message log buffer. 23 | If nil, disable message logging. If t, log messages but don't truncate 24 | the buffer when it becomes large.") 25 | 26 | 27 | (defsubr message (msg) 28 | "Display a message at the bottom of the screen. 29 | 30 | In batch mode, the message is printed to the standard error stream, 31 | followed by a newline." 32 | "minibuf_echo (tostring (msg))") 33 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/undo.zl: -------------------------------------------------------------------------------- 1 | ;; Undo facility commands. 2 | ;; 3 | ;; Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | (defsubr undo () 22 | "Undo some previous changes. 23 | Repeat this command to undo more changes." 24 | (interactive) 25 | "if cur_bp.noundo then 26 | minibuf_error ('Undo disabled in this buffer') 27 | return false 28 | end 29 | 30 | if warn_if_readonly_buffer () then 31 | return false 32 | end 33 | 34 | if not cur_bp.next_undop then 35 | minibuf_error ('No further undo information') 36 | cur_bp.next_undop = cur_bp.last_undop 37 | return false 38 | end 39 | 40 | cur_bp.next_undop = revert_action (cur_bp.next_undop) 41 | minibuf_echo ('Undo!') 42 | 43 | command.attach_label ':undo'") 44 | 45 | 46 | (defsubr revert-buffer () 47 | "Undo until buffer is unmodified." 48 | (interactive) 49 | ;; FIXME: save pointer to current undo action and abort if we get 50 | ;; back to it. 51 | "while cur_bp.modified do 52 | lisp.execute_function ('undo') 53 | end") 54 | -------------------------------------------------------------------------------- /lib/zmacs/zlisp/variables.zl: -------------------------------------------------------------------------------- 1 | ;; Variable facility commands. 2 | ;; 3 | ;; Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | ;; 5 | ;; This file is part of GNU Zile. 6 | ;; 7 | ;; This program is free software; you can redistribute it and/or modify it 8 | ;; under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3, or (at your option) 10 | ;; any later version. 11 | ;; 12 | ;; This program is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with this program. If not, see . 19 | 20 | 21 | (localvar parse "(require 'zile.zlisp').parse") 22 | 23 | 24 | (defvar inhibit-splash-screen nil 25 | "Non-nil inhibits the startup screen. 26 | It also inhibits display of the initial message in the `*scratch*' 27 | buffer.") 28 | 29 | 30 | (defsubr set-variable (symbol value) 31 | "Set VARIABLE to VALUE. VALUE is a Lisp object. 32 | VARIABLE should be a user option variable name, a Lisp variable 33 | meant to be customized by users. You should enter VALUE in Lisp syntax, 34 | so if you want VALUE to be a string, you must surround it with doublequotes. 35 | VALUE is used literally, not evaluated." 36 | (interactive) 37 | "if not symbol then 38 | local name = minibuf_read_variable_name ('Set variable: ') 39 | symbol = lisp.fetch_variable (name) 40 | end 41 | if not symbol then return false end 42 | 43 | if value == nil then 44 | local list = parse (minibuf_read ( 45 | string.format ('Set %s to value: ', symbol.name), '')) 46 | if list then value = list.car end 47 | end 48 | if value == nil then return keyboard_quit () end 49 | 50 | lisp.set_variable (symbol, value) 51 | return true") 52 | -------------------------------------------------------------------------------- /lib/zmacs/zmacs.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # @configure_input@ 3 | 4 | # Environment setting wrapper for uninstalled zmacs. 5 | # Written by Gary V. Vaughan, 2013 6 | # 7 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. 8 | # 9 | # This file is part of GNU Zile. 10 | # 11 | # GNU Zile is free software: you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation, either version 3 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # GNU Zile is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program. If not, see . 23 | 24 | # Be Bourne compatible 25 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 26 | emulate sh 27 | NULLCMD=: 28 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 29 | # is contrary to our usage. Disable this feature. 30 | alias -g '${1+"$@"}'='"$@"' 31 | setopt NO_GLOB_SUBST 32 | else 33 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 34 | fi 35 | 36 | LUA_PATH="\ 37 | @abs_top_builddir@/lib/?.lua;\ 38 | @abs_top_srcdir@/lib/?.lua;\ 39 | ${LUA_PATH+$LUA_PATH;}\ 40 | ;" 41 | export LUA_PATH 42 | 43 | exec "@abs_top_srcdir@/bin/zmacs" \ 44 | ${1+"$@"} 45 | exit 1 46 | -------------------------------------------------------------------------------- /lib/zz/.gitignore: -------------------------------------------------------------------------------- 1 | /doc/ 2 | /tests/package.m4 3 | /zz 4 | -------------------------------------------------------------------------------- /lib/zz/bind.lua: -------------------------------------------------------------------------------- 1 | -- Key bindings and extended commands 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | 22 | -- gather_bindings_state: 23 | -- { 24 | -- f: symbol to match 25 | -- bindings: bindings 26 | -- } 27 | 28 | local function gather_bindings (key, p, g) 29 | if p == g.f then table.insert (g.bindings, key) end 30 | end 31 | 32 | 33 | --- Find key bindings to a command. 34 | -- @string name name of a command 35 | -- @treturn table a table of key bindings for `name`, or nil. 36 | local function where_is (name) 37 | if name and eval.intern_soft (name) then 38 | local g = { f = eval.intern_soft (name).value, bindings = {} } 39 | walk_bindings (root_bindings, gather_bindings, g) 40 | return g.bindings 41 | end 42 | end 43 | 44 | return { 45 | where_is = where_is, 46 | } 47 | -------------------------------------------------------------------------------- /lib/zz/callbacks.lua: -------------------------------------------------------------------------------- 1 | -- Callbacks required by Zile. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | 22 | local call_command, mapatoms = eval.call_command, eval.mapatoms 23 | 24 | -- Used to process keyboard macros, and to maintain identical behaviour 25 | -- between the user typing and a keyboard macro sending keys, also used 26 | -- for the main loop after initialization. 27 | function get_and_run_command () 28 | local keys = get_key_sequence () 29 | local func = get_function_by_keys (keys) 30 | 31 | minibuf_clear () 32 | 33 | if func then 34 | call_command (func, lastflag.set_uniarg and (prefix_arg or 1)) 35 | else 36 | minibuf_error (tostring (keys) .. " is undefined") 37 | end 38 | end 39 | 40 | 41 | -- Read a function name from the minibuffer. 42 | local functions_history = history_new () 43 | 44 | function minibuf_read_function_name (fmt) 45 | local cp = completion_new () 46 | 47 | local function gather_interactive (symbol) 48 | if iscallable (symbol) and symbol["interactive-form"] then 49 | table.insert (cp.completions, symbol.name) 50 | end 51 | end 52 | mapatoms (gather_interactive) 53 | 54 | return minibuf_vread_completion (fmt, "", cp, functions_history, 55 | "No function name given", 56 | "Undefined function name `%s'") 57 | end 58 | 59 | -- Read a variable name from the minibuffer. 60 | function minibuf_read_variable_name (fmt) 61 | local cp = completion_new () 62 | 63 | local function gather_value (symbol) 64 | if not iscallable (symbol) then 65 | table.insert (cp.completions, symbol.name) 66 | end 67 | end 68 | mapatoms (gather_value) 69 | 70 | return minibuf_vread_completion (fmt, "", cp, nil, 71 | "No variable name given", 72 | "Undefined variable name `%s'") 73 | end 74 | -------------------------------------------------------------------------------- /lib/zz/commands.lua: -------------------------------------------------------------------------------- 1 | require "zz.commands.bind" 2 | require "zz.commands.buffer" 3 | require "zz.commands.edit" 4 | require "zz.commands.file" 5 | require "zz.commands.help" 6 | require "zz.commands.killring" 7 | require "zz.commands.line" 8 | require "zz.commands.lua" 9 | require "zz.commands.macro" 10 | require "zz.commands.marker" 11 | require "zz.commands.minibuf" 12 | require "zz.commands.move" 13 | require "zz.commands.registers" 14 | require "zz.commands.search" 15 | require "zz.commands.undo" 16 | require "zz.commands.variables" 17 | require "zz.commands.window" 18 | -------------------------------------------------------------------------------- /lib/zz/commands/lua.lua: -------------------------------------------------------------------------------- 1 | -- Zile Lisp commnads. 2 | -- 3 | -- Copyright (c) 2009-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun, zz = eval.Defun, eval.sandbox 22 | 23 | 24 | Defun ("load", 25 | [[ 26 | Execute a file of Lua code named FILE. 27 | ]], 28 | true, 29 | function (file) 30 | if file then 31 | return eval.loadfile (file) 32 | end 33 | end 34 | ) 35 | 36 | 37 | Defun ("execute_extended_command", 38 | [[ 39 | Read function name, then read its arguments and call it. 40 | ]], 41 | true, 42 | function (n) 43 | local msg = '' 44 | 45 | if lastflag.set_uniarg then 46 | if lastflag.uniarg_empty then 47 | msg = 'C-u ' 48 | else 49 | msg = string.format ('%d ', current_prefix_arg) 50 | end 51 | end 52 | msg = msg .. 'M-x ' 53 | 54 | local name = minibuf_read_function_name (msg) 55 | return zz[name] and zz[name] (n) or nil 56 | end 57 | ) 58 | 59 | 60 | Defun ("eval_buffer", 61 | [[ 62 | Execute the current buffer as Lua code. 63 | 64 | When called from a Lua program (i.e., not interactively), this 65 | function accepts an optional argument, the buffer to evaluate (nil 66 | means use current buffer). 67 | ]], 68 | true, 69 | function (buffer) 70 | local bp = (buffer and buffer ~= '') and find_buffer (buffer) or cur_bp 71 | return eval.loadstring (get_buffer_pre_point (bp) .. get_buffer_post_point (bp)) 72 | end 73 | ) 74 | 75 | 76 | local exprs_history = history_new () 77 | 78 | 79 | Defun ("eval_expression", 80 | [[ 81 | Evaluate a lua expression and print result in the minibuffer. 82 | ]], 83 | true, 84 | function (expr) 85 | if not expr then 86 | expr = minibuf_read ('Eval: ', '', nil, exprs_history) 87 | end 88 | 89 | eval.loadstring (expr) 90 | 91 | if expr then 92 | add_history_element (exprs_history, expr) 93 | end 94 | end 95 | ) 96 | -------------------------------------------------------------------------------- /lib/zz/commands/macro.lua: -------------------------------------------------------------------------------- 1 | -- Macro facility commands. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun = eval.Defun 22 | 23 | 24 | Defun ("start_kbd_macro", 25 | [[ 26 | Record subsequent keyboard input, defining a keyboard macro. 27 | The commands are recorded even as they are executed. 28 | Use @kbd{C-x )} to finish recording and make the macro available. 29 | ]], 30 | true, 31 | function () 32 | if thisflag.defining_macro then 33 | minibuf_error ('Already defining a keyboard macro') 34 | return false 35 | end 36 | 37 | if cur_mp ~= nil then 38 | cancel_kbd_macro () 39 | end 40 | 41 | minibuf_write ('Defining keyboard macro...') 42 | 43 | thisflag.defining_macro = true 44 | cur_mp = {} 45 | end 46 | ) 47 | 48 | 49 | Defun ("end_kbd_macro", 50 | [[ 51 | Finish defining a keyboard macro. 52 | The definition was started by @kbd{C-x (}. 53 | The macro is now available for use via @kbd{C-x e}. 54 | ]], 55 | true, 56 | function () 57 | if not thisflag.defining_macro then 58 | minibuf_error ('Not defining a keyboard macro') 59 | return false 60 | end 61 | 62 | thisflag.defining_macro = false 63 | end 64 | ) 65 | 66 | 67 | Defun ("call_last_kbd_macro", 68 | [[ 69 | Call the last keyboard macro that you defined with @kbd{C-x (}. 70 | A prefix argument serves as a repeat count. 71 | ]], 72 | true, 73 | function () 74 | if cur_mp == nil then 75 | minibuf_error ('No kbd macro has been defined') 76 | return false 77 | end 78 | 79 | -- FIXME: Call execute_kbd_macro (needs a way to reverse keystrtovec) 80 | macro_keys = cur_mp 81 | execute_with_uniarg (true, current_prefix_arg, call_macro) 82 | end 83 | ) 84 | 85 | 86 | Defun ("execute_kbd_macro", 87 | [[ 88 | Execute macro as string of editor command characters. 89 | ]], 90 | false, 91 | function (keystr) 92 | local keys = keystrtovec (keystr) 93 | if keys ~= nil then 94 | macro_keys = keys 95 | execute_with_uniarg (true, current_prefix_arg, call_macro) 96 | return true 97 | end 98 | end 99 | ) 100 | -------------------------------------------------------------------------------- /lib/zz/commands/marker.lua: -------------------------------------------------------------------------------- 1 | -- Marker facility commands. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun, zz = eval.Defun, eval.sandbox 22 | 23 | 24 | Defun ("exchange_point_and_mark", 25 | [[ 26 | Put the mark where point is now, and point where the mark is now. 27 | ]], 28 | true, 29 | function () 30 | if not cur_bp.mark then 31 | return minibuf_error ('No mark set in this buffer') 32 | end 33 | 34 | local tmp = get_buffer_pt (cur_bp) 35 | goto_offset (cur_bp.mark.o) 36 | cur_bp.mark.o = tmp 37 | activate_mark () 38 | thisflag.need_resync = true 39 | end 40 | ) 41 | 42 | 43 | Defun ("set_mark", 44 | [[ 45 | Set this buffer's mark to point. 46 | ]], 47 | false, 48 | function () 49 | set_mark () 50 | activate_mark () 51 | end 52 | ) 53 | 54 | 55 | Defun ("set_mark_command", 56 | [[ 57 | Set the mark where point is. 58 | ]], 59 | true, 60 | function () 61 | zz.set_mark () 62 | minibuf_write ('Mark set') 63 | end 64 | ) 65 | 66 | 67 | local function mark (uniarg, func) 68 | zz.set_mark () 69 | local ret = func and zz[func] (uniarg) 70 | if ret then 71 | zz.exchange_point_and_mark () 72 | end 73 | return ret 74 | end 75 | 76 | 77 | Defun ("mark_word", 78 | [[ 79 | Set mark argument words away from point. 80 | ]], 81 | true, 82 | function (n) 83 | return mark (n, 'forward_word') 84 | end 85 | ) 86 | 87 | 88 | Defun ("mark_sexp", 89 | [[ 90 | Set mark @i{arg} sexps from point. 91 | The place mark goes is the same place @kbd{C-M-f} would 92 | move to with the same argument. 93 | ]], 94 | true, 95 | function (n) 96 | return mark (n, 'forward_sexp') 97 | end 98 | ) 99 | 100 | 101 | Defun ("mark_paragraph", 102 | [[ 103 | Put point at beginning of this paragraph, mark at end. 104 | The paragraph marked is the one that contains point or follows point. 105 | ]], 106 | true, 107 | function () 108 | if command.was_labelled ':mark_paragraph' then 109 | zz.exchange_point_and_mark () 110 | zz.forward_paragraph () 111 | zz.exchange_point_and_mark () 112 | else 113 | zz.forward_paragraph () 114 | zz.set_mark () 115 | zz.backward_paragraph () 116 | end 117 | 118 | command.attach_label ':mark_paragraph' 119 | end 120 | ) 121 | 122 | 123 | Defun ("mark_whole_buffer", 124 | [[ 125 | Put point at beginning and mark at end of buffer. 126 | ]], 127 | true, 128 | function () 129 | goto_offset (get_buffer_size (cur_bp) + 1) 130 | zz.set_mark_command () 131 | goto_offset (1) 132 | end 133 | ) 134 | -------------------------------------------------------------------------------- /lib/zz/commands/minibuf.lua: -------------------------------------------------------------------------------- 1 | -- Minibuf commands. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun = eval.Defun 22 | 23 | 24 | Defun ("message", 25 | [[ 26 | Write to the minibuffer. 27 | ]], 28 | false, 29 | function (msg) 30 | minibuf_write (msg) 31 | end 32 | ) 33 | -------------------------------------------------------------------------------- /lib/zz/commands/registers.lua: -------------------------------------------------------------------------------- 1 | -- Registers facility commands. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun, zz = eval.Defun, eval.sandbox 22 | 23 | local regs = {} 24 | local regnum = false 25 | 26 | 27 | local function register_isempty (reg) 28 | return not regs[term_bytetokey (reg)] 29 | end 30 | 31 | local function register_store (reg, data) 32 | regs[term_bytetokey (reg)] = data 33 | end 34 | 35 | local function insert_register () 36 | insert_estr (regs[term_bytetokey (regnum)]) 37 | return true 38 | end 39 | 40 | Defun ("copy_to_register", 41 | [[ 42 | Copy region into register @i{register}. 43 | ]], 44 | true, 45 | function (reg) 46 | if not reg then 47 | minibuf_write ('Copy to register: ') 48 | reg = getkey_unfiltered (GETKEY_DEFAULT) 49 | end 50 | 51 | if reg == 7 then 52 | return keyboard_quit () 53 | else 54 | minibuf_clear () 55 | local rp = calculate_the_region () 56 | if not rp then 57 | return false 58 | else 59 | register_store (reg, get_buffer_region (cur_bp, rp)) 60 | end 61 | end 62 | 63 | return true 64 | end 65 | ) 66 | 67 | 68 | Defun ("insert_register", 69 | [[ 70 | Insert contents of the user specified register. 71 | Puts point before and mark after the inserted text. 72 | ]], 73 | true, 74 | function (reg) 75 | local ok = true 76 | 77 | if warn_if_readonly_buffer () then 78 | return false 79 | end 80 | 81 | if not reg then 82 | minibuf_write ('Insert register: ') 83 | reg = getkey_unfiltered (GETKEY_DEFAULT) 84 | end 85 | 86 | if reg == 7 then 87 | ok = keyboard_quit () 88 | else 89 | minibuf_clear () 90 | if register_isempty (reg) then 91 | minibuf_error ('Register does not contain text') 92 | ok = false 93 | else 94 | zz.set_mark_command () 95 | regnum = reg 96 | execute_with_uniarg (true, current_prefix_arg, insert_register) 97 | zz.exchange_point_and_mark () 98 | deactivate_mark () 99 | end 100 | end 101 | 102 | return ok 103 | end 104 | ) 105 | 106 | 107 | local function write_registers_list (i) 108 | for i, r in pairs (regs) do 109 | if r then 110 | insert_string (string.format ("Register %s contains ", tostring (i))) 111 | r = tostring (r) 112 | 113 | if r == "" then 114 | insert_string ("the empty string\n") 115 | elseif r:match ("^%s+$") then 116 | insert_string ("whitespace\n") 117 | else 118 | local len = math.min (20, math.max (0, cur_wp.ewidth - 6)) + 1 119 | insert_string (string.format ("text starting with\n %s\n", string.sub (r, 1, len))) 120 | end 121 | end 122 | end 123 | end 124 | 125 | 126 | Defun ("list_registers", 127 | [[ 128 | List defined registers. 129 | ]], 130 | true, 131 | function () 132 | write_temp_buffer ('*Registers List*', true, write_registers_list) 133 | end 134 | ) 135 | -------------------------------------------------------------------------------- /lib/zz/commands/undo.lua: -------------------------------------------------------------------------------- 1 | -- Undo facility commands. 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local Defun, zz = eval.Defun, eval.sandbox 22 | 23 | 24 | Defun ("undo", 25 | [[ 26 | Undo some previous changes. 27 | Repeat this command to undo more changes. 28 | ]], 29 | true, 30 | function () 31 | if cur_bp.noundo then 32 | minibuf_error ('Undo disabled in this buffer') 33 | return false 34 | end 35 | 36 | if warn_if_readonly_buffer () then 37 | return false 38 | end 39 | 40 | if not cur_bp.next_undop then 41 | minibuf_error ('No further undo information') 42 | cur_bp.next_undop = cur_bp.last_undop 43 | return false 44 | end 45 | 46 | cur_bp.next_undop = revert_action (cur_bp.next_undop) 47 | minibuf_write ('Undo!') 48 | 49 | command.attach_label ':undo' 50 | end 51 | ) 52 | 53 | 54 | Defun ("revert_buffer", 55 | [[ 56 | Undo until buffer is unmodified. 57 | ]], 58 | true, 59 | function () 60 | while cur_bp.modified do 61 | zz.undo () 62 | end 63 | end 64 | ) 65 | -------------------------------------------------------------------------------- /lib/zz/keymaps.lua: -------------------------------------------------------------------------------- 1 | -- Zz key mappings 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | local eval = require "zz.eval" 21 | local posix = require "posix" 22 | 23 | root_bindings = tree.new () 24 | 25 | function init_default_bindings () 26 | -- Bind all printing keys to self-insert-command 27 | for i = 0, 0xff do 28 | if posix.isprint (string.char (i)) then 29 | root_bindings[{keycode (string.char (i))}] = eval.sandbox.self_insert_command 30 | end 31 | end 32 | 33 | -- Bind special key names to self-insert-command 34 | list.map (function (e) 35 | root_bindings[{keycode (e)}] = eval.sandbox.self_insert_command 36 | end, 37 | {"\\SPC", "\\TAB", "\\RET", "\\\\"}) 38 | 39 | -- Search package.path for default-bindings.el, and load it. 40 | local ok, errmsg 41 | package.path:gsub ("[^;]+", 42 | function (path) 43 | if ok == nil then 44 | path = path:gsub ("%?", "zz/default-bindings", 1) 45 | ok, errmsg = eval.loadfile (path) 46 | end 47 | end) 48 | return ok, errmsg 49 | end 50 | -------------------------------------------------------------------------------- /lib/zz/man-extras: -------------------------------------------------------------------------------- 1 | [description] 2 | Zz is a lightweight text editor descended from GNU Zile's zmacs. 3 | It has functionality suitable for basic editing. Compared to 4 | zmacs, the Lisp Evaluator has been removed in favour of direct 5 | evaluation in the source language, Lua - with which it is easily 6 | extended and customized. 7 | 8 | /then go to/ 9 | Exit status is 0 if OK, 1 if it cannot start up, for example because 10 | of an invalid command-line argument, and 2 if it crashes or runs out 11 | of memory. 12 | 13 | [files] 14 | ~/.zz \(em user's Zz init file 15 | 16 | [author] 17 | Zz was written by Gary V. Vaughan, based Lua Zile by Reuben Thomas. 18 | 19 | [see also] 20 | .BR zmacs (1), 21 | .BR lua (1) 22 | -------------------------------------------------------------------------------- /lib/zz/mkdotzz.lua: -------------------------------------------------------------------------------- 1 | -- Produce dotzz.sample 2 | -- 3 | -- Copyright (c) 2012-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | require "std" 21 | require "zile.lib" 22 | 23 | -- required to load zz.commands 24 | require "zile.history" 25 | 26 | -- Load variables 27 | require "zz.commands" 28 | 29 | io.stdout:write ( 30 | [[ 31 | -- .]] .. os.getenv ("PACKAGE") .. [[ configuration 32 | 33 | -- Rebind keys with: 34 | -- global-set-key ("key", func) 35 | 36 | ]]) 37 | 38 | -- Don't note where the contents of this file comes from or that it's 39 | -- auto-generated, because it's ugly in a user configuration file. 40 | 41 | 42 | function document_variables (symbol) 43 | if not iscallable (symbol) then 44 | io.stdout:writelines ( 45 | "-- " .. symbol["documentation"]:gsub ("\n", "\n-- "), 46 | "-- Default value is " .. symbol.value .. ".", 47 | symbol.name .. " = " .. tostring (symbol.value), 48 | "") 49 | end 50 | end 51 | (require "zz.eval").mapatoms (document_variables) 52 | -------------------------------------------------------------------------------- /lib/zz/tests/message.at: -------------------------------------------------------------------------------- 1 | # Test the message command. 2 | # 3 | # Copyright (c) 2013-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | 21 | AT_BANNER([Zz Output.]) 22 | 23 | 24 | 25 | ## ------------- ## 26 | ## Basic output. ## 27 | ## ------------- ## 28 | 29 | 30 | AT_SETUP([message]) 31 | 32 | AT_DATA([message.zl], [[ 33 | (message "Hello, World!") 34 | ]]) 35 | 36 | AT_DATA([expout], 37 | [[Hello, World! 38 | ]]) 39 | 40 | AT_CHECK([$ZZ --batch -l message.zl], 0, expout) 41 | 42 | AT_CLEANUP 43 | -------------------------------------------------------------------------------- /lib/zz/tests/testsuite.at: -------------------------------------------------------------------------------- 1 | # zz Autotest testsuite 2 | # 3 | # Copyright (c) 2013-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | m4_pattern_allow([^dnl$]) 21 | 22 | m4_ifdef([AT_COLOR_TESTS], [AT_COLOR_TESTS]) 23 | 24 | AT_INIT 25 | 26 | 27 | ## ---------- ## 28 | ## The suite. ## 29 | ## ---------- ## 30 | 31 | # Tests will be appended here by the Makefile rule. 32 | -------------------------------------------------------------------------------- /lib/zz/tests/write-file.at: -------------------------------------------------------------------------------- 1 | # Test the message command. 2 | # 3 | # Copyright (c) 2013-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | 21 | AT_BANNER([Zz File Handling.]) 22 | 23 | 24 | 25 | ## ------------- ## 26 | ## Basic output. ## 27 | ## ------------- ## 28 | 29 | 30 | AT_SETUP([write buffer contents to file]) 31 | 32 | AT_DATA([script.zl], [[ 33 | (switch-to-buffer "*tmp*") 34 | (insert "Hello, World! 35 | ") 36 | (write-file "hello.txt") 37 | ]]) 38 | 39 | AT_DATA([expout], 40 | [[Wrote hello.txt 41 | ]]) 42 | 43 | AT_DATA([expfile], 44 | [[Hello, World! 45 | ]]) 46 | 47 | AT_CHECK([$ZZ --batch -l script.zl], 0, [expout]) 48 | AT_CHECK([diff hello.txt expfile], 0, []) 49 | 50 | AT_CLEANUP 51 | -------------------------------------------------------------------------------- /lib/zz/zz.in: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # @configure_input@ 3 | 4 | # Environment setting wrapper for uninstalled zz. 5 | # Written by Gary V. Vaughan, 2013 6 | # 7 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. 8 | # 9 | # This file is part of GNU Zile. 10 | # 11 | # GNU Zile is free software: you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation, either version 3 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # GNU Zile is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with this program. If not, see . 23 | 24 | # Be Bourne compatible 25 | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 26 | emulate sh 27 | NULLCMD=: 28 | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 29 | # is contrary to our usage. Disable this feature. 30 | alias -g '${1+"$@"}'='"$@"' 31 | setopt NO_GLOB_SUBST 32 | else 33 | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 34 | fi 35 | 36 | LUA_PATH="\ 37 | @abs_top_builddir@/lib/?.lua;\ 38 | @abs_top_srcdir@/lib/?.lua;\ 39 | ${LUA_PATH+$LUA_PATH;}\ 40 | ;" 41 | export LUA_PATH 42 | 43 | exec "@abs_top_srcdir@/bin/zz" \ 44 | ${1+"$@"} 45 | exit 1 46 | -------------------------------------------------------------------------------- /local.mk: -------------------------------------------------------------------------------- 1 | # Top-level Makefile.am 2 | # 3 | # Copyright (c) 1997-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | 21 | ## ------------ ## 22 | ## Environment. ## 23 | ## ------------ ## 24 | 25 | ZILE_PATH = $(abs_builddir)/lib/?.lua;$(abs_srcdir)/lib/?.lua 26 | 27 | RM = rm 28 | 29 | 30 | ## ---------- ## 31 | ## Bootstrap. ## 32 | ## ---------- ## 33 | 34 | old_NEWS_hash = 42b62d1dc98f4d243f36ed6047e2f473 35 | 36 | update_copyright_env = \ 37 | UPDATE_COPYRIGHT_USE_INTERVALS=1 \ 38 | UPDATE_COPYRIGHT_FORCE=1 39 | 40 | 41 | ## ------------- ## 42 | ## Declarations. ## 43 | ## ------------- ## 44 | 45 | classesdir = $(docdir)/classes 46 | modulesdir = $(docdir)/modules 47 | 48 | dist_doc_DATA = 49 | dist_classes_DATA = 50 | dist_modules_DATA = 51 | ldoc_DEPS = 52 | 53 | clean_local = 54 | install_exec_hook = 55 | 56 | include lib/zile/zile.mk 57 | include lib/zmacs/zmacs.mk 58 | include lib/zmacs/specs/specs.mk 59 | include lib/zz/zz.mk 60 | include tests/tests.mk 61 | 62 | check-local: $(check_local) 63 | clean-local: $(clean_local) 64 | install-exec-hook: $(install_exec_hook) 65 | 66 | ## Use a builtin rockspec build with root at $(srcdir)/lib 67 | mkrockspecs_args = --module-dir $(srcdir)/lib 68 | 69 | 70 | ## ------------- ## 71 | ## Installation. ## 72 | ## ------------- ## 73 | 74 | doc_DATA += \ 75 | AUTHORS \ 76 | FAQ \ 77 | NEWS \ 78 | $(NOTHING_ELSE) 79 | 80 | 81 | ## ------------- ## 82 | ## Distribution. ## 83 | ## ------------- ## 84 | 85 | gitlog_fix = $(srcdir)/build-aux/git-log-fix 86 | gitlog_args = --amend=$(gitlog_fix) --since=2009-03-30 87 | 88 | # Elide travis features. 89 | _travis_yml = $(NOTHING_ELSE) 90 | 91 | EXTRA_DIST += \ 92 | FAQ \ 93 | build-aux/config.ld \ 94 | $(NOTHING_ELSE) 95 | 96 | 97 | 98 | ## -------------- ## 99 | ## Documentation. ## 100 | ## -------------- ## 101 | 102 | dist_doc_DATA += \ 103 | $(srcdir)/doc/index.html \ 104 | $(srcdir)/doc/ldoc.css \ 105 | $(NOTHING_ELSE) 106 | 107 | dist_classes_DATA += \ 108 | $(srcdir)/doc/classes/zile.Cons.html \ 109 | $(srcdir)/doc/classes/zile.FileString.html \ 110 | $(srcdir)/doc/classes/zile.MutableString.html \ 111 | $(srcdir)/doc/classes/zile.Set.html \ 112 | $(srcdir)/doc/classes/zile.Symbol.html \ 113 | $(NOTHING_ELSE) 114 | 115 | dist_modules_DATA += \ 116 | $(srcdir)/doc/modules/zile.zlisp.html \ 117 | $(srcdir)/doc/modules/zmacs.eval.html \ 118 | $(srcdir)/doc/modules/zz.eval.html \ 119 | $(NOTHING_ELSE) 120 | 121 | ## Parallel make gets confused when one command ($(LDOC)) produces 122 | ## multiple targets (all the html files above), so use the doc/.ldocs 123 | ## as a sentinel file. 124 | $(dist_doc_DATA) $(dist_classes_DATA) $(dist_modules_DATA): $(srcdir)/doc/.ldocs 125 | 126 | $(srcdir)/doc/.ldocs: $(srcdir/doc) $(ldoc_DEPS) 127 | test -d $(srcdir)/doc || mkdir $(srcdir)/doc 128 | touch $@ 129 | $(LDOC) -c build-aux/config.ld -d $(abs_srcdir)/doc . 130 | -------------------------------------------------------------------------------- /rockspec.conf: -------------------------------------------------------------------------------- 1 | # Zile rockspec configuration. 2 | 3 | description: 4 | homepage: http://www.gnu.org/s/zile 5 | license: GPLv3+ 6 | summary: Zile Implements Lua Editors 7 | detailed: 8 | "An editor building kit, bundled with zmacs: a lightweight Emacs clone." 9 | 10 | dependencies: 11 | - alien >= 0.7.0 12 | - lua >= 5.2 13 | - luaposix >= 29 14 | - stdlib >= 37 15 | - lrexlib-gnu >= 2.7.1 16 | 17 | source: 18 | url: http://github.com/gvvaughan/zile 19 | 20 | build: 21 | copy_directories: 22 | - bin 23 | -------------------------------------------------------------------------------- /tests/backward-delete-char.el: -------------------------------------------------------------------------------- 1 | (insert "aa") 2 | (backward-delete-char 1) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/backward-delete-char.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/backward-kill-word.el: -------------------------------------------------------------------------------- 1 | (end-of-line) 2 | (backward-kill-word 1) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/backward-kill-word.output: -------------------------------------------------------------------------------- 1 | Here is a sample 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/backward-paragraph.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (backward-paragraph) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/backward-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/backward-sexp.el: -------------------------------------------------------------------------------- 1 | (insert "(") 2 | (end-of-line) 3 | (insert ")") 4 | (backward-sexp) 5 | (delete-char 1) 6 | (save-buffer) 7 | (save-buffers-kill-emacs) 8 | -------------------------------------------------------------------------------- /tests/backward-sexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file.) 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/backward-word.el: -------------------------------------------------------------------------------- 1 | (end-of-line) 2 | (backward-word 2) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/backward-word.output: -------------------------------------------------------------------------------- 1 | Here is a asample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/beginning-of-buffer.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (insert "a") 3 | (beginning-of-buffer) 4 | (insert "b") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/beginning-of-buffer.output: -------------------------------------------------------------------------------- 1 | bHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | a -------------------------------------------------------------------------------- /tests/beginning-of-line.el: -------------------------------------------------------------------------------- 1 | (forward-line) 2 | (forward-word 3) 3 | (beginning-of-line) 4 | (insert "a") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/beginning-of-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | aIt has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/capitalize-word.el: -------------------------------------------------------------------------------- 1 | (capitalize-word 3) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/capitalize-word.output: -------------------------------------------------------------------------------- 1 | Here Is A sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/copy-region-as-kill.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-char 4) 3 | (copy-region-as-kill (mark) (point)) 4 | (yank) 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/copy-region-as-kill.output: -------------------------------------------------------------------------------- 1 | HereHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/copy-to-register.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-char 4) 3 | (copy-to-register 97 (mark) (point)) 4 | (insert-register 97) 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/copy-to-register.output: -------------------------------------------------------------------------------- 1 | HereHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/delete-blank-lines.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | (delete-blank-lines) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/delete-blank-lines.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | And more than one paragraph. 4 | -------------------------------------------------------------------------------- /tests/delete-char.el: -------------------------------------------------------------------------------- 1 | (delete-char 1) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/delete-char.output: -------------------------------------------------------------------------------- 1 | ere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/delete-horizontal-space.el: -------------------------------------------------------------------------------- 1 | (forward-char 4) 2 | (delete-horizontal-space) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/delete-horizontal-space.output: -------------------------------------------------------------------------------- 1 | Hereis a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/delete-region.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line) 3 | (kill-region (point) (mark)) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/delete-region.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | 3 | And more than one paragraph. 4 | -------------------------------------------------------------------------------- /tests/describe-bindings.el: -------------------------------------------------------------------------------- 1 | (describe-bindings) 2 | (other-window 1) 3 | (set-mark (point)) 4 | (forward-line) 5 | (copy-region-as-kill (mark) (point)) 6 | (other-window -1) 7 | (yank) 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/describe-bindings.output: -------------------------------------------------------------------------------- 1 | Key translations: 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/describe-function.el: -------------------------------------------------------------------------------- 1 | (describe-function 'forward-char) 2 | (other-window 1) 3 | (set-mark (point)) 4 | (forward-word 5) 5 | (copy-region-as-kill (mark) (point)) 6 | (other-window -1) 7 | (yank) 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/describe-function.output: -------------------------------------------------------------------------------- 1 | forward-char is an interactiveHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/describe-key.el: -------------------------------------------------------------------------------- 1 | (describe-key "\C-f") 2 | (other-window 1) 3 | (set-mark (point)) 4 | (forward-word 11) 5 | (copy-region-as-kill (mark) (point)) 6 | (other-window -1) 7 | (yank) 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/describe-key.output: -------------------------------------------------------------------------------- 1 | C-f runs the command forward-char, which is an interactiveHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/describe-variable.el: -------------------------------------------------------------------------------- 1 | (describe-variable 'tab-width) 2 | (other-window 1) 3 | (set-mark (point)) 4 | (forward-word 6) 5 | (copy-region-as-kill (mark) (point)) 6 | (other-window -1) 7 | (yank) 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/describe-variable.output: -------------------------------------------------------------------------------- 1 | tab-width is a variable definedHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/downcase-region.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 2) 3 | (downcase-region (point) (mark)) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/downcase-region.output: -------------------------------------------------------------------------------- 1 | here is a sample file. 2 | it has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/downcase-word.el: -------------------------------------------------------------------------------- 1 | (downcase-word 6) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/downcase-word.output: -------------------------------------------------------------------------------- 1 | here is a sample file. 2 | it has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/end-of-buffer.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/end-of-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | a -------------------------------------------------------------------------------- /tests/end-of-line.el: -------------------------------------------------------------------------------- 1 | (end-of-line) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/end-of-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file.a 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/exchange-point-and-mark.el: -------------------------------------------------------------------------------- 1 | (forward-char 4) 2 | (set-mark (point)) 3 | (forward-line 2) 4 | (exchange-point-and-mark) 5 | (insert "f") 6 | (save-buffer) 7 | (save-buffers-kill-emacs) 8 | -------------------------------------------------------------------------------- /tests/exchange-point-and-mark.output: -------------------------------------------------------------------------------- 1 | Heref is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/fill-paragraph.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | (end-of-line) 4 | (insert " I am now going to make the line sufficiently long that I can wrap it.") 5 | (fill-paragraph) 6 | (save-buffer) 7 | (save-buffers-kill-emacs) 8 | -------------------------------------------------------------------------------- /tests/fill-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. I am now going to make the line sufficiently 2 | long that I can wrap it. It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/find-file-read-only.el: -------------------------------------------------------------------------------- 1 | (kill-buffer "find-file-read-only.input") 2 | (find-file-read-only "tests/find-file-read-only.input") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/find-file-read-only.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/find-file.el: -------------------------------------------------------------------------------- 1 | (find-file "not-exists") 2 | (kill-buffer "not-exists") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/find-file.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/forward-line.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/forward-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/forward-paragraph.el: -------------------------------------------------------------------------------- 1 | (forward-paragraph) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/forward-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/forward-sexp.el: -------------------------------------------------------------------------------- 1 | (forward-char 6) 2 | (insert ")") 3 | (beginning-of-line) 4 | (insert "(") 5 | (beginning-of-line) 6 | (forward-sexp) 7 | (insert "a") 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/forward-sexp.output: -------------------------------------------------------------------------------- 1 | (Here i)as a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/forward-word.el: -------------------------------------------------------------------------------- 1 | (forward-word 4) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/forward-word.output: -------------------------------------------------------------------------------- 1 | Here is a samplea file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/goto-char.el: -------------------------------------------------------------------------------- 1 | (goto-char 40) 2 | (insert "fff") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/goto-char.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lfffines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/goto-line.el: -------------------------------------------------------------------------------- 1 | (goto-line 4) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/goto-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | aAnd more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/indent-for-tab-command.el: -------------------------------------------------------------------------------- 1 | (indent-for-tab-command) 2 | (forward-line) 3 | (beginning-of-line) 4 | (indent-for-tab-command) 5 | (forward-line 2) 6 | (beginning-of-line) 7 | (indent-for-tab-command) 8 | (forward-line) 9 | (save-buffer) 10 | (save-buffers-kill-emacs) 11 | -------------------------------------------------------------------------------- /tests/indent-for-tab-command.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/indent-relative.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | (indent-relative) 3 | (insert "f") 4 | (indent-relative) 5 | (insert "fffff") 6 | (indent-relative) 7 | (insert "aaa") 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/indent-relative.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | f fffff aaa 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/insert-buffer.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | (insert-buffer "insert-buffer.input") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/insert-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | Here is a sample file. 4 | It has several lines. 5 | 6 | And more than one paragraph. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/insert-char.el: -------------------------------------------------------------------------------- 1 | (insert "a") 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/insert-char.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/insert-file.el: -------------------------------------------------------------------------------- 1 | (insert-file "insert-file.input") 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/insert-file.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | Here is a sample file. 6 | It has several lines. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/interactive/backward-delete-char.el: -------------------------------------------------------------------------------- 1 | ; a a backward-delete-char save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "aa\C-?\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/backward-delete-char.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/backward-paragraph.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer backward-paragraph a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M->\M-{a\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/backward-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/backward-sexp.el: -------------------------------------------------------------------------------- 1 | ; beginning-of-buffer ( end-of-buffer backward-char ) backward-sexp delete-char 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-<(\M->\C-b)\C-\M-b\C-d\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/backward-sexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph.) 5 | -------------------------------------------------------------------------------- /tests/interactive/beginning-of-buffer.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer a beginning-of-buffer b save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M->a\ea\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/end-of-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | a -------------------------------------------------------------------------------- /tests/interactive/exchange-point-and-mark.el: -------------------------------------------------------------------------------- 1 | ; ESC 4 forward-char set-mark end-of-buffer 2 | ; exchange-point-and-mark f save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\e4\C-f\C-@\M->\C-x\C-xf\C-x\C-s\C-x\C-c") 4 | 5 | ;; With a direct translation, Emacs exits 255 with 'end of buffer' error 6 | ;; for some reason?! 7 | ;(execute-kbd-macro "\e4\C-f\C-@\C-n\C-n\C-x\C-xf\C-x\C-s\C-x\C-c") 8 | -------------------------------------------------------------------------------- /tests/interactive/exchange-point-and-mark.output: -------------------------------------------------------------------------------- 1 | Heref is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/execute-extended-command.el: -------------------------------------------------------------------------------- 1 | ; M-x forward-char RET a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-xforward-char\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/execute-extended-command.output: -------------------------------------------------------------------------------- 1 | Haere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/find-file-read-only.el: -------------------------------------------------------------------------------- 1 | ; kill-buffer RET find-file-read-only "tests/interactive/find-file-read-only.input" save-buffers save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-xk\r\C-x\C-rtests/interactive/find-file-read-only.input\r\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/find-file-read-only.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/find-file.el: -------------------------------------------------------------------------------- 1 | ; find-file not-exists RET kill-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-x\C-fnot-exists\r\C-xk\r\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/find-file.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/forward-paragraph.el: -------------------------------------------------------------------------------- 1 | ; forward-paragraph a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-}a\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/forward-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/forward-sexp.el: -------------------------------------------------------------------------------- 1 | ; ESC 6 forward-char ) beginning-of-line ( beginning-of-line forward-sexp a 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\e6\C-f)\M-<(\M-<\C-\M-fa\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/forward-sexp.output: -------------------------------------------------------------------------------- 1 | (Here i)as a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/forward-word.el: -------------------------------------------------------------------------------- 1 | ; ESC 4 forward-word a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\e4\M-fa\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/forward-word.output: -------------------------------------------------------------------------------- 1 | Here is a samplea file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/goto-line.el: -------------------------------------------------------------------------------- 1 | ; goto-line 4 RET a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-gg4\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/goto-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | aAnd more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/indent-for-tab-command.el: -------------------------------------------------------------------------------- 1 | ; goto-line 1 RET indent-for-tab-command 2 | ; goto-line 2 RET indent-for-tab-command 3 | ; goto-line 4 RET indent-for-tab-command 4 | ; indent-for-tab-command save-buffer save-buffers-kill-emacs 5 | (execute-kbd-macro "\M-gg1\r\t\M-gg2\r\t\M-gg4\r\t\C-x\C-s\C-x\C-c") 6 | -------------------------------------------------------------------------------- /tests/interactive/indent-for-tab-command.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/insert-file.el: -------------------------------------------------------------------------------- 1 | ; insert-file "insert-file.input" RET save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-xiinsert-file.input\r\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/insert-file.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | Here is a sample file. 6 | It has several lines. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/interactive/isearch-backward-regexp.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | ; isearch-backward-regexp e . e RET f save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-\M-re.e\rf\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/isearch-backward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has sfeveral lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/isearch-backward.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | ; isearch-backward l C-r RET f save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-rl\C-r\rf\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/isearch-backward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has severafl lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/isearch-forward-regexp.el: -------------------------------------------------------------------------------- 1 | ; isearch-forward-regexp [ a ] . p RET f save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-\M-s[a].p\rf\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/isearch-forward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sampfle file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/isearch-forward.el: -------------------------------------------------------------------------------- 1 | ; isearch-forward a m RET f save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-sam\rf\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/isearch-forward.output: -------------------------------------------------------------------------------- 1 | Here is a samfple file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/just-one-space.el: -------------------------------------------------------------------------------- 1 | ; forward-word SPC SPC SPC just-one-space insert "a" 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-f \M- a\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/just-one-space.output: -------------------------------------------------------------------------------- 1 | Here ais a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/kill-buffer.el: -------------------------------------------------------------------------------- 1 | ; switch-to-buffer "*scratch*" RET kill-buffer RET a 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-xb*scratch*\r\C-xk\ra\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/kill-buffer.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/kill-line.el: -------------------------------------------------------------------------------- 1 | ; kill-line kill-line goto-line 2 RET yank save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-k\C-k\M-gg2\r\C-y\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/kill-line.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | Here is a sample file. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/kill-region.el: -------------------------------------------------------------------------------- 1 | ; set-mark goto-line 3 RET kill-region 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-@\M-gg3\r\C-w\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/kill-region.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | -------------------------------------------------------------------------------- /tests/interactive/kill-sexp.el: -------------------------------------------------------------------------------- 1 | ; forward-word forward-word ) beginning-of-line ( beginning-of-line 2 | ; kill-sexp save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-f\M-f)\M-<(\M-<\C-\M-k\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/kill-sexp.output: -------------------------------------------------------------------------------- 1 | a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/kill-word.el: -------------------------------------------------------------------------------- 1 | ; ESC 3 kill-word save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\e3\M-d\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/kill-word.output: -------------------------------------------------------------------------------- 1 | sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/list-registers.el: -------------------------------------------------------------------------------- 1 | ; set-mark copy-to-register 1 list-registers other-window set-mark 2 | ; goto-line 2 RET copy-region-as-kill other-window yank 3 | ; save-buffer save-buffers-kill-emacs 4 | (execute-kbd-macro "\C-@\C-xrx1\M-xlist-registers\r\C-xo\C-@\M-gg2\r\M-w\C-xo\C-y\C-x\C-s\C-x\C-c") 5 | -------------------------------------------------------------------------------- /tests/interactive/list-registers.output: -------------------------------------------------------------------------------- 1 | Register 1 contains the empty string 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/interactive/mark-paragraph.el: -------------------------------------------------------------------------------- 1 | ; mark-paragraph kill-region aaa save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-h\C-waaa\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/mark-paragraph.output: -------------------------------------------------------------------------------- 1 | aaa 2 | And more than one paragraph. 3 | -------------------------------------------------------------------------------- /tests/interactive/mark-sexp.el: -------------------------------------------------------------------------------- 1 | ; forward-word ( ESC 3 forward-word ) backward-word backward-word ESC 5 2 | ; backward-char mark-sexp kill-region save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-f(\e3\M-f)\M-b\M-b\e5\C-b\C-\M-@\C-w\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/mark-sexp.output: -------------------------------------------------------------------------------- 1 | Here file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/mark-whole-buffer.el: -------------------------------------------------------------------------------- 1 | ; mark-whole-buffer copy-region-as-kill yank save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-xh\M-w\C-y\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/mark-whole-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | Here is a sample file. 6 | It has several lines. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/interactive/mark-word.el: -------------------------------------------------------------------------------- 1 | ; mark-word kill-region end-of-line yank save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-@\C-w\C-e\C-y\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/mark-word.output: -------------------------------------------------------------------------------- 1 | is a sample file.Here 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/newline-and-indent.el: -------------------------------------------------------------------------------- 1 | ; newline-and-indent goto-line 3 RET 2 | ; newline-and-indent goto-line 5 RET 3 | ; newline-and-indent newline-and-indent save-buffer save-buffers-kill-emacs 4 | (execute-kbd-macro "\C-j\M-gg3\r\C-j\M-gg5\r\C-j\C-j\C-x\C-s\C-x\C-c") 5 | -------------------------------------------------------------------------------- /tests/interactive/newline-and-indent.output: -------------------------------------------------------------------------------- 1 | 2 | Here is a sample file. 3 | 4 | It has several lines. 5 | 6 | 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/interactive/newline.el: -------------------------------------------------------------------------------- 1 | ; newline newline newline a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\r\r\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/newline.output: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | aHere is a sample file. 5 | It has several lines. 6 | 7 | And more than one paragraph. 8 | -------------------------------------------------------------------------------- /tests/interactive/open-line.el: -------------------------------------------------------------------------------- 1 | ; goto-line 2 RET ESC 3 open-line a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-gg2\r\e3\C-oa\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/open-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | a 3 | 4 | 5 | It has several lines. 6 | 7 | And more than one paragraph. 8 | -------------------------------------------------------------------------------- /tests/interactive/prefix-argument.el: -------------------------------------------------------------------------------- 1 | ; prefix-argument 2 kill-line goto-line 2 RET yank 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-2\C-k\M-gg2\r\C-y\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/prefix-argument.output: -------------------------------------------------------------------------------- 1 | 2 | Here is a sample file. 3 | It has several lines. 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/query-replace.el: -------------------------------------------------------------------------------- 1 | ; query-replace l e RET b d RET ! save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-%le\rbd\r!\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/query-replace.output: -------------------------------------------------------------------------------- 1 | Here is a sampbd fibd. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/quoted-insert.el: -------------------------------------------------------------------------------- 1 | ; quoted-insert C-a quoted-insert C-h quoted-insert C-z quoted-insert C-q 2 | ; quoted-insert ESC O P quoted-insert TAB save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-q\C-a\C-q\C-h\C-q\C-z\C-q\C-q\C-q\eOP\C-q\t\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/quoted-insert.output: -------------------------------------------------------------------------------- 1 | OP Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/resume_search.el: -------------------------------------------------------------------------------- 1 | ; search-forward "ra" isearch-forward ENTER 2 isearch-forward isearch-forward ENTER 3 2 | ; save-buffer save-buffers-kill-emacs 3 | (set-variable 'isearch-nonincremental-instead nil) 4 | (execute-kbd-macro "\C-sra\C-s\r2\C-s\C-s\r3\C-x\C-s\C-x\C-c") 5 | -------------------------------------------------------------------------------- /tests/interactive/resume_search.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one para2gra3ph. 5 | -------------------------------------------------------------------------------- /tests/interactive/save-some-buffers.el: -------------------------------------------------------------------------------- 1 | ; Execute: a save-some-buffers ! save-buffer save-buffers-quit-emacs 2 | (execute-kbd-macro "a\C-xs!\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/save-some-buffers.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/search-backward-regexp.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer search-backward-regexp l . n RET a 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M->\M-xsearch-backward-regexp\rl.n\ra\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/search-backward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several alines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/search-backward.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer search-backward li RET a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M->\M-xsearch-backward\rli\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/search-backward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several alines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/search-forward-regexp.el: -------------------------------------------------------------------------------- 1 | ; search-forward-regexp l . n RET a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-xsearch-forward-regexp\rl.n\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/search-forward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several linaes. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/search-forward.el: -------------------------------------------------------------------------------- 1 | ; search-forward l i RET a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M-xsearch-forward\rli\ra\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/search-forward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lianes. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/set-fill-column.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | 4 | ; set-mark goto-line 3 RET kill-region yank yank open-line 5 | ; goto-line 6 RET yank goto-line 9 RET 6 | (execute-kbd-macro "\C-@\M-gg3\r\C-w\C-y\C-y\C-o\M-gg6\r\C-y\M-gg9\r") 7 | 8 | ; ESC 3 set-fill-column fill-paragraph ESC -3 goto-line 6 RET 9 | ; ESC 12 set-fill-column fill-paragraph ESC -3 goto-line 2 RET backward-char 10 | ; ESC 33 set-fill-column fill-paragraph save-buffer save-buffers-kill-emacs 11 | (execute-kbd-macro "\e3\C-xf\M-q\M-gg6\r\e12\C-xf\M-q\M-gg2\r\C-b\e33\C-xf\M-q\C-x\C-s\C-x\C-c") 12 | -------------------------------------------------------------------------------- /tests/interactive/set-fill-column.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. It has 2 | several lines. Here is a sample 3 | file. It has several lines. 4 | 5 | Here is a 6 | sample file. 7 | It has 8 | several 9 | lines. 10 | 11 | And 12 | more 13 | than 14 | one 15 | paragraph. 16 | -------------------------------------------------------------------------------- /tests/interactive/set-variable.el: -------------------------------------------------------------------------------- 1 | ; set-variable "kill-whole-line" RET t RET 2 | ; kill-line save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-xset-variable\rkill-whole-line\rt\r\C-k\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/set-variable.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | 3 | And more than one paragraph. 4 | -------------------------------------------------------------------------------- /tests/interactive/shell-command-on-region.el: -------------------------------------------------------------------------------- 1 | ; set-mark goto-line 5 RET shell-command-on-region "sort" RET 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-@\M-gg5\r\C-u\M-|sort\r\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/shell-command-on-region.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | Here is a sample file. 4 | It has several lines. 5 | -------------------------------------------------------------------------------- /tests/interactive/shell-command.el: -------------------------------------------------------------------------------- 1 | ; shell-command "echo foo" RET save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-u\M-!echo foo\r\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/shell-command.output: -------------------------------------------------------------------------------- 1 | foo 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/interactive/switch-to-buffer.el: -------------------------------------------------------------------------------- 1 | ; switch-to-buffer "testbuf" ENTER "get this" ENTER switch-to-buffer ENTER 2 | (execute-kbd-macro "\C-xbtestbuf\rget this\r\C-xb\r") 3 | 4 | ; switch-to-buffer "testb" TAB ENTER "leave this" ENTER goto-line 1 ENTER kill-line kill-line 5 | ; switch-to-buffer ENTER yank save-buffer save-buffers-kill-emacs 6 | (execute-kbd-macro "\C-xbtestb \rleave this\r\M-gg1\r\C-k\C-k\C-xb\r\C-y\C-x\C-s\C-x\C-c") 7 | -------------------------------------------------------------------------------- /tests/interactive/switch-to-buffer.output: -------------------------------------------------------------------------------- 1 | get this 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/interactive/tab-to-tab-stop.el: -------------------------------------------------------------------------------- 1 | ; goto-line 3 RET tab-to-tab-stop tab-to-tab-stop t a b 2 | ; save-buffer save-buffers-kill-emacs) 3 | (execute-kbd-macro "\M-gg3\r\M-i\M-itab\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/tab-to-tab-stop.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | tab 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/transpose-chars.el: -------------------------------------------------------------------------------- 1 | ; forward-char transpose-chars transpose-chars transpose-chars 2 | ; transpose-chars transpose-chars transpose-chars transpose-chars 3 | ; transpose-chars transpose-chars transpose-chars transpose-chars 4 | ; save-buffer save-buffers-kill-emacs 5 | (execute-kbd-macro "\C-f\C-t\C-t\C-t\C-t\C-t\C-t\C-t\C-t\C-t\C-t\C-t\C-x\C-s\C-x\C-c") 6 | -------------------------------------------------------------------------------- /tests/interactive/transpose-chars.output: -------------------------------------------------------------------------------- 1 | ere is a saHmple file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/transpose-lines.el: -------------------------------------------------------------------------------- 1 | ; transpose-lines transpose-lines transpose-lines 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x\C-t\C-x\C-t\C-x\C-t\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/transpose-lines.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | 3 | And more than one paragraph. 4 | Here is a sample file. 5 | -------------------------------------------------------------------------------- /tests/interactive/transpose-sexps.el: -------------------------------------------------------------------------------- 1 | ; forward-sexp transpose-sexps transpose-sexps transpose-sexps 2 | ; transpose-sexps transpose-sexps save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-\M-f\C-\M-t\C-\M-t\C-\M-t\C-\M-t\C-\M-t\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/transpose-sexps.output: -------------------------------------------------------------------------------- 1 | is a sample file It. 2 | Here has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/transpose-words.el: -------------------------------------------------------------------------------- 1 | ; forward-word transpose-words transpose-words transpose-words 2 | ; transpose-words transpose-words save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-f\M-t\M-t\M-t\M-t\M-t\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/transpose-words.output: -------------------------------------------------------------------------------- 1 | is a sample file It. 2 | Here has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/universal-argument.el: -------------------------------------------------------------------------------- 1 | ; M-1 0 forward-char a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-u10\C-fa\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/universal-argument.output: -------------------------------------------------------------------------------- 1 | Here is a asample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/upcase-word.el: -------------------------------------------------------------------------------- 1 | ; ESC 4 upcase-word save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\e4\M-u\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/interactive/upcase-word.output: -------------------------------------------------------------------------------- 1 | HERE IS A SAMPLE file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/interactive/yank.el: -------------------------------------------------------------------------------- 1 | ; set-mark goto-line 3 RET kill-region end-of-buffer yank 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-@\M-gg3\r\C-w\M->\C-y\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/interactive/yank.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | Here is a sample file. 4 | It has several lines. 5 | -------------------------------------------------------------------------------- /tests/just-one-space.el: -------------------------------------------------------------------------------- 1 | (forward-word) 2 | (insert " ") 3 | (just-one-space) 4 | (insert "a") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/just-one-space.output: -------------------------------------------------------------------------------- 1 | Here ais a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/kill-buffer.el: -------------------------------------------------------------------------------- 1 | (switch-to-buffer "*scratch*") 2 | (kill-buffer "*scratch*") 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/kill-buffer.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/kill-line.el: -------------------------------------------------------------------------------- 1 | (forward-line) 2 | (forward-word 2) 3 | (kill-line) 4 | (forward-line 2) 5 | (kill-line -1) 6 | (forward-line -2) 7 | (end-of-line) 8 | (kill-line 0) 9 | (save-buffer) 10 | (save-buffers-kill-emacs) 11 | -------------------------------------------------------------------------------- /tests/kill-line.output: -------------------------------------------------------------------------------- 1 | 2 | It has 3 | And more than one paragraph. 4 | -------------------------------------------------------------------------------- /tests/kill-region.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 2) 3 | (kill-region (point) (mark)) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/kill-region.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | -------------------------------------------------------------------------------- /tests/kill-sexp.el: -------------------------------------------------------------------------------- 1 | (forward-word 2) 2 | (insert ")") 3 | (beginning-of-line) 4 | (insert "(") 5 | (beginning-of-line) 6 | (kill-sexp) 7 | (save-buffer) 8 | (save-buffers-kill-emacs) 9 | -------------------------------------------------------------------------------- /tests/kill-sexp.output: -------------------------------------------------------------------------------- 1 | a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/kill-word.el: -------------------------------------------------------------------------------- 1 | (kill-word 3) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/kill-word.output: -------------------------------------------------------------------------------- 1 | sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/list-registers.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (copy-to-register 49 (point) (mark)) 3 | (list-registers) 4 | (other-window 1) 5 | (set-mark (point)) 6 | (forward-line) 7 | (copy-region-as-kill (point) (mark)) 8 | (other-window -1) 9 | (yank) 10 | (save-buffer) 11 | (save-buffers-kill-emacs) 12 | -------------------------------------------------------------------------------- /tests/list-registers.output: -------------------------------------------------------------------------------- 1 | Register 1 contains the empty string 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/mark-paragraph.el: -------------------------------------------------------------------------------- 1 | (mark-paragraph) 2 | (kill-region (point) (mark)) 3 | (insert "aaa") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/mark-paragraph.output: -------------------------------------------------------------------------------- 1 | aaa 2 | And more than one paragraph. 3 | -------------------------------------------------------------------------------- /tests/mark-sexp.el: -------------------------------------------------------------------------------- 1 | (forward-word) 2 | (insert "(") 3 | (forward-word 3) 4 | (insert ")") 5 | (backward-word 2) 6 | (backward-char 5) 7 | (mark-sexp) 8 | (kill-region (point) (mark)) 9 | (save-buffer) 10 | (save-buffers-kill-emacs) 11 | -------------------------------------------------------------------------------- /tests/mark-sexp.output: -------------------------------------------------------------------------------- 1 | Here file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/mark-whole-buffer.el: -------------------------------------------------------------------------------- 1 | (mark-whole-buffer) 2 | (copy-region-as-kill (point) (mark)) 3 | (yank) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/mark-whole-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | Here is a sample file. 6 | It has several lines. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/mark-word.el: -------------------------------------------------------------------------------- 1 | (mark-word) 2 | (kill-region (point) (mark)) 3 | (end-of-line) 4 | (yank) 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/mark-word.output: -------------------------------------------------------------------------------- 1 | is a sample file.Here 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/newline-and-indent.el: -------------------------------------------------------------------------------- 1 | (newline-and-indent) 2 | (forward-line) 3 | (newline-and-indent) 4 | (forward-line) 5 | (newline-and-indent) 6 | (newline-and-indent) 7 | (save-buffer) 8 | (save-buffers-kill-emacs) 9 | -------------------------------------------------------------------------------- /tests/newline-and-indent.output: -------------------------------------------------------------------------------- 1 | 2 | Here is a sample file. 3 | 4 | It has several lines. 5 | 6 | 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/newline.el: -------------------------------------------------------------------------------- 1 | (newline 3) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/newline.output: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | aHere is a sample file. 5 | It has several lines. 6 | 7 | And more than one paragraph. 8 | -------------------------------------------------------------------------------- /tests/next-line.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Use next-line! 2 | (forward-line 3) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/next-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | aAnd more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/open-line.el: -------------------------------------------------------------------------------- 1 | (forward-line) 2 | (open-line 3) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/open-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | a 3 | 4 | 5 | It has several lines. 6 | 7 | And more than one paragraph. 8 | -------------------------------------------------------------------------------- /tests/previous-line.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (forward-line -3) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/previous-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | aIt has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/quit.el: -------------------------------------------------------------------------------- 1 | (save-buffers-kill-emacs) 2 | -------------------------------------------------------------------------------- /tests/quit.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/regression/33910_execute-kbd-macro_with_quoted-insert.el: -------------------------------------------------------------------------------- 1 | ;;; FIXME: Although F1 usually outputs ^[OP, this test will fail 2 | ;;; when the terminal outputs something else instead. 3 | 4 | ;; quoted-insert F1 RETURN 5 | ;; save-buffer save-buffers-kill-emacs 6 | (execute-kbd-macro "\C-q\F1\RET\C-x\C-s\C-x\C-c") 7 | -------------------------------------------------------------------------------- /tests/regression/33910_execute-kbd-macro_with_quoted-insert.output: -------------------------------------------------------------------------------- 1 | OP 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/regression/34080_buffer-name-suffix.el: -------------------------------------------------------------------------------- 1 | ;;; Regression: 2 | ;;; crash when creating suffixed buffers for files with the same name 3 | 4 | ; find-file a/f RET find-file b/f RET kill-buffer RET kill-buffer RET 5 | ; save-buffer save-buffers-kill-emacs 6 | (execute-kbd-macro "\C-x\C-fa/f\r\C-x\C-fb/f\r\C-xk\r\C-xk\r\C-x\C-s\C-x\C-c") 7 | -------------------------------------------------------------------------------- /tests/regression/34080_buffer-name-suffix.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/regression/34086_call-last-kbd-macro.el: -------------------------------------------------------------------------------- 1 | ; start-kbd-macro "foo" RET UP end-kbd-macro 2 | ; prefix-cmd 3 call-last-kbd-macro save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x(foo\r\UP\C-x)\e3\C-xe\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/34086_call-last-kbd-macro.output: -------------------------------------------------------------------------------- 1 | foo 2 | foo 3 | foo 4 | foo 5 | Here is a sample file. 6 | It has several lines. 7 | 8 | And more than one paragraph. 9 | -------------------------------------------------------------------------------- /tests/regression/34087_undo_macro.el: -------------------------------------------------------------------------------- 1 | ; start-kbd-macro foo RET end-kbd-macro call-last-kbd-macro undo 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x(foo\r\C-x)\C-xe\C-_\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/34087_undo_macro.output: -------------------------------------------------------------------------------- 1 | foo 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/regression/34193_interactive_insert.el: -------------------------------------------------------------------------------- 1 | ;;; Regression: 2 | ;;; crash after accepting an empty argument to insert 3 | 4 | ; insert RET 5 | ; save-buffer save-buffers-kill-emacs 6 | (execute-kbd-macro "\M-xinsert\r\C-g\C-x\C-s\C-x\C-c") 7 | -------------------------------------------------------------------------------- /tests/regression/34193_interactive_insert.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/regression/35053_eob_upcase-word.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer backward-word upcase-word end-of-buffer upcase-word 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M->\M-b\M-u\M->\M-u\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/35053_eob_upcase-word.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one PARAGRAPH. 5 | -------------------------------------------------------------------------------- /tests/regression/35560_find-file_completion.el: -------------------------------------------------------------------------------- 1 | ; find-file TAB keyboard-quit o k RET save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-x\C-f\t\C-gok\r\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/regression/35560_find-file_completion.output: -------------------------------------------------------------------------------- 1 | ok 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/regression/35562_search-backward.el: -------------------------------------------------------------------------------- 1 | ; M-x search-backward RET C-g 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-xsearch-backward\r\C-g\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/35562_search-backward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/regression/35567_minibuffer_ding_non_printable.el: -------------------------------------------------------------------------------- 1 | ; ESC 1 ESC ! "echo foo" \M-x RET 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\e1\e!echo foo\M-x\r\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/35567_minibuffer_ding_non_printable.output: -------------------------------------------------------------------------------- 1 | foo 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/regression/forward-char_at_end.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer a forward-char 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M->a\C-f\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/forward-char_at_end.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | a -------------------------------------------------------------------------------- /tests/regression/goto-char_large.el: -------------------------------------------------------------------------------- 1 | ; C-u 10000 goto-char 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-10000\M-xgoto-char\RET\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/regression/goto-char_large.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/run-lisp-tests.lua: -------------------------------------------------------------------------------- 1 | -- run-lisp-tests 2 | -- 3 | -- Copyright (c) 2010-2014 Free Software Foundation, Inc. 4 | -- 5 | -- This file is part of GNU Zile. 6 | -- 7 | -- This program is free software; you can redistribute it and/or modify it 8 | -- under the terms of the GNU General Public License as published by 9 | -- the Free Software Foundation; either version 3, or (at your option) 10 | -- any later version. 11 | -- 12 | -- This program is distributed in the hope that it will be useful, but 13 | -- WITHOUT ANY WARRANTY; without even the implied warranty of 14 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | -- General Public License for more details. 16 | -- 17 | -- You should have received a copy of the GNU General Public License 18 | -- along with this program. If not, see . 19 | 20 | posix = require "posix" 21 | require "std" 22 | 23 | -- N.B. Tests that use execute-kbd-macro must note that keyboard input 24 | -- is only evaluated once the script has finished running. 25 | 26 | -- The following are defined in the environment for a build 27 | local srcdir = os.getenv ("srcdir") or "." 28 | local abs_srcdir = os.getenv ("abs_srcdir") or "." 29 | local builddir = os.getenv ("builddir") or "." 30 | local EMACSPROG = os.getenv ("EMACSPROG") or "" 31 | 32 | local zile_pass = 0 33 | local zile_fail = 0 34 | local emacs_pass = 0 35 | local emacs_fail = 0 36 | 37 | local zile_cmd = io.catfile (builddir, "lib", "zmacs", "zmacs") 38 | local srcdir_pat = string.escapePattern (srcdir) 39 | 40 | function run_test (test, name, editor_name, edit_file, cmd, args) 41 | posix.spawn ({"cp", io.catfile (srcdir, "tests", "test.input"), edit_file}) 42 | posix.spawn ({"chmod", "+w", edit_file}) 43 | local status = posix.spawn ({cmd, unpack (args)}) 44 | if status == 0 then 45 | if posix.spawn ({"diff", test .. ".output", edit_file}) == 0 then 46 | posix.spawn ({"rm", "-f", edit_file, edit_file .. "~"}) 47 | return true 48 | else 49 | print (editor_name .. " " .. name .. " failed to produce correct output") 50 | end 51 | else 52 | print (editor_name .. " " .. name .. " failed to run with error code " .. tostring (status)) 53 | end 54 | end 55 | 56 | for _, name in ipairs (arg) do 57 | local test = name:gsub ("%.el$", "") 58 | if io.open (test .. ".output") ~= nil then 59 | name = test:gsub (io.catfile (srcdir, "tests/"), "") 60 | local edit_file = test:gsub ("^" .. srcdir_pat, builddir) .. ".input" 61 | local args = {"--no-init-file", edit_file, "--load", test:gsub ("^" .. srcdir_pat, abs_srcdir) .. ".el"} 62 | 63 | posix.spawn ({"mkdir", "-p", posix.dirname (edit_file)}) 64 | 65 | if EMACSPROG ~= "" then 66 | if run_test (test, name, "Emacs", edit_file, EMACSPROG, list.concat (args, {"--quick", "--batch"})) then 67 | emacs_pass = emacs_pass + 1 68 | else 69 | emacs_fail = emacs_fail + 1 70 | os.rename (edit_file, edit_file .. "-emacs") 71 | os.rename (edit_file .. "~", edit_file .. "-emacs~") 72 | end 73 | end 74 | 75 | if run_test (test, name, "Zile", edit_file, zile_cmd, args) then 76 | zile_pass = zile_pass + 1 77 | else 78 | zile_fail = zile_fail + 1 79 | end 80 | end 81 | end 82 | 83 | print (string.format ("Zile: %d pass(es) and %d failure(s)", zile_pass, zile_fail)) 84 | print (string.format ("Emacs: %d pass(es) and %d failure(s)", emacs_pass, emacs_fail)) 85 | 86 | os.exit (zile_fail + emacs_fail) 87 | -------------------------------------------------------------------------------- /tests/search-backward-regexp.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (search-backward-regexp "l.n") 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/search-backward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several alines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/search-backward.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (search-backward "li") 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/search-backward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several alines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/search-forward-regexp.el: -------------------------------------------------------------------------------- 1 | (search-forward-regexp "l.n") 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/search-forward-regexp.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several linaes. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/search-forward.el: -------------------------------------------------------------------------------- 1 | (search-forward "li") 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/search-forward.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lianes. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/set-fill-column.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | (set-mark (point)) 4 | (forward-line 2) 5 | (kill-region (point) (mark)) 6 | (yank) 7 | (yank) 8 | (open-line 1) 9 | (forward-line) 10 | (yank) 11 | (forward-line) 12 | (set-fill-column 3) 13 | (fill-paragraph) 14 | (forward-line -3) 15 | (set-fill-column 12) 16 | (fill-paragraph) 17 | (forward-line -6) 18 | (end-of-line) 19 | (set-fill-column 33) 20 | (fill-paragraph) 21 | (save-buffer) 22 | (save-buffers-kill-emacs) 23 | -------------------------------------------------------------------------------- /tests/set-fill-column.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. It has 2 | several lines. Here is a sample 3 | file. It has several lines. 4 | 5 | Here is a 6 | sample file. 7 | It has 8 | several 9 | lines. 10 | 11 | And 12 | more 13 | than 14 | one 15 | paragraph. 16 | -------------------------------------------------------------------------------- /tests/set-variable.el: -------------------------------------------------------------------------------- 1 | (set-variable 'kill-whole-line t) 2 | (kill-line) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/set-variable.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | 3 | And more than one paragraph. 4 | -------------------------------------------------------------------------------- /tests/setq_nonexistent_variable.el: -------------------------------------------------------------------------------- 1 | (setq unknown-variable t) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/setq_nonexistent_variable.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/shell-command-on-region-2.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 4) 3 | (shell-command-on-region (point) (mark) "sort" t) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/shell-command-on-region-2.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | 6 | And more than one paragraph. 7 | Here is a sample file. 8 | It has several lines. 9 | -------------------------------------------------------------------------------- /tests/shell-command-on-region.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 4) 3 | (shell-command-on-region (mark) (point) "sort" t t) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/shell-command-on-region.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | Here is a sample file. 4 | It has several lines. 5 | -------------------------------------------------------------------------------- /tests/shell-command.el: -------------------------------------------------------------------------------- 1 | (shell-command "echo foo" t) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/shell-command.output: -------------------------------------------------------------------------------- 1 | foo 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/switch-to-buffer.el: -------------------------------------------------------------------------------- 1 | (switch-to-buffer "*scratch*") 2 | (insert "This is cool!.") 3 | (switch-to-buffer "switch-to-buffer.input") 4 | (insert "This is not.") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/switch-to-buffer.output: -------------------------------------------------------------------------------- 1 | This is not.Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/tab-to-tab-stop.el: -------------------------------------------------------------------------------- 1 | (forward-line 2) 2 | (tab-to-tab-stop) 3 | (tab-to-tab-stop) 4 | (insert "tab") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/tab-to-tab-stop.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | tab 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/test.input: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/tests.mk: -------------------------------------------------------------------------------- 1 | # Tests Makefile.am 2 | # 3 | # Copyright (c) 1997-2014 Free Software Foundation, Inc. 4 | # 5 | # This file is part of GNU Zile. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3, or (at your option) 10 | # any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | RUNLISPTESTS = $(LUA) $(srcdir)/tests/run-lisp-tests.lua 21 | 22 | TERM ?= vt100 23 | 24 | LISP_TESTS = \ 25 | $(srcdir)/tests/*.el \ 26 | $(srcdir)/tests/interactive/*.el 27 | 28 | LISP_TESTS_ZILE_ONLY = \ 29 | $(srcdir)/tests/regression/*.el \ 30 | $(srcdir)/tests/zile-only/*.el \ 31 | $(srcdir)/tests/zile-only/interactive/*.el 32 | 33 | LISP_TESTS_ZILE_ONLY_FIXED_SCREEN = \ 34 | $(srcdir)/tests/zile-only/fixed-screen/*.el 35 | 36 | LISP_TESTS_OUTPUTS = \ 37 | $(srcdir)/tests/*.output \ 38 | $(srcdir)/tests/interactive/*.output \ 39 | $(srcdir)/tests/regression/*.output \ 40 | $(srcdir)/tests/zile-only/*.output \ 41 | $(srcdir)/tests/zile-only/interactive/*.output \ 42 | $(srcdir)/tests/zile-only/fixed-screen/*.output 43 | 44 | LISP_ALL_TESTS = \ 45 | $(LISP_TESTS) \ 46 | $(LISP_TESTS_ZILE_ONLY) \ 47 | $(LISP_TESTS_ZILE_ONLY_FIXED_SCREEN) 48 | 49 | LISP_TESTS_ENVIRONMENT = \ 50 | abs_srcdir=$(abs_srcdir) \ 51 | srcdir=$(srcdir) \ 52 | abs_builddir=$(abs_builddir) \ 53 | TERM=$(TERM) 54 | 55 | EXTRA_DIST += \ 56 | $(LISP_ALL_TESTS) \ 57 | $(LISP_TESTS_OUTPUTS) \ 58 | tests/test.input \ 59 | tests/run-lisp-tests.lua 60 | 61 | ## Temporarily disable automatic running of these tests 62 | ##check_local += tests-check-local 63 | 64 | tests-check-local: $(builddir)/lib/zmacs/zmacs 65 | echo $(LISP_TESTS) | $(LUA_ENV) EMACSPROG="$(EMACSPROG)" $(LISP_TESTS_ENVIRONMENT) xargs $(RUNLISPTESTS) 66 | echo $(LISP_TESTS_ZILE_ONLY_FIXED_SCREEN) | COLUMNS=80 LINES=24 $(LISP_TESTS_ENVIRONMENT) EMACSPROG= xargs $(RUNLISPTESTS) 67 | echo $(LISP_TESTS_ZILE_ONLY) | $(LUA_ENV) EMACSPROG= $(LISP_TESTS_ENVIRONMENT) xargs $(RUNLISPTESTS) 68 | $(LISP_TESTS_ENVIRONMENT) $(builddir)/lib/zmacs/zmacs --unknown-flag --load $(srcdir)/tests/quit.el 69 | -------------------------------------------------------------------------------- /tests/toggle-read-only.el: -------------------------------------------------------------------------------- 1 | (toggle-read-only) 2 | ; FIXME: The next line causes an error in Emacs so the test fails 3 | ;(insert "aaa") 4 | (toggle-read-only) 5 | (insert "a") 6 | (save-buffer) 7 | (save-buffers-kill-emacs) 8 | -------------------------------------------------------------------------------- /tests/toggle-read-only.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/transpose-chars.el: -------------------------------------------------------------------------------- 1 | (forward-char) 2 | (transpose-chars 1) 3 | (transpose-chars 1) 4 | (transpose-chars 1) 5 | (transpose-chars 1) 6 | (transpose-chars 1) 7 | (transpose-chars 1) 8 | (transpose-chars 1) 9 | (transpose-chars 1) 10 | (transpose-chars 1) 11 | (transpose-chars 1) 12 | (transpose-chars 1) 13 | (save-buffer) 14 | (save-buffers-kill-emacs) 15 | -------------------------------------------------------------------------------- /tests/transpose-chars.output: -------------------------------------------------------------------------------- 1 | ere is a saHmple file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/transpose-lines.el: -------------------------------------------------------------------------------- 1 | (transpose-lines 1) 2 | (transpose-lines 1) 3 | (transpose-lines 1) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/transpose-lines.output: -------------------------------------------------------------------------------- 1 | It has several lines. 2 | 3 | And more than one paragraph. 4 | Here is a sample file. 5 | -------------------------------------------------------------------------------- /tests/transpose-sexps.el: -------------------------------------------------------------------------------- 1 | (forward-sexp) 2 | (transpose-sexps 1) 3 | (transpose-sexps 1) 4 | (transpose-sexps 1) 5 | (transpose-sexps 1) 6 | (transpose-sexps 1) 7 | (save-buffer) 8 | (save-buffers-kill-emacs) 9 | -------------------------------------------------------------------------------- /tests/transpose-sexps.output: -------------------------------------------------------------------------------- 1 | is a sample file It. 2 | Here has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/transpose-words.el: -------------------------------------------------------------------------------- 1 | (forward-word) 2 | (transpose-words 1) 3 | (transpose-words 1) 4 | (transpose-words 1) 5 | (transpose-words 1) 6 | (transpose-words 1) 7 | (save-buffer) 8 | (save-buffers-kill-emacs) 9 | -------------------------------------------------------------------------------- /tests/transpose-words.output: -------------------------------------------------------------------------------- 1 | is a sample file It. 2 | Here has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/upcase-region.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 2) 3 | (upcase-region (point) (mark)) 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/upcase-region.output: -------------------------------------------------------------------------------- 1 | HERE IS A SAMPLE FILE. 2 | IT HAS SEVERAL LINES. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/upcase-word.el: -------------------------------------------------------------------------------- 1 | (upcase-word 4) 2 | (save-buffer) 3 | (save-buffers-kill-emacs) 4 | -------------------------------------------------------------------------------- /tests/upcase-word.output: -------------------------------------------------------------------------------- 1 | HERE IS A SAMPLE file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/yank.el: -------------------------------------------------------------------------------- 1 | (set-mark (point)) 2 | (forward-line 2) 3 | (kill-region (point) (mark)) 4 | (forward-line 3) 5 | (yank) 6 | (save-buffer) 7 | (save-buffers-kill-emacs) 8 | -------------------------------------------------------------------------------- /tests/yank.output: -------------------------------------------------------------------------------- 1 | 2 | And more than one paragraph. 3 | Here is a sample file. 4 | It has several lines. 5 | -------------------------------------------------------------------------------- /tests/zile-only/backward-word.el: -------------------------------------------------------------------------------- 1 | ; end-of-line backward-word backward-word a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-e\M-b\M-ba\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/backward-word.output: -------------------------------------------------------------------------------- 1 | Here is a asample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/end-of-line.el: -------------------------------------------------------------------------------- 1 | ; end-of-line a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-ea\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/end-of-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file.a 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/fill-paragraph.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | 4 | ; end-of-line 5 | ; " I am now going to make the line sufficiently long that I can wrap it." 6 | ; fill-paragraph save-buffer save-buffers-kill-emacs 7 | (execute-kbd-macro "\C-e I am now going to make the line sufficiently long that I can wrap it.\M-q\C-x\C-s\C-x\C-c") 8 | -------------------------------------------------------------------------------- /tests/zile-only/fill-paragraph.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. I am now going to make the line sufficiently 2 | long that I can wrap it. It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/fill-paragraph_2.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | (end-of-line) 4 | (insert " I am now going to make the line sufficiently long that I can wrap it.") 5 | (fill-paragraph) 6 | (undo) 7 | (insert "a") 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/zile-only/fill-paragraph_2.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. I am now going to make the line sufficiently long that I can wrap it.a 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/fixed-screen/scroll-down.el: -------------------------------------------------------------------------------- 1 | (end-of-buffer) 2 | (scroll-down) 3 | (insert "a") 4 | (save-buffer) 5 | (save-buffers-kill-emacs) 6 | -------------------------------------------------------------------------------- /tests/zile-only/fixed-screen/scroll-down.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/fixed-screen/scroll-up.el: -------------------------------------------------------------------------------- 1 | (scroll-up) 2 | (insert "a") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/zile-only/fixed-screen/scroll-up.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | a -------------------------------------------------------------------------------- /tests/zile-only/global-set-key.el: -------------------------------------------------------------------------------- 1 | (global-set-key "d" 'delete-char) 2 | (execute-kbd-macro "ddddd") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/zile-only/global-set-key.output: -------------------------------------------------------------------------------- 1 | is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/global-unset-key.el: -------------------------------------------------------------------------------- 1 | (global-unset-key "e") 2 | (execute-kbd-macro "begin") 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/zile-only/global-unset-key.output: -------------------------------------------------------------------------------- 1 | bginHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/goal-column.el: -------------------------------------------------------------------------------- 1 | (forward-char) 2 | (forward-char) 3 | (forward-char) 4 | (forward-char) 5 | (next-line) 6 | (next-line) 7 | (next-line) 8 | (insert "a") 9 | (save-buffer) 10 | (save-buffers-kill-emacs) 11 | -------------------------------------------------------------------------------- /tests/zile-only/goal-column.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And amore than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/backward-kill-word.el: -------------------------------------------------------------------------------- 1 | ; end-of-line backward-kill-word 1 save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-e\C-\M-?\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/backward-kill-word.output: -------------------------------------------------------------------------------- 1 | Here is a sample 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/call-last-kbd-macro.el: -------------------------------------------------------------------------------- 1 | ; start-kbd-macro forward-word a end-kbd-macro call-last-kbd-macro 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x(\M-fa\C-x)\C-xe\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/call-last-kbd-macro.output: -------------------------------------------------------------------------------- 1 | Herea isa a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/downcase-region.el: -------------------------------------------------------------------------------- 1 | ;; By default interactive downcase-region is disabled in GNU Emacs. 2 | 3 | ; set-mark goto-line 3 RET downcase-region 4 | ; save-buffer save-buffers-kill-emacs 5 | (execute-kbd-macro "\C-@\M-gg3\r\C-x\C-l\C-x\C-s\C-x\C-c") 6 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/downcase-region.output: -------------------------------------------------------------------------------- 1 | here is a sample file. 2 | it has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/fill-paragraph_2.el: -------------------------------------------------------------------------------- 1 | ; FIXME: Next line should not be needed 2 | (setq sentence-end-double-space nil) 3 | 4 | ; end-of-line " I am now going to make the line sufficiently long that I can wrap it." 5 | ; fill-paragraph undo a save-buffer save-buffers-kill-emacs 6 | (execute-kbd-macro "\C-e I am now going to make the line sufficiently long that I can wrap it.\M-q\C-_a\C-x\C-s\C-x\C-c") 7 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/fill-paragraph_2.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. I am now going to make the line sufficiently long that I can wrap it.a 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/global-set-key.el: -------------------------------------------------------------------------------- 1 | ; M-x global-set-key RET d delete-char RET d d d d d 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro 4 | "\M-xglobal-set-key\RETddelete-char\RETddddd\C-x\C-s\C-x\C-c") 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/global-set-key.output: -------------------------------------------------------------------------------- 1 | is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/global-unset-key.el: -------------------------------------------------------------------------------- 1 | ; M-x global-unset-key RET e b e g i n 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-xglobal-unset-key\RETebegin\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/global-unset-key.output: -------------------------------------------------------------------------------- 1 | bginHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/goal-column.el: -------------------------------------------------------------------------------- 1 | ; ESC 4 forward-char ESC 3 next-line a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\e4\C-f\e3\C-na\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/goal-column.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And amore than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/keyboard-quit.el: -------------------------------------------------------------------------------- 1 | (insert "a") 2 | ; find-file keyboard-quit save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x\C-f\C-g\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/keyboard-quit.output: -------------------------------------------------------------------------------- 1 | aHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/list-buffers.el: -------------------------------------------------------------------------------- 1 | ; list-buffers other-window set-mark forward-line copy-region-as-kill 2 | ; other-window yank save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\C-x\C-b\C-xo\C-@\C-n\M-w\C-xo\C-y\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/list-buffers.output: -------------------------------------------------------------------------------- 1 | CRM Buffer Size Mode File 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/negative_prefix-argument.el: -------------------------------------------------------------------------------- 1 | ; prefix-argument 2 kill-line save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-n\C-n\M--2\C-k\C-n\C-y\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/negative_prefix-argument.output: -------------------------------------------------------------------------------- 1 | 2 | It has several lines. 3 | Here is a sample file. 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/next-line.el: -------------------------------------------------------------------------------- 1 | ; next-line next-line a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\C-n\C-na\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/next-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | a 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/previous-line.el: -------------------------------------------------------------------------------- 1 | ; end-of-buffer ESC 3 previous-line a save-buffer save-buffers-kill-emacs 2 | (execute-kbd-macro "\M->\e3\C-pa\C-x\C-s\C-x\C-c") 3 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/previous-line.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | aIt has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/revert-buffer.el: -------------------------------------------------------------------------------- 1 | ; M-4 delete-char M-x revert-buffer RET 2 | ; save-buffer save-buffers-kill-emacs 3 | (execute-kbd-macro "\M-4\C-d\M-xrevert-buffer\RET\C-x\C-s\C-x\C-c") 4 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/revert-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/undo.el: -------------------------------------------------------------------------------- 1 | ; undo in Emacs undoes everything from the start of the script (cf. fill-paragraph_2.el) 2 | 3 | ; delete-char delete-char delete-char delete-char undo undo undo 4 | ; save-buffer save-buffers-kill-emacs 5 | (execute-kbd-macro "\C-d\C-d\C-d\C-d\C-_\C-_\C-_\C-x\C-s\C-x\C-c") 6 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/undo.output: -------------------------------------------------------------------------------- 1 | ere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/upcase-region.el: -------------------------------------------------------------------------------- 1 | ;; By default interactive upcase-region is disabled in GNU Emacs. 2 | 3 | ; set-mark goto-line 3 RET upcase-region 4 | ; save-buffer save-buffers-kill-emacs 5 | (execute-kbd-macro "\C-@\M-gg3\r\C-x\C-u\C-x\C-s\C-x\C-c") 6 | -------------------------------------------------------------------------------- /tests/zile-only/interactive/upcase-region.output: -------------------------------------------------------------------------------- 1 | HERE IS A SAMPLE FILE. 2 | IT HAS SEVERAL LINES. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/list-buffers.el: -------------------------------------------------------------------------------- 1 | (list-buffers) 2 | (other-window 1) 3 | (set-mark (point)) 4 | (forward-line) 5 | (copy-region-as-kill (point) (mark)) 6 | (other-window -1) 7 | (yank) 8 | (save-buffer) 9 | (save-buffers-kill-emacs) 10 | -------------------------------------------------------------------------------- /tests/zile-only/list-buffers.output: -------------------------------------------------------------------------------- 1 | CRM Buffer Size Mode File 2 | Here is a sample file. 3 | It has several lines. 4 | 5 | And more than one paragraph. 6 | -------------------------------------------------------------------------------- /tests/zile-only/revert-buffer.el: -------------------------------------------------------------------------------- 1 | (delete-char 4) 2 | (revert-buffer) 3 | (save-buffer) 4 | (save-buffers-kill-emacs) 5 | -------------------------------------------------------------------------------- /tests/zile-only/revert-buffer.output: -------------------------------------------------------------------------------- 1 | Here is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/undo.el: -------------------------------------------------------------------------------- 1 | ; undo in Emacs undoes everything from the start of the script (cf. fill-paragraph_2.el) 2 | (delete-char 1) 3 | (delete-char 1) 4 | (delete-char 1) 5 | (delete-char 1) 6 | (undo) 7 | (undo) 8 | (undo) 9 | (save-buffer) 10 | (save-buffers-kill-emacs) 11 | -------------------------------------------------------------------------------- /tests/zile-only/undo.output: -------------------------------------------------------------------------------- 1 | ere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /tests/zile-only/undo_2.el: -------------------------------------------------------------------------------- 1 | ; undo in Emacs undoes everything from the start of the script (cf. fill-paragraph_2.el) 2 | (insert "a") 3 | (undo) 4 | (insert "b") 5 | (save-buffer) 6 | (save-buffers-kill-emacs) 7 | -------------------------------------------------------------------------------- /tests/zile-only/undo_2.output: -------------------------------------------------------------------------------- 1 | bHere is a sample file. 2 | It has several lines. 3 | 4 | And more than one paragraph. 5 | -------------------------------------------------------------------------------- /travis.yml.in: -------------------------------------------------------------------------------- 1 | # Lua is not officially supported, but an erlang environment will do. 2 | language: erlang 3 | 4 | env: 5 | global: 6 | - PACKAGE=@PACKAGE@ 7 | - ROCKSPEC=@PACKAGE@-git-1.rockspec 8 | - LUAROCKS_CONFIG=build-aux/luarocks-config.lua 9 | - LUAROCKS_BASE=luarocks-2.1.1 10 | - LUAROCKS="$LUA $HOME/bin/luarocks" 11 | matrix: 12 | - LUA=lua5.2 LUA_INCDIR=/usr/include/lua5.2 LUA_SUFFIX=5.2 13 | 14 | # Tool setup. 15 | install: 16 | # Put back the links for libyaml, which went missing on recent Travis VMs 17 | - test -f /usr/lib/libyaml.so || 18 | sudo find /usr/lib -name 'libyaml*' -exec ln -s {} /usr/lib \; 19 | 20 | - sudo apt-get install help2man 21 | - sudo apt-get install lua5.2 22 | - sudo apt-get install liblua5.2-dev 23 | 24 | # Install a recent luarocks release locally. 25 | - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz 26 | - tar zxvpf $LUAROCKS_BASE.tar.gz 27 | - ( cd $LUAROCKS_BASE; 28 | ./configure 29 | --prefix=$HOME --lua-version=$LUA_SUFFIX --lua-suffix=$LUA_SUFFIX 30 | --with-lua-include=$LUA_INCDIR; 31 | make; 32 | sudo make install; ) 33 | 34 | # Configure and build. 35 | script: 36 | # Initial bootstrap to build luarocks-config.lua, before we've 37 | # installed our rocks. 38 | - ./bootstrap --skip-rock-checks 39 | - ./configure LUA="$LUA" 40 | - make $LUAROCKS_CONFIG 41 | LUA="$LUA" LUA_INCDIR="$LUA_INCDIR" V=1 42 | || cat $LUAROCKS_CONFIG config.log 43 | 44 | # Set Lua and Shell paths up for local luarocks tree. 45 | # this package depends on will be installed. 46 | - eval `$LUAROCKS path` 47 | - export PATH=`pwd`/luarocks/bin:$PATH 48 | 49 | # Install extra rocks into $LUAROCKS_CONFIG rocks tree. 50 | - $LUAROCKS install lyaml; $LUAROCKS install specl; $LUAROCKS install ldoc 51 | 52 | # Make git rockspec for @PACKAGE@ 53 | - make rockspecs LUAROCKS="$LUAROCKS" V=1 54 | || { $LUAROCKS path; cat $ROCKSPEC; } 55 | 56 | # The git rockspec will rerun bootstrap, and check any rock versions 57 | # in bootstrap.conf:buildreq this time. 58 | - $LUAROCKS make $ROCKSPEC LUA="$LUA" 59 | - luarocks/bin/zmacs --version 60 | - luarocks/bin/zz --version 61 | 62 | # Check specifications. 63 | - LUA_PATH=`pwd`'/lib/?.lua;'"${LUA_PATH-;}" make check V=1 64 | 65 | # Check autotools installation. 66 | - $LUAROCKS remove $PACKAGE 67 | - ./configure LUA="$LUA" --prefix=`pwd`/_inst 68 | - make clean all install || lib/zz/zz --version 69 | - _inst/bin/zmacs --help 70 | - _inst/bin/zz --help 71 | --------------------------------------------------------------------------------