From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Kost Newsgroups: gmane.emacs.help Subject: Re: "clean" starting point for custom-theme-set-faces Date: Thu, 18 Sep 2014 09:23:48 +0400 Message-ID: <87wq91ec2j.fsf@gmail.com> References: <287e4dab-9ee0-4840-bb8f-0fc1b18a5501@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1411017862 3211 80.91.229.3 (18 Sep 2014 05:24:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 18 Sep 2014 05:24:22 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sam Halliday Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 18 07:24:14 2014 Return-path: Envelope-to: geh-help-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 1XUUCU-0000l1-2a for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Sep 2014 07:24:14 +0200 Original-Received: from localhost ([::1]:48560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUUCT-0000wn-LQ for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Sep 2014 01:24:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUUCE-0000wU-37 for help-gnu-emacs@gnu.org; Thu, 18 Sep 2014 01:24:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUUC8-0000Ug-LF for help-gnu-emacs@gnu.org; Thu, 18 Sep 2014 01:23:58 -0400 Original-Received: from mail-lb0-x235.google.com ([2a00:1450:4010:c04::235]:34170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUUC8-0000U8-EH for help-gnu-emacs@gnu.org; Thu, 18 Sep 2014 01:23:52 -0400 Original-Received: by mail-lb0-f181.google.com with SMTP id z11so410529lbi.26 for ; Wed, 17 Sep 2014 22:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=oh12xuzHF8ZP6SeNAShqY9lCGaU0C52uuHTO8PANjpA=; b=fYh8NV3ciaJ/NzxE3cDYxkI3il5jUMB4YPPXYinBFf2ZFpEYYS3Zhlo7pJH0WTzTDo Zz99kqsk7o9aKIXqkc8/BsWEw7Qz3nYjl4EEEEmFovBxtDNwPPookZ17zTddV5OWRpF0 fCHAs/xLz6B7qRubg+kECqJb4HJDm3l27GU2jgk29M++ZrjlWE0WINjtG0lI46CbHe3t QB2mY01EkWpD7HCZVRTCMmB+k6CKCE/d5bO4K8UAUfWToIzHd2oNqmjDssRphJUKBorV kb7j9aUA5gHM9k9nl8SYnI/zre3A1Gjcc5AFp+ZpLYfogq931vefyNnpbzMDYD+9QdOZ 1n9g== X-Received: by 10.152.197.35 with SMTP id ir3mr2213075lac.82.1411017826417; Wed, 17 Sep 2014 22:23:46 -0700 (PDT) Original-Received: from leviafan (128-70-192-205.broadband.corbina.ru. [128.70.192.205]) by mx.google.com with ESMTPSA id as6sm6773118lbc.17.2014.09.17.22.23.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Sep 2014 22:23:45 -0700 (PDT) In-Reply-To: (Sam Halliday's message of "Wed, 17 Sep 2014 05:31:06 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99995 Archived-At: --=-=-= Content-Type: text/plain Sam Halliday (2014-09-17 16:31 +0400) wrote: > On Wednesday, 17 September 2014 12:41:44 UTC+1, Alex Kost wrote: >> Sam Halliday (2014-09-17 14:00 +0400) wrote: >> > I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here: >> > https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el >> > >> > But there are a couple of things that confuse me about emacs faces, >> > even after reading the documentation and I'd appreciate some >> > guidance: >> > >> > 1. When a theme is loaded, what are the default "inherit" values for >> > all the faces that I'm defining? Is there an implicit "inherit" >> > based on what that face was before the theme was loaded? >> >> IIUC you are faced with the old behavior of applying faces that will be >> >> "fixed" in Emacs 24.4. I wrote something about that here: >> >> . > > Excellent, thanks! That answers my question. Although I'm a little confused how to use your workaround. I just put the following into my ".emacs": --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (defun face-spec-recalc-new (face frame) "Reset the face attributes of FACE on FRAME according to its specs. This applies the defface/custom spec first, then the custom theme specs, then the override spec." (while (get face 'face-alias) (setq face (get face 'face-alias))) (face-spec-reset-face face frame) ;; If FACE is customized or themed, set the custom spec from ;; `theme-face' records, which completely replace the defface spec ;; rather than inheriting from it. (let ((theme-faces (get face 'theme-face))) (if theme-faces (dolist (spec (reverse theme-faces)) (face-spec-set-2 face frame (cadr spec))) (face-spec-set-2 face frame (face-default-spec face)))) (face-spec-set-2 face frame (get face 'face-override-spec))) (defadvice face-spec-recalc (around new-recalc (face frame)) "Use `face-spec-recalc-new' (`face-spec-recalc' from Emacs 24.4)." (face-spec-recalc-new face frame)) (when (version< emacs-version "24.3.50") (ad-activate 'face-spec-recalc)) --=-=-= Content-Type: text/plain > Incidentally, I was originally thinking that I could rewrite my theme to > use your defaults but it seems to hardcode quite a lot of stuff. > > It would be really amazing if a theme template existed that required one > to only provide 10 colours and then it assigned them in a sensible way > across all the various popular major modes. There is some kind of template: "M-x customize-create-theme". --=-=-=--