-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(repl): Add the Elisp REPL command (#210)
* feat(repl): Add the Elisp REPL command * fix: Update syntax and rely on gnu * fix more syntax * ensure skip all input
- Loading branch information
Showing
18 changed files
with
118 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (C) 2024 the Eask authors. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3, or (at your option) | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
"use strict"; | ||
|
||
exports.command = ['repl', 'ielm']; | ||
exports.desc = UTIL.hide_cmd('Start the Elisp REPL'); | ||
|
||
exports.handler = async (argv) => { | ||
await UTIL.e_call(argv, 'core/repl'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
;;; core/repl.el --- Start the Elisp REPL -*- lexical-binding: t; -*- | ||
|
||
;;; Commentary: | ||
;; | ||
;; Command use to start the Elisp REPL, | ||
;; | ||
;; $ eask repl | ||
;; | ||
|
||
;;; Code: | ||
|
||
(let ((dir (file-name-directory (nth 1 (member "-scriptload" command-line-args))))) | ||
(load (expand-file-name "_prepare.el" | ||
(locate-dominating-file dir "_prepare.el")) | ||
nil t)) | ||
|
||
(defvar eask--repl-old-pos nil | ||
"Record the last position to output on the screen for the `ielm' buffer.") | ||
|
||
(defun eask--repl-output () | ||
"Print the REPL result to screen." | ||
(unless eask--repl-old-pos (setq eask--repl-old-pos (point-min))) | ||
(with-current-buffer "*ielm*" | ||
(goto-char eask--repl-old-pos) | ||
(while (not (eobp)) | ||
(let ((line (thing-at-point 'line t))) | ||
(unless (string-prefix-p "ELISP> " line) | ||
(eask-print line))) | ||
(forward-line 1) | ||
(end-of-line)) | ||
;; Record last output position | ||
(setq eask--repl-old-pos (point)))) | ||
|
||
(eask-start | ||
(require 'ielm) | ||
(ielm) | ||
(eask--repl-output) | ||
(let ((input)) | ||
(while (setq input (read-from-minibuffer (ansi-blue "ELISP> "))) | ||
(with-current-buffer "*ielm*" | ||
(insert input) | ||
(setq eask--repl-old-pos (point)) ; skip all input | ||
(eask--silent (ielm-send-input)) | ||
(eask--repl-output))))) | ||
|
||
;;; core/repl.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,6 @@ | |
|
||
(package-file "color.el") | ||
|
||
(source "gnu") | ||
(source 'gnu) | ||
|
||
(depends-on "emacs" "26.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
(exec-paths "./bin/") | ||
|
||
(source 'gnu) | ||
(source 'melpa) | ||
|
||
(depends-on "emacs" "26.1") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
|
||
(package-file "options.el") | ||
|
||
(source "gnu") | ||
(source 'gnu) | ||
|
||
(depends-on "emacs" "26.1") |