From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#50935: minibuffer-electric-default-mode interface Date: Mon, 4 Oct 2021 02:17:38 +0000 Message-ID: References: <87k0ixq6wt.fsf@mail.linkov.net> <87r1d285o4.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30229"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 50935@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 04 04:18: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 1mXDYQ-0007j2-OH for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 04 Oct 2021 04:18:11 +0200 Original-Received: from localhost ([::1]:35886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXDYO-0004AS-Jj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Oct 2021 22:18:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXDYI-0004AK-8x for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 22:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51856) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXDYI-0002ch-1k for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 22:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXDYH-0004ME-S6 for bug-gnu-emacs@gnu.org; Sun, 03 Oct 2021 22:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Oct 2021 02:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50935 X-GNU-PR-Package: emacs Original-Received: via spool by 50935-submit@debbugs.gnu.org id=B50935.163331386816731 (code B ref 50935); Mon, 04 Oct 2021 02:18:01 +0000 Original-Received: (at 50935) by debbugs.gnu.org; 4 Oct 2021 02:17:48 +0000 Original-Received: from localhost ([127.0.0.1]:35169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXDY4-0004Lm-A1 for submit@debbugs.gnu.org; Sun, 03 Oct 2021 22:17:48 -0400 Original-Received: from mail-pg1-f174.google.com ([209.85.215.174]:42914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXDY1-0004LY-Db for 50935@debbugs.gnu.org; Sun, 03 Oct 2021 22:17:46 -0400 Original-Received: by mail-pg1-f174.google.com with SMTP id 66so14681052pgc.9 for <50935@debbugs.gnu.org>; Sun, 03 Oct 2021 19:17:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=DlleW8GtF8a4XQwjOvqS6C2Xkw9uWI1rv/SlDgsO+WA=; b=oBsf/aIggKO0iApBuv/99GL7Wpluk0rl5tZABUDbAQ+quGGH/3JuxtmzqcREXUHhqz cqpy8CGpqu2aDGXkV2J3DQG3eHBIbpvdumXlu8S0DIH4AZa2tRrQvZ6A44ouDvbcT60p VJbKCGQ+b2Qq0+VIq5kCg1aEyvLWkxKzTaJ6aF3QLQoc9VlWc11l+asfKi9IyX8iNNxI 5KOdeZUjmcT7aRjH+x2JJF3XxV+kS+6sD8L2aa+JCSGemSpmCmTKocK8BXIGKQEtZKOx L9/zvmdY2c4eO7V4mI2IKSzdRfDWUaNwNNf9PQO3ZLSxL7XSgzOM3i3By6OOzipY121m HMAg== X-Gm-Message-State: AOAM532sAhEQc0qwFruxwdcbcj8AB/2yLQXSgSJXSTzwU63kphMWbOtZ Tn0QhD5/Gd+LaKo8nJQxIXtE31FUzJyNxDfDUwtiFHCh X-Google-Smtp-Source: ABdhPJxMu/531BgO2OQvjO+EmYaDVQgTWWtZd5+MAAQGljyoJZ7CL2m+Da72Jr65NCpPZYG+nEcYT66FAcPupKwy1ps= X-Received: by 2002:a63:4717:: with SMTP id u23mr8614042pga.359.1633313859387; Sun, 03 Oct 2021 19:17:39 -0700 (PDT) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 4 Oct 2021 02:17:38 +0000 In-Reply-To: <87r1d285o4.fsf@mail.linkov.net> 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:216322 Archived-At: Juri Linkov writes: > It seems it's too early to obsolete it. But maybe still > 'minibuffer-default-prompt-format' should be mentioned? > Since it's a user option supporting the same format (but in > a limited set of prompts) as 'minibuffer-electric-default-mode'. I guess we have this problem for many defcustoms, unless they are autoloaded, so for `minibuffer-eldef-shorten-default' we have that: - "Setting it to a non-nil value" using setq before the library is loaded will work. - "Setting it to a non-nil value" using setq after the library is loaded will *not* work, you must use customize. - You can only set it with customize after the library has been loaded. I think instead of documenting all that, we could just delete the reference to `minibuffer-eldef-shorten-default' from the manual, as it is the same thing as `minibuffer-default-prompt-format', just with a different interface. Of course, the latter is not yet perfect, but anywhere it isn't, that's just a bug, right? That option would look like the below diff. Another option is to just add a reference to 'minibuffer-default-prompt-format' without any deletions, basically accepting that the text is not perfect and move on. A third option is to add 'minibuffer-default-prompt-format' on emacs-28, but make the suggested deletion on master -- which give us more time to get `minibuffer-default-prompt-format' up to scrap. Thoughts? diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 6dcee3fa82..2581be30ba 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -41,11 +41,14 @@ Basic Minibuffer canceling the command asking for the argument (@pxref{Quitting}). @cindex default argument +@vindex minibuffer-default-prompt-format Sometimes, the prompt shows a @dfn{default argument}, inside parentheses before the colon. This default will be used as the argument if you just type @key{RET}. For example, commands that read buffer names usually show a buffer name as the default; you can type -@key{RET} to operate on that default buffer. +@key{RET} to operate on that default buffer. You can customize how +the default argument is shown with the user option +@code{minibuffer-default-prompt-format}. @cindex Minibuffer Electric Default mode @cindex mode, Minibuffer Electric Default @@ -55,11 +58,7 @@ Basic Minibuffer Emacs hides the default argument as soon as you modify the contents of the minibuffer (since typing @key{RET} would no longer submit that default). If you ever bring back the original minibuffer text, the -prompt again shows the default. Furthermore, if you change the -variable @code{minibuffer-eldef-shorten-default} to a non-@code{nil} -value, the default argument is displayed as @samp{[@var{default-arg}]} -instead of @samp{(default @var{default-arg})}, saving some screen -space. To enable this minor mode, type @kbd{M-x +prompt again shows the default. To enable this minor mode, type @kbd{M-x minibuffer-electric-default-mode}. Since the minibuffer appears in the echo area, it can conflict with diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el index f67ec353c8..039d0f8828 100644 --- a/lisp/minibuf-eldef.el +++ b/lisp/minibuf-eldef.el @@ -56,7 +56,9 @@ minibuffer-default--in-prompt-regexps ("\\( \\[.*\\]\\):? *\\'" 1)))) (defcustom minibuffer-eldef-shorten-default nil - "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts." + "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts. +This only takes effect if `minibuffer-electric-default-mode' is +active." :set (lambda (symbol value) (set-default symbol value) (setq-default minibuffer-default-in-prompt-regexps @@ -183,7 +185,9 @@ minibuffer-electric-default-mode the default when it's applicable -- that is, when hitting RET would yield the default value. If the user modifies the input such that hitting RET would enter a non-default value, the prompt -is modified to remove the default indication." +is modified to remove the default indication. + +See also the user option `minibuffer-eldef-shorten-default'." :global t :group 'minibuffer (if minibuffer-electric-default-mode