* bug#5423: Multiline y-or-n prompt in files.el @ 2010-01-19 13:51 Stefan Monnier 2010-01-19 14:12 ` Lennart Borgman ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Stefan Monnier @ 2010-01-19 13:51 UTC (permalink / raw) To: bug-gnu-emacs Package: Emacs Version: 23.1.91 find-file-noselect has a multiline y-or-n-p prompt if the file is already visited and modified (and in a different rawness). That only works when the minibuffer can be resized, sadly. In my case (separate minibuffer), I only see the beginning of the prompt. Stefan In GNU Emacs 23.1.91.1 (i686-pc-linux-gnu, GTK+ Version 2.18.3) of 2010-01-17 on ceviche Windowing system distributor `The X.Org Foundation', version 11.0.10704000 configured using `configure 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O1 -I/usr/include/GNUstep' 'LDFLAGS=-L/home/monnier/src/Xaw3d' 'CPPFLAGS=-I/home/monnier/src/Xaw3d'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: fr_CH.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Minibuffer-Area Minor modes in effect: diff-auto-refine-mode: t url-handler-mode: t global-reveal-mode: t reveal-mode: t auto-insert-mode: t savehist-mode: t minibuffer-electric-default-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-y <backspace> C-x C-s M-x M-p <return> C-x C-k <return> C-g C-x k <return> M-x M-p <return> C-x k <return> C-h f r m a <tab> <return> <switch-frame> <switch-frame> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> C-x k <return> M-x r m a <tab> <tab> - <tab> b u f <tab> <backspace> <backspace> <backspace> <tab> C-g C-h f r m a <tab> <return> <switch-frame> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <switch-frame> <select-window> <switch-frame> <help-echo> <switch-frame> <switch-frame> C-x C-c C-u M-x M-p <return> M-p <return> <right> C-g <C-down-mouse-3> <options> <debug-on-quit> C-u M-x M-p <return> M-p <return> C-g <select-window> <switch-frame> <switch-frame> <help-echo> <down-mouse-1> <mouse-2> C-c @ C-a <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> C-s , \ n C-a C-s a l r e a s y <backspace> <backspace> d y C-r C-r C-r C-r C-r C-r C-r C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s <switch-frame> <switch-frame> C-a C-s i s SPC a l r e a d y SPC v i s i C-a <C-left> <right> <up> <left> <right> <down> <left> <right> <down> <left> <right> <up> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <up> <up> <left> <right> <up> <left> <right> <up> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <down> <left> <right> <up> <left> <right> <help-echo> <switch-frame> <switch-frame> <select-window> M-x r e p o - e m - b u <tab> <return> Recent messages: Quit Debug on Quit enabled globally The file TP1-plans is already visited literally, meaning no coding system decoding, format conversion, or local variables. You have asked to visit it normally, but Emacs can only visit a file in one way at a time. Do you want to revisit the file normally now? (y or n) Entering debugger... Mark saved where search started [3 times] Load-path shadows: /usr/share/emacs23/site-lisp/bbdb/bbdb-com hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-com /usr/share/emacs23/site-lisp/bbdb/bbdb-ftp hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-ftp /usr/share/emacs23/site-lisp/bbdb/bbdb-rmail hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-rmail /usr/share/emacs23/site-lisp/bbdb/bbdb-mhe hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-mhe /usr/share/emacs23/site-lisp/bbdb/bbdb-gui hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gui /usr/share/emacs23/site-lisp/bbdb/bbdb-print hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-print /usr/share/emacs23/site-lisp/bbdb/bbdb hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb /usr/share/emacs23/site-lisp/bbdb/bbdb-w3 hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-w3 /usr/share/emacs23/site-lisp/bbdb/bbdb-sc hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-sc /usr/share/emacs23/site-lisp/bbdb/bbdb-whois hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-whois /usr/share/emacs23/site-lisp/bbdb/bbdb-snarf hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-snarf /usr/share/emacs23/site-lisp/bbdb/bbdb-merge hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-merge /usr/share/emacs23/site-lisp/bbdb/bbdb-vm hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-vm /usr/share/emacs23/site-lisp/bbdb/bbdb-migrate hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-migrate /usr/share/emacs23/site-lisp/bbdb/bbdb-gnus hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gnus /usr/share/emacs23/site-lisp/bbdb/bbdb-hooks hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-hooks Features: (shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date gmm-utils wid-edit mailheader canlock hashcash emacsbug cus-start cus-load edmacro kmacro speedbar sb-image ezimage dframe assoc find-func rmail mail-utils debug executable copyright smerge-mode multi-isearch vc-bzr sha1 hex-util filecache diff-mode server noutline outline easy-mmode flyspell ispell eldoc checkdoc regexp-opt thingatpt help-mode easymenu view url-handlers url-parse url-vars mm-util mail-prsvr reveal autoinsert uniquify advice help-fns advice-preload savehist minibuf-eldef cl cl-19 cl-loaddefs proof-site proof-autoloads pg-vars bbdb-autoloads agda2 tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page newcomment menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 13:51 bug#5423: Multiline y-or-n prompt in files.el Stefan Monnier @ 2010-01-19 14:12 ` Lennart Borgman 2010-01-19 14:56 ` Helmut Eller ` (2 more replies) 2010-01-20 1:59 ` bug#5423: Multiline y-or-n prompt in files.el Juri Linkov 2020-11-19 2:51 ` Stefan Kangas 2 siblings, 3 replies; 18+ messages in thread From: Lennart Borgman @ 2010-01-19 14:12 UTC (permalink / raw) To: Stefan Monnier, 5423; +Cc: bug-gnu-emacs On Tue, Jan 19, 2010 at 2:51 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote: > Package: Emacs > Version: 23.1.91 > > find-file-noselect has a multiline y-or-n-p prompt if the file is > already visited and modified (and in a different rawness). That only > works when the minibuffer can be resized, sadly. In my case (separate > minibuffer), I only see the beginning of the prompt. Is not the right fix to allow minibuffer resizing even when the minibuffer frame is separate? I have never heard of the problem with resizing the minibuffer. Is that documented somewhere? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 14:12 ` Lennart Borgman @ 2010-01-19 14:56 ` Helmut Eller 2010-01-19 15:17 ` Lennart Borgman 2010-01-19 15:35 ` Drew Adams 2010-01-19 19:02 ` broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] Glenn Morris 2 siblings, 1 reply; 18+ messages in thread From: Helmut Eller @ 2010-01-19 14:56 UTC (permalink / raw) To: bug-gnu-emacs * Lennart Borgman [2010-01-19 15:12+0100] writes: > Is not the right fix to allow minibuffer resizing even when the > minibuffer frame is separate? > > I have never heard of the problem with resizing the minibuffer. Is > that documented somewhere? There is the variable resize-mini-windows. I set that to nil and multiline messages are very annoying. Helmut ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 14:56 ` Helmut Eller @ 2010-01-19 15:17 ` Lennart Borgman 0 siblings, 0 replies; 18+ messages in thread From: Lennart Borgman @ 2010-01-19 15:17 UTC (permalink / raw) To: Helmut Eller; +Cc: bug-gnu-emacs On Tue, Jan 19, 2010 at 3:56 PM, Helmut Eller <eller.helmut@gmail.com> wrote: > * Lennart Borgman [2010-01-19 15:12+0100] writes: > >> Is not the right fix to allow minibuffer resizing even when the >> minibuffer frame is separate? >> >> I have never heard of the problem with resizing the minibuffer. Is >> that documented somewhere? > > There is the variable resize-mini-windows. I set that to nil and > multiline messages are very annoying. I can agreee multiline message are annoying, but I do not find multiline prompts annoying. It seems a bit wrong that they are coupled to each other. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 14:12 ` Lennart Borgman 2010-01-19 14:56 ` Helmut Eller @ 2010-01-19 15:35 ` Drew Adams 2010-01-19 19:02 ` broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] Glenn Morris 2 siblings, 0 replies; 18+ messages in thread From: Drew Adams @ 2010-01-19 15:35 UTC (permalink / raw) To: 'Lennart Borgman', 'Stefan Monnier', 5423; +Cc: bug-gnu-emacs > Is not the right fix to allow minibuffer resizing even when the > minibuffer frame is separate? > > I have never heard of the problem with resizing the minibuffer. Is > that documented somewhere? Please, _no_. A standalone minibuffer frame's size and its other defined qualities should be respected. Respect the user. ^ permalink raw reply [flat|nested] 18+ messages in thread
* broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] 2010-01-19 14:12 ` Lennart Borgman 2010-01-19 14:56 ` Helmut Eller 2010-01-19 15:35 ` Drew Adams @ 2010-01-19 19:02 ` Glenn Morris 2010-01-20 2:35 ` Stephen J. Turnbull 2 siblings, 1 reply; 18+ messages in thread From: Glenn Morris @ 2010-01-19 19:02 UTC (permalink / raw) To: Lennart Borgman; +Cc: emacs-devel Hello, you appear to be using a broken mail client that does not respect the Mail-Followup-To header. Please could you try and fix it. Thanks. ^ permalink raw reply [flat|nested] 18+ messages in thread
* broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] 2010-01-19 19:02 ` broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] Glenn Morris @ 2010-01-20 2:35 ` Stephen J. Turnbull 2010-01-22 21:02 ` broken mail-client Glenn Morris 0 siblings, 1 reply; 18+ messages in thread From: Stephen J. Turnbull @ 2010-01-20 2:35 UTC (permalink / raw) To: Glenn Morris; +Cc: Lennart Borgman, emacs-devel Glenn Morris writes: > Hello, you appear to be using a broken mail client that does not > respect the Mail-Followup-To header. Please could you try and fix it. > Thanks. Last time I checked, that's a news header (the switch-protocol aspect is part of why "Mail" is prefixed). I don't exactly know why the IETF has been unable to standardize this for mail, but there you have it. Nothing wrong with asking for the feature of course (it's a good one), but I would suggest retracting the words "broken" and "fix", and saying "*pretty* please." ^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: broken mail-client 2010-01-20 2:35 ` Stephen J. Turnbull @ 2010-01-22 21:02 ` Glenn Morris 0 siblings, 0 replies; 18+ messages in thread From: Glenn Morris @ 2010-01-22 21:02 UTC (permalink / raw) To: Stephen J. Turnbull; +Cc: Lennart Borgman, emacs-devel I don't know how a sane mail client can look at a message: From: A To: B Mail-Followup-To: A,C and construct a reply that goes: To: A,C Cc: B Either ignore MFT or respect it, don't do a bit of both. Anyway, never mind. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 13:51 bug#5423: Multiline y-or-n prompt in files.el Stefan Monnier 2010-01-19 14:12 ` Lennart Borgman @ 2010-01-20 1:59 ` Juri Linkov 2010-01-20 2:52 ` Lennart Borgman 2020-11-19 2:51 ` Stefan Kangas 2 siblings, 1 reply; 18+ messages in thread From: Juri Linkov @ 2010-01-20 1:59 UTC (permalink / raw) To: Stefan Monnier; +Cc: 5423 > find-file-noselect has a multiline y-or-n-p prompt if the file is > already visited and modified (and in a different rawness). That only > works when the minibuffer can be resized, sadly. In my case (separate > minibuffer), I only see the beginning of the prompt. I think multiline text should be displayed in a separate window above the minibuffer. I guess this configuration will also work for the case where the minibuffer is displayed in a separate frame. -- Juri Linkov http://www.jurta.org/emacs/ ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-20 1:59 ` bug#5423: Multiline y-or-n prompt in files.el Juri Linkov @ 2010-01-20 2:52 ` Lennart Borgman 0 siblings, 0 replies; 18+ messages in thread From: Lennart Borgman @ 2010-01-20 2:52 UTC (permalink / raw) To: Juri Linkov; +Cc: 5423 On Wed, Jan 20, 2010 at 2:59 AM, Juri Linkov <juri@jurta.org> wrote: >> find-file-noselect has a multiline y-or-n-p prompt if the file is >> already visited and modified (and in a different rawness). That only >> works when the minibuffer can be resized, sadly. In my case (separate >> minibuffer), I only see the beginning of the prompt. > > I think multiline text should be displayed in a separate window > above the minibuffer. I guess this configuration will also work > for the case where the minibuffer is displayed in a separate frame. That sounds a bit strange to me, but maybe I am misunderstanding something? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2010-01-19 13:51 bug#5423: Multiline y-or-n prompt in files.el Stefan Monnier 2010-01-19 14:12 ` Lennart Borgman 2010-01-20 1:59 ` bug#5423: Multiline y-or-n prompt in files.el Juri Linkov @ 2020-11-19 2:51 ` Stefan Kangas 2020-11-19 5:15 ` Stefan Monnier 2 siblings, 1 reply; 18+ messages in thread From: Stefan Kangas @ 2020-11-19 2:51 UTC (permalink / raw) To: Stefan Monnier; +Cc: 5423 Stefan Monnier <monnier@IRO.UMontreal.CA> writes: > Package: Emacs > Version: 23.1.91 > > find-file-noselect has a multiline y-or-n-p prompt if the file is > already visited and modified (and in a different rawness). That only > works when the minibuffer can be resized, sadly. In my case (separate > minibuffer), I only see the beginning of the prompt. That was 10 years ago, so just to check in: is this still an issue? (We normally check in once a decade to verify that no bug has been unduly fixed. ;-) ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-19 2:51 ` Stefan Kangas @ 2020-11-19 5:15 ` Stefan Monnier 2020-11-19 9:33 ` Stephen Berman 0 siblings, 1 reply; 18+ messages in thread From: Stefan Monnier @ 2020-11-19 5:15 UTC (permalink / raw) To: Stefan Kangas; +Cc: 5423 >> find-file-noselect has a multiline y-or-n-p prompt if the file is >> already visited and modified (and in a different rawness). That only >> works when the minibuffer can be resized, sadly. In my case (separate >> minibuffer), I only see the beginning of the prompt. > > That was 10 years ago, so just to check in: is this still an issue? I'd be surprised if it's been fixed, but I must admit that I can't remember how to trigger this, Stefan ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-19 5:15 ` Stefan Monnier @ 2020-11-19 9:33 ` Stephen Berman 2020-11-19 10:03 ` martin rudalics ` (2 more replies) 0 siblings, 3 replies; 18+ messages in thread From: Stephen Berman @ 2020-11-19 9:33 UTC (permalink / raw) To: Stefan Monnier; +Cc: Stefan Kangas, 5423 On Thu, 19 Nov 2020 00:15:04 -0500 Stefan Monnier <monnier@iro.umontreal.ca> wrote: >>> find-file-noselect has a multiline y-or-n-p prompt if the file is >>> already visited and modified (and in a different rawness). That only >>> works when the minibuffer can be resized, sadly. In my case (separate >>> minibuffer), I only see the beginning of the prompt. >> >> That was 10 years ago, so just to check in: is this still an issue? > > I'd be surprised if it's been fixed, but I must admit that I can't > remember how to trigger this, I'm not sure just what you meant with "beginning of the prompt", but what I see is only the last line of the entire prompt message: "The file test is already visited literally, meaning no coding system handling, format conversion, or local variables. You have edited the buffer. Now you have asked to visit the file normally, but Emacs can visit a file in only one way at a time. Do you want to save the file, and visit it normally instead? " To reproduce: $ touch /tmp/test $ emacs -Q --eval "(setq resize-mini-windows nil)" /tmp/test M-x find-file-literally RET /tmp/test RET => The minibuffer displays only: Do you want to save the file, and visit it literally instead? (y or no) By repeatedly typing `C-p' you can see the entire message line by line. Tested on current master. (There also seems to be another separate bug: that with the above recipe the prompt message seems inappropriate.) Steve Berman ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-19 9:33 ` Stephen Berman @ 2020-11-19 10:03 ` martin rudalics 2020-11-19 14:47 ` Eli Zaretskii 2020-11-20 8:30 ` Juri Linkov 2 siblings, 0 replies; 18+ messages in thread From: martin rudalics @ 2020-11-19 10:03 UTC (permalink / raw) To: Stephen Berman, Stefan Monnier; +Cc: Stefan Kangas, 5423 > I'm not sure just what you meant with "beginning of the prompt", but > what I see is only the last line of the entire prompt message: > "The file test is already visited literally, > meaning no coding system handling, format conversion, or local variables. > You have edited the buffer. Now you have asked to visit the file normally, > but Emacs can visit a file in only one way at a time. > > Do you want to save the file, and visit it normally instead? " Why can't that prompt just say "File's buffer modified, save it and visit file normally afterwards?" martin ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-19 9:33 ` Stephen Berman 2020-11-19 10:03 ` martin rudalics @ 2020-11-19 14:47 ` Eli Zaretskii 2020-11-20 8:30 ` Juri Linkov 2 siblings, 0 replies; 18+ messages in thread From: Eli Zaretskii @ 2020-11-19 14:47 UTC (permalink / raw) To: Stephen Berman; +Cc: stefan, 5423, monnier > From: Stephen Berman <stephen.berman@gmx.net> > Date: Thu, 19 Nov 2020 10:33:28 +0100 > Cc: Stefan Kangas <stefan@marxist.se>, 5423@debbugs.gnu.org > > $ touch /tmp/test > $ emacs -Q --eval "(setq resize-mini-windows nil)" /tmp/test > M-x find-file-literally RET /tmp/test RET > => The minibuffer displays only: > Do you want to save the file, and visit it literally instead? (y or no) The original report didn't say anything about setting resize-mini-windows to nil. In fact, the original report didn't provide any details to explain why a separate minibuffer frame doesn't have enough space to display several lines of text. So I think we don't have a clear understanding of the problem, and should request details. ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-19 9:33 ` Stephen Berman 2020-11-19 10:03 ` martin rudalics 2020-11-19 14:47 ` Eli Zaretskii @ 2020-11-20 8:30 ` Juri Linkov 2020-11-21 19:50 ` Juri Linkov 2 siblings, 1 reply; 18+ messages in thread From: Juri Linkov @ 2020-11-20 8:30 UTC (permalink / raw) To: Stephen Berman; +Cc: Stefan Kangas, 5423, Stefan Monnier [-- Attachment #1: Type: text/plain, Size: 446 bytes --] > $ touch /tmp/test > $ emacs -Q --eval "(setq resize-mini-windows nil)" /tmp/test > M-x find-file-literally RET /tmp/test RET > => The minibuffer displays only: > Do you want to save the file, and visit it literally instead? (y or no) Exactly like a week ago in bug#42708 we added support for C-h to read-char-from-minibuffer used by dired-query with help-form, this patch does the same for y-or-n-p used by find-file-noselect with help-form: [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: y-or-n-p-help-form.patch --] [-- Type: text/x-diff, Size: 5433 bytes --] diff --git a/lisp/files.el b/lisp/files.el index 3565b7f571..b61bbc05ad 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2310,22 +2310,27 @@ find-file-noselect ;; hexl-mode or image-mode. (memq major-mode '(hexl-mode image-mode))) (if (buffer-modified-p) - (if (y-or-n-p - (format - (if rawfile - "The file %s is already visited normally, + (if (let ((help-form + (format-message + (if rawfile "\ +The file %s is already visited normally, and you have edited the buffer. Now you have asked to visit it literally, meaning no coding system handling, format conversion, or local variables. -Emacs can visit a file in only one way at a time. - -Do you want to save the file, and visit it literally instead? " - "The file %s is already visited literally, +Emacs can visit a file in only one way at a time." + "\ +The file %s is already visited literally, meaning no coding system handling, format conversion, or local variables. You have edited the buffer. Now you have asked to visit the file normally, -but Emacs can visit a file in only one way at a time. - +but Emacs can visit a file in only one way at a time.") + (file-name-nondirectory filename)))) + (y-or-n-p + (format + (if rawfile + "\ +Do you want to save the file, and visit it literally instead? " + "\ Do you want to save the file, and visit it normally instead? ") - (file-name-nondirectory filename))) + (file-name-nondirectory filename)))) (progn (save-buffer) (find-file-noselect-1 buf filename nowarn @@ -2341,22 +2346,27 @@ find-file-noselect rawfile truename number) (error (if rawfile "File already visited non-literally" "File already visited literally")))) - (if (y-or-n-p - (format - (if rawfile - "The file %s is already visited normally. + (if (let ((help-form + (format-message + (if rawfile "\ +The file %s is already visited normally. You have asked to visit it literally, meaning no coding system decoding, format conversion, or local variables. -But Emacs can visit a file in only one way at a time. - -Do you want to revisit the file literally now? " - "The file %s is already visited literally, +But Emacs can visit a file in only one way at a time." + "\ +The file %s is already visited literally, meaning no coding system decoding, format conversion, or local variables. You have asked to visit it normally, -but Emacs can visit a file in only one way at a time. - +but Emacs can visit a file in only one way at a time.") + (file-name-nondirectory filename)))) + (y-or-n-p + (format + (if rawfile + "\ +Do you want to revisit the file literally now? " + "\ Do you want to revisit the file normally now? ") - (file-name-nondirectory filename))) + (file-name-nondirectory filename)))) (find-file-noselect-1 buf filename nowarn rawfile truename number) (error (if rawfile "File already visited non-literally" diff --git a/lisp/subr.el b/lisp/subr.el index d437e14501..d02a3611e0 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2902,7 +2902,13 @@ y-or-n-p (concat prompt (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) "" " ") - (if dialog "" "(y or n) ")))))) + (if dialog "" + (if help-form + (format "(y, n or %s) " + (key-description + (vector help-char))) + "(y or n) " + ))))))) (cond (noninteractive (setq prompt (funcall padded prompt)) @@ -2911,6 +2917,7 @@ y-or-n-p (let ((str (read-string temp-prompt))) (cond ((member str '("y" "Y")) (setq answer 'act)) ((member str '("n" "N")) (setq answer 'skip)) + ((and (member str '("h" "H")) help-form) (print help-form)) (t (setq temp-prompt (concat "Please answer y or n. " prompt)))))))) ((and (display-popup-menus-p) @@ -2923,10 +2930,18 @@ y-or-n-p (setq prompt (funcall padded prompt)) (let* ((empty-history '()) (enable-recursive-minibuffers t) + (msg help-form) + (keymap (let ((map (make-composed-keymap + y-or-n-p-map query-replace-map))) + (when help-form + (define-key map (vector help-char) + (lambda () + (interactive) + (let ((help-form msg)) ; lexically bound msg + (help-form-show))))) + map)) (str (read-from-minibuffer - prompt nil - (make-composed-keymap y-or-n-p-map query-replace-map) - nil + prompt nil keymap nil (or y-or-n-p-history-variable 'empty-history)))) (setq answer (if (member str '("y" "Y")) 'act 'skip))))) (let ((ret (eq answer 'act))) ^ permalink raw reply related [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-20 8:30 ` Juri Linkov @ 2020-11-21 19:50 ` Juri Linkov 2020-11-21 21:23 ` Stefan Monnier 0 siblings, 1 reply; 18+ messages in thread From: Juri Linkov @ 2020-11-21 19:50 UTC (permalink / raw) To: Stefan Monnier; +Cc: Stefan Kangas, Stephen Berman, 5423 >> $ touch /tmp/test >> $ emacs -Q --eval "(setq resize-mini-windows nil)" /tmp/test >> M-x find-file-literally RET /tmp/test RET >> => The minibuffer displays only: >> Do you want to save the file, and visit it literally instead? (y or no) > > Exactly like a week ago in bug#42708 we added support for C-h to > read-char-from-minibuffer used by dired-query with help-form, > this patch does the same for y-or-n-p used by find-file-noselect > with help-form: Pushed to master, but I don't know if this bug report can be closed now? ^ permalink raw reply [flat|nested] 18+ messages in thread
* bug#5423: Multiline y-or-n prompt in files.el 2020-11-21 19:50 ` Juri Linkov @ 2020-11-21 21:23 ` Stefan Monnier 0 siblings, 0 replies; 18+ messages in thread From: Stefan Monnier @ 2020-11-21 21:23 UTC (permalink / raw) To: Juri Linkov; +Cc: Stefan Kangas, Stephen Berman, 5423-done > Pushed to master, Thanks, this is even better than just fixing the original problem. > but I don't know if this bug report can be closed now? I think it can, Stefan ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-11-21 21:23 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-01-19 13:51 bug#5423: Multiline y-or-n prompt in files.el Stefan Monnier 2010-01-19 14:12 ` Lennart Borgman 2010-01-19 14:56 ` Helmut Eller 2010-01-19 15:17 ` Lennart Borgman 2010-01-19 15:35 ` Drew Adams 2010-01-19 19:02 ` broken mail-client [was Re: bug#5423: Multiline y-or-n prompt in files.el] Glenn Morris 2010-01-20 2:35 ` Stephen J. Turnbull 2010-01-22 21:02 ` broken mail-client Glenn Morris 2010-01-20 1:59 ` bug#5423: Multiline y-or-n prompt in files.el Juri Linkov 2010-01-20 2:52 ` Lennart Borgman 2020-11-19 2:51 ` Stefan Kangas 2020-11-19 5:15 ` Stefan Monnier 2020-11-19 9:33 ` Stephen Berman 2020-11-19 10:03 ` martin rudalics 2020-11-19 14:47 ` Eli Zaretskii 2020-11-20 8:30 ` Juri Linkov 2020-11-21 19:50 ` Juri Linkov 2020-11-21 21:23 ` Stefan Monnier
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.