schmidt@zola.ics.uci.edu (Doug Schmidt) (03/26/89)
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.