comparison lisp/progmodes/compile.el @ 64739:acd7896a76ba

(compilation-mode-font-lock-keywords): Use `compilation-text-face', `compilation-info-text-face' and `compilation-error-text-face' instead of `font-lock-keyword-face'. (compilation-error): New face. (compilation-error-file-name): Inherit from `compilation-error' instead of `font-lock-warning-face'. (compilation-warning-file-name): Inherit from `compilation-warning' instead of `font-lock-warning-face'. (compilation-info, compilation-error-file-name) (compilation-warning-file-name, compilation-info-file-name) (compilation-line-number, compilation-column-number): Doc fix. (compilation-error-text-face, compilation-warning-text-face) (compilation-info-text-face): New face variables. (compilation-line-face, compilation-column-face) (compilation-enter-directory-face) (compilation-leave-directory-face): Doc fix. (compilation-text-face): New function.
author Juri Linkov <juri@jurta.org>
date Sat, 06 Aug 2005 01:10:09 +0000
parents 5f8a240b7621
children 2838cf662e70
comparison
equal deleted inserted replaced
64738:b8929a75abe8 64739:acd7896a76ba
375 375
376 (defvar compilation-mode-font-lock-keywords 376 (defvar compilation-mode-font-lock-keywords
377 '(;; configure output lines. 377 '(;; configure output lines.
378 ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$" 378 ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$"
379 (1 font-lock-variable-name-face) 379 (1 font-lock-variable-name-face)
380 (2 font-lock-keyword-face)) 380 (2 (compilation-text-face '(4 . 3))))
381 ;; Command output lines. Recognize `make[n]:' lines too. 381 ;; Command output lines. Recognize `make[n]:' lines too.
382 ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" 382 ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
383 (1 font-lock-function-name-face) (3 compilation-line-face nil t)) 383 (1 font-lock-function-name-face) (3 compilation-line-face nil t))
384 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1) 384 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
385 ("^Compilation finished" . font-lock-keyword-face) 385 ("^Compilation finished" . compilation-info-text-face)
386 ("^Compilation exited abnormally" . font-lock-keyword-face)) 386 ("^Compilation exited abnormally" . compilation-error-text-face))
387 "Additional things to highlight in Compilation mode. 387 "Additional things to highlight in Compilation mode.
388 This gets tacked on the end of the generated expressions.") 388 This gets tacked on the end of the generated expressions.")
389 389
390 (defvar compilation-highlight-regexp t 390 (defvar compilation-highlight-regexp t
391 "Regexp matching part of visited source lines to highlight temporarily. 391 "Regexp matching part of visited source lines to highlight temporarily.
466 starting the compilation process.") 466 starting the compilation process.")
467 467
468 ;; History of compile commands. 468 ;; History of compile commands.
469 (defvar compile-history nil) 469 (defvar compile-history nil)
470 470
471 (defface compilation-error
472 '((t :inherit font-lock-warning-face))
473 "Face used to highlight compiler errors."
474 :group 'font-lock-highlighting-faces
475 :version "22.1")
476
471 (defface compilation-warning 477 (defface compilation-warning
472 '((((class color) (min-colors 16)) (:foreground "Orange" :weight bold)) 478 '((((class color) (min-colors 16)) (:foreground "Orange" :weight bold))
473 (((class color)) (:foreground "cyan" :weight bold)) 479 (((class color)) (:foreground "cyan" :weight bold))
474 (t (:weight bold))) 480 (t (:weight bold)))
475 "Face used to highlight compiler warnings." 481 "Face used to highlight compiler warnings."
485 (:foreground "Green1" :weight bold)) 491 (:foreground "Green1" :weight bold))
486 (((class color) (min-colors 16) (background dark)) 492 (((class color) (min-colors 16) (background dark))
487 (:foreground "Green" :weight bold)) 493 (:foreground "Green" :weight bold))
488 (((class color)) (:foreground "green" :weight bold)) 494 (((class color)) (:foreground "green" :weight bold))
489 (t (:weight bold))) 495 (t (:weight bold)))
490 "Face used to highlight compiler warnings." 496 "Face used to highlight compiler information."
491 :group 'font-lock-highlighting-faces 497 :group 'font-lock-highlighting-faces
492 :version "22.1") 498 :version "22.1")
493 ;; backward-compatibility alias 499 ;; backward-compatibility alias
494 (put 'compilation-info-face 'face-alias 'compilation-info) 500 (put 'compilation-info-face 'face-alias 'compilation-info)
495 501
496 (defface compilation-error-file-name 502 (defface compilation-error-file-name
497 '((default :inherit font-lock-warning-face) 503 '((default :inherit compilation-error)
498 (((supports :underline t)) :underline t)) 504 (((supports :underline t)) :underline t))
499 "Face for displaying file names in compilation errors." 505 "Face for displaying file names in error messages."
500 :group 'font-lock-highlighting-faces 506 :group 'font-lock-highlighting-faces
501 :version "22.1") 507 :version "22.1")
502 508
503 (defface compilation-warning-file-name 509 (defface compilation-warning-file-name
504 '((default :inherit font-lock-warning-face) 510 '((default :inherit compilation-warning)
505 (((supports :underline t)) :underline t)) 511 (((supports :underline t)) :underline t))
506 "Face for displaying file names in compilation errors." 512 "Face for displaying file names in warning messages."
507 :group 'font-lock-highlighting-faces 513 :group 'font-lock-highlighting-faces
508 :version "22.1") 514 :version "22.1")
509 515
510 (defface compilation-info-file-name 516 (defface compilation-info-file-name
511 '((default :inherit compilation-info) 517 '((default :inherit compilation-info)
512 (((supports :underline t)) :underline t)) 518 (((supports :underline t)) :underline t))
513 "Face for displaying file names in compilation errors." 519 "Face for displaying file names in informational messages."
514 :group 'font-lock-highlighting-faces 520 :group 'font-lock-highlighting-faces
515 :version "22.1") 521 :version "22.1")
516 522
517 (defface compilation-line-number 523 (defface compilation-line-number
518 '((default :inherit font-lock-variable-name-face) 524 '((default :inherit font-lock-variable-name-face)
519 (((supports :underline t)) :underline t)) 525 (((supports :underline t)) :underline t))
520 "Face for displaying file names in compilation errors." 526 "Face for displaying line numbers in compiler messages."
521 :group 'font-lock-highlighting-faces 527 :group 'font-lock-highlighting-faces
522 :version "22.1") 528 :version "22.1")
523 529
524 (defface compilation-column-number 530 (defface compilation-column-number
525 '((default :inherit font-lock-type-face) 531 '((default :inherit font-lock-type-face)
526 (((supports :underline t)) :underline t)) 532 (((supports :underline t)) :underline t))
527 "Face for displaying file names in compilation errors." 533 "Face for displaying column numbers in compiler messages."
528 :group 'font-lock-highlighting-faces 534 :group 'font-lock-highlighting-faces
529 :version "22.1") 535 :version "22.1")
530 536
531 (defvar compilation-message-face nil 537 (defvar compilation-message-face nil
532 "Face name to use for whole messages. 538 "Face name to use for whole messages.
535 `compilation-column-face' get prepended to this, when applicable.") 541 `compilation-column-face' get prepended to this, when applicable.")
536 542
537 (defvar compilation-error-face 'compilation-error-file-name 543 (defvar compilation-error-face 'compilation-error-file-name
538 "Face name to use for file name in error messages.") 544 "Face name to use for file name in error messages.")
539 545
546 (defvar compilation-error-text-face 'compilation-error
547 "Face name to use for text of error messages.")
548
540 (defvar compilation-warning-face 'compilation-warning-file-name 549 (defvar compilation-warning-face 'compilation-warning-file-name
541 "Face name to use for file name in warning messages.") 550 "Face name to use for file name in warning messages.")
542 551
552 (defvar compilation-warning-text-face 'compilation-warning
553 "Face name to use for text of warning messages.")
554
543 (defvar compilation-info-face 'compilation-info-file-name 555 (defvar compilation-info-face 'compilation-info-file-name
544 "Face name to use for file name in informational messages.") 556 "Face name to use for file name in informational messages.")
545 557
558 (defvar compilation-info-text-face 'compilation-info
559 "Face name to use for text of informational messages.")
560
546 (defvar compilation-line-face 'compilation-line-number 561 (defvar compilation-line-face 'compilation-line-number
547 "Face name to use for line number in message.") 562 "Face name to use for line numbers in compiler message.")
548 563
549 (defvar compilation-column-face 'compilation-column-number 564 (defvar compilation-column-face 'compilation-column-number
550 "Face name to use for column number in message.") 565 "Face name to use for column numbers in compiler messages.")
551 566
552 ;; same faces as dired uses 567 ;; same faces as dired uses
553 (defvar compilation-enter-directory-face 'font-lock-function-name-face 568 (defvar compilation-enter-directory-face 'font-lock-function-name-face
554 "Face name to use for column number in message.") 569 "Face name to use for entering directory messages.")
555 570
556 (defvar compilation-leave-directory-face 'font-lock-type-face 571 (defvar compilation-leave-directory-face 'font-lock-type-face
557 "Face name to use for column number in message.") 572 "Face name to use for leaving directory messages.")
558 573
559 574
560 575
561 ;; Used for compatibility with the old compile.el. 576 ;; Used for compatibility with the old compile.el.
562 (defvaralias 'compilation-last-buffer 'next-error-last-buffer) 577 (defvaralias 'compilation-last-buffer 'next-error-last-buffer)
567 582
568 (defun compilation-face (type) 583 (defun compilation-face (type)
569 (or (and (car type) (match-end (car type)) compilation-warning-face) 584 (or (and (car type) (match-end (car type)) compilation-warning-face)
570 (and (cdr type) (match-end (cdr type)) compilation-info-face) 585 (and (cdr type) (match-end (cdr type)) compilation-info-face)
571 compilation-error-face)) 586 compilation-error-face))
587
588 (defun compilation-text-face (type)
589 (or (and (car type) (match-end (car type)) compilation-warning-text-face)
590 (and (cdr type) (match-end (cdr type)) compilation-info-text-face)
591 compilation-error-text-face))
572 592
573 ;; Internal function for calculating the text properties of a directory 593 ;; Internal function for calculating the text properties of a directory
574 ;; change message. The directory property is important, because it is 594 ;; change message. The directory property is important, because it is
575 ;; the stack of nested enter-messages. Relative filenames on the following 595 ;; the stack of nested enter-messages. Relative filenames on the following
576 ;; lines are relative to the top of the stack. 596 ;; lines are relative to the top of the stack.