unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Angelo Graziosi <angelo.graziosi@alice.it>, help-gnu-emacs@gnu.org
Subject: RE: About how misspelled word are displayed
Date: Fri, 12 May 2017 13:34:28 -0700 (PDT)	[thread overview]
Message-ID: <557766eb-48c0-4eaf-8c08-459b2376da8c@default> (raw)
In-Reply-To: <4bf8d1cf-5287-f74e-d6c5-938bbf295d6c@alice.it>

> > 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 emacs-devel@gnu.org:
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	other threads:[~2017-05-12 20:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12  9:49 About how misspelled word are displayed Angelo Graziosi
2017-05-12 13:09 ` Kaushal Modi
2017-05-12 14:07   ` Angelo Graziosi
2017-05-12 14:14     ` tomas
2017-05-12 14:27       ` Emanuel Berg
2017-05-12 15:16         ` Drew Adams
2017-05-12 16:27           ` Emanuel Berg
2017-05-12 17:32             ` Drew Adams
2017-05-12 18:00               ` Emanuel Berg
2017-05-12 21:15                 ` tomas
2017-05-12 21:28               ` N. Raghavendra
2017-05-12 22:08                 ` Drew Adams
2017-05-13 14:15                   ` N. Raghavendra
2017-05-13 14:59                     ` Emanuel Berg
2017-05-13 15:07                       ` Emanuel Berg
2017-05-13 15:22                         ` Emanuel Berg
2017-05-13 15:34                       ` N. Raghavendra
2017-05-13 15:54                         ` Emanuel Berg
2017-05-13 17:59                     ` Drew Adams
2017-05-14 13:07               ` N. Raghavendra
2017-05-12 19:30   ` Angelo Graziosi
2017-05-12 20:34     ` Drew Adams [this message]
2017-05-12 20:41       ` Drew Adams
2017-05-12 22:14         ` Angelo Graziosi
2017-05-12 23:42           ` Emanuel Berg
2017-05-13  0:22             ` John Mastro
2017-05-13  9:53               ` Emanuel Berg
2017-05-12 21:07       ` Emanuel Berg
2017-05-12 19:57   ` Angelo Graziosi
2017-05-12 20:56     ` Emanuel Berg

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=557766eb-48c0-4eaf-8c08-459b2376da8c@default \
    --to=drew.adams@oracle.com \
    --cc=angelo.graziosi@alice.it \
    --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.
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).