From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Genovese Newsgroups: gmane.emacs.bugs Subject: bug#10191: dired-query (in dired-aux.el) fails for certain help-char's, Emacs 23 and 24 Date: Fri, 2 Dec 2011 01:27:02 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf30334dc5d8a2fc04b3160fd9 X-Trace: dough.gmane.org 1322807280 2688 80.91.229.12 (2 Dec 2011 06:28:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 2 Dec 2011 06:28:00 +0000 (UTC) To: 10191@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 02 07:27:56 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RWMbC-0004jX-VT for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Dec 2011 07:27:55 +0100 Original-Received: from localhost ([::1]:47643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMbC-0004eY-IL for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Dec 2011 01:27:54 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:33602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMb9-0004eO-BH for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWMb8-0007Do-6I for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:51 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMb8-0007Di-0D for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:50 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RWMbK-0000Vh-2y for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Christopher Genovese Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2011 06:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10191 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13228072631919 (code B ref -1); Fri, 02 Dec 2011 06:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Dec 2011 06:27:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWMb1-0000Uu-Cv for submit@debbugs.gnu.org; Fri, 02 Dec 2011 01:27:43 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RWMaz-0000Un-03 for submit@debbugs.gnu.org; Fri, 02 Dec 2011 01:27:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWMak-0007Ay-Jq for submit@debbugs.gnu.org; Fri, 02 Dec 2011 01:27:27 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:42322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMak-0007Au-IE for submit@debbugs.gnu.org; Fri, 02 Dec 2011 01:27:26 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:33536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMaj-0004eI-CT for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWMai-0007AV-1x for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:25 -0500 Original-Received: from mail-qw0-f48.google.com ([209.85.216.48]:52423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWMah-0007AP-V4 for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2011 01:27:24 -0500 Original-Received: by qao25 with SMTP id 25so682338qao.0 for ; Thu, 01 Dec 2011 22:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=yfCor1mha88zkRdiOndlGS6xfylPFf7DSkxixK7JxRo=; b=gq+Z7ajubI84uPd4ScDseOJGAQaKkYRfUNuYhqwKEq9PNQwqBgIjPxrIP6ZrFRgyv9 PCDHBq5UFvh2yBpaTnMIxpMho7ocYULOJfmhwNWSw8QzdmsVERoDGBaG+EJIZ0+41xMV vVDLuYZntbxnqEirKQU9Jk+f5XN8PZEavXgkU= Original-Received: by 10.224.185.145 with SMTP id co17mr1797413qab.77.1322807243350; Thu, 01 Dec 2011 22:27:23 -0800 (PST) Original-Received: by 10.229.242.73 with HTTP; Thu, 1 Dec 2011 22:27:02 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 02 Dec 2011 01:28:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:54586 Archived-At: --20cf30334dc5d8a2fc04b3160fd9 Content-Type: text/plain; charset=ISO-8859-1 Whether this is a bug or a ... misunderstanding may be a matter of opinion because it goes to the nature of help-char. But the problem is easily fixed in any case. The function dired-query fails for certain settings of help-char; this occurs during the execution of other dired commands (e.g., dired-do-rename-regexp) without a clear trace of the problem for the user. For example, I set my help-char to ?\M-\C-h, which works fine in general. But despite looking like a character, ?\M-\C-h does not satisfy #'characterp, which causes the problem. Technically perhaps, help-char should be a character but from the user's point of view, both of these should qualify. While help-event-list can handle this, using help-char with such a value works in all the other cases I've seen. The failure occurs at the following sexp in dired-query (the same code in 23 and 24 despite significant differences in the functions between the two versions): ; original (if help-form (format " [Type yn!q or %s] " (key-description (char-to-string help-char))) " [Type y, n, q or !] ") When (characterp help-char) is nil, as in my case, char-to-string raises an error. Because I find it highly desirable to allow "characters" like ?\M-\C-h for help-char, I think this is a bug worth fixing. Here is a minimal fix for the offending sexp, not my first choice but an easy change: ; minimal fix (if (and help-form (characterp help-char)) (format " [Type yn!q or %s] " (key-description (char-to-string help-char))) " [Type y, n, q or !] ") Here's a simple fix for the offending sexp that gives better feedback: ; simple fix (if help-form (format " [Type yn!q or %s] " (key-description (cond ((characterp help-char) (char-to-string help-char)) ((eventp help-char) (append (event-modifiers help-char) (list (event-basic-type help-char)))) (t "your help char")))) " [Type y, n, q or !] ") Because key-description does not abbreviate symbolic forms of key modifiers, this gives output like " h". For nicer output, the following more elaborate fix could work, although this *may* be too much for the purpose. ; more (too?) elaborate fix with nicer output (if help-form (format " [Type yn!q or %s] " (cond ((characterp help-char) (key-description (char-to-string help-char))) ((eventp help-char) (let* ((modifiers (reverse (event-modifiers help-char))) (base (event-basic-type help-char)) (mod->str '((meta . "M-") (control . "C-") (shift . "S-") (super . "s-") (hyper . "H-") (alt . "A-") (double . "double-click ") (triple . "triple-click ") (drag . "drag ") (click . "click "))) (modstring (lambda (mod) (cdr (assoc mod mod->str))))) (apply 'concat (reverse (cons (if (characterp base) (key-description (char-to-string base)) (symbol-name base)) (mapcar modstring modifiers)))))) (t "your help char"))) " [Type y, n, q or !] ") Thanks, Chris --20cf30334dc5d8a2fc04b3160fd9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Whether this is a bug or a ... misunderstanding may be a matter of opinion<= br>because it goes to the nature of help-char. But the problem is easilyfixed in any case.

The function dired-query fails for certain setti= ngs of help-char; this occurs
during the execution of other dired commands (e.g., dired-do-rename-regexp)=
without a clear trace of the problem for the user.

For example, = I set my help-char to ?\M-\C-h, which works fine in general.
But despit= e looking like a character, ?\M-\C-h does not satisfy #'characterp, whi= ch causes
the problem. Technically perhaps, help-char should be a character but from = the user's point
of view, both of these should qualify.=A0 While hel= p-event-list can handle this,
using help-char with such a value works in= all the other cases I've seen.

The failure occurs at the following sexp in dired-query (the same code = in 23 and 24
despite significant differences in the functions between th= e two versions):

; original
(if help-form=A0=A0=A0 (format " [Type yn!q or %s] "
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 (key-description
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 (char-to-string help-char)))
=A0 " [Type y, n, = q or !] ")
When (characterp help-char) is nil, as in my case, char-to-string raises a= n error.
Because I find it highly desirable to allow "characters" like ?\M= -\C-h for help-char,
I think this is a bug worth fixing.

Here is = a minimal fix for the offending sexp, not my first choice but an easy chang= e:

; minimal fix
(if (and help-form (characterp help-char))
=A0=A0=A0 (format "= ; [Type yn!q or %s] "
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (key-description
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 (char-to-string help-char)))
=A0 " [Type y, n, q or !] ")

Here's a simple fix for the offending sexp that gives better feedba= ck:

; simple fix
(if help-form=A0=A0=A0 (format " [Type yn!q or %s] "
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 (key-description
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 (cond
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 ((characterp help-char)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (char-to-string help-char))
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 ((eventp help-char)
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (append (event-modifiers help-char)=
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (list (event-basic-type help-= char))))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 (t
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 "your help char"))))
=A0 " [Type y, n, q or !] ")

Because key-description does not abbreviate symbolic forms of
key mo= difiers, this gives output like "<control> <meta> h".=
For nicer output, the following more elaborate fix could work,
although this may be too much for the purpose.

; more (too?) elabo= rate fix with nicer output
(if help-form
=A0=A0=A0 (format "= ; [Type yn!q or %s] "
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (cond
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 ((characterp help-char)
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (key-description (char-to-string he= lp-char)))
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 ((eventp help-char)
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (let* ((modifiers
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (reverse (event-modifiers help-c= har)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (base
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (event-basic-type help-char))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (mod->str '((meta . "M-")
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (control . "C-")
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 (shift . "S-")
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (super . "s-")
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 (hyper . "H-")
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (alt . "A-")
=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 (double . "double-click ")
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (triple . "triple-click ")
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (drag . "drag ")
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (click . "click ")))
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (modstring=A0 (lambda (= mod)
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 (cdr (assoc mod mod->str)))))
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (apply 'concat
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (reverse
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (if (characterp base)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 (key-description (char-to-string base))
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (symbol-name base))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= (mapcar modstring modifiers))))))
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0 (t
= =A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 "your help char")))
=A0 " [Type y, n, = q or !] ")


Thanks,

=A0 Chris


--20cf30334dc5d8a2fc04b3160fd9--