Я пытаюсь установить инструмент автоматического форматирования в формате clang, я установил clang-формат с M-x package-install clang-format
и вижу его в M-x list-packages
.
Мой ~ / .emacs:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
;; clang-format
(require 'clang-format)
(global-set-key [C-M-tab] 'clang-format-region)
(add-hook 'c-mode-common-hook
(function (lambda ()
(add-hook 'write-contents-functions
(lambda() (progn (clang-format-buffer) nil))))))
(add-hook 'cpp-mode-common-hook
(function (lambda ()
(add-hook 'write-contents-functions
(lambda() (progn (clang-format-buffer) nil))))))
;; irony-mode
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
;; company mode
(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode)
;; flycheck-mode
(add-hook 'c++-mode-hook 'flycheck-mode)
(add-hook 'c-mode-hook 'flycheck-mode)
(eval-after-load 'flycheck
'(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
;; eldoc-mode
(add-hook 'irony-mode-hook 'irony-eldoc)
(global-linum-mode)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(list-packages-ext clang-format flycheck-clang-tidy flycheck-clang-analyzer elpy irony-eldoc company-irony flycheck-irony flycheck irony))))
(custom-set-faces
;; custom-set-faces was added by Custom.
'(linum ((t (:inherit (shadow default) :foreground "yellow")))))
Но clang-формат не отображается внизу окна emacs, когда появляются Irony, FlyC, ElDoc и Abbrev.
Может ли кто-нибудь мне помочь?Спасибо!