[Top][All Lists]

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

Re: [comp.emacs] Announcing Easymacs: an all-in-one Emacs configuration

From: Robert J. Chassell
Subject: Re: [comp.emacs] Announcing Easymacs: an all-in-one Emacs configuration for newbies
Date: Fri, 1 Jul 2005 13:36:00 +0000 (UTC)

David Kastrup <address@hidden> writes

    The following announcement seems like an excellent reason to get
    custom themes working.  ...

Yes.  The advantages of a customize theme command are two fold:
writing customizations becomes more usual for those who have learned
differently than writing simple expressions.  And loading the
resulting libraries becomes simpler.

As Luc Teirlinck pointed out, for loading, the current custom theme
files use custom-theme-set-variables and custom-theme-set-faces.
This is not necessary.

There is an alternative way to load and unload the current custom
theme libraries.  This means writing one new function (which may be

The other part of customization, the part that uses the existing
cus-*.el libraries, is fine for people who have not learned or do not
wish to learn to write customizations in the normal way.

For loading, the current custom theme methods is very inconvenient for
those who have 20 year old custom theme libraries and load them
frequently (well, I mean, load the current version of the library).
That is because the regular customization libraries must be rewritten
using custom-theme-set-variables and custom-theme-set-faces.

On the other hand, the new method is advantageous to those who wish to
specify the name of a custom theme inside a library instead of making
the name of the library be the name of the theme.

I think we should drop the loading method in the current set up and
use the conventional loading method.  The latter works fine to load
`custom-set-faces' and `custom-set-variables' expressions; they can be
set however you want.

To load and unload custom themes we only need two functions, one of
which has been around since the beginning and one of which is new.

The first function is `load-library'.  It loads an existing custom
theme file, such as a .emacs file with a `custom-set-faces' expression
in it.

The second function does not exist.  It is `unload-libraries'.  This
function should unbind every customized or user-modified symbol in an
instance of Emacs and rebind those symbols to whose which come with

    emacs -q --no-site-file

(Well, the function should be named `unload-library' and should only
unload a specified library and return only those bindings to their
defaults; but I think that is harder.)

Thus, to offer an Emacs theme that has my personal theme plus a theme
with a white background (useful for sitting in the sun), type

    M-x load-library RET .emacs RET
    M-x load-library RET .emacs-white-background RET

To return to a default instance of Emacs, type

    M-x unload-libraries RET

The disadvantage is that each theme is specified by a named file.
In addition, you cannot put different themes into the same file.

Also, you cannot substract one theme from another, since
`unload-libraries' rebinds all symbols to whose which come with come
with `emacs -q --no-site-file'.

I do not know how unload one or more non-default libraries and return
an instance of Emacs to a default.  A function using `makunbound' is
not what we want since `makunbound' does not rebind a symbol to the
default value.  It makes the symbol be void.  As for `unload-feature',
I cannot figure out how to call the name of a file, such as
"~/.emacs-white-background" a `feature' that means the rest of the
library must be loaded or unloaded.  (I hope the capability is there
and that I am just being foolish.)

In any event, like everyone, I customize my instances of Emacs all the
time using various .emacs files.  However, instead of unloading such
customizations, I simply start a new instance with `-q -l ' and the
name of a different file to load.

Thus, if the customization file exists, I could start Easymacs with

    emacs -q -l .emacs-easymacs

With the new function, I could start an instance of Emacs of my own
and then type

    M-x unload-libraries RET
    M-x load-library RET .emacs-easymacs RET

For me, the first is easier, but for many, the second would be easier.

As for settings that go into a customization file:  that capability
can be left as is.  Some variables, like `inhibit-startup-message',
should be set with `setq' with the expression written into the
customization file.

On the other hand, to specify faces, it is often best to use the
`custom-set-faces' function.  When the face is new and you are working
interactively, the function automatically writes the expression into
the initialization file.  But you need not work interactively; for
previously set faces, you can change the expression in your .emacs
file.  This can be very convenient.

This is a scheme that works for both novices and experts:  use the old
loading function, one new unloading function, and the current setting

    Robert J. Chassell                         
    address@hidden                         GnuPG Key ID: 004B4AC8
    http://www.rattlesnake.com                  http://www.teak.cc

reply via email to

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