From cfe14bf11096ded649b57e2532302321044d51c6 Mon Sep 17 00:00:00 2001 From: Tomas Volf <~@wolfsden.cz> Date: Sat, 13 Jan 2024 14:18:04 +0100 Subject: edit: Add geiser-insert-actual-lambda. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some projects use λ, some use lambda, and it is convenient to be able to use the same mapping engraved into muscle memory for both. Therefore this commit adds a new variable that allow geiser-insert-lambda to do both, depending on the value. * elisp/geiser-edit.el (geiser-insert-actual-lambda): New variable. (geiser-insert-lambda): Respect it. --- elisp/geiser-edit.el | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'elisp/geiser-edit.el') diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el index 0f2b080..df4231c 100644 --- a/elisp/geiser-edit.el +++ b/elisp/geiser-edit.el @@ -298,13 +298,22 @@ With prefix, asks for the symbol to locate." (when marker (xref-push-marker-stack marker)) t))) +(geiser-custom--defcustom geiser-insert-actual-lambda t + "Whether geiser-insert-lambda should insert \"λ\" or \"lambda\"." + :type 'boolean) + (defun geiser-insert-lambda (&optional full) - "Insert λ at point. With prefix, inserts (λ ())." + "Insert λ or lambda at point. With prefix, inserts (λ ()) or (lambda ()). + +See also `geiser-insert-actual-lambda'." (interactive "P") - (if (not full) - (insert (make-char 'greek-iso8859-7 107)) - (insert "(" (make-char 'greek-iso8859-7 107) " ())") - (backward-char 2))) + (let ((sym (if geiser-insert-actual-lambda + (make-char 'greek-iso8859-7 107) + "lambda"))) + (if (not full) + (insert sym) + (insert "(" sym " ())") + (backward-char 2)))) (defun geiser-squarify (n) "Toggle between () and [] for current form. -- cgit v1.2.3