el/dot-emacs.el: Delete stray blank line.
[profile] / el / dot-emacs.el
index a04ac26..f3fffe9 100644 (file)
@@ -62,7 +62,7 @@ This may be at the expense of cool features.")
   "Turn a LIST of strings into a single regular expression at compile-time."
   (declare (indent nil)
           (debug 0))
-  `',(make-regexp list))
+  `',(make-regexp (sort (copy-list list) #'string<)))
 
 (defun mdw-wrong ()
   "This is not the key sequence you're looking for."
@@ -656,7 +656,6 @@ Evil key bindings are defined in `mdw-evil-keymap-keys'."
                                            ("" "hyperref" nil)
                                            "\\tolerance=1000")))
 
-
 (setq org-export-docbook-xslt-proc-command "xsltproc --output %o %s %i"
       org-export-docbook-xsl-fo-proc-command "fop %i.safe %o"
       org-export-docbook-xslt-stylesheet
@@ -2396,8 +2395,8 @@ indentation anyway."
       (let ((key (car item)) (value (cdr item)))
        (if (let* ((key-name (symbol-name key))
                   (key-len (length key-name)))
-             (and (>= key-len 5)
-                  (string= (subseq key-name (- key-len 5)) "-alist")))
+             (and (>= key-len 6)
+                  (string= (subseq key-name (- key-len 6)) "-alist")))
            (push (cons key
                        (mdw-merge-style-alists value
                                                (cdr (assoc key second))))
@@ -3280,7 +3279,7 @@ name, as a symbol."
             ;; And anything else is punctuation.
             (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
                   '(0 mdw-punct-face)))
-           font-lock-syntactic-face-function nil))
+           font-lock-syntactic-face-function nil))
 
   ;; Hack key bindings.
   (local-set-key [?{] 'mdw-self-insert-and-indent)
@@ -3440,7 +3439,7 @@ strip numbers instead."
              python-indent-offset 2
              python-fill-docstring-style 'symmetric)
 
-(defun mdw-fontify-pythonic (keywords)
+(defun mdw-fontify-pythonic (keywords builtins)
 
   ;; Miscellaneous fiddling.
   (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)")
@@ -3455,6 +3454,10 @@ strip numbers instead."
           ;; Set up the keywords defined above.
           (list (concat "\\_<\\(" keywords "\\)\\_>")
                 '(0 font-lock-keyword-face))
+          (list (concat "\\(^\\|[^.]\\)\\_<\\(" builtins "\\)\\_>")
+                '(2 font-lock-variable-name-face))
+          (list (concat "\\_<\\(__\\(\\sw+\\|\\s_+\\)+__\\)\\_>")
+                '(0 font-lock-variable-name-face))
 
           ;; At least numbers are simpler than C.
           (list (concat "\\_<0\\([xX][0-9a-fA-F]+\\|[oO]?[0-7]+\\|[bB][01]+\\)\\|"
@@ -3470,11 +3473,128 @@ strip numbers instead."
 
 (defun mdw-fontify-python ()
   (mdw-fontify-pythonic
-   (mdw-regexps "and" "as" "assert" "break" "class" "continue" "def"
-               "del" "elif" "else" "except" "exec" "finally" "for"
-               "from" "global" "if" "import" "in" "is" "lambda"
-               "not" "or" "pass" "print" "raise" "return" "try"
-               "while" "with" "yield")))
+   (mdw-regexps "and" "as" "assert" "async" "await"
+               "break"
+               "case" "class" "continue"
+               "def" "del"
+               "elif" "else" "except" ;"exec"
+               "finally" "for" "from"
+               "global"
+               "if" "import" "in" "is"
+               "lambda"
+               "match"
+               "nonlocal"
+               "not"
+               "or"
+               "pass" ;"print"
+               "raise" "return"
+               "try" ;"type"
+               "while" "with"
+               "yield")
+
+   (mdw-regexps "Ellipsis"
+               "False"
+               "None" "NotImplemented"
+               "True"
+               "__debug__"
+
+               "BaseException"
+                 "BaseExceptionGroup"
+                 "Exception"
+                   "StandardError"
+                     "ArithmeticError"
+                       "FloatingPointError"
+                       "OverflowError"
+                       "ZeroDivisionError"
+                     "AssertionError"
+                     "AttributeError"
+                     "BufferError"
+                     "EnvironmentError"
+                       "IOError"
+                       "OSError"
+                         "BlockingIOError"
+                         "ChildProcessError"
+                         "ConnectionError"
+                           "BrokenPipeError"
+                           "ConnectionAbortedError"
+                           "ConnectionRefusedError"
+                           "ConnectionResetError"
+                         "FileExistsError"
+                         "FileNotFoundError"
+                         "InterruptedError"
+                         "IsADirectoryError"
+                         "NotADirectoryError"
+                         "PermissionError"
+                         "TimeoutError"
+                     "EOFError"
+                     "ExceptionGroup"
+                     "ImportError"
+                       "ModuleNotFoundError"
+                     "LookupError"
+                       "IndexError"
+                       "KeyError"
+                     "MemoryError"
+                     "NameError"
+                       "UnboundLocalError"
+                     "ReferenceError"
+                     "RuntimeError"
+                       "NotImplementedError"
+                       "RecursionError"
+                     "SyntaxError"
+                       "IndentationError"
+                         "TabError"
+                     "SystemError"
+                     "TypeError"
+                     "ValueError"
+                       "UnicodeError"
+                         "UnicodeDecodeError"
+                         "UnicodeEncodeError"
+                         "UnicodeTranslateError"
+                   "StopIteration"
+                   "Warning"
+                     "BytesWarning"
+                     "DeprecationWarning"
+                     "EncodingWarning"
+                     "FutureWarning"
+                     "ImportWarning"
+                     "PendingDeprecationWarning"
+                     "ResourceWarning"
+                     "RuntimeWarning"
+                     "SyntaxWarning"
+                     "UnicodeWarning"
+                     "UserWarning"
+                 "GeneratorExit"
+                 "KeyboardInterrupt"
+                 "SystemExit"
+
+               "abs" "absolute_import" "aiter"
+                 "all" "anext" "any" "apply" "ascii"
+               "basestring" "bin" "bool" "breakpoint"
+                 "buffer" "bytearray" "bytes"
+               "callable" "coerce" "chr" "classmethod"
+                 "cmp" "compile" "complex"
+               "delattr" "dict" "dir" "divmod"
+               "enumerate" "eval" "exec" "execfile"
+               "file" "filter" "float" "format" "frozenset"
+               "getattr" "globals"
+               "hasattr" "hash" "help" "hex"
+               "id" "input" "int" "intern"
+                 "isinstance" "issubclass" "iter"
+               "len" "list" "locals" "long"
+               "map" "max" "memoryview" "min"
+               "next"
+               "object" "oct" "open" "ord"
+               "pow" "print" "property"
+               "range" "raw_input" "reduce" "reload"
+                 "repr" "reversed" "round"
+               "set" "setattr" "slice" "sorted"
+                 "staticmethod" "str" "sum" "super"
+               "tuple" "type"
+               "unichr" "unicode"
+               "vars"
+               "xrange"
+               "zip"
+               "__import__")))
 
 (defun mdw-fontify-pyrex ()
   (mdw-fontify-pythonic
@@ -3483,7 +3603,8 @@ strip numbers instead."
                "extern" "finally" "for" "from" "global" "if"
                "import" "in" "is" "lambda" "not" "or" "pass" "print"
                "property" "raise" "return" "struct" "try" "while" "with"
-               "yield")))
+               "yield")
+   ""))
 
 (define-derived-mode pyrex-mode python-mode "Pyrex"
   "Major mode for editing Pyrex source code")