From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Is there a way to convert a keyboard macro to a string? Date: Thu, 27 Jul 2017 08:22:52 +0200 Message-ID: <87y3ra2ybn.fsf@jane> 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 1501136617 15557 195.159.176.226 (27 Jul 2017 06:23:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Jul 2017 06:23:37 +0000 (UTC) User-Agent: mu4e 0.9.19; emacs 26.0.50 Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 27 08:23:33 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 1dacCq-0003mk-2o for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jul 2017 08:23:32 +0200 Original-Received: from localhost ([::1]:41361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dacCv-0000Hw-Mt for geh-help-gnu-emacs@m.gmane.org; Thu, 27 Jul 2017 02:23:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dacCV-0000Ho-Uo for help-gnu-emacs@gnu.org; Thu, 27 Jul 2017 02:23:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dacCR-0007Jb-Vy for help-gnu-emacs@gnu.org; Thu, 27 Jul 2017 02:23:11 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:53991) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dacCR-0007GV-PR for help-gnu-emacs@gnu.org; Thu, 27 Jul 2017 02:23:07 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 76C10E67F8; Thu, 27 Jul 2017 08:23:00 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jvOUMm5s_McD; Thu, 27 Jul 2017 08:22:57 +0200 (CEST) Original-Received: from localhost (static-dwadziewiec-jedenpiec7.echostar.pl [109.232.29.157]) by mail.mojserwer.eu (Postfix) with ESMTPSA id A330AE677E; Thu, 27 Jul 2017 08:22:57 +0200 (CEST) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.110.48.8 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:113887 Archived-At: On 2017-07-26, at 20:40, Stefan Monnier wrote: >> 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. Well, I was too concise, sorry. I mean that if seq-into works, its result would be fed to insert, and if not, the result of key-description would be fed into execute-kbd-macro. This _should_ work, no? Best, -- Marcin Borkowski