From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AAzGMlsUf2H0MgAAgWs5BA (envelope-from ) for ; Sun, 31 Oct 2021 23:10:35 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id gEl2LlsUf2EkTAAA1q6Kng (envelope-from ) for ; Sun, 31 Oct 2021 22:10:35 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EB72531382 for ; Sun, 31 Oct 2021 23:10:34 +0100 (CET) Received: from localhost ([::1]:57658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhJ2A-0000DG-2X for larch@yhetil.org; Sun, 31 Oct 2021 18:10:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhJ1W-0000D7-Mp for emacs-orgmode@gnu.org; Sun, 31 Oct 2021 18:09:54 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:37603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhJ1U-0005FI-PN for emacs-orgmode@gnu.org; Sun, 31 Oct 2021 18:09:54 -0400 Received: by mail-pj1-x1033.google.com with SMTP id t5-20020a17090a4e4500b001a0a284fcc2so14693373pjl.2 for ; Sun, 31 Oct 2021 15:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=YVgLv5kHjUC2O0JSH1WdusTwh7PW566IBbJcRKTB1eI=; b=Mb2j+c5I4u0vmTQnb3Eh8vxIxQtZz+Uzm6qi+kq1Uoi+Dk66jqVJ9jr1k90sF/XZuD 3ftnusU5uSU1xGsK9/JQjY5fQZL6Q4Rh4+n78CBBFftDZzBoZiVhFjBg98hzhvtxJifY Jqpem8nBnD1N7dZTYlUPxfCDVLTSWwUiuPAP4PyQmdvMzuHjFHSwDc2Qb3bGZ4tmE50K eTy5QoBmK/mCC5vMJxJDdsZbc1LPzDL0as8FEmm9TkIFp+Q2RPkIF78mqod502f12nHz +YaS/Su0b+X+o/LoAzqsXZnuccLpHpKwd06uVmmisMPbOMcyLqW2ys91JT6Ovf7cM4WG rkBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=YVgLv5kHjUC2O0JSH1WdusTwh7PW566IBbJcRKTB1eI=; b=m98iY89XAKEsLIu05zyG7GqYI3Fw69MUbZ31adSF1qiH4W1IuK+XKcCdTguKEmv7bX CMSMfBTJC2nNiNDV/hrWez3EISSx5eSgk21eIAyZkrHYDcvT/7tHI4K8XpsdL5S6a3Da 4y0lZvzKUkLf646yiTSPIla4dVJp2fElr74Xcl0pJetLPeVfud3yDEan669QCaECE3rZ yFWkLbyscwIS+tVX1AW77A6/8UMdUH5IEt3jtkVlr9VmfodvDG+ih14k3qnE4qJ8hrPY UyxRMKAQJDRE9PnQRWzeutRBrNCPLmZhoIAAKlfScbt0GQdOFJCvJLSfJbak7/eBq97J Dk0g== X-Gm-Message-State: AOAM531/Fq+e+zb6ip4VgmloAX7VPVqvLvjAywFMOiX+9x0nmf8jvYyN 3qjWzRizIxkCN+wHWjtCuFrZ8XL+xyI= X-Google-Smtp-Source: ABdhPJwQtLwSd4ilMeB9qFLdi6X9XPQMhjTBARNGe45H1J51t+Od6q8C9VGQCXD4l0mxBPktI4frcA== X-Received: by 2002:a17:90a:d317:: with SMTP id p23mr11304255pju.196.1635718190217; Sun, 31 Oct 2021 15:09:50 -0700 (PDT) Received: from dingbat (2001-44b8-31f2-bb00-a7f2-bf71-9d71-7b96.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:a7f2:bf71:9d71:7b96]) by smtp.gmail.com with ESMTPSA id e14sm9837729pga.76.2021.10.31.15.09.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 15:09:49 -0700 (PDT) References: <4Hj0ND6KM3z9rxQ@submission02.posteo.de> User-agent: mu4e 1.7.4; emacs 28.0.60 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: SHIFT-TAB not working in Windows-SSH-shell or Debian-tty (sometimes "M-[ ~ is undefined") Date: Mon, 01 Nov 2021 08:16:14 +1100 In-reply-to: <4Hj0ND6KM3z9rxQ@submission02.posteo.de> Message-ID: <87lf28rgm7.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x1033.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: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635718235; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YVgLv5kHjUC2O0JSH1WdusTwh7PW566IBbJcRKTB1eI=; b=h4PbklK2vdr21CmCYF4wJSsyiUmwNSpr+n5MLM8oZXrZKUXmxjjpR8NN3VSQup+0FI2XeP Z2gd+KOfyl8CpNBjgeUbwLEOdqMUGbmbwGsOEIr0HvoJQtMNXAckxQs8InC1CsMtDixxJi UkgwDHMklRWFultmfyp7d4rG6dA27RSsUk9k8cifa7me+qXAkU3DJ9bDEtbUTMtbEKp9vf quEkKyCFWZMB5Nwvva3nLICI5MqVxQcdyNY2n6N5AUy+xV3WI5Mj2NLBaHK554OayHNpua WbPI2gwykdxsumPcRzs5Z479ilmeARRRfQsNi6KWcyXiSddVzTV4xsdCYdWO2w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635718235; a=rsa-sha256; cv=none; b=Dx0yJUoy+fsf/7tG94v12pWHcmUHTXp/boM+Bi+Dn+t9f29L/zerDzocDwGum4fHskRw/P aShbaaNxi3eFY59QOqbL+J4QmlLtlMYZmvbONXOSIT/Ysx9F+vV7EYRIsUHeUecuUs+9gk v98NtTMHnS3pNChU3P+Cl6/SxFWaPNOZYndI5+4tMZMoUdPXPHVw2DrANmpf0KHEvCx8wL W0knS/uikYvRFltjZ/FYh5Wv+8GVk7gVfUiRFw7Mht4i5q+LW2x6JSU0CLKEhrpPMCEqTW 5KjjZvgXozYbB+vSFQmD9Sm12ICiKtAVofhL5ruWURJUpSkXblpv4UWgo4Sryw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Mb2j+c5I; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Mb2j+c5I; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: EB72531382 X-Spam-Score: -1.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: HP2WheBv41DQ writes: > X-Post: https://github.com/daviwil/emacs-from-scratch/issues/67 > > Hello together. > > # Introduction > > I am quite new to emacs and building my init.el based the "Emacs from > Scratch" (by System Crafter) videos. In org-mode I experience some wired > behavior of the SHIFT-TAB key when (un)folding headings in an > .org file. > > # Problem > > In some cases SHIFT-TAB creates a M-[ ~ is undefined message or simply > does not work without an error message. > > # System > > Debian 11 > GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, > cairo version 1.16.0) of 2021-03-28, modified by Debian > Copyright (C) 2020 Free Software Foundation, Inc. > > # Minimal init.el > > This can be used for reproduction. > > ;; === Package setup === > (require 'package) > (setq package-archives '(("melpa" . "https://melpa.org/packages/") > ("org" . "https://orgmode.org/elpa/") > ("elpa" . "https://elpa.gnu.org/packages/"))) > (package-initialize) > > ;; === use-package == > ;; use-package to simplify the config file > (unless (package-installed-p 'use-package) > (package-refresh-contents) > (package-install 'use-package)) > > (require 'use-package) > (setq use-package-always-ensure 't) > > (use-package org) > > # Description of the behavior in multiple cases > > ## Windows SSH-terminal > > Form a Windows 10 client and its usual command prompt (not PowerShell, > not Terminal.app) I log into my machine via SSH and (of course) use > emacs in none-gui mode then. TAB works. But SHIFT-TAB produce the M-[ ~ > is undefined error. > > ## A tty terminal (Debian 11) > > Here TAB works. But S-TAB does not. The latter does not produce any > error message. There is simply no reaction on that button. > > ## Cases in where it is NOT reproducable > > - Gui mode in XFCE session on Debian 11 > - Terminal emulator (terminator) in a XFCE session on Debian 11 > - SSH terminal from Debian 11 > > ## Sidenotes > > There is a stackoverflow QA for this: > https://stackoverflow.com/q/3518846 The solution there does not work > for me (Emacs from Debian 11). > > This problem is totally out of my scope of understanding. > I don't think this is an org problem. Rather, I think your probably running into two different problems which have the same symptom. Problem 1; Linux Console The linux console is not the same as a terminal emulator. There are a number of modifier combinations which are not recognised under the linux console unless you configure them using the loadkeys command to install a keymap file (there is also a dumpkeys command to dump out the current mapping). A full explanation of what to do is beyond a simple mail list reply, but I would suggest installing the console-data package, which includes some common keymaps and reading about loadkeys. You will need to configure your Linux system to load a console keymap on boot to have key combinations like shift+tab work. Problem 2: ssh/putty I'm not a windows user and have never used putty, so this is a bit of a shot in the dark, but might provide the pointers that will help you find a solution. When it comes to input issues when using ssh, there are typically two causes - 1. The host OS running the ssh client (i.e. putty), is stealing the key combination before it is passed to the underlying program. If your GUI uses the same key combination to do something (like switch applications), the key press will not be passed to the underlying program being run. I doubt this is your issue as I suspect it would be obvious (i.e. windows would pop up a dialogue to switch applications). 2. The underlying ssh protocol is filtering out the key combination or re-mapping it to a different combination which is not recognised by the remote program. This is most likely the issue in your case. The first thing I would do is have a look at the putty configuration and see if there are options to enable passing shift, altc, ctl combinations over ssh. It would also be worthwhile checking to see what the TERM variable is set to on the remote system when you ssh in as this can also affect what key combinations are recognised. Part of the problem here is that programs like putty 'reserve' some 'escape' keys (keys which can be entered that will be directed to putty rather than the underlying ssh channel to allow you to break out of the ssh session). Note that if your using Windows 10, it includes openSSH as a CLI. You don't need putty anymore. I would try using the CLI ssh command and see if that works any better. This might at least let you know if the issue is a putty issue or an underlying ssh issue - again helping to identify at what layer you need to focus to fix the issue. Getting all of this to work can be complicated. This is primarily because there are often multiple layers involved and getting the right settings may involve tweaks in multiple layers. It can be frustrating, but unfortunately, this is what happens when your working across different platforms and using interfaces designed in different eras. It took many years before keyboards became standardised. As Emacs was originally developed under a Unix system, it has some unusual terminology for keys (Alt, Meta, Hyper, Super), what can seem like inconsistencies (backspace v delete) and limitations on key combinations (original ASCII 8 bits limits number of keys which can be represented with a single key press). This also makes it nearly impossible to set a default which works across the board for everyone. finally, I would be very wary about stack overflow 'solutions'. There is a lot of outdated and incorrect information on SO. If you try a solution suggested there and it doesn't work, be very careful to ensure you undo the changes before trying something else. It is way too easy to spiral into disaster otherwise. Highly recommend you don't attempt a suggested solution if you don't understand how it works. Use it as a resource, but be critical and consider it as just a guide rather than a cut and paste solution. I've seen way too many people dig themselves into a deeper hole with SO.