Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!mips!sgi!dragon!dblues.wpd.sgi.com!jackr From: jackr@dblues.wpd.sgi.com (John Repenning) Newsgroups: comp.emacs Subject: Re: C++-mode and abbrevs Message-ID: <1990Dec3.174255.4742@relay.wpd.sgi.com> Date: 3 Dec 90 17:42:55 GMT References: Sender: news@relay.wpd.sgi.com ( CNews Account ) Reply-To: jackr@wpd.1.com Organization: Silicon Graphics, Inc. Lines: 70 In article , fuchs@it.uka.de (Harald Fuchs) writes: |> ... |> When I hit the ":" key, "pub" is correctly expanded to "public:", but |> it is not moved to the beginning of the line: |> |> class Foo { |> public: I had a similar problem in my c++ (with the same version info at the top as yours). I found it and fixed it - and yes, the change was simple. The problem also afflicts declaration of non-inline methods - for example: class Foo { public: int i(); } int Foo::i() { return 3; } Here, when you get to the first colon in ``Foo::i()'', the defective version shoves it in one space, rather than leaving it at the left edge. However, I haven't put many miles on the patch, yet (I only made it last Friday!). My experience with c-mode (on which this c++-mode is based) makes me a tad wary: if you apply this, you may find it breaks something else, either for you, or for someone else who likes their indentation different from what you (and I) like. If there were such a problem, it would (almost certainly) involve some other situation where a single word, beginning a line, got incorrect indentation. If you find such problems, I'd be interested in hearing them. But I can't promise I'll have time (or even expertise!) to fix them. But, at least backing out the change is as easy as applying it.... Here's the rcsdiff of the change. The change is in the defun for c++-indent-line, and the corrected version is at the bottom (``(max 0'', not ``(max 1''). Jack Repenning RCS file: RCS/c++-mode.el,v retrieving revision 1.1 diff -c -r1.1 c++-mode.el *** /tmp/,RCSt1a12615 Mon Dec 3 09:40:15 1990 --- c++-mode.el Mon Dec 3 09:39:26 1990 *************** *** 381,387 **** (save-excursion (forward-sexp 1) (looking-at ":[^:]")))) ! (setq indent (max 1 (+ indent c-label-offset)))) ((and (looking-at "else\\b") (not (looking-at "else\\s_"))) (setq indent (save-excursion --- 381,387 ---- (save-excursion (forward-sexp 1) (looking-at ":[^:]")))) ! (setq indent (max 0 (+ indent c-label-offset)))) ((and (looking-at "else\\b") (not (looking-at "else\\s_"))) (setq indent (save-excursion Brought to you by Super Global Mega Corp .com