Public bug reported: >From clang-format-3.5 to clang-format-3.6, the definition of clang- format-region changed in clang-format.el.
The old definition was this: (defun clang-format-region () "Use clang-format to format the currently active region." (interactive) (let ((beg (if mark-active (region-beginning) (min (line-beginning-position) (1- (point-max))))) (end (if mark-active (region-end) (line-end-position)))) (clang-format beg end))) The new definition begins thus: (defun clang-format-region (char-start char-end &optional style) "Use clang-format to format the code between START and END according to STYLE. If called interactively uses the region or the current statement if there is no active region. If no style is given uses `clang-format-style'." (interactive (if (use-region-p) (list (region-beginning) (region-end)) (list (point) (point)))) ... (It continues quite a bit longer.) The call to use-region-p always returns false if transient-mark-mode is turned off, e.g. via (transient-mark-mode nil). This causes clang- format-region always to format the current line and never the selected region. This is a fix, barring some further subtlety I've missed: (interactive (if mark-active (list (region-beginning) (region-end)) (list (point) (point)))) ProblemType: Bug DistroRelease: Ubuntu 15.10 Package: clang-format-3.7 1:3.7-2ubuntu1 ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3 Uname: Linux 4.2.0-16-generic x86_64 ApportVersion: 2.19.1-0ubuntu3 Architecture: amd64 CurrentDesktop: i3 Date: Sat Oct 31 17:34:38 2015 EcryptfsInUse: Yes InstallationDate: Installed on 2015-10-23 (8 days ago) InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Release amd64 (20150422) SourcePackage: llvm-toolchain-3.7 UpgradeStatus: Upgraded to wily on 2015-10-23 (8 days ago) ** Affects: llvm-toolchain-3.7 (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug wily -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1511978 Title: clang-format-region assumes transient-mark-mode To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-3.7/+bug/1511978/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs