From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: when you gotta have a variable value for a symbol name Date: Thu, 24 Jul 2014 00:12:28 +0200 Organization: Informatimago Message-ID: <87lhrjiv1v.fsf@kuiper.lan.informatimago.com> References: <27747b$8vdbei@ironport10.mayo.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1406154028 28317 80.91.229.3 (23 Jul 2014 22:20:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jul 2014 22:20:28 +0000 (UTC) To: 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:20:23 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 1XA4ta-0007et-E4 for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Jul 2014 00:20:22 +0200 Original-Received: from localhost ([::1]:47183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4tX-00043R-EK for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2014 18:20:19 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 44 Original-X-Trace: individual.net FoXm/9hseeAI/kn/Gu0crwSDG914hmeH0n5QU7vbDR/etL11oo Cancel-Lock: sha1:NTIxZjhhYzE4MzM3OGJmNDgxZjhjMDcyNDg5YjQ4OGU3NmUzYmRhYQ== sha1:r3+YOahSzbxdyHwLlmHHMSvRczo= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:206656 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:98930 Archived-At: Drew Adams writes: >> 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. And use: (defvar my-macro-counter 0) (defun … ) instead of: (defun … … (unless (boundp 'my-macro-counter) (setq my-macro-counter 0)) …) -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk