unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#738: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3
@ 2008-08-18 10:20 Jyrki Saarela
  2011-10-03 20:08 ` Glenn Morris
  0 siblings, 1 reply; 3+ messages in thread
From: Jyrki Saarela @ 2008-08-18 10:20 UTC (permalink / raw)
  To: bug-gnu-emacs

Automating indenting of c++ code is broken

In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)
 of 2008-03-26 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

likely in all versions. I tried to check from gnu.emacs.bug, but could
not find anything related. Feel free to blame google groups if this is
not a new bug.

There are 2 possibly separated things.

a) minor - if c-electric-flag is t then current line is re-indented
badly every time '(' is pressed within function body. This might be
even a feature - but very annoying one. It does work differently ( and
better ) in emacs 21.3. At least the indentation is corrected when ')'
is pressed.

b) major - at least last line of function where '}' is placed in
whitesmith style is indented incorrectly ( possibly other places too),
and indentation also depends on where you press <tab> key. If pressed
at left side of the '}' or on the '}' then indentation works
correctly. If c-electric-flag is t then the automatic indentation is
also incorrect. And yes, it does work in emacs 21.3.

To repro:

common:
1) see .emacs at bottom of this file
2) start up emacs. Visit a c++ file, eg ^X ^F foo.cpp<ret>

3a) to repro a), type "int main()<ret>{<ret>if("
result a:
int main()
    {
        if(

expected a:
int main()
    {
    if (


3b) to repro b) type "int main()<ret>{<ret>}"

result b:
int main()
    {
        }

expected b:
int main()
    {
    }

You can also start with

int main()
    {
    }<PRESS TAB HERE>

and press tab where indicated and end up with result b. But if you
start with result b

int main()
    {
        <PRESS TAB HERE>}

and press tab where indicated the indentation will be corrected.



-----------------------------------------------------------------------

(almost) Minimal .emacs required to reproduce:

;; ==========================
;; C/C++ indentation
;; ==========================
(defun my-c-mode-common-hook ()
  (c-set-style "whitesmith") )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

; if c-electric-flag is set, works even worse
;( setq-default c-electric-flag nil )
(setq-default indent-tabs-mode nil)

-- 
Jyrki







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

* bug#738: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3
  2008-08-18 10:20 bug#738: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3 Jyrki Saarela
@ 2011-10-03 20:08 ` Glenn Morris
  2015-12-29  4:57   ` Andrew Hyatt
  0 siblings, 1 reply; 3+ messages in thread
From: Glenn Morris @ 2011-10-03 20:08 UTC (permalink / raw)
  To: 738


Still present in 24.0.90.
(Partial?) duplicate of http://debbugs.gnu.org/cgi/bugreport.cgi?bug=523 ?





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

* bug#738: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3
  2011-10-03 20:08 ` Glenn Morris
@ 2015-12-29  4:57   ` Andrew Hyatt
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Hyatt @ 2015-12-29  4:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 738


I couldn't reproduce either bug in Emacs 25.  I'm closing this as
unreproducible, but please re-open if you can reproduce on Emacs 25.

Glenn Morris <rgm@gnu.org> writes:

> Still present in 24.0.90.
> (Partial?) duplicate of http://debbugs.gnu.org/cgi/bugreport.cgi?bug=523 ?





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

end of thread, other threads:[~2015-12-29  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-18 10:20 bug#738: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3 Jyrki Saarela
2011-10-03 20:08 ` Glenn Morris
2015-12-29  4:57   ` Andrew Hyatt

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