all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Comments on newcomment.el especially comment-insert-comment-function()
@ 2008-10-20 12:32 Nordlöw
  2008-10-20 12:44 ` Nordlöw
  0 siblings, 1 reply; 2+ messages in thread
From: Nordlöw @ 2008-10-20 12:32 UTC (permalink / raw)
  To: help-gnu-emacs

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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-20 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20 12:32 Comments on newcomment.el especially comment-insert-comment-function() Nordlöw
2008-10-20 12:44 ` Nordlöw

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.