|
82 | 82 | (require 'regexp-opt)
|
83 | 83 | (defvar add-log-current-defun-header-regexp)
|
84 | 84 | (defvar add-log-current-defun-function)
|
| 85 | + (defvar c-syntactic-context) |
85 | 86 | (defvar c-vsemi-status-unknown-p)
|
86 | 87 | (defvar syntax-propertize-via-font-lock))
|
87 | 88 |
|
@@ -603,11 +604,39 @@ might be to handle switch and goto labels differently."
|
603 | 604 | (defun php-lineup-cascaded-calls (langelem)
|
604 | 605 | "Line up chained methods using `c-lineup-cascaded-calls',
|
605 | 606 | but only if the setting is enabled."
|
606 |
| - (if php-mode-lineup-cascaded-calls |
607 |
| - (c-lineup-cascaded-calls langelem) |
| 607 | + (cond |
| 608 | + (php-mode-lineup-cascaded-calls (c-lineup-cascaded-calls langelem)) |
| 609 | + ((assq 'arglist-cont-nonempty c-syntactic-context) nil) |
| 610 | + ((assq 'defun-block-intro c-syntactic-context) nil) |
| 611 | + ((assq 'defun-close c-syntactic-context) nil) |
| 612 | + ((assq 'statement-cont c-syntactic-context) nil) |
| 613 | + (t |
608 | 614 | (save-excursion
|
609 | 615 | (beginning-of-line)
|
610 |
| - (if (looking-at-p "\\s-*->") '+ nil)))) |
| 616 | + (let ((beginning-of-langelem (cdr langelem)) |
| 617 | + (beginning-of-current-line (point)) |
| 618 | + start) |
| 619 | + (skip-chars-forward " ") |
| 620 | + (cond |
| 621 | + ((looking-at-p "->") '+) |
| 622 | + ((looking-at-p "[:?]") '+) |
| 623 | + ((looking-at-p "[,;]") nil) |
| 624 | + ;; Is the previous line terminated with `,' ? |
| 625 | + ((progn |
| 626 | + (forward-line -1) |
| 627 | + (end-of-line) |
| 628 | + (skip-chars-backward " ") |
| 629 | + (backward-char 1) |
| 630 | + (while (and (< beginning-of-langelem (point)) |
| 631 | + (setq start (php-in-string-or-comment-p))) |
| 632 | + (goto-char start) |
| 633 | + (skip-chars-backward " ") |
| 634 | + (backward-char 1)) |
| 635 | + (and (not (eq (point) beginning-of-current-line)) |
| 636 | + (not (looking-at-p ",")) |
| 637 | + (not (php-in-string-or-comment-p)))) |
| 638 | + '+) |
| 639 | + (t nil))))))) |
611 | 640 |
|
612 | 641 | (defun php-c-looking-at-or-maybe-in-bracelist (&optional _containing-sexp lim)
|
613 | 642 | "Replace `c-looking-at-or-maybe-in-bracelist'.
|
|
0 commit comments