zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _xt_arguments and new _nedit
@ 2000-03-18 18:50 Oliver Kiddle
  2000-03-18 19:19 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Kiddle @ 2000-03-18 18:50 UTC (permalink / raw)
  To: Zsh workers

Multiple -xrm options are allowed with xt applications so I've made a
small patch for that. Also here is a new completion for nedit (see
nedit.org if you don't know what it is).

It would be nice if there was a way of using globbing, similar to *(w)
and *(r) to match files which can be written to by the current process
as opposed to the file's owner. Taking the nedit completion as an
example, it would be useful to only complete files which can be written
to because I don't want to edit those which are read-only.

Oliver Kiddle

--- Completion/X/_xt_arguments.bak	Sat Mar 18 18:32:45 2000
+++ Completion/X/_xt_arguments	Sat Mar 18 18:33:01 2000
@@ -41,7 +41,7 @@
   '-selectionTimeout:selection timeout (milliseconds):_x_selection_timeout'
   '-title:title:_x_title'
   '-xnllanguage:locale:_x_locale'
-  '-xrm:resource:_x_resource'
+  '*-xrm:resource:_x_resource'
   '-xtsessionID:session ID:_xt_session_id'
 )
 
--- /dev/null	Sat Mar 18 18:34:55 2000
+++ Completion/User/_nedit	Sat Mar 18 18:25:27 2000
@@ -0,0 +1,49 @@
+#compdef nedit nc
+
+local state line expl nedit_common
+
+nedit_common=( \
+  '-read[open file read only]' \
+  "-create[create file if it doesn't already exist]" \
+  '-line[go to specified line number]:line number' \
+  '-do[execute macro or action commands]' \
+  '-lm[specify language mode]:language mode:->lang' \
+  '-svrname[name the server]:nedit server name' \
+  '(-noiconic)-iconic[set initial window state to iconic]' \
+  '*-xrm:resource:_x_resource' \
+  '*:file:_files' )
+
+if [[ $words[1] = *nc ]]; then
+  _x_arguments -C \
+    '(-noask)-ask[prompt if no server found]' \
+    '(-ask)-noask[start a new server without asking if none found]' \
+    '-svrcmd[command to run server]:server command:_command_names -e' \
+    "$nedit_common[@]"
+else
+  _x_arguments -C \
+    '-server[designate this session as an nedit server]' \
+    '-tags[load ctags file]:tags file:_files' \
+    '-tabs[specify tab width in characters]:tab width' \
+    '(-nowrap -autowrap -noautowrap)-wrap[use continuous wrap mode]' \
+    '(-wrap -autowrap -noautowrap)-nowrap[turn off continuous wrap mode]' \
+    '(-wrap -nowrap -noautowrap)-autowrap[use auto-newline wrap mode]' \
+    '(-wrap -nowrap -autowrap)-noautowrap[turn off auto-newline wrap mode]' \
+    '(-noautoindent)-autoindent[maintain a running indent]' \
+    '(-autoindent)-noautoindent[turn off autoindent]' \
+    '(-noautosave)-autosave[maintain a backup copy of file being edited]' \
+    "(-autosave)-noautosave[don't maintain a backup copy of file being edited]" \
+    "(-iconic)-noiconic[don't set initial window state to iconic]" \
+    '-rows[specify default height in characters for an editing window]:height' \
+    '-columns[specify default width in characters for an editing window]:width' \
+    '-font[specify font for text window]:font:_x_font' \
+    '(-bg)-background:background color:_x_color' \
+    '(-background)-bg[specify background color]:background color:_x_color' \
+    '(-fg)-foreground:foreground color:_x_color' \
+    '(-foreground)-fg[specify foreground color]:foreground color:_x_color' \
+    '-import[load additional preferences file]:nedit preferences file:_files' \
+    "$nedit_common[@]"
+fi
+
+[[ $state = lang ]] && _wanted neditlanguages expl 'language mode' &&
+    compadd "$expl[@]" -  ${(f)"$(sed -n \
+      '/^nedit.languageMode/,/^nedit/ s/.*	\([^:]*\).*/\1/p' < ~/.nedit)"}


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

* Re: PATCH: _xt_arguments and new _nedit
  2000-03-18 18:50 PATCH: _xt_arguments and new _nedit Oliver Kiddle
@ 2000-03-18 19:19 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-03-18 19:19 UTC (permalink / raw)
  To: Oliver Kiddle, Zsh workers

On Mar 18,  6:50pm, Oliver Kiddle wrote:
} Subject: PATCH: _xt_arguments and new _nedit
}
} It would be nice if there was a way of using globbing, similar to *(w)
} and *(r) to match files which can be written to by the current process

This should work:	_files -g '*(Uw,GI,W)'

That means "owned by the EUID and owner writable, or owned by the EGID
and group writable, or world writable."  That doesn't quite work with
group lists; for that you'd need something like

	_files -g \*\(Uw,Ig:${(j(:,Ig:))$(groups)}:,W\)


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

end of thread, other threads:[~2000-03-18 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-18 18:50 PATCH: _xt_arguments and new _nedit Oliver Kiddle
2000-03-18 19:19 ` Bart Schaefer

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