Skip to content

Commit 9bf1fcf

Browse files
committed
Fix indentation after functiono with return type
Work around zealous detection of c member initializers in cc-mode. Fixed in cc-mode starting from emacs 25.1, see commit: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=4765d24e18a947678bfa63b0351f68931484273c
1 parent 366be63 commit 9bf1fcf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

php-mode.el

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@
9393
(if (and (= emacs-major-version 24) (>= emacs-minor-version 4))
9494
(require 'cl)))
9595

96+
;; Work around https://github.com/ejmr/php-mode/issues/310.
97+
;;
98+
;; In emacs 24.4 and 24.5, lines after functions with a return type
99+
;; are incorrectly analyzed as member-init-cont.
100+
;;
101+
;; Before emacs 24.4, c member initializers are not supported this
102+
;; way. Starting from emacs 25.1, cc-mode only detects member
103+
;; initializers when the major mode is c++-mode.
104+
(eval-and-compile
105+
(if (and (= emacs-major-version 24) (or (= emacs-minor-version 4)
106+
(= emacs-minor-version 5)))
107+
(defun c-back-over-member-initializers ()
108+
;; Override of cc-engine.el, cc-mode in emacs 24.3 and 24.4 are too
109+
;; optimistic in recognizing c member initializers. Since we don't
110+
;; need it in php-mode, just return nil.
111+
nil)))
112+
96113

97114
;; Local variables
98115
;;;###autoload

0 commit comments

Comments
 (0)