From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#19217: 25.0.50; `C-M-x' (`eval-defun') on a `defface' that is not top-level Date: Sat, 6 Dec 2014 19:10:57 +0000 Message-ID: <20141206191057.GB3233@acm.acm> References: <20141129191023.34112.qmail@mail.muc.de> <3e0d66d6-99b6-4e0d-a1eb-b7f2e3731ea7@default> <20141130195811.GB12974@acm.acm> <6718ace6-b672-40fc-a5bc-ea29eb155239@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1417893151 26460 80.91.229.3 (6 Dec 2014 19:12:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 6 Dec 2014 19:12:31 +0000 (UTC) Cc: 19217@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 06 20:12:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XxKmB-0000iR-MR for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Dec 2014 20:12:19 +0100 Original-Received: from localhost ([::1]:55315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxKmB-0001gn-4K for geb-bug-gnu-emacs@m.gmane.org; Sat, 06 Dec 2014 14:12:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxKm1-0001gf-Qx for bug-gnu-emacs@gnu.org; Sat, 06 Dec 2014 14:12:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XxKlu-0002sJ-AY for bug-gnu-emacs@gnu.org; Sat, 06 Dec 2014 14:12:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XxKlu-0002sC-7t for bug-gnu-emacs@gnu.org; Sat, 06 Dec 2014 14:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XxKlt-0001AC-Pf for bug-gnu-emacs@gnu.org; Sat, 06 Dec 2014 14:12:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 19:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19217 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19217-submit@debbugs.gnu.org id=B19217.14178930834426 (code B ref 19217); Sat, 06 Dec 2014 19:12:01 +0000 Original-Received: (at 19217) by debbugs.gnu.org; 6 Dec 2014 19:11:23 +0000 Original-Received: from localhost ([127.0.0.1]:55615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxKlG-00019I-Lr for submit@debbugs.gnu.org; Sat, 06 Dec 2014 14:11:23 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:21721 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxKlE-00019A-EE for 19217@debbugs.gnu.org; Sat, 06 Dec 2014 14:11:21 -0500 Original-Received: (qmail 26119 invoked by uid 3782); 6 Dec 2014 19:11:19 -0000 Original-Received: from acm.muc.de (pD951AF84.dip0.t-ipconnect.de [217.81.175.132]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 06 Dec 2014 20:11:18 +0100 Original-Received: (qmail 3744 invoked by uid 1000); 6 Dec 2014 19:10:57 -0000 Content-Disposition: inline In-Reply-To: <6718ace6-b672-40fc-a5bc-ea29eb155239@default> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96919 Archived-At: Hi, Drew. On Sun, Nov 30, 2014 at 12:51:59PM -0800, Drew Adams wrote: > > > > You can also move point to just after the closing ) and do C-x > > > > C-e (`eval-last-sexp'). > > > I too thought that was the case, but it does not seem to be. I > > > just tried it, starting with emacs -Q in several Emacs versions > > > (22, 24.4, 25 dev build). > > I've never had a problem with C-x C-e that I can remember, and that > > includes several times with point after a random ) inside a defun. > > What happens when you do C-x C-e with point just after the `defface' > > form? > As I said, nothing happens. OK. I've hacked the following patch together, which wasn't actually all that difficult. I've tested it out on a defvar, and it works there. It gives C-x C-e the same special handling that C-M-x has for defvar's, defcustom's, defface's, etc. It's incomplete (no documentation has been changed), but it might do what you need. Please try it out. diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index 2be81a5..830ae2b 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -811,10 +811,11 @@ and level of lists, and include additional formats for integers (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) ;; Setup the lexical environment if lexical-binding is enabled. (elisp--eval-last-sexp-print-value - (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding) + (eval (eval-sexp-add-defvars + (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))) + lexical-binding) eval-last-sexp-arg-internal))) - (defun elisp--eval-last-sexp-print-value (value &optional eval-last-sexp-arg-internal) (let ((unabbreviated (let ((print-length nil) (print-level nil)) (prin1-to-string value))) -- Alan Mackenzie (Nuremberg, Germany).