From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: shorter form of frequently-seen lisp idiom? Date: 22 Feb 2005 10:29:23 -0800 Organization: http://groups.google.com Message-ID: <1109096963.491884.134590@c13g2000cwb.googlegroups.com> References: <87y8dg64h3.fsf-monnier+gnu.emacs.help@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1109096877 6777 80.91.229.2 (22 Feb 2005 18:27:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2005 18:27:57 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 22 19:27:57 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D3ekw-0005kp-Tw for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2005 19:27:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3f29-00075F-4n for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2005 13:45:21 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!c13g2000cwb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-NNTP-Posting-Host: 198.74.20.74 Original-X-Trace: posting.google.com 1109096967 21285 127.0.0.1 (22 Feb 2005 18:29:27 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 22 Feb 2005 18:29:27 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: c13g2000cwb.googlegroups.com; posting-host=198.74.20.74; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:128717 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24255 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24255 > Rule of thumb: if your solution uses `eval' it's either buggy or clunky. 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? Thanks Rick