* Re: void variable problem
2011-03-23 18:32 ` Haines Brown
@ 2011-03-23 20:09 ` Tim X
2011-03-23 23:14 ` Drew Adams
2011-03-24 1:19 ` Barry Margolin
2 siblings, 0 replies; 7+ messages in thread
From: Tim X @ 2011-03-23 20:09 UTC (permalink / raw)
To: help-gnu-emacs
Haines Brown <haines@HistoricalMaterialism.info> writes:
> Thank you and Eli for pointing out what should have been obvious to me.
>
> I was blissfully unaware of the Customize feature of emacs, and wonder
> why you recommend it in this case. As best I can make out, it creates a
> set of values for variables. But I don't see that the synonyms command
> requires setting values for variables, unless it is the name and
> location of the thesaurus and cache, which at this point I simply define
> in .emacs initiatialization. Why is it better to do it some other way?
>
One of the advantages of using custom is that it does some basic type
checking to ensure you enter a value of the correct type and reduces the
need for the user to understand some of the underlying code requirements
of elisp.
In this case, your mistake was to specify the file location wihtout
using quotes around the value. Emacs saw the value you entered as a
symbol rather than a value (to understand this, you really need to know
about how elisp reads and evaluates input etc). Many users don't want to
dive into the specifics of elisp, they just want to customize some
value. Here is where customize helps. In this case (guessing as I've not
seen the custom definition), the variable you were setting would likely
be defined as being a 'string', which means that when you entered
/home/somedir/somefile the custom mechanism would have saved that as
"/home/sodmedir/somefile" and the user can stay blissfully ignorant of
elisp evaluation, self-evaluating forms, symbols, functions, arguments,
quoting, etc.
On the other hand, if your someone who prefers to manage configuration
settings manually, then you will need to know about thses low level
issues, how to use the backtrace effectively and a number of common
idioms for defining structures, manipulating various objects etc.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: void variable problem
2011-03-23 18:32 ` Haines Brown
2011-03-23 20:09 ` Tim X
@ 2011-03-23 23:14 ` Drew Adams
2011-03-24 1:19 ` Barry Margolin
2 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2011-03-23 23:14 UTC (permalink / raw)
To: 'Haines Brown', help-gnu-emacs
> Thank you and Eli for pointing out what should have been
> obvious to me.
>
> I was blissfully unaware of the Customize feature of emacs, and wonder
> why you recommend it in this case.
The recommendation is not of the things-won't-work-otherwise sort. Regardless
of its off-putting UI, I recommend Customize in general, for several reasons,
including these:
1. It is type-aware. You cannot assign a value of the wrong type. Of course,
the programmer who wrote the `defcustom' defining the option needs to have
defined it with a reasonable type. If the type is too general (more or less
anything) then you lose the power of type-checking.
2. It is less error-prone in general (e.g. typos).
> As best I can make out, it creates a set of values for variables.
Yes.
> But I don't see that the synonyms command requires setting values
> for variables, unless it is the name and location of the thesaurus
> and cache,
Right, it does not require you to change any other options. But there are other
options you can change, if you want: `synonyms-append-result-flag',
`synonyms-fill-column', `synonyms-match-more-flag', `synonyms-mode-hook',
`synonyms-use-cygwin-flag', `synonyms-dictionary-url',
`synonyms-dictionary-url', and `synonyms-dictionary-alternate-url'.
> which at this point I simply define in .emacs
> initiatialization. Why is it better to do it some other way?
See above. There is nothing wrong with doing everything in your .emacs. I
recommend Customize in general, because it provides those benefits, but you need
not use it. If you had used it then type-checking would have prevented the
problem you ran into by forgetting to use double-quotes with `setq', as one
example.
HTH - Drew
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: void variable problem
2011-03-23 18:32 ` Haines Brown
2011-03-23 20:09 ` Tim X
2011-03-23 23:14 ` Drew Adams
@ 2011-03-24 1:19 ` Barry Margolin
2 siblings, 0 replies; 7+ messages in thread
From: Barry Margolin @ 2011-03-24 1:19 UTC (permalink / raw)
To: help-gnu-emacs
In article <8762r98z78.fsf@engels.HistoricalMaterialism.info>,
Haines Brown <haines@HistoricalMaterialism.info> wrote:
> Thank you and Eli for pointing out what should have been obvious to me.
>
> I was blissfully unaware of the Customize feature of emacs, and wonder
> why you recommend it in this case. As best I can make out, it creates a
> set of values for variables. But I don't see that the synonyms command
> requires setting values for variables, unless it is the name and
> location of the thesaurus and cache, which at this point I simply define
> in .emacs initiatialization. Why is it better to do it some other way?
The Customize feature allows you to assign these variables without
having to know anything about Lisp syntax. Since you apparently don't
know Lisp, it seems like you're the target audience for the feature.
In particular, it knows which variables are supposed to contain strings,
and it will automatically quote them properly for you.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 7+ messages in thread