aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-10-07 01:11:50 -0400
committerStefan Monnier2013-10-07 01:11:50 -0400
commita58332802b26fda1bc49cf409737e6fde71461b6 (patch)
tree70004e73b9ffa0b4038495bbec659a170b721f97
parent2e7ba2c231f813115bd1e4a1adbf520710c0e0b9 (diff)
downloademacs-a58332802b26fda1bc49cf409737e6fde71461b6.tar.gz
emacs-a58332802b26fda1bc49cf409737e6fde71461b6.zip
* lisp/emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using lexical-binding.
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/emacs-lisp/lisp-mode.el42
2 files changed, 22 insertions, 22 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 157152b20a3..6e6c0aaa671 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
12013-10-07 Stefan Monnier <monnier@iro.umontreal.ca> 12013-10-07 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/lisp-mode.el (eval-defun-2): Simplify, using lexical-binding.
4
3 * emacs-lisp/tq.el (tq-create): Use a closure instead of `(lambda...). 5 * emacs-lisp/tq.el (tq-create): Use a closure instead of `(lambda...).
4 6
5 * progmodes/ruby-mode.el: Fix recently added tests. 7 * progmodes/ruby-mode.el: Fix recently added tests.
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 @@
1;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands -*- coding: utf-8 -*- 1;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands -*- lexical-binding:t -*-
2 2
3;; Copyright (C) 1985-1986, 1999-2013 Free Software Foundation, Inc. 3;; Copyright (C) 1985-1986, 1999-2013 Free Software Foundation, Inc.
4 4
@@ -917,27 +917,25 @@ Return the result of evaluation."
917 (save-excursion 917 (save-excursion
918 ;; Arrange for eval-region to "read" the (possibly) altered form. 918 ;; Arrange for eval-region to "read" the (possibly) altered form.
919 ;; eval-region handles recording which file defines a function or 919 ;; eval-region handles recording which file defines a function or
920 ;; variable. Re-written using `apply' to avoid capturing 920 ;; variable.
921 ;; variables like `end'. 921 (let ((standard-output t)
922 (apply 922 beg end form)
923 #'eval-region 923 ;; Read the form from the buffer, and record where it ends.
924 (let ((standard-output t) 924 (save-excursion
925 beg end form) 925 (end-of-defun)
926 ;; Read the form from the buffer, and record where it ends. 926 (beginning-of-defun)
927 (save-excursion 927 (setq beg (point))
928 (end-of-defun) 928 (setq form (read (current-buffer)))
929 (beginning-of-defun) 929 (setq end (point)))
930 (setq beg (point)) 930 ;; Alter the form if necessary.
931 (setq form (read (current-buffer))) 931 (let ((form (eval-sexp-add-defvars
932 (setq end (point))) 932 (eval-defun-1 (macroexpand form)))))
933 ;; Alter the form if necessary. 933 (eval-region beg end standard-output
934 (setq form (eval-sexp-add-defvars (eval-defun-1 (macroexpand form)))) 934 (lambda (_ignore)
935 (list beg end standard-output 935 ;; Skipping to the end of the specified region
936 `(lambda (ignore) 936 ;; will make eval-region return.
937 ;; Skipping to the end of the specified region 937 (goto-char end)
938 ;; will make eval-region return. 938 form))))))
939 (goto-char ,end)
940 ',form))))))
941 ;; The result of evaluation has been put onto VALUES. So return it. 939 ;; The result of evaluation has been put onto VALUES. So return it.
942 (car values)) 940 (car values))
943 941