diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-10-07 01:11:50 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-10-07 01:11:50 -0400 |
commit | a58332802b26fda1bc49cf409737e6fde71461b6 (patch) | |
tree | 70004e73b9ffa0b4038495bbec659a170b721f97 /lisp/emacs-lisp | |
parent | 2e7ba2c231f813115bd1e4a1adbf520710c0e0b9 (diff) | |
download | emacs-a58332802b26fda1bc49cf409737e6fde71461b6.tar.gz emacs-a58332802b26fda1bc49cf409737e6fde71461b6.tar.bz2 emacs-a58332802b26fda1bc49cf409737e6fde71461b6.zip |
* lisp/emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using lexical-binding.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f7105b7d3b4..f1705cbc9ec 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1,4 +1,4 @@ -;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands -*- coding: utf-8 -*- +;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands -*- lexical-binding:t -*- ;; Copyright (C) 1985-1986, 1999-2013 Free Software Foundation, Inc. @@ -917,27 +917,25 @@ Return the result of evaluation." (save-excursion ;; Arrange for eval-region to "read" the (possibly) altered form. ;; eval-region handles recording which file defines a function or - ;; variable. Re-written using `apply' to avoid capturing - ;; variables like `end'. - (apply - #'eval-region - (let ((standard-output t) - beg end form) - ;; Read the form from the buffer, and record where it ends. - (save-excursion - (end-of-defun) - (beginning-of-defun) - (setq beg (point)) - (setq form (read (current-buffer))) - (setq end (point))) - ;; Alter the form if necessary. - (setq form (eval-sexp-add-defvars (eval-defun-1 (macroexpand form)))) - (list beg end standard-output - `(lambda (ignore) - ;; Skipping to the end of the specified region - ;; will make eval-region return. - (goto-char ,end) - ',form)))))) + ;; variable. + (let ((standard-output t) + beg end form) + ;; Read the form from the buffer, and record where it ends. + (save-excursion + (end-of-defun) + (beginning-of-defun) + (setq beg (point)) + (setq form (read (current-buffer))) + (setq end (point))) + ;; Alter the form if necessary. + (let ((form (eval-sexp-add-defvars + (eval-defun-1 (macroexpand form))))) + (eval-region beg end standard-output + (lambda (_ignore) + ;; Skipping to the end of the specified region + ;; will make eval-region return. + (goto-char end) + form)))))) ;; The result of evaluation has been put onto VALUES. So return it. (car values)) |