From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#12443: 24.2.50; Default values in the minibuffer prompt (fix inconsisntecy) Date: Tue, 25 Aug 2020 17:19:38 +0200 Message-ID: <87imd669dh.fsf@gnus.org> References: <871ui48di4.fsf@mail.jurta.org> <878se2aox0.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="31066"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Dani Moncayo , Stefan Monnier , 12443@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 25 17:20:12 2020 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 1kAak7-0007xA-EH for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 17:20:11 +0200 Original-Received: from localhost ([::1]:57124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAak6-0008Ku-GD for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 25 Aug 2020 11:20:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAajy-0008IT-FI for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 11:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAajy-0005XD-3G for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 11:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAajx-0007ZF-Rn for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2020 11:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2020 15:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12443 X-GNU-PR-Package: emacs Original-Received: via spool by 12443-submit@debbugs.gnu.org id=B12443.159836879329072 (code B ref 12443); Tue, 25 Aug 2020 15:20:01 +0000 Original-Received: (at 12443) by debbugs.gnu.org; 25 Aug 2020 15:19:53 +0000 Original-Received: from localhost ([127.0.0.1]:35687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAajp-0007Yp-9b for submit@debbugs.gnu.org; Tue, 25 Aug 2020 11:19:53 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:43008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAajn-0007Ya-DL for 12443@debbugs.gnu.org; Tue, 25 Aug 2020 11:19:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JYfSW0kv7OmYcLWf93SDS7Fi+fJZDPnOyGxd4gh8qyM=; b=poGu/8ELCgirAARY7gpfPALDJw 7H5tg+fddSNrESBTVeFmtsTsDKtncxtvgRu1vLVUlEbovTA6hvfNRSd3gVKSCys0SKyo2HuzaJlLu cT8B7qsnB4sOoidRzh7r6zpdIwaymJsiTBeL7WahZcR0Wi6xslpS3rOkG31JrJQ1J9eY=; Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAajc-00077W-F1; Tue, 25 Aug 2020 17:19:44 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAFVBMVEXQ8Pykzr/7/PPt 8s/f5a59k3P////3cTrHAAAAAWJLR0QGYWa4fQAAAAd0SU1FB+QIGQ8LDyR3I4cAAAGZSURBVDjL nZPBboMwDIbbSrvjEe6t091LnN0b2b0vGn7/V5mTEqBbpUm1EEL5+H87drLb/RP7breDDvb7vwQa /z+wvGATTYWIBI/RNeDjL7IoJD1VeCmxAZc78LGC5EzmwNnnDEhkyCzwTcmZzsC1AjOqv8L34QxV O4MonDyoug4x1XU+NnDLo/byXgATUWhABgWFaIpiZeS45FCdPvovxJElGrg0IKrgJ7MaqVg1ULxy 4lCAZwp+Bni2jkzi+qooKYTvIHphjc4ZiJ5WKzwByQCu7IPsCeRngDRacqD3A45jb6ApED+tXFc2 GG8Tepw3aCDlIfXcH/CkqkJ6bWDIWTkA4t6ADrqM9pTdFMgZKNMYZFGgkAS0HJ/WrOg4LYeBooGA +JbBEaVVURoZerOyAUdxS7lWp7WbEc/3CT4C5lJFORXTxsoax1cDanPWKa8Kiny30ly2sgIfE0l1 lFvSjcKWyIVag1gXNla20nlvp8Sn2yZ5TcIB65yELw9AYsA5jpvk9qPDJyAgUf8MPMar4OWwO7ze /VfiB8wrhoIKJgx3AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIwLTA4LTI1VDE1OjExOjE1KzAwOjAw m6b/BAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0wOC0yNVQxNToxMToxNSswMDowMOr7R7gAAAAA SUVORK5CYII= X-Now-Playing: Steve Hackett's _Voyage of the Acolyte_: "The Lovers" In-Reply-To: (Stefan Kangas's message of "Tue, 25 Aug 2020 05:55:44 -0700") 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:186306 Archived-At: Stefan Kangas writes: > How about taking it even further? Something along the lines of: > > (format-prompt PROMPT &optional DEFAULT) > > (format-prompt "Set bookmark" default) > => "Set bookmark [foobar]: " > > (format-prompt "Goto char") > => "Goto char: " > > (This would avoid having to always remember to use double formats like > above.) I like it. I just grepped for '(default %' just to see how this would look in practice. Most of them look good: diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 873d586ca1..5335855d6e 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -339,8 +339,7 @@ dired--mark-suffix-interactive-spec ('(16) (let* ((dflt (char-to-string dired-marker-char)) (input (read-string - (format - "Marker character to use (default %s): " dflt) + (format-prompt "Marker character to use" dflt) nil nil dflt))) (aref input 0))) (_ dired-marker-char)))) diff --git a/lisp/frame.el b/lisp/frame.el index 081d3010e9..d9e49d50ba 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -760,7 +760,7 @@ close-display-connection (list (let* ((default (frame-parameter nil 'display)) (display (completing-read - (format "Close display (default %s): " default) + (format-prompt "Close display" default) (delete-dups (mapcar (lambda (frame) (frame-parameter frame 'display)) However, there's things like: (setq from-coding (read-coding-system (format "Recode filename %s from (default %s): " filename default-coding) default-coding)) These are surprisingly rare, but, uhm... perhaps format-prompt could take a format string? The function would then look like: (defun format-prompt (prompt default &rest format-args) ) where it would call `format' on PROMPT and FORMAT-ARGS. So that would then be: (setq from-coding (read-coding-system (format-prompt "Recode filename %s" default-coding filename) default-coding)) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no