From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Random832 Newsgroups: gmane.emacs.devel Subject: Re: Is `kbd' idempotent? Date: Tue, 1 Dec 2015 15:37:13 +0000 (UTC) Message-ID: References: <87a8pvqzij.fsf@web.de> <87bnabv6m6.fsf@fencepost.gnu.org> <87610jqxx6.fsf@web.de> <87mvtu6ybe.fsf@web.de> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1448984276 22974 80.91.229.3 (1 Dec 2015 15:37:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Dec 2015 15:37:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 01 16:37:48 2015 Return-path: Envelope-to: ged-emacs-devel@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 1a3mzx-0005ph-UD for ged-emacs-devel@m.gmane.org; Tue, 01 Dec 2015 16:37:46 +0100 Original-Received: from localhost ([::1]:53301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3mzx-0005bt-9R for ged-emacs-devel@m.gmane.org; Tue, 01 Dec 2015 10:37:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3mzk-0005bW-Dt for emacs-devel@gnu.org; Tue, 01 Dec 2015 10:37:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3mzh-0000xm-7M for emacs-devel@gnu.org; Tue, 01 Dec 2015 10:37:32 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:38538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3mzh-0000xU-0h for emacs-devel@gnu.org; Tue, 01 Dec 2015 10:37:29 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a3mzZ-00058e-5s for emacs-devel@gnu.org; Tue, 01 Dec 2015 16:37:21 +0100 Original-Received: from c-68-39-146-59.hsd1.in.comcast.net ([68.39.146.59]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Dec 2015 16:37:21 +0100 Original-Received: from random832 by c-68-39-146-59.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Dec 2015 16:37:21 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 23 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-68-39-146-59.hsd1.in.comcast.net User-Agent: slrn/pre1.0.3-7 (Linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195677 Archived-At: On 2015-12-01, Michael Heerdegen wrote: > I'm deliberating if I'm doing the user a favor if I pass any `stringp' > input implicitly to `kbd', because the keyboard macro format seems to be > quite popular. That would spare him to wrap his input into `kbd' by > himself. But if the result of `kbd' can change the "semantics" of a > string describing a key sequence - as your counterexamples demonstrate - > I can't do that. What about calling kbd only if the 'read' result is a string? That way if they really want to pass a self-made string, they can do e.g. (identity "foo"), whereas "foo" alone will be treated as (kbd "foo") I do wonder what the use case is, though, that benefits from allowing the entry of an arbitrary lisp expression instead of just directly passing the user input to kbd without even a read/eval stage. Are there key sequences that can't be represented in kbd format that the user will want to enter as vector literals? How about a heuristic? If the first character of input is ", it is read and passed to kbd. If it is [, it is read. If it is (, it read and eval'd. Otherwise, it is passed directly to kbd. That'd save them from having to type a string literal in the (I assume most common) case they simply want to pass a printable string to kbd.