branch: elpa/drupal-mode
commit 5c53b742fb17fd4fdafc03c881965b46e04fcd44
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>
Improved buffer-file-name fallbacks.
---
drupal-mode.el | 6 +++---
drupal/flymake-phpcs.el | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drupal-mode.el b/drupal-mode.el
index 82e5258ada..edbf9c693a 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -478,7 +478,7 @@ the location of DRUPAL_ROOT."
(when (or (not drupal-version)
(not drupal-rootdir))
(dolist (file '("modules/system/system.module" "includes/bootstrap.inc"
"core/includes/bootstrap.inc"))
- (let ((here (or buffer-file-name dired-directory)))
+ (let ((here (or buffer-file-name default-directory)))
(when here
(let ((dir (locate-dominating-file here file)))
(when dir
@@ -492,7 +492,7 @@ the location of DRUPAL_ROOT."
(dir-locals-set-directory-class dir 'drupal-site)))
(setq drupal-version (match-string-no-properties 2))))))))
(hack-local-variables))
- (let ((module (drupal-locate-dominating-module buffer-file-name t))
+ (let ((module (drupal-locate-dominating-module (or buffer-file-name
default-directory) t))
(version drupal-version)
(module-name nil)
(module-version nil)
@@ -608,7 +608,7 @@ mode-hook."
(drupal-detect-drupal-version)
(when drupal-version
(drupal-mode 1))
- (when (string-match "drush" buffer-file-name)
+ (when (string-match "drush" (or buffer-file-name default-directory))
(drupal-drush-mode 1))))
;;;###autoload
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 93ba660885..ead33ab7db 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -69,7 +69,7 @@ so no need to highlight it twice."
;; flymake-phpcs initialize.
(make-local-variable 'flymake-allowed-file-name-masks)
(add-to-list 'flymake-allowed-file-name-masks
- `(,(concat "\\." (file-name-extension (buffer-file-name))
"\\'") flymake-phpcs-init))
+ `(,(concat "\\." (file-name-extension (or buffer-file-name
(buffer-name))) "\\'") flymake-phpcs-init))
(flymake-mode 1)))
(add-hook 'drupal-mode-hook #'drupal/flymake-phpcs-enable)