From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: Using the same custom file in two different OSes Date: Mon, 14 Jan 2013 14:05:56 -0800 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="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1358201172 2755 80.91.229.3 (14 Jan 2013 22:06:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Jan 2013 22:06:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "'Dani Moncayo'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 14 23:06:29 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 1TusAk-0002jk-5t for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Jan 2013 23:06:26 +0100 Original-Received: from localhost ([::1]:35281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TusAT-0005MK-SR for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Jan 2013 17:06:09 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TusAN-0005Ju-9O for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:06:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TusAL-0005fL-O6 for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:06:03 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:25462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TusAL-0005fB-Hj for help-gnu-emacs@gnu.org; Mon, 14 Jan 2013 17:06:01 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id r0EM5xBv017011 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Jan 2013 22:06:00 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0EM5wqn002365 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Jan 2013 22:05:59 GMT Original-Received: from abhmt108.oracle.com (abhmt108.oracle.com [141.146.116.60]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r0EM5wR7010214; Mon, 14 Jan 2013 16:05:58 -0600 Original-Received: from dradamslap1 (/130.35.178.8) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Jan 2013 14:05:58 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac3yj1L6TLMdWfhyQuOW6QFqBd8kFAADAlKA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:88621 Archived-At: > 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) (put THE-FACE 'saved-face-comment nil) (put THE-FACE 'face-comment nil) (put THE-FACE 'customized-face-comment nil) Here's another tip: Get in the habit of using the `State' menu for the particular option or face that you've changed, to save its changes, instead of using C-x C-s, which saves all changes. If you are worried about not catching some unsaved changes, you can use `M-x customize-unsaved' before you quit Emacs. You can even put that on `kill-emacs-query-functions': (add-hook 'kill-emacs-query-functions (lambda () (ignore-errors (customize-unsaved)))) Then, when you exit Emacs, if you have any unsaved changes, Customize will open to them, so you can decide whether you want to save them. Any faces or options listed in option `customize-customized-ignore' (cus-edit+.el) are ignored for this - any changes to them are silently ignored. See also: http://emacswiki.org/CustomizingAndSaving HTH.