Linux iad1-shared-b7-18 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
Apache
: 67.205.6.31 | : 216.73.216.47
Cant Read [ /etc/named.conf ]
8.2.29
fernandoquevedo
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
share /
jed /
lib /
[ HOME SHELL ]
Name
Size
Permission
Action
colors
[ DIR ]
drwxr-xr-x
abbrev.sl
838
B
-rw-r--r--
abbrev.slc
636
B
-rw-r--r--
abbrmisc.sl
2.15
KB
-rw-r--r--
abbrmisc.slc
1.98
KB
-rw-r--r--
aboutjed.hlp
252
B
-rw-r--r--
acompile.sl
2.04
KB
-rw-r--r--
acompile.slc
2.02
KB
-rw-r--r--
aprocess.sl
267
B
-rw-r--r--
aprocess.slc
238
B
-rw-r--r--
ashell.sl
7.69
KB
-rw-r--r--
ashell.slc
6.96
KB
-rw-r--r--
backups.sl
1.41
KB
-rw-r--r--
backups.slc
637
B
-rw-r--r--
bibtex.sl
17.05
KB
-rw-r--r--
bibtex.slc
12.74
KB
-rw-r--r--
binary.sl
589
B
-rw-r--r--
binary.slc
522
B
-rw-r--r--
bookmark.sl
1.6
KB
-rw-r--r--
bookmark.slc
1.2
KB
-rw-r--r--
brief.sl
5.98
KB
-rw-r--r--
buf.sl
3.41
KB
-rw-r--r--
buf.slc
1.96
KB
-rw-r--r--
bufed.sl
6.69
KB
-rw-r--r--
bufed.slc
4.68
KB
-rw-r--r--
bytecomp.sl
3.38
KB
-rw-r--r--
cal.sl
6.4
KB
-rw-r--r--
cal.slc
4.44
KB
-rw-r--r--
chglog.sl
3.13
KB
-rw-r--r--
chglog.slc
2.62
KB
-rw-r--r--
cmisc.sl
4.91
KB
-rw-r--r--
cmisc.slc
4
KB
-rw-r--r--
cmode.dfa
7.58
KB
-rw-r--r--
cmode.sl
40.06
KB
-rw-r--r--
cmode.slc
27.9
KB
-rw-r--r--
comments.sl
7.99
KB
-rw-r--r--
comments.slc
5.93
KB
-rw-r--r--
compat.sl
1.39
KB
-rw-r--r--
compile.sl
11.44
KB
-rw-r--r--
compile.slc
5.83
KB
-rw-r--r--
compress.sl
3.12
KB
-rw-r--r--
compress.slc
2.73
KB
-rw-r--r--
cpright.hlp
464
B
-rw-r--r--
ctags.sl
9.53
KB
-rw-r--r--
ctags.slc
7.34
KB
-rw-r--r--
cua.hlp
385
B
-rw-r--r--
cua.sl
7.56
KB
-rw-r--r--
cua.slc
3.91
KB
-rw-r--r--
cuamisc.sl
5.7
KB
-rw-r--r--
cuamisc.slc
1.63
KB
-rw-r--r--
dabbrev.sl
13.77
KB
-rw-r--r--
dabbrev.slc
8.05
KB
-rw-r--r--
dcl.sl
4.68
KB
-rw-r--r--
dcl.slc
4.5
KB
-rw-r--r--
defaults.sl
1.07
KB
-rw-r--r--
digraph.sl
3.8
KB
-rw-r--r--
digraph.slc
1.04
KB
-rw-r--r--
dired.sl
17.78
KB
-rw-r--r--
dired.slc
12.69
KB
-rw-r--r--
docbook.sl
38.33
KB
-rw-r--r--
docbook.slc
38.41
KB
-rw-r--r--
dos437.sl
998
B
-rw-r--r--
dos850.sl
1.3
KB
-rw-r--r--
dos852.sl
1.14
KB
-rw-r--r--
edt.hlp
1.6
KB
-rw-r--r--
edt.sl
14.55
KB
-rw-r--r--
edt.slc
7.93
KB
-rw-r--r--
emacs.hlp
227
B
-rw-r--r--
emacs.sl
6.86
KB
-rw-r--r--
emacs.slc
6.31
KB
-rw-r--r--
emacsmsc.sl
3.52
KB
-rw-r--r--
emacsmsc.slc
3.52
KB
-rw-r--r--
emul.sl
87
B
-rw-r--r--
f90.sl
22.75
KB
-rw-r--r--
f90.slc
18.39
KB
-rw-r--r--
ff90.sl
56
B
-rw-r--r--
ff90.slc
82
B
-rw-r--r--
filter.sl
646
B
-rw-r--r--
filter.slc
562
B
-rw-r--r--
folding.sl
13.47
KB
-rw-r--r--
folding.slc
11.13
KB
-rw-r--r--
fortran.sl
10.65
KB
-rw-r--r--
fortran.slc
7.79
KB
-rw-r--r--
generic.hlp
135
B
-rw-r--r--
gpg.sl
4.89
KB
-rw-r--r--
gpg.slc
4.51
KB
-rw-r--r--
help.sl
15.37
KB
-rw-r--r--
help.slc
12
KB
-rw-r--r--
history.sl
5.73
KB
-rw-r--r--
history.slc
2.2
KB
-rw-r--r--
hooks.sl
1.95
KB
-rw-r--r--
hooks.slc
1.74
KB
-rw-r--r--
html.dfa
6.13
KB
-rw-r--r--
html.sl
13.63
KB
-rw-r--r--
html.slc
10.06
KB
-rw-r--r--
ide.hlp
1.25
KB
-rw-r--r--
ide.sl
22.57
KB
-rw-r--r--
ide.slc
20.07
KB
-rw-r--r--
idl.sl
5.58
KB
-rw-r--r--
idl.slc
5.34
KB
-rw-r--r--
info.sl
19.92
KB
-rw-r--r--
info.slc
17.16
KB
-rw-r--r--
isearch.sl
7.7
KB
-rw-r--r--
isearch.slc
5.01
KB
-rw-r--r--
iso-lat2.sl
963
B
-rw-r--r--
iso-lat2.slc
1010
B
-rw-r--r--
iso-lat3.sl
1.3
KB
-rw-r--r--
iso-lat3.slc
994
B
-rw-r--r--
iso-latin.sl
625
B
-rw-r--r--
iso-latin.slc
420
B
-rw-r--r--
iso2xxx.sl
1.77
KB
-rw-r--r--
iso2xxx.slc
1.39
KB
-rw-r--r--
ispell.sl
2.99
KB
-rw-r--r--
ispell.slc
2.26
KB
-rw-r--r--
javamode.dfa
7.59
KB
-rw-r--r--
javamode.sl
3.24
KB
-rw-r--r--
javamode.slc
3.29
KB
-rw-r--r--
jed.hlp
356
B
-rw-r--r--
jed.rc
9.43
KB
-rw-r--r--
jed.sl
3.57
KB
-rw-r--r--
jed.slc
4.01
KB
-rw-r--r--
jedhelp.sl
1.43
KB
-rw-r--r--
jedhelp.slc
1.49
KB
-rw-r--r--
jedusage.sl
967
B
-rw-r--r--
jedusage.slc
1.08
KB
-rw-r--r--
keycode.sl
4.46
KB
-rw-r--r--
keydefs.sl
9.21
KB
-rw-r--r--
keydefs.slc
6.63
KB
-rw-r--r--
krconv.sl
1.86
KB
-rw-r--r--
krconv.slc
1.45
KB
-rw-r--r--
latex.sl
27.01
KB
-rw-r--r--
latex.slc
20.94
KB
-rw-r--r--
latex209.sl
2.24
KB
-rw-r--r--
latex209.slc
1.57
KB
-rw-r--r--
linux.sl
821
B
-rw-r--r--
lisp.sl
1.21
KB
-rw-r--r--
lisp.slc
1.1
KB
-rw-r--r--
ltx-comp.dat
2.01
KB
-rw-r--r--
ltx-math.sl
4.12
KB
-rw-r--r--
ltx-math.slc
3.95
KB
-rw-r--r--
lua.sl
13.05
KB
-rw-r--r--
macro.sl
2.08
KB
-rw-r--r--
macro.slc
1.95
KB
-rw-r--r--
mail.sl
4.82
KB
-rw-r--r--
mail.slc
4.17
KB
-rw-r--r--
mailalias.sl
6.21
KB
-rw-r--r--
mailalias.slc
3.61
KB
-rw-r--r--
mailedit.sl
10.79
KB
-rw-r--r--
mailutils.sl
3.52
KB
-rw-r--r--
makemode.sl
6.83
KB
-rw-r--r--
man.sl
1.8
KB
-rw-r--r--
man.slc
948
B
-rw-r--r--
maple.sl
2.14
KB
-rw-r--r--
maple.slc
1.91
KB
-rw-r--r--
matlab.sl
5.07
KB
-rw-r--r--
matlab.slc
4.07
KB
-rw-r--r--
menu.sl
4.7
KB
-rw-r--r--
menu.slc
3.91
KB
-rw-r--r--
menus.sl
2.31
KB
-rw-r--r--
menus.slc
1.74
KB
-rw-r--r--
mime.sl
1.98
KB
-rw-r--r--
mime.slc
1.75
KB
-rw-r--r--
mimemisc.sl
684
B
-rw-r--r--
mimemisc.slc
733
B
-rw-r--r--
mini.sl
4.54
KB
-rw-r--r--
mini.slc
3.73
KB
-rw-r--r--
minued.sl
8.99
KB
-rw-r--r--
minued.slc
4.37
KB
-rw-r--r--
misc.sl
4.01
KB
-rw-r--r--
misc.slc
2.51
KB
-rw-r--r--
modehook.sl
3.71
KB
-rw-r--r--
modehook.slc
1.64
KB
-rw-r--r--
modeinfo.sl
1.6
KB
-rw-r--r--
modeinfo.slc
1.48
KB
-rw-r--r--
most.sl
3.64
KB
-rw-r--r--
most.slc
3.13
KB
-rw-r--r--
mouse.sl
5.15
KB
-rw-r--r--
mousex.sl
8.33
KB
-rw-r--r--
mousex.slc
4.36
KB
-rw-r--r--
mswmouse.sl
6.85
KB
-rw-r--r--
mutekeys.sl
3.19
KB
-rw-r--r--
mutekeys.slc
1.49
KB
-rw-r--r--
nroff.sl
1.09
KB
-rw-r--r--
nroff.slc
709
B
-rw-r--r--
occur.sl
1.48
KB
-rw-r--r--
occur.slc
1.03
KB
-rw-r--r--
os.sl
4.22
KB
-rw-r--r--
paste.sl
509
B
-rw-r--r--
paste.slc
485
B
-rw-r--r--
perl.sl
33.63
KB
-rw-r--r--
perl.slc
13.77
KB
-rw-r--r--
perlxtra.sl
13.1
KB
-rw-r--r--
perlxtra.slc
5.18
KB
-rw-r--r--
php.sl
83.23
KB
-rw-r--r--
php.slc
54.16
KB
-rw-r--r--
pipe.sl
567
B
-rw-r--r--
pipe.slc
579
B
-rw-r--r--
popups.sl
9.03
KB
-rw-r--r--
popups.slc
8.88
KB
-rw-r--r--
preparse.sl
1.69
KB
-rw-r--r--
pscript.dfa
21.64
KB
-rw-r--r--
pscript.sl
4.79
KB
-rw-r--r--
pscript.slc
4.3
KB
-rw-r--r--
pushmode.sl
1.84
KB
-rw-r--r--
pushmode.slc
1.55
KB
-rw-r--r--
pymode.sl
17.24
KB
-rw-r--r--
pymode.slc
12.9
KB
-rw-r--r--
python.dfa
6.54
KB
-rw-r--r--
rcs.sl
4.27
KB
-rw-r--r--
rcs.slc
2.86
KB
-rw-r--r--
recent.sl
4.53
KB
-rw-r--r--
recent.slc
2.73
KB
-rw-r--r--
recentx.sl
10.13
KB
-rw-r--r--
recentx.slc
6.38
KB
-rw-r--r--
regexp.sl
1.63
KB
-rw-r--r--
regexp.slc
1.54
KB
-rw-r--r--
register.sl
4.11
KB
-rw-r--r--
register.slc
3.1
KB
-rw-r--r--
replace.sl
1.39
KB
-rw-r--r--
replace.slc
1.09
KB
-rw-r--r--
rmail.sl
38.64
KB
-rw-r--r--
rmail.slc
35.99
KB
-rw-r--r--
rot13.sl
497
B
-rw-r--r--
rot13.slc
379
B
-rw-r--r--
runpgm.sl
690
B
-rw-r--r--
sccs.sl
4.33
KB
-rw-r--r--
sccs.slc
2.54
KB
-rw-r--r--
search.sl
2.5
KB
-rw-r--r--
search.slc
2.29
KB
-rw-r--r--
seldisp.sl
806
B
-rw-r--r--
seldisp.slc
617
B
-rw-r--r--
sendmail.sl
7.02
KB
-rw-r--r--
sendmail.slc
5.73
KB
-rw-r--r--
session.sl
5.91
KB
-rw-r--r--
session.slc
3.46
KB
-rw-r--r--
shell.sl
6.26
KB
-rw-r--r--
shell.slc
3.32
KB
-rw-r--r--
shmode.dfa
1.57
KB
-rw-r--r--
shmode.sl
2.33
KB
-rw-r--r--
shmode.slc
1.91
KB
-rw-r--r--
simple.hlp
407
B
-rw-r--r--
site.sl
76.36
KB
-rw-r--r--
site.slc
36.67
KB
-rw-r--r--
slmode.dfa
3.22
KB
-rw-r--r--
slmode.sl
7.1
KB
-rw-r--r--
slmode.slc
5.79
KB
-rw-r--r--
sort.sl
1.21
KB
-rw-r--r--
sort.slc
1.13
KB
-rw-r--r--
sortmisc.sl
751
B
-rw-r--r--
sortmisc.slc
546
B
-rw-r--r--
spicemod.sl
1.06
KB
-rw-r--r--
spicemod.slc
1.03
KB
-rw-r--r--
srchmisc.sl
3.22
KB
-rw-r--r--
srchmisc.slc
2.56
KB
-rw-r--r--
syncproc.sl
3.58
KB
-rw-r--r--
syncproc.slc
2.36
KB
-rw-r--r--
syntax.sl
3.05
KB
-rw-r--r--
syntax.slc
1.47
KB
-rw-r--r--
tabs.sl
1.39
KB
-rw-r--r--
tabs.slc
1.31
KB
-rw-r--r--
tclmode.dfa
4.69
KB
-rw-r--r--
tclmode.sl
10.41
KB
-rw-r--r--
tclmode.slc
6.11
KB
-rw-r--r--
tex.sl
2.39
KB
-rw-r--r--
tex.slc
779
B
-rw-r--r--
texcom.dfa
1.5
KB
-rw-r--r--
texcom.sl
4.75
KB
-rw-r--r--
texcom.slc
4.12
KB
-rw-r--r--
textmode.sl
2.05
KB
-rw-r--r--
textmode.slc
974
B
-rw-r--r--
tiasm.sl
1.16
KB
-rw-r--r--
tiasm.slc
1.11
KB
-rw-r--r--
tmisc.sl
841
B
-rw-r--r--
tmisc.slc
786
B
-rw-r--r--
tmmode.sl
2.01
KB
-rw-r--r--
tmmode.slc
1.65
KB
-rw-r--r--
tmpfile.sl
2.83
KB
-rw-r--r--
tmpfile.slc
1.56
KB
-rw-r--r--
tpascal.dfa
7.65
KB
-rw-r--r--
tpascal.sl
5.77
KB
-rw-r--r--
tpascal.slc
5.51
KB
-rw-r--r--
untab.sl
1021
B
-rw-r--r--
untab.slc
569
B
-rw-r--r--
util.sl
544
B
-rw-r--r--
util.slc
293
B
-rw-r--r--
verilog.sl
1.49
KB
-rw-r--r--
verilog.slc
1.52
KB
-rw-r--r--
vhdlmode.sl
8.45
KB
-rw-r--r--
vhdlmode.slc
5.6
KB
-rw-r--r--
vmshelp.sl
2.25
KB
-rw-r--r--
win1250.sl
1.29
KB
-rw-r--r--
wmark.sl
4.36
KB
-rw-r--r--
wmark.slc
3.61
KB
-rw-r--r--
wmenu.sl
4.72
KB
-rw-r--r--
wmenu.slc
4.86
KB
-rw-r--r--
wordstar.hlp
909
B
-rw-r--r--
wordstar.sl
15.56
KB
-rw-r--r--
wordstar.slc
13.93
KB
-rw-r--r--
xformreg.sl
1.7
KB
-rw-r--r--
xformreg.slc
1.36
KB
-rw-r--r--
yankpop.sl
2.21
KB
-rw-r--r--
yankpop.slc
2.01
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : dabbrev.sl
% Complete the current word looking for similar word-beginnings % % Versions % 1 May 1994 Adrian Savage (afs@jumper.mcc.ac.uk) % Extensively modified by JED % 2.0 2003-05-01 rewrite by G.Milde <g.milde@web.de> % added support for scanning in a list of buffers % 2.1 added customizability % 2.2 look at last finding first % (as emacs does, tip P. Boekholt) % 2.2.1 bugfix: invalid mark when buffer of last % expansion killed (P. Boekholt) % 2.3 2003-12-01 prevent flooding the undo-buffer (using getkey for % subsequent invocations) % 2.3.1 2003-12-05 replaced unget_keystring with buffer_keystring % 2.4 2004-03-15 dabbrev() takes a prefix argument for the % buflist-scope (this is checked in dab_reset()) % clearer documentation (open_buffers -> all buffers) % (hints by J. E. Davis) % 2.4.1 2004-03-30 new custom var Dabbrev_Case_Search % added documentation for custom vars and get_buflist % 3.0 2004-04-03 Changed much of the code to permit to allow for greater % extensibility. % 3.0.1 2004-06-07 Minor bug fixes (P. Boekholt) % % % USAGE: % Put in path und bind to a key, e.g. % setkey("dabbrev", "^A"); % expand from Dabbrev_Default_Buflist % setkey("dabbrev(get_buflist(1))", "\ea"); % expand from visible buffers % % You can use any function that returns a list of buffers as argument, % make sure it is declared, e.g. with autoload("get_buflist", "dabbrev"); % % You could even define your own metafunction that does something usefull % (e.g. open a buffer) and then calls dabbrev("buf1\nbuf2\n ...") to expand % from listed buffers. % % CUSTOMIZATION % % Some custom variables can be used to tune the behaviour of dabbrev: % (The defaults are set to make dabbrev work as version 1) % % "Dabbrev_delete_tail", 0 % replace the existing completion % "Dabbrev_Default_Buflist", 0 % default to whatbuf() % "Dabbrev_Look_in_Folds", 1 % open folds when scanning for completions % --------------------------------------------------------------------------- % debug info, uncomment to trace down bugs % _traceback = 1; % _debug_info = 1; % --- Variables % %!%+ %\variable{Dabbrev_delete_tail} %\synopsis{Let completion replace word tail?} %\usage{Int_Type Dabbrev_delete_tail = 0} %\description % Should the completion replace the part of the word behind the cursor? %\seealso{dabbrev} %!%- custom_variable("Dabbrev_delete_tail", 0); %!%+ %\variable{Dabbrev_Default_Buflist} %\synopsis{Which buffers should dabbrev expand from?} %\usage{Int_Type Dabbrev_Default_Buflist = 0} %\description % The buffer-list when dabbrev is called without argument % 0 = current buffer, % 1 = visible buffers (including the current), % 2 = all buffers of same mode, % 3 = all buffers, % 4 = other visible buffers (excluding the current), % 5 = all other buffers of same mode (excluding the current), % 6 = all other buffers (excluding the current) %\seealso{dabbrev} %!%- custom_variable("Dabbrev_Default_Buflist", 0); %!%+ %\variable{Dabbrev_Look_in_Folds} %\synopsis{Scan folds for expansions} %\usage{Int_Type Dabbrev_Look_in_Folds = 1} %\description % Should dabbrev scan folded parts of the source buffer(s) % for expansions too? %\seealso{dabbrev} %!%- custom_variable("Dabbrev_Look_in_Folds", 1); %!%+ %\variable{Dabbrev_Case_Search} %\synopsis{Let dabbrev stick to case} %\usage{Int_Type Dabbrev_Case_Search = 1} %\description % Should dabbrev consider the case of words when looking for expansions? % Will be overridden by a blocal variable "Dabbrev_Case_Search" or by the % mode-info variable "dabbrev_case_search". %\seealso{dabbrev} %!%- custom_variable("Dabbrev_Case_Search", 0); % --- Functions private define get_buffer_mode_name (buf) { setbuf (buf); return get_mode_name (); } private define get_buflist(scope) { variable cbuf = whatbuf (); ifnot(scope) return cbuf; variable buffers = [buffer_list (), pop ()]; if (scope > 3) { buffers = buffers [where (buffers != cbuf)]; scope -= 3; } variable i; % prune hidden buffers, unless editing one if (cbuf[0] != ' ') { i = where (array_map (Int_Type, &strncmp, buffers, " ", 1)); buffers = buffers[i]; } switch (scope) { case 1: i = array_map (Int_Type, &buffer_visible, buffers); } { case 2: variable mode = get_mode_name (); i = (mode == array_map (String_Type, &get_buffer_mode_name, buffers)); setbuf (cbuf); } { case 3: i = [1:length(buffers)]; } buffers = buffers[where (i)]; return strjoin (buffers, "\n"); } % get the word tail private define dab_get_word_tail(word_chars, kill) { push_mark; skip_chars(word_chars); exchange_point_and_mark(); if (kill) return bufsubstr_delete(); else return bufsubstr(); } private variable Dab_Context_Type = struct { scan_mark, completion_list, patterns, pattern_index, buffer_list, buffer_list_index, match_methods, match_methods_index, word_chars, search_dir, start_mark, completion, prefix_mark, start_buffer, % buffer being edited and where completion is to take place }; % Switch to buf, mark position, widen if narrowed % TODO: How about hidden lines? private define enter_buffer (c, buf) { c.start_mark = create_user_mark (); setbuf (buf); push_spot(); if (count_narrows() and Dabbrev_Look_in_Folds) { push_narrow (); widen_buffer (); } if (c.scan_mark != NULL) goto_user_mark (c.scan_mark); else if (buf != c.start_buffer) % start search at EOB, otherwise a completion at the current point in this buffer may % be missed. eob (); } private define leave_buffer (c) { pop_narrow (); pop_spot (); setbuf (user_mark_buffer (c.start_mark)); goto_user_mark (c.start_mark); } private define dab_exact_match (prefix, word) { if (strncmp (prefix, word, strlen (prefix))) return NULL; return word; } private define dab_uppercase_match (prefix, word) { return strup (word); } private define dab_lowercase_match (prefix, word) { return strlow (word); } private define create_completion_context () % (buflist = whatbuf()) { % List of buffers to scan for completions variable c = @Dab_Context_Type; variable buffer_list; c.start_buffer = whatbuf(); if (_NARGS) { if (_NARGS > 1) error ("Incorrect usage of dabbrev-- one argument expected"); buffer_list = (); if (typeof (buffer_list) != String_Type) buffer_list = get_buflist (buffer_list); } else { variable buflist_scope = prefix_argument(-1); if (buflist_scope == -1) buflist_scope = Dabbrev_Default_Buflist; % buflist_scope = get_blocal("Dabbrev_Default_Buflist", % Dabbrev_Default_Buflist; buffer_list = get_buflist(buflist_scope); } if (strlen (buffer_list) == 0) c.buffer_list = String_Type[0]; else c.buffer_list = strchop (buffer_list, '\n', 0); c.buffer_list_index = 0; % get word_chars from: 1. mode_info, 2. blocal_var, 3. get_word_chars variable word_chars = mode_get_mode_info("dabbrev_word_chars"); if (word_chars == NULL) { if (blocal_var_exists("Word_Chars")) word_chars = get_blocal_var("Word_Chars"); else word_chars = "_" + get_word_chars(); } c.word_chars = word_chars; % Get patterns to expand from (keep cursor position) push_mark (); bskip_chars ("^" + word_chars); variable tmp = create_user_mark (); bskip_chars (word_chars); c.prefix_mark = create_user_mark (); exchange_point_and_mark(); variable pattern = bufsubstr (); if (tmp == c.prefix_mark) error("nothing to expand"); c.patterns = [pattern]; c.pattern_index = 0; c.completion_list = Assoc_Type[Int_Type]; c.completion_list[""] = 1; c.match_methods = [&dab_exact_match]; variable cs = NULL; if (blocal_var_exists("Dabbrev_Case_Search")) cs = get_blocal_var("Dabbrev_Case_Search"); else cs = mode_get_mode_info ("dabbrev_case_search"); if (cs == NULL) cs = Dabbrev_Case_Search; if (cs == 0) { if (strlow (pattern) == pattern) c.match_methods = [c.match_methods, &dab_lowercase_match]; if (strup (pattern) == pattern) c.match_methods = [c.match_methods, &dab_uppercase_match]; } c.match_methods_index = 0; c.search_dir = 0; return c; } private define dab_search (c, search_dir, match_method, pattern) { variable cs = CASE_SEARCH; EXIT_BLOCK { CASE_SEARCH = cs; } CASE_SEARCH = 0; variable found, word_chars = c.word_chars, prefix_mark = c.prefix_mark; forever { do { if (search_dir == 1) { go_right(1); found = fsearch (pattern); } else found = bsearch (pattern); ifnot (found) return NULL; % test whether at begin of a word push_spot(); bskip_chars(word_chars); variable m = create_user_mark (); pop_spot(); } while ((m != create_user_mark ()) or (m == prefix_mark)); variable len = strlen (pattern); push_spot (); push_mark (); go_right (len); %skip_chars ("^" + word_chars); skip_chars (word_chars); variable word = bufsubstr (); pop_spot (); word = (@match_method) (pattern, word); if (word != NULL) return substr (word, len+1, -1); } } private define is_completion_ok (c, completion) { if (assoc_key_exists (c.completion_list, completion)) return 0; c.completion_list[completion] = 1; return 1; } private define dab_process_buffer (c, buf, pattern) { enter_buffer (c, buf); % spot pushed EXIT_BLOCK { leave_buffer (c); } variable dir = c.search_dir; while (dir < 2) { variable match_methods_index = c.match_methods_index; variable match_methods_index_max = length (c.match_methods); while (match_methods_index < match_methods_index_max) { variable match_method = c.match_methods[match_methods_index]; variable completion = dab_search (c, dir, match_method, pattern); if (completion == NULL) { goto_spot (); % go back and start the search over match_methods_index++; continue; } if (is_completion_ok (c, completion)) { c.match_methods_index = match_methods_index; c.scan_mark = create_user_mark (); c.search_dir = dir; return completion; } } c.match_methods_index = 0; dir++; } c.search_dir = 0; c.scan_mark = NULL; return NULL; } private define dab_expand (c) { variable completion; while (c.pattern_index < length (c.patterns)) { variable pattern = c.patterns[c.pattern_index]; variable buffer_list_index = c.buffer_list_index; variable buffer_list_index_max = length (c.buffer_list); while (buffer_list_index < buffer_list_index_max) { completion = dab_process_buffer (c, c.buffer_list[buffer_list_index], pattern); if (completion != NULL) { c.buffer_list_index = buffer_list_index; return completion; } buffer_list_index++; } c.buffer_list_index = 0; c.pattern_index++; } c.pattern_index = 0; vmessage("No more completions for \"%s\" in [%s]", strjoin(c.patterns, ","), strjoin(c.buffer_list, ",")); return NULL; } % ----- main function -------------------------------------------------- %!%+ %\function{dabbrev} %\synopsis{Complete the current word looking for similar words} %\usage{dabbrev([optional_argument])} %\description % Takes the current stem (part of word before the cursor) % and scans the current buffer for words that begin with this stem. % The current word is expanded by the non-stem part of the finding. % Subsequent calls to dabbrev replace the last completion with the next % guess. % % The search for completions takes place over a list of buffers specified % by the \var{Dabbrev_Default_Buflist} variable unless \var{dabbrev} has % been called with an argument. The optional argument may either be an % integer whose value is interpreted as for \var{Dabbrev_Default_Buflist}, % or a string containing a newline separated list of buffer names to search. % % The scan proceeds as follows: %#v+ % foreach buffer in buflist % from cursor backwards to the beginning of the buffer % from cursor forwards to the end of the buffer %#v- %\example % The current buffer contains the line %#v+ % foo is better than foobar, foobase or foo %#v- % with the cursor at the end of the line. % dabbrev completes foo with foobase. % If called again (immediately) foobase is changed to foobar % If called once again, foobase is changed to foo and a message is % given: No more completions. % %\notes % You can use the optional argument to have keybindings to different % "flavours" of dabbrev. %#v+ % setkey("dabbrev", "^A"); % expand from Dabbrev_Default_Buflist % setkey("dabbrev(1)", "\ea"); % expand from visible buffers % setkey("dabbrev(\"wordlist\")","\e^A"); % expand from the buffer "wordlist" %#v- % %\seealso{Dabbrev_Default_Buflist, Dabbrev_Look_in_Folds} %!%- private variable Completion_Context = NULL; private variable Completion = NULL; private define before_key_hook (); private define before_key_hook (fun) { if (typeof (fun) == Ref_Type) fun = "&"; if ((0 == is_substr (fun, "dabbrev")) or (Completion == NULL)) { remove_from_hook ("_jed_before_key_hooks", &before_key_hook); Completion_Context = NULL; return; } push_mark(); go_left(strlen (Completion)); del_region(); } public define dabbrev() %(buflist=whatbuf()) { variable type, fun, key, args = __pop_args(_NARGS); add_to_hook ("_jed_before_key_hooks", &before_key_hook); if (Completion_Context == NULL) Completion_Context = create_completion_context (__push_args (args)); Completion = dab_expand (Completion_Context); if (Completion != NULL) insert (Completion); }
Close