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

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

[nongnu] elpa/drupal-mode f1985b5ca5 181/308: Merge branch 'release/0.4.


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode f1985b5ca5 181/308: Merge branch 'release/0.4.0'
Date: Tue, 25 Jan 2022 10:59:46 -0500 (EST)

branch: elpa/drupal-mode
commit f1985b5ca55cdc5ee9ed476b67e249c3298fe84e
Merge: a08207b0c9 b2ba37e71a
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Merge branch 'release/0.4.0'
---
 Makefile                |  4 ++--
 drupal-mode.el          | 46 ++++++++++++++++++++++++-----------------
 drupal/autoinsert.el    |  6 +++---
 drupal/emacs-drush.el   |  2 +-
 drupal/etags.el         |  4 ++--
 drupal/flycheck.el      | 24 ++++++++++++++--------
 drupal/flymake-phpcs.el | 54 +++++++++++++++++++++++++++++++++++++++++--------
 drupal/gtags.el         |  4 ++--
 drupal/phpcs.el         |  4 +---
 9 files changed, 101 insertions(+), 47 deletions(-)

diff --git a/Makefile b/Makefile
index fa4603b339..808de21563 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@
 
 CASK?=cask
 EMACS?=emacs
-TAR?=bsdtar
+TAR?=COPYFILE_DISABLE=1 bsdtar
 PANDOC?=pandoc --atx-headers
 
 VERSION?=$(shell $(CASK) version)
@@ -46,7 +46,7 @@ $(ARCHIVE_NAME)-pkg.el: $(ARCHIVE_NAME).el
 
 # create a tar ball in package.el format for uploading to 
http://marmalade-repo.org
 $(PACKAGE_NAME).tar: README $(ARCHIVE_NAME).el $(ARCHIVE_NAME)-pkg.el 
$(ARCHIVE_NAME).info dir drupal/*.el drupal-tests.el drush-make-mode.el
-       COPYFILE_DISABLE=1 $(TAR) -c -s "@^@$(PACKAGE_NAME)/@" -f 
$(PACKAGE_NAME).tar $^
+       $(TAR) -c -s "@^@$(PACKAGE_NAME)/@" -f $(PACKAGE_NAME).tar $^
 
 install: $(PACKAGE_NAME).tar
        $(EMACS) --batch -l package -f package-initialize --eval 
"(package-install-file \"$(PWD)/$(PACKAGE_NAME).tar\")"
diff --git a/drupal-mode.el b/drupal-mode.el
index 2773a0203d..d74620b5a9 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -1,11 +1,11 @@
 ;;; drupal-mode.el --- Advanced minor mode for Drupal development
 
-;; Copyright (C) 2012, 2013 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 ;; URL: https://github.com/arnested/drupal-mode
 ;; Created: January 17, 2012
-;; Version: 0.3.1
+;; Version: 0.4.0
 ;; Package-Requires: ((php-mode "1.5.0"))
 ;; Keywords: programming, php, drupal
 
@@ -36,7 +36,7 @@
 (require 'php-mode)
 (require 'format-spec)
 
-(eval-when-compile 
+(eval-when-compile
   (require 'css-mode))
 
 
@@ -62,7 +62,7 @@ If `Ask' ask the user whether to convert line endings.
 
 Drupal coding standards states that all text files should end in
 a single newline (\\n)."
-  :type `(choice 
+  :type `(choice
           :tag " we offer to change line endings if needed?"
           (const :tag "Always" t)
           (const :tag "Never" nil)
@@ -83,7 +83,7 @@ If `Default' do what the global setting is.
 
 Drupal coding standards states that lines should have no trailing
 whitespace at the end."
-  :type `(choice 
+  :type `(choice
           :tag "Whether to delete all the trailing whitespace."
           (const :tag "Always" always)
           (const :tag "Default" default)
@@ -98,6 +98,7 @@ whitespace at the end."
 %s is the search term."
   :type '(choice (const :tag "Api.drupal.org" 
"http://api.drupal.org/api/search/%v/%s";)
                  (const :tag "Api.drupalcontrib.org" 
"http://api.drupalcontrib.org/api/search/%v/%s";)
+                 (const :tag "Api.drupalize.me" 
"http://api.drupalize.me/api/search/%v/%s";)
                  (string :tag "Other" "http://example.com/api/search/%v/%s";))
   :link '(url-link :tag "api.drupalcontrib.org" "http://api.drupalcontrib.org";)
   :link '(url-link :tag "api.drupal.org" "http://api.drupal.org";)
@@ -188,14 +189,23 @@ Include path to the executable if it is not in your 
$PATH."
 (make-variable-buffer-local 'drupal-project)
 (put 'drupal-project 'safe-local-variable 'string-or-null-p)
 
+(defvar drupal-mode-map-alist
+  '((?d . drupal-search-documentation)
+    (?c . drupal-drush-cache-clear)
+    (?h . drupal-insert-hook)
+    (?f . drupal-insert-function)
+    (?m . drupal-module-name)
+    (?t . drupal-wrap-string-in-t-function))
+  "Map of mnemonic keys and functions for keyboard shortcuts.
+See `drupal-mode-map'.")
+
 (defvar drupal-mode-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [(control c) (control v) (control d)] 
#'drupal-search-documentation)
-    (define-key map [(control c) (control v) (control c)] 
#'drupal-drush-cache-clear)
-    (define-key map [(control c) (control v) (control h)] #'drupal-insert-hook)
-    (define-key map [(control c) (control v) (control f)] 
#'drupal-insert-function)
-    (define-key map [(control c) (control v) (control m)] #'drupal-module-name)
-    (define-key map [(control c) (control v) (control t)] 
#'drupal-wrap-string-in-t-function)
+    ;; Iterate `drupal-mode-map-alist' and assign the functions to the
+    ;; mode map on C-c C-v C-`mnemonic-key'.
+    (dolist (elem drupal-mode-map-alist)
+      (define-key map `[(control c) (control v) (control ,(car elem))] (cdr 
elem)))
+
     (define-key map [(control a)] #'drupal-mode-beginning-of-line)
     map)
   "Keymap for `drupal-mode'")
@@ -538,12 +548,12 @@ Heavily based on `message-beginning-of-line' from Gnus."
       (set zrs t)))
   (if (derived-mode-p 'conf-mode)
       (let* ((here (point))
-            (bol (progn (beginning-of-line n) (point)))
-            (eol (point-at-eol))
-            (eoh (re-search-forward "= *" eol t)))
-       (goto-char
-        (if (and eoh (or (< eoh here) (= bol here)))
-            eoh bol)))
+             (bol (progn (beginning-of-line n) (point)))
+             (eol (point-at-eol))
+             (eoh (re-search-forward "= *" eol t)))
+        (goto-char
+         (if (and eoh (or (< eoh here) (= bol here)))
+             eoh bol)))
     (beginning-of-line n)))
 
 
@@ -666,7 +676,7 @@ Used in `drupal-insert-hook' and `drupal-insert-function'."
                                         drupal-module
                                       ;; Otherwise fall back to a very naive
                                       ;; way of guessing the module name.
-                                      (file-name-nondirectory 
(file-name-sans-extension (buffer-file-name)))))))
+                                      (file-name-nondirectory 
(file-name-sans-extension (or buffer-file-name (buffer-name))))))))
     (if (called-interactively-p 'any)
         (insert name)
       name)))
diff --git a/drupal/autoinsert.el b/drupal/autoinsert.el
index 751bbdcaa6..1aa29d8472 100644
--- a/drupal/autoinsert.el
+++ b/drupal/autoinsert.el
@@ -1,9 +1,9 @@
 ;;; drupal/autoinsert.el --- Drupal-mode support for `auto-insert-mode'
 
-;; Copyright (C) 2012, 2013  Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014  Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
-;; Keywords: 
+;; Keywords:
 
 ;; This file is part of Drupal mode.
 
@@ -34,7 +34,7 @@
 (define-skeleton drupal/autoinsert-insert-info-skeleton
   "Drupal info file skeleton."
   nil
-  '(setq v1 (file-name-nondirectory (file-name-sans-extension 
(buffer-file-name))))
+  '(setq v1 (file-name-nondirectory (file-name-sans-extension (or 
buffer-file-name (buffer-name)))))
   '(setq v2 (if (drupal-major-version) (>= (string-to-number 
(drupal-major-version)) 7) t))
   "name = " @ - (upcase-initials (replace-regexp-in-string "[-_\\.]+" " " v1)) 
\n
   "description = " @ \n
diff --git a/drupal/emacs-drush.el b/drupal/emacs-drush.el
index bc6245278c..dad8c5774e 100644
--- a/drupal/emacs-drush.el
+++ b/drupal/emacs-drush.el
@@ -38,7 +38,7 @@
 On `after-save-hook' run `drush etags' or `drush gtags'.
 
 Requires `Drush utilities for Emacs users' to be installed."
-  :type `(choice 
+  :type `(choice
           (const :tag "Yes" t)
           (const :tag "No" nil))
   :link '(url-link :tag "Drush utilities for Emacs users" 
"https://drupal.org/project/emacs_drush";)
diff --git a/drupal/etags.el b/drupal/etags.el
index ee2251154a..6c23a7e216 100644
--- a/drupal/etags.el
+++ b/drupal/etags.el
@@ -1,6 +1,6 @@
 ;;; drupal/etags.el --- Drupal-mode support for etags
 
-;; Copyright (C) 2012, 2013 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 
@@ -29,7 +29,7 @@
 
 (defun drupal/etags-enable ()
   "Setup TAGS file for etags if it exists."
-  (let ((dir (locate-dominating-file (buffer-file-name) "TAGS")))
+  (let ((dir (locate-dominating-file (or buffer-file-name default-directory) 
"TAGS")))
     (when dir
       (set (make-local-variable 'drupal/etags-rootdir) dir)
 
diff --git a/drupal/flycheck.el b/drupal/flycheck.el
index 1aef618e9e..d671587aef 100644
--- a/drupal/flycheck.el
+++ b/drupal/flycheck.el
@@ -1,6 +1,6 @@
 ;;; drupal/flycheck.el --- Drupal-mode support for flycheck and phpcs
 
-;; Copyright (C) 2012, 2013 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
 
 ;; Author: Thomas Fini Hansen <xen@xen.dk>
 
@@ -25,6 +25,9 @@
 
 ;;; Code:
 
+(eval-when-compile
+  (require 'flycheck))
+
 (require 'drupal/phpcs)
 
 (defcustom drupal/flycheck-phpcs-js-and-css t
@@ -48,27 +51,32 @@
 
 (add-hook 'drupal-mode-hook #'drupal/flycheck-hook)
 
-(flycheck-declare-checker css-js-phpcs
+(flycheck-define-checker css-js-phpcs
   "Check CSS and JavaScript  using PHP_CodeSniffer.
 
 PHP_CodeSniffer can be used to check non-PHP files, as exemplified by the
 Drupal code sniffer.
 
 See URL `http://pear.php.net/package/PHP_CodeSniffer/'."
-  :command '("phpcs" "--report=emacs"
-             (option "--standard=" flycheck-phpcs-standard)
-             source)
+  :command ("phpcs" "--report=emacs"
+            (option "--standard=" flycheck-phpcs-standard)
+            source)
   ;; Though phpcs supports Checkstyle output which we could feed to
   ;; `flycheck-parse-checkstyle', we are still using error patterns here,
   ;; because PHP has notoriously unstable output habits.  See URL
   ;; `https://github.com/lunaryorn/flycheck/issues/78' and URL
   ;; `https://github.com/lunaryorn/flycheck/issues/118'
   :error-patterns
-  '(("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): error - \\(?4:.*\\)" error)
-    ("\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): warning - \\(?4:.*\\)" 
warning))
-  :modes '(css-mode js-mode)
+  ((error line-start
+          (file-name) ":" line ":" column ": error - " (message)
+          line-end)
+   (warning line-start
+            (file-name) ":" line ":" column ": warning - " (message)
+            line-end))
+  :modes (css-mode js-mode)
   :predicate (lambda ()
                (and drupal/flycheck-phpcs-js-and-css (apply 'derived-mode-p 
(append drupal-php-modes drupal-css-modes drupal-js-modes)))))
+
 (add-to-list 'flycheck-checkers 'css-js-phpcs)
 
 
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 671e3a172d..65bb429b89 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -1,6 +1,6 @@
 ;;; drupal/flymake-phpcs.el --- Drupal-mode support for flymake-phpcs
 
-;; Copyright (C) 2012, 2013 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 
@@ -32,15 +32,48 @@
 (define-obsolete-variable-alias 
'drupal/flymake-phpcs-dont-show-trailing-whitespace 
'drupal/phpcs-dont-show-trailing-whitespace)
 (require 'drupal/phpcs)
 
+;; Only available when `flymake' is the fork from
+;; https://github.com/illusori/emacs-flymake.
+(when (or (boundp 'flymake-run-in-place)
+          (fboundp 'flymake-phpcs-load))
+  (defcustom drupal/flymake-phpcs-run-in-place t
+    "If nil, flymake will run on copies in `temporary-file-directory' rather
+than the same directory as the original file.
+
+Drupal Coder Sniffer has some sniffs that will only work if run in place.
+
+Defaults to `t'. Set to `default' to use whatever
+`flymake-run-in-place' is set to.
+
+When editing a remote file via Tramp, this flag also has the side-effect of
+determining whether the syntax check is run in the same place as the original
+file (and thus on the remote machine), or in the same place as
+`temporary-file-directory' (usually the local machine)."
+    :type `(choice
+            (const :tag "Yes" t)
+            (const :tag "No" nil)
+            (const :tag "Default" default))
+    :link '(url-link :tag "Drupal Coder Sniffer" 
"https://drupal.org/project/coder";)
+    :group 'drupal))
+
 (defun drupal/flymake-phpcs-enable ()
-  "Enable drupal-mode support for flymake-phpcs."
-  (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes))
+  "Enable drupal-mode support for flymake-phpcs."(interactive)
+  (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes drupal-info-modes))
              (executable-find flymake-phpcs-command)
              drupal/phpcs-standard)
     ;; Set the coding standard to "Drupal" (we checked that it is
-    ;; supported above.
+    ;; supported above).
     (set (make-local-variable 'flymake-phpcs-standard) drupal/phpcs-standard)
 
+    ;; Set whether flymake runs in place.
+    (when (and (boundp 'drupal/flymake-phpcs-run-in-place)
+               (not (eq drupal/flymake-phpcs-run-in-place 'default)))
+      (when (fboundp 'flymake-phpcs-load)
+        (if drupal/flymake-phpcs-run-in-place
+            (set (make-local-variable 'flymake-phpcs-location) 'inplace)
+          (set (make-local-variable 'flymake-phpcs-location) 'tempdir)))
+      (set (make-local-variable 'flymake-run-in-place) 
drupal/flymake-phpcs-run-in-place))
+
     ;; Flymake-phpcs will also highlight trailing whitespace as an
     ;; error so no need to highlight it twice.
     (drupal/phpcs-dont-show-trailing-whitespace)
@@ -48,10 +81,15 @@
     ;; This is a php-mode file so add the extension to a buffer locale
     ;; version of `flymake-allowed-file-name-masks' and make
     ;; flymake-phpcs initialize.
-    (make-local-variable 'flymake-allowed-file-name-masks)
-    (add-to-list 'flymake-allowed-file-name-masks
-                 `(,(concat "\\." (file-name-extension (or buffer-file-name 
(buffer-name))) "\\'") flymake-phpcs-init))
-    (flymake-mode 1)))
+    (if (fboundp 'flymake-phpcs-load)
+        (flymake-phpcs-load)
+      (make-local-variable 'flymake-allowed-file-name-masks)
+      (let ((extension (file-name-extension (or buffer-file-name 
(buffer-name)))))
+        (when (string-match "\\.tpl\\.php\\'" (or buffer-file-name 
(buffer-name)))
+          (setq extension "tpl\\.php"))
+        (add-to-list 'flymake-allowed-file-name-masks
+                     `(,(concat "\\." extension "\\'") flymake-phpcs-init)))
+      (flymake-mode 1))))
 
 (add-hook 'drupal-mode-hook #'drupal/flymake-phpcs-enable)
 
diff --git a/drupal/gtags.el b/drupal/gtags.el
index ee48eb6484..9e67276d75 100644
--- a/drupal/gtags.el
+++ b/drupal/gtags.el
@@ -1,6 +1,6 @@
 ;;; drupal/gtags.el --- Drupal-mode support for gtags
 
-;; Copyright (C) 2012, 2013 Arne Jørgensen
+;; Copyright (C) 2012, 2013, 2014 Arne Jørgensen
 
 ;; Author: Arne Jørgensen <arne@arnested.dk>
 
@@ -35,7 +35,7 @@ Include path to the executable if it is not in your $PATH.")
 
 (defun drupal/gtags-enable ()
   "Setup rootdir for gtags."
-  (let ((dir (locate-dominating-file (buffer-file-name) "GTAGS")))
+  (let ((dir (locate-dominating-file (or buffer-file-name default-directory) 
"GTAGS")))
     (when dir
       (set (make-local-variable 'gtags-rootdir) dir)
 
diff --git a/drupal/phpcs.el b/drupal/phpcs.el
index c9fd848df8..723f9fa32f 100644
--- a/drupal/phpcs.el
+++ b/drupal/phpcs.el
@@ -34,7 +34,7 @@
                          ;; command. Check for both.
                          (call-process (or (and (boundp 
'flymake-phpcs-command) (executable-find flymake-phpcs-command)) 
(executable-find "phpcs")) nil (list t nil) nil "-i")))))
       (when (string-match
-             "\\(Drupal[^, 
+             "\\(Drupal[^,
 ]*\\)"
              standards)
         (match-string-no-properties 1 standards))))
@@ -60,8 +60,6 @@ need to highlight it twice."
 (defun drupal/phpcs-dont-show-trailing-whitespace ()
   "Turn of various trailing white space highlighting."
   (when drupal/phpcs-dont-show-trailing-whitespace
-    (when (boundp 'whitespace-style)
-      (set (make-local-variable 'whitespace-style) (remove 'trailing 
whitespace-style)))
     (setq show-trailing-whitespace nil)))
 
 (provide 'drupal/phpcs)



reply via email to

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