Decorating code comments?

This is a discussion on Decorating code comments? within the C++ Programming forums, part of the General Programming Boards category; Hi all, Not sure if this is even a proper question for this board, but the emacs people just blew ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    271

    Decorating code comments?

    Hi all,

    Not sure if this is even a proper question for this board, but the emacs people just blew me off, so might as well give it a shot.

    Is there a plugin for emacs (I do know emacs has "M-x comment-box" but it's nasty ugly) or visual studio that decorates the comments at the head of a piece of C/C++ source code?

    Like this:
    Code:
    /***************************************/
    /* yada yada yada yada yada yada yada yada    */
    /* This is code written by X and don't it look     */
    /* pretty                                                               */
    /* It is protected under some license.                  */
    /***************************************/
    If anyone knows of a plugin or script or program that can automate tediously keying in asterisks and slashes, it would be appreciated.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Why not just do something like this:
    Code:
    ///////////////////////////////////////////////////////////////////////////
    // Some comment block
    // With some text
    // and another line
    // written by... 
    // and license restriction blurb
    ///////////////////////////////////////////////////////////////////////////
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >If anyone knows of a plugin or script or program that can automate
    >tediously keying in asterisks and slashes, it would be appreciated.
    If it's so much trouble that you need a tool, maybe you're doing too much decoration. Sure, it might save you a little time, but running the tool still wastes time for little or no gain. Just change your commenting style so that it's easier to maintain.
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    271
    matsp: Thanks, but what you suggested is very close to what "M-x comment-box" generates in emacs C/C++ mode.

    Obviously, it's not critical to the code, but I think asterisks are so much prettier. (and though the code box in the OP is all messed up, I hope what I intended shows).

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, you could always attempt to fix the M-x comment-box in Emacs, I guess? [And yes, it's broken on my XEmacs too]

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Registered Abuser
    Join Date
    Sep 2007
    Location
    USA/NJ/TRENTON
    Posts
    127
    i always just keep a bunch of stuff (like comment headings for source files) somewhere easily accessed on my 'puter so that i can copy and paste

    If this is for c++, couldn't you write a pretty simple program that allows you to enter your text, then auto-formats it for you to a .txt, then copy and paste that bad-boy?

  7. #7
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by cunnus88 View Post
    Is there a plugin for emacs (I do know emacs has "M-x comment-box" but it's nasty ugly) or visual studio that decorates the comments at the head of a piece of C/C++ source code?
    I use emacs and have never bothered to write a macro or script to do it. I just copy a pre-existing comment block and edit it.

  8. #8
    Registered User
    Join Date
    Oct 2005
    Posts
    271
    Thanks people. I was just hoping to indulge my laziness a bit (imagine, a single stroke of the keyboard and voila you have nice looking comments), but maybe this is my chance to study emacs lisp.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 12:33 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. code and comments check
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 01-17-2002, 11:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21