bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12136: 24.1; Allow faces specified by property lists in `compilation


From: Oleksandr Manzyuk
Subject: bug#12136: 24.1; Allow faces specified by property lists in `compilation-error-regexp-alist'.
Date: Sat, 04 Aug 2012 17:07:39 +0300

Unlike Emacs 23 in which fontification of compilation errors is handled
by `font-lock.el', in Emacs 24, it is performed by `compile.el' itself,
in a rather ad hoc fashion.  In particular, it doesn't handle the faces
specified by property list of the form (face FACE PROP1 VAL1 PROP2 VAL2
...).  The documentation of `compilation-error-regexp-alist' says that
it is an alist that specifies how errors in compiler output are matched,
where each element has the form

(REGEXP FILE [LINE COLUMN TYPE HYPERLINK HIGHLIGHT...]).

Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where FACE is an
expression returning the face to use for the submatch.  If fact, only
symbols are supported by the current version of `compile.el' and lists
error out with the error message "Don't know how to handle face ...".

As a consequence, compilation error messages are not properly fontified
in `inferior-haskell-mode', which also breaks navigation between errors
with C-x ` (see https://github.com/haskell/haskell-mode/issues/67 for
more details).  Unfortunately, I don't know of any other examples where
this problem manifests itself.

It seems to be straightforward to add support for faces specified by
property list.  I use the following patch:

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index c008e1c..be73850 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1338,6 +1338,11 @@ to `compilation-error-regexp-alist' if RULES is nil."
                       (put-text-property
                        (match-beginning mn) (match-end mn)
                        'font-lock-face face))
+                     ((and (listp face)
+                           (eq (car face) 'face))
+                      (add-text-properties
+                       (match-beginning mn) (match-end mn)
+                       (cddr face)))
                      (t
                       (error "Don't know how to handle face %S"
                              face)))))))



In GNU Emacs 24.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
 of 2012-06-10 on paddy
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
Configured using:
 `configure '--prefix=/home/manzyuk''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  eldoc-mode: t
  diff-auto-refine-mode: t
  paredit-mode: t
  ido-everywhere: t
  shell-dirtrack-mode: t
  savehist-mode: t
  icomplete-mode: t
  global-auto-revert-mode: t
  show-paren-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x C-g C-h v c o m p i l a t i o n SPC e r r r <backspace> 
o r SPC r e <tab> <return> C-x o C-v C-v C-x o M-x 
r e o <backspace> p o r t SPC e m <tab> <return>

Recent messages:
Loading /home/manzyuk/src/emacs-preamble/init.el (source)...
Loading /home/manzyuk/.emacs.d/elpa/haskell-mode-2.8.0/haskell-site-file.el 
(source)...done
Loading /home/manzyuk/quicklisp/slime-helper.el (source)...done
Loading /home/manzyuk/src/emacs-preamble/init.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Type C-x 1 to delete the help window, C-M-v to scroll help.
scroll-down-command: Beginning of buffer

Load-path shadows:
None found.

Features:
(shadow sort flyspell ispell mail-extr emacsbug message rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader pp help-mode view eldoc preamble-scheme
preamble-ruby inf-ruby ruby-mode compile preamble-org org-install cl
preamble-magit preamble-diff magit-bisect magit-key-mode magit diff-mode
log-edit easy-mmode pcvs-util add-log preamble-lisp info-look
slime-autoloads preamble-haskell ghci-completion
preamble-google-translate google-translate json url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-util
url-parse url-vars mailcap preamble-emacs-lisp preamble-paredit paredit
preamble-auctex reftex reftex-vars preamble-package finder-inf
auctex-autoloads tex-site info easymenu ghci-completion-autoloads
google-translate-autoloads haskell-mode-autoloads inf-ruby-autoloads
magit-autoloads paredit-autoloads package tabulated-list preamble-text
preamble-shell preamble-prog preamble-makefile preamble-mail smtpmail
sendmail rfc2047 rfc2045 ietf-drums mail-utils preamble-ido ido
preamble-ibuffer preamble-hippie-expand preamble-ediff preamble-dired
preamble-comint preamble-ansi-color preamble-windows preamble-tramp
tramp tramp-compat auth-source eieio byte-opt bytecomp byte-compile
cconv macroexp assoc gnus-util mm-util mail-prsvr password-cache shell
pcomplete comint ansi-color ring format-spec tramp-loaddefs regexp-opt
preamble-server server preamble-mouse preamble-mode-line
preamble-minibuffer savehist icomplete preamble-keyboard
preamble-initialization preamble-frames preamble-files uniquify
autorevert preamble-env preamble-editing paren delsel edmacro kmacro
preamble-data saveplace preamble-browse-url preamble-bookmarks
preamble-utils advice help-fns advice-preload time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer loaddefs button faces cus-face files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)





reply via email to

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