unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
@ 2014-08-28 10:31 Filipp Gunbin
  2014-08-28 13:22 ` Stefan Monnier
  2015-03-05 23:41 ` Filipp Gunbin
  0 siblings, 2 replies; 6+ messages in thread
From: Filipp Gunbin @ 2014-08-28 10:31 UTC (permalink / raw)
  To: 18342

In GNU Emacs 24.3.93.1 (x86_64-apple-darwin13.3.0)
Repository revision: 117453 eliz@gnu.org-20140819185629-52e2mzy5tucd0tic

When stepping through compilation errors `C-x `' jumps to a code
location with correct line, but incorrect column: it actually jumps to a
column previous to the right one.  Checked with emacs -Q and Java files
compilation.

Emacs is built from current emacs-24 bzr branch.

-- 

    Filipp





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

* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
  2014-08-28 10:31 bug#18342: 24.3.93; jumping to compilation error location gives the wrong column Filipp Gunbin
@ 2014-08-28 13:22 ` Stefan Monnier
  2015-03-05 23:41 ` Filipp Gunbin
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2014-08-28 13:22 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 18342

> When stepping through compilation errors `C-x `' jumps to a code
> location with correct line, but incorrect column: it actually jumps to a
> column previous to the right one.  Checked with emacs -Q and Java files
> compilation.

> Emacs is built from current emacs-24 bzr branch.

There are columns and columns.  So most likely the problem is that Emacs
doesn't know which columns the Java compiler uses.

Are these columns 0-based or 1-based?  Do they count characters, bytes,
or width?  (e.g. what does TAB count as? what about non-ASCII chars in
utf-8?)

These can partly be supported via compilation-first-column and
compilation-error-screen-columns (tho Emacs has no support for counting
columns in bytes).  Arguably, rather than variables, these settings
should be part of the compilation-error-regexp-alist entries since it
depends on the compiler in use.


        Stefan





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

* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
  2014-08-28 10:31 bug#18342: 24.3.93; jumping to compilation error location gives the wrong column Filipp Gunbin
  2014-08-28 13:22 ` Stefan Monnier
@ 2015-03-05 23:41 ` Filipp Gunbin
  2015-03-06  8:34   ` Eli Zaretskii
  2015-03-06 17:54   ` Stefan Monnier
  1 sibling, 2 replies; 6+ messages in thread
From: Filipp Gunbin @ 2015-03-05 23:41 UTC (permalink / raw)
  To: 18342

Ok, I fixed it by adding the following to the java-mode-hook:

(set (make-local-variable 'compilation-first-column) 0)

But the problem of the common (lack of?) knowledge between emacs and the
compiler continues to exist.

However, if we set aside the TAB problem (everywhere I worked nobody
used TAB in source code), there doesn't seem to be a big problem:

The column numbers emitted by the compiler most probably mean "screen
columns" - just where you made an error in the source file.  I don't
know of compilers which do differently (I usually work only with
Oracle's Java compiler so I'm not the best person to state that).

If emacs and the compiler agree on source file encoding (and they should
be tuned to agree), then emacs just needs to go that count of chars
forward from the beginning of line.  The only things that remains -
whether to start from 0 or from 1 - is already handled by looking at
`compilation-first-column'.

Regarding `compilation-error-regexp-alist', the
`compilation-first-column' probably could be there, but then it should
be something like `compilation-compiler-var-alist' instead :)

There are unclear cases e.g. with maven: what if we use Oracle JDK which
outputs columns beginning with 0 and then change to another JDK which
outputs beginning with 1?  Would maven correct it's output?  I doubt so.
Then we should have two items in the alist: maven-oracle and maven-smth.

It'd be good to mention `compilation-first-column' in the manual.

Filipp





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

* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
  2015-03-05 23:41 ` Filipp Gunbin
@ 2015-03-06  8:34   ` Eli Zaretskii
  2015-03-06 17:54   ` Stefan Monnier
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2015-03-06  8:34 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 18342

> From: Filipp Gunbin <fgunbin@fastmail.fm>
> Date: Fri, 06 Mar 2015 02:41:30 +0300
> 
> The column numbers emitted by the compiler most probably mean "screen
> columns" - just where you made an error in the source file.  I don't
> know of compilers which do differently (I usually work only with
> Oracle's Java compiler so I'm not the best person to state that).
> 
> If emacs and the compiler agree on source file encoding (and they should
> be tuned to agree), then emacs just needs to go that count of chars
> forward from the beginning of line.

Character counts don't depend on encoding.  Only byte counts depend on
encoding.

So I'm not sure what you are trying to say here.





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

* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
  2015-03-05 23:41 ` Filipp Gunbin
  2015-03-06  8:34   ` Eli Zaretskii
@ 2015-03-06 17:54   ` Stefan Monnier
  2015-03-11  0:19     ` Filipp Gunbin
  1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-03-06 17:54 UTC (permalink / raw)
  To: Filipp Gunbin; +Cc: 18342

> Regarding `compilation-error-regexp-alist', the
> `compilation-first-column' probably could be there, but then it should
> be something like `compilation-compiler-var-alist' instead :)

I tend to agree that the "first-column" info should probably be placed
alongside the regexp (same for compilation-error-screen-columns, BTW).

> There are unclear cases e.g. with maven: what if we use Oracle JDK which
> outputs columns beginning with 0 and then change to another JDK which
> outputs beginning with 1?  Would maven correct it's output?  I doubt so.
> Then we should have two items in the alist: maven-oracle and maven-smth.

Indeed, there are "hard" cases.  Luckily, column positions usually
aren't so terribly important, so being off by a few chars is annoying
but bearable.


        Stefan





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

* bug#18342: 24.3.93; jumping to compilation error location gives the wrong column
  2015-03-06 17:54   ` Stefan Monnier
@ 2015-03-11  0:19     ` Filipp Gunbin
  0 siblings, 0 replies; 6+ messages in thread
From: Filipp Gunbin @ 2015-03-11  0:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18342-done

On 06/03/2015 12:54 -0500, Stefan Monnier wrote:

>> Regarding `compilation-error-regexp-alist', the
>> `compilation-first-column' probably could be there, but then it should
>> be something like `compilation-compiler-var-alist' instead :)
>
> I tend to agree that the "first-column" info should probably be placed
> alongside the regexp (same for compilation-error-screen-columns, BTW).
>
>> There are unclear cases e.g. with maven: what if we use Oracle JDK which
>> outputs columns beginning with 0 and then change to another JDK which
>> outputs beginning with 1?  Would maven correct it's output?  I doubt so.
>> Then we should have two items in the alist: maven-oracle and maven-smth.
>
> Indeed, there are "hard" cases.  Luckily, column positions usually
> aren't so terribly important, so being off by a few chars is annoying
> but bearable.

It's even worse, as I've just discovered: we have a "checkstyle" plugin
for Maven which, yes, checks style.  And maven outputs its errors with
differently based column numbers (starting with one).  This and javac
invocation happens within one compilation, so it seems currently we have
no way of distinguishing between them and applying different settings.

Anyway, I'm closing this bug for now.

Filipp





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

end of thread, other threads:[~2015-03-11  0:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-28 10:31 bug#18342: 24.3.93; jumping to compilation error location gives the wrong column Filipp Gunbin
2014-08-28 13:22 ` Stefan Monnier
2015-03-05 23:41 ` Filipp Gunbin
2015-03-06  8:34   ` Eli Zaretskii
2015-03-06 17:54   ` Stefan Monnier
2015-03-11  0:19     ` Filipp Gunbin

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).