help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: About how misspelled word are displayed


From: Drew Adams
Subject: RE: About how misspelled word are displayed
Date: Fri, 12 May 2017 13:34:28 -0700 (PDT)

> > And for stuff that is not so simple, it is better to rely
> > on Customize.
> 
> Yes, you are right but I have spent all the afternoon trying to find in
> 'Options - Customize Emacs' the things to customize and how... 

Yes, it can be difficult to find out which things to customize.
That's unrelated to the question of whether to use Customize or
Lisp to set them.

If you know which option or face you want to change then the
previously raised question comes into play: _how_ to change it.

> In short I have to use something like this:
> 
> (custom-set-faces
> '(flyspell-duplicate ((t (:foreground "Gold3" :underline t :weight
> normal))))
>     '(flyspell-incorrect ((t (:foreground "OrangeRed" :underline t
> :weight normal)))))

You can write that by hand, or you can let Customize take care of
it for you.  That was the choice being discussed.

> Really I already have in my init.el:
> 
> ;; Instead of saving on ~/.emacs.d/init.el
> (setq custom-file "~/.emacs.d/custom.el")
> (load custom-file)

Good.

> this because I have installed packages from MELPA and I didn't
> want my init file changed silently (*).

IOW, we now have not only Customize writing to your `custom-file'
or init file; we have also the package system doing that.

It's questionable whether that's a great idea - a question that was
discussed briefly on address@hidden:
http://lists.gnu.org/archive/html/emacs-devel/2016-02/msg00958.html

One of the Emacs maintainers asked there whether we shouldn't use a
different file for this.  But AFAIK that thread went nowhere.

An earlier thread also broached the question somewhat:
http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg00534.html
http://lists.gnu.org/archive/html/emacs-devel/2015-03/msg01010.html

Anyway, this is a side question, here.

> For this reasons, usually, I want to put all customizations,
> decided by me, in init.el leaving all the rest in custom.el.

Decided by you or coded by you?  If you mean the latter, then
yes, exactly.

And your init file can have conditional code.  (And you can have
multiple init files, e.g. for different platforms.)  And your
init file can load other Lisp files you might write or use.

You can do all kinds of things in your init file.

But if you mean the former (decided by you but not necessarily
coded by you) then the previous discussion applies: Why not
use Customize to do that?

Whatever face appearances you decide on, Customize will save
them to your `custom-file', leaving your init file alone.
Customize and the package system will (should - otherwise there
is an Emacs bug) play well together wrt updating that file.

> In this case, since _I_ want to change 'flyspell-duplicate',
> 'flyspell-incorrect', I would to add the code in init.el without
> duplicating the "custom-set-faces" (one in init.el and one in
> custom.el (*))

You are right to not have another `custom-set-faces' in the
particular file (init file or `custom-file') that is updated
by Customize.  That's the purpose of the warning in the
automatically inserted comment.

However, there is nothing wrong with invoking multiple
`custom-set-faces' sexps, including the case where the same
face is updated.

The reason for that warning is that if Customize writes to that
file then it wipes out all `custom-set-faces' occurrences except
the last.  IOW, the problem is not invoking that function more
than once; it is that Customize rewrites the file, wiping stuff
out.

That's the reason to sacrifice a separate file, `custom-file',
to Customize: to keep its hands off your init file.  It won't
bother your init file if `custom-file' is defined.

IMHO, everyone should have a `custom-file'.  Give that to
Customize to fiddle with.  Keep it away from your hand-written
code, and keep your code away from `custom-file'.  Never the
twain should meet.

In addition to reserving your init file for your own code,
that file can load other Lisp files, and they too can use
`custom-set-faces' or `custom-set-variables' if you like.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]