Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

READNULLCMD: its process and completion



Two issues related to READNULLCMD (one of the features I looove about Zsh):


1. There's something weird about completion of 'init.d' scripts with the '<filename' form. The simplest example I could find:

# </etc/init.d/<Tab>
[no completion]

# rsync -av /etc/init.d/ /etc/notinitd/
[... showing it's not something in the directory...]

# </etc/notinitd/<Tab>
zsh: do you wish to see all 101 possibilities (15 lines)?


It looks like init.d is special-cased somehow. Running with '-x', I see the following (among other output) when <Tab>-ing:

+_init_d:3> local magic cmds what script opts
+_init_d:5> _compskip=all
+_init_d:9> script=/etc/init.d/
+_init_d:10> [[ /etc/init.d/ == '*/*' ]]
+_init_d:11> [[ ! -f /etc/init.d/ ]]
+_init_d:12> _message 'init.d is not an init script'

But it's odd that it's not special-cased for other forms:

$ cat < /etc/init.d/<Tab>
zsh: do you wish to see all 101 possibilities (15 lines)?n
$ less < /etc/init.d/<Tab>
zsh: do you wish to see all 101 possibilities (15 lines)?n




2. There's something different about the way READNULLCMD gets called. My normal PAGER is less:

$ env | grep less
READNULLCMD=less
PAGER=less
LESSOPEN=|lesspipe.sh %s

Using 'less' as my READNULLCMD like that, it doesn't respect the LESSOPEN variable.


[Expected: lynx-dumped HTML]

$ less /usr/share/doc/lucene-1.9.1/html/api/index.html
   Frame: packageListFrame
   Frame: packageFrame
   Frame: classFrame

Frame Alert
[...]


[Actual: raw HTML]

$ </usr/share/doc/lucene-1.9.1/html/api/index.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd";>
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Mon Sep 01 21:13:06 EDT 2008-->
<TITLE>
Lucene 1.9.2-dev API
[...]


I also noticed in the docs that you can specify a function. So, I tried:

$ function less_with_pipe () { less $* }
$ export READNULLCMD=less_with_pipe

And got the same results as above. (less_with_pipe works on its own -- but as READNULLCMD, it doesn't use LESSOPEN.).

Even the following doesn't work:

$ function less_with_env () { echo using less_with_env ; env | grep LESS ; less $* }
$ </usr/share/doc/lucene-1.9.1/html/api/index.html
using less_with_env
LESS=-R -i -M --shift 5
LESSOPEN=|lesspipe.sh %s
[and the output is as above -- raw HTML instead of lesspipe'd through lynx]

Thanks for any pointers.

Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author