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