From 045d2a50ddccbebba315aac55f60dfa270b36d7f Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 27 Oct 2020 18:46:16 +0100 Subject: [PATCH] Revert "Fontify strings in {} better in tcl-mode" This reverts commit 7f32224dc324b0ee0f1b512c8d8b19aeb80141c1. The changes led to things like proc foo5 () { return 6 } being fontified as a string, which is wrong. --- lisp/progmodes/tcl.el | 45 +++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 583f4e396e5..717008a0a22 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -386,36 +386,32 @@ Call `tcl-set-font-lock-keywords' after changing this list.") Default list includes some TclX keywords. Call `tcl-set-font-lock-keywords' after changing this list.") +(defvar tcl-builtin-list + '("after" "append" "array" "bgerror" "binary" "catch" "cd" "clock" + "close" "concat" "console" "dde" "encoding" "eof" "exec" "expr" + "fblocked" "fconfigure" "fcopy" "file" "fileevent" "flush" + "format" "gets" "glob" "history" "incr" "info" "interp" "join" + "lappend" "lindex" "linsert" "list" "llength" "load" "lrange" + "lreplace" "lsort" "namespace" "open" "package" "pid" "puts" "pwd" + "read" "regexp" "registry" "regsub" "rename" "scan" "seek" "set" + "socket" "source" "split" "string" "subst" "tell" "time" "trace" + "unknown" "unset" "vwait") + "List of Tcl commands. Used only for highlighting. +Call `tcl-set-font-lock-keywords' after changing this list. +This list excludes those commands already found in `tcl-proc-list' and +`tcl-keyword-list'.") + (defvar tcl-font-lock-keywords nil "Keywords to highlight for Tcl. See variable `font-lock-keywords'. This variable is generally set from `tcl-proc-regexp', `tcl-typeword-list', and `tcl-keyword-list' by the function `tcl-set-font-lock-keywords'.") -(eval-and-compile - (defvar tcl-builtin-list - '("after" "append" "array" "bgerror" "binary" "catch" "cd" "clock" - "close" "concat" "console" "dde" "encoding" "eof" "exec" "expr" - "fblocked" "fconfigure" "fcopy" "file" "fileevent" "flush" - "format" "gets" "glob" "history" "incr" "info" "interp" "join" - "lappend" "lindex" "linsert" "list" "llength" "load" "lrange" - "lreplace" "lsort" "namespace" "open" "package" "pid" "puts" "pwd" - "read" "regexp" "registry" "regsub" "rename" "scan" "seek" "set" - "socket" "source" "split" "string" "subst" "tell" "time" "trace" - "unknown" "unset" "vwait") - "List of Tcl commands. Used only for highlighting. -Call `tcl-set-font-lock-keywords' after changing this list. -This list excludes those commands already found in `tcl-proc-list' and -`tcl-keyword-list'.") - - (defconst tcl-syntax-propertize-function - (syntax-propertize-rules - ;; Mark the few `#' that are not comment-markers. - ("[^;[{ \t\n][ \t]*\\(#\\)" (1 ".")) - ((concat "\\_<" (regexp-opt tcl-builtin-list t) - "\\_>" "\s*{\\([^}].*\\)}") - (2 "_"))) - "Syntactic keywords for `tcl-mode'.")) +(defconst tcl-syntax-propertize-function + (syntax-propertize-rules + ;; Mark the few `#' that are not comment-markers. + ("[^;[{ \t\n][ \t]*\\(#\\)" (1 "."))) + "Syntactic keywords for `tcl-mode'.") ;; FIXME need some way to recognize variables because array refs look ;; like 2 sexps. @@ -510,7 +506,6 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'." ;; number of "namespace::" qualifiers. A leading "::" refers ;; to the global namespace. '("\\${\\([^}]+\\)}" 1 font-lock-variable-name-face) - '("{\\([^}]+\\)}" 1 font-lock-string-face) '("\\$\\(\\(?:::\\)?\\(?:[[:alnum:]_]+::\\)*[[:alnum:]_]+\\)" 1 font-lock-variable-name-face) '("\\(?:\\s-\\|^\\|\\[\\)set\\s-+{\\([^}]+\\)}" -- 2.39.2