From 0cd78cfdefcf1c58918c3cca23a2a034acf2bf67 Mon Sep 17 00:00:00 2001 From: "OHASHI, Norikazu" Date: Sat, 8 Aug 2020 08:43:48 +0900 Subject: [PATCH] clang tidy add, meta-key config --- .../flycheck-clang-tidy-autoloads.el | 28 +++ .../flycheck-clang-tidy-pkg.el | 2 + .../flycheck-clang-tidy.el | 194 ++++++++++++++++++ .../flycheck-clang-tidy.elc | Bin 0 -> 8641 bytes inits/11_meta-key.el | 12 ++ 5 files changed, 236 insertions(+) create mode 100644 elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-autoloads.el create mode 100644 elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-pkg.el create mode 100644 elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.el create mode 100644 elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.elc create mode 100644 inits/11_meta-key.el diff --git a/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-autoloads.el b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-autoloads.el new file mode 100644 index 0000000..26f9a13 --- /dev/null +++ b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-autoloads.el @@ -0,0 +1,28 @@ +;;; flycheck-clang-tidy-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "flycheck-clang-tidy" "flycheck-clang-tidy.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from flycheck-clang-tidy.el + +(autoload 'flycheck-clang-tidy-setup "flycheck-clang-tidy" "\ +Setup Flycheck clang-tidy. + +\(fn)" nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flycheck-clang-tidy" '("flycheck-clang-tidy-"))) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; flycheck-clang-tidy-autoloads.el ends here diff --git a/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-pkg.el b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-pkg.el new file mode 100644 index 0000000..7acd65e --- /dev/null +++ b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy-pkg.el @@ -0,0 +1,2 @@ +;;; -*- no-byte-compile: t -*- +(define-package "flycheck-clang-tidy" "20191030.814" "Flycheck syntax checker using clang-tidy" '((flycheck "0.30")) :commit "2ae5542960785604a2974548f89e10407e2ccfc1" :keywords '("convenience" "languages" "tools") :authors '((nil . "Sebastian Nagel")) :maintainer '("tastytea" . "tastytea@tastytea.de") :url "https://github.com/ch1bo/flycheck-clang-tidy") diff --git a/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.el b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.el new file mode 100644 index 0000000..4e5cd30 --- /dev/null +++ b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.el @@ -0,0 +1,194 @@ +;;; flycheck-clang-tidy.el --- Flycheck syntax checker using clang-tidy -*- lexical-binding:t -*- + +;; Author: Sebastian Nagel +;; Maintainer: tastytea +;; URL: https://github.com/ch1bo/flycheck-clang-tidy +;; Package-Commit: 2ae5542960785604a2974548f89e10407e2ccfc1 +;; Keywords: convenience languages tools +;; Package-Version: 20191030.814 +;; Package-X-Original-Version: 0.3.0 +;; Package-Requires: ((flycheck "0.30")) + +;; This file is NOT part of GNU Emacs. +;; See LICENSE + +;;; Commentary: + +;; Adds a Flycheck syntax checker for C/C++ based on clang-tidy. + +;;; Usage: + +;; (eval-after-load 'flycheck +;; '(add-hook 'flycheck-mode-hook #'flycheck-clang-tidy-setup)) + + +;;; Code: + +(require 'flycheck) +(require 'dom) + +;; To keep variable names consistent. +(defvaralias 'flycheck-clang-tidy-executable 'flycheck-c/c++-clang-tidy-executable) + +(flycheck-def-config-file-var flycheck-clang-tidy c/c++-clang-tidy ".clang-tidy" + :type 'string + :safe #'stringp) + +(flycheck-def-option-var flycheck-clang-tidy-build-path "build" c/c++-clang-tidy + "Build path to read a compile command database. + +For example, it can be a CMake build directory in which a file named +compile_commands.json exists (use -DCMAKE_EXPORT_COMPILE_COMMANDS=ON +CMake option to get this output)." + :type 'string + :safe #'stringp) + +(flycheck-def-option-var flycheck-clang-tidy-extra-options nil c/c++-clang-tidy + "Extra options to pass to clang-tidy. Set to `nil' to disable." + :type 'string + :safe #'stringp) + +(defun flycheck-clang-tidy-find-project-root (checker) + "Find the project root for CHECKER using Projectile, vc or the .clang-tidy file." + (let ((project-root nil)) + (if (member 'projectile-mode minor-mode-list) + (setq project-root (projectile-project-root))) + (unless project-root + (setq project-root (vc-root-dir))) + (unless project-root + (let ((config_file_location (flycheck-locate-config-file flycheck-clang-tidy checker))) + (if config_file_location + (setq project-root (file-name-directory config_file_location))))) + (unless project-root + (message "Could not determine project root, trying current directory.") + (setq project-root (flycheck-clang-tidy-current-source-dir))) + project-root)) + +(defun flycheck-clang-tidy-current-source-dir () + "Directory of current source file." + (file-name-directory (buffer-file-name))) + +(defun flycheck-clang-tidy-get-config () + "Find and read .clang-tidy." + (let ((config-file (flycheck-locate-config-file flycheck-clang-tidy 0))) + (when config-file + (with-temp-buffer + (insert-file-contents config-file) + (buffer-string))))) + +(defun flycheck-clang-tidy--skip-http-headers () + "Position point just after HTTP headers." + (re-search-forward "^$")) + +(defun flycheck-clang-tidy--narrow-to-http-body () + "Narrow the current buffer to contain the body of an HTTP response." + (flycheck-clang-tidy--skip-http-headers) + (narrow-to-region (point) (point-max))) + +(defun flycheck-clang-tidy--decode-region-as-utf8 (start end) + "Decode a region from START to END in UTF-8." + (condition-case nil + (decode-coding-region start end 'utf-8) + (coding-system-error nil))) + +(defun flycheck-clang-tidy--remove-crlf () + "Remove carriage return and line feeds from the current buffer." + (save-excursion + (while (re-search-forward "\r$" nil t) + (replace-match "" t t)))) + +(defun flycheck-clang-tidy--extract-relevant-doc-section () + "Extract the parts of the LLVM clang-tidy documentation that are relevant. + +This function assumes that the current buffer contains the result +of browsing 'clang.llvm.org', as returned by `url-retrieve'. +More concretely, this function returns the main
element +with class 'section', and also removes 'headerlinks'." + (goto-char (point-min)) + (flycheck-clang-tidy--narrow-to-http-body) + (flycheck-clang-tidy--decode-region-as-utf8 (point-min) (point-max)) + (flycheck-clang-tidy--remove-crlf) + (let* ((dom (libxml-parse-html-region (point-min) (point-max))) + (section (dom-by-class dom "section"))) + (dolist (headerlink (dom-by-class section "headerlink")) + (dom-remove-node section headerlink)) + section)) + +(defun flycheck-clang-tidy--explain-error (explanation &rest args) + "Explain an error in the Flycheck error explanation buffer using EXPLANATION. + +EXPLANATION is a function with optional ARGS that, when +evaluated, inserts the content in the appropriate Flycheck +buffer." + (with-current-buffer flycheck-explain-error-buffer + (let ((inhibit-read-only t) + (inhibit-modification-hooks t)) + (erase-buffer) + (apply explanation args) + (goto-char (point-min))))) + +(defun flycheck-clang-tidy--show-documentation (error-id) + "Show clang-tidy documentation about ERROR-ID. + +Information comes from the clang.llvm.org website." + (url-retrieve (format + "https://clang.llvm.org/extra/clang-tidy/checks/%s.html" error-id) + (lambda (status) + (if-let ((error-status (plist-get status :error))) + (flycheck-clang-tidy--explain-error + #'insert + (format + "Error accessing clang-tidy documentation: %s" + (error-message-string error-status))) + (let ((doc-contents + (flycheck-clang-tidy--extract-relevant-doc-section))) + (flycheck-clang-tidy--explain-error + #'shr-insert-document doc-contents))))) + "Loading documentation...") + +(defun flycheck-clang-tidy-error-explainer (error) + "Explain a clang-tidy ERROR by scraping documentation from llvm.org." + (unless (fboundp 'libxml-parse-html-region) + (error "This function requires Emacs to be compiled with libxml2")) + (if-let (err-message (flycheck-error-message error)) + (if-let (((string-match "\\[\\(.*\\)\\]" err-message)) + (clang-tidy-error-id (match-string 1 err-message))) + (condition-case err + (flycheck-clang-tidy--show-documentation clang-tidy-error-id) + (error + (format + "Error accessing clang-tidy documentation: %s" + (error-message-string err)))) + (error "The clang-tidy error message does not contain an [error-id]")) + (error "Flycheck error does not contain an error message"))) + +(flycheck-define-checker c/c++-clang-tidy + "A C/C++ syntax checker using clang-tidy. + +See URL `https://github.com/ch1bo/flycheck-clang-tidy'." + :command ("clang-tidy" + (option "-p" flycheck-clang-tidy-build-path) + (eval (concat "-extra-arg=-I" (flycheck-clang-tidy-current-source-dir))) + (eval (concat "-config=" (flycheck-clang-tidy-get-config))) + (eval flycheck-clang-tidy-extra-options) + source) + :error-patterns + ((error line-start (file-name) ":" line ":" column ": error: " + (message) line-end) + (warning line-start (file-name) ":" line ":" column ": warning: " + (message) line-end) + (info line-start (file-name) ":" line ":" column ": note: " + (message) line-end)) + :modes (c-mode c++-mode) + :working-directory flycheck-clang-tidy-find-project-root + :error-explainer flycheck-clang-tidy-error-explainer + :predicate (lambda () (buffer-file-name)) + :next-checkers ((error . c/c++-cppcheck))) + +;;;###autoload +(defun flycheck-clang-tidy-setup () + "Setup Flycheck clang-tidy." + (add-to-list 'flycheck-checkers 'c/c++-clang-tidy)) + +(provide 'flycheck-clang-tidy) +;;; flycheck-clang-tidy.el ends here diff --git a/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.elc b/elpa/flycheck-clang-tidy-20191030.814/flycheck-clang-tidy.elc new file mode 100644 index 0000000000000000000000000000000000000000..3569a9ba71b5939a76325a69a560e821275533b6 GIT binary patch literal 8641 zcmcIq`ET3E70!VISr_}uwm`9q0)3&gv6YyzNJ{dNX0fi1uCb1j+D=g*ayJw?vbd&5 zEr+tB0{!3ny_w;m!*z;91IQ9NGjERfz3&~9SBEG2e|YfV!OE*wuV_CVjiXqE>LE(# zaO4M)ZbT-dG$FU!^i<1jln=>|V@k()G>ZP^=V+GA71ek#j3f;pg(gx+3a5!biUJDL zK;~JLT*(czW-=!~3`I!gEY42T-C2+krjU`OIR$Bw`{+E$2lh7JB=+9<{_!ydLqGF_ z9826#)B8zCGNr&zs4pl^{h3M3RwM~OizAUyK14^?)AQm8e$_u-z_0zcva+(?pXS02 z(om4q^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5@dSsDB;0+ zVc%uYjm0>zW!}5m5DdA9}s@=8Imh(d%7uii9|;0I@^sYE+|=Qit;rGAT&m@Yh=q zjs^R!EKjfBm>Hlycl84|`9XEDqY(SB3O8h&=d%7Y5@9<##t(N}I+$K|)uKs9qAqdP=xoy+@0UDzaxOfu}vR0?gXWvaTX zMfZ|wHdWo{A` zx&QLzT%Fg{CaX;;jhqWX@6S%?W8to^prT2?iCN&8oqoDm&R>mO{u_V^ORmHp@;0l*fukVmi)vcRCP;DVS7e$bkx6DSe&m;{x4O@=Cm216pr#L~IA$#8CvwQK40ntudoJQ*c; zr|D-GMW}T{T@5WjBq8>L5=_EY!Fl=T%QU0zlo}zB{2xW4a4PPQSDr-W(3hSfQ+^Rw z!T5K%=8IDcbn%z(Q27m{jWZE)m@Q2803|oX?#iL+sJdRv#GSz|cmWkiZP}F`n#Cp3 zc&ysgRaTBv7iBF(Qn)iwRp{N@G`q$b*NVo=mcLMS$9=#KS9no7#dQR3zK)8-t1^)L zGiO{zVrW^>f}_wC5)NcJg24ZC;NsU@9lhAqxwAA{5t`T_rSD F{sV^e>DT}O literal 0 HcmV?d00001 diff --git a/inits/11_meta-key.el b/inits/11_meta-key.el new file mode 100644 index 0000000..25170b8 --- /dev/null +++ b/inits/11_meta-key.el @@ -0,0 +1,12 @@ +;;; 11_meta-key.el --- option key の設定 +;;; Commentary: +;;; +;;; Code: + +(when (eq window-system 'mac) + (setq mac-command-modifier 'none) + (setq mac-option-modifier 'meta) + (setq mac-right-option-modifier 'alt)) + +;;; 11_meta-key.el ends here + -- 2.19.2