unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: 45412@debbugs.gnu.org, larsi@gnus.org, jidanni@jidanni.org,
	juri@linkov.net
Subject: bug#45412: File ... is large (... MiB), really open? (y)es or (n)o or (l)iterally
Date: Thu, 22 Apr 2021 13:04:28 +0300	[thread overview]
Message-ID: <83fsziprdf.fsf@gnu.org> (raw)
In-Reply-To: <m1a6prmgm1.fsf@yahoo.es> (bug-gnu-emacs@gnu.org)

> Date: Thu, 22 Apr 2021 00:12:54 +0200
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> -(defun read-multiple-choice (prompt choices)
> +(defun read-multiple-choice (prompt choices &optional help-string)
>    "Ask user a multiple choice question.
>  PROMPT should be a string that will be displayed as the prompt.
>  
> @@ -35,15 +35,18 @@ read-multiple-choice
>  be displayed while prompting (if there's room, it might be
>  shortened).  DESCRIPTION is an optional longer explanation that
>  will be displayed in a help buffer if the user requests more
> -help.
> +help.  This help description has a fixed format in columns, but
> +the user can control the text that is displayed and how it is
> +formatted with optional argument HELP-STRING.

This leaves it unsaid what HELP-STRING is (is it a string? a list? a
function? something else?) and how it is used by the function.

> +If the user enters `recenter', `scroll-up', or `scroll-down'
> +responses, perform the requested window recentering or scrolling
> +and ask again.  If the user enters `edit', a recursive edit is
> +started.

The last sentence (ab)uses the passive tense, and thus reads
awkwardly.  Can you reword not to use passive tense?

Also, how about saying what happens when the user exits the
recursive-edit?

> @@ -133,6 +136,10 @@ read-multiple-choice
>                    (ignore-errors (scroll-other-window)) t)
>                   ((eq answer 'scroll-other-window-down)
>                    (ignore-errors (scroll-other-window-down)) t)
> +                 ((eq answer 'edit)
> +                  (save-excursion
> +		    (save-window-excursion
> +		      (recursive-edit))))

It is customary to display an echo-area message when entering
recursive-edit, telling the user how to exit when done editing.

> -	    (setq wrong-char (not (memq tchar '(?? ?\C-h)))
> +	    (setq wrong-char (not (memq tchar '(?? help-char)))

What about F1?

> +              (if help-string
> +                  (with-help-window buf
> +                    (with-current-buffer buf
> +                      (insert help-string)))

Should this verify that HELP-STRING is a string?

> +---
> +** New help window when Emacs prompts before opening a large file.
> ++Press '?' or 'help-char' (by default, 'C-h') to display this new help window.

I think this should mention the situations where this happens.
"Opening large files" is not detailed enough: I suggest to mention a
couple of commands that trigger this, and perhaps also what is
considered a "large file".

>  (defun files--ask-user-about-large-file (size op-type filename offer-raw)
>    (let ((prompt (format "File %s is large (%s), really %s?"
>  		        (file-name-nondirectory filename)
>  		        (funcall byte-count-to-string-function size) op-type)))
>      (if (not offer-raw)
>          (if (y-or-n-p prompt) nil 'abort)
> -      (let* ((use-dialog (and (display-popup-menus-p)
> -                              last-input-event
> -	                      (listp last-nonmenu-event)
> -	                      use-dialog-box))
> +      (let* ((prompt (format "File %s is large (%s), really %s?"
> +		             (file-name-nondirectory filename)
> +		             (funcall byte-count-to-string-function size) op-type))
>               (choice
> -              (if use-dialog
> -                  (x-popup-dialog t `(,prompt
> -                                      ("Yes" . ?y)
> -                                      ("No" . ?n)
> -                                      ("Open literally" . ?l)))

Why are we losing the feature whereby we use GUI dialogs to ask the
question?  This sounds like a regression to me, at least for users who
use the mouse and menu-bar in preference to the keyboard.  And the doc
string still says we do support the dialogs.  Am I missing something?

Thanks.





  reply	other threads:[~2021-04-22 10:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 14:44 bug#45412: File ... is large (... MiB), really open? (y)es or (n)o or (l)iterally 積丹尼 Dan Jacobson
2020-12-25  1:00 ` Unknown
2020-12-25  1:29   ` 積丹尼 Dan Jacobson
2020-12-25  5:52   ` Lars Ingebrigtsen
2020-12-25  9:32     ` Juri Linkov
2021-04-10 22:32       ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-10 22:52         ` Juri Linkov
2021-04-11  7:03         ` Eli Zaretskii
2021-04-12  8:06         ` Lars Ingebrigtsen
2021-04-16 23:50           ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-17 11:44             ` Lars Ingebrigtsen
2021-04-21 22:12               ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-22 10:04                 ` Eli Zaretskii [this message]
2021-04-25 19:14                   ` Lars Ingebrigtsen
2021-04-25 21:23                     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-26  2:28                       ` Eli Zaretskii
2021-04-27  1:08                       ` Lars Ingebrigtsen
2021-05-05 23:10                         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-06  8:28                           ` Lars Ingebrigtsen
2021-05-06  8:30                           ` Eli Zaretskii
2021-05-07 14:11                             ` Eli Zaretskii
2021-05-08 11:37                               ` Lars Ingebrigtsen
2021-05-08 12:22                                 ` Eli Zaretskii
2021-05-09  9:57                                   ` Lars Ingebrigtsen
2021-05-09 10:04                                     ` Eli Zaretskii
2021-04-22 22:09                 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fsziprdf.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=45412@debbugs.gnu.org \
    --cc=jidanni@jidanni.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    --cc=mardani29@yahoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).