Fix clang-format-region-or-buffer and change binding to C-c f

This commit is contained in:
Camden Dixie O'Brien 2023-05-14 18:01:22 +01:00
parent fbfa5e04a8
commit bf2e563410

View File

@ -1291,8 +1291,8 @@
(defun clang-format-region-or-buffer ()
"Format the region if it's active, otherwise format the entire buffer."
(interactive)
(if (region-active-p)
(clang-format-region)
(if (use-region-p)
(clang-format-region (region-beginning) (region-end))
(clang-format-buffer)))
#+end_src
@ -1302,7 +1302,7 @@
(add-hook
'c-mode-hook
(lambda ()
(define-key c-mode-map (kbd "C-M-f")
(define-key c-mode-map (kbd "C-c f")
'clang-format-region-or-buffer)))
#+end_src