.dir-locals.el is difficult to use with drupal-mode#42
.dir-locals.el is difficult to use with drupal-mode#42
Conversation
In a better way than 4adeb0c.
This way it is easier to also add the mnemonic keys / functions to other
key bindings. I.e. I do the following in my .emacs to map them to the
hyper key:
```
(add-hook 'drupal-mode-hook (lambda ()
(dolist (elem drupal-mode-map-alist)
(local-set-key `[(hyper ,(car elem))] (cdr elem)))))
```
`whitespace-style` not only decides what kind of whitespace gets highlighted by `whitespace-mode` but also what kind of whitespace gets removed by `whitespace-cleanup`.
Updated phpcs patterns to new flycheck format.
Released 0.4.0.
Implemented our own versions of `flymake-create-temp-inplace` and `flymake-create-temp-intemp`. We need them to ensure better temporary file names to comply well with Drupal Coder Sniffer. We need the new `drupal/flymake-phpcs-init` to call our own temporary file name functions. Simplified setting `flymake-allowed-file-name-masks`.
|
My mistake, I see this is mostly a duplicate of issue #12. Feel free to close it so that any other discussion happens over there. |
|
Hi, @joddie. You are right this is a duplicate of #12. Trying to use dir-locals in `drupal-detect-drupal-version' was a choice I made a long time ago. I have been wanting do a cleanup but never got around to it - until now! Thank you for beating me to it! Please have a look at the I'll continue the work in #12 (and hope you don't mind I accidentally turned this issue into a pull request against the master branch). |
|
Sorry I took so long to reply to this, but thank you for the fix! This will be really useful to me. |
I experience problems trying to set directory-local variables for a Drupal project using a
.dir-locals.elfile when drupal-mode is enabled.Here is a test case: create a
.dir-locals.elfile at the root of a Drupal project with the following contents:This should set the variable
my-test-variableto the symbolfoofor files in any mode within the directory. (Becausemy-test-variablelacks adefvardeclaring it a safe varaiable, Emacs will also pop up a warning whenever these variables are applied).Starting from a new Emacs instance with drupal-mode installed, before any PHP files within the project are visited, the dir-locals are applied as expected (and cause a warning for each file opened). They are also applied the first PHP file visited within the project. However, after this, the dir-locals are not applied to any subsequent files opened within the project (whether they are in PHP or any other mode).
I suspect this problem arises because of the way that drupal-mode's
drupal-detect-drupal-versionuses thedir-locals-set-directory-classanddir-locals-set-class-variablesfunctions: the "directory class" set for the directory then takes precedence over the contents of.dir-locals.elfiles in the filesystem. If this is the case, a possible fix might be fordrupal-detect-drupal-versionto merge any existing variables fromdir-local-variables-alisttogether with its own dir-local values before callingdir-locals-set-class-variables. If you like, I can try this out and submit a patch. Otherwise, let me know if you can reproduce this or would like more information.Thanks for drupal-mode!