From 9742186a23e3c758188c673689929fdeac51211b Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Tue, 25 Jul 2017 13:31:54 +0200 Subject: [PATCH] better eval support --- autoscratch-mode.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoscratch-mode.el b/autoscratch-mode.el index aac49a1..3a12fd0 100644 --- a/autoscratch-mode.el +++ b/autoscratch-mode.el @@ -19,7 +19,7 @@ ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 ;; USA -;; Version: 0.01 +;; Version: 0.02 ;; Author: T.v.Dein ;; Keywords: files ;; URL: https://github.com/tlinden/autoscratch @@ -193,8 +193,15 @@ to $mode-scratch." (defun autoscratch--eval-trigger (form) "If FORM is a function execute interactively, otherwise evaluate it. -Executes `autoscratch-trigger-hook' after evaluation." - (eval form) +Executes `autoscratch-trigger-hook' after evaluation. + +Supported values for FORM include: + 'emacs-lisp-mode + '(lambda() (emacs-lisp-mode) + '(emacs-lisp-mmode)" + (if (autoscratch--function-p form) + (funcall form) + (eval form)) (run-hooks 'autoscratch-post-trigger-hook) (message (format "autoscratch switched to %s" major-mode)))