From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Is there a way to convert a keyboard macro to a string? Date: Wed, 26 Jul 2017 14:40:00 -0400 Message-ID: References: <87a83r4t43.fsf@jane> <878tjb3vue.fsf@jane> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1501094442 28198 195.159.176.226 (26 Jul 2017 18:40:42 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Jul 2017 18:40:42 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 26 20:40:35 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daREW-0006gh-Gx for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Jul 2017 20:40:32 +0200 Original-Received: from localhost ([::1]:39568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daREZ-00075T-Jv for geh-help-gnu-emacs@m.gmane.org; Wed, 26 Jul 2017 14:40:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daRE5-00072P-NV for help-gnu-emacs@gnu.org; Wed, 26 Jul 2017 14:40:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daRE2-00062A-KR for help-gnu-emacs@gnu.org; Wed, 26 Jul 2017 14:40:05 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:50826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daRE2-00061g-Dp for help-gnu-emacs@gnu.org; Wed, 26 Jul 2017 14:40:02 -0400 Original-Received: from lechazo.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6QIdxvw010755; Wed, 26 Jul 2017 14:39:59 -0400 Original-Received: by lechazo.home (Postfix, from userid 20848) id 5345360224; Wed, 26 Jul 2017 14:40:00 -0400 (EDT) In-Reply-To: <878tjb3vue.fsf@jane> (Marcin Borkowski's message of "Wed, 26 Jul 2017 20:18:49 +0200") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6080=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6080> : inlines <5995> : streams <1755883> : uri <2470353> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:113878 Archived-At: > Thanks, that was _exactly_ what I needed! This means that what I want > is to first use seq-into (wrapped in condition-case), and if that fails, > key-description. Emacs did not disappoint! ;-) I think that's the wrong approach: the kinds of strings returned are different. E.g for a vector like [?\C-a], seq-into will return a string with a single char (the ASCII code 1), whereas key-description will return the string "C-a". The most likely situation is that you always want to use `key-description` because the reason for wanting a string is to have a human-readable representation of the sequence of events. Stefan