From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#45412: File ... is large (... MiB), really open? (y)es or (n)o or (l)iterally Date: Sun, 11 Apr 2021 10:03:24 +0300 Message-ID: <83y2dp481v.fsf@gnu.org> References: <87k0t72rhd.5.fsf@jidanni.org> <8735zuig9m.fsf@gnus.org> <87wnx62rpe.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38123"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45412@debbugs.gnu.org, larsi@gnus.org, juri@linkov.net, jidanni@jidanni.org To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 11 09:04:12 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 1lVU8h-0009nK-Sb for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Apr 2021 09:04:11 +0200 Original-Received: from localhost ([::1]:38464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVU8g-00024Y-Ce for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Apr 2021 03:04:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVU8Y-00024O-VX for bug-gnu-emacs@gnu.org; Sun, 11 Apr 2021 03:04:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVU8Y-0004Vo-O0 for bug-gnu-emacs@gnu.org; Sun, 11 Apr 2021 03:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVU8Y-0001HZ-JE for bug-gnu-emacs@gnu.org; Sun, 11 Apr 2021 03:04:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Apr 2021 07:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45412 X-GNU-PR-Package: emacs Original-Received: via spool by 45412-submit@debbugs.gnu.org id=B45412.16181246334914 (code B ref 45412); Sun, 11 Apr 2021 07:04:02 +0000 Original-Received: (at 45412) by debbugs.gnu.org; 11 Apr 2021 07:03:53 +0000 Original-Received: from localhost ([127.0.0.1]:53866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVU8P-0001HB-Au for submit@debbugs.gnu.org; Sun, 11 Apr 2021 03:03:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40932) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVU8O-0001Gz-1D for 45412@debbugs.gnu.org; Sun, 11 Apr 2021 03:03:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58076) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVU8I-0004La-2U; Sun, 11 Apr 2021 03:03:46 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1601 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lVU8H-0005CI-DW; Sun, 11 Apr 2021 03:03:45 -0400 In-Reply-To: (bug-gnu-emacs@gnu.org) 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:203828 Archived-At: > Cc: 45412@debbugs.gnu.org, Lars Ingebrigtsen , > 積丹尼 Dan Jacobson > Date: Sun, 11 Apr 2021 00:32:34 +0200 > From: Daniel Martín via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > >>> Another approach could be to offer a C-h binding that opens a help > >>> window that describes the possible options and briefly links to the > >>> customization entry point that removes the prompt permanently. > >> > >> Yeah, that sounds like a good idea. > > > > I agree, this is really the best idea. > > OK, I've implemented it in the attached patch. Suggestions > welcome. Thanks, see below for some comments. > +--- > +** When Emacs prompts before opening a large file, a new help window > +has been added. This help window describes the available options and > +how to disable the prompt by customizing the > +'large-file-warning-threshold' variable. This should mention the C-h key which triggers the help display: IMO that's the most important piece of information users should know about the new feature. NEWS is visited in Outline mode, so each entry should have a heading line which is a complete sentence with a concise description of the change. > + > > * Editing Changes in Emacs 28.1 > > diff --git a/lisp/files.el b/lisp/files.el > index 60d6034011..49224e4b1e 100644 > --- a/lisp/files.el > +++ b/lisp/files.el > @@ -2123,28 +2123,62 @@ out-of-memory-warning-percentage > > (declare-function x-popup-dialog "menu.c" (position contents &optional header)) > > +(defun files--ask-user-about-large-file-help (op-type size) > + "Show a buffer explaining the options to open large files in Emacs." > + (with-output-to-temp-buffer "*Help*" > + (with-current-buffer standard-output > + (insert > + (format > + "The file that you want to %s is large (%s). I suggest to say here what is the threshold above which Emacs asks the question (because users may wish to customize it, as mentioned below). > +You can press ‘y‘ to open the file. Press 'y' to open the file. And please also use our style of quoting in documentation and strings, 'like this'. > +You can press ‘n‘ to abort. This should explain what "abort" means in this case. > +You can press ‘l‘ to open the file literally, which means that Suggest to say "(the letter ell)" here, to avoid confusion with the digit 1. Also, the text says literally "open", but the function actually accepts an argument that describes the operation, which could be something else. > +Emacs will open the file without doing any format or character code > +conversion and in Fundamental mode, without loading any potentially > +expensive feature. ^^^^^^^ "features", in plural. > +You can customize the option ‘large-file-warning-threshold‘ to be ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Quoting style again. Please quote `like this' here, so that Emacs creates a hyperlink to the variable's doc. > +the file size, in bytes, from which Emacs will ask for > +confirmation. Set it to ‘nil‘ to never request We don't quote nil and t in this context. > + (if use-dialog > + (setq choice (x-popup-dialog t `(,prompt > + ("Yes" . ?y) > + ("No" . ?n) > + ("Open literally" . ?l)))) A literal "Open" again. Also, don't we want to add a Help option to the dialog? If not, why not? > + (while (null choice) > + (setq choice (read-char-choice > + (concat prompt " (y)es, (n)o, (l)iterally, (?)") > + '(?y ?Y ?n ?N ?l ?L ?? ?\C-h))) > + (when (memq choice '(?? ?\C-h)) Why only ? or C-h? What about F1? what about the case that help-char is something else?