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

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

Re: Comments on newcomment.el especially comment-insert-comment-function


From: Nordlöw
Subject: Re: Comments on newcomment.el especially comment-insert-comment-function()
Date: Mon, 20 Oct 2008 05:44:41 -0700 (PDT)
User-agent: G2/1.0

On 20 Okt, 14:32, Nordlöw <per.nord...@gmail.com> wrote:
> Hey there!
>
> I have written a context-sensitive variant of comment-insert(). It
> handles C/C++ multi-line Doxygen comments  for the cases given below.
> But the fallback case has stopped working. I have looked into
> newcomment.el and I discovered that comment-insert-comment-function()
> is called also inside comment-indent() which explains the problem. But
> according to the doc for comment-dwim() this function should only be
> called when the line is empty. Is this a bug?
>
> Thanks in advance,
> Nordlöw
>
> CODE FOLLOWS:
>
> (defun c-insert-general-multiline-comment ()
>   "Insert Multi-line Comment for structures used in C/C++."
>   (interactive)
>   (if (or (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<enum\\_>"))
>           (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<typedef" "\
> \s-+" "\\_<enum\\_>"))
>           (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<struct\
> \_>"))
>           (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<typedef\
> \_>" "\\s-+" "struct\\_>"))
>           (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<typedef\
> \_>" "\\s-+" "class\\_>"))
>           (looking-at (concat "\\(?:\\s-*\n\\)*\\s-*" "\\_<template\
> \_>"))
>           )
>       (let ((descr (read-string "Brief Description: ")))
>         (delete-blank-lines)
>         (end-of-line) (forward-char)
>         (c-insert-general-doxygen-stub descr)
>       )))
> (setq comment-insert-comment-function 'c-insert-general-multiline-
> comment)

Is there a more flexible way of changing the behaviour of comment-
dwim() in specific modes in specfic code contexts?

/Nordlöw


reply via email to

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