[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Comments on newcomment.el especially comment-insert-comment-function()
From: |
Nordlöw |
Subject: |
Comments on newcomment.el especially comment-insert-comment-function() |
Date: |
Mon, 20 Oct 2008 05:32:48 -0700 (PDT) |
User-agent: |
G2/1.0 |
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)
- Comments on newcomment.el especially comment-insert-comment-function(),
Nordlöw <=