X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/6132bc0180aa5303c9ae697504893f40faeb04fd..29826b11b10dabd3e6ccdbeb98d8e3dae5f37af4:/el/dot-emacs.el diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 2f61f96..15b156b 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -807,11 +807,6 @@ doesn't match any of the regular expressions in ;; Make C indentation nice. -(eval-after-load "cc-mode" - '(progn - (define-key c-mode-map "*" nil) - (define-key c-mode-map "/" nil))) - (defun mdw-c-lineup-arglist (langelem) "Hack for DWIMmery in c-lineup-arglist." (if (save-excursion @@ -1345,37 +1340,48 @@ strip numbers instead." ;;;-------------------------------------------------------------------------- ;;; Python programming style. -;; Define Python fontification style. - -(defun mdw-fontify-python () +(defun mdw-fontify-pythonic (keywords) ;; Miscellaneous fiddling. (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") ;; Now define fontification things. (make-local-variable 'font-lock-keywords) - (let ((python-keywords - (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"))) - (setq font-lock-keywords - (list + (setq font-lock-keywords + (list - ;; Set up the keywords defined above. - (list (concat "\\<\\(" python-keywords "\\)\\>") - '(0 font-lock-keyword-face)) + ;; Set up the keywords defined above. + (list (concat "\\<\\(" keywords "\\)\\>") + '(0 font-lock-keyword-face)) - ;; At least numbers are simpler than C. - (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" - "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" - "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)") - '(0 mdw-number-face)) + ;; At least numbers are simpler than C. + (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|" + "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)" + "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)") + '(0 mdw-number-face)) - ;; And anything else is punctuation. - (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))))) + ;; And anything else is punctuation. + (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" + '(0 mdw-punct-face))))) + +;; Define Python fontification styles. + +(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"))) + +(defun mdw-fontify-pyrex () + (mdw-fontify-pythonic + (mdw-regexps "and" "as" "assert" "break" "cdef" "class" "continue" + "ctypedef" "def" "del" "elif" "else" "except" "exec" + "extern" "finally" "for" "from" "global" "if" + "import" "in" "is" "lambda" "not" "or" "pass" "print" + "raise" "return" "struct" "try" "while" "with" + "yield"))) ;;;-------------------------------------------------------------------------- ;;; Icon programming style.