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

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

[nongnu] elpa/drupal-mode 55a523b65f 046/308: No need to restart check s


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 55a523b65f 046/308: No need to restart check since flymake-phpcs 1.0.4
Date: Tue, 25 Jan 2022 10:59:17 -0500 (EST)

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

    No need to restart check since flymake-phpcs 1.0.4
---
 drupal-mode.el          | 79 +++++++++++++++++++++++++++++--------------------
 drupal/flymake-phpcs.el |  7 +----
 2 files changed, 48 insertions(+), 38 deletions(-)

diff --git a/drupal-mode.el b/drupal-mode.el
index 96af6da75a..c56d2269ff 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -167,7 +167,8 @@ Include path to the executable if it is not in your $PATH."
   :keymap drupal-mode-map
 
   ;; Detect drupal version, drupal root, etc.
-  (drupal-detect-drupal-version)
+  (unless drupal-version
+    (drupal-detect-drupal-version))
 
   ;; Delete trailing white space.
   (when (eq drupal-delete-trailing-whitespace 'always)
@@ -253,6 +254,15 @@ of the project)."
   (cons "Drupal" (make-sparse-keymap "Drupal")))
 
 ;; Define specific subcommands in this menu.
+(define-key drupal-mode-map
+  [menu-bar drupal flattr]
+  '("Flattr Drupal Mode" . (lambda () (interactive) (browse-url 
"https://flattr.com/thing/511837";))))
+(define-key drupal-mode-map
+  [menu-bar drupal github]
+  '("Drupal Mode on GitHub" . (lambda () (interactive) (browse-url 
"https://github.com/arnested/drupal-mode";))))
+(define-key drupal-mode-map
+  [menu-bar drupal separator]
+  '("--"))
 (define-key drupal-mode-map
   [menu-bar drupal customize]
   '("Customize Drupal Mode" . (lambda () (interactive) (customize-group 
'drupal))))
@@ -302,44 +312,49 @@ should save your files with unix style end of line."
 
 
 
+(defvar drupal-detect-drupal-version-in-progress nil
+  "Detect in progress.")
+
 ;; Detect Drupal and Drupal version
 (defun drupal-detect-drupal-version ()
   "Detect if the buffer is part of a Drupal project.
 If part of a Drupal project also detect the version of Drupal and
 the location of DRUPAL_ROOT."
   (interactive)
-  (hack-local-variables)
-  (when (not drupal-version)
-    (dolist (file '("modules/system/system.module" "includes/bootstrap.inc" 
"core/includes/bootstrap.inc"))
-      (let ((here (or buffer-file-name dired-directory)))
-        (when here
-          (let ((dir (locate-dominating-file here file)))
-            (when dir
-              (with-current-buffer (find-file-noselect (concat dir file) t)
-                (save-excursion
-                  (widen)
-                  (goto-char (point-min))
-                  (when (re-search-forward "\\(define('VERSION',\\|const 
VERSION =\\) +'\\(.+\\)'" nil t)
-                    (dir-locals-set-class-variables 'drupal-site `((nil . 
((drupal-version . ,(match-string-no-properties 2))
-                                                                           
(drupal-rootdir . ,dir)))))
-                    (dir-locals-set-directory-class dir 'drupal-site)))
-                (setq drupal-version (match-string-no-properties 2)))))))))
-  (let ((module (drupal-locate-dominating-module buffer-file-name t))
-        (version drupal-version))
-    (when module
+  (unless drupal-detect-drupal-version-in-progress
+    (let ((drupal-detect-drupal-version-in-progress t))
+      (hack-local-variables)
       (when (not drupal-version)
-        (with-current-buffer (find-file-noselect module t)
-          (save-excursion
-            (widen)
-            (goto-char (point-min))
-            (re-search-forward "core *= *\"?\\(.+\\)\"?" nil t)
-            (setq version (match-string-no-properties 1)))))
-      (dir-locals-set-class-variables 'drupal-module `((nil . ((drupal-module 
. ,(file-name-nondirectory
-                                                                               
   (file-name-sans-extension module)))
-                                                               (drupal-version 
. ,version)))))
-      (dir-locals-set-directory-class (file-name-directory module) 
'drupal-module)))
-  (hack-local-variables)
-  drupal-version)
+        (dolist (file '("modules/system/system.module" 
"includes/bootstrap.inc" "core/includes/bootstrap.inc"))
+          (let ((here (or buffer-file-name dired-directory)))
+            (when here
+              (let ((dir (locate-dominating-file here file)))
+                (when dir
+                  (with-current-buffer (find-file-noselect (concat dir file) t)
+                    (save-excursion
+                      (widen)
+                      (goto-char (point-min))
+                      (when (re-search-forward "\\(define('VERSION',\\|const 
VERSION =\\) +'\\(.+\\)'" nil t)
+                        (dir-locals-set-class-variables 'drupal-site `((nil . 
((drupal-version . ,(match-string-no-properties 2))
+                                                                               
(drupal-rootdir . ,dir)))))
+                        (dir-locals-set-directory-class dir 'drupal-site)))
+                    (setq drupal-version (match-string-no-properties 2)))))))))
+      (let ((module (drupal-locate-dominating-module buffer-file-name t))
+            (version drupal-version))
+        (when module
+          (when (not drupal-version)
+            (with-current-buffer (find-file-noselect module t)
+              (save-excursion
+                (widen)
+                (goto-char (point-min))
+                (re-search-forward "core *= *\"?\\(.+\\)\"?" nil t)
+                (setq version (match-string-no-properties 1)))))
+          (dir-locals-set-class-variables 'drupal-module `((nil . 
((drupal-module . ,(file-name-nondirectory
+                                                                               
       (file-name-sans-extension module)))
+                                                                   
(drupal-version . ,version)))))
+          (dir-locals-set-directory-class (file-name-directory module) 
'drupal-module)))
+      (hack-local-variables)
+      drupal-version)))
 
 (defun drupal-locate-dominating-module (file &optional info-file-location)
   "Look up the directory hierarchy from FILE for a Drupal module root.
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 00e909449b..80d7951fec 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -34,12 +34,7 @@
     ;; 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))
-
-    ;; We have probably set `flymake-phpcs-standard' after a syntax
-    ;; check was initiated - so kill it and start syntax check again.
-    (flymake-stop-all-syntax-checks)
-    (flymake-start-syntax-check)))
+                 `(,(concat "\\." (file-name-extension (buffer-file-name)) 
"\\'") flymake-phpcs-init))))
 
 (add-hook 'drupal-mode-hook 'drupal/flymake-phpcs-enable)
 



reply via email to

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