add emacs config

This commit is contained in:
lucy 2026-08-21 23:49:25 +02:00
commit c1363180d7
761 changed files with 46444 additions and 0 deletions

View file

@ -0,0 +1,57 @@
name: Test
on: push
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest]
emacs_version:
- '24.3'
- '25.1'
- '25.3'
- '26.1'
- '26.2'
- '26.3'
- '27.1'
include:
# - emacs_version: 'snapshot'
# os: ubuntu-latest
# allow_failure: true
# - os: macos-latest
# emacs_version: '24.3'
- os: macos-latest
emacs_version: '25.1'
- os: macos-latest
emacs_version: '27.1'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Emacs
uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}
- name: Set up Cask
uses: conao3/setup-cask@master
- name: Install Lua (Ubuntu)
if: matrix.os != 'macos-latest'
run: sudo apt install lua5.2 && echo 'print(123)' | lua -i
- name: Install Lua (MacOS)
if: matrix.os == 'macos-latest'
uses: xpol/setup-lua@master
with:
lua-version: "5.2.4"
- name: Run tests
if: matrix.allow_failure != true
run: 'cask && make test'
- name: Run tests (allow failure)
if: matrix.allow_failure == true
run: 'cask && make test || true'

View file

@ -0,0 +1,37 @@
dist: xenial
language: minimal
sudo: no
addons:
apt:
packages:
- lua5.2
homebrew:
update: true
packages:
- lua
env:
- EVM_EMACS=emacs-git-snapshot-travis-linux-xenial
- EVM_EMACS=emacs-26.2-travis-linux-xenial
- EVM_EMACS=emacs-26.1-travis-linux-xenial
- EVM_EMACS=emacs-25.3-travis
- EVM_EMACS=emacs-25.2-travis
- EVM_EMACS=emacs-25.1-travis
- EVM_EMACS=emacs-24.5-travis
- EVM_EMACS=emacs-24.4-travis
- EVM_EMACS=emacs-24.3-travis
jobs:
include:
- os: osx
env:
- EVM_EMACS=emacs-26.1-travis
matrix:
allow_failures:
- env: EVM_EMACS=emacs-git-snapshot-travis-linux-xenial
fast_finish: true
before_install:
- source ./travis/before-install.sh
install:
- cask install
script:
- echo 'print(123)' | lua -i
- make test

View file

@ -0,0 +1,42 @@
Thanks to:
- Thanks to xristos <xristos@sdf.lonestar.org> for subprocess buffer handling
fixes (tiny change)
- Thanks to Juergen Fuhrmann <juergen.fuhrmann@web.de> (tiny change)
- Thanks to guoxx <guoxx@me.com> for imenu expression extension (tiny change).
- Vedat Hallac <github.com/vhallac> for sharing some of his fixes and updates
to core indentation logics.
- Julien Danjou <julien@danjou.info> for a patch deriving lua-mode from
prog-mode with define-derived-mode
- Rafael Sanchez <rafael@cornerdimension.com> for patch adding lua-mode to
interpreter-mode-alist.
- Thanks to Leonardo Etcheverry <leo@kalio.net> for enabling narrow-to-defun
and fixing lua-send-defun.
- Thanks to Tobias Polzin <polzin@gmx.de> for function indenting patch: Indent
"(" like "{".
- Thanks to Fabien <fleutot@gmail.com> for imenu patches.
- Thanks to Simon Marshall <simonm@mail.esrin.esa.it> and Olivier Andrieu
<oandrieu@gmail.com> for font-lock patches.
- Additional font-lock highlighting and indentation tweaks by Adam D. Moss
<adam@gimp.org>.
- Juergen Hoetzel <juergen@hoetzel.info> for hard work maintaining lua-mode during
2006 -- 2010.
- Reuben Thomas <rrt@sc3d.org> for hard work maintaining lua-mode during 2010
-- 2011.
- Rolando Pereira <rolando_pereira@sapo.pt> for adding support for goto keyword
Ideas:
- thanks to d87 <github.com/d87> for an idea of highlighting lua builtins

View file

@ -0,0 +1,12 @@
(source melpa)
(source gnu)
(package "lua-mode" "dev" "Major mode for editing Lua")
(development
(depends-on "buttercup" "1.9")
(depends-on "cl-lib"))
;; Local Variables:
;; mode: emacs-lisp
;; End:

View file

@ -0,0 +1,58 @@
# Makefile for lua-mode
VERSION="$(shell sed -nre '/^;; Version:/ { s/^;; Version:[ \t]+//; p }' lua-mode.el)"
DISTFILE = lua-mode-$(VERSION).zip
# EMACS value may be overridden
EMACS?=emacs
EMACS_MAJOR_VERSION=$(shell $(EMACS) -batch -eval '(princ emacs-major-version)')
LUA_MODE_ELC=lua-mode.$(EMACS_MAJOR_VERSION).elc
EMACS_BATCH=$(EMACS) --batch -Q
default:
@echo version is $(VERSION)
%.$(EMACS_MAJOR_VERSION).elc: %.elc
mv $< $@
%.elc: %.el
$(EMACS_BATCH) -f batch-byte-compile $<
compile: $(LUA_MODE_ELC)
dist:
rm -f $(DISTFILE) && \
git archive --format=zip -o $(DISTFILE) --prefix=lua-mode/ HEAD
.PHONY: test-compiled-nocask test-uncompiled-nocask test-compiled test-uncompiled
# check both regular and compiled versions
test-nocask: test-compiled-nocask test-uncompiled-nocask
test: test-compiled test-uncompiled
test-compiled-nocask: $(LUA_MODE_ELC)
$(EMACS) -batch -l $(LUA_MODE_ELC) -l buttercup -f buttercup-run-discover
test-uncompiled-nocask:
$(EMACS) -batch -l lua-mode.el -l buttercup -f buttercup-run-discover
test-compiled: $(LUA_MODE_ELC)
EMACS=$(EMACS) cask exec buttercup -l $(LUA_MODE_ELC)
test-uncompiled:
EMACS=$(EMACS) cask exec buttercup -l lua-mode.el
tryout:
cask exec $(EMACS) -Q -l init-tryout.el test.lua
tryout-nocask:
$(EMACS) -Q -l init-tryout.el test.lua
release:
git fetch && \
git diff remotes/origin/master --exit-code && \
git tag -a -m "Release tag" rel-$(VERSION) && \
woger lua-l lua-mode lua-mode "release $(VERSION)" "Emacs major mode for editing Lua files" release-notes-$(VERSION) http://github.com/immerrr/lua-mode/ && \
git push origin master
@echo 'Send update to ELPA!'

View file

@ -0,0 +1,106 @@
* Release v20151025
** allow setting lua-indent-level as file local variable (issue #108)
** add luadoc keyword fontification (issue #71)
** fix comments being spilled into the code (issue #25)
** add `run-lua' alias for `lua-start-process' (issue #97)
** skip shebang line when sending to inferior buffer (issue #61)
** add builtin functions and modules for Lua 5.3 (issue #90)
** fix lua-beginning-of-proc matching (issue #85)
** add `lua-documentation-function' to customize the way the documentation is
shown, rename `lua-search-url-prefix' to `lua-documentation-url',
auto-detect lua documentation installed in /usr/share/doc/lua (issue #82)
** fix some errors with `lua-kill-process' (issue #69)
** improve `next-error' integration in Lua subprocess buffer: "stdin:N:"
entries are no longer highlighted and no longer prompt for "stdin" files
* release v20140514
** add support for Lua 5.2 goto statements
** when indenting, don't anchor to block-open tokens
somefunc({
^
don't indent next line relative to this brace
** fix several `indent-new-comment-line'-related bugs
** add support for local functions in imenu (issue #65)
** fix font lock of functions with underscores (issue #63)
** don't send shebang when sending lua buffer to subprocess (issue #61)
** fix interaction with electric-pair-mode (issue #54)
** rewrite lua-send-region to use "loadstring" rather than "dofile"
- sending code to processes on remote hosts is now supported
- stack traces for errors occurred in sent code point to proper lines in files
- script path is preserved when sending code (issue #55)
- no more hang ups when waiting for input (issue #48) or after sending code
with no output (issue #60)
** increase consistency with Emacs ecosystem to improve user experience
- fix character syntax hacks: '.' is now punctuation and '_' is now symbol
- remove number highlighting
- font-lock "nil", "true" and "false" as constants rather than keywords
** make builtin font-locking more stable, enable it after ".." operator
** add missing modulo operator (%) to line-continuation tokens
** fix interaction with electric-pair-mode (issue #54)
** when unindenting block-close tokens consider all of them, not just the first one
x = foobar('arg1', function ()
print('foobar')
end)
^ this line starts with two block-close tokens and is unindented
accordingly
* Release rel-20130419
** highlight hash-bang line as comment
** make lua-mode-hook editable via customize
** fix several indentation bugs & quirks
** fix lua-send-proc not to send previous function when point is at the beginning of a function
** derive lua-mode from prog-mode for Emacs24
** add font-locking for builtins and numeric constants
** fix a bug causing exponential complexity in a keyword matching regexp
** add more unindentation cases for block-closing tokens
** improve multiline highlighting via font-lock-syntactic-keywords
This should make font-locking of multiline literals more fluent & stable. And
it becomes customizable via standard font-lock configuration
** properly fontify variable definitions in 'local ...' & 'for ...'
Also, perform some basic syntax verification in those lines. Multi-line
constructs not supported yet.
** fix indentation for blocks starting on continued lines
local foo =
{
bar,
baz
} ^
1. these lines should be indented properly now
^
2. the following lines should be unindented properly now
** extend imenu-generic-expression
Now it matches 'foo = function(...)' function definitions

View file

@ -0,0 +1,13 @@
Lua-mode
========
Maintainer: immerrr <immerrr+lua@gmail.com>
lua-mode is an Emacs major mode for editing Lua files. For
documentation, including installation instructions, please see
lua-mode.el.
Please send bug reports and suggestions to the maintainer, or use the
trackers at github:
http://github.com/immerrr/lua-mode

View file

@ -0,0 +1,109 @@
# Lua mode
[![Build Status](https://travis-ci.org/immerrr/lua-mode.svg?branch=master)](https://travis-ci.org/immerrr/lua-mode)
[![MELPA](https://melpa.org/packages/lua-mode-badge.svg)](https://melpa.org/#/lua-mode)
[![MELPA Stable](https://stable.melpa.org/packages/lua-mode-badge.svg)](https://stable.melpa.org/#/lua-mode)
[![NonGNU ELPA](https://elpa.nongnu.org/nongnu/lua-mode.svg)](https://elpa.nongnu.org/nongnu/lua-mode.html)
**lua-mode** is a major mode for editing Lua sources in Emacs.
If you have a problem or a suggestion about **lua-mode**, please, let me know about it via github's [Issue Tracker](https://github.com/immerrr/lua-mode/issues).
## INSTALLATION
### MELPA INSTALLATION
**lua-mode**'s officially supported installation method is from [MELPA](https://melpa.org/#/) archive.
To get started, enable installing packages from MELPA:
```lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
```
To fetch the list of packages you can do
```
<M-x> package-refresh-contents
```
And after that **lua-mode** can be installed with
```
<M-x> package-install "lua-mode"
```
Please, refer to [MELPA documentation](https://melpa.org/#/getting-started) and [Emacs documentation on
packages](https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html) for further information.
### EL-GET INSTALLATION
[El-get](https://github.com/dimitri/el-get) is a package manager which greatly simplifies adding
modules to your Emacs and keeping them up-to-date. Once you have **el-get** set up,
**lua-mode** can also be installed with
<M-x> el-get-install "lua-mode"
and updating is no more than
<M-x> el-get-update "lua-mode"
Please, consult with [el-get documentation](https://github.com/dimitri/el-get/blob/master/README.md) for further information.
### MANUAL INSTALLATION
To install, you need to make sure that `lua-mode.el` is on your load-path (and optionally byte-compile
it) and to set up Emacs to automatically enable **lua-mode** for `*.lua` files or ones that contain lua
hash-bang line (`#!/usr/bin/lua`). Putting this snippet to `.emacs` should be enough in most cases:
```lisp
;;;; This snippet enables lua-mode
;; This line is not necessary, if lua-mode.el is already on your load-path
(add-to-list 'load-path "/path/to/directory/where/lua-mode-el/resides")
(autoload 'lua-mode "lua-mode" "Lua editing mode." t)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
```
## FEATURES
- syntactic indentation & highlighting (including multiline literals/comments)
- evaluation of lines/regions/functions/files in Lua subprocess or direct interaction with its REPL
- documentation lookup (using online/offline reference manual, e.g. [string.find](http://www.lua.org/manual/5.1/manual.html#pdf-string.find))
- [imenu](http://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html) integration
- [HideShow](http://www.gnu.org/software/emacs/manual/html_node/emacs/Hideshow.html) integration
- [Flymake](https://www.gnu.org/software/emacs/manual/html_mono/flymake.html) integration for on-the-fly linting. The [luacheck](https://github.com/lunarmodules/luacheck) program is required for this. It can be installed e.g. via luarocks.
## CUSTOMIZATION
The following variables are available for customization (see more via `M-x customize-group lua`):
- Var `lua-indent-level` (default `3`): indentation offset in spaces
- Var `lua-indent-string-contents` (default `nil`): set to `t` if you like to have contents of multiline strings to be indented like comments
- Var `lua-indent-nested-block-content-align` (default `t`) set to `nil` to stop aligning the content of nested blocks with the open parenthesis
- Var `lua-indent-close-paren-align` (default `t`) set to `t` to align close parenthesis with the open parenthesis rather than with the beginning of the line
- Var `lua-mode-hook`: list of functions to execute when lua-mode is initialized
- Var `lua-documentation-url` (default `"http://www.lua.org/manual/5.1/manual.html#pdf-"`): base URL for documentation lookup
- Var `lua-documentation-function` (default `browse-url`): function used to show documentation (`eww` is a viable alternative for Emacs 25)
## LUA SUBPROCESS CREATION
- Var `lua-default-application` (default `"lua"`): command to start up the subprocess (REPL)
- Var `lua-default-command-switches` (default `"-i"`): arguments to pass to the subprocess on startup (make sure `-i` is there if you expect working with Lua shell interactively)
- Cmd `lua-start-process`: start new REPL process, usually happens automatically
- Cmd `lua-kill-process`: kill current REPL process
## LUA SUBPROCESS INTERACTION
- Cmd `lua-show-process-buffer`: switch to REPL buffer
- Cmd `lua-hide-process-buffer`: hide window showing REPL buffer
- Var `lua-always-show`: show REPL buffer after sending something
- Cmd `lua-send-buffer`: send whole buffer
- Cmd `lua-send-current-line`: send current line
- Cmd `lua-send-defun`: send current top-level function
- Cmd `lua-send-region`: send active region
- Cmd `lua-restart-with-whole-file`: restart REPL and send whole buffer

View file

@ -0,0 +1,92 @@
# -*- mode: org -*-
#+PROPERTY: COOKIE_DATA todo recursive
* Useful resources
- Lua5.1
- [[http://www.lua.org/manual/5.1/manual.html#8][bnf syntax]]
- [[http://www.lua.org/manual/5.1/index.html#index][function index]]
- Lua5.2
- [[http://www.lua.org/manual/5.2/manual.html#9][syntax]]
- [[http://www.lua.org/manual/5.2/#index][function index]]
* TODO Fontify function parameters as variable names
* TODO Fontify variable names in line-continuation statements
- local
foo,bar,baz = xyz,xyyz,xyyz
- function xyzzy(
foo,
bar,
baz
)
* TODO left-shift parenthesis that closes function parameter block
local foobar = function(
param1,
param2,
param3
)
dosmth()
end
* TODO issue #33
a =
{
}
b =
{
}
* TODO finish works in lua-compat branch for Emacs21/Emacs22
* TODO put text property 'lua-last-stmt-begin
- continuation-line detection becomes a one-liner
- multiline fontification becomes easier
- beginning-of-defun is a one-liner
- if property value is a marker, it will get updated on each edit,
that's not necessary and might cause performance impact
- if property value is an integer, it needs to be updated before use
1. `buffer-access-fontify-functions' / `buffer-access-fontified-property'
2. maintain `stmt-begin-up-to-date-pos' point
- after-change function sets `stmt-begin-up-to-date-pos' to
(line-beginning-position)
- (defun get-stmt-beginning-pos (pos) ...)
- (when (< stmt-begin-up-to-date-pos pos)
...
(setq stmt-begin-up-to-date-pos pos))
- return property at position pos
* TODO Support line-continuation statements [0/2]
- [ ] assignments
x,y = long_value,
other_long_value
- [ ] `for ... do' operators
* TODO update site [0/2]
** TODO reuse section-aware template
** TODO add section for release downloading
* TODO [#C] Improve lua-prefix-key machinery [0/2]
- [ ] add docs
- [ ] improve setting prefix-key
Currently, prefix-key is parsed from a macro string (which may
contain more than one key) and all keys but the first one are
silently removed. Maybe there's a better way to do it.
* DONE Fix braces/parens that reduce indent by const offset
this causes wrong behavior when indented block was
anchored to first line, e.g.
my_func( hello,
world
)
* DONE lua-mark-all-multiline-literals [5/5]
- [X] process --[[ as multiline comment
- [X] process ---[[ as single-line comment
distinguish by syntax state of last dash before square bracket
- [X] don't recognize [[ in comments or literals
- [X] extend region backwards if BEGIN is inside multiline literal
- [X] don't change buffer-modified-p state
* TODO [#C] Redo syntax engine using semantic/wisent

View file

@ -0,0 +1,41 @@
;;; lua-mode-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.
;; This file is part of GNU Emacs.
;;; Code:
(add-to-list 'load-path (or (and load-file-name (directory-file-name (file-name-directory load-file-name))) (car load-path)))
;;; Generated autoloads from lua-mode.el
(autoload 'lua-mode "lua-mode" "\
Major mode for editing Lua code.
(fn)" t)
(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode))
(defalias 'run-lua #'lua-start-process)
(autoload 'lua-start-process "lua-mode" "\
Start a Lua process named NAME, running PROGRAM.
PROGRAM defaults to NAME, which defaults to `lua-default-application'.
When called interactively, switch to the process buffer.
(fn &optional NAME PROGRAM STARTFILE &rest SWITCHES)" t)
(register-definition-prefixes "lua-mode" '("lua-"))
;;; End of scraped data
(provide 'lua-mode-autoloads)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:
;;; lua-mode-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;; Generated package description from lua-mode.el -*- no-byte-compile: t -*-
(define-package "lua-mode" "20221027" "a major-mode for editing Lua scripts" '((emacs "24.3")) :commit "1cb83e691627fb92290d452cb08b6c5f73fe19b6" :authors '(("2011-2013 immerrr" . "immerrr+lua@gmail.com") ("2010-2011 Reuben Thomas" . "rrt@sc3d.org") ("2006 Juergen Hoetzel" . "juergen@hoetzel.info") ("2001 Christian Vogler" . "cvogler@gradient.cis.upenn.edu") ("1997 Bret Mogilefsky starting from" . "mogul-lua@gelatinous.com") ("tcl-mode by Gregor Schmid" . "schmid@fb3-s7.math.tu-berlin.de") ("Paul Du Bois and" . "pld-lua@gelatinous.com") ("Aaron Smith" . "aaron-lua@gelatinous.com")) :maintainer '(("2011-2013 immerrr" . "immerrr+lua@gmail.com") ("2010-2011 Reuben Thomas" . "rrt@sc3d.org") ("2006 Juergen Hoetzel" . "juergen@hoetzel.info") ("2001 Christian Vogler" . "cvogler@gradient.cis.upenn.edu") ("1997 Bret Mogilefsky starting from" . "mogul-lua@gelatinous.com") ("tcl-mode by Gregor Schmid" . "schmid@fb3-s7.math.tu-berlin.de") ("Paul Du Bois and" . "pld-lua@gelatinous.com") ("Aaron Smith" . "aaron-lua@gelatinous.com")) :keywords '("languages" "processes" "tools") :url "https://immerrr.github.io/lua-mode")

File diff suppressed because it is too large Load diff

Binary file not shown.