* void variable problem
@ 2011-03-23 17:12 Haines Brown
2011-03-23 17:59 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Haines Brown @ 2011-03-23 17:12 UTC (permalink / raw)
To: help-gnu-emacs
I installed synonyms.el, and it depends on access to mthesar.txt. So I
created: /home/haines/mthesaur/mthesaur.txt and in .emacs access it with
the line (setq synonyms-file /home/haines/mthesaur/mthesaur.txt)
But when emacs loads, I get this error:
Debugger entered--Lisp error: (void-variable
/home/haines/mthesaur/mthesaur\.txt)
(setq synonyms-file /home/haines/mthesaur/mthesaur\.txt)
eval-buffer(#<buffer *load*<4>> nil "/home/haines/.emacs" nil t) ;
Reading at buffer position 17897
load-with-code-conversion("/home/haines/.emacs"
"/home/haines/.emacs" nil nil)
load("~/.emacs")
What does the backshash in "mthesaur\.txt" mean?
Haines Brown
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: void variable problem
2011-03-23 17:12 void variable problem Haines Brown
@ 2011-03-23 17:59 ` Eli Zaretskii
2011-03-23 18:13 ` Drew Adams
[not found] ` <mailman.9.1300904003.4948.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2011-03-23 17:59 UTC (permalink / raw)
To: help-gnu-emacs
> From: Haines Brown <haines@HistoricalMaterialism.info>
> Date: Wed, 23 Mar 2011 13:12:07 -0400
>
> I installed synonyms.el, and it depends on access to mthesar.txt. So I
> created: /home/haines/mthesaur/mthesaur.txt and in .emacs access it with
> the line (setq synonyms-file /home/haines/mthesaur/mthesaur.txt)
This should be "/home/haines/mthesaur/mthesaur.txt", in quotes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: void variable problem
2011-03-23 17:12 void variable problem Haines Brown
2011-03-23 17:59 ` Eli Zaretskii
@ 2011-03-23 18:13 ` Drew Adams
[not found] ` <mailman.9.1300904003.4948.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2011-03-23 18:13 UTC (permalink / raw)
To: 'Haines Brown', help-gnu-emacs
> I installed synonyms.el, and it depends on access to mthesar.txt. So I
> created: /home/haines/mthesaur/mthesaur.txt and in .emacs
> access it with the line
> (setq synonyms-file /home/haines/mthesaur/mthesaur.txt)
> But when emacs loads, I get this error:
> (void-variable /home/haines/mthesaur/mthesaur\.txt)
>
> What does the backshash in "mthesaur\.txt" mean?
Eli already mentioned that the file-name value needs to be string (i.e. "...").
The error message shows that Emacs read the symbol named `mthesaur.txt' and
tried to find its value as a variable. When printing the symbol name, Emacs
escapes the `.' with a backslash.
Instead of using (setq synonyms-file...) you can use Customize (command
`customize-option'). I recommend this.
Or you can just start using command `synonyms' and it will prompt you for the
file to use. And if you want Emacs to remember this, then use `customize
option' to save it.
This is all explained in file synonyms.el, in the Commentary (file header).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: void variable problem
[not found] ` <mailman.9.1300904003.4948.help-gnu-emacs@gnu.org>
@ 2011-03-23 18:32 ` Haines Brown
2011-03-23 20:09 ` Tim X
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Haines Brown @ 2011-03-23 18:32 UTC (permalink / raw)
To: 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. 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?
Haines Brown
^ 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: 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
end of thread, other threads:[~2011-03-24 1:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-23 17:12 void variable problem Haines Brown
2011-03-23 17:59 ` Eli Zaretskii
2011-03-23 18:13 ` Drew Adams
[not found] ` <mailman.9.1300904003.4948.help-gnu-emacs@gnu.org>
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
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).