From ba80d4d5c8d0d6fe5609f8fb83d6ee33eec2cd75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 14:50:02 +0100 Subject: [PATCH 1/7] Remove drupalcontrib.com as search URL option --- drupal-mode.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drupal-mode.el b/drupal-mode.el index 0134975..af77a2a 100644 --- a/drupal-mode.el +++ b/drupal-mode.el @@ -1,6 +1,6 @@ ;;; drupal-mode.el --- Advanced minor mode for Drupal development -;; Copyright (C) 2012, 2013, 2014, 2015, 2016, 2017 Arne Jørgensen +;; Copyright (C) 2012, 2013, 2014, 2015, 2016, 2017, 2019 Arne Jørgensen ;; Author: Arne Jørgensen ;; URL: https://github.com/arnested/drupal-mode @@ -96,15 +96,13 @@ whitespace at the end." :group 'drupal) -(defcustom drupal-search-url "http://api.drupal.org/api/search/%v/%s" +(defcustom drupal-search-url "https://api.drupal.org/api/search/%v/%s" "The URL to search the Drupal API. %v is the Drupal major version. %s is the search term." - :type '(choice (const :tag "Api.drupal.org" "http://api.drupal.org/api/search/%v/%s") - (const :tag "Drupalcontrib.org" "http://drupalcontrib.org/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") + :type '(choice (const :tag "Api.drupal.org" "https://api.drupal.org/api/search/%v/%s") + (string :tag "Other" "https://example.com/api/search/%v/%s")) + :link '(url-link :tag "api.drupal.org" "https://api.drupal.org") :group 'drupal) ;;;###autoload From a8d3e30000055572ac2e117e38dd843857f2e2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 14:51:32 +0100 Subject: [PATCH 2/7] Link to drupal.org using www prefix --- drupal/webjump.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drupal/webjump.el b/drupal/webjump.el index 4fc10dd..90c42cf 100644 --- a/drupal/webjump.el +++ b/drupal/webjump.el @@ -1,6 +1,6 @@ ;;; drupal/webjump.el --- Drupal projects as webjump sites -;; Copyright (C) 2012, 2013 Arne Jørgensen +;; Copyright (C) 2012, 2013, 2019 Arne Jørgensen ;; Author: Arne Jørgensen @@ -26,7 +26,7 @@ (require 'webjump) -(add-to-list 'webjump-sites '("Drupal" . [simple-query "drupal.org" "https://drupal.org/project/" ""])) +(add-to-list 'webjump-sites '("Drupal" . [simple-query "drupal.org" "https://www.drupal.org/project/" ""])) From 3ce73dd22128f137c89cf51a3dbdc8dbb08fc068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 15:05:22 +0100 Subject: [PATCH 3/7] Fix array member indentation in function calls ```php $foo = bar([ 'baz', ]); ``` ```php $foo = bar([ 'baz', ]); ``` --- drupal-mode.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drupal-mode.el b/drupal-mode.el index af77a2a..f77bf40 100644 --- a/drupal-mode.el +++ b/drupal-mode.el @@ -1,6 +1,6 @@ ;;; drupal-mode.el --- Advanced minor mode for Drupal development -;; Copyright (C) 2012, 2013, 2014, 2015, 2016, 2017, 2019 Arne Jørgensen +;; Copyright (C) 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020 Arne Jørgensen ;; Author: Arne Jørgensen ;; URL: https://github.com/arnested/drupal-mode @@ -331,8 +331,7 @@ function arguments.") (indent-tabs-mode . nil) (require-final-newline . t) (c-offsets-alist . ((arglist-close . 0) - (arglist-cont-nonempty . c-lineup-math) - (arglist-intro . +) + (arglist-cont-nonempty . 0) (statement-cont . +))) (c-doc-comment-style . (php-mode . javadoc)) (c-label-minimum-indentation . 1) From 690f2c55922a3196f6a56874287386db71009219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 15:13:10 +0100 Subject: [PATCH 4/7] Cleanup URLs in documentation --- Cask | 2 +- Makefile | 6 +++--- README.md | 40 ++++++++++++++++++---------------------- drush-make-mode.el | 4 ++-- 4 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Cask b/Cask index efad37c..3347780 100644 --- a/Cask +++ b/Cask @@ -1,3 +1,3 @@ (package-file "drupal-mode.el") -(source marmalade) +(source melpa) diff --git a/Makefile b/Makefile index 808de21..3cc4c14 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # This file is part of Drupal mode. -# Copyright (C) 2012, 2013 Arne Jørgensen +# Copyright (C) 2012, 2013, 2020 Arne Jørgensen # Author: Arne Jørgensen @@ -42,9 +42,9 @@ README: README.md $(PANDOC) -t plain -o $@ $^ $(ARCHIVE_NAME)-pkg.el: $(ARCHIVE_NAME).el - $(CASK) package + $(CASK) pkg-file -# create a tar ball in package.el format for uploading to http://marmalade-repo.org +# create a tar ball in package.el format $(PACKAGE_NAME).tar: README $(ARCHIVE_NAME).el $(ARCHIVE_NAME)-pkg.el $(ARCHIVE_NAME).info dir drupal/*.el drupal-tests.el drush-make-mode.el $(TAR) -c -s "@^@$(PACKAGE_NAME)/@" -f $(PACKAGE_NAME).tar $^ diff --git a/README.md b/README.md index db678f1..a183657 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,9 @@ below) and depend on a few through the packaging system ## Installation The easiest way to install Drupal mode is probably to install it via -the ELPA archive at -[Marmalade](http://marmalade-repo.org/packages/drupal-mode) or -[MELPA Stable](http://stable.melpa.org/#/drupal-mode) (if you want -bleeding edge use regular [MELPA](http://melpa.org/#/drupal-mode)). - -ELPA (package.el) is part of Emacs 24. For Emacs 23 see -[Marmalade](http://marmalade-repo.org) for installation instructions. +the ELPA archive [MELPA +Stable](https://stable.melpa.org/#/drupal-mode) (if you want bleeding +edge use regular [MELPA](https://melpa.org/#/drupal-mode)). ## Features of Drupal mode @@ -46,7 +42,7 @@ ELPA (package.el) is part of Emacs 24. For Emacs 23 see ### Drupal Coding Standards Drupal mode will make you write code that adheres to -[Drupals coding standards](http://drupal.org/coding-standards#indenting). +[Drupals coding standards](https://www.drupal.org/coding-standards). It does this by: @@ -54,7 +50,7 @@ It does this by: #### Indentation In php-mode code will be indented according to -[Drupals coding standards](http://drupal.org/coding-standards#indenting). If not +[Drupals coding standards](https://drupal.org/coding-standards). If not it is considered a bug! @@ -91,10 +87,10 @@ menu entry. Files that are part of a Drupal project will try to identify the used version of Drupal core and look up the documentation for the -corresponding version at http://api.drupal.org. +corresponding version at https://api.drupal.org. If the symbol at point is believed to be a Drush command the -documentation will be looked up at http://api.drush.org instead. If +documentation will be looked up at https://api.drush.org instead. If Drush is installed it will identify the version of Drush and look up the documentation for the installed version of Drush. @@ -131,7 +127,7 @@ Etags is a built-in part of Emacs. ### GNU Globals / gtags -If you load [GNU Globals / gtags](http://www.gnu.org/software/global/) +If you load [GNU Globals / gtags](https://www.gnu.org/software/global/) support in Emacs then Drupal mode will set `gtags-rootdir` to your DRUPAL_ROOT. @@ -139,7 +135,7 @@ DRUPAL_ROOT. ### Drush utilities for Emacs users If -[Drush utilities for Emacs users](http://drupal.org/project/emacs_drush) +[Drush utilities for Emacs users](https://www.drupal.org/project/emacs_drush) is installed Drupal mode will update existing tag files in your DRUPAL_ROOT after saving a buffer. @@ -148,11 +144,11 @@ DRUPAL_ROOT after saving a buffer. If ispell.el is loaded in Emacs then Drupal mode will set the language of your Drupal mode buffers to `american` as stated in [Drupals coding -standards](http://drupal.org/coding-standards). +standards](https://www.drupal.org/coding-standards). ispell.el is a built-in part of Emacs. An external program must be installed to run the actual spell checking, -i.e. [ispell](http://www.gnu.org/software/ispell/), +i.e. [ispell](https://www.gnu.org/software/ispell/), [aspell](http://aspell.net/), or [hunspell](http://hunspell.sourceforge.net/). @@ -162,14 +158,14 @@ i.e. [ispell](http://www.gnu.org/software/ispell/), If support for [flymake-phpcs.el](https://github.com/illusori/emacs-flymake-phpcs) is loaded in Emacs and you have installed -[Drupal Code Sniffer](http://drupal.org/project/drupalcs) rules then +[Drupal Code Sniffer](https://www.drupal.org/project/drupalcs) rules then Drupal mode will enable flymake-phpcs under php-mode. For this to work you need: -* [PHP CodeSniffer](http://pear.php.net/package/PHP_CodeSniffer) -* [flymake-phpcs.el](http://marmalade-repo.org/packages/flymake-phpcs) -* [Drupal Code Sniffer](http://drupal.org/project/drupalcs) rules +* [PHP CodeSniffer](https://pear.php.net/package/PHP_CodeSniffer) +* [flymake-phpcs.el](https://melpa.org/#/flymake-phpcs) +* [Drupal Code Sniffer](https://drupal.org/project/drupalcs) rules ## Other takes on a Drupal mode @@ -179,11 +175,11 @@ wild: * [Search Github for drupal-mode](https://github.com/search?l=Emacs+Lisp&q=drupal&type=Repositories) * At drupal.org: - * http://drupal.org/sandbox/bartlantz/1405156 - * http://drupal.org/project/emacs + * https://www.drupal.org/sandbox/bartlantz/1405156 + * https://www.drupal.org/project/emacs All of them more or less based on -[Configuring Emacs](http://drupal.org/node/59868). +[Configuring Emacs](https://www.drupal.org/node/59868). ## Development of Drupal mode diff --git a/drush-make-mode.el b/drush-make-mode.el index 0d7c3bb..5bbe9a8 100644 --- a/drush-make-mode.el +++ b/drush-make-mode.el @@ -1,6 +1,6 @@ ;;; drush-make-mode.el --- Major mode for drush make files -;; Copyright (C) 2013, 2014 Arne Jørgensen +;; Copyright (C) 2013, 2014, 2020 Arne Jørgensen ;; Author: Arne Jørgensen ;; Keywords: languages, tools, extensions @@ -35,7 +35,7 @@ :group 'drupal ;; Use `bug-reference-mode' for linking issues and patches. - (set (make-local-variable 'bug-reference-url-format) "http://drupal.org/node/%s") + (set (make-local-variable 'bug-reference-url-format) "https://www.drupal.org/node/%s") (set (make-local-variable 'bug-reference-bug-regexp) "\\(?:\\#\\(?2:[0-9]+\\)\\|\\[['\"]?\\(?2:[0-9]+\\)\\([^0-9].*\\)?\\(['\"]?\\]\\)\\)") (bug-reference-mode) From 76c28888f76ccb7ef42c7c0e79ba9bdc89f3c931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 16:35:18 +0100 Subject: [PATCH 5/7] Adjust buffer name patterns for autoinsert Fixes #77. --- drupal/autoinsert.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drupal/autoinsert.el b/drupal/autoinsert.el index 3a32ada..fb2cfdf 100644 --- a/drupal/autoinsert.el +++ b/drupal/autoinsert.el @@ -1,6 +1,6 @@ ;;; drupal/autoinsert.el --- Drupal-mode support for `auto-insert-mode' -;; Copyright (C) 2012, 2013, 2014, 2015, 2016 Arne Jørgensen +;; Copyright (C) 2012, 2013, 2014, 2015, 2016, 2020 Arne Jørgensen ;; Author: Arne Jørgensen ;; Keywords: @@ -26,12 +26,12 @@ ;;; Code: -(define-auto-insert '("\\.info" . "Drupal info file") 'drupal/autoinsert-insert-info-skeleton) -(define-auto-insert '("\\.module" . "Drupal module file") 'drupal/autoinsert-insert-module-skeleton) -(define-auto-insert '("\\.install" . "Drupal install file") 'drupal/autoinsert-insert-install-skeleton) -(define-auto-insert '("\\.test" . "Drupal test file") 'drupal/autoinsert-insert-test-skeleton) -(define-auto-insert '("\\.api.php" . "Drupal API file") 'drupal/autoinsert-insert-api-skeleton) -(define-auto-insert '("\\.variable.inc" . "Drupal variable module support file") 'drupal/autoinsert-insert-variable-module-skeleton) +(define-auto-insert '("\\.info\\'" . "Drupal info file") 'drupal/autoinsert-insert-info-skeleton) +(define-auto-insert '("\\.module\\'" . "Drupal module file") 'drupal/autoinsert-insert-module-skeleton) +(define-auto-insert '("\\.install\\'" . "Drupal install file") 'drupal/autoinsert-insert-install-skeleton) +(define-auto-insert '("\\.test\\'" . "Drupal test file") 'drupal/autoinsert-insert-test-skeleton) +(define-auto-insert '("\\.api\\.php\\'" . "Drupal API file") 'drupal/autoinsert-insert-api-skeleton) +(define-auto-insert '("\\.variable.inc\\'" . "Drupal variable module support file") 'drupal/autoinsert-insert-variable-module-skeleton) (define-skeleton drupal/autoinsert-insert-info-skeleton "Drupal info file skeleton." From dc82e5430c532be482b8fdf8986cbc6e1a500ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 16:36:01 +0100 Subject: [PATCH 6/7] Handle .info.yml files --- drupal-mode.el | 13 ++++++------- drupal/autoinsert.el | 11 +++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drupal-mode.el b/drupal-mode.el index f77bf40..fdc564d 100644 --- a/drupal-mode.el +++ b/drupal-mode.el @@ -159,7 +159,7 @@ Include path to the executable if it is not in your $PATH." :group 'drupal) ;;;###autoload -(defcustom drupal-info-modes (list 'conf-windows-mode) +(defcustom drupal-info-modes (list 'conf-windows-mode 'yaml-mode) "Major modes to consider info files in Drupal mode." :type '(repeat symbol) :group 'drupal) @@ -806,13 +806,12 @@ older implementation of `locate-dominating-file'." (let ((prev-user user)) (setq user (nth 2 (file-attributes dir))) (or (null prev-user) (equal user prev-user)))) - (if (and (setq files (condition-case nil - (directory-files dir 'full "\\(.+\\)\\.info\\'" 'nosort) - (error nil))) - (file-exists-p (concat (file-name-sans-extension (car files)) ".module"))) + (if (setq files (condition-case nil + (directory-files dir 'full "\\(.+\\)\\.info\\(\\.yml\\)\\'" 'nosort) + (error nil))) (if info-file-location (throw 'found (car files)) - (throw 'found (file-name-nondirectory (file-name-sans-extension (car files))))) + (throw 'found (file-name-nondirectory (file-name-sans-extension(file-name-sans-extension (car files)))))) (if (equal dir (setq dir (file-name-directory (directory-file-name dir)))) @@ -831,7 +830,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 (or buffer-file-name (buffer-name)))))))) + (file-name-nondirectory (file-name-sans-extension (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 fb2cfdf..e3cbc12 100644 --- a/drupal/autoinsert.el +++ b/drupal/autoinsert.el @@ -27,6 +27,7 @@ ;;; Code: (define-auto-insert '("\\.info\\'" . "Drupal info file") 'drupal/autoinsert-insert-info-skeleton) +(define-auto-insert '("\\.info\\.yml\\'" . "Drupal info YML file") 'drupal/autoinsert-insert-info-yml-skeleton) (define-auto-insert '("\\.module\\'" . "Drupal module file") 'drupal/autoinsert-insert-module-skeleton) (define-auto-insert '("\\.install\\'" . "Drupal install file") 'drupal/autoinsert-insert-install-skeleton) (define-auto-insert '("\\.test\\'" . "Drupal test file") 'drupal/autoinsert-insert-test-skeleton) @@ -51,6 +52,16 @@ (when v2 "; required = ") & @ (when v2 "TRUE\n") (when v2 "; hidden = ") & @ (when v2 "TRUE\n")) +(define-skeleton drupal/autoinsert-insert-info-yml-skeleton + "Drupal 8 info.yml file skeleton." + nil + '(setq v1 (file-name-nondirectory (file-name-sans-extension (file-name-sans-extension (or buffer-file-name (buffer-name)))))) + '(setq v2 (if (string= (drupal-major-version) "8") "^8 || ^9" (concat "^" (drupal-major-version)))) + "name: " @ - (upcase-initials (replace-regexp-in-string "[-_\\.]+" " " v1)) \n + "description: " @ (replace-regexp-in-string "[-_\\.]+" " " v1) \n + "type: module" @ \n + "core_version_requirement: " @ v2 "\n") + (define-skeleton drupal/autoinsert-insert-module-skeleton "Drupal module file skeleton." nil From cca428d723ebdbcb09013f46d637ee58d45ca0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arne=20J=C3=B8rgensen?= Date: Sat, 8 Feb 2020 18:56:14 +0100 Subject: [PATCH 7/7] Run tests on Emacs 25.3, 26.3, and snapshot --- .travis.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68bb672..7b1c79b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,14 @@ language: emacs-lisp before_install: - - curl -fsSkL https://gist.githubusercontent.com/rejeep/7736123/raw | sh - - export PATH="/home/travis/.cask/bin:$PATH" - - export PATH="/home/travis/.evm/bin:$PATH" - - evm install $EVM_EMACS --use - - cask + - git clone https://github.com/rejeep/evm.git $HOME/.evm + - export PATH=$HOME/.cask/bin:$HOME/.evm/bin:$PATH + - evm config path /tmp + - evm install $EVM_EMACS --use --skip + - curl -fsSkL https://raw.github.com/cask/cask/master/go | python env: - - EVM_EMACS=emacs-24.1-bin - - EVM_EMACS=emacs-24.2-bin - - EVM_EMACS=emacs-24.4-bin - - EVM_EMACS=emacs-24.5-bin + - EVM_EMACS=emacs-25.3-travis + - EVM_EMACS=emacs-26.3-travis-linux-xenial + - EVM_EMACS=emacs-git-snapshot-travis-linux-xenial script: - emacs --version - make test