Skip to content

Commit a9c8cc6

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 3c352f0 + 38ea784 commit a9c8cc6

25 files changed

+663
-155
lines changed

Filelist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ SRC_ALL = \
8888
src/search.c \
8989
src/sha256.c \
9090
src/sign.c \
91+
src/sound.c \
9192
src/spell.c \
9293
src/spell.h \
9394
src/spellfile.c \
@@ -150,6 +151,7 @@ SRC_ALL = \
150151
src/testdir/samples/test000 \
151152
src/testdir/if_ver*.vim \
152153
src/testdir/color_ramp.vim \
154+
src/testdir/silent.wav \
153155
src/proto.h \
154156
src/protodef.h \
155157
src/proto/arabic.pro \
@@ -209,6 +211,7 @@ SRC_ALL = \
209211
src/proto/search.pro \
210212
src/proto/sha256.pro \
211213
src/proto/sign.pro \
214+
src/proto/sound.pro \
212215
src/proto/spell.pro \
213216
src/proto/spellfile.pro \
214217
src/proto/syntax.pro \

runtime/doc/eval.txt

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2326,6 +2326,7 @@ extend({expr1}, {expr2} [, {expr3}])
23262326
exp({expr}) Float exponential of {expr}
23272327
expand({expr} [, {nosuf} [, {list}]])
23282328
any expand special keywords in {expr}
2329+
expandcmd({expr}) String expand {expr} like with `:edit`
23292330
feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer
23302331
filereadable({file}) Number |TRUE| if {file} is a readable file
23312332
filewritable({file}) Number |TRUE| if {file} is a writable file
@@ -2622,6 +2623,12 @@ sin({expr}) Float sine of {expr}
26222623
sinh({expr}) Float hyperbolic sine of {expr}
26232624
sort({list} [, {func} [, {dict}]])
26242625
List sort {list}, using {func} to compare
2626+
sound_playevent({name} [, {callback}])
2627+
Number play an event sound
2628+
sound_playfile({name} [, {callback}])
2629+
Number play a sound file
2630+
sound_stop({id}) none stop playing sound {id}
2631+
sound_stopall() none stop playing all sounds
26252632
soundfold({word}) String sound-fold {word}
26262633
spellbadword() String badly spelled word at cursor
26272634
spellsuggest({word} [, {max} [, {capital}]])
@@ -4212,6 +4219,14 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()*
42124219
See |glob()| for finding existing files. See |system()| for
42134220
getting the raw output of an external command.
42144221

4222+
expandcmd({expr}) *expandcmd()*
4223+
Expand special items in {expr} like what is done for an Ex
4224+
command such as `:edit`. This expands special keywords, like
4225+
with |expand()|, and environment variables, anywhere in
4226+
{expr}. Returns the expanded string.
4227+
Example: >
4228+
:echo expandcmd('make %<.o')
4229+
<
42154230
extend({expr1}, {expr2} [, {expr3}]) *extend()*
42164231
{expr1} and {expr2} must be both |Lists| or both
42174232
|Dictionaries|.
@@ -8837,6 +8852,49 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
88378852
return a:i1 - a:i2
88388853
endfunc
88398854
<
8855+
*sound_playevent()*
8856+
sound_playevent({name} [, {callback}])
8857+
Play a sound identified by {name}. Which event names are
8858+
supported depends on the system. Often the XDG sound names
8859+
are used. On Ubuntu they may be found in
8860+
/usr/share/sounds/freedesktop/stereo. Example: >
8861+
call sound_playevent('bell')
8862+
8863+
< When {callback} is specified it is invoked when the sound is
8864+
finished. The first argument is the sound ID, the second
8865+
argument is the status:
8866+
0 sound was played to the end
8867+
1 sound was interruped
8868+
2 error occured after sound started
8869+
Example: >
8870+
func Callback(id, status)
8871+
echomsg "sound " .. a:id .. " finished with " .. a:status
8872+
endfunc
8873+
call sound_playevent('bell', 'Callback')
8874+
8875+
< Returns the sound ID, which can be passed to `sound_stop()`.
8876+
Returns zero if the sound could not be played.
8877+
{only available when compiled with the +sound feature}
8878+
8879+
*sound_playfile()*
8880+
sound_playfile({name} [, {callback}])
8881+
Like `sound_playevent()` but play sound file {name}. {name}
8882+
must be a full path. On Ubuntu you may find files to play
8883+
with this command: >
8884+
:!find /usr/share/sounds -type f | grep -v index.theme
8885+
8886+
< {only available when compiled with the +sound feature}
8887+
8888+
8889+
sound_stop({id}) *sound_stop()*
8890+
Stop playing sound {id}. {id} must be previously returned by
8891+
`sound_playevent()` or `sound_playfile()`.
8892+
{only available when compiled with the +sound feature}
8893+
8894+
sound_stopall() *sound_stopall()*
8895+
Stop playing all sounds.
8896+
{only available when compiled with the +sound feature}
8897+
88408898
*soundfold()*
88418899
soundfold({word})
88428900
Return the sound-folded equivalent of {word}. Uses the first
@@ -10759,6 +10817,7 @@ scrollbind Compiled with 'scrollbind' support. (always true)
1075910817
showcmd Compiled with 'showcmd' support.
1076010818
signs Compiled with |:sign| support.
1076110819
smartindent Compiled with 'smartindent' support.
10820+
sound Compiled with sound support, e.g. `sound_playevent()`
1076210821
spell Compiled with spell checking support |spell|.
1076310822
startuptime Compiled with |--startuptime| support.
1076410823
statusline Compiled with support for 'statusline', 'rulerformat'

runtime/doc/tags

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6220,6 +6220,7 @@ exp() eval.txt /*exp()*
62206220
expand() eval.txt /*expand()*
62216221
expand-env options.txt /*expand-env*
62226222
expand-environment-var options.txt /*expand-environment-var*
6223+
expandcmd() eval.txt /*expandcmd()*
62236224
expr eval.txt /*expr*
62246225
expr-! eval.txt /*expr-!*
62256226
expr-!= eval.txt /*expr-!=*
@@ -8812,6 +8813,10 @@ slow-terminal term.txt /*slow-terminal*
88128813
socket-interface channel.txt /*socket-interface*
88138814
sort() eval.txt /*sort()*
88148815
sorting change.txt /*sorting*
8816+
sound_playevent() eval.txt /*sound_playevent()*
8817+
sound_playfile() eval.txt /*sound_playfile()*
8818+
sound_stop() eval.txt /*sound_stop()*
8819+
sound_stopall() eval.txt /*sound_stopall()*
88158820
soundfold() eval.txt /*soundfold()*
88168821
space intro.txt /*space*
88178822
spec-customizing pi_spec.txt /*spec-customizing*

runtime/doc/usr_41.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*usr_41.txt* For Vim version 8.1. Last change: 2019 May 29
1+
*usr_41.txt* For Vim version 8.1. Last change: 2019 Jun 09
22

33
VIM USER MANUAL - by Bram Moolenaar
44

@@ -609,6 +609,7 @@ String manipulation: *string-functions*
609609
strcharpart() get part of a string using char index
610610
strgetchar() get character from a string using char index
611611
expand() expand special keywords
612+
expandcmd() expand a command like done for `:edit`
612613
iconv() convert text from one encoding to another
613614
byteidx() byte index of a character in a string
614615
byteidxcomp() like byteidx() but count composing characters

src/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,7 @@ BASIC_SRC = \
16451645
search.c \
16461646
sha256.c \
16471647
sign.c \
1648+
sound.c \
16481649
spell.c \
16491650
spellfile.c \
16501651
syntax.c \
@@ -1760,6 +1761,7 @@ OBJ_COMMON = \
17601761
objects/search.o \
17611762
objects/sha256.o \
17621763
objects/sign.o \
1764+
objects/sound.o \
17631765
objects/spell.o \
17641766
objects/spellfile.o \
17651767
objects/syntax.o \
@@ -1900,6 +1902,7 @@ PRO_AUTO = \
19001902
search.pro \
19011903
sha256.pro \
19021904
sign.pro \
1905+
sound.pro \
19031906
spell.pro \
19041907
spellfile.pro \
19051908
syntax.pro \
@@ -3261,6 +3264,9 @@ objects/sha256.o: sha256.c
32613264
objects/sign.o: sign.c
32623265
$(CCC) -o $@ sign.c
32633266

3267+
objects/sound.o: sound.c
3268+
$(CCC) -o $@ sound.c
3269+
32643270
objects/spell.o: spell.c
32653271
$(CCC) -o $@ spell.c
32663272

@@ -3707,6 +3713,10 @@ objects/sign.o: sign.c vim.h protodef.h auto/config.h feature.h os_unix.h \
37073713
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
37083714
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
37093715
proto.h globals.h
3716+
objects/sound.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
3717+
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
3718+
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
3719+
proto.h globals.h
37103720
objects/spell.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
37113721
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
37123722
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \

0 commit comments

Comments
 (0)