all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Dani Moncayo'" <dmoncayo@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: RE: Using the same custom file in two different OSes
Date: Mon, 14 Jan 2013 14:05:56 -0800	[thread overview]
Message-ID: <A67A23F287DA44CC989BE1173F6160C7@us.oracle.com> (raw)
In-Reply-To: <CAH8Pv0iy2X9D=CmauBwGWYar=bbjyyRF+hY12nrta18-=AC4ow@mail.gmail.com>

> 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.




  parent reply	other threads:[~2013-01-14 22:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-13 22:00 Using the same custom file in two different OSes Dani Moncayo
2013-01-13 22:18 ` Drew Adams
2013-01-14 18:46   ` Dani Moncayo
2013-01-14 19:13     ` Drew Adams
2013-01-14 19:42       ` Dani Moncayo
2013-01-14 21:55         ` Peter Dyballa
2013-01-14 23:00           ` Dani Moncayo
2013-01-15  8:25             ` Didier Verna
2013-01-15  8:42               ` Dani Moncayo
2013-01-14 22:05         ` Drew Adams [this message]
2013-01-16 21:03           ` Dani Moncayo
     [not found]           ` <mailman.17633.1358371586.855.help-gnu-emacs@gnu.org>
2013-01-17  8:43             ` Sebastien Vauban
2013-01-17 14:19               ` Drew Adams
2013-01-17 14:38                 ` Peter Dyballa
2013-01-17 15:22                   ` Dani Moncayo
2013-01-17 16:38                     ` Eli Zaretskii
2013-01-17 16:01                   ` Drew Adams
2013-01-17 16:33                   ` Eli Zaretskii
2013-01-17 16:32                 ` Eli Zaretskii
2013-01-17 16:57                   ` Drew Adams
2013-01-17 17:48                     ` Eli Zaretskii
2013-01-17 18:15                       ` Drew Adams
2013-01-17 18:44                         ` Eli Zaretskii
2013-01-15 13:27 ` Stefan Monnier
2013-01-15 20:27   ` Dani Moncayo
     [not found]   ` <mailman.17532.1358281671.855.help-gnu-emacs@gnu.org>
2013-01-16  8:58     ` Sebastien Vauban
2013-01-16 20:35       ` Dani Moncayo
2013-01-16 12:59     ` Jason Rumney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A67A23F287DA44CC989BE1173F6160C7@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=dmoncayo@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.