help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inserting comment headings


From: Martin Stemplinger
Subject: Re: inserting comment headings
Date: Tue, 20 Jan 2004 23:59:40 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

On Mon Jan 19 2004 at 18:21, Martin Stemplinger
<mstemplingerNOSPAM@gmx.de> wrote: 

> On Mon Jan 19 2004 at 10:04, Patrick Drechsler
> <patrick.drechsler@gmx.net> wrote: 
>
>> I wanted to include the `-----------------' stuff after the
>> comment automatically:
>>
>> ;;* comment -----------------------------------------------
>>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> Any ideas?
>>
> You could write a little function that asks for the comment and
> inserts it accordingly.

In the meantime I had some spare time to come up with a solution:

(defun ms-insert-comment-at-line (comment)
  "Insert a comment at the beginning of the current line."
  (interactive "sComment:")
  (forward-line 0)                      
  (insert (comment-padright comment-start comment-add) " ** "
          comment " " (make-string (- (window-width)
                                             (+ (length comment) 5)
                                             1)
                                          ?-))
  (unless (string= "" comment-end)
    (insert (comment-padleft comment-end comment-add))))

HTH 
Martin
-- 
Remove NOSPAM to reply by mail


reply via email to

[Prev in Thread] Current Thread [Next in Thread]