|
|
|
@ -3,13 +3,13 @@
|
|
|
|
|
; To use this file, add this to your .emacs, uncommented :
|
|
|
|
|
;(load "cc-engine.elc")
|
|
|
|
|
;(load "~/kde2/tdesdk/scripts/kde-devel-emacs.el")
|
|
|
|
|
; (setq auto-mode-alist
|
|
|
|
|
; (set auto-mode-alist
|
|
|
|
|
; (append '(("\\.h$" . c++-mode)) auto-mode-alist))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Tip: also add (gnuserv-start), to be able to use gnuclient to open new files from a shell
|
|
|
|
|
|
|
|
|
|
; Add (setq magic-keys-mode t) to your .xemacs/init.el or ~/.emacs (before loading this file)
|
|
|
|
|
; Add (set magic-keys-mode t) to your .xemacs/init.el or ~/.emacs (before loading this file)
|
|
|
|
|
; to enable the magic keys in C++ mode (auto-insertion of spaces and newlines).
|
|
|
|
|
|
|
|
|
|
; See the end of this file for the list of key bindings and for customizing them
|
|
|
|
@ -24,11 +24,11 @@
|
|
|
|
|
|
|
|
|
|
(if (string= (substring (emacs-version) 0 6) "XEmacs")
|
|
|
|
|
(progn
|
|
|
|
|
(setq emacs nil)
|
|
|
|
|
(setq xemacs t))
|
|
|
|
|
(set emacs nil)
|
|
|
|
|
(set xemacs t))
|
|
|
|
|
(progn
|
|
|
|
|
(setq emacs t)
|
|
|
|
|
(setq xemacs nil)))
|
|
|
|
|
(set emacs t)
|
|
|
|
|
(set xemacs nil)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; ------- First part, from Arnt's "c++ stuff"
|
|
|
|
@ -56,7 +56,7 @@
|
|
|
|
|
(let ((count 0)
|
|
|
|
|
(bmp (buffer-modified-p)))
|
|
|
|
|
(while (re-search-forward "[ \t]+$" nil t)
|
|
|
|
|
(setq count (1+ count))
|
|
|
|
|
(set count (1+ count))
|
|
|
|
|
(replace-match "" t t))
|
|
|
|
|
(set-buffer-modified-p bmp)
|
|
|
|
|
(and (buffer-modified-p)
|
|
|
|
@ -89,11 +89,11 @@ With arg, to it arg times."
|
|
|
|
|
(delete-region b (point-marker)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(setq c++-mode-hook
|
|
|
|
|
(set c++-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(font-lock-mode)
|
|
|
|
|
(c-set-style "stroustrup")
|
|
|
|
|
(setq c-tab-always-indent nil
|
|
|
|
|
(set c-tab-always-indent nil
|
|
|
|
|
insert-tab-mode nil
|
|
|
|
|
indent-tabs-mode nil
|
|
|
|
|
fume-auto-rescan-buffer-p nil
|
|
|
|
@ -108,7 +108,7 @@ With arg, to it arg times."
|
|
|
|
|
(cond ((string-match "^\\(.*/qt/src\\)/.*/" buffer-file-truename)
|
|
|
|
|
(progn
|
|
|
|
|
(make-local-variable 'compile-command)
|
|
|
|
|
(setq compile-command
|
|
|
|
|
(set compile-command
|
|
|
|
|
(concat "make -k -j 3 -C "
|
|
|
|
|
(substring buffer-file-truename
|
|
|
|
|
(match-beginning 1) (match-end 1))
|
|
|
|
@ -119,7 +119,7 @@ With arg, to it arg times."
|
|
|
|
|
((string-match "^\\\(.*/2x/src\\\)/.*/" buffer-file-truename)
|
|
|
|
|
(progn
|
|
|
|
|
(make-local-variable 'compile-command)
|
|
|
|
|
(setq compile-command
|
|
|
|
|
(set compile-command
|
|
|
|
|
(concat "make -k -C "
|
|
|
|
|
(substring buffer-file-truename
|
|
|
|
|
(match-beginning 1)
|
|
|
|
@ -130,7 +130,7 @@ With arg, to it arg times."
|
|
|
|
|
(define-key c++-mode-map "\ed" 'agulbra-delete-into-nomenclature)
|
|
|
|
|
(define-key c++-mode-map "\eb" 'c-backward-into-nomenclature)
|
|
|
|
|
|
|
|
|
|
; Add (setq magic-keys-mode t) to your .emacs (before loading this file)
|
|
|
|
|
; Add (set magic-keys-mode t) to your .emacs (before loading this file)
|
|
|
|
|
; to enable the magic keys in C++ mode.
|
|
|
|
|
(and (boundp 'magic-keys-mode)
|
|
|
|
|
(progn
|
|
|
|
@ -141,10 +141,10 @@ With arg, to it arg times."
|
|
|
|
|
))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
(setq c-mode-hook
|
|
|
|
|
(set c-mode-hook
|
|
|
|
|
(lambda ()
|
|
|
|
|
(font-lock-mode)
|
|
|
|
|
(setq c-tab-always-indent nil
|
|
|
|
|
(set c-tab-always-indent nil
|
|
|
|
|
c-basic-offset 4
|
|
|
|
|
c-offsets-alist (append '((case-label . 4)
|
|
|
|
|
(access-label . -)
|
|
|
|
@ -169,10 +169,10 @@ With arg, to it arg times."
|
|
|
|
|
(forward-word 2))
|
|
|
|
|
(while (looking-at "[ \t]")
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(setq start (point))
|
|
|
|
|
(set start (point))
|
|
|
|
|
(while (looking-at "[A-Za-z0-9_]")
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(setq class (buffer-substring start (point))))))
|
|
|
|
|
(set class (buffer-substring start (point))))))
|
|
|
|
|
(progn
|
|
|
|
|
(and (looking-at "$")
|
|
|
|
|
(progn
|
|
|
|
@ -184,7 +184,7 @@ With arg, to it arg times."
|
|
|
|
|
(progn
|
|
|
|
|
(while (looking-at "[ \t]")
|
|
|
|
|
(forward-char 1))
|
|
|
|
|
(setq start (point))
|
|
|
|
|
(set start (point))
|
|
|
|
|
(and (search-forward "(" nil t)
|
|
|
|
|
(progn
|
|
|
|
|
(forward-char -1)
|
|
|
|
@ -192,31 +192,31 @@ With arg, to it arg times."
|
|
|
|
|
(and (looking-at "[ \t]+const")
|
|
|
|
|
(forward-word 1))
|
|
|
|
|
(and (looking-at ";")
|
|
|
|
|
(setq function (buffer-substring start (point))))
|
|
|
|
|
(set function (buffer-substring start (point))))
|
|
|
|
|
(re-search-forward "(" nil t))))
|
|
|
|
|
(and (stringp function)
|
|
|
|
|
(progn ;; get rid of virtual, static, multiple spaces, default values.
|
|
|
|
|
(and (string-match "[ \t]*\\<virtual\\>[ \t]*" function)
|
|
|
|
|
(setq function (replace-match " " t t function)))
|
|
|
|
|
(set function (replace-match " " t t function)))
|
|
|
|
|
(and (string-match "^\\(virtual\\>\\)?[ \t]*" function)
|
|
|
|
|
(setq function (replace-match "" t t function)))
|
|
|
|
|
(set function (replace-match "" t t function)))
|
|
|
|
|
(and (string-match "^\\(static\\>\\)?[ \t]*" function)
|
|
|
|
|
(setq function (replace-match "" t t function)))
|
|
|
|
|
(set function (replace-match "" t t function)))
|
|
|
|
|
(while (string-match " +" function)
|
|
|
|
|
(setq function (replace-match " " t t function)))
|
|
|
|
|
(set function (replace-match " " t t function)))
|
|
|
|
|
(while (string-match "\t+" function)
|
|
|
|
|
(setq function (replace-match " " t t function)))
|
|
|
|
|
(set function (replace-match " " t t function)))
|
|
|
|
|
(while (string-match " ?=[^,)]+" function)
|
|
|
|
|
(setq function (replace-match " " t t function)))
|
|
|
|
|
(set function (replace-match " " t t function)))
|
|
|
|
|
(while (string-match " +," function)
|
|
|
|
|
(setq function (replace-match "," t t function)))))
|
|
|
|
|
(set function (replace-match "," t t function)))))
|
|
|
|
|
(and (stringp function)
|
|
|
|
|
(stringp class)
|
|
|
|
|
(stringp file)
|
|
|
|
|
(progn
|
|
|
|
|
(cond ((string-match (concat "^ *" class "[ \\t]*(") function)
|
|
|
|
|
(progn
|
|
|
|
|
(setq insertion-string
|
|
|
|
|
(set insertion-string
|
|
|
|
|
(concat
|
|
|
|
|
(replace-match
|
|
|
|
|
(concat class "::" class "(")
|
|
|
|
@ -224,7 +224,7 @@ With arg, to it arg times."
|
|
|
|
|
"\n{\n \n}\n"))))
|
|
|
|
|
((string-match (concat "^ *~" class "[ \\t]*(") function)
|
|
|
|
|
(progn
|
|
|
|
|
(setq insertion-string
|
|
|
|
|
(set insertion-string
|
|
|
|
|
(concat
|
|
|
|
|
(replace-match
|
|
|
|
|
(concat class "::~" class "(")
|
|
|
|
@ -232,7 +232,7 @@ With arg, to it arg times."
|
|
|
|
|
"\n{\n \n}\n"))))
|
|
|
|
|
((string-match " *\\([a-zA-Z0-9_]+\\)[ \\t]*(" function)
|
|
|
|
|
(progn
|
|
|
|
|
(setq insertion-string
|
|
|
|
|
(set insertion-string
|
|
|
|
|
(concat
|
|
|
|
|
(replace-match
|
|
|
|
|
(concat " " class "::" "\\1(")
|
|
|
|
@ -244,12 +244,12 @@ With arg, to it arg times."
|
|
|
|
|
"'', aborting"))))
|
|
|
|
|
(stringp insertion-string))
|
|
|
|
|
(string-match "\\.h$" file)
|
|
|
|
|
(setq f (replace-match ".cpp" t t file))
|
|
|
|
|
(set f (replace-match ".cpp" t t file))
|
|
|
|
|
(if (file-readable-p f )
|
|
|
|
|
(message "")
|
|
|
|
|
(progn
|
|
|
|
|
(string-match "\\.h$" file)
|
|
|
|
|
(setq f (replace-match ".cc" t t file))
|
|
|
|
|
(set f (replace-match ".cc" t t file))
|
|
|
|
|
))
|
|
|
|
|
(find-file f)
|
|
|
|
|
(progn
|
|
|
|
@ -258,7 +258,7 @@ With arg, to it arg times."
|
|
|
|
|
(forward-char -3)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (string-match ".*/" file)
|
|
|
|
|
(setq file (replace-match "" t nil file)))
|
|
|
|
|
(set file (replace-match "" t nil file)))
|
|
|
|
|
(or (re-search-backward
|
|
|
|
|
(concat "^#include *\"" file "\"$") nil t)
|
|
|
|
|
(progn
|
|
|
|
@ -269,7 +269,7 @@ With arg, to it arg times."
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(setq compilation-error-regexp-systems-list '(gnu of comma 4bsd)
|
|
|
|
|
(set compilation-error-regexp-systems-list '(gnu of comma 4bsd)
|
|
|
|
|
compilation-ask-about-save nil)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -300,9 +300,9 @@ With arg, to it arg times."
|
|
|
|
|
(let ((enclosing (match-string 1)))
|
|
|
|
|
(cond
|
|
|
|
|
((string-equal enclosing "extern")
|
|
|
|
|
(setq inenclosing-p 'extern))
|
|
|
|
|
(set inenclosing-p 'extern))
|
|
|
|
|
((string-equal enclosing "namespace")
|
|
|
|
|
(setq inenclosing-p 'namespace))
|
|
|
|
|
(set inenclosing-p 'namespace))
|
|
|
|
|
)))))
|
|
|
|
|
;; get the buffer position of the most nested opening brace,
|
|
|
|
|
;; if there is one, and it hasn't been narrowed out
|
|
|
|
@ -312,23 +312,23 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(while (and state
|
|
|
|
|
(not containing-sexp))
|
|
|
|
|
(setq containing-sexp (car state)
|
|
|
|
|
(set containing-sexp (car state)
|
|
|
|
|
state (cdr state))
|
|
|
|
|
(if (consp containing-sexp)
|
|
|
|
|
;; if cdr == point, then containing sexp is the brace
|
|
|
|
|
;; that opens the sexp we close
|
|
|
|
|
(if (= (cdr containing-sexp) (point))
|
|
|
|
|
(setq containing-sexp (car containing-sexp))
|
|
|
|
|
(set containing-sexp (car containing-sexp))
|
|
|
|
|
;; otherwise, ignore this element
|
|
|
|
|
(setq containing-sexp nil))
|
|
|
|
|
(set containing-sexp nil))
|
|
|
|
|
;; ignore the bufpos if its been narrowed out by the
|
|
|
|
|
;; containing class or does not contain the indent point
|
|
|
|
|
(if (or (<= containing-sexp (point-min))
|
|
|
|
|
(>= containing-sexp indent-point))
|
|
|
|
|
(setq containing-sexp nil)))))
|
|
|
|
|
(set containing-sexp nil)))))
|
|
|
|
|
|
|
|
|
|
;; set the limit on the farthest back we need to search
|
|
|
|
|
(setq lim (or containing-sexp
|
|
|
|
|
(set lim (or containing-sexp
|
|
|
|
|
(if (consp (car fullstate))
|
|
|
|
|
(cdr (car fullstate))
|
|
|
|
|
nil)
|
|
|
|
@ -338,14 +338,14 @@ With arg, to it arg times."
|
|
|
|
|
;; the most likely position to perform the majority of tests
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(setq char-after-ip (char-after))
|
|
|
|
|
(set char-after-ip (char-after))
|
|
|
|
|
(c-backward-syntactic-ws lim)
|
|
|
|
|
(setq char-before-ip (char-before))
|
|
|
|
|
(set char-before-ip (char-before))
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
|
|
|
|
|
;; are we in a literal?
|
|
|
|
|
(setq literal (c-in-literal lim))
|
|
|
|
|
(set literal (c-in-literal lim))
|
|
|
|
|
|
|
|
|
|
;; now figure out syntactic qualities of the current line
|
|
|
|
|
(cond
|
|
|
|
@ -359,22 +359,22 @@ With arg, to it arg times."
|
|
|
|
|
((and (eq literal 'pound)
|
|
|
|
|
(/= (save-excursion
|
|
|
|
|
(c-beginning-of-macro lim)
|
|
|
|
|
(setq placeholder (point)))
|
|
|
|
|
(set placeholder (point)))
|
|
|
|
|
(c-point 'boi)))
|
|
|
|
|
(c-add-syntax 'cpp-macro-cont placeholder))
|
|
|
|
|
;; CASE 4: In-expression statement.
|
|
|
|
|
((and (or c-inexpr-class-key c-inexpr-block-key c-lambda-key)
|
|
|
|
|
(setq placeholder (c-looking-at-inexpr-block)))
|
|
|
|
|
(setq tmpsymbol (assq (car placeholder)
|
|
|
|
|
(set placeholder (c-looking-at-inexpr-block)))
|
|
|
|
|
(set tmpsymbol (assq (car placeholder)
|
|
|
|
|
'((inexpr-class . class-open)
|
|
|
|
|
(inexpr-statement . block-open))))
|
|
|
|
|
(if tmpsymbol
|
|
|
|
|
;; It's a statement block or an anonymous class.
|
|
|
|
|
(setq tmpsymbol (cdr tmpsymbol))
|
|
|
|
|
(set tmpsymbol (cdr tmpsymbol))
|
|
|
|
|
;; It's a Pike lambda. Check whether we are between the
|
|
|
|
|
;; lambda keyword and the argument list or at the defun
|
|
|
|
|
;; opener.
|
|
|
|
|
(setq tmpsymbol (if (eq char-after-ip ?{)
|
|
|
|
|
(set tmpsymbol (if (eq char-after-ip ?{)
|
|
|
|
|
'inline-open
|
|
|
|
|
'lambda-intro-cont)))
|
|
|
|
|
(goto-char (cdr placeholder))
|
|
|
|
@ -387,7 +387,7 @@ With arg, to it arg times."
|
|
|
|
|
(cond
|
|
|
|
|
;; CASE 5A: we are looking at a defun, brace list, class,
|
|
|
|
|
;; or inline-inclass method opening brace
|
|
|
|
|
((setq special-brace-list
|
|
|
|
|
((set special-brace-list
|
|
|
|
|
(or (and c-special-brace-lists
|
|
|
|
|
(c-looking-at-special-brace-list))
|
|
|
|
|
(eq char-after-ip ?{)))
|
|
|
|
@ -398,16 +398,16 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(and (c-safe (progn (c-backward-sexp 2) t))
|
|
|
|
|
(looking-at (concat c-extra-toplevel-key "[^_]"))
|
|
|
|
|
(setq keyword (match-string 1)
|
|
|
|
|
(set keyword (match-string 1)
|
|
|
|
|
placeholder (point))
|
|
|
|
|
(or (and (string-equal keyword "namespace")
|
|
|
|
|
(setq tmpsymbol 'namespace-open))
|
|
|
|
|
(set tmpsymbol 'namespace-open))
|
|
|
|
|
(and (string-equal keyword "extern")
|
|
|
|
|
(progn
|
|
|
|
|
(c-forward-sexp 1)
|
|
|
|
|
(c-forward-syntactic-ws)
|
|
|
|
|
(eq (char-after) ?\"))
|
|
|
|
|
(setq tmpsymbol 'extern-lang-open)))
|
|
|
|
|
(set tmpsymbol 'extern-lang-open)))
|
|
|
|
|
))
|
|
|
|
|
(goto-char placeholder)
|
|
|
|
|
(c-add-syntax tmpsymbol (c-point 'boi)))
|
|
|
|
@ -424,7 +424,7 @@ With arg, to it arg times."
|
|
|
|
|
(c-search-uplist-for-classkey (c-parse-state))
|
|
|
|
|
)))
|
|
|
|
|
(and decl
|
|
|
|
|
(setq placeholder (aref decl 0)))
|
|
|
|
|
(set placeholder (aref decl 0)))
|
|
|
|
|
))
|
|
|
|
|
(c-add-syntax 'class-open placeholder))
|
|
|
|
|
;; CASE 5A.3: brace list open
|
|
|
|
@ -436,17 +436,17 @@ With arg, to it arg times."
|
|
|
|
|
(if (looking-at "typedef[^_]")
|
|
|
|
|
(progn (c-forward-sexp 1)
|
|
|
|
|
(c-forward-syntactic-ws indent-point)))
|
|
|
|
|
(setq placeholder (c-point 'boi))
|
|
|
|
|
(set placeholder (c-point 'boi))
|
|
|
|
|
(or (consp special-brace-list)
|
|
|
|
|
(and (or (save-excursion
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(setq tmpsymbol nil)
|
|
|
|
|
(set tmpsymbol nil)
|
|
|
|
|
(while (and (> (point) placeholder)
|
|
|
|
|
(= (c-backward-token-1 1 t) 0)
|
|
|
|
|
(/= (char-after) ?=))
|
|
|
|
|
(if (and (not tmpsymbol)
|
|
|
|
|
(looking-at "new\\>[^_]"))
|
|
|
|
|
(setq tmpsymbol 'topmost-intro-cont)))
|
|
|
|
|
(set tmpsymbol 'topmost-intro-cont)))
|
|
|
|
|
(eq (char-after) ?=))
|
|
|
|
|
(looking-at "enum[ \t\n]+"))
|
|
|
|
|
(save-excursion
|
|
|
|
@ -500,12 +500,12 @@ With arg, to it arg times."
|
|
|
|
|
(c-backward-syntactic-ws lim)))
|
|
|
|
|
(if (eq (char-before) ?\))
|
|
|
|
|
(c-backward-sexp 1))
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(and (c-safe (c-backward-sexp 1) t)
|
|
|
|
|
(looking-at "throw[^_]")
|
|
|
|
|
(c-safe (c-backward-sexp 1) t)
|
|
|
|
|
(setq placeholder (point))))
|
|
|
|
|
(set placeholder (point))))
|
|
|
|
|
(goto-char placeholder)
|
|
|
|
|
(c-add-syntax 'member-init-intro (c-point 'boi))
|
|
|
|
|
;; we don't need to add any class offset since this
|
|
|
|
@ -557,13 +557,13 @@ With arg, to it arg times."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (not done)
|
|
|
|
|
(cond ((looking-at c-Java-special-key)
|
|
|
|
|
(setq injava-inher (cons cont (point))
|
|
|
|
|
(set injava-inher (cons cont (point))
|
|
|
|
|
done t))
|
|
|
|
|
((or (not (c-safe (c-forward-sexp -1) t))
|
|
|
|
|
(<= (point) fence))
|
|
|
|
|
(setq done t))
|
|
|
|
|
(set done t))
|
|
|
|
|
)
|
|
|
|
|
(setq cont t)))
|
|
|
|
|
(set cont t)))
|
|
|
|
|
injava-inher)
|
|
|
|
|
(not (c-crosses-statement-barrier-p (cdr injava-inher)
|
|
|
|
|
(point)))
|
|
|
|
@ -624,7 +624,7 @@ With arg, to it arg times."
|
|
|
|
|
;; CASE 5D.1: hanging member init colon, but watch out
|
|
|
|
|
;; for bogus matches on access specifiers inside classes.
|
|
|
|
|
((and (save-excursion
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(c-backward-token-1 1 t lim)
|
|
|
|
|
(and (eq (char-after) ?:)
|
|
|
|
|
(not (eq (char-before) ?:))))
|
|
|
|
@ -655,7 +655,7 @@ With arg, to it arg times."
|
|
|
|
|
;; CASE 5D.3: perhaps a multiple inheritance line?
|
|
|
|
|
((save-excursion
|
|
|
|
|
(c-beginning-of-statement-1 lim)
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(looking-at c-inher-key))
|
|
|
|
|
(goto-char placeholder)
|
|
|
|
|
(c-add-syntax 'inher-cont (c-point 'boi)))
|
|
|
|
@ -665,7 +665,7 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-backward "^<" lim)
|
|
|
|
|
;; not sure if this is the right test, but it should
|
|
|
|
|
;; be fast and mostly accurate.
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(and (eq (char-before) ?<)
|
|
|
|
|
(not (c-in-literal lim))))
|
|
|
|
|
;; we can probably indent it just like an arglist-cont
|
|
|
|
@ -692,7 +692,7 @@ With arg, to it arg times."
|
|
|
|
|
;; CASE 5F: extern-lang-close or namespace-close?
|
|
|
|
|
((and inenclosing-p
|
|
|
|
|
(eq char-after-ip ?}))
|
|
|
|
|
(setq tmpsymbol (if (eq inenclosing-p 'extern)
|
|
|
|
|
(set tmpsymbol (if (eq inenclosing-p 'extern)
|
|
|
|
|
'extern-lang-close
|
|
|
|
|
'namespace-close))
|
|
|
|
|
(c-add-syntax tmpsymbol (aref inclass-p 0)))
|
|
|
|
@ -720,11 +720,11 @@ With arg, to it arg times."
|
|
|
|
|
(point))))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(c-backward-syntactic-ws limit)
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(while (and (memq (char-before) '(?\; ?,))
|
|
|
|
|
(> (point) limit))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(c-backward-syntactic-ws limit))
|
|
|
|
|
(and (eq (char-before) ?\))
|
|
|
|
|
(or (not c-method-key)
|
|
|
|
@ -821,18 +821,18 @@ With arg, to it arg times."
|
|
|
|
|
(not (eq char-before-ip ?,)))
|
|
|
|
|
(memq char-after-ip '(?\) ?\])))
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(setq placeholder (c-point 'boi))
|
|
|
|
|
(set placeholder (c-point 'boi))
|
|
|
|
|
(when (and (c-safe (backward-up-list 1) t)
|
|
|
|
|
(> (point) placeholder))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(setq placeholder (point)))
|
|
|
|
|
(set placeholder (point)))
|
|
|
|
|
(c-add-syntax 'arglist-close placeholder))
|
|
|
|
|
;; CASE 7B: Looking at the opening brace of an
|
|
|
|
|
;; in-expression block or brace list.
|
|
|
|
|
((eq char-after-ip ?{)
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(setq placeholder (c-point 'boi))
|
|
|
|
|
(set placeholder (c-point 'boi))
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(if (c-inside-bracelist-p placeholder
|
|
|
|
|
(cons containing-sexp state))
|
|
|
|
@ -846,12 +846,12 @@ With arg, to it arg times."
|
|
|
|
|
;; looking at a close paren or bracket.
|
|
|
|
|
((memq char-before-ip '(?\( ?\[))
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(setq placeholder (c-point 'boi))
|
|
|
|
|
(set placeholder (c-point 'boi))
|
|
|
|
|
(when (and (c-safe (backward-up-list 1) t)
|
|
|
|
|
(> (point) placeholder))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(setq placeholder (point)))
|
|
|
|
|
(set placeholder (point)))
|
|
|
|
|
(c-add-syntax 'arglist-intro placeholder))
|
|
|
|
|
;; CASE 7D: we are inside a conditional test clause. treat
|
|
|
|
|
;; these things as statements
|
|
|
|
@ -887,12 +887,12 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(not (eolp)))
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(setq placeholder (c-point 'boi))
|
|
|
|
|
(set placeholder (c-point 'boi))
|
|
|
|
|
(when (and (c-safe (backward-up-list 1) t)
|
|
|
|
|
(> (point) placeholder))
|
|
|
|
|
(forward-char)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(setq placeholder (point)))
|
|
|
|
|
(set placeholder (point)))
|
|
|
|
|
(c-add-syntax 'arglist-cont-nonempty placeholder))
|
|
|
|
|
;; CASE 7G: we are looking at just a normal arglist
|
|
|
|
|
;; continuation line
|
|
|
|
@ -923,7 +923,7 @@ With arg, to it arg times."
|
|
|
|
|
(c-add-syntax 'inher-cont (point))
|
|
|
|
|
)))
|
|
|
|
|
;; CASE 9: we are inside a brace-list
|
|
|
|
|
((setq special-brace-list
|
|
|
|
|
((set special-brace-list
|
|
|
|
|
(or (and c-special-brace-lists
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
@ -940,8 +940,8 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-backward " \t")
|
|
|
|
|
(if (and (bolp)
|
|
|
|
|
(assoc 'statement-cont
|
|
|
|
|
(setq placeholder (c-guess-basic-syntax))))
|
|
|
|
|
(setq syntax placeholder)
|
|
|
|
|
(set placeholder (c-guess-basic-syntax))))
|
|
|
|
|
(set syntax placeholder)
|
|
|
|
|
(c-beginning-of-statement-1 lim)
|
|
|
|
|
(c-forward-token-1 0)
|
|
|
|
|
(if (looking-at "typedef\\>") (c-forward-token-1 1))
|
|
|
|
@ -1008,7 +1008,7 @@ With arg, to it arg times."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(c-beginning-of-statement-1 containing-sexp)
|
|
|
|
|
(c-forward-syntactic-ws)
|
|
|
|
|
(setq placeholder (point))))
|
|
|
|
|
(set placeholder (point))))
|
|
|
|
|
(/= placeholder containing-sexp))
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
@ -1034,7 +1034,7 @@ With arg, to it arg times."
|
|
|
|
|
(c-add-syntax 'substatement-open (c-point 'boi))
|
|
|
|
|
(c-add-syntax 'substatement (c-point 'boi))))
|
|
|
|
|
;; CASE 10B: open braces for class or brace-lists
|
|
|
|
|
((setq special-brace-list
|
|
|
|
|
((set special-brace-list
|
|
|
|
|
(or (and c-special-brace-lists
|
|
|
|
|
(c-looking-at-special-brace-list))
|
|
|
|
|
(eq char-after-ip ?{)))
|
|
|
|
@ -1045,7 +1045,7 @@ With arg, to it arg times."
|
|
|
|
|
(skip-chars-forward " \t{")
|
|
|
|
|
(let ((decl (c-search-uplist-for-classkey (c-parse-state))))
|
|
|
|
|
(and decl
|
|
|
|
|
(setq placeholder (aref decl 0)))
|
|
|
|
|
(set placeholder (aref decl 0)))
|
|
|
|
|
))
|
|
|
|
|
(c-add-syntax 'class-open placeholder))
|
|
|
|
|
;; CASE 10B.2: brace-list-open
|
|
|
|
@ -1125,7 +1125,7 @@ With arg, to it arg times."
|
|
|
|
|
(and (looking-at "while\\b[^_]")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(c-backward-to-start-of-do containing-sexp)
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(looking-at "do\\b[^_]"))
|
|
|
|
|
))
|
|
|
|
|
(goto-char placeholder)
|
|
|
|
@ -1145,7 +1145,7 @@ With arg, to it arg times."
|
|
|
|
|
(c-safe (c-backward-sexp) t)
|
|
|
|
|
t)
|
|
|
|
|
(looking-at "\\<\\(try\\|catch\\)\\>[^_]")
|
|
|
|
|
(setq placeholder (c-point 'boi))))
|
|
|
|
|
(set placeholder (c-point 'boi))))
|
|
|
|
|
(c-add-syntax 'catch-clause placeholder))
|
|
|
|
|
;; CASE 14: A case or default label
|
|
|
|
|
((looking-at c-switch-label-key)
|
|
|
|
@ -1175,8 +1175,8 @@ With arg, to it arg times."
|
|
|
|
|
;; block?
|
|
|
|
|
((save-excursion
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(setq placeholder (c-looking-at-inexpr-block)))
|
|
|
|
|
(setq tmpsymbol (if (eq (car placeholder) 'inlambda)
|
|
|
|
|
(set placeholder (c-looking-at-inexpr-block)))
|
|
|
|
|
(set tmpsymbol (if (eq (car placeholder) 'inlambda)
|
|
|
|
|
'inline-close
|
|
|
|
|
'block-close))
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
@ -1192,7 +1192,7 @@ With arg, to it arg times."
|
|
|
|
|
;; an extern block or namespace?
|
|
|
|
|
((progn
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(setq placeholder (c-search-uplist-for-classkey state)))
|
|
|
|
|
(set placeholder (c-search-uplist-for-classkey state)))
|
|
|
|
|
(goto-char (aref placeholder 0))
|
|
|
|
|
(if (looking-at (concat c-extra-toplevel-key "[^_]"))
|
|
|
|
|
(c-add-syntax 'defun-close relpos)
|
|
|
|
@ -1232,7 +1232,7 @@ With arg, to it arg times."
|
|
|
|
|
(while (or (c-skip-case-statement-forward fullstate indent-point)
|
|
|
|
|
(and (looking-at c-switch-label-key)
|
|
|
|
|
(not inswitch-p)))
|
|
|
|
|
(setq inswitch-p t))
|
|
|
|
|
(set inswitch-p t))
|
|
|
|
|
;; we want to ignore non-case labels when skipping forward
|
|
|
|
|
(while (and (looking-at c-label-key)
|
|
|
|
|
(goto-char (match-end 0)))
|
|
|
|
@ -1245,11 +1245,11 @@ With arg, to it arg times."
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(c-beginning-of-statement-1 containing-sexp)
|
|
|
|
|
(setq placeholder (point))
|
|
|
|
|
(set placeholder (point))
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(when (re-search-forward c-switch-label-key
|
|
|
|
|
(max placeholder (c-point 'eol)) t)
|
|
|
|
|
(setq placeholder (match-beginning 0)))))
|
|
|
|
|
(set placeholder (match-beginning 0)))))
|
|
|
|
|
(goto-char indent-point)
|
|
|
|
|
(skip-chars-forward " \t")
|
|
|
|
|
(if (eq (char-after) ?{)
|
|
|
|
@ -1296,19 +1296,19 @@ With arg, to it arg times."
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
|
(c-forward-syntactic-ws)))
|
|
|
|
|
(setq relpos (c-point 'boi))
|
|
|
|
|
(set relpos (c-point 'boi))
|
|
|
|
|
(while (and (not done)
|
|
|
|
|
(<= safepos (point))
|
|
|
|
|
(/= relpos (point)))
|
|
|
|
|
(c-beginning-of-statement-1 safepos)
|
|
|
|
|
(if (= relpos (c-point 'boi))
|
|
|
|
|
(setq done t))
|
|
|
|
|
(setq relpos (c-point 'boi)))
|
|
|
|
|
(set done t))
|
|
|
|
|
(set relpos (c-point 'boi)))
|
|
|
|
|
(c-add-syntax 'statement relpos)
|
|
|
|
|
(if (eq char-after-ip ?{)
|
|
|
|
|
(c-add-syntax 'block-open))))
|
|
|
|
|
;; CASE 17E: first statement in an in-expression block
|
|
|
|
|
((setq placeholder
|
|
|
|
|
((set placeholder
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char containing-sexp)
|
|
|
|
|
(c-looking-at-inexpr-block)))
|
|
|
|
@ -1386,7 +1386,7 @@ With arg, to it arg times."
|
|
|
|
|
((and (eq literal 'pound)
|
|
|
|
|
(= (save-excursion
|
|
|
|
|
(c-beginning-of-macro lim)
|
|
|
|
|
(setq placeholder (point)))
|
|
|
|
|
(set placeholder (point)))
|
|
|
|
|
(c-point 'boi))
|
|
|
|
|
(not (and (c-major-mode-is 'pike-mode)
|
|
|
|
|
(eq (char-after (1+ placeholder)) ?\"))))
|
|
|
|
@ -1402,17 +1402,17 @@ With arg, to it arg times."
|
|
|
|
|
(c nil))
|
|
|
|
|
(cond ((and (string-match "\\.h$" n)
|
|
|
|
|
(progn
|
|
|
|
|
(setq c (replace-match ".cpp" t t n))
|
|
|
|
|
(set c (replace-match ".cpp" t t n))
|
|
|
|
|
(file-readable-p c)))
|
|
|
|
|
(find-file c))
|
|
|
|
|
((and (string-match "\\.h$" n)
|
|
|
|
|
(progn
|
|
|
|
|
(setq c (replace-match ".cc" t t n))
|
|
|
|
|
(set c (replace-match ".cc" t t n))
|
|
|
|
|
(file-readable-p c)))
|
|
|
|
|
(find-file c))
|
|
|
|
|
((and (string-match "\\.h$" n)
|
|
|
|
|
(progn
|
|
|
|
|
(setq c (replace-match ".C" t t n))
|
|
|
|
|
(set c (replace-match ".C" t t n))
|
|
|
|
|
(file-readable-p c)))
|
|
|
|
|
(find-file c))
|
|
|
|
|
((string-match "\\.h$" n)
|
|
|
|
@ -1505,9 +1505,9 @@ With arg, to it arg times."
|
|
|
|
|
(classes (cdr elm)))
|
|
|
|
|
( while (and classes (not found))
|
|
|
|
|
(if (string= (downcase cls) (downcase (symbol-name (car classes))))
|
|
|
|
|
(setq found include-file)
|
|
|
|
|
(setq classes (cdr classes)))))
|
|
|
|
|
(setq list (cdr list)))
|
|
|
|
|
(set found include-file)
|
|
|
|
|
(set classes (cdr classes)))))
|
|
|
|
|
(set list (cdr list)))
|
|
|
|
|
(if found
|
|
|
|
|
(symbol-name found)
|
|
|
|
|
nil) ; return value
|
|
|
|
@ -1603,8 +1603,8 @@ With arg, to it arg times."
|
|
|
|
|
(let ((a (fume-function-before-point)))
|
|
|
|
|
(and (string-match "^\\(.*\\)::\\(.*\\)$" a)
|
|
|
|
|
(progn
|
|
|
|
|
(setq class (match-string 1 a))
|
|
|
|
|
(setq fn (match-string 2 a))
|
|
|
|
|
(set class (match-string 1 a))
|
|
|
|
|
(set fn (match-string 2 a))
|
|
|
|
|
(agulbra-switch-cpp-h)
|
|
|
|
|
(goto-char 0)
|
|
|
|
|
(re-search-forward class nil t)
|
|
|
|
@ -1614,12 +1614,12 @@ With arg, to it arg times."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-line 0)
|
|
|
|
|
(re-search-forward "[ \t]+\\([^ \t(]+\\)[ \t]*(" nil t)
|
|
|
|
|
(setq fn (match-string 1))
|
|
|
|
|
(set fn (match-string 1))
|
|
|
|
|
(re-search-backward "^class \\([a-zA-Z0-9_]+\\)[ \t]*\\([a-zA-Z0-9_]*\\)" nil t)
|
|
|
|
|
(setq class (match-string 1))
|
|
|
|
|
(setq save (match-string 2))
|
|
|
|
|
(set class (match-string 1))
|
|
|
|
|
(set save (match-string 2))
|
|
|
|
|
(and (string-match "Q_EXPORT" class)
|
|
|
|
|
(setq class save))
|
|
|
|
|
(set class save))
|
|
|
|
|
(message (concat class "::" fn))
|
|
|
|
|
)
|
|
|
|
|
(agulbra-switch-cpp-h)
|
|
|
|
@ -1670,9 +1670,9 @@ With arg, to it arg times."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((f (buffer-file-name)))
|
|
|
|
|
(if (string-match "^.*/" f)
|
|
|
|
|
(setq f (replace-match "" t t f)))
|
|
|
|
|
(set f (replace-match "" t t f)))
|
|
|
|
|
(while (string-match "\\." f)
|
|
|
|
|
(setq f (replace-match "_" t t f)))
|
|
|
|
|
(set f (replace-match "_" t t f)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(insert "#ifndef " (upcase f) "\n#define " (upcase f) "\n\n")
|
|
|
|
@ -1688,7 +1688,7 @@ With arg, to it arg times."
|
|
|
|
|
(if (not (c-in-literal))
|
|
|
|
|
(let ((n nil))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(setq n (or (progn (forward-char -2) (looking-at "if"))
|
|
|
|
|
(set n (or (progn (forward-char -2) (looking-at "if"))
|
|
|
|
|
(progn (forward-char -1) (looking-at "for"))
|
|
|
|
|
(progn (forward-char -1) (looking-at "case"))
|
|
|
|
|
(progn (forward-char -1) (looking-at "while"))
|
|
|
|
@ -1712,9 +1712,9 @@ With arg, to it arg times."
|
|
|
|
|
(if (not (c-in-literal))
|
|
|
|
|
(let ((remv nil) (nospac nil))
|
|
|
|
|
(forward-char -2)
|
|
|
|
|
(setq remv (looking-at "( ")) ; () -> we'll have to remove that space
|
|
|
|
|
(set remv (looking-at "( ")) ; () -> we'll have to remove that space
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(setq nospac (or (looking-at " ") (looking-at "(")) ) ; no space to be added
|
|
|
|
|
(set nospac (or (looking-at " ") (looking-at "(")) ) ; no space to be added
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(cond
|
|
|
|
|
(remv (progn
|
|
|
|
@ -1747,9 +1747,9 @@ With arg, to it arg times."
|
|
|
|
|
(let ((n nil) (o nil))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-char -2)
|
|
|
|
|
(setq o (looking-at "()"))
|
|
|
|
|
(set o (looking-at "()"))
|
|
|
|
|
(forward-char 1)
|
|
|
|
|
(setq n (looking-at ")"))
|
|
|
|
|
(set n (looking-at ")"))
|
|
|
|
|
)
|
|
|
|
|
(cond
|
|
|
|
|
(n (progn
|
|
|
|
@ -1798,15 +1798,15 @@ With arg, to it arg times."
|
|
|
|
|
(defun makeinstallexec () (interactive) (compile "make install-exec"))
|
|
|
|
|
(defun makethisfile () (interactive)
|
|
|
|
|
(let ((f (buffer-name)))
|
|
|
|
|
(if (string-match "\.cpp$" f) (setq f (replace-match "\.lo" t t f)))
|
|
|
|
|
(if (string-match "\.cc$" f) (setq f (replace-match "\.lo" t t f)))
|
|
|
|
|
(if (string-match "\.cpp$" f) (set f (replace-match "\.lo" t t f)))
|
|
|
|
|
(if (string-match "\.cc$" f) (set f (replace-match "\.lo" t t f)))
|
|
|
|
|
(compile (concat "make " f ))))
|
|
|
|
|
|
|
|
|
|
;; Indentation: 4 characters, no tabs.
|
|
|
|
|
(setq c-basic-offset 4)
|
|
|
|
|
(setq insert-tab-mode nil)
|
|
|
|
|
(setq-default require-final-newline t)
|
|
|
|
|
(setq-default next-line-add-newlines nil)
|
|
|
|
|
(set c-basic-offset 4)
|
|
|
|
|
(set insert-tab-mode nil)
|
|
|
|
|
(set-default require-final-newline t)
|
|
|
|
|
(set-default next-line-add-newlines nil)
|
|
|
|
|
|
|
|
|
|
;; pc-like textmarking
|
|
|
|
|
(load "pc-select")
|
|
|
|
@ -1873,7 +1873,7 @@ With arg, to it arg times."
|
|
|
|
|
; Shift-F10: Place point on a class name, and press Shift-F10, and konqueror will load
|
|
|
|
|
; Qt documentation. Customize the location of the Qt documentation with the
|
|
|
|
|
; variable kdab-qt-documentation. XXX will be replace with the class name.
|
|
|
|
|
; Example (setq kdab-qt-location "file:/packages/kde-src/qt-copy/doc/html/XXX.html")
|
|
|
|
|
; Example (set kdab-qt-location "file:/packages/kde-src/qt-copy/doc/html/XXX.html")
|
|
|
|
|
;
|
|
|
|
|
; Ctrl+Meta+D : insert a kdDebug statement with the name of the current method
|
|
|
|
|
; [the new hide-all-windows shortcut conflicts with that, you may have to
|
|
|
|
@ -1885,6 +1885,6 @@ With arg, to it arg times."
|
|
|
|
|
; C-x r m to set a named bookmark in the buffer
|
|
|
|
|
; C-x r b to jump to a named bookmark in the buffer
|
|
|
|
|
|
|
|
|
|
(setq-default initial-scratch-message
|
|
|
|
|
(set-default initial-scratch-message
|
|
|
|
|
"File kde-devel-emacs.el is deprecated!
|
|
|
|
|
Please use KDE-Emacs from tdesdk/scripts/kde-emacs.")
|
|
|
|
|