Mercurial > emacs
changeset 71754:60304f6ae360
* progmodes/cc-awk.el, cc-defs.el, cc-fonts.el, cc-langs.el,
cc-mode.el: Changes to eradicate eval-after-load.
author | Alan Mackenzie <acm@muc.de> |
---|---|
date | Mon, 10 Jul 2006 13:17:09 +0000 |
parents | 0f33735837d4 |
children | e54eca94588b |
files | lisp/progmodes/cc-awk.el lisp/progmodes/cc-defs.el lisp/progmodes/cc-fonts.el lisp/progmodes/cc-langs.el lisp/progmodes/cc-mode.el |
diffstat | 5 files changed, 145 insertions(+), 145 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/cc-awk.el Sun Jul 09 23:34:31 2006 +0000 +++ b/lisp/progmodes/cc-awk.el Mon Jul 10 13:17:09 2006 +0000 @@ -32,7 +32,7 @@ ;; 1. The AWK Mode syntax table. ;; 2. Regular expressions for analysing AWK code. ;; 3. Indentation calculation stuff ("c-awk-NL-prop text-property"). -;; 4. Syntax-table property/font-locking stuff, but not including the +;; 4. Syntax-table property/font-locking stuff, including the ;; font-lock-keywords setting. ;; 5. The AWK Mode before/after-change-functions. ;; 6. AWK Mode specific versions of commands like beginning-of-defun. @@ -852,6 +852,96 @@ (c-awk-advise-fl-for-awk-region lazy-lock-defer-rest-after-change) (c-awk-advise-fl-for-awk-region lazy-lock-defer-line-after-change) +;; Awk regexps written with help from Peter Galbraith +;; <galbraith@mixing.qc.dfo.ca>. +;; Take GNU Emacs's 'words out of the following regexp-opts. They dont work +;; in Xemacs 21.4.4. acm 2002/9/19. +(defconst awk-font-lock-keywords + (eval-when-compile + (list + ;; Function names. + '("^\\s *\\(func\\(tion\\)?\\)\\>\\s *\\(\\sw+\\)?" + (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) + ;; + ;; Variable names. + (cons + (concat "\\<" + (regexp-opt + '("ARGC" "ARGIND" "ARGV" "BINMODE" "CONVFMT" "ENVIRON" + "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" "FS" "IGNORECASE" + "LINT" "NF" "NR" "OFMT" "OFS" "ORS" "PROCINFO" "RLENGTH" + "RS" "RSTART" "RT" "SUBSEP" "TEXTDOMAIN") t) "\\>") + 'font-lock-variable-name-face) + + ;; Special file names. (acm, 2002/7/22) + ;; The following regexp was created by first evaluating this in GNU Emacs 21.1: + ;; (regexp-opt '("/dev/stdin" "/dev/stdout" "/dev/stderr" "/dev/fd/n" "/dev/pid" + ;; "/dev/ppid" "/dev/pgrpid" "/dev/user") 'words) + ;; , removing the "?:" from each "\\(?:" (for backward compatibility with older Emacsen) + ;; , replacing the "n" in "dev/fd/n" with "[0-9]+" + ;; , removing the unwanted \\< at the beginning, and finally filling out the + ;; regexp so that a " must come before, and either a " or heuristic stuff after. + ;; The surrounding quotes are fontified along with the filename, since, semantically, + ;; they are an indivisible unit. + '("\\(\"/dev/\\(fd/[0-9]+\\|p\\(\\(\\(gr\\)?p\\)?id\\)\\|\ +std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\ +\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" + (1 font-lock-variable-name-face t) + (8 font-lock-variable-name-face t t)) + ;; Do the same (almost) with + ;; (regexp-opt '("/inet/tcp/lport/rhost/rport" "/inet/udp/lport/rhost/rport" + ;; "/inet/raw/lport/rhost/rport") 'words) + ;; This cannot be combined with the above pattern, because the match number + ;; for the (optional) closing \" would then exceed 9. + '("\\(\"/inet/\\(\\(raw\\|\\(tc\\|ud\\)p\\)/lport/rhost/rport\\)\\)\\>\ +\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" + (1 font-lock-variable-name-face t) + (6 font-lock-variable-name-face t t)) + + ;; Keywords. + (concat "\\<" + (regexp-opt + '("BEGIN" "END" "break" "continue" "delete" "do" "else" + "exit" "for" "getline" "if" "in" "next" "nextfile" + "return" "while") + t) "\\>") + + ;; Builtins. + `(eval . (list + ,(concat + "\\<" + (regexp-opt + '("adump" "and" "asort" "atan2" "bindtextdomain" "close" + "compl" "cos" "dcgettext" "exp" "extension" "fflush" + "gensub" "gsub" "index" "int" "length" "log" "lshift" + "match" "mktime" "or" "print" "printf" "rand" "rshift" + "sin" "split" "sprintf" "sqrt" "srand" "stopme" + "strftime" "strtonum" "sub" "substr" "system" + "systime" "tolower" "toupper" "xor") t) + "\\>") + 0 c-preprocessor-face-name)) + + ;; gawk debugging keywords. (acm, 2002/7/21) + ;; (Removed, 2003/6/6. These functions are now fontified as built-ins) + ;; (list (concat "\\<" (regexp-opt '("adump" "stopme") t) "\\>") + ;; 0 'font-lock-warning-face) + + ;; User defined functions with an apparent spurious space before the + ;; opening parenthesis. acm, 2002/5/30. + `(,(concat "\\(\\w\\|_\\)" c-awk-escaped-nls* "\\s " + c-awk-escaped-nls*-with-space* "(") + (0 'font-lock-warning-face)) + + ;; Space after \ in what looks like an escaped newline. 2002/5/31 + '("\\\\\\s +$" 0 font-lock-warning-face t) + + ;; Unbalanced string (") or regexp (/) delimiters. 2002/02/16. + '("\\s|" 0 font-lock-warning-face t nil) + ;; gawk 3.1 localizable strings ( _"translate me!"). 2002/5/21 + '("\\(_\\)\\s|" 1 font-lock-warning-face) + '("\\(_\\)\\s\"" 1 font-lock-string-face) ; FIXME! not for XEmacs. 2002/10/6 + )) + "Default expressions to highlight in AWK mode.") ;; ACM 2002/9/29. Movement functions, e.g. for C-M-a and C-M-e
--- a/lisp/progmodes/cc-defs.el Sun Jul 09 23:34:31 2006 +0000 +++ b/lisp/progmodes/cc-defs.el Mon Jul 10 13:17:09 2006 +0000 @@ -69,14 +69,15 @@ (not (fboundp 'push))) (cc-load "cc-fix"))) -(eval-after-load "font-lock" - '(if (and (not (featurep 'cc-fix)) ; only load the file once. +; (eval-after-load "font-lock" ; 2006-07-09. font-lock is now preloaded +; ' +(if (and (not (featurep 'cc-fix)) ; only load the file once. (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS ; to make the call to f-l-c-k throw an error. (let (font-lock-keywords) (font-lock-compile-keywords '("\\<\\>")) font-lock-keywords)) ; did the previous call foul this up? - (load "cc-fix"))) + (load "cc-fix")) ;) ;; The above takes care of the delayed loading, but this is necessary ;; to ensure correct byte compilation. @@ -1034,35 +1035,35 @@ ;; Make edebug understand the macros. -(eval-after-load "edebug" - '(progn - (def-edebug-spec cc-eval-when-compile t) - (def-edebug-spec c-point t) - (def-edebug-spec c-set-region-active t) - (def-edebug-spec c-safe t) - (def-edebug-spec c-save-buffer-state let*) - (def-edebug-spec c-tentative-buffer-changes t) - (def-edebug-spec c-forward-syntactic-ws t) - (def-edebug-spec c-backward-syntactic-ws t) - (def-edebug-spec c-forward-sexp t) - (def-edebug-spec c-backward-sexp t) - (def-edebug-spec c-up-list-forward t) - (def-edebug-spec c-up-list-backward t) - (def-edebug-spec c-down-list-forward t) - (def-edebug-spec c-down-list-backward t) - (def-edebug-spec c-add-syntax t) - (def-edebug-spec c-add-class-syntax t) - (def-edebug-spec c-benign-error t) - (def-edebug-spec c-with-syntax-table t) - (def-edebug-spec c-skip-ws-forward t) - (def-edebug-spec c-skip-ws-backward t) - (def-edebug-spec c-major-mode-is t) - (def-edebug-spec c-put-char-property t) - (def-edebug-spec c-get-char-property t) - (def-edebug-spec c-clear-char-property t) - (def-edebug-spec c-clear-char-properties t) - (def-edebug-spec c-put-overlay t) - (def-edebug-spec c-delete-overlay t))) +;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. +; '(progn +(def-edebug-spec cc-eval-when-compile t) +(def-edebug-spec c-point t) +(def-edebug-spec c-set-region-active t) +(def-edebug-spec c-safe t) +(def-edebug-spec c-save-buffer-state let*) +(def-edebug-spec c-tentative-buffer-changes t) +(def-edebug-spec c-forward-syntactic-ws t) +(def-edebug-spec c-backward-syntactic-ws t) +(def-edebug-spec c-forward-sexp t) +(def-edebug-spec c-backward-sexp t) +(def-edebug-spec c-up-list-forward t) +(def-edebug-spec c-up-list-backward t) +(def-edebug-spec c-down-list-forward t) +(def-edebug-spec c-down-list-backward t) +(def-edebug-spec c-add-syntax t) +(def-edebug-spec c-add-class-syntax t) +(def-edebug-spec c-benign-error t) +(def-edebug-spec c-with-syntax-table t) +(def-edebug-spec c-skip-ws-forward t) +(def-edebug-spec c-skip-ws-backward t) +(def-edebug-spec c-major-mode-is t) +(def-edebug-spec c-put-char-property t) +(def-edebug-spec c-get-char-property t) +(def-edebug-spec c-clear-char-property t) +(def-edebug-spec c-clear-char-properties t) +(def-edebug-spec c-put-overlay t) +(def-edebug-spec c-delete-overlay t) ;)) ;;; Functions. @@ -1738,9 +1739,10 @@ ,@(and pre-files `(',pre-files)))))) (put 'c-lang-defconst 'lisp-indent-function 1) -(eval-after-load "edebug" - '(def-edebug-spec c-lang-defconst - (&define name [&optional stringp] [&rest sexp def-form]))) +;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. +; ' +(def-edebug-spec c-lang-defconst + (&define name [&optional stringp] [&rest sexp def-form])) (defun c-define-lang-constant (name bindings &optional pre-files) ;; Used by `c-lang-defconst'.
--- a/lisp/progmodes/cc-fonts.el Sun Jul 09 23:34:31 2006 +0000 +++ b/lisp/progmodes/cc-fonts.el Mon Jul 10 13:17:09 2006 +0000 @@ -348,15 +348,15 @@ highlights)))) nil))) - (eval-after-load "edebug" - '(progn - (def-edebug-spec c-fontify-types-and-refs let*) - (def-edebug-spec c-make-syntactic-matcher t) - ;; If there are literal quoted or backquoted highlight specs in - ;; the call to `c-make-font-lock-search-function' then let's - ;; instrument the forms in them. - (def-edebug-spec c-make-font-lock-search-function - (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form))))) +; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. +; '(progn + (def-edebug-spec c-fontify-types-and-refs let*) + (def-edebug-spec c-make-syntactic-matcher t) + ;; If there are literal quoted or backquoted highlight specs in + ;; the call to `c-make-font-lock-search-function' then let's + ;; instrument the forms in them. + (def-edebug-spec c-make-font-lock-search-function + (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form)));)) (defun c-fontify-recorded-types-and-refs () ;; Convert the ranges recorded on `c-record-type-identifiers' and @@ -2268,101 +2268,7 @@ autodoc-font-lock-doc-comments))))) -;; AWK. - -;; Awk regexps written with help from Peter Galbraith -;; <galbraith@mixing.qc.dfo.ca>. -;; Take GNU Emacs's 'words out of the following regexp-opts. They dont work -;; in Xemacs 21.4.4. acm 2002/9/19. -(eval-after-load "cc-awk" ; Evaluate while loading cc-fonts - `(defconst awk-font-lock-keywords ; Evaluate after loading cc-awk - ',(eval-when-compile ; Evaluate while compiling cc-fonts - (list - ;; Function names. - '("^\\s *\\(func\\(tion\\)?\\)\\>\\s *\\(\\sw+\\)?" - (1 font-lock-keyword-face) (3 font-lock-function-name-face nil t)) - ;; - ;; Variable names. - (cons - (concat "\\<" - (regexp-opt - '("ARGC" "ARGIND" "ARGV" "BINMODE" "CONVFMT" "ENVIRON" - "ERRNO" "FIELDWIDTHS" "FILENAME" "FNR" "FS" "IGNORECASE" - "LINT" "NF" "NR" "OFMT" "OFS" "ORS" "PROCINFO" "RLENGTH" - "RS" "RSTART" "RT" "SUBSEP" "TEXTDOMAIN") t) "\\>") - 'font-lock-variable-name-face) - - ;; Special file names. (acm, 2002/7/22) - ;; The following regexp was created by first evaluating this in GNU Emacs 21.1: - ;; (regexp-opt '("/dev/stdin" "/dev/stdout" "/dev/stderr" "/dev/fd/n" "/dev/pid" - ;; "/dev/ppid" "/dev/pgrpid" "/dev/user") 'words) - ;; , removing the "?:" from each "\\(?:" (for backward compatibility with older Emacsen) - ;; , replacing the "n" in "dev/fd/n" with "[0-9]+" - ;; , removing the unwanted \\< at the beginning, and finally filling out the - ;; regexp so that a " must come before, and either a " or heuristic stuff after. - ;; The surrounding quotes are fontified along with the filename, since, semantically, - ;; they are an indivisible unit. - '("\\(\"/dev/\\(fd/[0-9]+\\|p\\(\\(\\(gr\\)?p\\)?id\\)\\|\ -std\\(err\\|in\\|out\\)\\|user\\)\\)\\>\ -\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" - (1 font-lock-variable-name-face t) - (8 font-lock-variable-name-face t t)) - ;; Do the same (almost) with - ;; (regexp-opt '("/inet/tcp/lport/rhost/rport" "/inet/udp/lport/rhost/rport" - ;; "/inet/raw/lport/rhost/rport") 'words) - ;; This cannot be combined with the above pattern, because the match number - ;; for the (optional) closing \" would then exceed 9. - '("\\(\"/inet/\\(\\(raw\\|\\(tc\\|ud\\)p\\)/lport/rhost/rport\\)\\)\\>\ -\\(\\(\"\\)\\|\\([^\"/\n\r][^\"\n\r]*\\)?$\\)" - (1 font-lock-variable-name-face t) - (6 font-lock-variable-name-face t t)) - - ;; Keywords. - (concat "\\<" - (regexp-opt - '("BEGIN" "END" "break" "continue" "delete" "do" "else" - "exit" "for" "getline" "if" "in" "next" "nextfile" - "return" "while") - t) "\\>") - - ;; Builtins. - `(eval . (list - ,(concat - "\\<" - (regexp-opt - '("adump" "and" "asort" "atan2" "bindtextdomain" "close" - "compl" "cos" "dcgettext" "exp" "extension" "fflush" - "gensub" "gsub" "index" "int" "length" "log" "lshift" - "match" "mktime" "or" "print" "printf" "rand" "rshift" - "sin" "split" "sprintf" "sqrt" "srand" "stopme" - "strftime" "strtonum" "sub" "substr" "system" - "systime" "tolower" "toupper" "xor") t) - "\\>") - 0 c-preprocessor-face-name)) - - ;; gawk debugging keywords. (acm, 2002/7/21) - ;; (Removed, 2003/6/6. These functions are now fontified as built-ins) -;; (list (concat "\\<" (regexp-opt '("adump" "stopme") t) "\\>") -;; 0 'font-lock-warning-face) - - ;; User defined functions with an apparent spurious space before the - ;; opening parenthesis. acm, 2002/5/30. - `(,(concat "\\(\\w\\|_\\)" c-awk-escaped-nls* "\\s " - c-awk-escaped-nls*-with-space* "(") - (0 'font-lock-warning-face)) - - ;; Space after \ in what looks like an escaped newline. 2002/5/31 - '("\\\\\\s +$" 0 font-lock-warning-face t) - - ;; Unbalanced string (") or regexp (/) delimiters. 2002/02/16. - '("\\s|" 0 font-lock-warning-face t nil) - ;; gawk 3.1 localizable strings ( _"translate me!"). 2002/5/21 - '("\\(_\\)\\s|" 1 font-lock-warning-face) - '("\\(_\\)\\s\"" 1 font-lock-string-face) ; FIXME! not for XEmacs. 2002/10/6 - )) - "Default expressions to highlight in AWK mode.")) - - +;; 2006-07-10: awk-font-lock-keywords has been moved back to cc-awk.el. (cc-provide 'cc-fonts) ;;; arch-tag: 2f65f405-735f-4da5-8d4b-b957844c5203
--- a/lisp/progmodes/cc-langs.el Sun Jul 09 23:34:31 2006 +0000 +++ b/lisp/progmodes/cc-langs.el Mon Jul 10 13:17:09 2006 +0000 @@ -173,9 +173,10 @@ `',var) (put 'c-lang-defvar 'lisp-indent-function 'defun) -(eval-after-load "edebug" - '(def-edebug-spec c-lang-defvar - (&define name def-form &optional stringp))) +; (eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el. +; ' +(def-edebug-spec c-lang-defvar + (&define name def-form &optional stringp)) ;) (eval-and-compile ;; Some helper functions used when building the language constants.
--- a/lisp/progmodes/cc-mode.el Sun Jul 09 23:34:31 2006 +0000 +++ b/lisp/progmodes/cc-mode.el Mon Jul 10 13:17:09 2006 +0000 @@ -114,8 +114,9 @@ ;; Load cc-fonts first after font-lock is loaded, since it isn't ;; necessary until font locking is requested. -(eval-after-load "font-lock" - '(require 'cc-fonts)) +; (eval-after-load "font-lock" ; 2006-07-09: font-lock is now preloaded. +; ' +(require 'cc-fonts) ;) ;; cc-langs isn't loaded when we're byte compiled, so add autoload ;; directives for the interface functions.