Code

Changes between Version 19 and Version 20 of Emacs


Ignore:
Timestamp:
12/26/10 10:23:24 (3 years ago)
Author:
myfreeweb
Comment:

Updated django-mode

Legend:

Unmodified
Added
Removed
Modified
  • Emacs

    v19 v20  
    4343{{{ 
    4444#!html 
    45 <img src="http://code.djangoproject.com/attachment/wiki/Emacs/nxhtml-django-html-mumamo.png?format=raw" alt="Screenshot of Django template in GNU Emacs with nXhtml."> 
     45<img src="http://code.djangoproject.com/attachment/wiki/Emacs/nxhtml-django-html-mumamo.png?format=raw" alt="Screenshot of Django template in GNU Emacs with nXhtml." /> 
    4646}}} 
    4747 
     48== New django-mode, django-html-mode == 
     49The latest and greatest mode for all things Django is [http://github.com/myfreeweb/django-mode here]. You can add this as a git submodule if you manage your Emacs configuration with Git, or just download if you don't. 
     50This mode includes snippets for [http://code.google.com/p/yasnippet YASnippet], Emacs functions for executing manage.py commands and jumping. Included django-html-mode is based on nxml-mode. Both modes have functions for quickly marking strings for translation. 
    4851 
     52{{{ 
     53#!html 
     54<img src="http://files.droplr.com/files/16908652/dA79.Django-emacs-jump.png" alt="Screenshot of jumping in Django-mode" /> 
     55}}} 
    4956 
    50 == django-mode == 
     57The setup looks like this: 
     58{{{ 
     59(add-to-list 'load-path "path-to/django-mode/") 
     60(require 'django-html-mode) 
     61(require 'django-mode) 
     62(yas/load-directory "path-to/django-mode/snippets") 
     63(add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode)) 
     64}}} 
     65 
     66== Old modes == 
     67=== django-mode === 
    5168 
    5269'''Status: old, download link does not work.''' 
     
    7390}}} 
    7491 
    75 == django-html-mode == 
     92=== django-html-mode === 
    7693 
    7794'''Status: unmaintained.''' 
     
    89106 
    90107Note: The django-html-mode code does not appear to support template tag indentation. 
    91  
    92  
    93 == Yasnippet == 
    94  
    95 If you are using [http://code.google.com/p/yasnippet/ Yasnippet], you can get the [https://edge.launchpad.net/django-mode django-mode] with many useful snippets.  
    96 To get, run on a shell: 
    97 {{{ 
    98 cd /tmp 
    99 mkdir ~/.emacs/plugins 
    100  
    101 bzr branch lp:python-mode 
    102 bzr branch lp:django-mode 
    103  
    104 mv /tmp/python-mode/python-mode.el ~/.emacs.d 
    105 mv /tmp/django-mode/*.el ~/.emacs.d 
    106 mv /tmp/django-mode/snippets ~/.emacs.d/plugins 
    107 }}} 
    108 And append something like: 
    109 {{{ 
    110 (add-to-list 'load-path "~/.emacs.d/plugins/yasnippet-0.6.1c") 
    111 (require 'yasnippet) 
    112 (yas/initialize) 
    113 (yas/load-directory "~/.emacs.d/plugins/yasnippet-0.6.1c/snippets") 
    114 (require 'django-html-mode) 
    115 (require 'django-mode) 
    116 (yas/load-directory "~/.emacs.d/plugins/django-mode/snippets") 
    117 }}} 
    118 to your .emacs. 
    119  
    120 The django-mode yasnippets code depend on python-mode.el, so it also has to be downloaded.  Note: there is a difference between python.el (which comes with the native Emacs distribution) and python-mode.el, which has to be downloaded separately. 
    121  
    122 Also, if you use django-html-mumamo-mode, you should not use Ysnippet since the automatic template tag indenting will not function correctly with the Ysnippet django-html-mode and django-mode code loaded.