File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -196,18 +196,20 @@ should save your files with unix style end of line."
196196 (if drupal-version
197197 drupal-version
198198 (dolist (file '(" modules/system/system.module" " includes/bootstrap.inc" " core/includes/bootstrap.inc" ))
199- (let ((dir (locate-dominating-file buffer-file-name file)))
200- (when dir
201- (with-current-buffer (find-file-noselect (concat dir file) t )
202- (save-excursion
203- (goto-char (point-min ))
204- (when (re-search-forward " \\ (define('VERSION',\\ |const VERSION =\\ ) +'\\ (.+\\ )'" nil t )
205- (dir-locals-set-class-variables 'drupal-class `((nil . ((drupal-version . ,(match-string-no-properties 2 ))))))
206- (dir-locals-set-directory-class dir 'drupal-class )))
207- (setq drupal-version (match-string-no-properties 2 ))
208- )
209- (hack-local-variables ))))
210- drupal-version))
199+ (let ((here (or buffer-file-name dired-directory )))
200+ (when here
201+ (let ((dir (locate-dominating-file here file)))
202+ (when dir
203+ (with-current-buffer (find-file-noselect (concat dir file) t )
204+ (save-excursion
205+ (goto-char (point-min ))
206+ (when (re-search-forward " \\ (define('VERSION',\\ |const VERSION =\\ ) +'\\ (.+\\ )'" nil t )
207+ (dir-locals-set-class-variables 'drupal-class `((nil . ((drupal-version . ,(match-string-no-properties 2 ))))))
208+ (dir-locals-set-directory-class dir 'drupal-class )))
209+ (setq drupal-version (match-string-no-properties 2 ))
210+ )))
211+ (hack-local-variables )
212+ drupal-version)))))
211213
212214(defun drupal-major-version (&optional version )
213215 " Return major version number of version string.
You can’t perform that action at this time.
0 commit comments