diff options
| author | Stefan Monnier | 2005-10-21 06:29:52 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-10-21 06:29:52 +0000 |
| commit | d55c4199f78929731b22ac89b499cfd41d0ad021 (patch) | |
| tree | 78244259d571abf8928a2298288609a8ab095529 | |
| parent | 8debde6e208dfab075de1e975839fcdc2e350ca5 (diff) | |
| download | emacs-d55c4199f78929731b22ac89b499cfd41d0ad021.tar.gz emacs-d55c4199f78929731b22ac89b499cfd41d0ad021.zip | |
(font-lock-compile-keywords): Add a help-echo to the
warning face on open-paren-in-column-0.
| -rw-r--r-- | lisp/font-lock.el | 227 |
1 files changed, 114 insertions, 113 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3d2d0fe6ef0..77e20d5d026 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -1184,35 +1184,35 @@ Optional argument OBJECT is the string or buffer containing the text." | |||
| 1184 | 1184 | ||
| 1185 | ;; For completeness: this is to `remove-text-properties' as `put-text-property' | 1185 | ;; For completeness: this is to `remove-text-properties' as `put-text-property' |
| 1186 | ;; is to `add-text-properties', etc. | 1186 | ;; is to `add-text-properties', etc. |
| 1187 | ;(defun remove-text-property (start end property &optional object) | 1187 | ;;(defun remove-text-property (start end property &optional object) |
| 1188 | ; "Remove a property from text from START to END. | 1188 | ;; "Remove a property from text from START to END. |
| 1189 | ;Argument PROPERTY is the property to remove. | 1189 | ;;Argument PROPERTY is the property to remove. |
| 1190 | ;Optional argument OBJECT is the string or buffer containing the text. | 1190 | ;;Optional argument OBJECT is the string or buffer containing the text. |
| 1191 | ;Return t if the property was actually removed, nil otherwise." | 1191 | ;;Return t if the property was actually removed, nil otherwise." |
| 1192 | ; (remove-text-properties start end (list property) object)) | 1192 | ;; (remove-text-properties start end (list property) object)) |
| 1193 | 1193 | ||
| 1194 | ;; For consistency: maybe this should be called `remove-single-property' like | 1194 | ;; For consistency: maybe this should be called `remove-single-property' like |
| 1195 | ;; `next-single-property-change' (not `next-single-text-property-change'), etc. | 1195 | ;; `next-single-property-change' (not `next-single-text-property-change'), etc. |
| 1196 | ;(defun remove-single-text-property (start end prop value &optional object) | 1196 | ;;(defun remove-single-text-property (start end prop value &optional object) |
| 1197 | ; "Remove a specific property value from text from START to END. | 1197 | ;; "Remove a specific property value from text from START to END. |
| 1198 | ;Arguments PROP and VALUE specify the property and value to remove. The | 1198 | ;;Arguments PROP and VALUE specify the property and value to remove. The |
| 1199 | ;resulting property values are not equal to VALUE nor lists containing VALUE. | 1199 | ;;resulting property values are not equal to VALUE nor lists containing VALUE. |
| 1200 | ;Optional argument OBJECT is the string or buffer containing the text." | 1200 | ;;Optional argument OBJECT is the string or buffer containing the text." |
| 1201 | ; (let ((start (text-property-not-all start end prop nil object)) next prev) | 1201 | ;; (let ((start (text-property-not-all start end prop nil object)) next prev) |
| 1202 | ; (while start | 1202 | ;; (while start |
| 1203 | ; (setq next (next-single-property-change start prop object end) | 1203 | ;; (setq next (next-single-property-change start prop object end) |
| 1204 | ; prev (get-text-property start prop object)) | 1204 | ;; prev (get-text-property start prop object)) |
| 1205 | ; (cond ((and (symbolp prev) (eq value prev)) | 1205 | ;; (cond ((and (symbolp prev) (eq value prev)) |
| 1206 | ; (remove-text-property start next prop object)) | 1206 | ;; (remove-text-property start next prop object)) |
| 1207 | ; ((and (listp prev) (memq value prev)) | 1207 | ;; ((and (listp prev) (memq value prev)) |
| 1208 | ; (let ((new (delq value prev))) | 1208 | ;; (let ((new (delq value prev))) |
| 1209 | ; (cond ((null new) | 1209 | ;; (cond ((null new) |
| 1210 | ; (remove-text-property start next prop object)) | 1210 | ;; (remove-text-property start next prop object)) |
| 1211 | ; ((= (length new) 1) | 1211 | ;; ((= (length new) 1) |
| 1212 | ; (put-text-property start next prop (car new) object)) | 1212 | ;; (put-text-property start next prop (car new) object)) |
| 1213 | ; (t | 1213 | ;; (t |
| 1214 | ; (put-text-property start next prop new object)))))) | 1214 | ;; (put-text-property start next prop new object)))))) |
| 1215 | ; (setq start (text-property-not-all next end prop nil object))))) | 1215 | ;; (setq start (text-property-not-all next end prop nil object))))) |
| 1216 | 1216 | ||
| 1217 | ;;; End of Additional text property functions. | 1217 | ;;; End of Additional text property functions. |
| 1218 | 1218 | ||
| @@ -1534,7 +1534,8 @@ If REGEXP is non-nil, it means these keywords are used for | |||
| 1534 | (if (memq (get-text-property (match-beginning 0) 'face) | 1534 | (if (memq (get-text-property (match-beginning 0) 'face) |
| 1535 | '(font-lock-string-face font-lock-doc-face | 1535 | '(font-lock-string-face font-lock-doc-face |
| 1536 | font-lock-comment-face)) | 1536 | font-lock-comment-face)) |
| 1537 | font-lock-warning-face) | 1537 | (list 'face font-lock-warning-face |
| 1538 | 'help-echo "Looks like a toplevel defun: escape the parenthesis")) | ||
| 1538 | prepend))))) | 1539 | prepend))))) |
| 1539 | keywords)) | 1540 | keywords)) |
| 1540 | 1541 | ||
| @@ -1602,7 +1603,7 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1602 | (let* ((defaults (or font-lock-defaults | 1603 | (let* ((defaults (or font-lock-defaults |
| 1603 | (cdr (assq major-mode | 1604 | (cdr (assq major-mode |
| 1604 | (with-no-warnings | 1605 | (with-no-warnings |
| 1605 | font-lock-defaults-alist))))) | 1606 | font-lock-defaults-alist))))) |
| 1606 | (keywords | 1607 | (keywords |
| 1607 | (font-lock-choose-keywords (nth 0 defaults) | 1608 | (font-lock-choose-keywords (nth 0 defaults) |
| 1608 | (font-lock-value-in-major-mode font-lock-maximum-decoration))) | 1609 | (font-lock-value-in-major-mode font-lock-maximum-decoration))) |
| @@ -1854,95 +1855,95 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1854 | ;; buttons and when they are on or off needs tweaking. I have assumed that the | 1855 | ;; buttons and when they are on or off needs tweaking. I have assumed that the |
| 1855 | ;; mechanism is via `menu-toggle' and `menu-selected' symbol properties. sm. | 1856 | ;; mechanism is via `menu-toggle' and `menu-selected' symbol properties. sm. |
| 1856 | 1857 | ||
| 1857 | ;;;;###autoload | 1858 | ;;;;;###autoload |
| 1858 | ;(progn | 1859 | ;;(progn |
| 1859 | ; ;; Make the Font Lock menu. | 1860 | ;; ;; Make the Font Lock menu. |
| 1860 | ; (defvar font-lock-menu (make-sparse-keymap "Syntax Highlighting")) | 1861 | ;; (defvar font-lock-menu (make-sparse-keymap "Syntax Highlighting")) |
| 1861 | ; ;; Add the menu items in reverse order. | 1862 | ;; ;; Add the menu items in reverse order. |
| 1862 | ; (define-key font-lock-menu [fontify-less] | 1863 | ;; (define-key font-lock-menu [fontify-less] |
| 1863 | ; '("Less In Current Buffer" . font-lock-fontify-less)) | 1864 | ;; '("Less In Current Buffer" . font-lock-fontify-less)) |
| 1864 | ; (define-key font-lock-menu [fontify-more] | 1865 | ;; (define-key font-lock-menu [fontify-more] |
| 1865 | ; '("More In Current Buffer" . font-lock-fontify-more)) | 1866 | ;; '("More In Current Buffer" . font-lock-fontify-more)) |
| 1866 | ; (define-key font-lock-menu [font-lock-sep] | 1867 | ;; (define-key font-lock-menu [font-lock-sep] |
| 1867 | ; '("--")) | 1868 | ;; '("--")) |
| 1868 | ; (define-key font-lock-menu [font-lock-mode] | 1869 | ;; (define-key font-lock-menu [font-lock-mode] |
| 1869 | ; '("In Current Buffer" . font-lock-mode)) | 1870 | ;; '("In Current Buffer" . font-lock-mode)) |
| 1870 | ; (define-key font-lock-menu [global-font-lock-mode] | 1871 | ;; (define-key font-lock-menu [global-font-lock-mode] |
| 1871 | ; '("In All Buffers" . global-font-lock-mode))) | 1872 | ;; '("In All Buffers" . global-font-lock-mode))) |
| 1872 | ; | 1873 | ;; |
| 1873 | ;;;;###autoload | 1874 | ;;;;;###autoload |
| 1874 | ;(progn | 1875 | ;;(progn |
| 1875 | ; ;; We put the appropriate `menu-enable' etc. symbol property values on when | 1876 | ;; ;; We put the appropriate `menu-enable' etc. symbol property values on when |
| 1876 | ; ;; font-lock.el is loaded, so we don't need to autoload the three variables. | 1877 | ;; ;; font-lock.el is loaded, so we don't need to autoload the three variables. |
| 1877 | ; (put 'global-font-lock-mode 'menu-toggle t) | 1878 | ;; (put 'global-font-lock-mode 'menu-toggle t) |
| 1878 | ; (put 'font-lock-mode 'menu-toggle t) | 1879 | ;; (put 'font-lock-mode 'menu-toggle t) |
| 1879 | ; (put 'font-lock-fontify-more 'menu-enable '(identity)) | 1880 | ;; (put 'font-lock-fontify-more 'menu-enable '(identity)) |
| 1880 | ; (put 'font-lock-fontify-less 'menu-enable '(identity))) | 1881 | ;; (put 'font-lock-fontify-less 'menu-enable '(identity))) |
| 1881 | ; | 1882 | ;; |
| 1882 | ; ;; Put the appropriate symbol property values on now. See above. | 1883 | ;; ;; Put the appropriate symbol property values on now. See above. |
| 1883 | ;(put 'global-font-lock-mode 'menu-selected 'global-font-lock-mode) | 1884 | ;;(put 'global-font-lock-mode 'menu-selected 'global-font-lock-mode) |
| 1884 | ;(put 'font-lock-mode 'menu-selected 'font-lock-mode) | 1885 | ;;(put 'font-lock-mode 'menu-selected 'font-lock-mode) |
| 1885 | ;(put 'font-lock-fontify-more 'menu-enable '(nth 2 font-lock-fontify-level)) | 1886 | ;;(put 'font-lock-fontify-more 'menu-enable '(nth 2 font-lock-fontify-level)) |
| 1886 | ;(put 'font-lock-fontify-less 'menu-enable '(nth 1 font-lock-fontify-level)) | 1887 | ;;(put 'font-lock-fontify-less 'menu-enable '(nth 1 font-lock-fontify-level)) |
| 1887 | ; | 1888 | ;; |
| 1888 | ;(defvar font-lock-fontify-level nil) ; For less/more fontification. | 1889 | ;;(defvar font-lock-fontify-level nil) ; For less/more fontification. |
| 1889 | ; | 1890 | ;; |
| 1890 | ;(defun font-lock-fontify-level (level) | 1891 | ;;(defun font-lock-fontify-level (level) |
| 1891 | ; (let ((font-lock-maximum-decoration level)) | 1892 | ;; (let ((font-lock-maximum-decoration level)) |
| 1892 | ; (when font-lock-mode | 1893 | ;; (when font-lock-mode |
| 1893 | ; (font-lock-mode)) | 1894 | ;; (font-lock-mode)) |
| 1894 | ; (font-lock-mode) | 1895 | ;; (font-lock-mode) |
| 1895 | ; (when font-lock-verbose | 1896 | ;; (when font-lock-verbose |
| 1896 | ; (message "Fontifying %s... level %d" (buffer-name) level)))) | 1897 | ;; (message "Fontifying %s... level %d" (buffer-name) level)))) |
| 1897 | ; | 1898 | ;; |
| 1898 | ;(defun font-lock-fontify-less () | 1899 | ;;(defun font-lock-fontify-less () |
| 1899 | ; "Fontify the current buffer with less decoration. | 1900 | ;; "Fontify the current buffer with less decoration. |
| 1900 | ;See `font-lock-maximum-decoration'." | 1901 | ;;See `font-lock-maximum-decoration'." |
| 1901 | ; (interactive) | 1902 | ;; (interactive) |
| 1902 | ; ;; Check in case we get called interactively. | 1903 | ;; ;; Check in case we get called interactively. |
| 1903 | ; (if (nth 1 font-lock-fontify-level) | 1904 | ;; (if (nth 1 font-lock-fontify-level) |
| 1904 | ; (font-lock-fontify-level (1- (car font-lock-fontify-level))) | 1905 | ;; (font-lock-fontify-level (1- (car font-lock-fontify-level))) |
| 1905 | ; (error "No less decoration"))) | 1906 | ;; (error "No less decoration"))) |
| 1906 | ; | 1907 | ;; |
| 1907 | ;(defun font-lock-fontify-more () | 1908 | ;;(defun font-lock-fontify-more () |
| 1908 | ; "Fontify the current buffer with more decoration. | 1909 | ;; "Fontify the current buffer with more decoration. |
| 1909 | ;See `font-lock-maximum-decoration'." | 1910 | ;;See `font-lock-maximum-decoration'." |
| 1910 | ; (interactive) | 1911 | ;; (interactive) |
| 1911 | ; ;; Check in case we get called interactively. | 1912 | ;; ;; Check in case we get called interactively. |
| 1912 | ; (if (nth 2 font-lock-fontify-level) | 1913 | ;; (if (nth 2 font-lock-fontify-level) |
| 1913 | ; (font-lock-fontify-level (1+ (car font-lock-fontify-level))) | 1914 | ;; (font-lock-fontify-level (1+ (car font-lock-fontify-level))) |
| 1914 | ; (error "No more decoration"))) | 1915 | ;; (error "No more decoration"))) |
| 1915 | ; | 1916 | ;; |
| 1916 | ; ;; This should be called by `font-lock-set-defaults'. | 1917 | ;; ;; This should be called by `font-lock-set-defaults'. |
| 1917 | ;(defun font-lock-set-menu () | 1918 | ;;(defun font-lock-set-menu () |
| 1918 | ; ;; Activate less/more fontification entries if there are multiple levels for | 1919 | ;; ;; Activate less/more fontification entries if there are multiple levels for |
| 1919 | ; ;; the current buffer. Sets `font-lock-fontify-level' to be of the form | 1920 | ;; ;; the current buffer. Sets `font-lock-fontify-level' to be of the form |
| 1920 | ; ;; (CURRENT-LEVEL IS-LOWER-LEVEL-P IS-HIGHER-LEVEL-P) for menu activation. | 1921 | ;; ;; (CURRENT-LEVEL IS-LOWER-LEVEL-P IS-HIGHER-LEVEL-P) for menu activation. |
| 1921 | ; (let ((keywords (or (nth 0 font-lock-defaults) | 1922 | ;; (let ((keywords (or (nth 0 font-lock-defaults) |
| 1922 | ; (nth 1 (assq major-mode font-lock-defaults-alist)))) | 1923 | ;; (nth 1 (assq major-mode font-lock-defaults-alist)))) |
| 1923 | ; (level (font-lock-value-in-major-mode font-lock-maximum-decoration))) | 1924 | ;; (level (font-lock-value-in-major-mode font-lock-maximum-decoration))) |
| 1924 | ; (make-local-variable 'font-lock-fontify-level) | 1925 | ;; (make-local-variable 'font-lock-fontify-level) |
| 1925 | ; (if (or (symbolp keywords) (= (length keywords) 1)) | 1926 | ;; (if (or (symbolp keywords) (= (length keywords) 1)) |
| 1926 | ; (font-lock-unset-menu) | 1927 | ;; (font-lock-unset-menu) |
| 1927 | ; (cond ((eq level t) | 1928 | ;; (cond ((eq level t) |
| 1928 | ; (setq level (1- (length keywords)))) | 1929 | ;; (setq level (1- (length keywords)))) |
| 1929 | ; ((or (null level) (zerop level)) | 1930 | ;; ((or (null level) (zerop level)) |
| 1930 | ; ;; The default level is usually, but not necessarily, level 1. | 1931 | ;; ;; The default level is usually, but not necessarily, level 1. |
| 1931 | ; (setq level (- (length keywords) | 1932 | ;; (setq level (- (length keywords) |
| 1932 | ; (length (member (eval (car keywords)) | 1933 | ;; (length (member (eval (car keywords)) |
| 1933 | ; (mapcar 'eval (cdr keywords)))))))) | 1934 | ;; (mapcar 'eval (cdr keywords)))))))) |
| 1934 | ; (setq font-lock-fontify-level (list level (> level 1) | 1935 | ;; (setq font-lock-fontify-level (list level (> level 1) |
| 1935 | ; (< level (1- (length keywords)))))))) | 1936 | ;; (< level (1- (length keywords)))))))) |
| 1936 | ; | 1937 | ;; |
| 1937 | ; ;; This should be called by `font-lock-unset-defaults'. | 1938 | ;; ;; This should be called by `font-lock-unset-defaults'. |
| 1938 | ;(defun font-lock-unset-menu () | 1939 | ;;(defun font-lock-unset-menu () |
| 1939 | ; ;; Deactivate less/more fontification entries. | 1940 | ;; ;; Deactivate less/more fontification entries. |
| 1940 | ; (setq font-lock-fontify-level nil)) | 1941 | ;; (setq font-lock-fontify-level nil)) |
| 1941 | 1942 | ||
| 1942 | ;;; End of Menu support. | 1943 | ;;; End of Menu support. |
| 1943 | 1944 | ||
| 1944 | ;;; Various regexp information shared by several modes. | 1945 | ;;; Various regexp information shared by several modes. |
| 1945 | ; ;; Information specific to a single mode should go in its load library. | 1946 | ;; ;; Information specific to a single mode should go in its load library. |
| 1946 | 1947 | ||
| 1947 | ;; Font Lock support for C, C++, Objective-C and Java modes is now in | 1948 | ;; Font Lock support for C, C++, Objective-C and Java modes is now in |
| 1948 | ;; cc-fonts.el (and required by cc-mode.el). However, the below function | 1949 | ;; cc-fonts.el (and required by cc-mode.el). However, the below function |