From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [newbie] trouble getting the context of macros Date: Sun, 2 Feb 2020 08:20:28 -0800 (PST) Message-ID: <518e7bcc-e6f2-45f8-ab12-f60025420b76@default> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="76513"; mail-complaints-to="usenet@ciao.gmane.io" To: Marco Maggi , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 02 17:21:07 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iyHze-000Jl7-94 for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 02 Feb 2020 17:21:06 +0100 Original-Received: from localhost ([::1]:57484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyHzd-00086W-BU for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 02 Feb 2020 11:21:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52643) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iyHzD-00085f-D1 for help-gnu-emacs@gnu.org; Sun, 02 Feb 2020 11:20:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iyHzB-00052g-IT for help-gnu-emacs@gnu.org; Sun, 02 Feb 2020 11:20:38 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:36780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iyHzA-0004zH-Qc for help-gnu-emacs@gnu.org; Sun, 02 Feb 2020 11:20:37 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 012GKVER035837; Sun, 2 Feb 2020 16:20:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=oO9hAtD/Lyv7xMVV7DlCJRh3sp9SrUaPrfm7YzlCpj4=; b=Ba6QiGxRs2lAGLzqeVPKpsqtsRMN4UrxTPKfR+3/aas1x0LXHkgw1Sz8eoYFNIcyWlDw ipZD0Il5e90kMqsQozkcWgauQS2JvbvxQi5wN/yW4/W/sKBHb3EZ4TKHbrlY9nKtSM+l 0QXUA4Nqe7KEtgDrXQzdLW1d9afe/Ak/UfBz6RnmaELsMCXyY1QGN13+QqFmJ5rRDfB4 Whw1yCH8Asj+It8gqchlcnB/Pd7fqTbG4RBGZxTH5yWpGSJRwSgvH4XgSPATPsVmdAne o7FlManT2xucZMILl1JIrFK8fZ7SkM/ghrk2Ia7jA67gyRuLOkWtm7nIHs2l6T46I/JX mQ== Original-Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2120.oracle.com with ESMTP id 2xw19q40u5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Feb 2020 16:20:31 +0000 Original-Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 012GIaRZ194627; Sun, 2 Feb 2020 16:20:30 GMT Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2xwjt1cw0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 02 Feb 2020 16:20:30 +0000 Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 012GKTAZ021494; Sun, 2 Feb 2020 16:20:30 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4954.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9519 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=910 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2002020131 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9519 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=966 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2002020131 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.78 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122331 Archived-At: > (defmacro my-try-2 (op) > (let ((fun (make-symbol (concat "my-" (symbol-name op))))) > `(defun ,fun (op1 op1) t))) > my-try-2 > (my-try-2 fun3) > my-fun3 > (my-fun3 1 2) >=20 > the last form gives me the error "eval: Symbol=E2=80=99s function definit= ion is > void: my-fun3". I do not understand why. Try this instead: (defmacro my-try-2 (op) (let ((fun (intern (concat "my-" (symbol-name op))))) `(defun ,fun (op1 op2) t))) `C-h f make-symbol' tells you that the new symbol it returns is not interned. See the Elisp manual, node Creating Symbols, for info about `intern' and `make-symbol'. https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Symbols.= html