unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Kenichi Handa <handa@m17n.org>
Cc: 9160@debbugs.gnu.org
Subject: bug#9160: 24.0.50; Emacs freezes in *shell* buffer.
Date: Mon, 19 Sep 2011 21:10:58 -0400	[thread overview]
Message-ID: <jwv4o08jkpf.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <tl7liu2ur9b.fsf@m17n.org> (Kenichi Handa's message of "Tue, 06 Sep 2011 15:19:44 +0900")

> I confirmed that that above test case is fixed now.  But, I
> found several other bugs related completions.  All the
> following testcases are with the latest trunk Emacs with -Q
> argument, and they don't happen with Emacs 23.3.

> (1) SPC not escaped in *Completions* buffer
> % mkdir tmp
> % cd tmp
> % touch '0 a' '0-a'
> % rm 0<tab>

> Now the the *Completions* buffer is:
> <...>
> Possible completions are:
> 0 a
> 0-a

> Note that SPC is not escapsed in '0 a'.  So, when I click

Yes, that by design.

> it, *shell* buffer becomes this:
> % rm 0 a

That's a known (to me) bug.
Making escaping (aka quoting) interact correctly with completion styles
like partial-completion and substring is actually a nasty problem.
The old code used to escape the strings returned by all-completions (so
the *Completions* buffer would show the escaped names), which solves
some of the problematic cases, but has the following downsides:
- it's aesthetically unpleasant (the *Completions* buffer does not need
  that kind of escaping).
- it's inefficient (requires escaping all elements of all-completions).
- more problematic: it doesn't actually solve the problem in all cases,
  because the user may have typed "a\bc" but the escaping code cannot
  know that the user decided to (unnecessarily) escape "b" so it won't
  escape "b" and we're back at the problem that the completion will fail
  because the output from all-completions doesn't actually match the
  user's input, even tho it should.
We have related problems with $ escaping in find-file (they manifest in
different ways because we half-solved the issues differently).

I'm still not quite sure yet how to best solve those problems, but it
seems that a real solution will have to handle a more general problem,
e.g. cases such as "/u-$b-c" in find-file, where "$b" is an env var that
expands to (say) "c/d".

> (2) The second arg to rm command is not completed.
> % mkdir tmp
> % cd tmp
> % touch abc def
> % rm a<tab>
> % rm abc d<tab>
> Now just "No match" is shown instead of "d" completed to
> "def".  This DOES NOT happen with 'ls' command.

I think I just fixed it with the patch below.

> (3) Error in post-command-hook for *.tar.gz file.
> % mkdir tmp
> % cd tmp
> % echo abc > abc
> % echo def > def
> % tar cfz temp.tar.gz abc def
> % tar tfz temp<tab>
> Now the command line is correctly completed to:
> % tar tfz temp.tar.gz 
> But, this error is signaled:
> Error in post-command-hook (completion-in-region--postch):
> (wrong-type-argument listp [tar-header #<marker at 513 in  *tar-data
> temp.tar.gz*> abc 436 8308 8308 4 (20069 47563) 4380 nil  ustar  handa handa
> 0 0 nil])

I cannot reproduce this error.  Has it been fixed in the mean time?


        Stefan


--- lisp/minibuffer.el	2011-09-02 00:36:58 +0000
+++ lisp/minibuffer.el	2011-09-20 01:00:12 +0000
@@ -322,14 +322,15 @@
     (test-completion string table pred2))
    (t
     (or (complete-with-action action table string
-                              (if (null pred2) pred1
+                              (if (not (and pred1 pred2))
+                                  (or pred1 pred2)
                                 (lambda (x)
                                   ;; Call `pred1' first, so that `pred2'
                                   ;; really can't tell that `x' is in table.
-                                  (if (funcall pred1 x) (funcall pred2 x)))))
+                                  (and (funcall pred1 x) (funcall pred2 x)))))
         ;; If completion failed and we're not applying pred1 strictly, try
         ;; again without pred1.
-        (and (not strict)
+        (and (not strict) pred1 pred2
              (complete-with-action action table string pred2))))))
 
 (defun completion-table-in-turn (&rest tables)
@@ -1774,7 +1775,7 @@
 
 (defun completion-file-name-table (string pred action)
   "Completion table for file names."
-  (ignore-errors
+  (with-demoted-errors
     (cond
      ((eq action 'metadata) '(metadata (category . file)))
      ((eq (car-safe action) 'boundaries)






  reply	other threads:[~2011-09-20  1:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 12:07 bug#9160: 24.0.50; Emacs freezes in *shell* buffer Kenichi Handa
2011-08-23  4:49 ` Stefan Monnier
2011-08-25  0:52   ` Kenichi Handa
2011-08-28  5:16     ` Stefan Monnier
2011-09-06  6:19       ` Kenichi Handa
2011-09-20  1:10         ` Stefan Monnier [this message]
2011-09-20  5:16           ` Kenichi Handa
2011-10-17 17:12             ` Stefan Monnier
2011-12-02 12:06               ` Kenichi Handa
2011-12-02 14:45                 ` Stefan Monnier
2011-12-04 13:41                   ` Kenichi Handa
2011-12-04 15:38                     ` Stefan Monnier

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=jwv4o08jkpf.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=9160@debbugs.gnu.org \
    --cc=handa@m17n.org \
    /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).