🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #485

c++-mode.el

#485
From: Doug Schmidt
Date: Sat, 25 Mar 1989 23:15
87 lines
3088 bytes
Hi,

  The latest version of c++-mode from ./etc has several annoying quirks.

1. Regular C-style comments don't correctly align themselves automagically:
   Try:
   
  /* I am a comment,
    This is not
      what should
        be happening! */

   I don't believe that the earlier version got this wrong.

2. Also, formatting a class declaration does weird things to public
   and private, e.g.:        

----------------------------------------
class foo
{
private:
  int i;        
public:
  foo ();
};
----------------------------------------

turns into

----------------------------------------
class foo
{
 private:
  int i;        
 public:
  foo ();
};
----------------------------------------

Which is not as nice (IMHO).  I have a feeling that the reformatter
thinks public and private are labels, and treats them accordingly.  If
anyone knows a good fix I'd appreciate it!

3. Finally, so I won't be accused of only criticizing without contributing
   (;-)), here's a neat ``high-voltage'' addition that toggles 
   c-auto-newline mode on and off.  I find this especially useful
   when I'm writing new code (it can be annoying when maintaining
   code).

*** c++-mode.el.~1~	Thu Mar 23 18:17:51 1989
--- c++-mode.el	Sat Mar 25 15:14:04 1989
***************
*** 44,49 ****
--- 44,50 ----
  (define-key c++-mode-map "\e" 'mark-c-function)
  (define-key c++-mode-map "\eq" 'indent-c++-exp)
  (define-key c++-mode-map "\177" 'backward-delete-char-untabify)
+ (define-key c++-mode-map "\C-^" 'c++-high-voltage)
  (define-key c++-mode-map "\t" 'c++-indent-command)
  (define-key c++-mode-map "\C-c\C-i" 'c++-insert-header)
  (define-key c++-mode-map "\C-c\C-\\" 'c++-macroize-region)
***************
*** 151,156 ****
--- 152,164 ----
        (define-key c++-mode-map ":" 'electric-c++-terminator)))
  
  
+ ;;; "High-voltage" option
+ (defun c++-high-voltage ( ) "Toggle high voltage (c-auto-newline)"
+   (interactive)
+   (if c-auto-newline
+     (progn (setq c-auto-newline nil) (message "High voltage OFF"))
+     (progn (setq c-auto-newline t) (message "High voltage ON"))))
+ 
  ;; This is used by indent-for-comment
  ;; to decide how much to indent a comment in C++ code
  ;; based on its context.
               
----------------------------------------

Doug               

--
schmidt@ics.uci.edu | On a clear day, under blue skies, one need not seek
office:             | And asking about Buddha 
(714) 856-4043      | Is like proclaiming innocence,
                    | With loot in your pocket.
Technical Details
Message-ID: <10511@paris.ics.uci.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!peregrine!zardoz!uci-ics!zola.ics.uci.edu!schmidt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!peregrine!zardoz!uci-ics!zola.ics.uci.edu!schmidt
From: schmidt@zola.ics.uci.edu (Doug Schmidt)
Newsgroups: gnu.g++.lib.bug
Subject: c++-mode.el
Message-ID: <10511@paris.ics.uci.edu>
Date: 25 Mar 89 23:15:12 GMT
Sender: news@paris.ics.uci.edu
Reply-To: Doug Schmidt <schmidt@zola.ics.uci.edu>
Distribution: gnu
Organization: University of California at Irvine: ICS Dept.
Lines: 87