comparison lisp/packages/font-lock.el @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents 1a767b41a199
children 131b0175ea99
comparison
equal deleted inserted replaced
47:11c6df210d7f 48:56c54cf7c5b6
1099 "Apply HIGHLIGHT following a match. 1099 "Apply HIGHLIGHT following a match.
1100 HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'." 1100 HIGHLIGHT should be of the form MATCH-HIGHLIGHT, see `font-lock-keywords'."
1101 (let* ((match (nth 0 highlight)) 1101 (let* ((match (nth 0 highlight))
1102 (start (match-beginning match)) (end (match-end match)) 1102 (start (match-beginning match)) (end (match-end match))
1103 (override (nth 2 highlight))) 1103 (override (nth 2 highlight)))
1104 (and end
1105 (goto-char end)) ;; tlp00 hack to allow for back to back fonts
1106 (let ((newface (nth 1 highlight))) 1104 (let ((newface (nth 1 highlight)))
1107 (or (symbolp newface) 1105 (or (symbolp newface)
1108 (setq newface (eval newface))) 1106 (setq newface (eval newface)))
1109 (cond ((not start) 1107 (cond ((not start)
1110 ;; No match but we might not signal an error. 1108 ;; No match but we might not signal an error.
1818 ;; 1816 ;;
1819 ;; Fontify function name definitions (GNU style; without type on line). 1817 ;; Fontify function name definitions (GNU style; without type on line).
1820 1818
1821 ;; In FSF this has the simpler definition of "\\sw+" for ctoken. 1819 ;; In FSF this has the simpler definition of "\\sw+" for ctoken.
1822 ;; I'm not sure if ours is more correct. 1820 ;; I'm not sure if ours is more correct.
1823 (list (concat "^\\(" ctoken "\\)[ \t]*(") 1 'font-lock-function-name-face) 1821 ;; This is a subset of the next rule, and is slower when present. --dmoore
1822 ;; (list (concat "^\\(" ctoken "\\)[ \t]*(") 1 'font-lock-function-name-face)
1824 ;; 1823 ;;
1825 ;; fontify the names of functions being defined. 1824 ;; fontify the names of functions being defined.
1826 ;; FSF doesn't have this but I think it should be fast for us because 1825 ;; FSF doesn't have this but I think it should be fast for us because
1827 ;; our regexp routines are more intelligent than FSF's about handling 1826 ;; our regexp routines are more intelligent than FSF's about handling
1828 ;; anchored-at-newline. (When I added this hack in regex.c, it halved 1827 ;; anchored-at-newline. (When I added this hack in regex.c, it halved
1829 ;; the time to do the regexp phase of font-lock for a C file!) Not 1828 ;; the time to do the regexp phase of font-lock for a C file!) Not
1830 ;; including this discriminates against those who don't follow the 1829 ;; including this discriminates against those who don't follow the
1831 ;; GNU coding style. --ben 1830 ;; GNU coding style. --ben
1831 ;; x?x?x?y?z should always be: (x(xx?)?)?y?z --dmoore
1832 (list (concat 1832 (list (concat
1833 "^\\(" ctoken "[ \t]+\\)?" ; type specs; there can be no 1833 "^\\("
1834 "\\(" ctoken "[ \t]+\\)?" ; more than 3 tokens, right? 1834 "\\(" ctoken "[ \t]+\\)" ; type specs; there can be no
1835 "\\(" ctoken "[ \t]+\\)?" 1835 "\\("
1836 "\\(" ctoken "[ \t]+\\)" ; more than 3 tokens, right?
1837 "\\(" ctoken "[ \t]+\\)"
1838 "?\\)?\\)?"
1836 "\\([*&]+[ \t]*\\)?" ; pointer 1839 "\\([*&]+[ \t]*\\)?" ; pointer
1837 "\\(" ctoken "\\)[ \t]*(") ; name 1840 "\\(" ctoken "\\)[ \t]*(") ; name
1838 8 'font-lock-function-name-face) 1841 10 'font-lock-function-name-face)
1839 ;; 1842 ;;
1840 ;; This is faster but not by much. I don't see why not. 1843 ;; This is faster but not by much. I don't see why not.
1841 ;(list (concat "^\\(" ctoken "\\)[ \t]*(") 1 'font-lock-function-name-face) 1844 ;(list (concat "^\\(" ctoken "\\)[ \t]*(") 1 'font-lock-function-name-face)
1842 ;; 1845 ;;
1843 ;; Added next two; they're both jolly-good fastmatch candidates so 1846 ;; Added next two; they're both jolly-good fastmatch candidates so
1932 1935
1933 (setq c++-font-lock-keywords-1 1936 (setq c++-font-lock-keywords-1
1934 (append 1937 (append
1935 ;; 1938 ;;
1936 ;; The list `c-font-lock-keywords-1' less that for function names. 1939 ;; The list `c-font-lock-keywords-1' less that for function names.
1937 (cdr c-font-lock-keywords-1) 1940 ;; the simple function form regexp has been removed. --dmoore
1941 ;;(cdr c-font-lock-keywords-1)
1942 c-font-lock-keywords-1
1938 ;; 1943 ;;
1939 ;; Fontify function name definitions, possibly incorporating class name. 1944 ;; Fontify function name definitions, possibly incorporating class name.
1940 (list 1945 (list
1941 '("^\\(\\sw+\\)\\(::\\(\\sw+\\)\\)?[ \t]*(" 1946 '("^\\(\\sw+\\)\\(::\\(\\sw+\\)\\)?[ \t]*("
1942 (1 (if (match-beginning 2) 1947 (1 (if (match-beginning 2)