From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: when you gotta have a variable value for a symbol name Date: Wed, 23 Jul 2014 15:02:38 -0700 (PDT) Message-ID: References: <27747b$8vdbei@ironport10.mayo.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1406153002 16779 80.91.229.3 (23 Jul 2014 22:03:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jul 2014 22:03:22 +0000 (UTC) To: "Buchs, Kevin J." , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 24 00:03:15 2014 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 1XA4d0-0001sq-O8 for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Jul 2014 00:03:14 +0200 Original-Received: from localhost ([::1]:47124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4d0-00025M-DE for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2014 18:03:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4cg-000255-Q4 for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 18:03:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XA4cT-0003rS-NK for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 18:02:54 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:27889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4cT-0003rM-Go for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 18:02:41 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s6NM2e3R002857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Jul 2014 22:02:40 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6NM2dl8019930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 23 Jul 2014 22:02:40 GMT Original-Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s6NM2cEu014267; Wed, 23 Jul 2014 22:02:39 GMT In-Reply-To: <27747b$8vdbei@ironport10.mayo.edu> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:98929 Archived-At: > I want to evaluate (kmacro-name-last-macro variable), where I want the > value of "variable" passed as the symbol name. Despite years of trying, > I don't think I ever really conceptually "got" the distinction between > symbols and variables and that seems to be critical here. I'm working > with the code below, but it is not suceeding in naming the macros (no > error messages, however). Of course (kmacro-name-last-macro 'my-macro) > works just fine. > > (defun name-my-macro-sequentially () > "Names the last recorded macro as my-macro#, where # is a number > sequentially incremented" > (interactive) > (unless (boundp 'my-macro-counter) (setq my-macro-counter 0)) > (setq my-macro-counter (1+ my-macro-counter)) > (let ((macro-name (format "my-macro-%d" my-macro-counter))) > (kmacro-name-last-macro (make-symbol macro-name)) ^^^^^^^^^^^ > (message "named keyboard macro %s" macro-name))) Change `make-symbol' to `intern' and you're good to go. `make-symbol' returns an uninterned symbol.