From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.help Subject: Re: Does code exist to check if a key sequence is valid for Emacs running in terminal mode? Date: Fri, 12 Jul 2024 14:53:36 +0200 Message-ID: <874j8ug4a7.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30794"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Pierre Rouleau Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 12 14:54:32 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sSFnE-0007rB-4V for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jul 2024 14:54:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSFml-0001gF-Rf; Fri, 12 Jul 2024 08:54:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSFmR-0000Yf-Br for help-gnu-emacs@gnu.org; Fri, 12 Jul 2024 08:53:47 -0400 Original-Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSFmP-0002kq-0I for help-gnu-emacs@gnu.org; Fri, 12 Jul 2024 08:53:42 -0400 Original-Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52eafa1717bso2006958e87.2 for ; Fri, 12 Jul 2024 05:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720788818; x=1721393618; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from:from :to:cc:subject:date:message-id:reply-to; bh=7rOGLkX20txvg/Lt6cxWUyDTONohOm2nliXcIGZ+l5Y=; b=XELrR6uAeFPUlp49KepNoLAWl5ForGbyEewSiSKQDgVvQL6S6r67Wi2vaZ7fg05AvE 6r5iSnQxBdycwaybKwbVPJuWTC8lpcAvSfV0wkH+/p8qCiP6P+tlmlk479g4hfyJk/HI c4hti715IPylW9OwsC/F9zae+gtyFuN3E8WlSeFfLpyhcp1t4Fbm6Fde67Th741Jpur4 2WMKRi497Qe4aSQqJw/vABscl422WVRASF38JAYBfcGhfEDEnols+6yA2qy6aM3EkxHV mAjD3oSLnaxV9d3rETLkOz8tlGGMNsi/QUql4I+iTj3h2aYKO+GMiN5uGk9WX3t5JI+z mD4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720788818; x=1721393618; h=content-transfer-encoding:mime-version:message-id:date :gmane-reply-to-list:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7rOGLkX20txvg/Lt6cxWUyDTONohOm2nliXcIGZ+l5Y=; b=LxE3Cqhh8eUDvkJtsndaQR4bTqjovKtSSdtUOjQqx7UR8csiOjeU9fW/oduLbgCWxC ZNwF5H/VGmH9GIMh1xAex551keLW31d3gn6jBY5RcpE05KqYlIdjhOEKZpipqgk6RMW6 y9LWWcTFIEX8u+PgRxewDqsxkIkmiHf7XRpr7qzaJb302/pQIn4VyisuJjqAge+Oswrf Krqij/4JWVCza95cNZE3FHNzYN4o3lfses0qOuzkYD5KuXsKZf+gHW5lVGVQgcO2PdkY rV6a+pGEZj+D6CCnbsq7gLnbK6m5vD3ipQGBWH680NAeNuvb33z/e9tE/QZL+2a2bO0R UU5Q== X-Gm-Message-State: AOJu0Ywf4JbRyz4W99q/BrE8abb3A/39gRDboxU6sKpgjmKgHWVAAOa6 c7qJkSdpwINv5hBBsVkjkUSKGkegZreA1/AT/LZuAAwpeDVL2YvUbq44cw== X-Google-Smtp-Source: AGHT+IF+GNcu4Yzw2C40WT1M5LiE3uIY12lMlQzuLCfH0Og/627qqG5KfOcvV7jeJGkNlGeCbBl80A== X-Received: by 2002:a05:6512:54c:b0:524:43b2:d326 with SMTP id 2adb3069b0e04-52eb99a273amr6956126e87.37.1720788817689; Fri, 12 Jul 2024 05:53:37 -0700 (PDT) Original-Received: from rltb ([82.66.8.55]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f2cc306sm23431815e9.30.2024.07.12.05.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jul 2024 05:53:37 -0700 (PDT) In-Reply-To: (Pierre Rouleau's message of "Fri, 12 Jul 2024 08:14:52 -0400") Gmane-Reply-To-List: yes Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=rpluim@gmail.com; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147158 Archived-At: >>>>> On Fri, 12 Jul 2024 08:14:52 -0400, Pierre Rouleau said: Pierre> Hi all, Pierre> Does Emacs already have a predicate function that can be used t= o check if Pierre> the specified key sequence is valid for Emacs running in termin= al mode? Not that I know of, but Emacs always has functionality I don=CA=BCt know of :-) Pierre> For example, "C-;" is not accessible on Emacs running in termin= al mode Pierre> because this is not an ASCII control character. It's available = for Emacs Pierre> running in graphical environment, but not in terminal mode. Pierre> Is there something similar already available or one would simpl= y wrap Pierre> describe-key and catch the error to check? I=CA=BCm in a terminal frame: (describe-key (kbd "C-;")) =3D> #("C-; is undefined" 0 3 (face help-key-binding font-lock-face help-key= -binding)) which is exactly what you get in a GUI frame. I think the best you can do is bind the key. If it=CA=BCs available, it wil= l work. Robert --=20