-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this commit makes it possible to use EROS with any other evaluation function as long as it returns a string. Thus other languages may set up support for EROS.
- Loading branch information
1 parent
a9a92bd
commit 72cf2f8
Showing
1 changed file
with
15 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
;;; eros.el --- Evaluation Result OverlayS for Emacs Lisp -*- lexical-binding: t; -*- | ||
|
||
;; Copyright (C) 2016-2018 Tianxiang Xiong | ||
;; Copyright (C) 2016-2021 Tianxiang Xiong | ||
|
||
;; Author: Tianxiang Xiong <[email protected]> | ||
;; Keywords: convenience, lisp | ||
;; Package-Requires: ((emacs "24.4")) | ||
;; URL: https://github.com/xiongtx/eros | ||
;; Version: 0.1.0 | ||
;; Version: 0.2.0 | ||
|
||
;; 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 | ||
|
@@ -232,16 +232,17 @@ This function also removes itself from `pre-command-hook'." | |
(remove-hook 'pre-command-hook #'eros--remove-result-overlay 'local) | ||
(remove-overlays nil nil 'category 'result)) | ||
|
||
(defun eros--eval-overlay (value point) | ||
"Make overlay for VALUE at POINT." | ||
(eros--make-result-overlay (format "%S" value) | ||
:where point | ||
:duration eros-eval-result-duration) | ||
value) | ||
|
||
|
||
;; API | ||
|
||
;;;###autoload | ||
(defun eros-eval-overlay (string point) | ||
"Make overlay for STRING value at POINT." | ||
(eros--make-result-overlay string | ||
:where point | ||
:duration eros-eval-result-duration)) | ||
|
||
;;;###autoload | ||
(defun eros-eval-last-sexp (eval-last-sexp-arg-internal) | ||
"Wrapper for `eval-last-sexp' that overlays results." | ||
|
@@ -250,19 +251,18 @@ This function also removes itself from `pre-command-hook'." | |
(setq eros--last-result result) | ||
(when (get-buffer eros--inspect-buffer-name) | ||
(eros-inspect-last-result)) | ||
(eros--eval-overlay | ||
result | ||
(eros-eval-overlay | ||
(format "%S" result) | ||
(point)))) | ||
|
||
;;;###autoload | ||
(defun eros-eval-defun (edebug-it) | ||
"Wrapper for `eval-defun' that overlays results." | ||
(interactive "P") | ||
(eros--eval-overlay | ||
(eval-defun edebug-it) | ||
(save-excursion | ||
(end-of-defun) | ||
(point)))) | ||
(let ((value (eval-defun edebug-it)) | ||
(point (save-excursion (end-of-defun) (point)))) | ||
(eros-eval-overlay (format "%S" value) point) | ||
value)) | ||
|
||
(defun eros-inspect-last-result () | ||
"Inspect the result of last `eros-eval-'." | ||
|