Skip to content

Commit c883221

Browse files
committed
Documentation was rewritten and extended.
1 parent 8828357 commit c883221

File tree

3 files changed

+565
-93
lines changed

3 files changed

+565
-93
lines changed

README

Lines changed: 145 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,153 @@
1-
Drupal Mode
2-
===========
1+
Drupal mode
32

4-
Drupal Mode is an advanced minor mode for developing in Drupal.
3+
Drupal mode is an advanced minor mode for developing in Drupal.
54

6-
Drupal Mode is based on top of PHP mode and defines among other things
7-
indentation etc. to match Drupal Coding Standards.
5+
The approach taken is somewhat different from other attempts at creating
6+
a Drupal mode.
87

9-
Mission statement
10-
-----------------
8+
This mode is a minor mode and can be applied to all files in a Drupal
9+
project no matter what major mode they use - whether it be php-mode or
10+
something else.
1111

12-
- Don't over do it
13-
- Only provide what makes sense in standard Emacs fashion.
14-
- Leave out what is considered personal taste.
15-
- Provide optional stuff if in doubt.
16-
- ... or provide option to disable if the personal taste is
17-
considered good practice.
18-
- The rest can go as advice on EmacsWiki or github wiki or g.d.o.
12+
Besides giving access to general functionality in all modes (i.e.
13+
clearing cache through Drush) it will also adapt it self to the major
14+
mode to enable functionality only for that particular major mode (i.e.
15+
adhering to Drupals PHP coding standards only in php-mode).
1916

20-
- Development is based on Emacs 24 - but Emacs 23 will be supported
21-
for all releases as well (although only a subset).
22-
- Do the right thing in all relevant major modes:
23-
- php-mode
24-
- javascript mode(s)
25-
- conf-mode (module.info)
17+
Drupal mode will try not to enforce specific ways of working with Emacs
18+
on to you. Emacs can be extended in a million different ways and you
19+
should use the parts and extensions that fit you and your working
20+
habits.
2621

27-
- Provide the mode via ELPA.
22+
If Drupal mode recognizes you using an extension that it knows about it
23+
will adapt the extension to be useful in Drupal mode and with Drupal.
24+
I.e. it will recognize if you have loaded etags support and setup your
25+
buffers to use the TAGS file in your DRUPAL_ROOT folder.
2826

29-
Other drupal modes
30-
------------------
27+
Drupal mode won't embed other libraries but will suggest some (see
28+
below) and depend on a few through the packaging system (i.e. php-mode).
3129

32-
There are quite a few attempts at writing a drupal-mode out in the wild:
30+
Installation
31+
32+
The easiest way to install Drupal mode is probably to install it via the
33+
ELPA archive at Marmalade.
34+
35+
ELPA (package.el) is part of Emacs 24. For Emacs 23 see Marmalade for
36+
installation instructions.
37+
38+
Features of Drupal mode
39+
40+
Drupal Coding Standards
41+
42+
Drupal mode will make you write code that adheres to Drupals coding
43+
standards.
44+
45+
It does this by:
46+
47+
Indentation
48+
49+
In php-mode code will be indented according to Drupals coding standards.
50+
If not it is considered a bug!
51+
52+
Fixing line endings
53+
54+
If your files are not written with unix style line endings Drupal mode
55+
will ask your to convert them to unix style line endings on saving
56+
buffers.
57+
58+
This behavior can be customized be the variable
59+
drupal-convert-line-ending.
60+
61+
The default is to ask if you want the file to be converted. By asking
62+
you we hopefully won't trick you into making a commit in your version
63+
control system consisting of a bunch of functionality changes with every
64+
line also changed by a new line ending. If you have ever read 1000 of
65+
commits/diffs you will appreciate this.
66+
67+
Delete trailing white space
68+
69+
In Drupal mode buffers we will enable Emacs' delete-trailing-whitespace.
70+
71+
This behavior can be customized be the variable
72+
drupal-delete-trailing-whitespace.
73+
74+
Search documentation
75+
76+
You can search Drupal documentation for the symbol at point by issuing
77+
C-c d f or M-x drupal-search-documentation or from the Drupal menu
78+
entry.
79+
80+
Files that are part of a Drupal project will try to identify the used
81+
version of Drupal core and look up the documentation for the
82+
corresponding version at http://api.drupal.org.
83+
84+
If the symbol at point is believed to be a drush command the
85+
documentation will be looked up at http://api.drush.org instead. If
86+
Drush is installed it will identify the version of Drush and look up the
87+
documentation for that version.
88+
89+
You can change where to search for documentation be customizing
90+
drupal-search-url (besides api.drupal.org it also has a predefined
91+
setting for api.drupalcontrib.org) and drupal-drush-search-url.
92+
93+
Clearing all caches
94+
95+
If Drush is installed you can issue a drush cc all from within Emacs by
96+
issuing C-c d c or M-x drupal-drush-cache-clear or from the Drupal menu
97+
entry.
98+
99+
Drush editing minor mode
100+
101+
If the buffer you visit is believe to be a Drush command (we think it is
102+
its name or path contains "drush") we will also enter a Drush minor
103+
mode.
104+
105+
There is currently no functionality connected to drupal-drush-mode.
106+
107+
Emacs modes and extensions that Drupal mode will enhance
108+
109+
etags
110+
111+
If you have generated a TAGS file in your DRUPAL_ROOT folder Drupal mode
112+
will setup all buffers running drupal-mode to set tags-file-name to
113+
point to that TAGS file.
114+
115+
Etags is a builtin part of Emacs.
116+
117+
GNU Globals / gtags
118+
119+
If you load GNU Globals / gtags support in Emacs then Drupal mode will
120+
set gtags-rootdir to your DRUPAL_ROOT.
121+
122+
ispell
123+
124+
If ispell.el is loaded in Emacs then Drupal mode will set the language
125+
of your Drupal mode buffers to american as stated in Drupals coding
126+
standards.
127+
128+
ispell.el is a builtin part of Emacs. A external program must be
129+
installed to run the actual spell checking, i.e. ispell, aspell, or
130+
hunspell.
131+
132+
flymake-phpcs
133+
134+
If support for flymake-phpcs.el is loaded in emacs and you have
135+
installed Drupal Code Sniffer rules then Drupal mode will enable
136+
flymake-phpcs under php-mode.
137+
138+
For this to work you need:
139+
140+
- PHP CodeSniffer
141+
- flymake-phpcs.el
142+
- Drupal Code Sniffer rules
143+
144+
Making all of them work together can be a bit of a puzzle. Especially
145+
notice the need to run phpcs through a wrapper you get with
146+
flymake-phpcs.el.
147+
148+
Other takes on a Drupal mode
149+
150+
There are quite a few attempts at writing a Drupal mode out in the wild:
33151

34152
- Search Github for drupal-mode
35153
- At drupal.org:
@@ -38,8 +156,7 @@ There are quite a few attempts at writing a drupal-mode out in the wild:
38156

39157
All of them more or less based on Configuring Emacs.
40158

41-
Installation
42-
------------
159+
Development of Drupal mode
43160

44-
The easiest way to install Drupal Mode is probably to install it via the
45-
ELPA archive at Marmalade.
161+
Drupal mode is actively developed at GitHub. Feature requests, ideas,
162+
bug reports, and pull request are more that welcome!

0 commit comments

Comments
 (0)