zsh-users
 help / color / mirror / code / Atom feed
* Incomplete completion for w3m under 4.1.1
@ 2003-10-15 19:26 Lloyd Zusman
  2003-10-16  9:45 ` Peter Stephenson
  2003-10-17  5:50 ` Zvi Har'El
  0 siblings, 2 replies; 6+ messages in thread
From: Lloyd Zusman @ 2003-10-15 19:26 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

The zsh-4.1.1 completion specification for the 'w3m' program
(specification attached) is incomplete.  It will only try to complete
the final argument if it's some sort of URL.  For example ..

  w3m [ -options ] http://some.url.goes.here

However, w3m can also properly be used in the following way:

  w3m file.html

... where 'file.html' is a file on disk that I want to view.  However,
zsh is not completing these cases.

How can the _w3m completion spec be changed so that both kinds of values
can validly be completed for the final argument? ... or at least so
that I can cause it to switch between the two types of completion
with some sort of keystroke.    Thanks in advance.


[-- Attachment #2: zsh-4.1.1 _w3m --]
[-- Type: text/plain, Size: 1103 bytes --]

#compdef w3m

local curcontext="$curcontext" state line
typeset -A opt_args

_arguments -C \
  '-t[tabwidth]:tabwidth:' \
  '-r[ignore backspace effect]' \
  '-l[preserved lines]:number of lines:' \
  '-B[load bookmark]' \
  '-bookmark:bookmark file:_files' \
  '-T[content-type]:content type:' \
  '-m[internet message mode]' \
  '-v[visual startup mode]' \
  '-M[monochrome display]' \
  '-F[automatically render frame]' \
  '(-dump_source -dump_head)-dump' \
  '-cols:column width:' \
  '(-dump -dump_head)-dump_source' \
  '(-dump -dump_source)-dump_head' \
  '+:goto line:' \
  '-num[show line number]' \
  '-no-proxy' \
  '-no-mouse' \
  '(-no-cookie)-cookie' \
  '(-cookie)-no-cookie' \
  '-no-graph' \
  '-S[squeeze multiple blank lines]' \
  '-W[toggle wrap search mode]' \
  '-X[do not use termcap init/deinit]' \
  '-o[option]:option-value:' \
  '-config:config file:_files' \
  '-debug' \
  ':url:->url' && return 0

case $state in
	url)
	local _w3mhistory

	if [[ -s ~/.w3m/history ]]; then
	   _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
	   compadd $_w3mhistory
	fi

	_urls -f
	;;

esac

[-- Attachment #3: Type: text/plain, Size: 36 bytes --]



-- 
 Lloyd Zusman
 ljz@asfast.com

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

* Re: Incomplete completion for w3m under 4.1.1
  2003-10-15 19:26 Incomplete completion for w3m under 4.1.1 Lloyd Zusman
@ 2003-10-16  9:45 ` Peter Stephenson
  2003-10-21 18:29   ` Lloyd Zusman
  2003-10-17  5:50 ` Zvi Har'El
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2003-10-16  9:45 UTC (permalink / raw)
  To: zsh-users

Lloyd Zusman wrote:
> How can the _w3m completion spec be changed so that both kinds of values
> can validly be completed for the final argument?

Have a look at the _lynx completer, which deals with this problem using
_alternative; that's probably the best way since it allows the normal
tags stuff to work.  That would probably be easiest if the _w3mhistory
stuff went into a function itself

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


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

* Re: Incomplete completion for w3m under 4.1.1
  2003-10-15 19:26 Incomplete completion for w3m under 4.1.1 Lloyd Zusman
  2003-10-16  9:45 ` Peter Stephenson
@ 2003-10-17  5:50 ` Zvi Har'El
  2003-10-21 18:30   ` Lloyd Zusman
  1 sibling, 1 reply; 6+ messages in thread
From: Zvi Har'El @ 2003-10-17  5:50 UTC (permalink / raw)
  To: Lloyd Zusman; +Cc: zsh-users

Perhaps _w3m should be fixed to resemble _lynx, i.e., the last parameter for
the _arguments function should be ':url:->html' rather then ':url:->url' .
What I do now when I wish zsh to complete files in the current directory is to
start with "w3m fi<TAB>" and next "w3m file://<TAB>" which completes the
current directory. 

On Wed, 15 Oct 2003 15:26:16 -0400, Lloyd Zusman wrote about "Incomplete completion for w3m under 4.1.1":
> The zsh-4.1.1 completion specification for the 'w3m' program
> (specification attached) is incomplete.  It will only try to complete
> the final argument if it's some sort of URL.  For example ..
> 
>   w3m [ -options ] http://some.url.goes.here
> 
> However, w3m can also properly be used in the following way:
> 
>   w3m file.html
> 
> ... where 'file.html' is a file on disk that I want to view.  However,
> zsh is not completing these cases.
> 
> How can the _w3m completion spec be changed so that both kinds of values
> can validly be completed for the final argument? ... or at least so
> that I can cause it to switch between the two types of completion
> with some sort of keystroke.    Thanks in advance.
> 

Content-Description: zsh-4.1.1 _w3m
> #compdef w3m
> 
> local curcontext="$curcontext" state line
> typeset -A opt_args
> 
> _arguments -C \
>   '-t[tabwidth]:tabwidth:' \
>   '-r[ignore backspace effect]' \
>   '-l[preserved lines]:number of lines:' \
>   '-B[load bookmark]' \
>   '-bookmark:bookmark file:_files' \
>   '-T[content-type]:content type:' \
>   '-m[internet message mode]' \
>   '-v[visual startup mode]' \
>   '-M[monochrome display]' \
>   '-F[automatically render frame]' \
>   '(-dump_source -dump_head)-dump' \
>   '-cols:column width:' \
>   '(-dump -dump_head)-dump_source' \
>   '(-dump -dump_source)-dump_head' \
>   '+:goto line:' \
>   '-num[show line number]' \
>   '-no-proxy' \
>   '-no-mouse' \
>   '(-no-cookie)-cookie' \
>   '(-cookie)-no-cookie' \
>   '-no-graph' \
>   '-S[squeeze multiple blank lines]' \
>   '-W[toggle wrap search mode]' \
>   '-X[do not use termcap init/deinit]' \
>   '-o[option]:option-value:' \
>   '-config:config file:_files' \
>   '-debug' \
>   ':url:->url' && return 0
> 
> case $state in
> 	url)
> 	local _w3mhistory
> 
> 	if [[ -s ~/.w3m/history ]]; then
> 	   _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
> 	   compadd $_w3mhistory
> 	fi
> 
> 	_urls -f
> 	;;
> 
> esac

> 
> 
> -- 
>  Lloyd Zusman
>  ljz@asfast.com


-- 
Dr. Zvi Har'El     mailto:rl@math.technion.ac.il     Department of Mathematics
tel:+972-54-227607 icq:179294841     Technion - Israel Institute of Technology
fax:+972-4-8293388 http://www.math.technion.ac.il/~rl/     Haifa 32000, ISRAEL
"If you can't say somethin' nice, don't say nothin' at all." -- Thumper (1942)
                              Friday, 21 Tishri 5764, 17 October 2003,  7:40AM


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

* Re: Incomplete completion for w3m under 4.1.1
  2003-10-16  9:45 ` Peter Stephenson
@ 2003-10-21 18:29   ` Lloyd Zusman
  2003-10-21 21:06     ` Lloyd Zusman
  0 siblings, 1 reply; 6+ messages in thread
From: Lloyd Zusman @ 2003-10-21 18:29 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 791 bytes --]

Peter Stephenson <pws@csr.com> writes:

> Lloyd Zusman wrote:
>> How can the _w3m completion spec be changed so that both kinds of values
>> can validly be completed for the final argument?
>
> Have a look at the _lynx completer, which deals with this problem using
> _alternative; that's probably the best way since it allows the normal
> tags stuff to work.  That would probably be easiest if the _w3mhistory
> stuff went into a function itself

I very much appreciate this information.  Attached are my altered _w3m
and a new helper function _w3mhist.  I'm pretty new at this, so could
someone evaluate what I came up with?

Also, I could only get this to work if I put "autoload -U _w3mhist" in
my /etc/zshrc, even though the file _w3mhist is in my $fpath.  What am
I missing?

Thanks.


[-- Attachment #2: New _w3m --]
[-- Type: text/plain, Size: 1030 bytes --]

#compdef w3m

local curcontext="$curcontext" state line
typeset -A opt_args

_arguments -C \
  '-t[tabwidth]:tabwidth:' \
  '-r[ignore backspace effect]' \
  '-l[preserved lines]:number of lines:' \
  '-B[load bookmark]' \
  '-bookmark:bookmark file:_files' \
  '-T[content-type]:content type:' \
  '-m[internet message mode]' \
  '-v[visual startup mode]' \
  '-M[monochrome display]' \
  '-F[automatically render frame]' \
  '(-dump_source -dump_head)-dump' \
  '-cols:column width:' \
  '(-dump -dump_head)-dump_source' \
  '(-dump -dump_source)-dump_head' \
  '+:goto line:' \
  '-num[show line number]' \
  '-no-proxy' \
  '-no-mouse' \
  '(-no-cookie)-cookie' \
  '(-cookie)-no-cookie' \
  '-no-graph' \
  '-S[squeeze multiple blank lines]' \
  '-W[toggle wrap search mode]' \
  '-X[do not use termcap init/deinit]' \
  '-o[option]:option-value:' \
  '-config:config file:_files' \
  '-debug' \
  ':url:->html' && return 0

case $state in
	html)
	_alternative 'files:file:_files -g "*.x#html"' 'urls:url:_w3mhist'
	;;

esac

[-- Attachment #3: _w3mhist --]
[-- Type: text/plain, Size: 157 bytes --]

#compdef -default-

local _w3mhistory

if [[ -s ~/.w3m/history ]]; then
   _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
   compadd $_w3mhistory
fi

_urls -f

[-- Attachment #4: Type: text/plain, Size: 35 bytes --]


-- 
 Lloyd Zusman
 ljz@asfast.com

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

* Re: Incomplete completion for w3m under 4.1.1
  2003-10-17  5:50 ` Zvi Har'El
@ 2003-10-21 18:30   ` Lloyd Zusman
  0 siblings, 0 replies; 6+ messages in thread
From: Lloyd Zusman @ 2003-10-21 18:30 UTC (permalink / raw)
  To: zsh-users

"Zvi Har'El" <rl@math.technion.ac.il> writes:

> Perhaps _w3m should be fixed to resemble _lynx, i.e., the last parameter for
> the _arguments function should be ':url:->html' rather then ':url:->url' .
> What I do now when I wish zsh to complete files in the current directory is to
> start with "w3m fi<TAB>" and next "w3m file://<TAB>" which completes the
> current directory. 

Thank you.  I have attempted to do something like that.  I sent my
attempt in my previous message.

-- 
 Lloyd Zusman
 ljz@asfast.com


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

* Re: Incomplete completion for w3m under 4.1.1
  2003-10-21 18:29   ` Lloyd Zusman
@ 2003-10-21 21:06     ` Lloyd Zusman
  0 siblings, 0 replies; 6+ messages in thread
From: Lloyd Zusman @ 2003-10-21 21:06 UTC (permalink / raw)
  To: zsh-users

Lloyd Zusman <ljz@asfast.com> writes:
>
> [ ... ] Attached are my altered _w3m and a new helper function
> _w3mhist.

Correction: the _w3mhist function I sent in my earlier message should
begin something like this:  #compdef w3m

The "-default-" I put there was wrong.

-- 
 Lloyd Zusman
 ljz@asfast.com


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

end of thread, other threads:[~2003-10-21 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 19:26 Incomplete completion for w3m under 4.1.1 Lloyd Zusman
2003-10-16  9:45 ` Peter Stephenson
2003-10-21 18:29   ` Lloyd Zusman
2003-10-21 21:06     ` Lloyd Zusman
2003-10-17  5:50 ` Zvi Har'El
2003-10-21 18:30   ` Lloyd Zusman

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).