Makes c-mode works ???

but very slow
This commit is contained in:
2022-01-18 19:38:06 +01:00
parent 71fdd55a54
commit 744fe00eda

66
.emacs
View File

@@ -1,3 +1,4 @@
;(toggle-debug-on-error)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(custom-set-variables (custom-set-variables
;; custom-set-variables was added by Custom. ;; custom-set-variables was added by Custom.
@@ -86,25 +87,6 @@
indent-relative-maybe)) indent-relative-maybe))
(setq indent-tabs-mode nil)) (setq indent-tabs-mode nil))
ad-do-it)) ad-do-it))
(defmacro smart-tabs-advice (function offset)
`(progn
(defvaralias ',offset 'tab-width)
(defadvice ,function (around smart-tabs activate)
(cond
(indent-tabs-mode
(save-excursion
(beginning-of-line)
(while (looking-at "\t*\\( +\\)\t+")
(replace-match "" nil nil nil 1)))
(setq tab-width tab-width)
(let ((tab-width fill-column)
(,offset fill-column)
(wstart (window-start)))
(unwind-protect
(progn ad-do-it)
(set-window-start (selected-window) wstart))))
(t
ad-do-it)))))
(smart-tabs-advice c-indent-line c-basic-offset) (smart-tabs-advice c-indent-line c-basic-offset)
(smart-tabs-advice c-indent-region c-basic-offset) (smart-tabs-advice c-indent-region c-basic-offset)
(smart-tabs-add-language-support cmake cmake-mode-hook (smart-tabs-add-language-support cmake cmake-mode-hook
@@ -138,9 +120,6 @@
(smart-tabs-insinuate 'c 'javascript 'c++ 'cmake 'nxml 'protobuf 'html 'glsl) (smart-tabs-insinuate 'c 'javascript 'c++ 'cmake 'nxml 'protobuf 'html 'glsl)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; magit
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package magit (use-package magit
:commands (magit-status) :commands (magit-status)
@@ -153,46 +132,49 @@
(global-company-mode t) (global-company-mode t)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CMake
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-package cmake-mode (use-package cmake-mode
:config :config
(setq cmake-tab-width 4) (setq cmake-tab-width 4)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (use-package company-irony
;; Company :after (company irony)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; :config
; (add-to-list 'company-backends 'company-irony)
)
(use-package company-irony-c-headers
:after (company irony)
; :config
; (add-to-list 'company-backends 'company-irony-c-headers)
)
(use-package irony (use-package irony
:hook (c-mode-common)
:config :config
(push 'glsl-mode irony-supported-major-modes) (push 'glsl-mode irony-supported-major-modes)
(push 'protobuf-mode irony-supported-major-modes) (push 'protobuf-mode irony-supported-major-modes)
(push 'opencl-mode irony-supported-major-modes) (push 'opencl-mode irony-supported-major-modes)
(company-irony-setup-begin-commands)
(irony-cdb-autosetup-compile-options)
'(add-to-list
'company-backends
'(company-irony-c-headers company-irony company-yasnippet))
) )
(use-package srefactor (use-package srefactor
:hook (c-mode-common)
:bind (:map c-mode-map :bind (:map c-mode-map
("M-RET" . srefactor-refactor-at-point) ("M-RET" . srefactor-refactor-at-point)
:map c++-mode-map :map c++-mode-map
("M-RET" . srefactor-refactor-at-point)) ("M-RET" . srefactor-refactor-at-point))
) )
(use-package yasnippet (use-package yasnippet
:hook (c-mode-common) :after (company)
:bind ( :map yas-minor-mode-map :bind ( :map yas-minor-mode-map
("TAB" . nil) ("TAB" . nil)
) )
:config
; (add-to-list 'company-backends 'company-yasnippet)
)
(use-package yasnippet-snippets
:after (yasnippet)
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -224,7 +206,15 @@ header"
(require 'compile) (require 'compile)
(global-set-key (kbd "C-x f") 'find-file-at-point) (global-set-key (kbd "C-x f") 'find-file-at-point)
(c-set-offset 'inextern-lang 0) (c-set-offset 'inextern-lang 0)
(eval-after-load 'company
'(add-to-list
'company-backends
'(company-irony company-irony-c-headers company-yasnippet)))
(smart-tabs-mode) (smart-tabs-mode)
(irony-mode)
(yas-minor-mode-on)
(company-irony-setup-begin-commands)
(irony-cdb-autosetup-compile-options)
) )
(add-hook 'c-mode-common-hook 'my-c-common-hook) (add-hook 'c-mode-common-hook 'my-c-common-hook)