GNU bug report logs - #10258
compilation-error-regexp-alist just assumes columns not characters

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Fri, 9 Dec 2011 21:56:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10258 in the body.
You can then email your comments to 10258 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10258; Package emacs. (Fri, 09 Dec 2011 21:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Dec 2011 21:56:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: compilation-error-regexp-alist just assumes columns not characters
Date: Sat, 10 Dec 2011 04:18:12 +0800
Gentlemen, why does *compilation* say

  basex -b y=3 TaiwanAMFMSW.xq
  Stopped at line 57, column 29 in /home/jidanni/millerliu/xquery/TaiwanAMFMSW.xq:
  [XPST0003] Expecting "return", found "r".

But the cursor upon next-error ends up at

        case "TaiwanAMFMSW_by_band" retrun let $K:= "AM/FM/SW" return ()
                            ^      ^
                            A, not B       if those blanks at front were a TAB.

Well that is because on
   (describe-variable (quote compilation-error-regexp-alist))
there is nary a mention of what to do when the compiler making the
message is counting characters (TAB=1) and emacs is thinking it is
counting columns (TAB=8, etc.).

All we see is
  COLUMN can also be of the form (COLUMN . END-COLUMN) meaning a range of
  columns starting on LINE and ending on END-LINE, if that matched.

There is no way to communicate to emacs that this certain compiler does
not know how many columns a TAB equals in emacs, and is just reporting a
character count from the last newline.

So one is forced to untabify ones source files!

So it seems that compilation-error-regexp-alist needs an extra parameter
to tell if we are just counting characters or actually counting columns.

P.S., guess what happens when there are wide characters involved,

        case "補補補TaiwanAMFMSW_by_band" retrun let $K:= "AM/FM/SW" return ()

you guessed it!

How can I tell emacs in
   (add-to-list 'compilation-error-regexp-alist-alist
   '(basex "^Stopped at line \\([0-9]+\\), column \\([0-9]+\\) in \\(.*?\\):$" 3 1 2))
     (add-to-list 'compilation-error-regexp-alist 'basex)
that "column" means "char"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10258; Package emacs. (Mon, 12 Dec 2011 16:30:01 GMT) Full text and rfc822 format available.

Message #8 received at 10258 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: 10258 <at> debbugs.gnu.org
Subject: Re: bug#10258: compilation-error-regexp-alist just assumes columns
	not characters
Date: Mon, 12 Dec 2011 11:28:22 -0500
> there is nary a mention of what to do when the compiler making the
> message is counting characters (TAB=1) and emacs is thinking it is
> counting columns (TAB=8, etc.).

There's compilation-error-screen-columns, but it can't be set only for
a specific compilation-error-regexp-alist entry.  OTOH in Emacs-24, you
can set it buffer-locally in the target buffer (i.e. in your
TaiwanAMFMSW.xq file).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10258; Package emacs. (Wed, 14 Dec 2011 14:11:02 GMT) Full text and rfc822 format available.

Message #11 received at 10258 <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: 10258 <at> debbugs.gnu.org
Subject: Re: bug#10258: compilation-error-regexp-alist just assumes columns
	not characters
Date: Wed, 14 Dec 2011 22:09:02 +0800
>>>>> "SM" == Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
SM> There's compilation-error-screen-columns, but it can't be set only for
SM> a specific compilation-error-regexp-alist entry.
Well do consider that enhancement. In the meantime I discovered this works:

(setq compilation-error-screen-columns t);default, set once more for good luck.
(make-variable-buffer-local 'compilation-error-screen-columns)
(add-hook 'xquery-mode-hook
	  (function (lambda ()
		      (setq compilation-error-screen-columns nil))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10258; Package emacs. (Fri, 16 Dec 2011 00:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 10258 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: jidanni <at> jidanni.org
Cc: 10258 <at> debbugs.gnu.org
Subject: Re: bug#10258: compilation-error-regexp-alist just assumes columns
	not characters
Date: Thu, 15 Dec 2011 19:06:13 -0500
> (setq compilation-error-screen-columns t);default, set once more for good luck.
> (make-variable-buffer-local 'compilation-error-screen-columns)
> (add-hook 'xquery-mode-hook
> 	  (function (lambda ()
> 		      (setq compilation-error-screen-columns nil))))

Better not call make-variable-buffer-local except on variables you have
defined yourself (e.g. in this case only do it in compile.el).
I.e. use

 (add-hook 'xquery-mode-hook
 	  (lambda ()
 	    (set (make-local-variable 'compilation-error-screen-columns) nil)))


-- Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10258; Package emacs. (Thu, 22 Dec 2011 01:50:01 GMT) Full text and rfc822 format available.

Message #17 received at 10258 <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: monnier <at> iro.umontreal.ca
Cc: 10258 <at> debbugs.gnu.org
Subject: Re: bug#10258: compilation-error-regexp-alist just assumes columns
	not characters
Date: Thu, 22 Dec 2011 07:59:01 +0800
>>>>> "SM" == Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
SM> Better not call make-variable-buffer-local except...
OK thanks. Maybe
(info "(emacs) Locals")
more precisely,
(Info-menu "Emacs (emacs-snapshot)" nil)
(Info-index "make-variable-buffer-local")
should warn/hint about that, just like
(describe-function (quote make-variable-buffer-local))
already does.




Reply sent to Stefan Monnier <monnier <at> IRO.UMontreal.CA>:
You have taken responsibility. (Wed, 28 Dec 2011 10:22:02 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Wed, 28 Dec 2011 10:22:03 GMT) Full text and rfc822 format available.

Message #22 received at 10258-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: jidanni <at> jidanni.org
Cc: 10258-done <at> debbugs.gnu.org
Subject: Re: bug#10258: compilation-error-regexp-alist just assumes columns
	not characters
Date: Tue, 27 Dec 2011 18:49:07 -0500
SM> Better not call make-variable-buffer-local except...
> OK thanks. Maybe
> (info "(emacs) Locals")
> more precisely,
> (Info-menu "Emacs (emacs-snapshot)" nil)
> (Info-index "make-variable-buffer-local")
> should warn/hint about that, just like
> (describe-function (quote make-variable-buffer-local))
> already does.

Indeed.  I've installed the patch below,


        Stefan


=== modified file 'doc/lispref/variables.texi'
--- doc/lispref/variables.texi	2011-12-23 13:14:12 +0000
+++ doc/lispref/variables.texi	2011-12-27 23:42:22 +0000
@@ -1352,6 +1352,8 @@
 This function marks @var{variable} (a symbol) automatically
 buffer-local, so that any subsequent attempt to set it will make it
 local to the current buffer at the time.
+Contrary to @code{make-local-variable} with which it is often confused, this
+cannot be undone, and affects the behavior of the variable in all buffers.
 
 A peculiar wrinkle of this feature is that binding the variable (with
 @code{let} or other binding constructs) does not create a buffer-local





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Jan 2012 12:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.