* Completion/Unix/_emacs
@ 2012-04-23 6:43 Nikolai Weibull
2012-04-23 6:51 ` Completion/Unix/_emacs Nikolai Weibull
0 siblings, 1 reply; 2+ messages in thread
From: Nikolai Weibull @ 2012-04-23 6:43 UTC (permalink / raw)
To: Zsh Workers
[-- Attachment #1: Type: text/plain, Size: 512 bytes --]
Hi!
Please find Completion/Unix/_emacs attached.
Note that I’ve been lazy and haven’t implemented _emacs_color, instead
using _x_color. It’s not worth the effort for me, as I never use any
of the color options, but if someone wants a challenge, perhaps
execute emacs in batch mode and run list-colors-display or some such.
Also note that I haven’t implemented +number and +line:column. It
shouldn’t be hard to do, but I couldn’t figure out how to do it
properly, so I left it alone.
[-- Attachment #2: _emacs --]
[-- Type: application/octet-stream, Size: 4422 bytes --]
#compdef emacs
local state line curcontext="$curcontext" ret=1
typeset -A opt_args
local -a terminal
if (( CURRENT == 2 )); then
terminal=('(-t --terminal)'{-t,--terminal}'[use given file as terminal instead of stdin/stdout]: :_files')
fi
# TODO +number, +line:column
# TODO --foreground-color and similar are more involved than _x_color
_x_arguments -C -S \
{--file,--find-file,--visit}'=[edit given file]:_files' \
'(-q --no-init-file)'{-q,--no-init-file}'[do not load an init file]' \
'--no-site-file[do not load site-wide startup file]' \
'--no-desktop[do not load a saved desktop]' \
'(-Q --quick)'{-Q,--quick}'[similar to -q --no-site-file --no-splash]' \
'--no-splash[do not display a splash screen during start-up]' \
'--debug-info[enable debugger during processing of user init file]' \
'(-u --user)'{-u,--user=}'[load init file of given user]: :_users' \
$terminal \
'(--daemon)-daemon[start as a daemon, enabling server and disconnecting from terminal]' \
'(-daemon)--daemon=-[start as a daemon, enabling server and disconnecting from terminal]::server name' \
'(- *)--version[display version information and exit]' \
'(- *)--help[display help information and exit]' \
'*'{-f,--function=}'[execute given lisp function]:function' \
'*'{-l,--load=}'[load given lisp file]: :_files -g "*.el(|c)"' \
'*'{--eval,--execute}'=[evaluate given lisp expression]:expression' \
'(-q --no-init-file)--batch[edit in batch mode]' \
'*--script=[run given file as a script file]: :_files' \
'*--insert=[insert contents of file into current buffer]: :_files' \
'--kill[exit while in batch mode]' \
'*'{-L,--directory=}'[add given directory to load path]: :_directories' \
'--name[specify name of first window]:name' \
'(-T --title)'{-T,--title=}'[specify title of first window]:title' \
'(-r -rv --reverse-video)'{-r,-rv,--reverse-video}'[display window in reverse video]' \
'(-fn --font)'{-fn,--font=}'[use given font as font of the window]: :_x_fonts' \
'*--xrm=[set X resource]: :_x_resources' \
'--color=[override color mode for terminal]: :->color' \
'(-bw --border-width)'{-bw,--border-width=}'[set border width of window]: :_x_border' \
'(-ib --internal-border)'{-ib,--internal-border=}'[set internal border width of window]: :_x_border' \
'(-lsp --line-spacing)'{-lsp,--line-spacing=}'[set additional line spacing]:spacing:_guard "[[\:digit\:]]#"' \
'(-vb --vertical-scrollbars)'{-vb,--vertical-scrollbars}'[enable vertical scrollbars]' \
'(-fh --full-height)'{-fh,--full-height}'[make first frame as high as screen]' \
'(-fs --full-screen)'{-fs,--fullscreen}'[make first frame fullscreen]' \
'(-fw --full-width)'{-fw,--full-width}'[make first frame as wide as screen]' \
'(-fh -fw -mm --maximized)'{-mm,--maximized}'[maximize first frame]' \
'(-fg --foreground-color)'{-fg,--foreground-color=}'[set text color]: :_x_color' \
'(-bg --background-color)'{-bg,--background-color=}'[set window color]: :_x_color' \
'(-bd --border-color)'{-bd,--border-color=}'[set border color]: :_x_color' \
'(-cr --cursor-color)'{-cr,--cursor-color=}'[set cursor color]: :_x_color' \
'(-ms --mouse-color)'{-ms,--mouse-color=}'[set mouse color]: :_x_color' \
'(-nbi --no-bitmap-icon)'{-nbi,--no-bitmap-icon}'[do not use gnu icon]' \
'--iconic[start in iconified state]' \
'(-nbc --no-blinking-cursor)'{-nbc,--no-blinking-cursor}'[disable blinking cursor]' \
'(--name -T --title -r -rv --reverse-video -fn --font --xrm -bw --border-width -ib --internal-border -lsp --line-spacing -vb --vertical-scrollbars -fh --full-height -fs --full-screen -fw --full-width -mm --maximized -fg --foreground-color -bg --background-color -bd --border-color -cr --cursor-color -ms --mouse-color -nbi --no-bitmap-icon --iconic -nbc --no-blinking-cursor -D --basic-display -nw --no-window-system)'{-nw,--no-window-system}'[do not create a frame (use terminal)]' \
'(-D --basic-display)'{-D,--basic-display}'[disable many display features]' \
'*: :_files' && ret=0
case $state in
(color)
local -a colors
colors=({never,no,-1}':do not use colors'
{default,auto,0}':determine automatically if colors should be used'
{ansi8,always,yes,8}':use colors unconditionally'
'16:use 16 colors'
'88:use 88 colors'
'256:use 256 colors')
_describe -t colors color colors && ret=0
;;
esac
return ret
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Completion/Unix/_emacs
2012-04-23 6:43 Completion/Unix/_emacs Nikolai Weibull
@ 2012-04-23 6:51 ` Nikolai Weibull
0 siblings, 0 replies; 2+ messages in thread
From: Nikolai Weibull @ 2012-04-23 6:51 UTC (permalink / raw)
To: Zsh Workers
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
On Mon, Apr 23, 2012 at 08:43, Nikolai Weibull <now@bitwi.se> wrote:
> Please find Completion/Unix/_emacs attached.
Here’s an updated version that does --display and --geometry properly.
[-- Attachment #2: _emacs --]
[-- Type: application/octet-stream, Size: 4742 bytes --]
#compdef emacs
local state line curcontext="$curcontext" ret=1
typeset -A opt_args
local -a terminal display
if (( CURRENT == 2 )); then
terminal=('(-t --terminal)'{-t,--terminal}'[use given file as terminal instead of stdin/stdout]: :_files')
display=('(-d --display)'{-d,--display=}'[tell server to display file on given display]: :_x_display')
fi
# TODO +number, +line:column
# TODO --foreground-color and similar are more involved than _x_color
_x_arguments -C -S \
{--file,--find-file,--visit}'=[edit given file]:_files' \
'(-q --no-init-file)'{-q,--no-init-file}'[do not load an init file]' \
'--no-site-file[do not load site-wide startup file]' \
'--no-desktop[do not load a saved desktop]' \
'(-Q --quick)'{-Q,--quick}'[similar to -q --no-site-file --no-splash]' \
'--no-splash[do not display a splash screen during start-up]' \
'--debug-info[enable debugger during processing of user init file]' \
'(-u --user)'{-u,--user=}'[load init file of given user]: :_users' \
$terminal \
'(--daemon)-daemon[start as a daemon, enabling server and disconnecting from terminal]' \
'(-daemon)--daemon=-[start as a daemon, enabling server and disconnecting from terminal]::server name' \
'(- *)--version[display version information and exit]' \
'(- *)--help[display help information and exit]' \
'*'{-f,--function=}'[execute given lisp function]:function' \
'*'{-l,--load=}'[load given lisp file]: :_files -g "*.el(|c)"' \
'*'{--eval,--execute}'=[evaluate given lisp expression]:expression' \
'(-q --no-init-file)--batch[edit in batch mode]' \
'*--script=[run given file as a script file]: :_files' \
'*--insert=[insert contents of file into current buffer]: :_files' \
'--kill[exit while in batch mode]' \
'*'{-L,--directory=}'[add given directory to load path]: :_directories' \
'--name[specify name of first window]:name' \
'(-T --title)'{-T,--title=}'[specify title of first window]:title' \
'(-r -rv --reverse-video)'{-r,-rv,--reverse-video}'[display window in reverse video]' \
'(-fn --font)'{-fn,--font=}'[use given font as font of the window]: :_x_fonts' \
'*--xrm=[set X resource]: :_x_resources' \
'--color=[override color mode for terminal]: :->color' \
'(-bw --border-width)'{-bw,--border-width=}'[set border width of window]: :_x_border' \
'(-ib --internal-border)'{-ib,--internal-border=}'[set internal border width of window]: :_x_border' \
'(-g --geometry)'{-g,--geometry=}'[set width, height, and position of window]: :_x_geometry' \
'(-lsp --line-spacing)'{-lsp,--line-spacing=}'[set additional line spacing]:spacing:_guard "[[\:digit\:]]#"' \
'(-vb --vertical-scrollbars)'{-vb,--vertical-scrollbars}'[enable vertical scrollbars]' \
'(-fh --full-height)'{-fh,--full-height}'[make first frame as high as screen]' \
'(-fs --full-screen)'{-fs,--fullscreen}'[make first frame fullscreen]' \
'(-fw --full-width)'{-fw,--full-width}'[make first frame as wide as screen]' \
'(-fh -fw -mm --maximized)'{-mm,--maximized}'[maximize first frame]' \
'(-fg --foreground-color)'{-fg,--foreground-color=}'[set text color]: :_x_color' \
'(-bg --background-color)'{-bg,--background-color=}'[set window color]: :_x_color' \
'(-bd --border-color)'{-bd,--border-color=}'[set border color]: :_x_color' \
'(-cr --cursor-color)'{-cr,--cursor-color=}'[set cursor color]: :_x_color' \
'(-ms --mouse-color)'{-ms,--mouse-color=}'[set mouse color]: :_x_color' \
$display \
'(-d --display)'{-d,--display=}'[tell server to display file on given display]: :_x_display' \
'(-nbi --no-bitmap-icon)'{-nbi,--no-bitmap-icon}'[do not use gnu icon]' \
'--iconic[start in iconified state]' \
'(-nbc --no-blinking-cursor)'{-nbc,--no-blinking-cursor}'[disable blinking cursor]' \
'(--name -T --title -r -rv --reverse-video -fn --font --xrm -bw --border-width -ib --internal-border -lsp --line-spacing -vb --vertical-scrollbars -fh --full-height -fs --full-screen -fw --full-width -mm --maximized -fg --foreground-color -bg --background-color -bd --border-color -cr --cursor-color -ms --mouse-color -nbi --no-bitmap-icon --iconic -nbc --no-blinking-cursor -D --basic-display -nw --no-window-system)'{-nw,--no-window-system}'[do not create a frame (use terminal)]' \
'(-D --basic-display)'{-D,--basic-display}'[disable many display features]' \
'*: :_files' && ret=0
case $state in
(color)
local -a colors
colors=({never,no,-1}':do not use colors'
{default,auto,0}':determine automatically if colors should be used'
{ansi8,always,yes,8}':use colors unconditionally'
'16:use 16 colors'
'88:use 88 colors'
'256:use 256 colors')
_describe -t colors color colors && ret=0
;;
esac
return ret
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-23 6:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 6:43 Completion/Unix/_emacs Nikolai Weibull
2012-04-23 6:51 ` Completion/Unix/_emacs Nikolai Weibull
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).