emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/drupal-mode 07eaf83729 015/308: New var drupal-root. Use i


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 07eaf83729 015/308: New var drupal-root. Use it for `tags-file-name'.
Date: Tue, 25 Jan 2022 10:59:03 -0500 (EST)

branch: elpa/drupal-mode
commit 07eaf837295d61c60bc6e220de56caafa2ec700c
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    New var drupal-root. Use it for `tags-file-name'.
---
 drupal-mode.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index c8e4534298..ed9ac15514 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -82,6 +82,10 @@ According to http://drupal.org/coding-standards#indenting.";
 (make-variable-buffer-local 'drupal-version)
 (put 'drupal-version 'safe-local-variable 'string-or-null-p)
 
+(defvar drupal-root nil "Drupal project root as auto detected.")
+(make-variable-buffer-local 'drupal-root)
+(put 'drupal-root 'safe-local-variable 'string-or-null-p)
+
 (defvar drupal-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\C-cdf" 'drupal-search-documentation)
@@ -102,6 +106,12 @@ According to http://drupal.org/coding-standards#indenting.";
     (c-add-language 'drupal-mode 'c-mode)
     (c-set-style "drupal"))
 
+  ;; setup TAGS file for etags if it exists in DRUPAL_ROOT
+  (when (and (boundp 'drupal-root)
+            (file-exists-p (concat drupal-root "TAGS")))
+    (setq tags-file-name (concat drupal-root "TAGS")))
+
+  ;; handle line ending and trailing whitespace
   (add-hook 'before-save-hook 'drupal-convert-line-ending)
   (add-hook 'before-save-hook 'drupal-delete-trailing-whitespace))
 
@@ -204,7 +214,8 @@ should save your files with unix style end of line."
                (save-excursion
                  (goto-char (point-min))
                  (when (re-search-forward "\\(define('VERSION',\\|const 
VERSION =\\) +'\\(.+\\)'" nil t)
-                   (dir-locals-set-class-variables 'drupal-class `((nil . 
((drupal-version . ,(match-string-no-properties 2))))))
+                   (dir-locals-set-class-variables 'drupal-class `((nil . 
((drupal-version . ,(match-string-no-properties 2))
+                                                                           
(drupal-root . ,dir)))))
                    (dir-locals-set-directory-class dir 'drupal-class)))
                (setq drupal-version (match-string-no-properties 2))
                )))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]