Re: Comparison of defcustom and defvar arguments

Heime <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <nSAY5w733vLH7wb4IuJJbSXrOmRpNpONow5K34c6-6ro10Y1dqDeG14yFHe3pBcSyjQlumLao--hM3ZiS3_thWQibGq0vgTztyujXxhPZic=@protonmail.com>
On Friday, August 21st, 2026 at 3:04 PM, [email protected] <[email protected]> wrote:

> Heime <[email protected]> writes:
> 
> > Looked at the decumentation of defcustom and defvar
> >
> > (defcustom SYMBOL STANDARD DOC &rest ARGS)
> >
> > defcustom accepts STANDARD to be an expression, and includes
> > keyword declarations such as :initualize
> >
> > (defvar SYMBOL &optional INITVALUE DOCSTRING)
> >
> > On the other hand, defvar does not seem to allow INITVALUE to be
> > an expression, and keyword declarations are not allowed.
> >
> > It seems to me that defvar is very restrictive.
> >
> 
> The definition of ‘defvar’ is complex because it can be used
> in several contexts, but it is possible to use an expression
> (which *will* be evaluated) in a ‘defvar’ expression.
> 
> Simple example:
> 
>   (defvar my-var (list (quote a)
>                        (char-to-string ?b)
>                        (cons 'c 'd)
>                        emacs-version))
> 
> M-: my-var
> 
> => (a "b" (c . d) "30.2")

I have done the following - a function returning an alist which I call
via (myalist) to set the variable value


(defun myalist ()
  "Docstring"

  (let ( (waypt orellana-waypt) )
    `( (ORLNA . ,waypt)
       (GLXKS . ,(concat basewaypt "/galaxiakos"))
       (HKDMR . ,(concat waypt "/hakudo-maru"))
       (TKYNS . ,(concat waypt "/tachyons"))
       (SVMTR . ,(concat waypt "/servomotor"))
       (AMZNS . ,(concat waypt "/amazones"))
       (GRVDR . ,(concat waypt "/groovador"))
       (KGIZA . ,(concat waypt "/groovador/kasrgiza"))
       (MTJRA . ,(concat waypt "/montejura"))) ))

(defvar this (myalist)
  orellana-fpln-dokette)

> 
> --
> The lyf so short, the craft so long to lerne.
> - Geoffrey Chaucer, The Parliament of Birds.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.