Formats cmake file only if a project-wide configuration file is found
Otherwise do nothing.
This commit is contained in:
10
.emacs
10
.emacs
@@ -473,8 +473,14 @@
|
||||
(defun atu/cmake-format-buffer ()
|
||||
"Formats the current buffer using cmake-format"
|
||||
(interactive)
|
||||
(let ((error-buffer (atu/create-or-erase-buffer "*cmake-format:stderr*")))
|
||||
(let (
|
||||
(error-buffer (atu/create-or-erase-buffer "*cmake-format:stderr*"))
|
||||
(cmake-format-config-file-exists
|
||||
(file-exists-p (projectile-expand-root ".cmake-format.yaml"))
|
||||
)
|
||||
)
|
||||
(setq-local atu/after-save-message nil)
|
||||
(if cmake-format-config-file-exists
|
||||
(if (eq 0 (call-process-region
|
||||
;;region
|
||||
(point-min)
|
||||
@@ -501,6 +507,8 @@
|
||||
(buffer-name) error-buffer)
|
||||
(current-message)
|
||||
)
|
||||
(message "cmake-format: skipping as no configuration file found")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user