Pablo Funes <pablo(a)icosystem.com>, you wrote:
21.5 indents java files wrongly, only in jde-mode. This problem has
been on 21.5 for a while, so it should be a known bug, but I have not
been able to find a discussion in any of the lists.
The problem happens with comments. Here's a sample file
/**
* Class Tmp
*
*/
public class Tmp {}
This is correctly indented; however, xemacs 21.5 only, and in JDE mode
only, indents this as:
/**
* Class Tmp
*
*/
public class Tmp {}
which is clearly wrong. How can this be fixed?
It's even worse now. It gets the second line wrong, and is not coloring
with the comment color. Try evaluating this in the *scratch* buffer
after loading JDE:
(make-syntax-table)
=> #s(char-table type syntax data ())
java-mode-syntax-table
=> #s(char-table type syntax data (?\n 262156 ?\r 262156 ?% 1 ?& 1 ?\' 7 ?*
2621441 ?+ 1 ?- 1 ?/ 13762561 ?< 1 ?= 1 ?> 1 ?\\ 9 ?_ 3 ?| 1))
(let ((my-syntax-table (make-syntax-table)))
(derived-mode-merge-syntax-tables java-mode-syntax-table my-syntax-table)
my-syntax-table)
=> #s(char-table type syntax data ())
There's the trouble; jde-mode-syntax-table didn't get the stuff from
java-mode-syntax-table merged into it. So why did the merge fail? In
derived-mode-merge-syntax-tables, we see this:
(map-char-table
#'(lambda (key value)
(if (eq ?@ (char-syntax-from-code value))
(map-char-table #'(lambda (key1 value1)
(put-char-table key1 value1 new))
old
key)))
new)
But try evaluating this in *scratch*:
(let ((keyval nil))
(map-char-table
#'(lambda (key value) (push (list key value) keyval))
(make-syntax-table))
keyval)
=> nil
It appears that map-char-table does NOTHING when handed an empty
char-table. Hence, derived-mode-merge-syntax-tables does nothing when
handed the empty jde-mode-syntax-table. The result is that
jde-mode-syntax-table has JDE's modifications, but to the standard
syntax table instead of to the Java syntax table.
I don't understand map-char-table (which is a C function). It looks
like Ben Wing has touched that file (chartab.c) a lot in the last couple
of years. Ben, do you know what might be going on with map-char-table?
--
Jerry James
http://www.ittc.ku.edu/~james/