From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Unable to scroll from y-or-n-p prompt Date: Tue, 26 Jun 2012 07:54:43 -0700 Message-ID: <910E8B50016B43749AAB700663140FC4@us.oracle.com> References: <87txxyiltq.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340722512 13544 80.91.229.3 (26 Jun 2012 14:55:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jun 2012 14:55:12 +0000 (UTC) To: "'John Wiegley'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 26 16:55:12 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SjXAd-0000pA-Ev for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2012 16:55:11 +0200 Original-Received: from localhost ([::1]:53387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjXAd-0002vI-HG for ged-emacs-devel@m.gmane.org; Tue, 26 Jun 2012 10:55:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjXAR-0002q7-NJ for emacs-devel@gnu.org; Tue, 26 Jun 2012 10:55:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjXAL-0002GK-9o for emacs-devel@gnu.org; Tue, 26 Jun 2012 10:54:59 -0400 Original-Received: from rcsinet15.oracle.com ([148.87.113.117]:28383) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjXAL-0002FJ-3N for emacs-devel@gnu.org; Tue, 26 Jun 2012 10:54:53 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q5QEsmPR025208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Jun 2012 14:54:49 GMT Original-Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q5QEsmCH003902 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Jun 2012 14:54:48 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q5QEsmhT021972; Tue, 26 Jun 2012 09:54:48 -0500 Original-Received: from dradamslap1 (/10.159.222.231) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 Jun 2012 07:54:48 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Ac1TfSuIzHkh25dyRHuYSfs7n0rrjgAJ+3gg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 148.87.113.117 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151185 Archived-At: > > I think I have reported this in the past, and it seem not fixed. > > This patch fix it, please review. > > Looks simple enough to me. This allows scrolling of the > minibuffer contents after the question is asked? Even better might be to let `y-or-n-p' accept one or more args that let a caller roll additional behavior into the mix. IOW, scrolling, like recentering and help, is just one alternative user event that someone might want to incorporate here. Otherwise, you have to roll your own when the need arises. For example, in Dired+ I have this: ,---- | diredp-y-or-n-files-p is a Lisp function in `dired+.el'. | | (diredp-y-or-n-files-p PROMPT FILES &optional PREDICATE) | | PROMPT user with a "y or n" question about a list of FILES. | Return t if answer is "y". Otherwise, return nil. | | Like `y-or-n-p', but the user can also hit `l' to display the list of | files that the confirmation is for, in buffer `*Files'. When | finished, buffer `*Files*' is killed if it was never shown, or is | hidden and buried otherwise. Thus, if it was shown then it is still | available to revisit afterward (even if the user quit using `C-g'). | | PREDICATE is passed to `diredp-list-files', to list only file names | for which it returns non-nil. `---- The definition is about the same as `y-or-n-p', with the addition of recognition of an `l' at the prompt to effect an interim action of displaying FILES and a help key to show a help message. Oh, and some unwind-protect cleanup. In short, it does this temporarily: (define-key query-replace-map "l" 'show) and adds this to the `case' for the key typed: (show (dired-list-files files nil list-buffer predicate)) If `y-or-n-p' accepted some more args to incorporate the ability to recognize other keys and effect their actions then the definition might be almost as simple as this: (defun diredp-y-or-n-files-p (prompt files &optional predicate) "..." (y-or-n-p prompt (show ; Entry for `show' action - use `C-l' (lambda () (diredp-list-files files nil (generate-new-buffer-name "*Files*") predicate))) ?l) ; Key to bind to `show' (help ; Entry for `help' action - use help keys (lambda () (message "Use `l' to show file list") (sit-for 1))))) Or we could use a macro etc. It would be a little more complex than that - being able to tell `y-or-n-p' about any unwind actions to take, for example (e.g. bury/kill buffer "*Files*"). But you get the idea. Dunno whether others have found a similar need to allow additional user events/actions during `y-or-n-p'. If not, ignore.