1 (let ((dir (concat (file-name-directory
3 (file-name-directory (or load-file-name
4 (when (boundp 'bytecomp-filename) bytecomp-filename)
6 (file-name-as-directory "emacsstuff"))))
7 (add-to-list 'load-path dir))
9 (require 'g0dilstuff-init)
14 (define-key c++-mode-map "\C-c\C-c" 'recompile)
15 (define-key c++-mode-map "\C-c\C-i" 'comment-indent)
17 ;;; remove some unnecessary compilation error regexp settings which just cause problems
18 (setq compilation-error-regexp-alist (delq 'cucumber compilation-error-regexp-alist))
19 (setq compilation-error-regexp-alist (delq 'mips-1 compilation-error-regexp-alist))
21 ;;; remove matching whitespace in filenames for 'gnu' style error messages
22 (setf (nth 1 (assoc 'gnu compilation-error-regexp-alist-alist))
23 (replace-regexp-in-string (regexp-quote " [^-/\n]\\|") ""
24 (nth 1 (assoc 'gnu compilation-error-regexp-alist-alist)) t t))
26 (defun debug-compilation-error-regexps ()
31 (narrow-to-region (point) (save-excursion (forward-line 1) (point)))
32 (let ((match (loop for key in compilation-error-regexp-alist
33 for elt = (assoc key compilation-error-regexp-alist-alist)
34 if (and elt (re-search-forward (cadr elt) nil t))
37 (message "compilation-error-regexp-alist-alist key: %s" match)
38 (error "no error line at point"))))))
40 (defun c++-mode-update-font-lock-keywords ()
41 (font-lock-add-keywords
42 nil '(;; complete some fundamental keywords
43 ;; add the new C++11 keywords
44 ("\\<\\(alignof\\|alignas\\|constexpr\\|decltype\\|noexcept\\|nullptr\\|static_assert\\|thread_local\\|override\\|final\\)\\>" . font-lock-keyword-face)
45 ("\\<\\(char[0-9]+_t\\)\\>" . font-lock-keyword-face)
46 ;; hexadecimal numbers
47 ("\\<0[xX][0-9A-Fa-f]+\\>" . font-lock-constant-face)
48 ;; integer/float/scientific numbers
49 ("\\<[\\-+]*[0-9]*\\.?[0-9]+\\([ulUL]+\\|[eE][\\-+]?[0-9]+\\)?\\>" . font-lock-constant-face))))
51 (add-hook 'c++-mode-hook 'c++-mode-update-font-lock-keywords t)