[Top][All Lists]

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

Re: Using "Emacs Configure" **and** modifying .emacs

From: ken
Subject: Re: Using "Emacs Configure" **and** modifying .emacs
Date: Sat, 12 Aug 2017 11:53:30 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 08/11/2017 03:15 PM, Drew Adams wrote:
It is fine to use Lisp. It is generally not
advisable to use it without knowing what the
functions you use do (or don't do).
That's one way to learn, of course, - by
experimenting, but it can also help to read
the fine manual.
For setting single variables, one would think
using common sense, and the kind of common
sense that comes with using computers every day
and evermore pushing the envelope to increase
one's understanding, it would seem this would
be enough, at the very least if the docstring
(help system) also is consulted for the
specific setting. But reading the manual is
always encouraged, of course.

If the docstring isn't enough, but the manual
is, one can report it as a bug and suggest how
the docstring can be improved.
Yes, the doc string for such an option should warn you
not to just use `setq'.  But not every doc string is
perfect. ;-)

The Elisp manual, node `Variable Definitions' says:

      Specify SETFUNCTION as the way to change the value of this option
      when using the Customize interface.  The function SETFUNCTION
      should take two arguments, a symbol (the option name) and the new
      value, and should do whatever is necessary to update the value
      properly for this option (which may not mean simply setting the
      option as a Lisp variable); preferably, though, it should not
      modify its value argument destructively.  The default for
      SETFUNCTION is ‘set-default’.

      If you specify this keyword, the variable’s documentation string
      should describe how to do the same job in hand-written Lisp code.

Note the second paragraph.  If you define an option with a
`defcustom' that uses `:set', help users of your option by
letting them know how to change the value using Lisp.  How
to change the value typically does not mean using only `setq'
in such a case.

Excellent idea.  Here's a practical example:

Having a fairly large screen and often many windows open, it's sometimes difficult to find the cursor in an emacs window. So I thought limegreen would be a more discernible color for a cursor than the default black. So I put this in my .emacs:

(set-cursor-color "limegreen")

However, the result is that only the first emacs window loaded has a limegreen cursor. All the others subsequent have the default black cursor. Running the same function in each emacs buffer does correctly yield a limegreen cursor, but not a practical solution when I have twenty or thirty buffers open, each in its own window (or frame).

The help documention (C-h f set-cursor-color) shows:

set-cursor-color is an interactive compiled Lisp function.

(set-cursor-color COLOR-NAME)

Set the text cursor color of the selected frame to COLOR-NAME.
When called interactively, prompt for the name of the color to use.
This works by setting the `cursor-color' frame parameter on the
selected frame.

You can also set the text cursor color, for all frames, by
customizing the `cursor' face.

If someone preferred to place a statement in .emacs to accomplish the goal-- rather than "customizing"-- what should the above documentation say?

reply via email to

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