From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Defining functions on the fly Date: Mon, 15 Jun 2015 13:31:11 +0200 Message-ID: <878ublcio0.fsf@web.de> References: <557E99BE.2060407@easy-emacs.de> <877fr58fr0.fsf@gmail.com> <557EA6D3.40108@easy-emacs.de> <87zj41qml7.fsf@gnu.org> <87egldcj7t.fsf@web.de> <87vbepqknm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1434367901 12007 80.91.229.3 (15 Jun 2015 11:31:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Jun 2015 11:31:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jun 15 13:31:32 2015 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 1Z4Sc0-0003SP-3r for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 13:31:32 +0200 Original-Received: from localhost ([::1]:33496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Sbz-00088K-E4 for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Jun 2015 07:31:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Sbo-00088E-Ol for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:31:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z4Sbl-0004ep-J5 for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:31:20 -0400 Original-Received: from mout.web.de ([212.227.15.3]:64452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z4Sbl-0004eQ-92 for help-gnu-emacs@gnu.org; Mon, 15 Jun 2015 07:31:17 -0400 Original-Received: from drachen.dragon ([90.187.144.201]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0Lp7Lg-1ZY00N0yAu-00eupE; Mon, 15 Jun 2015 13:31:15 +0200 In-Reply-To: <87vbepqknm.fsf@gnu.org> (Tassilo Horn's message of "Mon, 15 Jun 2015 13:24:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:OY+zGVdHuJaiRO9IocpQNy8lWyezcR5DWBE9HaOcmvtYsYyyNfZ 5eaI5o+eNNs8jSFfpsMuD0REyhV+utHnvI0XSae1hvry/o78795Lv8nkf5c2SUI6JEnypGa a+8p5rczC+gGv7zgZWNU8xEMryYK3elBiNia8LKwI0Ndam9Uzr4EN95p9LgG0dWcYA9RWN/ txrK1xnT+OHO0o6PrKq/A== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.15.3 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:104946 Archived-At: Tassilo Horn writes: > Ah, yes, so that's basically as if > > (defalias '(intern (concat pfxd "-foo")) ...) > > had been written. Yip: (macroexpand '(defun (concat "current-prefix-" foo) ())) ==> (defalias '(concat "current-prefix-" foo) #'(lambda nil nil)) The "problem" is that the defun macro (intentionally) adds a quote, so that (defun name ..) expands to (defalias 'name ...) and `name' doesn't get evaluated. If the defun macro would not add that quote, you would have to write (defun 'name ...) but (defun (intern name) ...) would work then. Michael.