#title Emacs
#author Stefan Hornburg (Racke)
#lang en
#topics Emacs, Debian, GnuPG, Markdown
** Major modes
*** Editing web pages
We are using =web-mode.el= which is available from [[http://web-mode.org/][http://web-mode.org/]].
Configuration as follows:
;; customizations
(defun my-web-mode-hook ()
"Hooks for Web mode."
(setq web-mode-markup-indent-offset 2)
)
(add-hook 'web-mode-hook 'my-web-mode-hook)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
*** Markdown
#markdown
[[https://jblevins.org/projects/markdown-mode/][Markdown mode]]
*** Muse
#muse
*** YAML
#yaml
Use *yaml-mode*.
*** Encrypted files
In order to use [[https://www.emacswiki.org/emacs/EasyPG][EasyPG]] for transparent, automatic encryption and decryption add the following to your Emacs init file:
(require 'epa-file)
(epa-file-enable)
This assumes that you the use file suffix =.gpg= for your encrypted files.
*** Version control
Refresh information: ALT-X vc-refresh-state
*** Tramp
**** SSH and Sudo
To login as regular user and switch to the root user with sudo:
{{{
/ssh:johndoe@example.org|sudo:root@example.org:
}}}
**** Multi hop hack to forward ssh agent
{{{
(defun add-ssh-agent-to-tramp ()
(cl-pushnew '("-A")
(cadr (assoc 'tramp-login-args
; if on Windows using Putty with Pageant,
; replace "ssh" with "plink"
(assoc "ssh" tramp-methods)))
:test #'equal))
(add-ssh-agent-to-tramp)
}}}
** Buffers
*** Minibuffer
**** Set focus to minibuffer
{{{
(defun switch-to-minibuffer ()
"Switch to minibuffer window."
(interactive)
(if (active-minibuffer-window)
(select-window (active-minibuffer-window))
(error "Minibuffer is not active")))
(global-set-key "\C-co" 'switch-to-minibuffer) ;; Bind to `C-c o'
}}}
** Development
*** Debian Packaging
dpkg-dev-el :: Emacs helpers specific to Debian development
elpa-go-mode :: Go(lang) mode
elpa-markdown-mode :: [[#markdown][Markdown mode]]
elpa-muse :: [[#muse][Muse mode]]
elpa-yaml-mode :: [[#yaml][YAML mode]]
The package dpkg-dev-el contains the following modes:
debian-bts-control :: builds control@bugs.debian.org email messages
debian-changelog-mode :: a helper mode for Debian changelogs
debian-control-mode :: a helper mode for debian/control files
debian-copyright :: major mode for Debian package copyright files
readme-debian :: major mode for editing README.Debian files