GNU bug report logs - #43951
26.3; Java-mode annotation indentation

Previous Next

Package: emacs;

Reported by: johol <at> lysator.liu.se

Date: Mon, 12 Oct 2020 12:29:01 UTC

Severity: normal

Found in version 26.3

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 43951 in the body.
You can then email your comments to 43951 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#43951; Package emacs. (Mon, 12 Oct 2020 12:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to johol <at> lysator.liu.se:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 12 Oct 2020 12:29:01 GMT) Full text and rfc822 format available.

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

From: johol <at> lysator.liu.se
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; Java-mode annotation indentation
Date: Mon, 12 Oct 2020 12:28:24 +0000
Java source examples

Wrong indentation:
public class Foo
{
  @Foo(a=true,
       b=false)
       boolean foo = false;
}


Correct indentation with proposed fix below (as found on
https://github.com/jdee-emacs/jdee/issues/5
comment made by oldButNotWise on Dec 22, 2015)

public class Foo
{
  @Foo(a=true,
       b=false)
  boolean foo = false;
}


Proposed fix:
	 ;;CASE 5N: We are at a topmost continuation line and the only
	 ;;preceding items are annotations.
	 ((and (c-major-mode-is 'java-mode)
	       (setq placeholder (point))
	       (c-beginning-of-statement-1)
	       (progn
		 (while (and (c-forward-annotation))
		   (c-forward-syntactic-ws))
		 t)
	       (prog1
		   (>= (point) placeholder)
		 (goto-char placeholder)))
          ;; (c-add-syntax 'annotation-top-cont (c-point 'boi))
          (prog1
              (c-add-syntax 'annotation-top-cont
                            (progn (c-beginning-of-statement-1)
                                   (point)))
            (goto-char placeholder))
          )


In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
 of 2019-08-29 built on CIRROCUMULUS
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor 'Microsoft Corp.', version 10.0.17134
Recent messages:
Undo! [21 times]
Redo!
Mark saved where search started [2 times]
Mark set [3 times]
c-guess-basic-syntax
You can run the command ‘eval-last-sexp’ with C-x C-e
c-guess-basic-syntax
Making completion list...
delete-backward-char: Text is read-only
Making completion list...

Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS THREADS LCMS2

Important settings:
  value of $LANG: SVE
  locale-coding-system: cp1252

Major mode: Java//l

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  show-paren-mode: t
  global-whitespace-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
derived epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mail-utils cc-langs thingatpt dired dired-loaddefs
ruler-mode hl-line hexl sh-script smie executable cl-print debug
cl-extra eieio-opt speedbar sb-image ezimage dframe find-func help-fns
radix-tree rect help-mode misearch multi-isearch face-remap python
tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell
pcomplete parse-time format-spec advice json map comint ring ansi-color
dabbrev vc-git diff-mode easy-mmode cc-mode cc-fonts cc-guess cc-menus
cc-cmds elec-pair mm-util mail-prsvr paren whitespace
display-line-numbers cus-start cus-load cc-styles cc-align cc-engine
cc-vars cc-defs edmacro kmacro finder-inf package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 766749 159606)
 (symbols 48 32289 5)
 (miscs 40 1146 6875)
 (strings 32 65510 4209)
 (string-bytes 1 1983504)
 (vectors 16 54667)
 (vector-slots 8 1662698 151554)
 (floats 8 95 539)
 (intervals 56 88414 1458)
 (buffers 992 95))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Mon, 12 Oct 2020 13:13:02 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: johol <at> lysator.liu.se
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Mon, 12 Oct 2020 18:41:58 +0530
This issues occurs in ‘master’ branch as well.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Wed, 27 Jan 2021 05:35:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: johol <at> lysator.liu.se
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Wed, 27 Jan 2021 06:34:34 +0100
johol <at> lysator.liu.se writes:

> Java source examples
>
> Wrong indentation:
> public class Foo
> {
>   @Foo(a=true,
>        b=false)
>        boolean foo = false;
> }
>
> Correct indentation with proposed fix below (as found on
> https://github.com/jdee-emacs/jdee/issues/5
> comment made by oldButNotWise on Dec 22, 2015)
>
> public class Foo
> {
>   @Foo(a=true,
>        b=false)
>   boolean foo = false;
> }

I can reproduce this in Emacs 27.1, but not in Emacs 28, so I'm going to
go ahead and guess that this has been fixed recently, and I'm closing
this bug report.  If you can still see this in Emacs 28, please respond
to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 43951 <at> debbugs.gnu.org and johol <at> lysator.liu.se Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 27 Jan 2021 05:35:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Wed, 27 Jan 2021 17:09:02 GMT) Full text and rfc822 format available.

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

From: John Olsson <johol <at> lysator.liu.se>
To: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951 acknowledged by developer (control message for bug
 #43951)
Date: Wed, 27 Jan 2021 18:08:51 +0100
Hi!

When I move point to the beginning of the line containing “@Foo” and press TAB I get the error message 
Wrong type argument: integer-or-marker-p, t

I get the same error if I press C-c C-o anywhere on that line. Also when moving to initial left brace of class as well as anywhere on the line containing the Boolean variable “foo”. But *not* on the line containing “b=false”...

> On 27 Jan 2021, at 06:36, help-debbugs <at> gnu.org wrote:
> 
> This is an automatic notification regarding your bug report
> #43951: 26.3; Java-mode annotation indentation,
> which was filed against the emacs package.
> 
> Thank you for your report, which has now been closed.
> You can view the full report at
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43951
> 
> If you require further information, please followup to 43951 <at> debbugs.gnu.org.
> 
> debbugs.gnu.org maintainers
> (administrator, GNU bugs database)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Wed, 27 Jan 2021 17:13:01 GMT) Full text and rfc822 format available.

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

From: John Olsson <johol <at> lysator.liu.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Wed, 27 Jan 2021 18:12:30 +0100
Sorry for spamming. :(

I used GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-01-15

> On 27 Jan 2021, at 06:35, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> johol <at> lysator.liu.se writes:
> 
>> Java source examples
>> 
>> Wrong indentation:
>> public class Foo
>> {
>>  @Foo(a=true,
>>       b=false)
>>       boolean foo = false;
>> }
>> 
>> Correct indentation with proposed fix below (as found on
>> https://github.com/jdee-emacs/jdee/issues/5
>> comment made by oldButNotWise on Dec 22, 2015)
>> 
>> public class Foo
>> {
>>  @Foo(a=true,
>>       b=false)
>>  boolean foo = false;
>> }
> 
> I can reproduce this in Emacs 27.1, but not in Emacs 28, so I'm going to
> go ahead and guess that this has been fixed recently, and I'm closing
> this bug report.  If you can still see this in Emacs 28, please respond
> to the debbugs address and we'll reopen.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 03:33:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: John Olsson <johol <at> lysator.liu.se>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 04:31:56 +0100
John Olsson <johol <at> lysator.liu.se> writes:

> Sorry for spamming. :(
>
> I used GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-01-15

[...]

>> I can reproduce this in Emacs 27.1, but not in Emacs 28, so I'm going to
>> go ahead and guess that this has been fixed recently, and I'm closing
>> this bug report.  If you can still see this in Emacs 28, please respond
>> to the debbugs address and we'll reopen.

Sorry; I don't quite follow -- are you still seeing this issue, or does
the indentation in the example work as expected for you in Emacs 28?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 05:01:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: John Olsson <johol <at> lysator.liu.se>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: acknowledged by developer (control message for bug
 #43951)
Date: Thu, 28 Jan 2021 06:00:08 +0100
John Olsson <johol <at> lysator.liu.se> writes:

> When I move point to the beginning of the line containing “@Foo” and
> press TAB I get the error message
> Wrong type argument: integer-or-marker-p, t

I'm unable to reproduce this in Emacs 28.  Is this with "emacs -Q"?

> I get the same error if I press C-c C-o anywhere on that line. Also
> when moving to initial left brace of class as well as anywhere on the
> line containing the Boolean variable “foo”. But *not* on the line
> containing “b=false”...

What's `C-c C-o' bound to for you?  Mine is:

C-c C-o runs the command c-set-offset (found in java-mode-map), which
is an autoloaded interactive compiled Lisp function in ‘cc-styles.el’.

and doesn't signal any errors.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 05:22:02 GMT) Full text and rfc822 format available.

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

From: John Olsson <johol <at> lysator.liu.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 06:21:49 +0100
I can’t indent some lines (marked with “<=“ at the end of the line)

public class Foo
{ <=
@Foo(a=true <=
b=false)
boolean foo = false; <=
} <=

When I try I get the error message 

Wrong type argument: integer-or-marker-p, t

in the mini-buffer. It is almost the inverse problem, the line I previously got wrong indentation on indents correctly, but almost all other lines fails to indent at all...

Something fishy is going on here.

> On 28 Jan 2021, at 04:32, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> John Olsson <johol <at> lysator.liu.se> writes:
> 
>> Sorry for spamming. :(
>> I used GNU Emacs 28.0.50 (build 1, x86_64-w64-mingw32) of 2021-01-15
> 
> [...]
> 
>>> I can reproduce this in Emacs 27.1, but not in Emacs 28, so I'm going to
>>> go ahead and guess that this has been fixed recently, and I'm closing
>>> this bug report.  If you can still see this in Emacs 28, please respond
>>> to the debbugs address and we'll reopen.
> 
> Sorry; I don't quite follow -- are you still seeing this issue, or does
> the indentation in the example work as expected for you in Emacs 28?
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 05:28:02 GMT) Full text and rfc822 format available.

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

From: John Olsson <johol <at> lysator.liu.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: acknowledged by developer (control message for bug
 #43951)
Date: Thu, 28 Jan 2021 06:27:49 +0100
I just realized I did not try this when using -Q flag. I’ll do that and get back to you.

Regardless, something has happened between Emacs 26 and 28 since my .emacs file is almost trivial. It works in Emacs 26. But if there is something there I’ll try to pin-point it.

> On 28 Jan 2021, at 06:00, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> John Olsson <johol <at> lysator.liu.se> writes:
> 
>> When I move point to the beginning of the line containing “@Foo” and
>> press TAB I get the error message
>> Wrong type argument: integer-or-marker-p, t
> 
> I'm unable to reproduce this in Emacs 28.  Is this with "emacs -Q"?
> 
>> I get the same error if I press C-c C-o anywhere on that line. Also
>> when moving to initial left brace of class as well as anywhere on the
>> line containing the Boolean variable “foo”. But *not* on the line
>> containing “b=false”...
> 
> What's `C-c C-o' bound to for you?  Mine is:
> 
> C-c C-o runs the command c-set-offset (found in java-mode-map), which
> is an autoloaded interactive compiled Lisp function in ‘cc-styles.el’.
> 
> and doesn't signal any errors.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 05:53:02 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: John Olsson <johol <at> lysator.liu.se>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 11:22:27 +0530
John Olsson <johol <at> lysator.liu.se> writes:

> I can’t indent some lines (marked with “<=“ at the end of the line)
>
> public class Foo
> { <=
> @Foo(a=true <=
> b=false)
> boolean foo = false; <=
> } <=
>
> When I try I get the error message 
>
> Wrong type argument: integer-or-marker-p, t
>
> in the mini-buffer. It is almost the inverse problem, the line I
> previously got wrong indentation on indents correctly, but almost all
> other lines fails to indent at all...

The above snippet is perfectly indented on my latest build (today). I
suspect some customisation in your init.

Could you please try again after (setq debug-on-error t)?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 07:12:01 GMT) Full text and rfc822 format available.

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

From: John Olsson <johol <at> lysator.liu.se>
To: Pankaj Jangid <pankaj <at> codeisgreat.org>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 08:11:31 +0100
I can now confirm that it was indeed my init file that caused the problems I described.

The cause of the problem was that I missed that I loaded a file (without any guard checking Emacs version!) that fixed the behavior in Emacs 26 and that fix was not compatible with Emacs 28... *sigh*

You can close this bug! :D

> On 28 Jan 2021, at 06:52, Pankaj Jangid <pankaj <at> codeisgreat.org> wrote:
> 
> John Olsson <johol <at> lysator.liu.se> writes:
> 
>> I can’t indent some lines (marked with “<=“ at the end of the line)
>> 
>> public class Foo
>> { <=
>> @Foo(a=true <=
>> b=false)
>> boolean foo = false; <=
>> } <=
>> 
>> When I try I get the error message 
>> 
>> Wrong type argument: integer-or-marker-p, t
>> 
>> in the mini-buffer. It is almost the inverse problem, the line I
>> previously got wrong indentation on indents correctly, but almost all
>> other lines fails to indent at all...
> 
> The above snippet is perfectly indented on my latest build (today). I
> suspect some customisation in your init.
> 
> Could you please try again after (setq debug-on-error t)?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 07:26:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: John Olsson <johol <at> lysator.liu.se>
Cc: Pankaj Jangid <pankaj <at> codeisgreat.org>, 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 08:25:16 +0100
John Olsson <johol <at> lysator.liu.se> writes:

> The cause of the problem was that I missed that I loaded a file
> (without any guard checking Emacs version!) that fixed the behavior in
> Emacs 26 and that fix was not compatible with Emacs 28... *sigh*

:-)

> You can close this bug! :D

Thanks for checking; closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#43951; Package emacs. (Thu, 28 Jan 2021 07:57:02 GMT) Full text and rfc822 format available.

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

From: Pankaj Jangid <pankaj <at> codeisgreat.org>
To: John Olsson <johol <at> lysator.liu.se>
Cc: 43951 <at> debbugs.gnu.org
Subject: Re: bug#43951: 26.3; Java-mode annotation indentation
Date: Thu, 28 Jan 2021 13:26:27 +0530
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> John Olsson <johol <at> lysator.liu.se> writes:
>
>> The cause of the problem was that I missed that I loaded a file
>> (without any guard checking Emacs version!) that fixed the behavior in
>> Emacs 26 and that fix was not compatible with Emacs 28... *sigh*
>
> :-)
>
>> You can close this bug! :D
>
> Thanks for checking; closing.

Just for info:

John, you can also close a bug that you have created. Just by sending an
email to nnnn-done <at> debbugs.gnu.org, which in this case is
43951-done <at> debbugs.gnu.org. You can send with any subject and body.




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

This bug report was last modified 3 years and 32 days ago.

Previous Next


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