From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: What is the :eval form ? Date: Sat, 09 Jun 2012 10:34:02 +0200 Message-ID: <87zk8cc29x.fsf@gnuvola.org> References: <87d35965s1.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1339230836 15683 80.91.229.3 (9 Jun 2012 08:33:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Jun 2012 08:33:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jun 09 10:33:55 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SdH7K-0006qA-HO for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 10:33:54 +0200 Original-Received: from localhost ([::1]:39349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdH7K-0006IF-5h for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Jun 2012 04:33:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdH7D-0006I5-TE for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 04:33:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdH7C-0003SD-2g for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 04:33:47 -0400 Original-Received: from smtp208.alice.it ([82.57.200.104]:52351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdH7B-0003GD-Pj for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 04:33:46 -0400 Original-Received: from ambire (79.40.15.238) by smtp208.alice.it (8.6.023.02) id 4F056E8511B009C2 for help-gnu-emacs@gnu.org; Sat, 9 Jun 2012 10:33:07 +0200 Original-Received: from ttn by ambire with local (Exim 4.72) (envelope-from ) id 1SdH7T-0000U9-N0 for help-gnu-emacs@gnu.org; Sat, 09 Jun 2012 10:34:03 +0200 In-Reply-To: (Richard Riley's message of "Sat, 09 Jun 2012 08:40:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.57.200.104 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85174 Archived-At: () Richard Riley () Sat, 09 Jun 2012 08:40:44 +0200 Is that also true in a function call?=20 ,---- | (notifications-notify :title "Wazzup!?" :message message)) `---- title and message are not keywords here.=20 Or is the keyword "symbol" here? In Emacs Lisp keywords and symbols are not disjoint. A keyword is a symbol whose name begins with colon. That's all (conceptually). ;; -*- emacs-lisp -*- (symbolp 'foo) t =20=20 (symbolp :foo) t =20=20 (keywordp 'foo) nil =20=20 (keywordp :foo) t In this *scratch* excerpt, we see that relationship and note that all occurances are "in a function call" (i presume to mean "arg to a function"), the functions being =E2=80=98symbolp=E2=80=99 and =E2=80=98keywordp=E2=80=99. But design and implementation are likewise not disjoint: In the prior example, =E2=80=98notifications-notify=E2=80=99 is called with four args, the even-indexed keywords, the odd-indexed a string and whatever =E2=80=98message=E2=80=99 happens to be. If you instrument (advise) =E2=80=98notifications-notify=E2=80=99 to call =E2=80=98type-of=E2=80=99 on each of the args it receives, you will find that =E2=80=98type-of=E2=80=99 is not so smart: (type-of 'foo) symbol =20=20 (type-of :foo) symbol You might be tempted, then, to write: (defun excruciatingly-correct-type-of (object) (let ((guess (type-of object))) (case guess (symbol (if (char-equal ?: (aref (symbol-name object) 0)) 'keyword guess)) (t guess)))) =20=20 (excruciatingly-correct-type-of 'foo) symbol =20=20 (excruciatingly-correct-type-of :foo) keyword Or not. Personally, i stressed about this a while back but now have mellowed out a bit. Willful ignorance tastes different once you go around the circle (at least once :-D).