[Top][All Lists]

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

Re: shorter form of frequently-seen lisp idiom?

From: rgb
Subject: Re: shorter form of frequently-seen lisp idiom?
Date: 22 Feb 2005 10:29:23 -0800
User-agent: G2/0.2

> Rule of thumb: if your solution uses `eval' it's either buggy or

Interesting, I've never heard this.
My elisp isn't all that great yet so I looked for instances where
I use it.

(defun tacl-eldoc-function ()
  "Returns a documentation string for context near point or nil"
  (let ((word (thing-at-point 'symbol)))
    (if word
        (eval (intern-soft (upcase word) tacl-eldoc-obarray)))))

tacl-eldoc-obarray is populated like this.

(set (intern "FOO" tacl-eldoc-obarray) "FOO help text here")
(set (intern "BAR" tacl-eldoc-obarray) "BAR help text")

I thought this might be an exception to your rule because apply
doesn't apply.  But then it occured to me that symbol-value is
probably what I should have coded.

Is there a collection of more such tips someplace?


reply via email to

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