all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: shorter form of frequently-seen lisp idiom?
Date: 22 Feb 2005 10:29:23 -0800	[thread overview]
Message-ID: <1109096963.491884.134590@c13g2000cwb.googlegroups.com> (raw)
In-Reply-To: 87y8dg64h3.fsf-monnier+gnu.emacs.help@gnu.org

> 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

  reply	other threads:[~2005-02-22 18:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.680.1108839059.32256.help-gnu-emacs@gnu.org>
2005-02-19 18:43 ` shorter form of frequently-seen lisp idiom? David Kastrup
2005-02-19 23:31   ` August
     [not found]   ` <mailman.714.1108857188.32256.help-gnu-emacs@gnu.org>
2005-02-19 23:55     ` David Kastrup
2005-02-21  0:07       ` Denis Bueno
2005-02-21  0:17         ` Denis Bueno
     [not found]       ` <mailman.835.1108945397.32256.help-gnu-emacs@gnu.org>
2005-02-21  0:28         ` David Kastrup
2005-02-22 14:44 ` Stefan Monnier
2005-02-22 18:29   ` rgb [this message]
2005-02-22 18:51     ` Thien-Thi Nguyen
2005-02-23 16:29       ` rgb
2005-02-23 18:03         ` Thien-Thi Nguyen
2005-02-22 21:20     ` Oliver Scholz
2005-02-22 22:16       ` Drew Adams
     [not found]       ` <mailman.1159.1109113137.32256.help-gnu-emacs@gnu.org>
2005-02-23 18:48         ` rgb
2005-02-19 18:33 Joe Corneli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1109096963.491884.134590@c13g2000cwb.googlegroups.com \
    --to=rbielaws@i1.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.