diff --git a/ChangeLog b/ChangeLog
index ef74d0fdb9c2fb063733c9291f53bf89c93ca620..970f44a05579cffa1d0309417fb79ec8f525a4aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-03-09  Benno Schulenberg  <bensberg@justemail.net>
+	* src/rcfile.c (parse_syntax): Produce an adequate error message
+	when the syntax name is unquoted.  This fixes Savannah bug #47324.
+
 2016-03-04  Benno Schulenberg  <bensberg@justemail.net>
 	* src/color.c (found_in_list): Don't bother keeping the compiled
 	regular expression when it matched -- drop this tiny optimization
diff --git a/src/rcfile.c b/src/rcfile.c
index e7dd76921d95cd2aea104e3b7d6ec24697f14dcf..7e6343124b26e98f323c5f73b563f15dbb4c3fbe 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -266,7 +266,7 @@ bool nregcomp(const char *regex, int eflags)
  * global list of color syntaxes. */
 void parse_syntax(char *ptr)
 {
-    const char *fileregptr = NULL, *nameptr = NULL;
+    char *fileregptr, *nameptr;
     regexlisttype *endext = NULL;
 	/* The end of the extensions list for this syntax. */
 
@@ -274,21 +274,24 @@ void parse_syntax(char *ptr)
 
     assert(ptr != NULL);
 
-    if (*ptr == '\0') {
+    /* Check that the syntax name is not empty. */
+    if (*ptr == '\0' || (*ptr == '"' &&
+			(*(ptr + 1) == '\0' || *(ptr + 1) == '"'))) {
 	rcfile_error(N_("Missing syntax name"));
 	return;
     }
 
-    if (*ptr != '"') {
-	rcfile_error(
-		N_("Regex strings must begin and end with a \" character"));
+    nameptr = ++ptr;
+    ptr = parse_next_word(ptr);
+
+    /* Check that the name starts and ends with a double quote. */
+    if (*(nameptr - 1) != '\x22' || nameptr[strlen(nameptr) - 1] != '\x22') {
+	rcfile_error(N_("A syntax name must be quoted"));
 	return;
     }
 
-    nameptr = ++ptr;
-    ptr = parse_next_regex(ptr);
-    if (ptr == NULL)
-	return;
+    /* Strip the end quote. */
+    nameptr[strlen(nameptr) - 1] = '\0';
 
     /* Redefining the "none" syntax is not allowed. */
     if (strcmp(nameptr, "none") == 0) {