Skip to content

Commit 704bf19

Browse files
committed
Remove redundant functions
1 parent e8f525c commit 704bf19

2 files changed

Lines changed: 5 additions & 28 deletions

File tree

emacs/elisp/ast.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66

77
__all__ = ['ElispAstNode', 'Form', 'Literal', 'Symbol', 'Cons', 'List', 'Quote',
8-
'Raw', 'to_elisp', 'make_list', 'make_alist', 'make_plist',
9-
'symbols', 'quote', 'cons']
8+
'Raw', 'to_elisp', 'make_alist', 'make_plist', 'symbols', 'quote']
109

1110

1211
class ElispAstNode:
@@ -200,22 +199,10 @@ def _bool_to_elisp(value):
200199
# Convert Python lists to quoted Emacs lists
201200
@to_elisp.register(list)
202201
def _py_list_to_el_list(pylist):
203-
return Quote(make_list(pylist))
202+
return Quote(List(pylist))
204203

205204

206-
@to_elisp.register(tuple)
207-
def make_list(items):
208-
"""Make an Elisp list from a Python sequence, first converting its elements to Elisp.
209-
210-
Parameters
211-
----------
212-
items : Iterable of objects to convert to list.
213-
214-
Returns
215-
-------
216-
.List
217-
"""
218-
return List(map(to_elisp, items))
205+
to_elisp.register(tuple, List)
219206

220207

221208
def quote(value):
@@ -237,16 +224,6 @@ def quote(value):
237224
return Quote(form)
238225

239226

240-
def cons(car, cds):
241-
"""Create a Cons cell, converting arguments.
242-
243-
Returns
244-
-------
245-
.Cons
246-
"""
247-
return Cons(to_elisp(car), to_elisp(cds))
248-
249-
250227
def symbols(*names, quote=False):
251228
"""Create a list of symbols.
252229
@@ -303,7 +280,7 @@ def make_alist(pairs, quote=False):
303280
-------
304281
ElispAstNode
305282
"""
306-
alist = List([cons(key, value) for key, value in _convert_pairs(pairs)])
283+
alist = List([Cons(key, value) for key, value in _convert_pairs(pairs)])
307284
return Quote(alist) if quote else alist
308285

309286

emacs/elisp/dsl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def __call__(self, value):
3939
return to_elisp(value)
4040

4141
Q = staticmethod(quote)
42-
C = staticmethod(cons)
42+
C = staticmethod(Cons)
4343
S = staticmethod(symbols)
4444
R = staticmethod(Raw)
4545

0 commit comments

Comments
 (0)