runrist 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- runrist/__init__.py +23 -0
- runrist/__main__.py +6 -0
- runrist/api.py +228 -0
- runrist/buffer.py +845 -0
- runrist/chars.py +154 -0
- runrist/command.py +100 -0
- runrist/commands/__init__.py +5 -0
- runrist/commands/basic.py +1491 -0
- runrist/commands/files.py +234 -0
- runrist/commands/folding.py +191 -0
- runrist/commands/misc.py +55 -0
- runrist/commands/prog.py +815 -0
- runrist/commands/registers.py +204 -0
- runrist/commands/windows.py +568 -0
- runrist/display.py +796 -0
- runrist/editor.py +1006 -0
- runrist/eregex.py +293 -0
- runrist/errors.py +62 -0
- runrist/faces.py +297 -0
- runrist/files.py +393 -0
- runrist/fold.py +206 -0
- runrist/fontlock.py +294 -0
- runrist/help.py +489 -0
- runrist/keymap.py +183 -0
- runrist/keys.py +438 -0
- runrist/kmacro.py +465 -0
- runrist/live.py +571 -0
- runrist/main.py +107 -0
- runrist/minibuffer.py +817 -0
- runrist/minimap.py +386 -0
- runrist/mode.py +260 -0
- runrist/modeline.py +155 -0
- runrist/modes/__init__.py +5 -0
- runrist/modes/base.py +47 -0
- runrist/modes/clike.py +314 -0
- runrist/modes/data/asm-mode.json +1 -0
- runrist/modes/data/autoconf-mode.json +1 -0
- runrist/modes/data/awk-mode.json +1 -0
- runrist/modes/data/bat-mode.json +1 -0
- runrist/modes/data/bibtex-mode.json +1 -0
- runrist/modes/data/change-log-mode.json +1 -0
- runrist/modes/data/conf-colon-mode.json +1 -0
- runrist/modes/data/conf-desktop-mode.json +1 -0
- runrist/modes/data/conf-javaprop-mode.json +1 -0
- runrist/modes/data/conf-mode.json +1 -0
- runrist/modes/data/conf-space-mode.json +1 -0
- runrist/modes/data/conf-toml-mode.json +1 -0
- runrist/modes/data/conf-unix-mode.json +1 -0
- runrist/modes/data/conf-windows-mode.json +1 -0
- runrist/modes/data/css-mode.json +1 -0
- runrist/modes/data/diff-mode.json +1 -0
- runrist/modes/data/dns-mode.json +1 -0
- runrist/modes/data/emacs-lisp-mode.json +1 -0
- runrist/modes/data/f90-mode.json +1 -0
- runrist/modes/data/fortran-mode.json +1 -0
- runrist/modes/data/html-mode.json +1 -0
- runrist/modes/data/index.json +595 -0
- runrist/modes/data/js-json-mode.json +1 -0
- runrist/modes/data/js-mode.json +1 -0
- runrist/modes/data/latex-mode.json +1 -0
- runrist/modes/data/ld-script-mode.json +1 -0
- runrist/modes/data/lisp-data-mode.json +1 -0
- runrist/modes/data/lisp-mode.json +1 -0
- runrist/modes/data/lua-mode.json +1 -0
- runrist/modes/data/m4-mode.json +1 -0
- runrist/modes/data/makefile-automake-mode.json +1 -0
- runrist/modes/data/makefile-bsdmake-mode.json +1 -0
- runrist/modes/data/makefile-gmake-mode.json +1 -0
- runrist/modes/data/makefile-mode.json +1 -0
- runrist/modes/data/nroff-mode.json +1 -0
- runrist/modes/data/octave-mode.json +1 -0
- runrist/modes/data/pascal-mode.json +1 -0
- runrist/modes/data/perl-mode.json +1 -0
- runrist/modes/data/plain-tex-mode.json +1 -0
- runrist/modes/data/prolog-mode.json +1 -0
- runrist/modes/data/python-mode.json +1 -0
- runrist/modes/data/rst-mode.json +1 -0
- runrist/modes/data/ruby-mode.json +1 -0
- runrist/modes/data/scheme-mode.json +1 -0
- runrist/modes/data/sgml-mode.json +1 -0
- runrist/modes/data/sh-mode.json +1 -0
- runrist/modes/data/sql-mode.json +1 -0
- runrist/modes/data/tcl-mode.json +1 -0
- runrist/modes/data/texinfo-mode.json +1 -0
- runrist/modes/data/verilog-mode.json +1 -0
- runrist/modes/data/vhdl-mode.json +1 -0
- runrist/modes/dired.py +255 -0
- runrist/modes/emacs.py +244 -0
- runrist/modes/markup.py +161 -0
- runrist/modes/python.py +311 -0
- runrist/pyeval.py +260 -0
- runrist/search.py +656 -0
- runrist/startup.py +123 -0
- runrist/syntax.py +325 -0
- runrist/term.py +391 -0
- runrist/testing.py +55 -0
- runrist/text.py +355 -0
- runrist/themes/__init__.py +162 -0
- runrist/user.py +6 -0
- runrist/variables.py +227 -0
- runrist/window.py +292 -0
- runrist-0.1.0.dist-info/METADATA +197 -0
- runrist-0.1.0.dist-info/RECORD +107 -0
- runrist-0.1.0.dist-info/WHEEL +5 -0
- runrist-0.1.0.dist-info/entry_points.txt +2 -0
- runrist-0.1.0.dist-info/licenses/COPYING +674 -0
- runrist-0.1.0.dist-info/top_level.txt +1 -0
runrist/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# runrist -- a live terminal text editor in the Emacs tradition.
|
|
2
|
+
# Copyright (C) 2026 Adam DePrince
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
# (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
"""Runrist: a live, Python-extensible terminal text editor.
|
|
17
|
+
|
|
18
|
+
The running editor is the program. Its source is loaded statement by
|
|
19
|
+
statement and patched in place, so redefining a function, a class or a key
|
|
20
|
+
binding takes effect at once, in every place that already refers to it.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
__version__ = '0.1.0'
|
runrist/__main__.py
ADDED
runrist/api.py
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# This file is part of runrist. GPL-3.0-or-later; see COPYING.
|
|
2
|
+
"""What extensions use.
|
|
3
|
+
|
|
4
|
+
``from runrist.api import *`` brings in the editor object, the decorators that
|
|
5
|
+
define commands, modes and variables, and functions that act on the current
|
|
6
|
+
buffer under the names Emacs gives them::
|
|
7
|
+
|
|
8
|
+
from runrist.api import *
|
|
9
|
+
|
|
10
|
+
@command('p')
|
|
11
|
+
def duplicate_line(n=1):
|
|
12
|
+
"Insert N copies of the current line below it."
|
|
13
|
+
line = buffer_substring(line_beginning_position(), line_end_position())
|
|
14
|
+
with save_excursion():
|
|
15
|
+
goto_char(line_end_position())
|
|
16
|
+
insert(('\\n' + line) * n)
|
|
17
|
+
|
|
18
|
+
global_set_key('C-c d', duplicate_line)
|
|
19
|
+
|
|
20
|
+
Positions count from zero and ranges exclude their end, as in Python.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from . import faces, files, fold, keymap, live, minibuffer, variables
|
|
24
|
+
from .buffer import Buffer, Marker, Overlay, inhibit_read_only
|
|
25
|
+
from .command import command, commands, defalias
|
|
26
|
+
from .editor import ed, global_map
|
|
27
|
+
from .errors import (BeginningOfBuffer, BufferReadOnly, EditorError, EndOfBuffer, Quit,
|
|
28
|
+
SearchFailed)
|
|
29
|
+
from .faces import defface, deftheme, load_theme, set_face
|
|
30
|
+
from .keymap import Keymap, kbd, key_description
|
|
31
|
+
from .minibuffer import (completing_read, read_buffer, read_char, read_command,
|
|
32
|
+
read_file_name, read_from_minibuffer, read_number, read_string,
|
|
33
|
+
y_or_n_p, yes_or_no_p)
|
|
34
|
+
from .mode import (add_auto_mode, major_mode, minor_mode, minor_mode_enabled,
|
|
35
|
+
set_major_mode, set_minor_mode)
|
|
36
|
+
from .variables import (add_hook, defhook, defvar, remove_hook, run_hooks, setq, v)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def current_buffer():
|
|
40
|
+
return ed.current_buffer
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def selected_window():
|
|
44
|
+
return ed.selected_window
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def message(text=None):
|
|
48
|
+
"""Show ``text`` in the echo area and log it in ``*Messages*``."""
|
|
49
|
+
return ed.message(text)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def point():
|
|
53
|
+
return ed.current_buffer.pt
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def point_min():
|
|
57
|
+
return ed.current_buffer.point_min
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def point_max():
|
|
61
|
+
return ed.current_buffer.point_max
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def goto_char(position):
|
|
65
|
+
return ed.current_buffer.goto_char(position)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def insert(*strings):
|
|
69
|
+
ed.current_buffer.insert(*strings)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def delete_region(start, end):
|
|
73
|
+
return ed.current_buffer.delete_region(start, end)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def buffer_string():
|
|
77
|
+
return ed.current_buffer.string()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def buffer_substring(start, end):
|
|
81
|
+
return ed.current_buffer.substring(start, end)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def char_after(position=None):
|
|
85
|
+
return ed.current_buffer.char_after(position)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def char_before(position=None):
|
|
89
|
+
return ed.current_buffer.char_before(position)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def bolp():
|
|
93
|
+
return ed.current_buffer.bolp()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def eolp():
|
|
97
|
+
return ed.current_buffer.eolp()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def bobp():
|
|
101
|
+
return ed.current_buffer.bobp()
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def eobp():
|
|
105
|
+
return ed.current_buffer.eobp()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def forward_line(n=1):
|
|
109
|
+
return ed.current_buffer.forward_line(n)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def line_beginning_position(n=1):
|
|
113
|
+
return ed.current_buffer.line_beginning_position(n)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def line_end_position(n=1):
|
|
117
|
+
return ed.current_buffer.line_end_position(n)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def line_number_at_pos(position=None):
|
|
121
|
+
return ed.current_buffer.line_number(position)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def current_column():
|
|
125
|
+
return ed.current_buffer.current_column()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def move_to_column(column, force=False):
|
|
129
|
+
return ed.current_buffer.move_to_column(column, force)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def current_indentation():
|
|
133
|
+
return ed.current_buffer.current_indentation()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def search_forward(string, bound=None, noerror=False, count=1):
|
|
137
|
+
return ed.current_buffer.search_forward(string, bound, noerror=noerror, count=count)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def search_backward(string, bound=None, noerror=False, count=1):
|
|
141
|
+
return ed.current_buffer.search_backward(string, bound, noerror=noerror, count=count)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def re_search_forward(pattern, bound=None, noerror=False, count=1):
|
|
145
|
+
return ed.current_buffer.re_search_forward(pattern, bound, noerror=noerror, count=count)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def re_search_backward(pattern, bound=None, noerror=False, count=1):
|
|
149
|
+
return ed.current_buffer.re_search_backward(pattern, bound, noerror=noerror, count=count)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def looking_at(pattern):
|
|
153
|
+
return ed.current_buffer.looking_at(pattern)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def looking_back(pattern, limit=None):
|
|
157
|
+
return ed.current_buffer.looking_back(pattern, limit)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def mark():
|
|
161
|
+
return ed.current_buffer.mark_pos()
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def region_beginning():
|
|
165
|
+
return ed.current_buffer.region()[0]
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def region_end():
|
|
169
|
+
return ed.current_buffer.region()[1]
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def region_active_p():
|
|
173
|
+
return ed.current_buffer.region_active()
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def save_excursion():
|
|
177
|
+
"""``with save_excursion():`` restores point afterwards."""
|
|
178
|
+
return ed.current_buffer.save_excursion()
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def with_current_buffer(buffer):
|
|
182
|
+
"""``with with_current_buffer(b):`` makes ``b`` current for the block."""
|
|
183
|
+
return ed.current(ed.get_buffer(buffer) or buffer)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def get_buffer(name):
|
|
187
|
+
return ed.get_buffer(name)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def get_buffer_create(name):
|
|
191
|
+
return ed.get_buffer_create(name)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def switch_to_buffer(buffer):
|
|
195
|
+
return ed.switch_to_buffer(buffer)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def find_file(filename):
|
|
199
|
+
return ed.switch_to_buffer(files.find_file_noselect(filename))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def global_set_key(keys, binding):
|
|
203
|
+
"""Bind a key sequence, in ``kbd`` notation, for every buffer."""
|
|
204
|
+
global_map.bind(keys, binding)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def global_unset_key(keys):
|
|
208
|
+
global_map.unbind(keys)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def local_set_key(keys, binding):
|
|
212
|
+
"""Bind a key sequence in the current buffer's major mode."""
|
|
213
|
+
ed.current_buffer.keymap.bind(keys, binding)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def call_interactively(name):
|
|
217
|
+
return ed.call_interactively(name)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def run_at_time(delay, function, repeat=None):
|
|
221
|
+
return ed.run_at_time(delay, function, repeat)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def run_with_idle_timer(seconds, function, repeat=True):
|
|
225
|
+
return ed.run_with_idle_timer(seconds, function, repeat)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
__all__ = [name for name in dir() if not name.startswith('_')]
|