From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vladimir Nikishkin Newsgroups: gmane.emacs.devel Subject: Fwd: A TAB operation reform question. Date: Tue, 11 Oct 2022 10:37:06 +0800 Message-ID: <87mta3krsg.fsf@laptop.lockywolf.net> References: <87tu4blmf0.fsf@laptop.lockywolf.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29352"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.6; emacs 29.0.50 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 11 07:17:56 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oi7eO-0007QG-Ni for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 07:17:56 +0200 Original-Received: from localhost ([::1]:56694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oi7eN-0000HC-MG for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Oct 2022 01:17:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oi5D4-0007Ze-53 for emacs-devel@gnu.org; Mon, 10 Oct 2022 22:41:34 -0400 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:45755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oi5D2-0004w0-9f for emacs-devel@gnu.org; Mon, 10 Oct 2022 22:41:33 -0400 Original-Received: by mail-ed1-x529.google.com with SMTP id a67so8878559edf.12 for ; Mon, 10 Oct 2022 19:41:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:subject:to:from:user-agent:references :from:to:cc:subject:date:message-id:reply-to; bh=6xkR9MJn2fRGy2WCj86WIacijdUlshJvpXQ6dBEI4KA=; b=LqhdWBkJackuKudpH09zPpDjql80ljNSCdpAgz3jV/xqR1aVOv1zuopeRiYX6Rr4gN JFUkUnizLwxKEpj85HcD2OZiRxWZguLFcIS66sW6Hh94UmfeMaIQM0arkl6VaYc+uA4K GmCyzOsbtoGWHBiq1pNWo7Yf0VHB51h5DxWV8vJl2uPBJLGPFIjBNE4egjq41wCMdhJw N+6qX0G1Wgox5H0+SrGqXzgL9sFUYNi52DWjr4wXI4bJtYBmXEAyuKsXyUdeUB4vVv/J QEEG1cOFd99gPU32oSPGcIT9XbnTsPh2JI/GOcTyDKLSILJekF85mp6tXMVDUg9j8oj+ wLbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:to:from:user-agent:references :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6xkR9MJn2fRGy2WCj86WIacijdUlshJvpXQ6dBEI4KA=; b=qyDoRz4tkZXvcuW+gpryetYZBjSX7tF7aStkWzE0hwf+UG+3JpR4IwByOvxtTgeKdp Ef5BqmlJpoDhMS0b1Qsoa6D83Mp8FPYBTlM88Qk7dk6I4p7lO3Nuh4haMgWyvR1ORMYE n4x4H79AK7NYbE7HUvpmWDV8/MPOLNy8879R22edEmL3QxJN6Z/E6XVucinPnr7GtGBN 6lvw772muO0sFNWNf3ryz7blOyCE442QIMxbXNqXT2X0YJfrYHjDadQcTs0qw/kxEcHL rPWRWwHvZvv/e2V9gTL182J8cyypsAolBzSD2YuGsfNS4CsBi6Jh7NOJb1LQF7KCt7om ugNg== X-Gm-Message-State: ACrzQf1lRoJb+HRh1Q40WMoABFmA2qY23TrBmuPs2rRlMxaJu9Ktv+Dl 19aFCpYwyaQr3LC7wTt73+bZQCnWCkDxCQ== X-Google-Smtp-Source: AMsMyM4fkqWZMyR/9DBW/ua9mH7n8FjpFa8w7ym9t/APMrHFIDsZN6Q1QsTvItDOYDhWZFLiPEn3qA== X-Received: by 2002:a05:6402:350d:b0:45c:29d7:4f98 with SMTP id b13-20020a056402350d00b0045c29d74f98mr6313605edd.40.1665456090096; Mon, 10 Oct 2022 19:41:30 -0700 (PDT) Original-Received: from laptop.lockywolf.net ([240e:36c:d0f:7f00::18]) by smtp.gmail.com with ESMTPSA id z22-20020a17090655d600b0077826b92d99sm6228500ejp.12.2022.10.10.19.41.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 19:41:28 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=lockywolf@gmail.com; helo=mail-ed1-x529.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-Mailman-Approved-At: Tue, 11 Oct 2022 01:14:37 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297417 Archived-At: I am sorry for "forwarding" an email, but I initially thought that "help-gnu-emacs" would be more appropriate. But still, I would like to ask what Emacs developers think about this issue. Would it be possible to repurpose TAB from "sometimes TAB, sometimes indent, sometimes complete", to a more general-purpose dwim framework? Vladimir Nikishkin writes: > Hello, Emacs users and developers > > I would like to ask if a reform to the way TAB (C-i) works has been > considered? And if "yes", then how hard would it be to implement it? > > The motivation is the following: > > The way TAB works at the moment is peculiar. > > There is this "indent-for-tab-command", which either indents, or inserts > a tab-character, or completes... unless "tab-always-indent" is set to > some special value, but there are mode-specific > modename-tab-always-indent, but they are also sometimes ignored. Also, > org-mode overrides it with "org-cycle", and perhaps, other modes do too. > Also, "tab" is considered to be "the place somehow close to completion > functions", so M-C-i==M-TAB is "ispell-complete-word", and a lot of > other packages try to make their completion somehow close to TAB. > > This looks a bit like a mess, partly because TAB is almost universally > seen as a "dwim" entry point, but it is not officially so in Emacs. > > Could there be an alternative protocol? Could TAB be make a DWIM entry > point "officially"? > > In particular, could it be possible to make a "hard-switch" variable > "tab-always-inserts-tab", which would be the opposite of > "tab-always-indent", but simpler, and it would be possible to override > it in the major modes, thus making "c-tab-always-indent" unnecessary. > > If tab-always-inserts-tab is set to nil, TAB (for example) would be > looking in some customizable list of functions, say > "tab-dwim-list-functions", and run each function until some does not > return non-nil. The default list could be something like > (indent-if-possible indent-comment-if-possible hs-fold-if-possible > complete-if-possible insert-tab). > Using TAB with a prefix-argument would always insert a TAB. (which would > be an exception to the rule "default prefix argument is 4", but I think > it would be understandable.). > > This way, instead of rebinding tab to org-cycle, org-mode could prepend > "org-cycle" to this list, or make it the only member of the list, but > this would still allow the users to plug in custom dwim functions > further into the list, such as ispell-word (not completion), jump > between table cells, and such. -- Your sincerely, Vladimir Nikishkin (MiEr, lockywolf) (Laptop)