[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM UNSURE] Warnings no longer discriminated by compilation-mode
From: |
Stephen Leake |
Subject: |
Re: [SPAM UNSURE] Warnings no longer discriminated by compilation-mode |
Date: |
Sat, 14 Aug 2021 06:37:54 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) |
Manuel Gómez <mgrojo@gmail.com> writes:
> Am 12/8/21 um 19:29 schrieb Stephen Leake:
>> Manuel Gómez <mgrojo@gmail.com> writes:
>>
>>> After updating to ada-mode version 7.1.7 from 4.0 (it is the built-in
>>> version in Emacs 26.3), I've noticed that warnings emitted by the
>>> compiler are no longer colorized differently and the count in the
>>> modeline no longer counts them (second number in orange). Everything
>>> is considered an error. Even if I call M-x compile and run gprbuild by
>>> myself, the compilation-mode acts in the same way; so I suppose it has
>>> been set up by ada-mode 7 in some way. Is that intended?
>> This is controlled by compilation-error-regexp-alist-alist and
>> compilation-error-regexp-alist.
>> ada-mode 7.x does not set these variables for Ada buffers; it does
>> set
>> them for gpr-query results.
>> It may be that ada-mode 4 did set these; you can probably just copy
>> that
>> setting into your ~/.emacs.
>> In my devel system, compilation-error-regexp-alist is set to
>> '(gnat),
>> but I can't find where that happens :(.
>>
>
> At least in ada-mode-7.1.7 it is set here:
> gnat-core.el:361: (setq compilation-error-regexp-alist '(gnat))
Ah, sorry, I missed that. And the 'gnat style is defined at the bottom of
that file:
(add-to-list
'compilation-error-regexp-alist-alist
'(gnat
;; typical:
;; cards_package.adb:45:32: expected private type "System.Address"
;;
;; with full path Source_Reference pragma :
;; d:/maphds/version_x/1773/sbs-abi-dll_lib.ads.gp:39:06: file
"interfaces_c.ads" not found
;;
;; gnu cc1: (gnatmake can invoke the C compiler)
;; foo.c:2: `TRUE' undeclared here (not in a function)
;; foo.c:2 : `TRUE' undeclared here (not in a function)
;;
;; we can't handle secondary errors here, because a regexp can't distinquish
"message" from "filename"
"^\\(\\(.:\\)?[^ :\n]+\\):\\([0-9]+\\)\\s-?:?\\([0-9]+\\)?" 1 3 4))
The default value for the 'ada style is in compile.el:
(defvar compilation-error-regexp-alist-alist
`( ...
(ada
"\\(warning: .*\\)? at \\([^ \n]+\\):\\([0-9]+\\)$" 2 3 nil (1))
...
that sets the TYPE subexpression if "warning" is present; see
the doc string for compilation-error-regexp-alist.
(I always run the compiler with warnings=error, so I don't notice that
warnings should be colored differently).
The default definition of the 'gnu looks very complete. I don't remember
why I don't just use that; I'll experiment.
As a workaround, you can override these definitions in your ~/.emacs
(must be done after wisi is loaded):
(require 'wisi)
(cl-defmethod wisi-compiler-select-prj ((_compiler gnat-compiler) _project)
(add-to-list 'completion-ignored-extensions ".ali") ;; gnat library files
;; (setq compilation-error-regexp-alist '(gnat))
)
(cl-defmethod wisi-compiler-deselect-prj ((_compiler gnat-compiler) _project)
(setq completion-ignored-extensions (delete ".ali"
completion-ignored-extensions))
;; (setq compilation-error-regexp-alist
;; (mapcar #'car compilation-error-regexp-alist-alist))
)
Or change that to set '(gnu).
Or you can change the regexp in the 'gnat entry in
compilation-error-regexp-alist-alist to set the TYPE subexpression.
--
-- Stephe