* PATCH: _lynx and _urls.
@ 1999-09-02 18:23 Tanaka Akira
0 siblings, 0 replies; 2+ messages in thread
From: Tanaka Akira @ 1999-09-02 18:23 UTC (permalink / raw)
To: zsh-workers
This is completion function for lynx.
--- /dev/null Fri Sep 3 02:54:25 1999
+++ Completion/User/_lynx Fri Sep 3 03:13:53 1999
@@ -0,0 +1,109 @@
+#compdef lynx
+
+_lynx () {
+ _arguments \
+ '-accept_all_cookies' \
+ '-anonymous' \
+ '-assume_charset=:MIMENAME:' \
+ '-assume_local_charset=:MIMENAME:' \
+ '-assume_unrec_charset=:MIMENAME:' \
+ '-auth=:ID\:PW:' \
+ '-base' \
+ '-blink' \
+ '-book' \
+ '-buried_news' \
+ '-cache=:NUMBER:' \
+ '-case' \
+ '-cfg=:FILENAME:_files' \
+ '-child' \
+ '-color' \
+ '-cookies' \
+ '-core' \
+ '-crawl' \
+ '-display=:DISPLAY:_x_display' \
+ '-dump' \
+ '-editor=:EDITOR:_files' \
+ '-emacskeys' \
+ '-enable_scrollback' \
+ '-error_file=:FILENAME:_files' \
+ '-fileversions' \
+ '-force_html' \
+ '-force_secure' \
+ '-from' \
+ '-ftp' \
+ '-get_data' \
+ '-head' \
+ '-help' \
+ '-historical' \
+ '-homepage=:URL: _urls -f' \
+ '-image_links' \
+ '-ismap' \
+ '-index=:URL: _urls -f' \
+ '-link=:NUMBER:' \
+ '-localhost' \
+ '-locexec' \
+ '-mime_header' \
+ '-minimal' \
+ '-newschunksize=:NUMBER:' \
+ '-newsmaxchunk=:NUMBER:' \
+ '-nobrowse' \
+ '-nocc' \
+ '-nocolor' \
+ '-noexec' \
+ '-nofilereferer' \
+ '-nolist' \
+ '-nolog' \
+ '-nonrestarting_sigwinch' \
+ '-nopause' \
+ '-noprint' \
+ '-noredir' \
+ '-noreferer' \
+ '-nosocks' \
+ '-nostatus' \
+ '-number_links' \
+ '-partial' \
+ '-pauth=:ID\:PW:' \
+ '-popup' \
+ '-post_data' \
+ '-preparsed' \
+ '-print' \
+ '-pseudo_inlines' \
+ '-raw' \
+ '-realm' \
+ '-reload' \
+ '-restrictions=:options:_lynx_restrictions' \
+ '-resubmit_posts' \
+ '-rlogin' \
+ '-selective' \
+ '-show_cursor' \
+ '-soft_dquotes' \
+ '-source' \
+ '-startfile_ok' \
+ '-tagsoup' \
+ '-telnet' \
+ '-term=:TERM:' \
+ '-tlog' \
+ '-trace' \
+ '-traversal' \
+ '-underscore' \
+ '-useragent=:NAME:' \
+ '-use_mouse' \
+ '-validate' \
+ '-verbose' \
+ '-version' \
+ '-vikeys' \
+ '-width=:NUMBER:' \
+ ':url: _urls -f'
+}
+
+_lynx_restrictions () {
+ compset -P '*,'
+ compadd -qS, \
+ all bookmark bookmark_exec change_exec_perms default dired_support \
+ disk_save dotfiles download editor exec exec_frozen externals file_url \
+ goto inside_ftp inside_news inside_rlogin inside_telnet jump mail \
+ multibook news_post options_save outside_ftp outside_news outside_rlogin \
+ outside_telnet print shell suspend telnet_port useragent
+}
+
+_lynx "$@"
--- /dev/null Fri Sep 3 02:54:25 1999
+++ Completion/User/_urls Fri Sep 3 03:09:54 1999
@@ -0,0 +1,65 @@
+#autoload
+
+# Usage: _urls [-f]
+# Options:
+# -f : complete files.
+
+# To complete URLs, you must make a URL database locally such as:
+#
+# % cd ~/.zsh/urls
+# % find . -ls
+# ... drwxr-xr-x ... 512 Sep 3 02:46 .
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http
+# ... drwxr-xr-x ... 512 Sep 3 02:52 ./http/www.zsh.org
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999
+# ... -rw-r--r-- ... 0 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999/index.html
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk/zsh
+# ... drwxr-xr-x ... 512 Sep 3 02:47 ./bookmark
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./bookmark/zsh
+# ... -rw-r--r-- ... 27 Sep 3 02:47 ./bookmark/zsh/home
+# ... -rw-r--r-- ... 20 Sep 3 02:48 ./bookmark/zsh/meta
+
+local ipre scheme dirs files
+
+if [[ "$1" = -f ]]; then
+ shift
+ _files "$@" && return
+fi
+
+if [[ -z "$compconfig[_urls_dir]" ]]; then
+ compconfig[_urls_dir]=${ZDOTDIR:-$HOME}/.zsh/urls
+fi
+
+ipre="$IPREFIX"
+
+if [[ -prefix [-+.a-z0-9]#: ]]; then
+ scheme="${PREFIX%%:*}"
+ compset -P "[-+.a-z0-9]#:"
+else
+ compadd -S '' http:// ftp:// bookmark:
+ return
+fi
+
+case "$scheme" in
+ http) compset -P // || { compadd "$@" -S '' //; return };;
+ ftp) compset -P // || { compadd "$@" -S '' //; return };;
+esac
+
+if [[ "$scheme" = bookmark &&
+ -f "$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX" &&
+ -s "$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX" ]]; then
+ compadd "$@" -QU -- "$ipre$(<"$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX")"
+else
+ dirs=($compconfig[_urls_dir]/$scheme/$PREFIX*$SUFFIX(/:t))
+ files=($compconfig[_urls_dir]/$scheme/$PREFIX*$SUFFIX(.:t))
+ compset -P '*/'
+ compadd "$@" -Q -S '/' - $dirs
+ if [[ "$scheme" = bookmark ]]; then
+ compadd "$@" -QS '' - $files
+ else
+ compadd "$@" -Q - $files
+ fi
+fi
--
Tanaka Akira
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _lynx and _urls.
@ 1999-09-03 7:56 Sven Wischnowsky
0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-09-03 7:56 UTC (permalink / raw)
To: zsh-workers
Tanaka Akira wrote:
> This is completion function for lynx.
I hope you don't mind if I change the name of the configuration key to
`urls_dir' -- no other key starts with an underscore.
`_lynx' looks like a candidate for the support for state transitions I
plan to add to `_arguments'. I hope I'll find the time at the weekend
so that we can compare the different forms.
Bye
Sven
diff -u Completion.old/User/_urls Completion/User/_urls
--- Completion.old/User/_urls Fri Sep 3 09:22:43 1999
+++ Completion/User/_urls Fri Sep 3 09:53:37 1999
@@ -3,24 +3,27 @@
# Usage: _urls [-f]
# Options:
# -f : complete files.
-
-# To complete URLs, you must make a URL database locally such as:
#
-# % cd ~/.zsh/urls
-# % find . -ls
-# ... drwxr-xr-x ... 512 Sep 3 02:46 .
-# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http
-# ... drwxr-xr-x ... 512 Sep 3 02:52 ./http/www.zsh.org
-# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla
-# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers
-# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999
-# ... -rw-r--r-- ... 0 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999/index.html
-# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk
-# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk/zsh
-# ... drwxr-xr-x ... 512 Sep 3 02:47 ./bookmark
-# ... drwxr-xr-x ... 512 Sep 3 02:48 ./bookmark/zsh
-# ... -rw-r--r-- ... 27 Sep 3 02:47 ./bookmark/zsh/home
-# ... -rw-r--r-- ... 20 Sep 3 02:48 ./bookmark/zsh/meta
+# Configuration key used:
+#
+# urls_dir
+# The path to a directory containing a URL database, such as:
+#
+# % cd ~/.zsh/urls
+# % find . -ls
+# ... drwxr-xr-x ... 512 Sep 3 02:46 .
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http
+# ... drwxr-xr-x ... 512 Sep 3 02:52 ./http/www.zsh.org
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers
+# ... drwxr-xr-x ... 512 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999
+# ... -rw-r--r-- ... 0 Sep 3 03:01 ./http/www.zsh.org/mla/workers/1999/index.html
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./http/sunsite.auc.dk/zsh
+# ... drwxr-xr-x ... 512 Sep 3 02:47 ./bookmark
+# ... drwxr-xr-x ... 512 Sep 3 02:48 ./bookmark/zsh
+# ... -rw-r--r-- ... 27 Sep 3 02:47 ./bookmark/zsh/home
+# ... -rw-r--r-- ... 20 Sep 3 02:48 ./bookmark/zsh/meta
local ipre scheme dirs files
@@ -29,8 +32,8 @@
_files "$@" && return
fi
-if [[ -z "$compconfig[_urls_dir]" ]]; then
- compconfig[_urls_dir]=${ZDOTDIR:-$HOME}/.zsh/urls
+if [[ -z "$compconfig[urls_dir]" ]]; then
+ compconfig[urls_dir]=${ZDOTDIR:-$HOME}/.zsh/urls
fi
ipre="$IPREFIX"
@@ -49,12 +52,12 @@
esac
if [[ "$scheme" = bookmark &&
- -f "$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX" &&
- -s "$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX" ]]; then
- compadd "$@" -QU -- "$ipre$(<"$compconfig[_urls_dir]/$scheme/$PREFIX$SUFFIX")"
+ -f "$compconfig[urls_dir]/$scheme/$PREFIX$SUFFIX" &&
+ -s "$compconfig[urls_dir]/$scheme/$PREFIX$SUFFIX" ]]; then
+ compadd "$@" -QU -- "$ipre$(<"$compconfig[urls_dir]/$scheme/$PREFIX$SUFFIX")"
else
- dirs=($compconfig[_urls_dir]/$scheme/$PREFIX*$SUFFIX(/:t))
- files=($compconfig[_urls_dir]/$scheme/$PREFIX*$SUFFIX(.:t))
+ dirs=($compconfig[urls_dir]/$scheme/$PREFIX*$SUFFIX(/:t))
+ files=($compconfig[urls_dir]/$scheme/$PREFIX*$SUFFIX(.:t))
compset -P '*/'
compadd "$@" -Q -S '/' - $dirs
if [[ "$scheme" = bookmark ]]; then
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-09-03 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-02 18:23 PATCH: _lynx and _urls Tanaka Akira
1999-09-03 7:56 Sven Wischnowsky
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).