X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/a1b01eb3d3e7cfe59bfd6b1e35d5485a97d39359..5e504acc7931c1abf3bb487d4137158ba4196f5e:/el/dot-emacs.el diff --git a/el/dot-emacs.el b/el/dot-emacs.el index dbc1677..2fb1520 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -810,6 +810,8 @@ case." (whitespace-mode arg)) (setq show-trailing-whitespace whitespace-mode))) +(defvar mdw-do-misc-mode-hacking nil) + (defun mdw-misc-mode-config () (and mdw-auto-indent (cond ((eq major-mode 'lisp-mode) @@ -819,14 +821,13 @@ case." nil) (t (local-set-key "\C-m" 'newline-and-indent)))) + (set (make-local-variable 'mdw-do-misc-mode-hacking) t) (local-set-key [C-return] 'newline) (make-local-variable 'page-delimiter) (setq page-delimiter "\f\\|^.*-\\{6\\}.*$") (setq comment-column 40) (auto-fill-mode 1) (setq fill-column 77) - (setq show-trailing-whitespace t) - (mdw-whitespace-mode 1) (and (fboundp 'gtags-mode) (gtags-mode)) (if (fboundp 'hs-minor-mode) @@ -835,8 +836,17 @@ case." (reveal-mode t) (trap (turn-on-font-lock))) -(defun mdw-post-config-mode-hack () - (mdw-whitespace-mode 1)) +(defun mdw-post-local-vars-misc-mode-config () + (when (and mdw-do-misc-mode-hacking + (not buffer-read-only)) + (setq show-trailing-whitespace t) + (mdw-whitespace-mode 1))) +(add-hook 'hack-local-variables-hook 'mdw-post-local-vars-misc-mode-config) + +(defadvice toggle-read-only (after mdw-angry-fruit-salad activate) + (when mdw-do-misc-mode-hacking + (setq show-trailing-whitespace (not buffer-read-only)) + (mdw-whitespace-mode (if buffer-read-only 0 1)))) (eval-after-load 'gtags '(progn @@ -1226,7 +1236,7 @@ doesn't match any of the regular expressions in (mdw-define-face mdw-ellipsis-face (((type tty)) :foreground "blue") (t :foreground "grey60")) (let ((dollar (make-glyph-code ?$ 'mdw-ellipsis-face)) - (backslash (make-glyph-code ?\ 'mdw-ellipsis-face)) + (backslash (make-glyph-code ?\\ 'mdw-ellipsis-face)) (dot (make-glyph-code ?. 'mdw-ellipsis-face)) (bar (make-glyph-code ?| mdw-ellipsis-face))) (set-display-table-slot standard-display-table 0 dollar) @@ -1461,9 +1471,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))) - - (mdw-post-config-mode-hack))) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; AP calc mode. @@ -1515,9 +1523,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Java programming configuration. @@ -1583,9 +1589,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Javascript programming configuration. @@ -1643,9 +1647,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Scala programming configuration. @@ -1718,9 +1720,7 @@ doesn't match any of the regular expressions in "\\|" "\\\\" "." "\\)" "\\('\\)") '(1 "\"") - '(4 "\""))))) - - (mdw-post-config-mode-hack)) + '(4 "\"")))))) ;;;-------------------------------------------------------------------------- ;;; C# programming configuration. @@ -1791,9 +1791,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) (define-derived-mode csharp-mode java-mode "C#" "Major mode for editing C# code.") @@ -1908,9 +1906,7 @@ doesn't match any of the regular expressions in '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) (defun mdw-fontify-inferior-fsharp () (mdw-fontify-fsharp) @@ -1979,9 +1975,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Rust programming configuration. @@ -2057,10 +2051,7 @@ doesn't match any of the regular expressions in ;; Hack key bindings. (local-set-key [?{] 'mdw-self-insert-and-indent) - (local-set-key [?}] 'mdw-self-insert-and-indent) - - ;; Final hacking. - (mdw-post-config-mode-hack)) + (local-set-key [?}] 'mdw-self-insert-and-indent)) ;;;-------------------------------------------------------------------------- ;;; Awk programming configuration. @@ -2118,15 +2109,15 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Perl programming style. ;; Perl indentation style. +(setq perl-indent-level 2) + (setq cperl-indent-level 2) (setq cperl-continued-statement-offset 2) (setq cperl-continued-brace-offset 0) @@ -2141,16 +2132,29 @@ doesn't match any of the regular expressions in ;; Miscellaneous fiddling. (modify-syntax-entry ?$ "\\") (modify-syntax-entry ?$ "\\" font-lock-syntax-table) + (modify-syntax-entry ?: "." font-lock-syntax-table) (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") ;; Now define fontification things. (make-local-variable 'font-lock-keywords) (let ((perl-keywords - (mdw-regexps "and" "break" "cmp" "continue" "do" "else" "elsif" "eq" - "for" "foreach" "ge" "given" "gt" "goto" "if" - "last" "le" "lt" "local" "my" "ne" "next" "or" - "our" "package" "redo" "require" "return" "sub" - "undef" "unless" "until" "use" "when" "while"))) + (mdw-regexps "and" + "break" + "cmp" "continue" + "default" "do" + "else" "elsif" "eq" + "for" "foreach" + "ge" "given" "gt" "goto" + "if" + "last" "le" "local" "lt" + "my" + "ne" "next" + "or" "our" + "package" + "redo" "require" "return" + "sub" + "undef" "unless" "until" "use" + "when" "while"))) (setq font-lock-keywords (list @@ -2167,9 +2171,7 @@ doesn't match any of the regular expressions in ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) (defun perl-number-tests (&optional arg) "Assign consecutive numbers to lines containing `#t'. With ARG, @@ -2212,9 +2214,7 @@ strip numbers instead." ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) ;; Define Python fontification styles. @@ -2288,9 +2288,7 @@ strip numbers instead." ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Assembler mode. @@ -2324,8 +2322,7 @@ strip numbers instead." "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))) - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) ;;;-------------------------------------------------------------------------- ;;; Dylan programming configuration. @@ -2391,9 +2388,7 @@ strip numbers instead." "\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\|" "\\_<[-+*/=<>:&|]+\\_>" "\\)") - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Algol 68 configuration. @@ -2435,9 +2430,7 @@ strip numbers instead." "\\>") '(0 mdw-number-face)) (list "\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; REXX configuration. @@ -2510,9 +2503,7 @@ strip numbers instead." ;; And everything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Standard ML programming style. @@ -2562,9 +2553,7 @@ strip numbers instead." ;; And anything else is punctuation. (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Haskell configuration. @@ -2642,9 +2631,7 @@ strip numbers instead." "\\([eE]\\([-+]\\|\\)[0-9]+\\|\\)") '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Erlang configuration. @@ -2677,9 +2664,7 @@ strip numbers instead." (list "\\<[0-9]+\\(\\|#[0-9a-zA-Z]+\\|[eE][+-]?[0-9]+\\)\\>" '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face))))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face)))))) ;;;-------------------------------------------------------------------------- ;;; Texinfo configuration. @@ -2713,9 +2698,7 @@ strip numbers instead." ;; Fontify TeX special characters as punctuation. (list "[{}]+" - '(0 mdw-punct-face)))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) ;;;-------------------------------------------------------------------------- ;;; TeX and LaTeX configuration. @@ -2781,9 +2764,7 @@ strip numbers instead." ;; Fontify TeX special characters as punctuation. (list "[$^_{}#&]" - '(0 mdw-punct-face)))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) ;;;-------------------------------------------------------------------------- ;;; SGML hacking. @@ -3143,8 +3124,7 @@ that character only to be normal punctuation.") "\\([eE]\\([-+]\\|\\)[0-9_]+\\|\\)") '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))) - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) ;; Lispy languages. @@ -3201,9 +3181,7 @@ that character only to be normal punctuation.") "\\)\\_>") '(0 mdw-number-face)) (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" - '(0 mdw-punct-face)))) - - (mdw-post-config-mode-hack)) + '(0 mdw-punct-face))))) (defun comint-send-and-indent () (interactive)