emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Underlining in compile.el


From: Juri Linkov
Subject: Re: Underlining in compile.el
Date: Sat, 06 Aug 2005 21:43:08 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

I just noticed that there is a much simpler and more correct solution
for adding underline attributes to links in the compilation and grep
buffers than using new special faces with the underline attribute
(currently fontification with them is still wrong: some parts of links
are not underlined while some non-link parts are underlined).

There is already a face variable `compilation-message-face' with
`nil' value by default.  compile.el puts the face from this variable
exactly on the link areas active for navigation (together with
text properties `message', `help-echo' and `mouse-face'=`highlight').

So changing its default value to `underline' will do the right thing:
it will underline exactly the link areas, no more, no less.

The patch below removes the new compilation faces with underline
attributes, and changes the default value of `compilation-message-face'
to `underline'.

Index: lisp/progmodes/compile.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.369
diff -c -r1.369 compile.el
*** lisp/progmodes/compile.el   6 Aug 2005 01:10:09 -0000       1.369
--- lisp/progmodes/compile.el   6 Aug 2005 18:31:58 -0000
***************
*** 377,389 ****
     '(;; configure output lines.
       ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to 
\\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: 
.+\\)?\\)\\|no\\|\\(.*\\)\\)$"
        (1 font-lock-variable-name-face)
!       (2 (compilation-text-face '(4 . 3))))
       ;; Command output lines.  Recognize `make[n]:' lines too.
       ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
        (1 font-lock-function-name-face) (3 compilation-line-face nil t))
       (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
!      ("^Compilation finished" . compilation-info-text-face)
!      ("^Compilation exited abnormally" . compilation-error-text-face))
     "Additional things to highlight in Compilation mode.
  This gets tacked on the end of the generated expressions.")
  
--- 377,389 ----
     '(;; configure output lines.
       ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to 
\\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: 
.+\\)?\\)\\|no\\|\\(.*\\)\\)$"
        (1 font-lock-variable-name-face)
!       (2 (compilation-face '(4 . 3))))
       ;; Command output lines.  Recognize `make[n]:' lines too.
       ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
        (1 font-lock-function-name-face) (3 compilation-line-face nil t))
       (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
!      ("^Compilation finished" . compilation-info-face)
!      ("^Compilation exited abnormally" . compilation-error-face))
     "Additional things to highlight in Compilation mode.
  This gets tacked on the end of the generated expressions.")
  
***************
*** 499,563 ****
  ;; backward-compatibility alias
  (put 'compilation-info-face 'face-alias 'compilation-info)
  
- (defface compilation-error-file-name
-   '((default :inherit compilation-error)
-     (((supports :underline t)) :underline t))
-   "Face for displaying file names in error messages."
-   :group 'font-lock-highlighting-faces
-   :version "22.1")
- 
- (defface compilation-warning-file-name
-   '((default :inherit compilation-warning)
-     (((supports :underline t)) :underline t))
-   "Face for displaying file names in warning messages."
-   :group 'font-lock-highlighting-faces
-   :version "22.1")
- 
- (defface compilation-info-file-name
-   '((default :inherit compilation-info)
-     (((supports :underline t)) :underline t))
-   "Face for displaying file names in informational messages."
-   :group 'font-lock-highlighting-faces
-   :version "22.1")
- 
  (defface compilation-line-number
!   '((default :inherit font-lock-variable-name-face)
!     (((supports :underline t)) :underline t))
    "Face for displaying line numbers in compiler messages."
    :group 'font-lock-highlighting-faces
    :version "22.1")
  
  (defface compilation-column-number
!   '((default :inherit font-lock-type-face)
!     (((supports :underline t)) :underline t))
    "Face for displaying column numbers in compiler messages."
    :group 'font-lock-highlighting-faces
    :version "22.1")
  
! (defvar compilation-message-face nil
    "Face name to use for whole messages.
  Faces `compilation-error-face', `compilation-warning-face',
  `compilation-info-face', `compilation-line-face' and
  `compilation-column-face' get prepended to this, when applicable.")
  
! (defvar compilation-error-face 'compilation-error-file-name
    "Face name to use for file name in error messages.")
  
! (defvar compilation-error-text-face 'compilation-error
!   "Face name to use for text of error messages.")
! 
! (defvar compilation-warning-face 'compilation-warning-file-name
    "Face name to use for file name in warning messages.")
  
! (defvar compilation-warning-text-face 'compilation-warning
!   "Face name to use for text of warning messages.")
! 
! (defvar compilation-info-face 'compilation-info-file-name
    "Face name to use for file name in informational messages.")
  
- (defvar compilation-info-text-face 'compilation-info
-   "Face name to use for text of informational messages.")
- 
  (defvar compilation-line-face 'compilation-line-number
    "Face name to use for line numbers in compiler message.")
  
--- 499,531 ----
  ;; backward-compatibility alias
  (put 'compilation-info-face 'face-alias 'compilation-info)
  
  (defface compilation-line-number
!   '((t :inherit font-lock-variable-name-face))
    "Face for displaying line numbers in compiler messages."
    :group 'font-lock-highlighting-faces
    :version "22.1")
  
  (defface compilation-column-number
!   '((t :inherit font-lock-type-face))
    "Face for displaying column numbers in compiler messages."
    :group 'font-lock-highlighting-faces
    :version "22.1")
  
! (defvar compilation-message-face 'underline
    "Face name to use for whole messages.
  Faces `compilation-error-face', `compilation-warning-face',
  `compilation-info-face', `compilation-line-face' and
  `compilation-column-face' get prepended to this, when applicable.")
  
! (defvar compilation-error-face 'compilation-error
    "Face name to use for file name in error messages.")
  
! (defvar compilation-warning-face 'compilation-warning
    "Face name to use for file name in warning messages.")
  
! (defvar compilation-info-face 'compilation-info
    "Face name to use for file name in informational messages.")
  
  (defvar compilation-line-face 'compilation-line-number
    "Face name to use for line numbers in compiler message.")
  
***************
*** 584,594 ****
    (or (and (car type) (match-end (car type)) compilation-warning-face)
        (and (cdr type) (match-end (cdr type)) compilation-info-face)
        compilation-error-face))
- 
- (defun compilation-text-face (type)
-   (or (and (car type) (match-end (car type)) compilation-warning-text-face)
-       (and (cdr type) (match-end (cdr type)) compilation-info-text-face)
-       compilation-error-text-face))
  
  ;; Internal function for calculating the text properties of a directory
  ;; change message.  The directory property is important, because it is
--- 552,557 ----

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]