Commit 7a7824e
committed
Fall back on an HTML mode for Blade when web-mode is missing
Opening a .blade.php file without web-mode installed did not warn and
carry on -- it failed. php-derivation-major-mode warned but left MODE
set to the unavailable web-mode, so php-mode-maybe went on to funcall it
and signalled void-function. Every other template zeroed MODE and fell
back on php-default-major-mode; Blade was the one case that could not
open at all.
Degrade instead. A Blade template is mostly HTML plus Blade's own
directives -- it is not PHP, so php-mode cannot read it either -- and an
HTML mode renders the bulk of it correctly. The new
php-blade-template-major-mode-fallback names the modes to try
(mhtml-mode then html-mode, both built in); set it to nil to opt out and
get php-default-major-mode as before. The warning now says which mode
was substituted rather than claiming Blade is unsupported.
The fallback deliberately applies to Blade only. Other templates are
PHP with HTML in them, which php-mode does read, and they share
php-html-template-major-mode with the auto-detection path --
php-project-php-file-as-template defaults to `auto', so any .php file
holding an HTML tag reaches it. Extending the fallback there would take
most PHP files away from php-mode for everyone without web-mode. A test
pins that behaviour down.
Avoids seq-find: seq is not preloaded on every supported Emacs.1 parent a357bc8 commit 7a7824e
2 files changed
Lines changed: 83 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
183 | 197 | | |
184 | 198 | | |
185 | 199 | | |
| |||
623 | 637 | | |
624 | 638 | | |
625 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
626 | 647 | | |
627 | 648 | | |
628 | 649 | | |
| |||
638 | 659 | | |
639 | 660 | | |
640 | 661 | | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
645 | 675 | | |
646 | 676 | | |
647 | 677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
699 | 699 | | |
700 | 700 | | |
701 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
702 | 751 | | |
703 | 752 | | |
704 | 753 | | |
| |||
0 commit comments