unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Correct way of overriding custom-set-faces after the color-theme is loaded
@ 2012-02-03  7:48 Vineet Naik
  2012-02-03  8:58 ` Philipp Haselwarter
  0 siblings, 1 reply; 6+ messages in thread
From: Vineet Naik @ 2012-02-03  7:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I use the Solarized Dark theme on emacs 23. This theme defines
background color as orange for flymake error line. I wanted to change
this to DarkRed. So in my .emacs file, I added the following lines
after requiring the color theme

;; flymake error and warning faces
(custom-set-faces
 '(flymake-errline ((t (:background "DarkRed"))))
 '(flymake-warnline ((((class color)) (:background "DarkBlue")))))

This was working as expected. Today I set some customization options
using M-x customize-group and saved them due to which, emacs moved the
above lines to the top of the .emacs file resulting in the default
solalized faces to be applied to flymake error.

It also added the following comment under custom-set-faces which is
self explanatory

 ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.

I need to know what would be the correct way to manage my
customizations for the solarized theme without editing the definitions
in the theme itself and make sure they are not overwritten by
customize-*

Thanks
--
Vineet Naik



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Correct way of overriding custom-set-faces after the color-theme is loaded
  2012-02-03  7:48 Correct way of overriding custom-set-faces after the color-theme is loaded Vineet Naik
@ 2012-02-03  8:58 ` Philipp Haselwarter
  2012-02-03 10:11   ` Vineet Naik
  0 siblings, 1 reply; 6+ messages in thread
From: Philipp Haselwarter @ 2012-02-03  8:58 UTC (permalink / raw)
  To: help-gnu-emacs

two solutions come to my mind:

1) set the face attributes outside of customize, that way they won't be
   affected by customize.
#+begin_src elisp
 (set-face-background 'flymake-errline "DarkRed")
#+end_src

2) put custom stuff into a separate file and load that at some point of
   your .emacs
#+begin_src elisp
 (load
  (setq custom-file
        (expand-file-name "custom.el" user-emacs-directory))
  'noerror)
#+end_src

-- 
Philipp Haselwarter




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Correct way of overriding custom-set-faces after the color-theme is loaded
  2012-02-03  8:58 ` Philipp Haselwarter
@ 2012-02-03 10:11   ` Vineet Naik
  2012-02-03 11:04     ` Vineet Naik
  2012-02-03 11:13     ` Philipp Haselwarter
  0 siblings, 2 replies; 6+ messages in thread
From: Vineet Naik @ 2012-02-03 10:11 UTC (permalink / raw)
  To: help-gnu-emacs

@Philipp - Oops, I replied back to you directly instead of the list.
Sorry for that.

I couldn't find your reply on the list besides the first one. I
checked here - http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/threads.html

is there a different emacs.help list ?

Thanks

On Fri, Feb 3, 2012 at 2:28 PM, Philipp Haselwarter
<philipp.haselwarter@gmx.de> wrote:
> two solutions come to my mind:
>
> 1) set the face attributes outside of customize, that way they won't be
>   affected by customize.
> #+begin_src elisp
>  (set-face-background 'flymake-errline "DarkRed")
> #+end_src
>
> 2) put custom stuff into a separate file and load that at some point of
>   your .emacs
> #+begin_src elisp
>  (load
>  (setq custom-file
>        (expand-file-name "custom.el" user-emacs-directory))
>  'noerror)
> #+end_src
>
> --
> Philipp Haselwarter
>
>



-- 
Vineet Naik



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Correct way of overriding custom-set-faces after the color-theme is loaded
  2012-02-03 10:11   ` Vineet Naik
@ 2012-02-03 11:04     ` Vineet Naik
  2012-02-03 11:13     ` Philipp Haselwarter
  1 sibling, 0 replies; 6+ messages in thread
From: Vineet Naik @ 2012-02-03 11:04 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Feb 3, 2012 at 3:41 PM, Vineet Naik <naikvin@gmail.com> wrote:
> @Philipp - Oops, I replied back to you directly instead of the list.
> Sorry for that.
>
> I couldn't find your reply on the list besides the first one. I
> checked here - http://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/threads.html
>
> is there a different emacs.help list ?
>
> Thanks
>
> On Fri, Feb 3, 2012 at 2:28 PM, Philipp Haselwarter
> <philipp.haselwarter@gmx.de> wrote:
>> two solutions come to my mind:
>>
>> 1) set the face attributes outside of customize, that way they won't be
>>   affected by customize.
>> #+begin_src elisp
>>  (set-face-background 'flymake-errline "DarkRed")
>> #+end_src
>>
>> 2) put custom stuff into a separate file and load that at some point of
>>   your .emacs
>> #+begin_src elisp
>>  (load
>>  (setq custom-file
>>        (expand-file-name "custom.el" user-emacs-directory))
>>  'noerror)
>> #+end_src
>>
>> --
>> Philipp Haselwarter
>>
>>
> --
> Vineet Naik

How do I get my changes to take effect right at the time emacs loads ?

Here is the reply I had sent to Philipp by mistake instead of replying
to the mailing list.

I tried to use the second method, but the overriden changes don't take
effect automatically on starting emacs.
But if I open .emacs file and evaluate the expression, then the
changes are seen.

Here is the code I added

#+begin_src elisp
;; in .emacs file
(setq user-emacs-dir (expand-file-name "emacs/site/common"))
(load
 (setq custom-file
      (expand-file-name "theme-custom.el" user-emacs-dir))
 'noerror)
#+end_src

#+begin_src elisp
;; in theme-custom.el
(set-face-background 'flymake-errline "DarkRed")
(set-face-background 'flymake-warnline "DarkBlue")
#+end_src

Am I missing anything ?
Sorry if this is a dumb question to ask but my I emacs lisp knowledge
is very little.

Thanks for helping out.
-- 
Vineet Naik



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Correct way of overriding custom-set-faces after the color-theme is loaded
  2012-02-03 10:11   ` Vineet Naik
  2012-02-03 11:04     ` Vineet Naik
@ 2012-02-03 11:13     ` Philipp Haselwarter
  2012-02-03 15:36       ` Vineet Naik
  1 sibling, 1 reply; 6+ messages in thread
From: Philipp Haselwarter @ 2012-02-03 11:13 UTC (permalink / raw)
  To: help-gnu-emacs

my bad, got confused with my mail accounts.


On Fri, Feb 03 2012 09:58 (@1328259509), Philipp Haselwarter wrote:

> two solutions come to my mind:
>
> 1) set the face attributes outside of customize, that way they won't be
>    affected by customize.
> #+begin_src elisp
>  (set-face-background 'flymake-errline "DarkRed")
> #+end_src
>
> 2) put custom stuff into a separate file and load that at some point of
>    your .emacs
> #+begin_src elisp
>  (load
>   (setq custom-file
>         (expand-file-name "custom.el" user-emacs-directory))
>   'noerror)
> #+end_src

Clarification: Do one /or/ the other :) If you choose option two, make
sure to create the file you set as `custom-file' (C-h v custom-file RET)
and move all the custom-* stuff from your .emacs into that file. Also,
use an absolute path-name. If things don't work as expected, remove the
'noerror and start emacs as "emacs --debug-init".

-- 
Philipp Haselwarter




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Correct way of overriding custom-set-faces after the color-theme is loaded
  2012-02-03 11:13     ` Philipp Haselwarter
@ 2012-02-03 15:36       ` Vineet Naik
  0 siblings, 0 replies; 6+ messages in thread
From: Vineet Naik @ 2012-02-03 15:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Feb 3, 2012 at 4:43 PM, Philipp Haselwarter
<philipp.haselwarter@gmx.de> wrote:
> my bad, got confused with my mail accounts.
>
>
> On Fri, Feb 03 2012 09:58 (@1328259509), Philipp Haselwarter wrote:
>
>> two solutions come to my mind:
>>
>> 1) set the face attributes outside of customize, that way they won't be
>>    affected by customize.
>> #+begin_src elisp
>>  (set-face-background 'flymake-errline "DarkRed")
>> #+end_src
>>
>> 2) put custom stuff into a separate file and load that at some point of
>>    your .emacs
>> #+begin_src elisp
>>  (load
>>   (setq custom-file
>>         (expand-file-name "custom.el" user-emacs-directory))
>>   'noerror)
>> #+end_src
>
> Clarification: Do one /or/ the other :) If you choose option two, make
> sure to create the file you set as `custom-file' (C-h v custom-file RET)
> and move all the custom-* stuff from your .emacs into that file. Also,
> use an absolute path-name. If things don't work as expected, remove the
> 'noerror and start emacs as "emacs --debug-init".
>
> --
> Philipp Haselwarter
>
>

Oh! got it now. Your explanantion also helped me refactor my .emacs file :)

Thank you for all the help.

-- 
Vineet Naik



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-03 15:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03  7:48 Correct way of overriding custom-set-faces after the color-theme is loaded Vineet Naik
2012-02-03  8:58 ` Philipp Haselwarter
2012-02-03 10:11   ` Vineet Naik
2012-02-03 11:04     ` Vineet Naik
2012-02-03 11:13     ` Philipp Haselwarter
2012-02-03 15:36       ` Vineet Naik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).