zsh-users
 help / color / mirror / code / Atom feed
* Reading difficult directory name correctly:
@ 2020-12-10 21:47 Ray Andrews
  2020-12-10 22:00 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Ray Andrews @ 2020-12-10 21:47 UTC (permalink / raw)
  To: Zsh Users

I may have asked this before but I can't remember the answer.  So the 
directory below is created automatically by certain software:

     $ls drwxr-xr-x 2      4096 2020-10-02/19:58:13 Sky above 49°30'N 
123°30'W at Sat 2020 Oct 3 5:35_files/


Tab completion seems to put backslashes where needed but the " _files  " 
is left off:
     $ rm -r Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Sat\ 2020\ Oct\ 3\ 5:35

     rm: cannot remove "Sky above 49°30'N 123°30'W at Sat 2020 Oct 3 
5:35": No such file or directory

Is there a fix for this?  Not a big deal since just typing in the "  
_files   " works fine, still I'm expecting the underscore to cause no 
issues.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading difficult directory name correctly:
  2020-12-10 21:47 Reading difficult directory name correctly: Ray Andrews
@ 2020-12-10 22:00 ` Bart Schaefer
  2020-12-10 22:23   ` Ray Andrews
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2020-12-10 22:00 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Thu, Dec 10, 2020 at 1:48 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Tab completion seems to put backslashes where needed but the " _files  "
> is left off

That should only happen if there's an ambiguity, i.e., another file or
directory with the same name up to but not including the "_files"
part.

Running _complete_debug with ctrl-x? may provide some insight here.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading difficult directory name correctly:
  2020-12-10 22:00 ` Bart Schaefer
@ 2020-12-10 22:23   ` Ray Andrews
  2020-12-10 22:32     ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Ray Andrews @ 2020-12-10 22:23 UTC (permalink / raw)
  To: zsh-users

On 2020-12-10 2:00 p.m., Bart Schaefer wrote:
> On Thu, Dec 10, 2020 at 1:48 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>> Tab completion seems to put backslashes where needed but the " _files  "
>> is left off
> That should only happen if there's an ambiguity, i.e., another file or
> directory with the same name up to but not including the "_files"
> part.
Right you are there's a file:

     Sky above 49°30'N 123°30'W at Sat 2020 Oct 3 5:35.html

But shouldn't it  go into into it's selection mode?  I keep pressing tab 
until I get the completion I want? The completion seems unaware of the 
ambiguity as far as offering me the choices.  Mind ... the command is " 
rm -r " thus expecting a directory and the other item is a file.  Sounds 
like a logical lapse.  Some time ago I turned off all my 'smart' 
completions -- being a simple soul I just want completions on local 
files without any filtering  but .... dunno, maybe that's part of it.  
But then I'd expect it to either complete with the directory, OR offer 
me manual completion.



>
> Running _complete_debug with ctrl-x? may provide some insight here.
>
Pardon Bart, exactly how do I do that?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading difficult directory name correctly:
  2020-12-10 22:23   ` Ray Andrews
@ 2020-12-10 22:32     ` Bart Schaefer
  2020-12-11  1:25       ` Ray Andrews
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2020-12-10 22:32 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Thu, Dec 10, 2020 at 2:23 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> Right you are there's a file:
>
>      Sky above 49°30'N 123°30'W at Sat 2020 Oct 3 5:35.html
>
> But shouldn't it  go into into it's selection mode?  I keep pressing tab
> until I get the completion I want?

If I make the directory and file you mentioned, then press TAB twice,
I get this (pardon likely gmail line wrapping):

ubuntu% rm -f 19:58:13\ Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Sat\
2020\ Oct\ 3\ 5:35
file
19:58:13\ Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Sat\ 2020\ Oct\ 3\ 5:35_files/
19:58:13\ Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Sat\ 2020\ Oct\ 3\ 5:35.html

(That's with zsh -f with compinit -D plus zstyle '*' format %d)

> Mind ... the command is "
> rm -r " thus expecting a directory and the other item is a file.

I don't think completion for "rm -f" introduces any expectation of directory.

> >
> > Running _complete_debug with ctrl-x? may provide some insight here.
> >
> Pardon Bart, exactly how do I do that?

Instead of pressing TAB, hold down the ctrl key, type x, then release
that, hold down shift, and type question mark.

A file will be written with a backtrace of what the completion system
did.  An entry is made in the shell history providing the name of the
file.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading difficult directory name correctly:
  2020-12-10 22:32     ` Bart Schaefer
@ 2020-12-11  1:25       ` Ray Andrews
  0 siblings, 0 replies; 5+ messages in thread
From: Ray Andrews @ 2020-12-11  1:25 UTC (permalink / raw)
  To: zsh-users

On 2020-12-10 2:32 p.m., Bart Schaefer wrote:

I added this to the bottom of my config file:

     ###
     #autoload -U compinit && compinit -d $ZSHBOOT/zcompdump
     autoload -U compinit -D && compinit -d $ZSHBOOT/zcompdump
     zstyle '*' format %d

... and it made no difference.  First TAB gives the partial completion.  
Second TAB adds the

     Completing `file'

message, but nothing is added -- no files are offered nor is the partial 
line completed.


> A file will be written with a backtrace of what the completion system
> did.  An entry is made in the shell history providing the name of the
> file.
Yikes, it's 420 lines long :(

This auto created directory is the only case I know of where anything 
like this happens so it's hardly a big deal in practice, still I'm 
curious, but don't waste any time on it Bart.

One more experiment: no changes to config but:

     7 /aMisc 5 $ zsh -f
g5--9-Debian1#
     g5--9-Debian1# rm Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Fri\ 2020\ 
Dec\ 11\ 0\ 58
     Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Fri\ 2020\ Dec\ 11\ 0\ 58.html
     Sky\ above\ 49°30\'N\ 123°30\'W\ at\ Fri\ 2020\ Dec\ 11\ 0\ 58_files/

So, it works as you described -- second TAB shows both the file and the 
directory and completion cycles thru them.

So I broke something.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-11  1:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 21:47 Reading difficult directory name correctly: Ray Andrews
2020-12-10 22:00 ` Bart Schaefer
2020-12-10 22:23   ` Ray Andrews
2020-12-10 22:32     ` Bart Schaefer
2020-12-11  1:25       ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).