el/dot-emacs.el: Treat the Python soft keywords more carefully.
[profile] / el / dot-emacs.el
index 7c58433..cd648c1 100644 (file)
@@ -633,6 +633,17 @@ Evil key bindings are defined in `mdw-evil-keymap-keys'."
                                         :key-type string
                                         :value-type string))))
 
+(setq org-emphasis-regexp-components
+       '("- \t('\"{}"                  ; prematch
+         "- \t.,:!?;'\")}\\["          ; postmatch
+         " \t\r\n"                     ; /forbidden/ as border
+         "."                           ; body regexp
+         1))                           ; maximum newlines
+
+(setq org-entities-user
+       ;; NAME LATEX MATHP HTML ASCII LATIN1 UTF8
+       '(("relax" "" nil "" "" "" "")))
+
 (eval-after-load "org-latex"
   '(setq org-export-latex-classes
           (append mdw-org-latex-defs org-export-latex-classes)))
@@ -656,7 +667,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
@@ -3440,7 +3450,7 @@ strip numbers instead."
              python-indent-offset 2
              python-fill-docstring-style 'symmetric)
 
-(defun mdw-fontify-pythonic (keywords builtins)
+(defun mdw-fontify-pythonic (keywords soft-keywords builtins)
 
   ;; Miscellaneous fiddling.
   (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)")
@@ -3455,6 +3465,8 @@ strip numbers instead."
           ;; Set up the keywords defined above.
           (list (concat "\\_<\\(" keywords "\\)\\_>")
                 '(0 font-lock-keyword-face))
+          (list (concat "\\(^\\|[^.]\\)\\_<\\(" soft-keywords "\\)\\_>")
+                '(2 font-lock-keyword-face))
           (list (concat "\\(^\\|[^.]\\)\\_<\\(" builtins "\\)\\_>")
                 '(2 font-lock-variable-name-face))
           (list (concat "\\_<\\(__\\(\\sw+\\|\\s_+\\)+__\\)\\_>")
@@ -3474,23 +3486,27 @@ strip numbers instead."
 
 (defun mdw-fontify-python ()
   (mdw-fontify-pythonic
-   (mdw-regexps "and" "as" "assert"
+   (mdw-regexps "and" "as" "assert" "async" "await"
                "break"
                "class" "continue"
                "def" "del"
-               "elif" "else" "except" "exec"
+               "elif" "else" "except" ;"exec"
                "finally" "for" "from"
                "global"
                "if" "import" "in" "is"
                "lambda"
+               "nonlocal"
                "not"
                "or"
-               "pass" "print"
+               "pass" ;"print"
                "raise" "return"
-               "try"
+               "try" ;"type"
                "while" "with"
                "yield")
 
+   (mdw-regexps "case"
+               "match")
+
    (mdw-regexps "Ellipsis"
                "False"
                "None" "NotImplemented"
@@ -3498,6 +3514,7 @@ strip numbers instead."
                "__debug__"
 
                "BaseException"
+                 "BaseExceptionGroup"
                  "Exception"
                    "StandardError"
                      "ArithmeticError"
@@ -3510,8 +3527,24 @@ strip numbers instead."
                      "EnvironmentError"
                        "IOError"
                        "OSError"
+                         "BlockingIOError"
+                         "ChildProcessError"
+                         "ConnectionError"
+                           "BrokenPipeError"
+                           "ConnectionAbortedError"
+                           "ConnectionRefusedError"
+                           "ConnectionResetError"
+                         "FileExistsError"
+                         "FileNotFoundError"
+                         "InterruptedError"
+                         "IsADirectoryError"
+                         "NotADirectoryError"
+                         "PermissionError"
+                         "TimeoutError"
                      "EOFError"
+                     "ExceptionGroup"
                      "ImportError"
+                       "ModuleNotFoundError"
                      "LookupError"
                        "IndexError"
                        "KeyError"
@@ -3521,6 +3554,7 @@ strip numbers instead."
                      "ReferenceError"
                      "RuntimeError"
                        "NotImplementedError"
+                       "RecursionError"
                      "SyntaxError"
                        "IndentationError"
                          "TabError"
@@ -3535,9 +3569,11 @@ strip numbers instead."
                    "Warning"
                      "BytesWarning"
                      "DeprecationWarning"
+                     "EncodingWarning"
                      "FutureWarning"
                      "ImportWarning"
                      "PendingDeprecationWarning"
+                     "ResourceWarning"
                      "RuntimeWarning"
                      "SyntaxWarning"
                      "UnicodeWarning"
@@ -3546,12 +3582,14 @@ strip numbers instead."
                  "KeyboardInterrupt"
                  "SystemExit"
 
-               "abs" "absolute_import" "all" "any" "apply"
-               "basestring" "bin" "bool" "buffer" "bytearray"
+               "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" "execfile"
+               "enumerate" "eval" "exec" "execfile"
                "file" "filter" "float" "format" "frozenset"
                "getattr" "globals"
                "hasattr" "hash" "help" "hex"
@@ -3581,6 +3619,7 @@ strip numbers instead."
                "import" "in" "is" "lambda" "not" "or" "pass" "print"
                "property" "raise" "return" "struct" "try" "while" "with"
                "yield")
+   ""
    ""))
 
 (define-derived-mode pyrex-mode python-mode "Pyrex"