From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dani Moncayo Newsgroups: gmane.emacs.help Subject: Re: Using the same custom file in two different OSes Date: Wed, 16 Jan 2013 22:03:05 +0100 Message-ID: References: <419D9CDD3C2740E3B0E0CDE556F7BD12@us.oracle.com> <3F565B0F873C4BCCAA938FB0B136521E@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1358371589 25999 80.91.229.3 (16 Jan 2013 21:26:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Jan 2013 21:26:29 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 16 22:26:47 2013 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 1TvaVS-0002R7-Mf for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Jan 2013 22:26:46 +0100 Original-Received: from localhost ([::1]:44240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvaVC-0001a3-5C for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Jan 2013 16:26:30 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvaV4-0001Ym-SG for help-gnu-emacs@gnu.org; Wed, 16 Jan 2013 16:26:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvaV3-0007mY-Ds for help-gnu-emacs@gnu.org; Wed, 16 Jan 2013 16:26:22 -0500 Original-Received: from mail-oa0-f53.google.com ([209.85.219.53]:64667) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tva8Y-0001p6-43 for help-gnu-emacs@gnu.org; Wed, 16 Jan 2013 16:03:06 -0500 Original-Received: by mail-oa0-f53.google.com with SMTP id j6so1928240oag.12 for ; Wed, 16 Jan 2013 13:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=Jc3TtoeWG1ZrmQDS/k6hZIi6wz98FKb7RrUiNb+blGQ=; b=Alwg8a+Lhw6K4Ig3JO7O2fVQ3vcF7iyVM4fMikvdN4wZsR7KNT7k3DE4wogPzkHKve HNxafFFcd6t3TJK+fmOu2C+3RO/pngOADsVtAnq0d3xe5bqvfc5s/W1rUEMd1uuT9h2d MIs86i7T/ad+2LNIZJyVG840CVIXn5sySf/7Llp9JUtm4/K4E1oIp7zftwMFqZIB9fvU F6szn2ejFgmkk9lWjGJtrQaRscBRfYLoaHVv1yhRptrmOuGB1+pwSKoq8g9j/7WeIv9o f9hrA5kxLA5C/Q3lrwwwFjRO+p6PrpqJep8tqad6JSoy3FOXD4E9fimqs6TmnGwVWkJf f1Mg== X-Received: by 10.182.130.38 with SMTP id ob6mr2019406obb.100.1358370185438; Wed, 16 Jan 2013 13:03:05 -0800 (PST) Original-Received: by 10.60.11.39 with HTTP; Wed, 16 Jan 2013 13:03:05 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.219.53 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:88652 Archived-At: On Mon, Jan 14, 2013 at 11:05 PM, Drew Adams wrote: >> Mmmm I'm afraid I'm unable to keep my custom file free of my >> platform-specific stuff. I've just seen this behavior: >> 1. I remove the `default' and `variable-pitch' lines from my >> custom file. >> 2. I exit Emacs, start it again and verify that my custom file doesn't >> have the lines I removed. Note that this session has loaded my init >> file, which first loads my custom file and then makes the >> platform-specific customization (in that order). >> 3. I do some customization (change the box-width property of the >> `mode-line' face, for example), and save it (C-x C-s). >> 4. I reopen my custom file and see that the two lines I removed in #1 >> have been reinserted. >> >> Changing the order (first do the platform-specific customization and >> the load the custom file) doesn't help. The custom file is >> regenerated (when I save any customization) entirely, including the >> `default' and `variable-pitch' faces. > > Right. > > It's because your init file changes the faces but does not save those changes or > cancel them. Then, when you save changes with C-x C-s, that saves the faces you > changed. > > You want to either (a) do what you do now: redefine the faces after loading your > `custom-file' each time or (b) just tell Customize that the faces have _not_ > been changed (even though they have), before hitting C-x C-s. That is, just > tell Customize to ignore your changes. > > For that, you can just add those faces to option `customize-customized-ignore' > (user preferences to ignore in `customize-customized'). For that you will need > to load library cus-edit+.el. > http://www.emacswiki.org/emacs-en/download/cus-edit%2b.el > > If you do not want to do that, then you can use code like this in your init > file, just after setting the faces the way you want: > > (face-spec-set THE-FACE (get THE-FACE 'face-defface-spec) 'reset) > > That should work. This should also do the trick, as an alternative: > > (put THE-FACE 'saved-face nil) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ That did the trick. So, now I'm able to keep my custom file free of platform-dependent settings, which are moved to the init file, like this: ;; Set the custom-file (setq custom-file "whatever") ;; Load the platform-independent customization (load custom-file) ;; Set the platform-specific customization (if (display-graphic-p) (if (eq system-type 'windows-nt) (custom-set-faces ) (custom-set-faces ))) ;; Reset de state of the faces customized above, so that they ;; don't get written to the custom-file when some customization ;; is saved. (put 'default 'saved-face nil) (put 'variable-pitch 'saved-face nil) Thanks Drew! -- Dani Moncayo