<commit_before>;;; module-cc.el --- C, C++, and Objective-C

(use-package cc-mode
  :commands (c-mode c++-mode objc-mode java-mode)
  :init
  (associate! objc-mode :match "\\.mm$")
  (add-hook! 'c++-mode-hook '(highlight-numbers-mode narf|init-c++-C11-highlights))
  (add-hook 'c-initialization-hook 'narf|init-c/c++-settings)

  ;; C++ header files
  (push `(,(lambda () (and (f-ext? buffer-file-name "h")
                      (or (f-exists? (f-swap-ext buffer-file-name "cpp"))
                          (awhen (car-safe (projectile-get-other-files (buffer-file-name) (projectile-current-project-files)))
                            (f-ext? it "cpp")))))
          . c++-mode)
        magic-mode-alist)

  ;; Obj-C
  (push `(,(lambda () (and (f-ext? buffer-file-name "h")
                      (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
          . objc-mode)
        magic-mode-alist)

  :config
  (def-electric! (c-mode c++-mode objc-mode) :chars (?\n ?\}))
  (def-company-backend! (c-mode c++-mode objc-mode) (irony-c-headers irony))

  (setq c-tab-always-indent nil
        c-electric-flag nil)

  (map! :map c-mode-base-map (:localleader :nv ";" 'narf/append-semicolon))

  (sp-with-modes '(c-mode c++-mode objc-mode java-mode)
    (sp-local-pair "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p))
    (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
    ;; Doxygen blocks
    (sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
    (sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))

  ;; Improve indentation of inline lambdas in C++11
  (advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist))

(use-package irony
  :after cc-mode
  :config
  (setq irony-server-install-prefix (concat narf-temp-dir "/irony/"))
  (push "-std=c++11" irony-additional-clang-options)

  (require 'irony-eldoc)
  (require 'company-irony)
  (require 'company-irony-c-headers)
  (require 'flycheck-irony)
  (flycheck-irony-setup)

  ;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode)
  (add-hook! (c-mode c++-mode ojbc-mode)
    (when (memq major-mode '(c-mode c++-mode objc-mode))
      (flycheck-mode +1)
      (irony-mode +1)
      (eldoc-mode +1)
      (irony-eldoc +1))))

(use-package disaster :commands (disaster))

;;
(use-package cmake-mode
  :mode "CMakeLists\\.txt$"
  :config (def-company-backend! cmake-mode (cmake yasnippet)))

(use-package company-cmake :after cmake-mode)

(use-package glsl-mode :mode ("\\.glsl\\'" "\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))

(use-package cuda-mode :mode "\\.cuh?$")

(use-package opencl-mode :mode "\\.cl$")

(use-package demangle-mode
  :commands demangle-mode
  :init (add-hook 'llvm-mode-hook 'demangle-mode))

(provide 'module-cc)
;;; module-cc.el ends here
<commit_msg>cc: only set -std=c++11 in c++-mode<commit_after>;;; module-cc.el --- C, C++, and Objective-C

(use-package cc-mode
  :commands (c-mode c++-mode objc-mode java-mode)
  :init
  (associate! objc-mode :match "\\.mm$")
  (add-hook! c++-mode '(highlight-numbers-mode narf|init-c++-C11-highlights))
  (add-hook 'c-initialization-hook 'narf|init-c/c++-settings)

  ;; C++ header files
  (push `(,(lambda () (and (f-ext? buffer-file-name "h")
                      (or (f-exists? (f-swap-ext buffer-file-name "cpp"))
                          (awhen (car-safe (projectile-get-other-files (buffer-file-name) (projectile-current-project-files)))
                            (f-ext? it "cpp")))))
          . c++-mode)
        magic-mode-alist)

  ;; Obj-C
  (push `(,(lambda () (and (f-ext? buffer-file-name "h")
                      (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))
          . objc-mode)
        magic-mode-alist)

  :config
  (def-electric! (c-mode c++-mode objc-mode) :chars (?\n ?\}))
  (def-company-backend! (c-mode c++-mode objc-mode) (irony-c-headers irony))

  (setq c-tab-always-indent nil
        c-electric-flag nil)

  (map! :map c-mode-base-map (:localleader :nv ";" 'narf/append-semicolon))

  (sp-with-modes '(c-mode c++-mode objc-mode java-mode)
    (sp-local-pair "<" ">" :when '(narf/sp-point-is-template-p narf/sp-point-after-include-p))
    (sp-local-pair "/*" "*/" :post-handlers '(("||\n[i]" "RET") ("| " "SPC")))
    ;; Doxygen blocks
    (sp-local-pair "/**" "*/" :post-handlers '(("||\n[i]" "RET") ("||\n[i]" "SPC")))
    (sp-local-pair "/*!" "*/" :post-handlers '(("||\n[i]" "RET") ("[d-1]< | " "SPC"))))

  ;; Improve indentation of inline lambdas in C++11
  (advice-add 'c-lineup-arglist :around 'narf/c-lineup-arglist))

(use-package irony
  :after cc-mode
  :config
  (setq irony-server-install-prefix (concat narf-temp-dir "/irony/"))
  (add-hook! c++-mode
    (make-variable-buffer-local 'irony-additional-clang-options)
    (push "-std=c++11" irony-additional-clang-options))

  (require 'irony-eldoc)
  (require 'company-irony)
  (require 'company-irony-c-headers)
  (require 'flycheck-irony)
  (flycheck-irony-setup)

  ;; some c-mode dervied modes wrongfully trigger these hooks (like php-mode)
  (add-hook! (c-mode c++-mode ojbc-mode)
    (when (memq major-mode '(c-mode c++-mode objc-mode))
      (flycheck-mode +1)
      (irony-mode +1)
      (eldoc-mode +1)
      (irony-eldoc +1))))

(use-package disaster :commands (disaster))

;;
(use-package cmake-mode
  :mode "CMakeLists\\.txt$"
  :config (def-company-backend! cmake-mode (cmake yasnippet)))

(use-package company-cmake :after cmake-mode)

(use-package glsl-mode :mode ("\\.glsl\\'" "\\.vert\\'" "\\.frag\\'" "\\.geom\\'"))

(use-package cuda-mode :mode "\\.cuh?$")

(use-package opencl-mode :mode "\\.cl$")

(use-package demangle-mode
  :commands demangle-mode
  :init (add-hook 'llvm-mode-hook 'demangle-mode))

(provide 'module-cc)
;;; module-cc.el ends here

{'fraction_non_alphanumeric': 0.21961184882533197, 'fraction_numerical': 0.0040858018386108275, 'mean_word_length': 2.872775214238629, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539621', 'n_tokens_mistral': 2388, 'n_tokens_neox': 2287, 'n_words': 449}