-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add php-mode-maybe for auto-mode-alist #362
Conversation
This change can be simply replaced by I was wondering if I should abandon this patch. However, it may be able to help some users not familiar with PHP. |
I like the concept and I believe this is a useful change we should make. However, my opinion is that it would better if we simply added: ;;;###autoload
(progn
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode)
(add-to-list 'auto-mode-alist '("config\\.php\\'" . php-mode) We could put this at the end of Do Blade templates require the extension Right now I think we should take the approach of using @syohex I would really appreciate hearing your opinion on this before making any change. I believe we should introduce additional calls to modify @zonuexe Thank you for the patch and raising the issue. For now let's add additional entries to |
I should also add, I do not believe that modifying And finally, no matter what we do, let's update the README to describe PHP Mode's lack of usefulness for Blade templates. |
The new function `php-mode-maybe` is wrapper for auto-mode-alist that invokes another function that is not php-mode under certain conditions. One of them is the Bladetemplate. This file generally has .blade.php extension, but it can not be edited in php-mode. Fortunately web-mode supports Blade templates. When web-mode is not installed in Emacs, simply announce warn and notify the user that php-mode is not suitable for editing the blade file.
Use 'php-mode-maybe instead of 'php-mode. Invoke php-mode or the appropriate major mode when open the file.
@ejmr |
@zonuexe Thank you for the pull-requests. I just finished a comment on the other, but I will look over both of them a second time tonight. I will probably make a few small tweaks but also will merge the changes in the next twenty-four hours unless some major problem arises (which I really doubt will happen). |
@zonuexe I am very sorry for the long delay in cleaning this up and merging it. I have been having serious health problems---kidney failure---so I simply haven't had the time or energy to write all this month. Nonethelss I still intended to merge this as soon as I feel better and get things under control. I am really sorry about the delay, but thank you very much for being patient. |
@ejmr |
This change is somewhat strange, but the code is simple.
I kept this patch for four months, but I think that this PR may not be accepted.
The new function
feature/integrates-other-mode
abandons the work of php-mode under certain conditions and invoke another major mode. This implementation is a bit odd but you can delegate files that are not good for php-mode to other major modes.One of them is the Blade template. This file generally has
.blade.php
extension, but it can not be edited in php-mode. Fortunately web-mode supports Blade templates. When web-mode is not installed in Emacs, simply announce warn and notify the user that php-mode is not suitable for editing the blade file.Back ground 1
Currently, many php-mode users can not open
config.php
. Whenphp-mode
is auto loaded, its priority is lower inauto-mode-alist
due to theappend
flag ofadd-to-list
. Because of that,/config.php
matchesconf-maybe-mode
.Although I think that the
append
flag should be removed, I am worried that it may break the end users' setting compatibility.Back ground 2
Blade template file name has
.blade.php
extension.Because the template language has its own control syntax, php-mode is useless.