unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Per Starbäck" <per@starback.se>
To: 9643@debbugs.gnu.org
Subject: bug#9643: 24.0.90; pcomplete/tar and complete-within
Date: Sat, 1 Oct 2011 02:05:05 +0200	[thread overview]
Message-ID: <CADkQgvuo+CkavKqmxJFDCNgtUfowOi3FNc2+HivPLHEv6=DJYA@mail.gmail.com> (raw)

    $ touch foo bar
    $ tar cf test.tar foo bar
    $ emacs -Q -f shell
    tar xf test. TAB

yields

    Error in post-command-hook (completion-in-region--postch):
    (wrong-type-argument listp [tar-header #<marker at 513 in  *tar-data
    test.tar*> foo 436 324 324 0 (20102 20143) 5077 nil  ustar  starback
    starback 0 0 nil])

I expected getting a completion of ".tar " to my command.

Reason: pcomplete/tar in pcmpl-gnu.el has an erroneous notion of how
tar-parse-info entries look like.

With this fix the example above will work, and it can complete "foo" and
"bar" inside the tar file as arguments after "test.tar":

----------------------------------------------------------------------
$ diff -u pcmpl-gnu.el~ pcmpl-gnu.el
--- pcmpl-gnu.el~	2011-01-26 17:16:33.000000000 +0100
+++ pcmpl-gnu.el	2011-10-01 01:24:45.000000000 +0200
@@ -298,7 +298,7 @@
 		  (mapcar
 		   (function
 		    (lambda (entry)
-		      (tar-header-name (cdr entry))))
+		      (tar-header-name entry)))
 		   tar-parse-info))
 	      (pcomplete-entries))
 	    nil 'identity))))
----------------------------------------------------------------------

I don't totally like this anyway. I get an extra buffer for "test.tar"
even though I never explicitly opened the file.

Next problem, also in "*shell*", when I have a large tar file,
in this case emacs-24.0.90.tar.gz:

    tar xf emacs-24.0.90.t TAB

yields (with the patch above) completion and a question

    File emacs-24.0.90.tar.gz is large (48MB), really open? (y or n)

This was what I first encountered, and not knowing about pcomplete
beforehand I was really surprised, as I had no intention of opening that
file in Emacs. Even if I had known about it I wouldn't have liked
this. I was only trying to complete the tar filename!

* In both my examples I'm trying to complete the tar filename, and it
  looked inside it to prepare for doing completion of arguments after
  this. If it only opened the tar file if I actually tried to complete
  more arguments *after* the tar filename it would be a lot better.





             reply	other threads:[~2011-10-01  0:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01  0:05 Per Starbäck [this message]
2011-10-01  2:39 ` bug#9643: 24.0.90; pcomplete/tar and complete-within Glenn Morris
2011-10-02  1:01   ` 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='CADkQgvuo+CkavKqmxJFDCNgtUfowOi3FNc2+HivPLHEv6=DJYA@mail.gmail.com' \
    --to=per@starback.se \
    --cc=9643@debbugs.gnu.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).