Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cask
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(package-file "drupal-mode.el")

(source marmalade)
(source melpa)
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 <arne@arnested.dk>

Expand Down Expand Up @@ -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 $^

Expand Down
40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,25 @@ 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

### 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:


#### 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!


Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -131,15 +127,15 @@ 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.


### 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.

Expand All @@ -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/).

Expand All @@ -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
Expand All @@ -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
Expand Down
28 changes: 12 additions & 16 deletions drupal-mode.el
Original file line number Diff line number Diff line change
@@ -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, 2020 Arne Jørgensen

;; Author: Arne Jørgensen <arne@arnested.dk>
;; URL: https://github.com/arnested/drupal-mode
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -161,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)
Expand Down Expand Up @@ -333,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)
Expand Down Expand Up @@ -809,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))))
Expand All @@ -834,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)))
Expand Down
25 changes: 18 additions & 7 deletions drupal/autoinsert.el
Original file line number Diff line number Diff line change
@@ -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 <arne@arnested.dk>
;; Keywords:
Expand All @@ -26,12 +26,13 @@

;;; 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 '("\\.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)
(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."
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions drupal/webjump.el
Original file line number Diff line number Diff line change
@@ -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 <arne@arnested.dk>

Expand All @@ -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/" ""]))



Expand Down
4 changes: 2 additions & 2 deletions drush-make-mode.el
Original file line number Diff line number Diff line change
@@ -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 <arne@arnested.dk>
;; Keywords: languages, tools, extensions
Expand Down Expand Up @@ -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)

Expand Down