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

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

[nongnu] elpa/drupal-mode 90446f5bd8 003/308: Merge branch 'release/0.1.


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode 90446f5bd8 003/308: Merge branch 'release/0.1.0'
Date: Tue, 25 Jan 2022 10:58:52 -0500 (EST)

branch: elpa/drupal-mode
commit 90446f5bd8fab97888ba458564a061ec55cb6712
Merge: 6e1ef13c5e 3937ec3f40
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    Merge branch 'release/0.1.0'
---
 Makefile           |  15 ++++
 README             |  33 ++++++++
 README.md          |  26 ++++++
 dir                |  18 ++++
 drupal-mode-pkg.el |   3 +
 drupal-mode.el     | 245 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 drupal-mode.elc    | Bin 0 -> 6458 bytes
 drupal-mode.info   |  78 +++++++++++++++++
 8 files changed, 418 insertions(+)

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..7105dad209
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+.PHONY: all
+
+VERSION=0.1.0
+
+all: drupal-mode.info README
+
+drupal-mode.info: README.md
+       pandoc -t texinfo $^ | makeinfo -o $@
+
+README: README.md
+       pandoc -t plain -o $@ $^
+
+# create a tar ball in package.el format for uploading to 
http://marmalade-repo.org
+elpa-package: README drupal-mode.el drupal-mode-pkg.el drupal-mode.info dir
+       tar -c -s "@^@drupal-mode-${VERSION}/@" -f drupal-mode-${VERSION}.tar $^
diff --git a/README b/README
new file mode 100644
index 0000000000..fba03d2557
--- /dev/null
+++ b/README
@@ -0,0 +1,33 @@
+Drupal Mode
+===========
+
+Drupal Mode is an advanced minor mode for developing in Drupal.
+
+Drupal Mode is based on top of PHP mode and defines among other things
+indentation etc. to match Drupal Coding Standards.
+
+Mission statement
+-----------------
+
+-   Don't over do it
+    -   Only provide what makes sense in standard Emacs fashion.
+    -   Leave out what is considered personal taste.
+    -   Provide optional stuff if in doubt.
+    -   ... or provide option to disable if the personal taste is
+        considered good practice.
+    -   The rest can go as advice on EmacsWiki or github wiki or g.d.o.
+
+-   Lets base this on Emacs 24 - to do it simple, backporting can come
+    later.
+-   Do the right thing in all relevant major modes:
+    -   php-mode
+    -   javascript mode(s)
+    -   conf-mode (module.info)
+
+-   Provide the mode via ELPA.
+
+Installation
+------------
+
+The easiest way to install Drupal Mode is probably to install it via the
+ELPA archive at Marmalade.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..d7c28632d7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,26 @@
+# Drupal Mode #
+
+Drupal Mode is an advanced minor mode for developing in Drupal.
+
+Drupal Mode is based on top of PHP mode and defines among other things
+indentation etc. to match Drupal Coding Standards.
+
+## Mission statement ##
+
+* Don't over do it
+    * Only provide what makes sense in standard Emacs fashion.
+    * Leave out what is considered personal taste.
+    * Provide optional stuff if in doubt.
+    * ... or provide option to disable if the personal taste is considered 
good practice.
+    * The rest can go as advice on EmacsWiki or github wiki or g.d.o.
+* Lets base this on Emacs 24 - to do it simple, backporting can come later.
+* Do the right thing in all relevant major modes:
+       * php-mode
+       * javascript mode(s)
+       * conf-mode (module.info)
+* Provide the mode via ELPA.
+
+## Installation ##
+
+The easiest way to install Drupal Mode is probably to install it via
+the ELPA archive at [Marmalade](http://marmalade-repo.org).
diff --git a/dir b/dir
new file mode 100644
index 0000000000..adabb75773
--- /dev/null
+++ b/dir
@@ -0,0 +1,18 @@
+This is the file .../info/dir, which contains the
+topmost node of the Info hierarchy, called (dir)Top.
+The first time you invoke Info you start off looking at this node.
+
+File: dir,     Node: Top       This is the top of the INFO tree
+
+  This (the Directory node) gives a menu of major topics.
+  Typing "q" exits, "?" lists all Info commands, "d" returns here,
+  "h" gives a primer for first-timers,
+  "mEmacs<Return>" visits the Emacs manual, etc.
+
+  In Emacs, you can click mouse button 2 on a menu item or cross reference
+  to select it.
+
+* Menu:
+
+Programming
+* Drupal: (drupal-mode).                 Advanced minor mode for developing in 
Drupal.
diff --git a/drupal-mode-pkg.el b/drupal-mode-pkg.el
new file mode 100644
index 0000000000..95122bb919
--- /dev/null
+++ b/drupal-mode-pkg.el
@@ -0,0 +1,3 @@
+(define-package "drupal-mode" "0.1.0"
+  "Advanced minor mode for developing in Drupal"
+  '((php-mode "1.5.0")))
diff --git a/drupal-mode.el b/drupal-mode.el
new file mode 100644
index 0000000000..dd4e5081a2
--- /dev/null
+++ b/drupal-mode.el
@@ -0,0 +1,245 @@
+;;; drupal-mode.el --- Advanced minor mode for developing in Drupal
+
+;; Copyright (C) 2012 Arne Jørgensen
+
+;; Author: Arne Jørgensen <arne@arnested.dk>
+;; URL: https://github.com/arnested/drupal-mode
+;; Created: January 17, 2012
+;; Version: 0.1.0
+;; Package-Requires: ((php-mode "1.5.0"))
+;; Keywords: programming, php, drupal
+
+;; This file is NOT part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Drupal mode is an advanced minor mode for developing in Drupal.
+
+;; Drupal mode is based on top of PHP mode and defines among other
+;; things indentation etc. to match Drupal Coding Standards.
+
+;;; Code:
+
+(require 'php-mode)
+
+
+
+;; Customization
+(defgroup drupal nil
+  "Drupal configuration."
+  :prefix "drupal-"
+  :group 'languages)
+
+;; Should we offer to change line endings if needed?
+(defcustom drupal-convert-line-ending 'ask
+  "Should we offer to change line endings if needed?.
+According to http://drupal.org/coding-standards#indenting.";
+  :type `(choice 
+         :tag " we offer to change line endings if needed?"
+         (const :tag "Always" t)
+         (const :tag "Never" nil)
+         (const :tag "Ask" ask))
+  :group 'drupal)
+(make-variable-buffer-local 'drupal-convert-line-ending)
+
+;; Should we delete trailing white space?
+(defcustom drupal-delete-trailing-whitespace t
+  "Should we delete trailing white space?.
+According to http://drupal.org/coding-standards#indenting.";
+  :type `(choice 
+         :tag " we offer to delete trailing whitespace."
+         (const :tag "Always" t)
+         (const :tag "Never" nil))
+  :group 'drupal)
+
+;; 
+(defcustom drupal-search-url "http://api.drupal.org/api/search/%s/%s";
+  "The URL to search the Drupal API.
+First parameter is the Drupal version. Second parameter is the search term."
+  :type 'string
+  :group 'drupal)
+
+(defvar drupal-version nil "Drupal version as auto detected.")
+(make-variable-buffer-local 'drupal-version)
+(put 'drupal-version 'safe-local-variable 'string-or-null-p)
+
+(defvar drupal-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\C-cdf" 'drupal-search-documentation)
+    map)
+  "Keymap for `drupal-mode'")
+
+
+
+;;;###autoload
+(define-minor-mode drupal-mode
+  "Major mode for developing Drupal modules and code.\n\n\\{drupal-mode-map}"
+  :group 'drupal
+  :init-value nil
+  :lighter "/Drupal"
+  :keymap drupal-mode-map
+  (drupal-detect-drupal-version)
+  (when (eq major-mode 'php-mode)
+    (c-add-language 'drupal-mode 'c-mode)
+    (c-set-style "drupal"))
+
+  (add-hook 'before-save-hook 'drupal-convert-line-ending)
+  (add-hook 'before-save-hook 'drupal-delete-trailing-whitespace))
+
+;; drupal style
+(defcustom drupal-style
+  '((c-basic-offset . 2)
+    (fill-column . 80)
+    (show-trailing-whitespace . t)
+    (indent-tabs-mode . nil)
+    (require-final-newline . t)
+    (c-offsets-alist . ((arglist-close . 0)
+                       (arglist-cont-nonempty . c-lineup-math)
+                       (arglist-intro . +)
+                       (case-label . +)
+                       (comment-intro . 0)))
+    )
+  "Drupal coding style.
+According to http://drupal.org/coding-standards#indenting.";
+  :group 'drupal)
+
+(c-add-style "drupal" drupal-style)
+(add-to-list 'c-default-style '(drupal-mode . "drupal"))
+
+
+
+(defun drupal-mode-manual ()
+  "Go to the Drupal Mode info page."
+  (interactive)
+  (info-display-manual "drupal-mode"))
+
+
+
+;; Make a menu keymap (with a prompt string)
+;; and make it the menu bar item's definition.
+(define-key drupal-mode-map [menu-bar] (make-sparse-keymap))
+(define-key drupal-mode-map [menu-bar drupal]
+  (cons "Drupal" (make-sparse-keymap "Drupal")))
+
+;; Define specific subcommands in this menu.
+(define-key drupal-mode-map
+  [menu-bar drupal customize]
+  '("Customize Drupal Mode" . (lambda () (interactive) (customize-group 
'drupal))))
+(define-key drupal-mode-map
+  [menu-bar drupal manual]
+  '("Drupal Mode manual" . drupal-mode-manual))
+(define-key drupal-mode-map
+  [menu-bar drupal search-documentation]
+  '("Search documentation" . drupal-search-documentation))
+
+
+
+;; utility functions
+
+(defun drupal-convert-line-ending ()
+  "Convert to unix style line ending.
+According to http://drupal.org/coding-standards#indenting you
+should save your files with unix style end of line."
+  (when (and (eq major-mode 'drupal-mode)
+            drupal-convert-line-ending
+            (/= (coding-system-eol-type buffer-file-coding-system) 0))
+    (if (or (eq drupal-convert-line-ending t)
+           (y-or-n-p "Convert to unix style line endings?"))
+       (progn
+         (message "Coding system conversion")
+         (set-buffer-file-coding-system 'unix))
+      (progn
+       (setq drupal-convert-line-ending nil)))))
+
+(defun drupal-delete-trailing-whitespace ()
+  "Delete trailing whitespace if in drupal mode."
+  (when (and (eq major-mode 'drupal-mode)
+            drupal-delete-trailing-whitespace)
+    (delete-trailing-whitespace)))
+
+(defun drupal-search-documentation ()
+  "Search Drupal documentation for symbol at point."
+  (interactive)
+  (browse-url(format drupal-search-url (drupal-major-version drupal-version) 
(symbol-at-point))))
+
+
+
+;; Detect Drupal and Drupal version
+(defun drupal-detect-drupal-version ()
+  "Detect if the buffer is part of a Drupal project."
+  (interactive)
+  (if drupal-version
+      drupal-version
+    (dolist (file '("modules/system/system.module" "includes/bootstrap.inc" 
"core/includes/bootstrap.inc"))
+      (let ((dir (locate-dominating-file buffer-file-name file)))
+       (when dir
+         (with-current-buffer (find-file-noselect (concat dir file) t)
+           (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-directory-class dir 'drupal-class)))
+           (setq drupal-version (match-string-no-properties 2))
+           )
+         (hack-local-variables))))
+         drupal-version))
+
+(defun drupal-major-version (&optional version)
+  "Return major version number of version string.
+If major version number is 4 - return both major and minor."
+  (unless version
+    (setq version (drupal-detect-drupal-version)))
+  (let ((version-list (split-string version "\\.")))
+    (if (= (string-to-number (car version-list)) 4)
+       (format "%s.%s" (car version-list) (cadr version-list))
+      (car version-list))))
+
+;;;###autoload
+(defun drupal-mode-bootstrap ()
+  "Activate Drupal minor mode if major mode is supported.
+The command will activate `drupal-mode' if the current major mode
+is a mode supported by `drupal-mode' (currently only
+`php-mode').
+
+The function is suitable for adding to the supported major modes
+mode-hook, i.e.
+
+(eval-after-load 'php-mode
+  '(add-hook 'php-mode-hook 'drupal-mode-bootstrap))
+"
+  (when (eq major-mode 'php-mode)
+    (drupal-detect-drupal-version)
+    (when drupal-version
+      (drupal-mode 1))))
+
+;;;###autoload
+(eval-after-load 'php-mode
+  '(add-hook 'php-mode-hook 'drupal-mode-bootstrap))
+
+;;;###autoload
+(progn
+  (add-to-list 'auto-mode-alist 
'("\\.\\(module\\|test\\|install\\|theme\\|tpl\\.php\\)$" . php-mode))
+  (add-to-list 'auto-mode-alist '("\\.info$" . conf-windows-mode)))
+
+
+
+(provide 'drupal-mode)
+
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
+;;; drupal-mode.el ends here
diff --git a/drupal-mode.elc b/drupal-mode.elc
new file mode 100644
index 0000000000..400c37e6c8
Binary files /dev/null and b/drupal-mode.elc differ
diff --git a/drupal-mode.info b/drupal-mode.info
new file mode 100644
index 0000000000..f34722cb30
--- /dev/null
+++ b/drupal-mode.info
@@ -0,0 +1,78 @@
+Dette er drupal-mode.info, produceret med makeinfo version 4.8 ud fra
+stdin.
+
+
+File: drupal-mode.info,  Node: Top,  Up: (dir)
+
+Top
+***
+
+* Menu:
+
+* Drupal Mode::
+
+
+File: drupal-mode.info,  Node: Drupal Mode,  Prev: Top,  Up: Top
+
+1 Drupal Mode
+*************
+
+Drupal Mode is an advanced minor mode for developing in Drupal.
+
+   Drupal Mode is based on top of PHP mode and defines among other
+things indentation etc. to match Drupal Coding Standards.
+
+* Menu:
+
+* Mission statement::
+* Installation::
+
+
+File: drupal-mode.info,  Node: Mission statement,  Next: Installation,  Up: 
Drupal Mode
+
+1.1 Mission statement
+=====================
+
+   * Don't over do it
+        * Only provide what makes sense in standard Emacs fashion.
+
+        * Leave out what is considered personal taste.
+
+        * Provide optional stuff if in doubt.
+
+        * ... or provide option to disable if the personal taste is
+          considered good practice.
+
+        * The rest can go as advice on EmacsWiki or github wiki or
+          g.d.o.
+
+   * Lets base this on Emacs 24 - to do it simple, backporting can come
+     later.
+
+   * Do the right thing in all relevant major modes:
+        * php-mode
+
+        * javascript mode(s)
+
+        * conf-mode (module.info)
+
+   * Provide the mode via ELPA.
+
+
+File: drupal-mode.info,  Node: Installation,  Prev: Mission statement,  Up: 
Drupal Mode
+
+1.2 Installation
+================
+
+The easiest way to install Drupal Mode is probably to install it via
+the ELPA archive at Marmalade (http://marmalade-repo.org).
+
+
+
+Tag Table:
+Node: Top78
+Node: Drupal Mode163
+Node: Mission statement500
+Node: Installation1275
+
+End Tag Table



reply via email to

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