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: Sun, 30 Nov 2014 23:20:03 +0000 Message-ID: <20141130232003.GC12974@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 1417389696 17549 80.91.229.3 (30 Nov 2014 23:21:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 30 Nov 2014 23:21:36 +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 Mon Dec 01 00:21:22 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 1XvDnt-000732-Kg for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Dec 2014 00:21:21 +0100 Original-Received: from localhost ([::1]:52095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvDns-0006Ot-Ot for geb-bug-gnu-emacs@m.gmane.org; Sun, 30 Nov 2014 18:21:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvDni-0006OV-9e for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 18:21:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XvDna-0002OV-P7 for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 18:21:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XvDna-0002OR-Kr for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 18:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XvDna-0001i5-Ce for bug-gnu-emacs@gnu.org; Sun, 30 Nov 2014 18:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Nov 2014 23:21:02 +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.14173896326474 (code B ref 19217); Sun, 30 Nov 2014 23:21:02 +0000 Original-Received: (at 19217) by debbugs.gnu.org; 30 Nov 2014 23:20:32 +0000 Original-Received: from localhost ([127.0.0.1]:50203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XvDn6-0001gJ-43 for submit@debbugs.gnu.org; Sun, 30 Nov 2014 18:20:32 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:12556 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XvDn2-0001fy-P7 for 19217@debbugs.gnu.org; Sun, 30 Nov 2014 18:20:30 -0500 Original-Received: (qmail 47453 invoked by uid 3782); 30 Nov 2014 23:20:27 -0000 Original-Received: from acm.muc.de (pD951B3FA.dip0.t-ipconnect.de [217.81.179.250]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 01 Dec 2014 00:20:26 +0100 Original-Received: (qmail 14422 invoked by uid 1000); 30 Nov 2014 23:20:03 -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:96769 Archived-At: Hello, 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. Ah. Yes, `defface' is like `defvar', in that if you defface a face twice, the second try does not overwrite the first. I had to look at the fine source to see this, the documentation being somewhat suboptimal. There's presumably some way of deleting a face, but I'm dashed if I can find it in the info pages. Something like `makunbound', but for faces. I suspect that this will also be only to be found by perusal of the fine source, possibly the C source. I've had a look at xfaces.c, and it would seem there is no way to delete a face. Faces are simply stored in an array of Lisp_object's, starting at element 0, and counting up from there each time you add a new face. It was also said, somewhere, that C-M-x takes special action for a variable, customisable something-or-other, or face. So how does it do this? Well, a bit of digging around, and the answer's in `eval-defun-1' in lisp-mode.el. So I now see what you're complaining about, and I think would too, if I were doing anything at all with faces. Having defined a face with `defface', the _ONLY_ way to tweak it at the source code level, is either to restart Emacs or use C-M-x. And for the latter, you need the opening paren at top level. If I were you, I'd hack something together for my own use based on what's in lisp-mode.el. Phew! > emacs -Q > Put this in *scratch*, and evaluate it: > (when t > (defface foo '((((background dark)) (:foreground "#58DFFA4FFFFF")) > (t (:foreground "Firebrick"))) > "A face." :group 'help) > ) > `M-x customize-face' shows that it is defined as it should be. > > What exactly are you suggesting? > See above. (1) `C-x C-e' should work as you say it works. You could probably fix this with a bit of advice (whether old-style or new-style ;-). > (2) `C-M-x' with point inside a defface sexp should also work. > If the latter cannot easily be made to work with point anywhere > inside the sexp, then at least make it work with point on `defface' > or near it (e.g. at the same list level). > > That `defface' be made a special case, > If that's necessary, yes. It should be made to work, whether that > means special-casing it or not. Given how much of a special case faces already are, in terms of awkwardness and inflexibility, maybe that's not too much to ask for. But beware of what you're asking for - you might get it. Then when you do C-M-x, expecting to evaluate a defun, you accidentally get a face defined instead, which you then can't get rid of. [ .... ] > > I'm not sure how you're going to construe "closer", given that a > > list typically extends over many characters and when point is > > within it, that must count as distance zero. Or something. > It's trivial to determine whether point is at the same list level > as the `defface' symbol. That would indeed be one way of doing it. -- Alan Mackenzie (Nuremberg, Germany).