comparison lisp/progmodes/make-mode.el @ 12912:e519963ce31a

(makefile-space-face): New variable. (makefile-define-space-face): New function. (makefile-tab-face): Variable deleted. (makefile-define-tab-face): Function deleted. (makefile-font-lock-keywords): Highlight leading spaces, not tabs.
author Richard M. Stallman <rms@gnu.org>
date Mon, 21 Aug 1995 17:27:04 +0000
parents 58b96b3c285e
children 1548eeb34926
comparison
equal deleted inserted replaced
12911:be0fe2c66b9d 12912:e519963ce31a
12 ;; Also, the doc strings need fixing: the first line doesn't stand alone, 12 ;; Also, the doc strings need fixing: the first line doesn't stand alone,
13 ;; and other usage is not high quality. Symbol names don't have `...'. 13 ;; and other usage is not high quality. Symbol names don't have `...'.
14 14
15 ;; So, for the meantime, this is not the default mode for makefiles. 15 ;; So, for the meantime, this is not the default mode for makefiles.
16 16
17 ;; $Id: makefile.el,v 1.22 1995/06/15 20:42:24 kwzh Exp rms $ 17 ;; $Id: makefile.el,v 1.23 1995/06/24 07:34:27 rms Exp rms $
18 18
19 ;; This file is part of GNU Emacs. 19 ;; This file is part of GNU Emacs.
20 20
21 ;; GNU Emacs is free software; you can redistribute it and/or modify 21 ;; GNU Emacs is free software; you can redistribute it and/or modify
22 ;; it under the terms of the GNU General Public License as published by 22 ;; it under the terms of the GNU General Public License as published by
203 203
204 (defconst makefile-ignored-files-in-pickup-regex 204 (defconst makefile-ignored-files-in-pickup-regex
205 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)" 205 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)"
206 "Regex for filenames that will NOT be included in the target list.") 206 "Regex for filenames that will NOT be included in the target list.")
207 207
208 ;; TABs are important in Makefiles. So highlight them in font-lock. 208 (defvar makefile-space-face 'makefile-space-face
209 ;; Thanks to Job Ganzevoort <Job.Ganzevoort@cwi.nl> for this. 209 "Face to use for highlighting leading spaces in Font-Lock mode.")
210 (defvar makefile-tab-face 'makefile-tab-face
211 "Face to use for highlighting leading tabs in font-lock-mode.")
212 210
213 (defconst makefile-font-lock-keywords 211 (defconst makefile-font-lock-keywords
214 (list 212 (list
215 ;; Do macro assignments. These get the "variable-name" face rather 213 ;; Do macro assignments. These get the "variable-name" face rather
216 ;; arbitrarily. 214 ;; arbitrarily.
220 '("\\$[({]\\([a-zA-Z0-9_]+\\)[})]" 1 font-lock-reference-face t) 218 '("\\$[({]\\([a-zA-Z0-9_]+\\)[})]" 1 font-lock-reference-face t)
221 ;; 219 ;;
222 ;; Do dependencies. These get the function name face. 220 ;; Do dependencies. These get the function name face.
223 (list makefile-dependency-regex 1 'font-lock-function-name-face) 221 (list makefile-dependency-regex 1 'font-lock-function-name-face)
224 222
225 ;; Highlight leading tab. Maybe highlighting all leading TABs 223 ;; Highlight leading spaces, since they are hard to see and
226 ;; would be nice? I don't know. 224 ;; can make a makefile fail to function.
227 '("^\t" . makefile-tab-face))) 225 ;; Don't highlight leading tabs, because they are normal
226 ;; and people assume that 8 cols of whitespace means a tab.
227 '("^ " . makefile-space-face)))
228 228
229 ;;; ------------------------------------------------------------ 229 ;;; ------------------------------------------------------------
230 ;;; The following configurable variables are used in the 230 ;;; The following configurable variables are used in the
231 ;;; up-to-date overview . 231 ;;; up-to-date overview .
232 ;;; The standard configuration assumes that your `make' program 232 ;;; The standard configuration assumes that your `make' program
485 (make-local-variable 'makefile-has-prereqs) 485 (make-local-variable 'makefile-has-prereqs)
486 (make-local-variable 'makefile-need-target-pickup) 486 (make-local-variable 'makefile-need-target-pickup)
487 (make-local-variable 'makefile-need-macro-pickup) 487 (make-local-variable 'makefile-need-macro-pickup)
488 488
489 ;; Font lock. 489 ;; Font lock.
490 (makefile-define-tab-face) 490 (makefile-define-space-face)
491 (make-local-variable 'font-lock-defaults) 491 (make-local-variable 'font-lock-defaults)
492 (setq font-lock-defaults '(makefile-font-lock-keywords)) 492 (setq font-lock-defaults '(makefile-font-lock-keywords))
493 493
494 ;; Add-log. 494 ;; Add-log.
495 (make-local-variable 'add-log-current-defun-function) 495 (make-local-variable 'add-log-current-defun-function)
1359 (match-beginning n)) 1359 (match-beginning n))
1360 alist)))) 1360 alist))))
1361 (imenu-progress-message stupid 100) 1361 (imenu-progress-message stupid 100)
1362 (nreverse alist))) 1362 (nreverse alist)))
1363 1363
1364 (defun makefile-define-tab-face () 1364 (defun makefile-define-space-face ()
1365 (make-face 'makefile-tab-face) 1365 (make-face 'makefile-space-face)
1366 (or (face-differs-from-default-p 'makefile-tab-face) 1366 (or (face-differs-from-default-p 'makefile-space-face)
1367 (let* ((light-bg (eq font-lock-background-mode 'light)) 1367 (let* ((light-bg (eq font-lock-background-mode 'light))
1368 (bg-color 1368 (bg-color
1369 (cond ((memq font-lock-display-type '(mono monochrome)) 1369 (cond ((memq font-lock-display-type '(mono monochrome))
1370 (if light-bg "black" "white")) 1370 (if light-bg "black" "white"))
1371 ((memq font-lock-display-type '(grayscale greyscale 1371 ((memq font-lock-display-type '(grayscale greyscale
1373 (if light-bg "black" "white")) 1373 (if light-bg "black" "white"))
1374 (light-bg ; Light color background. 1374 (light-bg ; Light color background.
1375 "hotpink") 1375 "hotpink")
1376 (t ; Dark color background. 1376 (t ; Dark color background.
1377 "hotpink")))) 1377 "hotpink"))))
1378 (set-face-background 'makefile-tab-face bg-color)))) 1378 (set-face-background 'makefile-space-face bg-color))))
1379 1379
1380 ;;; makefile.el ends here 1380 ;;; makefile.el ends here