From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Buchs, Kevin J." Newsgroups: gmane.emacs.help Subject: when you gotta have a variable value for a symbol name Date: Wed, 23 Jul 2014 16:37:06 -0500 Message-ID: <27747b$8vdbei@ironport10.mayo.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1406151467 31080 80.91.229.3 (23 Jul 2014 21:37:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jul 2014 21:37:47 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 23 23:37:42 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 1XA4EF-0002Wa-Tc for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2014 23:37:40 +0200 Original-Received: from localhost ([::1]:47040 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4EF-0005ts-FV for geh-help-gnu-emacs@m.gmane.org; Wed, 23 Jul 2014 17:37:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4E0-0005tl-IU for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 17:37:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XA4Du-0003FL-7k for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 17:37:24 -0400 Original-Received: from mail10.mayo.edu ([129.176.114.198]:3877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XA4Du-0003Em-2s for help-gnu-emacs@gnu.org; Wed, 23 Jul 2014 17:37:18 -0400 Original-Received: from unknown (HELO mail10.mayo.edu) ([10.146.65.140]) by ironport10-dlp.mayo.edu with ESMTP; 23 Jul 2014 16:37:15 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcEAC0q0FMKgNEM/2dsb2JhbABWA4NgV8klBohrdoRCBAFKGlQ2GQgBAYhDuXmGRxuPXwWCIQ9ABIE8BYRvhXiJJIh0hXSGX4oBTg Original-Received: from unknown (HELO msgoms03.mayo.edu) ([10.128.209.12]) by ironport10.mayo.edu with ESMTP; 23 Jul 2014 16:37:12 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 129.176.114.198 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:98927 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. -- Kevin Buchs Research Computer Services Phone: 507-538-5459 Mayo Clinic 200 1st. St SW Rochester, MN 55905 http://mayoclinic.org http://facebook.com/MayoClinic http://youtube.com/MayoClinic http://twitter.com/MayoClinic (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)))