unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22270: Indentation following a multi-line Java annotation not correct
@ 2015-12-30  0:56 Lanning
  2020-12-03 10:39 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Lanning @ 2015-12-30  0:56 UTC (permalink / raw)
  To: 22270

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

In the file cc-engine the function c-guess-basic-syntax doesn't
always properly handle indentation after a Java annotation.
In the case where the annotation spans multiple lines, the
following code in indented to be in-line with the last line
of the annotation:

    @AnAnnotation(param1=1,
                  param2=2)
                  public void run() {
    }

The problem is in the CASE 5N clause, where the code calls
    (c-add-syntax 'annotation-top-cont (c-point 'boi))
Instead of moving to the previous line, it should move to the
beginning of the annotation
    (prog1
        (c-add-syntax 'annotation-top-cont (progn
(c-beginning-of-statement-1) (point)))
      (goto-char placeholder))


In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6)
 of 2015-09-17 on lgw01-52, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11702000
System Description: Ubuntu 15.10

Configured using:
 `configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  recentf-mode: t
  global-edit-server-edit-mode: t
  which-function-mode: t
  global-whitespace-mode: t
  global-srecode-minor-mode: t
  global-ede-mode: t
  diff-auto-refine-mode: t
  global-semantic-idle-completions-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-summary-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  global-semanticdb-minor-mode: t
  semantic-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Undo!
Auto-saving...done
Quit
Saving file
/home/slanning/Templates/java-library/src/main/java/com/netflix/Foo.java...
Wrote
/home/slanning/Templates/java-library/src/main/java/com/netflix/Foo.java
Mark set [4 times]
Saving file
/home/slanning/Templates/java-library/src/main/java/com/netflix/Foo.java...
Wrote
/home/slanning/Templates/java-library/src/main/java/com/netflix/Foo.java
Composing main Info directory...done
Mark saved where search started [2 times]

Load-path shadows:
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-cycle hides
/usr/share/emacs24/site-lisp/ecb/ecb-cycle
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-upgrade hides
/usr/share/emacs24/site-lisp/ecb/ecb-upgrade
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-help hides
/usr/share/emacs24/site-lisp/ecb/ecb-help
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-file-browser hides
/usr/share/emacs24/site-lisp/ecb/ecb-file-browser
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-semantic-wrapper hides
/usr/share/emacs24/site-lisp/ecb/ecb-semantic-wrapper
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-eshell hides
/usr/share/emacs24/site-lisp/ecb/ecb-eshell
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-layout-defs hides
/usr/share/emacs24/site-lisp/ecb/ecb-layout-defs
/home/slanning/.emacs.d/elpa/ecb-20140215.114/tree-buffer hides
/usr/share/emacs24/site-lisp/ecb/tree-buffer
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-face hides
/usr/share/emacs24/site-lisp/ecb/ecb-face
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-jde hides
/usr/share/emacs24/site-lisp/ecb/ecb-jde
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-examples hides
/usr/share/emacs24/site-lisp/ecb/ecb-examples
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-autogen hides
/usr/share/emacs24/site-lisp/ecb/ecb-autogen
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-util hides
/usr/share/emacs24/site-lisp/ecb/ecb-util
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-semantic hides
/usr/share/emacs24/site-lisp/ecb/ecb-semantic
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-create-layout hides
/usr/share/emacs24/site-lisp/ecb/ecb-create-layout
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-tod hides
/usr/share/emacs24/site-lisp/ecb/ecb-tod
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-common-browser hides
/usr/share/emacs24/site-lisp/ecb/ecb-common-browser
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-compilation hides
/usr/share/emacs24/site-lisp/ecb/ecb-compilation
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-navigate hides
/usr/share/emacs24/site-lisp/ecb/ecb-navigate
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-layout hides
/usr/share/emacs24/site-lisp/ecb/ecb-layout
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-advice-test hides
/usr/share/emacs24/site-lisp/ecb/ecb-advice-test
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-symboldef hides
/usr/share/emacs24/site-lisp/ecb/ecb-symboldef
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-method-browser hides
/usr/share/emacs24/site-lisp/ecb/ecb-method-browser
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-compatibility hides
/usr/share/emacs24/site-lisp/ecb/ecb-compatibility
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb hides
/usr/share/emacs24/site-lisp/ecb/ecb
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-mode-line hides
/usr/share/emacs24/site-lisp/ecb/ecb-mode-line
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-speedbar hides
/usr/share/emacs24/site-lisp/ecb/ecb-speedbar
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-buffertab hides
/usr/share/emacs24/site-lisp/ecb/ecb-buffertab
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-winman-support hides
/usr/share/emacs24/site-lisp/ecb/ecb-winman-support
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-autoloads hides
/usr/share/emacs24/site-lisp/ecb/ecb-autoloads
/home/slanning/.emacs.d/elpa/ecb-20140215.114/silentcomp hides
/usr/share/emacs24/site-lisp/ecb/silentcomp
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-multiframe hides
/usr/share/emacs24/site-lisp/ecb/ecb-multiframe
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-analyse hides
/usr/share/emacs24/site-lisp/ecb/ecb-analyse
/home/slanning/.emacs.d/elpa/ecb-20140215.114/ecb-cedet-wrapper hides
/usr/share/emacs24/site-lisp/ecb/ecb-cedet-wrapper
/usr/share/emacs/24.5/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs24/site-lisp/flim/md4 hides /usr/share/emacs/24.5/lisp/md4
/usr/share/emacs24/site-lisp/flim/hex-util hides
/usr/share/emacs/24.5/lisp/hex-util
/usr/share/emacs24/site-lisp/flim/sasl hides
/usr/share/emacs/24.5/lisp/net/sasl
/usr/share/emacs24/site-lisp/flim/ntlm hides
/usr/share/emacs/24.5/lisp/net/ntlm
/usr/share/emacs24/site-lisp/flim/hmac-def hides
/usr/share/emacs/24.5/lisp/net/hmac-def
/usr/share/emacs24/site-lisp/flim/sasl-ntlm hides
/usr/share/emacs/24.5/lisp/net/sasl-ntlm
/usr/share/emacs24/site-lisp/flim/sasl-digest hides
/usr/share/emacs/24.5/lisp/net/sasl-digest
/usr/share/emacs24/site-lisp/flim/hmac-md5 hides
/usr/share/emacs/24.5/lisp/net/hmac-md5
/usr/share/emacs24/site-lisp/flim/sasl-cram hides
/usr/share/emacs/24.5/lisp/net/sasl-cram

Features:
(shadow sort mail-extr warnings mule-util time-stamp copyright tabify
emacsbug sendmail semantic/ia semantic/analyze/refs semantic/edit
jka-compr grep misearch multi-isearch ede/dired ede/emacs
semantic/analyze/complete semantic/db-typecache semantic/complete
eieio-opt find-func semantic/decorate/mode pp descr-text help-mode
vc-git ede/cpp-root semantic/dep semantic/tag-file
semantic/wisent/java-tags semantic/wisent/javat-wy jdee-prj-common
gradle crm ggtags ewoc cc-langs flymake my-init my-init-display
smL-theme init-display frame-cmds frame-fns avoid disp-table recentf
edit-server org-install tramp tramp-compat auth-source gnus-util
password-cache tramp-loaddefs trampver which-func cpp my-init-java
auto-complete-config auto-complete popup semantic/db-global
semantic/symref/global semantic/symref inversion cedet-global whitespace
decompile jdee-checkstyle jdee-javadoc working jdee-javadoc-gen
srecode/mode srecode/insert srecode/filters srecode/args srecode/find
srecode/map srecode/ctxt srecode/compile srecode/dictionary
srecode/table srecode ede/speedbar ede/files ede ede/base ede/auto
ede/source eieio-speedbar eieio-custom server init-netflix skeleton
init-gradle init-git magit-bisect magit-key-mode magit diff-mode
log-edit message rfc822 mml mml-sec mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mailabbrev gmm-utils mailheader pcvs-util add-log init-calc
init-online-help init-shell init-perl init-jdee jdee-patches
init-jdee-gen init-jdee-formatting init-jdibug jdibug jdibug-menu
jdibug-run jdibug-ui jdibug-expr semantic/wisent semantic/wisent/wisent
jdibug-java-expr-wy jdi jdwp jdibug-util bindat tree-mode elog
jdee-refactor dired-aux dired-x dired jdee-xref jdee derived jdee-wiz
jdee-project-file jdee-jdk-manager cl-macs jdee-jdb jdee-java-grammar
jdee-which-method jdee-font-lock jdee-help jdee-gen tempo jdee-custom
jdee-compile jdee-class jdee-file-util jdee-parse-class jdee-bsh
jdee-plugins jdee-parse-expr jdee-bug jdee-run jdee-dbs jdee-dbo
jdee-widgets tree-widget jdee-db jdee-open-source semantic/senator
semantic/decorate pulse jdee-util arc-mode archive-mode jdee-import
jdee-complete semantic/idle jdee-parse rx jdee-imenu semantic/imenu
semantic/sb imenu semantic/db-file data-debug cedet-files semantic/java
semantic/doc etags avl-tree jdee-annotations efc cus-edit cus-start
cus-load cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine beanshell init-c init-sendmail feedmail mail-utils init-vm
vcard vm-vcard vm-menu ps-print ps-def lpr vm-save vm-ps-print
vm-autoload vm-autoloads vm-version vm-vars init-print init-hotlink
init-unix cl package epg-config time w3m-load scala-mode-auto 50magit
go-mode-autoloads ido ess-toolbar ess-mouse mouseme browse-url ess-menu
ess-swv ess-noweb ess-noweb-font-lock-mode ess-bugs-l essd-els ess-sas-d
ess-sas-l ess-sas-a shell pcomplete ess-sta-d ess-sta-l cc-vars cc-defs
make-regexp ess-sp6-d ess-sp3-d ess-julia ess-r-d ess-r-completion
ess-tracebug format-spec ess-roxy ess-help ess-developer eldoc ess-s-l
ess ess-inf ess-mode ess-noweb-mode ess-utils ess-custom executable
ess-compat ess-site erlang-start jabber-autoloads emacs-goodies-el
emacs-goodies-custom emacs-goodies-loaddefs easy-mmode ecb edmacro
kmacro ecb-symboldef ecb-analyse ecb-compatibility ecb-winman-support
ecb-autogen autoload lisp-mnt ecb-tod ecb-cycle ecb-eshell ecb-help
ecb-jde ecb-method-browser hideshow ecb-semantic-wrapper ecb-semantic
ecb-file-browser ecb-speedbar ecb-layout compile comint ansi-color
ecb-create-layout advice help-fns ecb-compilation ecb-common-browser
speedbar sb-image dframe ecb-navigate ecb-mode-line ecb-face tree-buffer
ecb-upgrade ecb-cedet-wrapper semantic/db-mode semantic/db-find
semantic/db-ref semantic/analyze semantic/sort semantic/scope
semantic/analyze/fcn semantic/db gv eieio-base semantic/format ezimage
semantic/tag-ls semantic/find semantic/ctxt semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw eieio
byte-opt bytecomp byte-compile cl-extra cconv eieio-core mode-local
cedet wid-edit cl-loaddefs cl-lib ecb-util ring thingatpt info easymenu
dash-functional dash time-date tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 641400 27229)
 (symbols 48 69349 0)
 (miscs 40 558 837)
 (strings 32 237970 18648)
 (string-bytes 1 5062882)
 (vectors 16 55372)
 (vector-slots 8 880056 25901)
 (floats 8 508 640)
 (intervals 56 6431 37)
 (buffers 960 29)
 (heap 1024 64333 2328))

[-- Attachment #2: Type: text/html, Size: 15777 bytes --]

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

* bug#22270: Indentation following a multi-line Java annotation not correct
  2015-12-30  0:56 bug#22270: Indentation following a multi-line Java annotation not correct Lanning
@ 2020-12-03 10:39 ` Lars Ingebrigtsen
  2021-02-01 20:48   ` Alan Mackenzie
       [not found]   ` <YBhpN0RF1tqkiLCL@ACM>
  0 siblings, 2 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-03 10:39 UTC (permalink / raw)
  To: Lanning; +Cc: 22270, Alan Mackenzie

Lanning <lanning@gmail.com> writes:

> In the file cc-engine the function c-guess-basic-syntax doesn't
> always properly handle indentation after a Java annotation.
> In the case where the annotation spans multiple lines, the
> following code in indented to be in-line with the last line
> of the annotation:
>
>     @AnAnnotation(param1=1,
>                   param2=2)
>                   public void run() {
>     }
>
> The problem is in the CASE 5N clause, where the code calls
>     (c-add-syntax 'annotation-top-cont (c-point 'boi))
> Instead of moving to the previous line, it should move to the
> beginning of the annotation
>     (prog1
>         (c-add-syntax 'annotation-top-cont (progn (c-beginning-of-statement-1)
> (point)))
>       (goto-char placeholder))

Emacs 28 behaves the same way, and that does seem to be the wrong
indentation.

Alan?

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





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

* bug#22270: Indentation following a multi-line Java annotation not correct
  2020-12-03 10:39 ` Lars Ingebrigtsen
@ 2021-02-01 20:48   ` Alan Mackenzie
       [not found]   ` <YBhpN0RF1tqkiLCL@ACM>
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2021-02-01 20:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22270, Lanning

Hello, Lars.

On Thu, Dec 03, 2020 at 11:39:23 +0100, Lars Ingebrigtsen wrote:
> Lanning <lanning@gmail.com> writes:

> > In the file cc-engine the function c-guess-basic-syntax doesn't
> > always properly handle indentation after a Java annotation.
> > In the case where the annotation spans multiple lines, the
> > following code in indented to be in-line with the last line
> > of the annotation:

> >     @AnAnnotation(param1=1,
> >                   param2=2)
> >                   public void run() {
> >     }

> > The problem is in the CASE 5N clause, where the code calls
> >     (c-add-syntax 'annotation-top-cont (c-point 'boi))
> > Instead of moving to the previous line, it should move to the
> > beginning of the annotation
> >     (prog1
> >         (c-add-syntax 'annotation-top-cont (progn (c-beginning-of-statement-1)
> > (point)))
> >       (goto-char placeholder))

> Emacs 28 behaves the same way, and that does seem to be the wrong
> indentation.

> Alan?

I think this has already been fixed, quite recently, indeed as a
minor supporting part of 

    commit 92c56300c317c9e5573dca787a2cf20f777b3179
    Author: Alan Mackenzie <acm@muc.de>
    Date:   Tue Dec 15 12:09:47 2020 +0000

        CC Mode: Optimize for scrolling large buffers containing few braces

The fix had been in standalone CC Mode for a few years, but somehow
evaded getting merged to savannah.  The above commit hit merge conflicts
around the area, and adding in the fix to the Java annotations fixed
those conflicts at the same time.

So, could I ask you to try out the bug scenario again, notice that it is
now fixed, and close the bug.

Thanks!

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

-- 
Alan Mackenzie (Nuremberg, Germany).





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

* bug#22270: Indentation following a multi-line Java annotation not correct
       [not found]   ` <YBhpN0RF1tqkiLCL@ACM>
@ 2021-02-02  8:53     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-02  8:53 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: 22270, Lanning

Alan Mackenzie <acm@muc.de> writes:

> So, could I ask you to try out the bug scenario again, notice that it is
> now fixed, and close the bug.

Yup; works fine for me now, so I'm closing the bug report.

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





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

end of thread, other threads:[~2021-02-02  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30  0:56 bug#22270: Indentation following a multi-line Java annotation not correct Lanning
2020-12-03 10:39 ` Lars Ingebrigtsen
2021-02-01 20:48   ` Alan Mackenzie
     [not found]   ` <YBhpN0RF1tqkiLCL@ACM>
2021-02-02  8:53     ` Lars Ingebrigtsen

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).