diff --git a/src/sound.c b/src/sound.c
index abe412c..04a1651 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1,6 +1,6 @@
-/* vi:set ts=8 sts=4 sw=4 noet:
+/* vi:set ts=8 sts=4 sw=4 et:
  *
- * VIM - Vi IMproved	by Bram Moolenaar
+ * VIM - Vi IMproved    by Bram Moolenaar
  *
  * Do ":help uganda"  in Vim to read copying and usage conditions.
  * Do ":help credits" in Vim to see a list of people who contributed.
@@ -15,17 +15,17 @@
 
 #if defined(FEAT_SOUND) || defined(PROTO)
 
-static long	    sound_id = 0;
+static long         sound_id = 0;
 
 // soundcb_T is typedef'ed in proto/sound.pro
 
 struct soundcb_S {
-    callback_T	snd_callback;
+    callback_T  snd_callback;
 #ifdef MSWIN
-    MCIDEVICEID	snd_device_id;
-    long	snd_id;
+    MCIDEVICEID snd_device_id;
+    long        snd_id;
 #endif
-    soundcb_T	*snd_next;
+    soundcb_T   *snd_next;
 };
 
 static soundcb_T    *first_callback = NULL;
@@ -43,27 +43,27 @@
     static soundcb_T *
 get_sound_callback(typval_T *arg)
 {
-    callback_T	callback;
-    soundcb_T	*soundcb;
+    callback_T  callback;
+    soundcb_T   *soundcb;
 
     if (arg->v_type == VAR_UNKNOWN)
-	return NULL;
+        return NULL;
     callback = get_callback(arg);
     if (callback.cb_name == NULL)
-	return NULL;
+        return NULL;
 
     soundcb = ALLOC_ONE(soundcb_T);
     if (soundcb == NULL)
     {
-	free_callback(&callback);
-	return NULL;
+        free_callback(&callback);
+        return NULL;
     }
 
     soundcb->snd_next = first_callback;
     first_callback = soundcb;
     set_callback(&soundcb->snd_callback, &callback);
     if (callback.cb_free_name)
-	vim_free(callback.cb_name);
+        vim_free(callback.cb_name);
     return soundcb;
 }
 
@@ -73,8 +73,8 @@
     void
 call_sound_callback(soundcb_T *soundcb, long snd_id, int result)
 {
-    typval_T	argv[3];
-    typval_T	rettv;
+    typval_T    argv[3];
+    typval_T    rettv;
 
     argv[0].v_type = VAR_NUMBER;
     argv[0].vval.v_number = snd_id;
@@ -92,20 +92,20 @@
     void
 delete_sound_callback(soundcb_T *soundcb)
 {
-    soundcb_T	*p;
-    soundcb_T	*prev = NULL;
+    soundcb_T   *p;
+    soundcb_T   *prev = NULL;
 
     for (p = first_callback; p != NULL; prev = p, p = p->snd_next)
-	if (p == soundcb)
-	{
-	    if (prev == NULL)
-		first_callback = p->snd_next;
-	    else
-		prev->snd_next = p->snd_next;
-	    free_callback(&p->snd_callback);
-	    vim_free(p);
-	    break;
-	}
+        if (p == soundcb)
+        {
+            if (prev == NULL)
+                first_callback = p->snd_next;
+            else
+                prev->snd_next = p->snd_next;
+            free_callback(&p->snd_callback);
+            vim_free(p);
+            break;
+        }
 }
 
 #if defined(HAVE_CANBERRA) || defined(PROTO)
@@ -121,10 +121,10 @@
 typedef struct soundcb_queue_S soundcb_queue_T;
 
 struct soundcb_queue_S {
-    soundcb_queue_T	*scb_next;
-    uint32_t		scb_id;		// ID of the sound
-    int			scb_result;	// CA_ value
-    soundcb_T		*scb_callback;	// function to call
+    soundcb_queue_T     *scb_next;
+    uint32_t            scb_id;         // ID of the sound
+    int                 scb_result;     // CA_ value
+    soundcb_T           *scb_callback;  // function to call
 };
 
 // Queue of callbacks to invoke from the main loop.
@@ -137,24 +137,24 @@
  */
     static void
 sound_callback(
-	ca_context  *c UNUSED,
-	uint32_t    id,
-	int	    error_code,
-	void	    *userdata)
+        ca_context  *c UNUSED,
+        uint32_t    id,
+        int         error_code,
+        void        *userdata)
 {
-    soundcb_T	    *soundcb = (soundcb_T *)userdata;
+    soundcb_T       *soundcb = (soundcb_T *)userdata;
     soundcb_queue_T *scb;
 
     scb = ALLOC_ONE(soundcb_queue_T);
     if (scb == NULL)
-	return;
+        return;
     scb->scb_next = callback_queue;
     callback_queue = scb;
     scb->scb_id = id;
     scb->scb_result = error_code == CA_SUCCESS ? 0
-			  : error_code == CA_ERROR_CANCELED
-					    || error_code == CA_ERROR_DESTROYED
-			  ? 1 : 2;
+                          : error_code == CA_ERROR_CANCELED
+                                            || error_code == CA_ERROR_DESTROYED
+                          ? 1 : 2;
     scb->scb_callback = soundcb;
 }
 
@@ -177,13 +177,13 @@
 
     while (callback_queue != NULL)
     {
-	scb = callback_queue;
-	callback_queue = scb->scb_next;
+        scb = callback_queue;
+        callback_queue = scb->scb_next;
 
-	call_sound_callback(scb->scb_callback, scb->scb_id, scb->scb_result);
+        call_sound_callback(scb->scb_callback, scb->scb_id, scb->scb_result);
 
-	delete_sound_callback(scb->scb_callback);
-	vim_free(scb);
+        delete_sound_callback(scb->scb_callback);
+        vim_free(scb);
     }
     redraw_after_callback(TRUE, FALSE);
 }
@@ -192,47 +192,47 @@
 sound_play_common(typval_T *argvars, typval_T *rettv, int playfile)
 {
     if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     if (context == NULL)
-	ca_context_create(&context);
+        ca_context_create(&context);
     if (context == NULL)
-	return;
+        return;
 
-    soundcb_T	*soundcb = get_sound_callback(&argvars[1]);
-    int		res = CA_ERROR_INVALID;
+    soundcb_T   *soundcb = get_sound_callback(&argvars[1]);
+    int         res = CA_ERROR_INVALID;
 
     ++sound_id;
     if (soundcb == NULL)
     {
-	res = ca_context_play(context, sound_id,
-		playfile ? CA_PROP_MEDIA_FILENAME : CA_PROP_EVENT_ID,
-		tv_get_string(&argvars[0]),
-		CA_PROP_CANBERRA_CACHE_CONTROL, "volatile",
-		NULL);
+        res = ca_context_play(context, sound_id,
+                playfile ? CA_PROP_MEDIA_FILENAME : CA_PROP_EVENT_ID,
+                tv_get_string(&argvars[0]),
+                CA_PROP_CANBERRA_CACHE_CONTROL, "volatile",
+                NULL);
     }
     else
     {
-	static ca_proplist *proplist = NULL;
+        static ca_proplist *proplist = NULL;
 
-	ca_proplist_create(&proplist);
-	if (proplist != NULL)
-	{
-	    if (playfile)
-		ca_proplist_sets(proplist, CA_PROP_MEDIA_FILENAME,
-			(char *)tv_get_string(&argvars[0]));
-	    else
-		ca_proplist_sets(proplist, CA_PROP_EVENT_ID,
-			(char *)tv_get_string(&argvars[0]));
-	    ca_proplist_sets(proplist, CA_PROP_CANBERRA_CACHE_CONTROL,
-		    "volatile");
-	    res = ca_context_play_full(context, sound_id, proplist,
-		    sound_callback, soundcb);
-	    if (res != CA_SUCCESS)
-		delete_sound_callback(soundcb);
+        ca_proplist_create(&proplist);
+        if (proplist != NULL)
+        {
+            if (playfile)
+                ca_proplist_sets(proplist, CA_PROP_MEDIA_FILENAME,
+                        (char *)tv_get_string(&argvars[0]));
+            else
+                ca_proplist_sets(proplist, CA_PROP_EVENT_ID,
+                        (char *)tv_get_string(&argvars[0]));
+            ca_proplist_sets(proplist, CA_PROP_CANBERRA_CACHE_CONTROL,
+                    "volatile");
+            res = ca_context_play_full(context, sound_id, proplist,
+                    sound_callback, soundcb);
+            if (res != CA_SUCCESS)
+                delete_sound_callback(soundcb);
 
-	    ca_proplist_destroy(proplist);
-	}
+            ca_proplist_destroy(proplist);
+        }
     }
     rettv->vval.v_number = res == CA_SUCCESS ? sound_id : 0;
 }
@@ -259,10 +259,10 @@
 f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
 {
     if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     if (context != NULL)
-	ca_context_cancel(context, tv_get_number(&argvars[0]));
+        ca_context_cancel(context, tv_get_number(&argvars[0]));
 }
 
 /*
@@ -272,7 +272,7 @@
 f_sound_clear(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
 {
     if (context == NULL)
-	return;
+        return;
     ca_context_destroy(context);
     context = NULL;
 }
@@ -284,17 +284,17 @@
     soundcb_queue_T *scb;
 
     if (context != NULL)
-	ca_context_destroy(context);
+        ca_context_destroy(context);
 
     while (first_callback != NULL)
-	delete_sound_callback(first_callback);
+        delete_sound_callback(first_callback);
 
     while (callback_queue != NULL)
     {
-	scb = callback_queue;
-	callback_queue = scb->scb_next;
-	delete_sound_callback(scb->scb_callback);
-	vim_free(scb);
+        scb = callback_queue;
+        callback_queue = scb->scb_next;
+        delete_sound_callback(scb->scb_callback);
+        vim_free(scb);
     }
 }
 # endif
@@ -310,29 +310,29 @@
     static LRESULT CALLBACK
 sound_wndproc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
-    soundcb_T	*p;
+    soundcb_T   *p;
 
     switch (message)
     {
-	case MM_MCINOTIFY:
-	    for (p = first_callback; p != NULL; p = p->snd_next)
-		if (p->snd_device_id == (MCIDEVICEID) lParam)
-		{
-		    char	buf[32];
+        case MM_MCINOTIFY:
+            for (p = first_callback; p != NULL; p = p->snd_next)
+                if (p->snd_device_id == (MCIDEVICEID) lParam)
+                {
+                    char        buf[32];
 
-		    vim_snprintf(buf, sizeof(buf), "close sound%06ld",
-								p->snd_id);
-		    mciSendStringA(buf, NULL, 0, 0);
+                    vim_snprintf(buf, sizeof(buf), "close sound%06ld",
+                                                                p->snd_id);
+                    mciSendStringA(buf, NULL, 0, 0);
 
-		    long result =   wParam == MCI_NOTIFY_SUCCESSFUL ? 0
-				  : wParam == MCI_NOTIFY_ABORTED ? 1 : 2;
-		    call_sound_callback(p, p->snd_id, result);
+                    long result =   wParam == MCI_NOTIFY_SUCCESSFUL ? 0
+                                  : wParam == MCI_NOTIFY_ABORTED ? 1 : 2;
+                    call_sound_callback(p, p->snd_id, result);
 
-		    delete_sound_callback(p);
-		    redraw_after_callback(TRUE, FALSE);
+                    delete_sound_callback(p);
+                    redraw_after_callback(TRUE, FALSE);
 
-		}
-	    break;
+                }
+            break;
     }
 
     return DefWindowProc(hwnd, message, wParam, lParam);
@@ -343,12 +343,12 @@
 {
     if (g_hWndSound == NULL)
     {
-	LPCSTR clazz = "VimSound";
-	WNDCLASS wndclass = {
-	    0, sound_wndproc, 0, 0, g_hinst, NULL, 0, 0, NULL, clazz };
-	RegisterClass(&wndclass);
-	g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0,
-		HWND_MESSAGE, NULL, g_hinst, NULL);
+        LPCSTR clazz = "VimSound";
+        WNDCLASS wndclass = {
+            0, sound_wndproc, 0, 0, g_hinst, NULL, 0, 0, NULL, clazz };
+        RegisterClass(&wndclass);
+        g_hWndSound = CreateWindow(clazz, NULL, 0, 0, 0, 0, 0,
+                HWND_MESSAGE, NULL, g_hinst, NULL);
     }
 
     return g_hWndSound;
@@ -357,33 +357,33 @@
     void
 f_sound_playevent(typval_T *argvars, typval_T *rettv)
 {
-    WCHAR	    *wp;
+    WCHAR           *wp;
 
     if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     wp = enc_to_utf16(tv_get_string(&argvars[0]), NULL);
     if (wp == NULL)
-	return;
+        return;
 
     if (PlaySoundW(wp, NULL, SND_ASYNC | SND_ALIAS))
-	rettv->vval.v_number = ++sound_id;
+        rettv->vval.v_number = ++sound_id;
     free(wp);
 }
 
     void
 f_sound_playfile(typval_T *argvars, typval_T *rettv)
 {
-    long	newid = sound_id + 1;
-    size_t	len;
-    char_u	*p, *filename;
-    WCHAR	*wp;
-    soundcb_T	*soundcb;
-    char	buf[32];
-    MCIERROR	err;
+    long        newid = sound_id + 1;
+    size_t      len;
+    char_u      *p, *filename;
+    WCHAR       *wp;
+    soundcb_T   *soundcb;
+    char        buf[32];
+    MCIERROR    err;
 
     if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     filename = tv_get_string(&argvars[0]);
 
@@ -391,24 +391,24 @@
     p = alloc(len);
     if (p == NULL)
     {
-	return;
+        return;
     }
     vim_snprintf((char *)p, len, "open \"%s\" alias sound%06ld", filename, newid);
 
     wp = enc_to_utf16((char_u *)p, NULL);
     free(p);
     if (wp == NULL)
-	return;
+        return;
 
     err = mciSendStringW(wp, NULL, 0, sound_window());
     free(wp);
     if (err != 0)
-	return;
+        return;
 
     vim_snprintf(buf, sizeof(buf), "play sound%06ld notify", newid);
     err = mciSendStringA(buf, NULL, 0, sound_window());
     if (err != 0)
-	goto failure;
+        goto failure;
 
     sound_id = newid;
     rettv->vval.v_number = sound_id;
@@ -416,9 +416,9 @@
     soundcb = get_sound_callback(&argvars[1]);
     if (soundcb != NULL)
     {
-	vim_snprintf(buf, sizeof(buf), "sound%06ld", newid);
-	soundcb->snd_id = newid;
-	soundcb->snd_device_id = mciGetDeviceID(buf);
+        vim_snprintf(buf, sizeof(buf), "sound%06ld", newid);
+        soundcb->snd_id = newid;
+        soundcb->snd_device_id = mciGetDeviceID(buf);
     }
     return;
 
@@ -434,7 +434,7 @@
     char    buf[32];
 
     if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     id = tv_get_number(&argvars[0]);
     vim_snprintf(buf, sizeof(buf), "stop sound%06ld", id);
@@ -455,7 +455,7 @@
     CloseWindow(g_hWndSound);
 
     while (first_callback != NULL)
-	delete_sound_callback(first_callback);
+        delete_sound_callback(first_callback);
 }
 # endif
 
@@ -466,7 +466,7 @@
 sound_play_common(typval_T *argvars, typval_T *rettv, bool playfile)
 {
     if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
-	return;
+        return;
 
     char_u *sound_name = tv_get_string(&argvars[0]);
     soundcb_T *soundcb = get_sound_callback(&argvars[1]);
@@ -476,7 +476,7 @@
     bool play_success = sound_mch_play(sound_name, sound_id, soundcb, playfile);
     if (!play_success && soundcb)
     {
-	delete_sound_callback(soundcb);
+        delete_sound_callback(soundcb);
     }
     rettv->vval.v_number = play_success ? sound_id : 0;
 }
@@ -497,7 +497,7 @@
 f_sound_stop(typval_T *argvars, typval_T *rettv UNUSED)
 {
     if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
-	return;
+        return;
     sound_mch_stop(tv_get_number(&argvars[0]));
 }
 
@@ -513,7 +513,7 @@
 {
     sound_mch_free();
     while (first_callback != NULL)
-	delete_sound_callback(first_callback);
+        delete_sound_callback(first_callback);
 }
 #endif
 
diff --git a/src/version.c b/src/version.c
index 2e89485..27d5bc6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    829,
+/**/
     828,
 /**/
     827,
