From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felician Nemeth Newsgroups: gmane.emacs.bugs Subject: bug#47215: 28.0.50; Let M-x switch between M-x and M-X Date: Sun, 04 Apr 2021 19:51:17 +0200 Message-ID: <87k0pi546i.fsf@betli.tmit.bme.hu> References: <87tup91x6b.fsf@betli.tmit.bme.hu> <87tup9t5f6.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15498"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: Lars Ingebrigtsen To: 47215@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 04 19:52:11 2021 Return-path: Envelope-to: geb-bug-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 1lT6ux-0003wX-3t for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Apr 2021 19:52:11 +0200 Original-Received: from localhost ([::1]:34308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lT6uv-0007Mn-PO for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 04 Apr 2021 13:52:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT6un-0007MP-VS for bug-gnu-emacs@gnu.org; Sun, 04 Apr 2021 13:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lT6un-00088t-OS for bug-gnu-emacs@gnu.org; Sun, 04 Apr 2021 13:52:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lT6un-0002Ng-L1 for bug-gnu-emacs@gnu.org; Sun, 04 Apr 2021 13:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Felician Nemeth Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Apr 2021 17:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47215 X-GNU-PR-Package: emacs Original-Received: via spool by 47215-submit@debbugs.gnu.org id=B47215.16175586899110 (code B ref 47215); Sun, 04 Apr 2021 17:52:01 +0000 Original-Received: (at 47215) by debbugs.gnu.org; 4 Apr 2021 17:51:29 +0000 Original-Received: from localhost ([127.0.0.1]:36404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lT6uH-0002Mr-1n for submit@debbugs.gnu.org; Sun, 04 Apr 2021 13:51:29 -0400 Original-Received: from mail-ed1-f46.google.com ([209.85.208.46]:42683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lT6uD-0002Mc-91 for 47215@debbugs.gnu.org; Sun, 04 Apr 2021 13:51:27 -0400 Original-Received: by mail-ed1-f46.google.com with SMTP id l18so10421849edc.9 for <47215@debbugs.gnu.org>; Sun, 04 Apr 2021 10:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:face:mime-version; bh=u4mvo6a6IRZKTDou/5/5LP9MBYKE/QSLS5LPp0OVqOA=; b=D/gp8n3YfxU/twJ+xOvjCRCXTboipfcdn9u6R4kx0zORgkdHsuFpW+vN15fGXrEr+w cNuDKNH5yj+VeDnrtsLx42VXZPcdDCtpCil0o6r2It6xruApCnABW+YN/a6qOrDF3EQu M29nQi+OQwBsMEbB/kWzp4pHQw3FCeGWgWJigoFjr8NBh7ZRa1Vg4ku2MICDXQNw7qZj Tzd/jWzD+Fi8/QAOGRs/X4nbnvBJ5qBymbwNIy0nNmTp8hoSX7J0vtcqT0JUdaYfGphu baA7gjIzdpRZv3WL5t4kgxWxKOXzSGLrPUT/Xk/MX3WHPA/3IH8n7ldu8HxZ7gRAGGLA 5Diw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:face:mime-version; bh=u4mvo6a6IRZKTDou/5/5LP9MBYKE/QSLS5LPp0OVqOA=; b=JUo9FUAu6QX8yM8xJ9o/bUxJEfaGJEXF90PJMEmEnfWGkT+tPWUhTPjrRFWcjv9irZ uBxw/17/0VFAJ4rhQm6zkUnlLBeFZEzlW+5yEmBbRfpr0KMDcX8nNWM+yiBzWCCxmt08 PNzxL5Eb+l0u2VwtJ2WbmmF4KhhKluHK1tkQ15xwzURoSgUb2hm9Z4rFu2qnwbTsZCvo gTdxp6ebFqdAmp9xPnXeePRV0+cjH5zDiInXMPpIoljX7zMHhKgebM6sqg9D4tPPdOmt +S/JW9pGUS/TwVaGAPKZmXH0nkFAeD8HLplD1UBy1LWrUszdzfl10kgcWRnNES+yHWXp G2eg== X-Gm-Message-State: AOAM531rSlF2xDsy7SAxX1xYPSCeud7IGoH38BhbHFpXbUTXpSAmVkJP 9AVJ6iaWjkqblNIHBaur4bc= X-Google-Smtp-Source: ABdhPJxhNj6KkVNvpbnyXJG7/saH74q/aGpvAO6EgUKQimuHB8mz8cUzlIDxR10ckgmJP0w9fTT1Ew== X-Received: by 2002:aa7:c7c5:: with SMTP id o5mr26973065eds.31.1617558679398; Sun, 04 Apr 2021 10:51:19 -0700 (PDT) Original-Received: from betli.gmail.com (catv-89-135-146-28.catv.broadband.hu. [89.135.146.28]) by smtp.gmail.com with ESMTPSA id z9sm9335445edr.75.2021.04.04.10.51.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 04 Apr 2021 10:51:19 -0700 (PDT) In-Reply-To: <87tup9t5f6.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 18 Mar 2021 06:08:29 +0100") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/ //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA AAAASUVORK5CYII= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203550 Archived-At: >> I wish there was a convenient way to switch back and forth between >> execute-extended-command and execute-extended-command-for-buffer. I >> think M-x would be an ideal binding for this as it is easy to press and >> more useful than the current "Command attempted to use minibuffer while >> in minibuffer". >> >> I'd imagine this feature being somewhat analogous to how ido-find-file >> falls back to find-file after C-f. > > Yes, being able to move from `execute-extended-command-for-buffer' to > `execute-extended-command' makes sense, but I'm not sure the other > direction is as useful. And while there's only two of these commands > today, I think it's likely that (in the future) that we'll grow more of > these. I think cycling makes even more sense when there are more than two of these execute-extended-commands. Currently, going from `execute-extended-command' to `execute-extended-command-for-buffer' would be useful for me because I can type M-x M-x more easily than type M-X. > I'm not quite sure how to implement this, though -- we basically end up > in `completing-read', and `execute-extended-command-for-buffer' would > have to define an `M-x' binding there, I guess... and then somehow call > `read-extended-command' with the text already in the minibuffer. > > Anybody got an idea as to how to implement this without rewriting > `read-extended-command' completely? The execute-extended-commands have two undocumented optional arguments (command-name and typed). What are they used for? Anyway, following the fallback logic of `ido-find-file', I was able to rebind `M-x' and save the content of the minibuffer with a non-standard exit from `execute-extended-command'. Maybe the ugly code below can give ideas to someone more knowledgeable. (defun my-exit () (interactive) (throw 'cycle (cons 'cycle (minibuffer-contents)))) (let ((minibuffer-local-completion-map minibuffer-local-completion-map) ret) (define-key minibuffer-local-completion-map (kbd "M-x") 'my-exit) (setq ret (catch 'cycle (execute-extended-command nil))) (if (eq 'cycle (car ret)) (message "Should switch to M-X with %s" (cdr ret)) ret)) Thanks.