From: g0dil Date: Tue, 17 Jul 2007 19:33:37 +0000 (+0000) Subject: Kde/KChooseWindow: Better 'Ok' handling X-Git-Url: http://g0dil.de/git?p=emacsstuff.git;a=commitdiff_plain;h=1f82e5d15fd2f1b9b581a010a476c3c603163bf2 Kde/KChooseWindow: Better 'Ok' handling Emacs/cc-ide: Fix ccide-build-implementation for multi-line return type Emacs/cc-ide: Implement ccide-sync-file-variables and ccide-gen-exception --- diff --git a/cc-ide/cc-helper.el b/cc-ide/cc-helper.el index e25f2e2..5d6d701 100644 --- a/cc-ide/cc-helper.el +++ b/cc-ide/cc-helper.el @@ -86,18 +86,16 @@ (c-build-template-specs (aref state 0) cbuf) (if (aref state 1) (progn - (insert-buffer-substring cbuf (car (aref state 1)) (cdr (aref state 1))) + (save-excursion + (insert-buffer-substring cbuf (car (aref state 1)) (cdr (aref state 1))) + (insert " ")) (if (not no-kill) (progn - (beginning-of-line) - (c-kill-special-keywords) - (goto-char (point-max)))) - (insert " "))) + (c-kill-special-keywords))))) (if add-words (progn - (beginning-of-line) - (insert add-words " ") - (goto-char (point-max)))) + (insert add-words " "))) + (goto-char (point-max)) (setq p1 (point)) (insert prefix) (if (> (length prefix) 0) diff --git a/cc-ide/cc-ide.el b/cc-ide/cc-ide.el index d174164..165e4eb 100644 --- a/cc-ide/cc-ide.el +++ b/cc-ide/cc-ide.el @@ -88,6 +88,8 @@ ("ci" ccide-class-impl-comment "Generate class implemenation comment") + ("ce" ccide-gen-exception "Generate an exception class") + (nil nil separator) ;; method level @@ -376,6 +378,39 @@ (buffer-file-name))) "\n{}") (beginning-of-line))))) +(defun ccide-sync-file-variables () + "Syncronize file variables to the current value of ccide-file-vars" + (interactive) + (save-excursion + (goto-char (point-max)) + (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) + (let ((case-fold-search t)) + (if (search-forward "Local Variables:" nil t) + (let (prefix suffix vars) + (skip-chars-forward " \t") + (or (eolp) + (setq suffix (buffer-substring (point) (progn (end-of-line) (point))))) + (goto-char (match-beginning 0)) + (or (bolp) + (setq prefix (buffer-substring (point) (progn (beginning-of-line) (point))))) + (loop do (progn + (forward-line 1) + (if (and prefix (looking-at prefix)) + (goto-char (match-end 0))) + (skip-chars-forward " \t")) + while (not (looking-at "end:")) + do (progn + (setq vars (cons (intern (buffer-substring + (point) + (progn (skip-chars-forward "^:\n") (point)))) + vars)))) + (beginning-of-line) + (loop for (var . value) in ccide-file-vars + do (if (not (memq var vars)) + (insert (or prefix "") + (symbol-name var) ": " (prin1-to-string value) + (or suffix "") "\n")))))))) + (defun ccide-syncronize-includes () "Syncronize include's in all other files" (interactive) @@ -610,6 +645,16 @@ copy constructor, assignment operator and destructor." "// private\n\n")) (message name))) +(defun ccide-gen-exception (class &optional description) + (interactive "sException name: ") + (indent-according-to-mode) + (let ((in (make-string c-basic-offset ? )) + (ofs (make-string (current-indentation) ? )) + (prefix (c-get-full-prefix (c-get-block-scope)))) + (insert "struct " class " : public std::exception\n" + ofs "{ virtual char const * what() const throw() " + "{ return \"" prefix "::" class "\"; } };\n"))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; function/method level