all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#61093: Indented file names confuse compilation buffer
@ 2023-01-27 11:11 Sascha Ziemann
  2023-01-27 14:34 ` Mattias Engdegård
  2023-01-27 21:00 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Ziemann @ 2023-01-27 11:11 UTC (permalink / raw)
  To: 61093

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

The Go compiler indents sometimes filenames. I have attached a
htmlfontified compilation buffer showing this. It also shows that the
parser of the compilation buffer gets confused by this. The
problematic line is:

"    ./config.go:10:5: other declaration of config_file"

Some code thinks the whole line is a file name, because the whole line
is a hyperlink (underlined).

Some other code thinks only the beginning of the line is a file name
(red). But this part also thinks the line number is part of the file
name and marks the column number as line number (purple).

I think it might be ok to ignore leading whitespace, because file
names do not start very often with whitespace.

[-- Attachment #2: compilation.html --]
[-- Type: text/html, Size: 10423 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#61093: Indented file names confuse compilation buffer
  2023-01-27 11:11 bug#61093: Indented file names confuse compilation buffer Sascha Ziemann
@ 2023-01-27 14:34 ` Mattias Engdegård
  2023-01-27 16:23   ` Rudolf Schlatte
  2023-01-27 21:00 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 4+ messages in thread
From: Mattias Engdegård @ 2023-01-27 14:34 UTC (permalink / raw)
  To: 61093; +Cc: Sascha Ziemann

> I think it might be ok to ignore leading whitespace, because file
> names do not start very often with whitespace.

The story goes like this: a tool uses a modification of the GNU message format and its users then expect Emacs to conform to that variant.

The problem with doing that is that each little tweak makes the compilation message rules less robust and more likely to collide with one another and become slower. There are about 60 regexps now, most of which are used by very few people, and we keep adding. Build logs can become quite long so performance is not unimportant.

Maybe it's safe to accept and ignore not arbitrary leading whitespace but a single tab, which your tool seems to emit. Or you could ask those making it to cease emitting the tab.

You could also put your own rule in compilation-regexp-alist. It might look like this:

;; Message pattern for ancillary locations (notes) from the Go compiler
(let ((rule
       `(go-note
         ,(rx bol "\t"
              (group                    ; 1: hyperlink
               (group                    ; 2: file
                (not (in " \t\n:"))
                (* (not (in "\t\n"))))
               ":"
               (group (+ digit))         ; 3: line
               ":"
               (group (+ digit))         ; 4: column
               ":")
              " "
              (+ nonl))                ; message
          2 3 4 0 1)))
  (setq compilation-error-regexp-alist-alist
        (remq (assq 'go-note compilation-error-regexp-alist-alist)
              compilation-error-regexp-alist-alist))
  (push rule compilation-error-regexp-alist-alist)
  (setq compilation-error-regexp-alist
        (remq 'go-note compilation-error-regexp-alist))
  (push 'go-note compilation-error-regexp-alist))







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#61093: Indented file names confuse compilation buffer
  2023-01-27 14:34 ` Mattias Engdegård
@ 2023-01-27 16:23   ` Rudolf Schlatte
  0 siblings, 0 replies; 4+ messages in thread
From: Rudolf Schlatte @ 2023-01-27 16:23 UTC (permalink / raw)
  To: 61093

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

>> I think it might be ok to ignore leading whitespace, because file
>> names do not start very often with whitespace.
>
> The story goes like this: a tool uses a modification of the GNU message format and its users then expect Emacs to conform to that variant.
>
> The problem with doing that is that each little tweak makes the compilation message rules less robust and more likely to collide with one another and become slower. There are about 60 regexps now, most of which are used by very few people, and we keep adding. Build logs can become quite long so performance is not unimportant.
>
> Maybe it's safe to accept and ignore not arbitrary leading whitespace but a single tab, which your tool seems to emit. Or you could ask those making it to cease emitting the tab.
>
> You could also put your own rule in compilation-regexp-alist. It might look like this:
>
> ;; Message pattern for ancillary locations (notes) from the Go compiler
> (let ((rule
>        `(go-note
>          ,(rx bol "\t"
>               (group                    ; 1: hyperlink
>                (group                    ; 2: file
>                 (not (in " \t\n:"))
>                 (* (not (in "\t\n"))))
>                ":"
>                (group (+ digit))         ; 3: line
>                ":"
>                (group (+ digit))         ; 4: column
>                ":")
>               " "
>               (+ nonl))                ; message
>           2 3 4 0 1)))
>   (setq compilation-error-regexp-alist-alist
>         (remq (assq 'go-note compilation-error-regexp-alist-alist)
>               compilation-error-regexp-alist-alist))
>   (push rule compilation-error-regexp-alist-alist)
>   (setq compilation-error-regexp-alist
>         (remq 'go-note compilation-error-regexp-alist))
>   (push 'go-note compilation-error-regexp-alist))

Is there a way for an emacs mode to add mode-specific values to
compilation-error-regexp-alist(-alist)?  If a major mode starts
compilation, presumably it knows the error message format and could set
up that one compilation buffer accordingly without having to add to
global error message parsing.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#61093: Indented file names confuse compilation buffer
  2023-01-27 11:11 bug#61093: Indented file names confuse compilation buffer Sascha Ziemann
  2023-01-27 14:34 ` Mattias Engdegård
@ 2023-01-27 21:00 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 4+ messages in thread
From: Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-01-27 21:00 UTC (permalink / raw)
  To: Sascha Ziemann, 61093

Sascha Ziemann <ceving@gmail.com> writes:

> I think it might be ok to ignore leading whitespace, because file
> names do not start very often with whitespace.

Would that perhaps fix Lua errors too, which are also indented?

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60830

Rudy
-- 
"Logic is a science of the necessary laws of thought, without which no
employment of the understanding and the reason takes place."
-- Immanuel Kant, 1785

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-27 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-27 11:11 bug#61093: Indented file names confuse compilation buffer Sascha Ziemann
2023-01-27 14:34 ` Mattias Engdegård
2023-01-27 16:23   ` Rudolf Schlatte
2023-01-27 21:00 ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.