Hi Collin,
There are no default templates for C code, just C++. I'm not sure about
the doc, but it is probably wrong, or I may have some old config where
my .h files are in c++ mode causing me to get my doc wrong. Of course,
several C++ templates in cpp.srt would probably be fine for C.
A simple way to "fix" it would be to edit cpp.srt, and change the mode
setting to be c-mode, not c++ mode, but that is not the 'correct' solution.
If you (or anyone on the mailing list for that matter) would like to
create templates for C code, knowing that the C++ templates will inherit
from them, that would be a nice project. There are many tests in the
cit tests for C++, and adding some good ones for C would be pretty easy.
I would need assignments of your work to the FSF in order to integrate
in your templates.
Thanks!
Eric
On 05/27/2012 09:04 PM, Collin Day wrote:
> Just a quick question - the Srecoder menu does not appear when I load a
> .c or .h file, but does appear with .cpp and .hpp files. Is this how it
> is supposed to work, or is there something extr I need to add to my
> .emacs file? My current .emacs is pretty short with
> (global-srecode-minor-mode 1) set at the end. The manual says it should
> activate with .h files, but I can't seem to get it to work in the C mode
> - just C++. Also, when I open a new .h file and use M-x
> (global-)srecode-minor-mode, no menu shows up, and when I try to insert
> a template with M-x srecode-insert file: there are less options - for
> example no include guard, but it is available with .hpp files in C++ mode.
>
> Any suggestions or hints would be very appreciated. Thanks!
>
> ------------------------------------ .emacs
> -----------------------------------------
>
> (set-foreground-color "white")
> (set-background-color "black")
> (set-cursor-color "red")
> (display-time)
>
> ;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/slime.el")
> ;;(require 'slime)
> (add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
> (add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
> (setq inferior-lisp-program "clisp")
>
> (global-ede-mode t)
> (semantic-load-enable-excessive-code-helpers)
> (require 'semantic-ia)
> (require 'semantic-gcc)
>
> (setq auto-mode-alist (cons'("\\.cc$" . c++-mode) auto-mode-alist))
> (setq auto-mode-alist (cons'("\\.hpp" . c++-mode) auto-mode-alist))
> (setq c-default-style '((c++-mode . "stroustrup") (c-mode . "stroustrup")))
>
> (defun my-c-mode-hook()
> (c-set-offset 'access-label '/)
> (c-set-offset 'topmost-intro '0)
> )
> (add-hook 'c-mode-hook 'my-c-mode-hook)
> (add-hook 'c++-mode-hook 'my-c-mode-hook)
>
> ;;Projects - move this to a file to include later
> (when (file-exists-p "~/projects/gnome-inform7pp/INSTALL")
> (ede-cpp-root-project "gnome-inform7pp"
> :name "Gnome Inform 7 C++"
> :file "~/projects/gnome-inform7pp/INSTALL"
> :include-path '("/"
> "/src"
> "/src/libchimara"
> "/src/osxcart"
> "/src/interpreters/frotz"
> "/src/interpreters/git"
> "/src/interpreters/glulxe"
> "/src/inform6"
> )
> ))
>
> ;; Semantic key bindings
> (defun my-cedet-hook ()
> (local-set-key "\C-c?" 'semantic-ia-complete-symbol)
> (local-set-key "\C-c>" 'semantic-complete-analyze-inline)
> (local-set-key "\C-c=" 'semantic-decoration-include-visit)
>
> (local-set-key "\C-cj" 'semantic-ia-fast-jump)
> (local-set-key "\C-cq" 'semantic-ia-show-doc)
> (local-set-key "\C-cs" 'semantic-ia-show-summary)
> (local-set-key "\C-cp" 'semantic-analyze-proto-impl-toggle)
> (local-set-key (kbd "C-c <left>") 'semantic-tag-folding-fold-block)
> (local-set-key (kbd "C-c <right>") 'semantic-tag-folding-show-block)
>
> ;;(add-to-list 'ac-sources 'ac-source-semantic)
> )
> (add-hook 'c-mode-common-hook 'my-cedet-hook)
> (add-hook 'lisp-mode-hook 'my-cedet-hook)
> (add-hook 'emacs-lisp-mod-hook 'my-cedet-hook)
>
> (defun my-c-mode-cedet-hook()
> (local-set-key "\C-ct" 'eassist-switch-h-cpp)
> (local-set-key "\C-xt" 'eassist-switch-h-cpp)
> (local-set-key "\C-ce" 'eassist-list-methods)
> (local-set-key "\C-c\C-r" 'semantic-symref)
> (local-set-key "." 'semantic-complete-self-insert)
> (local-set-key ">" 'semantic-complete-self-insert)
> ;; (add-to-list 'ac-sources 'ac-source-gtags)
> )
>
> (add-hook 'c-mode-common-hook 'my-c-mode-cedet-hook)
>
> (semanticdb-enable-gnu-global-databases 'c-mode t)
> (semanticdb-enable-gnu-global-databases 'c++-mode t)
>
> (when (cedet-ectag-version-check t)
> (semantic-load-enable-primary-ectags-support))
>
> (global-srecode-minor-mode 1)
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> Cedet-devel mailing list
> Cedet-devel@...
> https://lists.sourceforge.net/lists/listinfo/cedet-devel
|