Difference between pages "Building a Kernel from Source" and "Package:Emacs"

(Difference between pages)
m (build the better-initramfs)
 
(.emacs)
 
Line 1: Line 1:
Setting up a proper kernel yourself - lean, mean and tailored to your hardware,  is the challenge by which a linux user can graduate to becoming a Funtoo knight ;-)
+
[[File:emacs-logo.png]]
  
Even though many of us are using enterprise-ready kernels in datacenters, there is almost nobody who hasn't at least considered building a kernel for his laptop / PC.
+
Emacs is a famous text editor, famous by its flexibility and extensibility. One manual describes it as "the extensible, customizable, self-documenting, real-time display editor".
We are showing here how an intermediate Linux user can use an alternative to the standard beginners "genkernel" approach, to compile a custom kernel, in a relatively still speedy and easy set up.
+
  
=== Minimum Requirements ===
+
This page is designed to give users a good place to share their config and settings for a nice emacs setup.
You should understand the way how things work in a terminal and how to use an editor and tweak config files. This is crucial.
+
You don't need much knowledge about the linux kernel and it's internals. Nevertheless, you have to know at least where the files are located, how they are used and what is the file logic behind the overall structure. Otherwise you should consider using a non source based linux distribution.
+
If you are scared now, don't worry - we are going to build a kernel the Funtoo way and you will pick up everthing necessary to accomplish this challenge, step by step, so the next time you do it yourself and become a real Funtoo knight!
+
  
=== Assumptions ===
+
== Installing emacs ==
You start from an installed Funtoo system on the disk, or at least, you are on stage3 in a chrooted environment from a live cd, following somehow the Funto [[Installation (Tutorial)|Installation Tutorial]].
+
To install {{Package|app-editors/emacs}}, run the following command:
 +
<console>
 +
###i## emerge -av emacs
 +
</console>
 +
for the standard gnu emacs {{Package|app-editors/xemacs}} and
 +
<console>
 +
###i## emerge -av xemacs
 +
</console>
  
In this case we are building a kernel that is booting root in LVM over encrypted LUKS container.
+
for the 1980 created fork of emacs, both should handle the same, while emacs on its own stands here for both. If you install additional extensions for both you might need to add <tt>app-emacs</tt> or <tt>app-xemacs</tt> to the package as there are two different versions for both.
If you don't have this setup, don't worry, you just don't need all the modules, but everything else is similar.
+
  
 +
== What emacs is and what it is not ==
  
= Getting everything in order to start =
+
# Emacs is primarily a text editor and not a word processor, it concentrates on manipulating any kind of text, rather than manipulating the font and look. It is client and GUI based, so can be used on local box in graphical environments with a GUI and remote on a server in a client mode.
 +
# Emacs provides commands for manipulate every kind of text and syntax highlighting.
  
First there is the decision which linux kernel sources we need.
+
=== Customizability ===
There are plenty of them in the repositories around, often it is not easy to distinguish between them.
+
  
I would always trust my distribution of choice and take what is has to offer - and funtoo has a lot to offer!
+
'''Emacs is highly customizable:'''
  
I really do recommend (especially if it is your first time) to build a debian-sourced genkernel like described in chapter 5 "Using Debian-Sources with Genkernel" in the [[Funtoo_Linux_Kernels| Funtoo Kernels Tutorial]].
+
* the <tt>customize</tt> extension, which allows settings of customized variables, such as color themes, graphical interface, etc. This part is intended for emacs beginners, who do not want to work with Emacs lisp code.
 +
* combine keystrokes to execute complex makros.
 +
* using Emacs Lisp. Designed for the emacs professional.
  
From there you should have a running system booting nicely from your own build (just little bit bloated) kernel. This is more than you can expect from any other ready to go distribution.
+
=== Extensibility ===
  
{{Note}} We are using RedHat's dracut in order to build a nice initramfs (containing all the necessary tools and extra drivers our kernel might need to start the system). Although dracut is the way to go, more sophisticated and not as buggy as gentoo's genkernel approach, more and more funtoo geeks start using slashbeast's better-initramfs, which we will cover at the end of this howto! So after having set up a genkernel from debian or gentoo sources we are going to build a kernel with either (or both) dracut or/and better-initramfs. So gentoo sources with genkernel is always my backup if anything is not working correctly on my system. For the slightly more geeky approach with my own initram I am using pf-sources, ck-sources or any other more or less heavily patched sources.
+
As a result of the above points, Emacs behaviour can be easily definied to all text behavings without limit. Like some of the examples below show you:
  
Let's go!
+
* AUCTeX, A suite for LaTeX and other TeX versions,
 +
* ERC, A Emacs IRC client,
 +
* ORG-mode, A Emacs PIM and Orga tool
 +
* Wanderlust, A highly flexible Mail tool for Emacs
  
== Kernel Sources ==
+
== User Configs ==
We are going to use the kernel sources from the funtoo git repository.
+
=== golodhrim's config ===
 +
==== .emacs ====
 +
{{File
 +
|~/.emacs|<pre>
 +
;;;;;;;;;;;;;;;;;;;;;;
 +
;; General Settings ;;
 +
;;;;;;;;;;;;;;;;;;;;;;
  
The source you use on your system is up to you and your needs.
+
(setq emacs-root-dir (concat (getenv "HOME") "/em/"))
For a laptop or desktop system, we recommend the following:
+
  
* '''sys-kernel/pf-sources'''
+
(setq inhibit-startup-message t)    ;; Suppress the startup message
* '''sys-kernel/ck-sources'''
+
(setq standard-indent 4)            ;; Default indent level is 3 chars
* '''sys-kernel/gentoo-sources'''
+
(setq-default indent-tabs-mode nil) ;; Indent with spaces, not tabs
* '''sys-kernel/git-sources'''
+
* '''sys-kernel/sysrescue-std-sources'''
+
* '''sys-kernel/debian-sources'''
+
  
Please, have a look in the ebuild description, look onto their homepage and take the one that suits you best!
+
(setq make-backup-files nil)          ;; Enable backup files.
If you are unsure for now, use sys-kernel/gentoo-sources. That's always a safe bet for a general system.
+
(setq version-control nil)            ;; Enable versioning with default values
 +
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))  ;; Save all backup file in this directory.
  
It is not a problem to have various kernels installed parallel, so go on with any one of them.
+
(line-number-mode 1)                ;; Show line-number in the mode line
 +
(column-number-mode 1)              ;; Show column-number in the mode line
  
I am going to use the sys-kernel/pf-sources now, as I already had the gentoo-sources installed.
+
(setq auto-fill-mode 1)            ;; Line wrap
  
== Prerequisites ==
+
(set-default-font "Inconsolata-12")
  
I don't know which tools you have already installed, so some information here might be redundant.
+
(setq browse-url-browser-function 'browse-url-generic
It doesn't harm to just copy and paste and do some steps again.
+
      browse-url-generic-program "google-chrome")
  
First, we look into our <code>/etc/make.conf</code>:
+
(global-set-key (kbd "C-<prior>") 'previous-buffer)
 +
(global-set-key (kbd "C-<next>" ) 'next-buffer    )
  
<console>
 
###i## nano /etc/make.conf
 
#These compiler flags are just tweaking (optimazation) and NOT necessary:
 
CFLAGS="-O2 -pipe -march=native -ftracer -fforce-addr"
 
CXXFLAGS="${CFLAGS} -fpermissive -fomit-frame-pointer"
 
KDIR=/usr/src/linux
 
KERNEL="symlink build"
 
USE="$KERNEL ....here are your use flags...."
 
## These modules are available:
 
## DRACUT_MODULES="dracut_modules_biosdevname dracut_modules_btrfs dracut_modules_caps dracut_modules_crypt dracut_modules_crypt-gpg dracut_modules_dmraid dracut_modules_dmsquash-live dracut_modules_gensplash dracut_modules_iscsi dracut_modules_livenet dracut_modules_lvm dracut_modules_mdraid dracut_modules_multipath dracut_modules_nbd dracut_modules_nfs dracut_modules_plymouth dracut_modules_ssh-client dracut_modules_syslog"
 
## We will use these modules for LVM / LUKS:
 
DRACUT_MODULES="crypt lvm plymouth biosdevname dmraid crypt-gpg dmsquash-live ssh-client syslog"
 
</console>
 
  
Next, we set the package keywords:
+
(setq load-path (cons "~/.emacs.d/plugins" load-path))
<console>
+
###i## nano /etc/portage/package.use/dracut
+
sys-kernel/dracut dm net device-mapper crypt lvm
+
</console>
+
  
{{Note}} If you don't have lvm over encrypted LUKS you probably just add the "net" keyword here, or "selinux".
+
(setq global-font-lock-mode 1)
  
 +
(show-paren-mode 1)
  
After that we are going to build our packages:
+
;;;;;;;;;;;;;;;;;;
<console>
+
;; el-get setup ;;
###i## emerge -av app-portage/gentoolkit sys-kernel/pf-sources sys-kernel/dracut sys-boot/plymouth sys-boot/plymouth-openrc-plugin
+
;;;;;;;;;;;;;;;;;;
</console>
+
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
 +
(unless (require 'el-get nil t)
 +
  (with-current-buffer
 +
    (url-retrieve-synchronously "https://raw.github.com/golodhrim/el-get/master/el-get-install.el")
 +
  (end-of-buffer)
 +
  (eval-print-last-sexp)))
  
Finished? Well, then let's go on and
+
(el-get 'sync)
  
== Preparing the kernel ==
+
;;;;;;;;;;;;;;;
 +
;; mediawiki ;;
 +
;;;;;;;;;;;;;;;
 +
(require 'mediawiki)
  
We go now to the sources directory and enter the following commands to update the kernel's  .config  file:
+
;;;;;;;;;;;;;;;;;;;;
<console>
+
;; Org-mode stuff ;;
###i## cd /usr/src/linux/
+
;;;;;;;;;;;;;;;;;;;;
###i## make clean
+
  CLEAN  .
+
  CLEAN  arch/x86/kernel/acpi/realmode
+
  CLEAN  arch/x86/kernel/cpu
+
  CLEAN  arch/x86/kernel
+
  CLEAN  arch/x86/vdso
+
  CLEAN  arch/x86/lib
+
  CLEAN  drivers/gpu/drm/radeon
+
  CLEAN  drivers/net/wan
+
  CLEAN  drivers/scsi/aic7xxx
+
  CLEAN  drivers/tty/vt
+
  CLEAN  drivers/video/logo
+
  CLEAN  firmware
+
  CLEAN  kernel
+
  CLEAN  lib/raid6
+
  CLEAN  lib
+
  CLEAN  security/apparmor
+
  CLEAN  security/selinux
+
  CLEAN  usr
+
  CLEAN  arch/x86/boot/compressed
+
  CLEAN  arch/x86/boot
+
  CLEAN  .tmp_versions
+
  CLEAN  vmlinux System.map .tmp_kallsyms2.S .tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms1.S .tmp_vmlinux1 .tmp_vmlinux2 .tmp_System.map
+
###i## zcat /proc/config.gz > /usr/src/linux/.config
+
</console>
+
  
<console>
+
;; Tell emacs where org-mode is
###i## make localmodconfig
+
;;(setq load-path (cons "/usr/share/emacs/site-lisp/org-mode/" load-path))
</console>
+
;;(setq load-path (cons "/usr/share/emacs/site-lisp/org-mode/contrib/" load-path))
 +
(require 'org-install) ;; Tell emacs to use org-mode
 +
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) ;; Turn on org-mode for all *.org files
  
You will get some questions which you can answer mostly with either M (compiled as a module) or Y (compiled directly into the kernel).
+
;; Some key sequences
<pre>
+
(define-key global-map "\C-cl" 'org-store-link)  
Enable different security models (SECURITY) [Y/n/?] y
+
(define-key global-map "\C-ca" 'org-agenda)
Enable the securityfs filesystem (SECURITYFS) [Y/?] y
+
(global-set-key [f9]   'org-archive-subtree-default)
Socket and Networking Security Hooks (SECURITY_NETWORK) [Y/?] y
+
Security hooks for pathname based access control (SECURITY_PATH) [Y/?] y
+
Low address space for LSM to protect from user allocation (LSM_MMAP_MIN_ADDR) [65536] 65536
+
NSA SELinux Support (SECURITY_SELINUX) [Y/n/?] y
+
  NSA SELinux boot parameter (SECURITY_SELINUX_BOOTPARAM) [N/y/?] n
+
  NSA SELinux runtime disable (SECURITY_SELINUX_DISABLE) [N/y/?] n
+
  NSA SELinux Development Support (SECURITY_SELINUX_DEVELOP) [Y/n/?] y
+
  NSA SELinux AVC Statistics (SECURITY_SELINUX_AVC_STATS) [Y/n/?] y
+
  NSA SELinux checkreqprot default value (SECURITY_SELINUX_CHECKREQPROT_VALUE) [1] 1
+
  NSA SELinux maximum supported policy format version (SECURITY_SELINUX_POLICYDB_VERSION_MAX) [Y/n/?] y
+
    NSA SELinux maximum supported policy format version value (SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE) [19] 19
+
TOMOYO Linux Support (SECURITY_TOMOYO) [Y/n/?] y
+
  Default maximal count for learning mode (SECURITY_TOMOYO_MAX_ACCEPT_ENTRY) [2048] 2048
+
  Default maximal count for audit log (SECURITY_TOMOYO_MAX_AUDIT_LOG) [1024] 1024
+
  Activate without calling userspace policy loader. (SECURITY_TOMOYO_OMIT_USERSPACE_LOADER) [Y/n/?] y
+
AppArmor support (SECURITY_APPARMOR) [Y/n/?] y
+
  AppArmor boot parameter default value (SECURITY_APPARMOR_BOOTPARAM_VALUE) [1] 1
+
Integrity Measurement Architecture(IMA) (IMA) [Y/n/?] y
+
EVM support (EVM) [N/y/?] (NEW)
+
Default security module
+
  1. SELinux (DEFAULT_SECURITY_SELINUX)
+
  2. TOMOYO (DEFAULT_SECURITY_TOMOYO)
+
  3. AppArmor (DEFAULT_SECURITY_APPARMOR)
+
> 4. Unix Discretionary Access Controls (DEFAULT_SECURITY_DAC)
+
choice[1-4?]: 4
+
warning: (ACPI_HOTPLUG_CPU) selects ACPI_CONTAINER which has unmet direct dependencies (ACPI && EXPERIMENTAL)
+
warning: (MEDIA_TUNER) selects MEDIA_TUNER_TEA5761 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_MEDIA && I2C && EXPERIMENTAL)
+
#
+
# configuration written to .config
+
#
+
warning: (GFS2_FS) selects DLM which has unmet direct dependencies (EXPERIMENTAL && INET && SYSFS && CONFIGFS_FS && (IPV6 || IPV6=n))
+
warning: (IMA) selects TCG_TPM which has unmet direct dependencies (HAS_IOMEM && EXPERIMENTAL)
+
warning: (MEDIA_TUNER) selects MEDIA_TUNER_TEA5761 which has unmet direct dependencies (MEDIA_SUPPORT && VIDEO_MEDIA && I2C && EXPERIMENTAL)
+
warning: (ACPI_HOTPLUG_CPU) selects ACPI_CONTAINER which has unmet direct dependencies (ACPI && EXPERIMENTAL)
+
root@[~src/linux] #
+
  
</pre>
+
(setq org-log-done t) ;; I have no idea what this does, it was in the manual -- think it controls whether or not to log time completed for tasks
  
Now comes the most adventurous part!
+
(setq org-directory "~/notes")
  
= Building the Kernel =
+
;; Files that should be included in agenda views:
<console>
+
(setq org-agenda-files (list "~/notes/business.org"
###i## make -j8  bzImage
+
                            "~/notes/personal.org"
###i## make -j8 modules
+
                            "~/notes/projects/"
###i## make modules_install
+
    "~/notes/projects/writing/"))
###i## make install
+
</console>
+
  
 +
(setq org-todo-keywords '((type "TODO" "Postponed" "Upcoming" "Doing" "|" "DONE(#)"))) ;; TODO workflows
  
'''Building an initramfs or not?'''
+
(setq org-tag-alist '(("work" . ?k) ("personal" . ?p) ("organization" . ?o) ("writing" . ?w) ("code" . ?c) ("blog" . ?b) ("funtoo" . ?f) ("social" . ?s))) ;; Most-used tags, with shortcuts
  
The reason to build a kernel with an initramfs is mostly for interoperability (e.g. live-cd's) and special features like an included busybox, ssh, etc.  But mostly, and that's why we are doing this here now, to have a proper kernel up and running quick'n dirty in a reasonable time without fighting hours and days until a more or less exotic hardware is perfectly run by the kernel.  
+
;; Capture stuff
After having a proper basic kernel running with the help of an initramfs, I really recommend you to go a step further and build a true kernel with all features includes without an initramfs. But this could be pain in the ass and very time consuming - so we do it the funtoo way here - at least in the second example when we stick to better-initramfs instead of Red-Hat's ''dracut''.
+
(setq org-default-notes-file "~/.org/capture.org")
 +
(define-key global-map "\C-cc" 'org-capture)
 +
(setq org-refile-targets '((org-agenda-files :level . 1)(org-agenda-files :level . 2)))
 +
(setq org-refile-use-outline-path 'file)
  
= Option one: Initrd with dracut =
+
(setq org-capture-templates
 +
      '(("t" "Todo" entry (file+headline "~/.org/capture.org" "Tasks")
 +
            "- TODO %?\n  %i\n  %a")
 +
        ("j" "Journal" entry (file+datetree "~/.org/journal.org")
 +
            "- %?\nEntered on %U\n  %i\n  %a")))
  
To build the initrd we just execute
+
(setq org-mobile-directory "~/Dropbox/MobileOrg")
 +
(setq org-mobile-use-encryption)
 +
(setq org-mobile-use-encryption-password "PASSWORD")
 +
(setq org-mobile-inbox-for-pull "~/notes/mobileorg/inbox.org")
  
<console>
+
;;;;;;;;;;;;;;;;;;;
# ##i##dracut -f --fstab --xz /boot/initramfs-3.2.6-pf.img  3.2.6-pf
+
;; Markdown Mode ;;
</console>
+
;;;;;;;;;;;;;;;;;;;
  
Generally, this really should be enough!
+
(require 'markdown-mode)
If you experience booting problems like missing modules / drivers then just boot from the genkernel section and fix the initrd building. You can look into the man page to tweak the command a bit (e.g. --add-drivers "xz dm_crypt" etc...).
+
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
 +
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
  
Ok let's go on and finish the taks, we are going to tell now grub how to boot off correctly!
+
;;;;;;;;;;;;;;;;
 +
;; Python IDE ;;
 +
;;;;;;;;;;;;;;;;
 +
(c-add-style
 +
  "python-new"
 +
  '((indent-tabs-mode . nil)
 +
    (fill-column      . 78)
 +
    (c-basic-offset  . 4)
 +
    (c-offsets-alist  . ((substatement-open . 0)
 +
                          (inextern-lang    . 0)
 +
                          (arglist-intro    . +)
 +
                          (knr-argdecl-intro . +)))
 +
    (c-hanging-braces-alist . ((brace-list-open)
 +
                                (brace-list-intro)
 +
                                (brace-list-close)
 +
                                (brace-entry-open)
 +
                                (substatement-open after)
 +
                                (block-close . c-snug-do-while)))
 +
    (c-block-comment-prefix . "* "))
 +
)
  
<console>
+
;; This is a very crude hook that auto-selects the C style depending on
###i## nano /etc/boot.conf
+
;; whether it finds a line starting with tab in the first 3000 characters
 +
;; in the file
 +
(defun c-select-style ()
 +
  (save-excursion
 +
    (if (re-search-forward "^\t" 3000 t)
 +
        (c-set-style "python")
 +
      (c-set-style "python-new"))))
 +
(add-hook 'c-mode-hook 'c-select-style)
  
boot {
+
;;;;;;;;;;;;
        generate grub
+
;; Django ;;
        default "Funtoo Linux dracut"
+
;;;;;;;;;;;;
        timeout 3
+
(yas/initialize)
}
+
(add-to-list 'load-path "~/.emacs.d/el-get/django-mode/")
 +
(require 'django-html-mode)
 +
(require 'django-mode)
 +
(yas/load-directory "~/.emacs.d/el-get/django-mode/snippets")
 +
(add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode))
  
"Funtoo Linux genkernel" {
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        kernel kernel-genkernel[-v]
+
;; Document Engineering (AUCTeX + ConTeXt) ;;
        initrd initramfs-genkernel[-v]
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        params = quiet rootfstype=ext4
+
(load "auctex.el" nil t t)
        params += luks enc_root=/dev/sda3
+
(load "preview-latex.el" nil t t)
        params += lvm root=/dev/mapper/vg-root
+
}
+
  
"Funtoo Linux dracut" {
+
(setq TeX-auto-save 1)
        kernel vmlinuz[-v]
+
(setq TeX-parse-self 1)
## this is the better-initramfs generated initrd
+
(setq TeX-auto-untabify 1)
        initrd initramfs[-v].img
+
(setq TeX-display-help 1)
        params  = quiet rootfstype=ext4
+
(setq TeX-save-query nil)
        params += luks enc_root=/dev/sda3
+
(setq TeX-clean-confirm nil)
        params += lvm root=/dev/mapper/vg-root
+
(setq-default TeX-master nil)
}
+
</console>
+
  
That's it almost!
+
(add-hook 'TeX-mode-hook (lambda () (TeX-fold-mode 1)))
 +
(add-hook 'TeX-mode-hook (lambda () (TeX-source-specials-mode 1)))
 +
(add-hook 'TeX-mode-hook (lambda () (TeX-toggle-debug-bad-boxes)))
 +
(add-hook 'TeX-mode-hook (lambda () (TeX-toggle-debug-warnings)))
 +
(add-hook 'TeX-mode-hook (lambda () (outline-minor-mode)))
 +
(add-hook 'TeX-mode-hook (lambda () (abbrev-mode t)))
 +
(add-hook 'TeX-mode-hook (lambda () (auto-fill-mode 1)))
  
Now write to the <code>grub.cfg</code> with the new handy boot-update script from funtoo:
+
(add-hook 'TeX-mode-hook 'LaTeX-math-mode)
<console>
+
###i## boot-update -v
+
  
boot-update 1.5.2 / Copyright 2009-2011 Funtoo Technologies
+
(autoload 'etexshow "etexshow" "Browser for ConTeXt commands." t)
  
[use option "-l" for license info, "-h" for help]
+
(setq etexshow-xml-files-alist
 +
  `((,(concat emacs-root-dir "libs/etexshow/cont-en.xml") .
 +
      ,(concat "/tmp/cont-en.cache"))))
  
* Generating config for grub...
+
(setq etexshow-comment-file
 +
  (concat emacs-root-dir "libs/etexshow/cont-en-comments.xml"))
  
DEFAULT > Funtoo Linux - vmlinuz-3.2.6-pf
+
(setq TeX-PDF-mode 1)
          Funtoo Linux genkernel - kernel-genkernel-x86_64-3.2.6-pf
+
(setq revert-without-query '(".+pdf$"))
 +
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
  
  * Completed successfully.
+
;;;;;;;;;;
</console>
+
;; bbdb ;;
 +
;;;;;;;;;;
 +
(setq bbdb-file "~/.emacs.d/.bbdb")
 +
(require 'bbdb)
 +
(bbdb-initialize)
 +
(setq
 +
  bbdb-offer-save 1                        ;; 1 means save-without-asking
 +
bbdb-use-pop-up t                        ;; allow popups for addresses
 +
bbdb-electric-p t                        ;; be disposable with SPC
 +
bbdb-popup-target-lines 1                ;; very small
 +
bbdb-dwim-net-address-allow-redundancy t  ;; always use full name
 +
bbdb-quiet-about-name-mismatches 2        ;; show name-mismatches 2 secs
 +
bbdb-always-add-address t                ;; add new addresses to existing...
 +
                                          ;; ...contacts automatically
 +
bbdb-canonicalize-redundant-nets-p t      ;; x@foo.bar.cx => x@bar.cx
 +
bbdb-completion-type nil                  ;; complete on anything
 +
bbdb-complete-name-allow-cycling t        ;; cycle through matches
 +
                                          ;; this only works partially
 +
bbdb-message-caching-enabled t            ;; be fast
 +
bbdb-use-alternate-names t                ;; use AKA
 +
bbdb-elided-display t                    ;; single-line addresses
 +
;; auto-create addresses from mail
 +
bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook
 +
bbdb-ignore-some-messages-alist          ;; don't ask about fake addresses
 +
;; NOTE: there can be only one entry per header (such as To, From)
 +
;; http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html
 +
'(( "From" . "no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter")))
  
Okay,... here you go..! :)
+
;;;;;;;;;;;;;;;;;
 +
;; Jabber Mode ;;
 +
;;;;;;;;;;;;;;;;;
  
Reboot and see how it works!
+
(require 'jabber-autoloads)
 +
(setq jabber-account-list '(
 +
                            ("USER@jabber-server.tld"
 +
                            (:password . "PASSWORD")
 +
                            )
 +
                          )
 +
)
 +
(setq
 +
    jabber-history-enabled t
 +
    jabber-use-global-history nil
 +
    jabber-backlog-number 40
 +
    jabber-backlog-days 30
 +
)
  
= Option two: using better-initramfs =
+
(add-hook 'jabber-chat-mode-hook 'goto-address)
  
Piotr's better-initramfs is another approach that is tiny, nice and shiny and seems to become more and more a favourite among funtoo'ers. The biggest plus is that, once built it is kernel version independant.
+
(load "~/.emacs.d/plugins/autosmiley.el")
 +
(require 'autosmiley)
 +
(add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
  
For using this you just do the following steps:
+
(defvar libnotify-program "/usr/bin/notify-send")
<pre>
+
1. download sources
+
2. build kernel with "make bzImage"
+
3. download better-initramfs
+
4. run better-initramfs
+
5. adjust /etc/boot.conf
+
</pre>
+
  
Here is how in detail:
+
(defun notify-send (title message)
 +
  (start-process "notify" " notify"
 +
                libnotify-program "--expire-time=4000" title message))
  
Assuming you did install already a genkernel backup or at least you have a working bzImage + modules installed, we rush forward to step 3:
+
(defun libnotify-jabber-notify (from buf text proposed-alert)
 +
  "(jabber.el hook) Notify of new Jabber chat messages via libnotify"
 +
  (when (or jabber-message-alert-same-buffer
 +
                        (not (memq (selected-window) (get-buffer-window-list buf))))
 +
    (if (jabber-muc-sender-p from)
 +
        (notify-send (format "(PM) %s"
 +
                            (jabber-jid-displayname (jabber-jid-user from)))
 +
                    (format "%s: %s" (jabber-jid-resource from) text)))
 +
    (notify-send (format "%s" (jabber-jid-displayname from))
 +
                text)))
  
=== Downloading Better-initramfs ===
+
(add-hook 'jabber-alert-message-hooks 'libnotify-jabber-notify)
  
<console>
+
(defun jabber-visit-history (jid)
###i## cd /usr/src/;
+
   "Visit jabber history with JID in a new buffer.
###i## git clone https://github.com/slashbeast/better-initramfs.git
+
###i## /src #  cd better-initramfs
+
###i## better-initramfs git:(master) ls
+
AUTHORS    LICENSE   README.rst  bootstrap  output  sourceroot
+
ChangeLog  Makefile  TODO        examples  scripts
+
</console>
+
  
=== build the better-initramfs ===
+
Performs well only for small files. Expect to wait a few seconds
<console>
+
for large histories. Adapted from `jabber-chat-create-buffer'."
###i## better-initramfs git:(master) sudo bootstrap/bootstrap-all
+
  (interactive (list (jabber-read-jid-completing "JID: ")))
###i## sudo make prepare
+
  (let ((buffer (generate-new-buffer (format "*-jabber-history-%s-*"
###i## sudo make image
+
                                            (jabber-jid-displayname jid)))))
###i## sudo mv output/initramfs.cpio.gz /boot
+
    (switch-to-buffer buffer)
</console>
+
    (make-local-variable 'jabber-chat-ewoc)
 +
    (setq jabber-chat-ewoc (ewoc-create #'jabber-chat-pp))
 +
    (mapc 'jabber-chat-insert-backlog-entry
 +
          (nreverse (jabber-history-query nil nil t t "."
 +
                                          (jabber-history-filename jid))))
 +
    (view-mode)))
  
=== adjust grub ===
+
;;;;;;;;;;
 +
;; EMMS ;;
 +
;;;;;;;;;;
 +
(require 'emms-setup)
 +
(emms-devel)
 +
(emms-default-players)
  
Taking the above setup we edit the /etc/boot.conf
+
;;;;;;;;;
as I installed genkernel first, and dracut after - you see this setup:
+
;; ERC ;;
 +
;;;;;;;;;
 +
(require 'erc)
 +
(require 'erc-extension)
 +
(require 'erc-services)
 +
(require 'erc-tex)
 +
(require 'tls)
 +
(require 'erc-nicklist)
  
<pre>
+
(and
boot {
+
(require 'erc-highlight-nicknames)
        generate grub
+
(add-to-list 'erc-modules 'highlight-nicknames)
        default "Funtoo Linux"
+
(erc-update-modules))
        timeout 3
+
}
+
  
# Rootfs over lvm over luks
+
(erc-services-mode 1)
# /dev/sda3 - encrypted lvm's pv
+
# /dev/mapper/vg-root - rootfs's lv
+
  
"Funtoo Linux" {
+
(setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof
        kernel bzImage[-v]
+
                            -CAfile /home/USER/.ssl/USER.pem
## this is the better-initramfs generated initrd
+
                            -cert /home/USER/.ssl/USER.pem"
        initrd initramfs.cpio.gz
+
                    "gnutls-cli --priority secure256
        params  = quiet rootfstype=ext4
+
                                --x509cafile /home/USER/.ssl/USER.pem
        params += luks enc_root=/dev/sda3
+
                                --x509certfile /home/USER/.ssl/USER.pem -p %p %h"
        params += lvm root=/dev/mapper/vg-root
+
                    "gnutls-cli --priority secure256 -p %p %h"))
}
+
  
"Funtoo Linux dracut" {
+
(autoload 'erc-nick-notify-mode "erc-nick-notify" "Minor mode that calls `erc-nick-notify-cmd' when his nick gets mentioned in an erc channel" t)
        kernel vmlinuz[-v]
+
(eval-after-load 'erc '(erc-nick-notify-mode t))
## this is the dracut generated initrd
+
(defun irc-erc ()
        initrd initramfs[-v].img
+
  "Fire up IRC."
        params  = quiet rootfstype=ext4
+
  (interactive)
        params += luks enc_root=/dev/sda3
+
  (erc-tls :server "chat.freenode.net" :port 7000 :nick "USER" :full-name "FULL NAME" :password "PASSWORD"))
        params += lvm root=/dev/mapper/vg-root
+
}
+
  
 +
(setq erc-autojoin-channels-alist '(("freenode.net" "#frogandowl" "#funtoo" "#funtoo-quebec" "#syntazia" "#context" "#nginx" "#emacs" "#openvswitch")))
 +
(setq erc-log-channels-directory "~/.erc/logs/")
 +
(setq erc-log-insert-log-on-open nil)
 +
(setq erc-save-buffer-on-part nil
 +
      erc-save-buffer-queries-on-quit nil
 +
      erc-log-write-after-send t
 +
      erc-log-write-after-insert t)
  
"Funtoo Linux genkernel" {
+
(require 'smiley)
        kernel kernel-genkernel[-v]
+
    (add-to-list 'smiley-regexp-alist '("\\(:-?]\\)\\W" 1 "forced"))
        initrd initramfs-genkernel[-v]
+
    (add-to-list 'smiley-regexp-alist '("\\s-\\(:-?/\\)\\W" 1 "wry"))
        params = quiet rootfstype=ext4
+
    (add-to-list 'smiley-regexp-alist '("\\(:-?(\\)\\W" 1 "sad"))
        params += luks enc_root=/dev/sda3
+
    (add-to-list 'smiley-regexp-alist '("\\((-?:\\)\\W" 1 "reverse-smile"))
        params += lvm root=/dev/mapper/vg-root
+
    (add-to-list 'smiley-regexp-alist '("\\(:-?D\\)\\W" 1 "grin"))
}
+
    (add-to-list 'smiley-regexp-alist '("\\(:-?P\\)\\W" 1 "poke"))
</pre>
+
 
Okay,... here you go..! :)
+
;; (setq smiley-cached-regexp-alist nil)
 +
;; (smiley-update-cache)
 +
 
 +
;;;;;;;;;;;;;;;;
 +
;; Wanderlust ;;
 +
;;;;;;;;;;;;;;;;
 +
(autoload 'wl "wl" "Wanderlust" t)
 +
 
 +
;;;;;;;;;;;;;;;
 +
;; mailcrypt ;;
 +
;;;;;;;;;;;;;;;
 +
(require 'mailcrypt)
 +
(add-hook 'wl-summary-mode-hook 'mc-install-read-mode)
 +
(add-hook 'wl-mail-setup-hook 'mc-install-write-mode)
 +
 
 +
(defun mc-wl-verify-signature ()
 +
  (interactive)
 +
  (save-window-excursion
 +
    (wl-summary-jump-to-current-message)
 +
    (mc-verify)))
 +
 
 +
(defun mc-wl-decrypt-message ()
 +
  (interactive)
 +
  (save-window-excursion
 +
    (wl-summary-jump-to-current-message)
 +
    (let ((inhibit-read-only t))
 +
      (mc-decrypt))))
 +
 
 +
(eval-after-load "mailcrypt"
 +
  '(setq mc-modes-alist
 +
        (append
 +
          (quote
 +
          ((wl-draft-mode (encrypt . mc-encrypt-message)
 +
                          (sign . mc-sign-message))
 +
            (wl-summary-mode (decrypt . mc-wl-decrypt-message)
 +
                            (verify . mc-wl-verify-signature))))
 +
          mc-modes-alist)))
  
update the grub.cfg, then reboot and see how it works!
+
;;;;;;;;;;;;;;;;;;;;;
 +
;; notify function ;;
 +
;;;;;;;;;;;;;;;;;;;;;
 +
(defun djcb-popup (title msg &optional icon sound)
 +
  "Show a popup if we're on X, or echo it otherwise; TITLE is the title of the message, MSG is the context. Optionally, you can provide an ICON and a sound to be played"
 +
  (interactive)
 +
  (when sound (shell-command
 +
              (concat "mplayer2 -really-quiet " sound " 2> /dev/null")))
 +
  (if (eq window-system 'x)
 +
      (shell-command (concat "notify-send "
 +
                           
 +
                            (if icon (concat "-i " icon) "")
 +
                            " '" title "' '" msg "'"))
 +
    ;; text only version
 +
    (message (concat title ": " msg))))
  
 +
;; the appointment notification facility
 +
(setq
 +
appt-message-warning-time 15 ;; warn 15 min in advance
 +
appt-display-mode-line t    ;; show in the modeline
 +
appt-display-format 'window) ;; usr our func
 +
(appt-activate t)            ;; active appt (appointment notification)
 +
(display-time)
 +
 +
;; update appt each time agenda opened
 +
(add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt)
 +
 +
;; our little facade-function for djcb-popup
 +
(defun djcb-appt-display (min-to-app new-time msg)
 +
  (djcb-popup (format "Appointment in %s minute(s)" min-to-app) msg
 +
              "/usr/share/icons/gnome/32x32/status/appointment-soon.png"
 +
              "/usr/share/sounds/purple/alert.wav"))
 +
(setq appt-disp-window-function (function djcb-appt-display))
 +
 +
;;;;;;;;;;;;;;;;;;;;;;;;;;
 +
;; Custom Variable sets ;;
 +
;;;;;;;;;;;;;;;;;;;;;;;;;;
 +
(custom-set-variables
 +
  ;; custom-set-variables was added by Custom.
 +
  ;; If you edit it by hand, you could mess it up, so be careful.
 +
  ;; Your init file should contain only one such instance.
 +
  ;; If there is more than one, they won't work right.
 +
'(TeX-command-list (quote (("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt MKIV" "context %t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt MKIV") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))))
 +
'(column-number-mode t)
 +
'(erc-modules (quote (autojoin bbdb button completion fill irccontrols list log match menu move-to-prompt netsplit networks noncommands readonly ring services smiley stamp spelling track)))
 +
'(mediawiki-site-alist (quote (("Funtoo" "http://www.funtoo.org/" "USER" "PASSWORD" "")))))
 +
(custom-set-faces
 +
  ;; custom-set-faces was added by Custom.
 +
  ;; If you edit it by hand, you could mess it up, so be careful.
 +
  ;; Your init file should contain only one such instance.
 +
  ;; If there is more than one, they won't work right.
 +
)
 +
 +
;;;;;;;;;;;;;;;;;;
 +
;; Color-Themes ;;
 +
;;;;;;;;;;;;;;;;;;
 +
;;(add-to-list 'load-path "/usr/share/emacs/site-lisp/color-theme/color-theme.el")
 +
;;(add-to-list 'load-path "~/.emacs.d/themes/")
 +
(require 'color-theme)
 +
(color-theme-initialize)
 +
;;(color-theme-subtle-hacker)
 +
(color-theme-twilight)
 +
;;(eval-after-load "color-theme"
 +
;;  '(progn
 +
;;    (color-theme-initialize)
 +
;;    (require 'color-theme-citrus)
 +
;;    (require 'color-theme-candy)
 +
;;    (require 'color-theme-autumn-leaves)
 +
;;    (require 'color-theme-inthedark)
 +
;;    (require 'color-theme-marine)
 +
;;    (require 'color-theme-october)
 +
;;    (require 'color-theme-eatyourgreens)
 +
;;    (require 'color-theme-august)
 +
;;    (require 'color-theme-saddle-2)
 +
;;    (color-theme-saddle-2)))
 +
;;    (color-theme-subtle-hacker)))
 +
 +
(setq css-indent-offset 2)
 +
</pre>}}
 +
 +
==== .wl ====
 
<console>
 
<console>
root@[~src/linux-3.2.6-pf] # boot-update -v   
+
###i## nano ~/.wl
 +
;; load bbdb support
 +
(require 'bbdb-wl)
 +
(bbdb-wl-setup)
  
boot-update 1.5.2 / Copyright 2009-2011 Funtoo Technologies
+
;; setup from where to get addresses
 +
(setq bbdb-wl-folder-regexp "^\.INBOX|^\.inbox|^\.Sent|^\.sent|^\.\[IMAPS\]\\Sent")
  
[use option "-l" for license info, "-h" for help]
+
;; define keybinding
 +
(define-key wl-draft-mode-map (kbd "<C-tab>") 'bbdb-complete-name)
  
* Generating config for grub...
+
;; set multiple e-mail addresses
 +
(setq wl-user-mail-address-list (quote ("User@googlemail.com" "USER@own-server.tld")))
  
DEFAULT > Funtoo Linux better-initramfs - vmlinuz-3.2.6-pf
+
;; handle ("d") mark
          Funtoo Linux dracut - vmlinuz-3.2.6-pf
+
;; remove = instant removal (same as "D"), thrash = move to wl-trash-folder
          Funtoo Linux genkernel - kernel-genkernel-x86_64-3.2.6-ck
+
;; string = move to string
 +
(setq wl-dispose-folder-alist
 +
      '(
 +
        ("\.\*googlemail\\.com" "%[Imap]/Trash:"User@googlemail.com"/clear@imap.gmail.com:993!")
 +
        ("\.\*@own\-\server\\.tld" "%INBOX.Trash:"USER"/clear@imap.own-server.tld")
 +
))
  
* Completed successfully.
+
;; notify hook
 +
(add-hook 'wl-biff-notify-hook
 +
          (lambda()
 +
            (djcb-popup "Wanderlust" "You have new mail!"
 +
                        "/usr/share/icons/gnome/32x32/status/mail-unread.png"
 +
                        "/usr/share/sounds/purple/alert.wav")))
  
root@[~src/linux-3.2.6-pf] #
+
;; timer settings
 +
(setq
 +
wl-biff-check-interval 30 ;; check every 30 seconds
 +
wl-biff-use-idle-timer t) ;; in the background
  
root@[~src/linux-3.2.6-pf] # reboot
+
;; Name of top-folder, default "Desktop"
 +
(setq wl-folder-desktop-name "e-Mail")
  
System going down for reboot!
+
;; select correct email address when we _start_ writing a draft.
 +
(add-hook 'wl-mail-setup-hook 'wl-draft-config-exec)
  
 +
(setq wl-draft-config-alist
 +
      '(
 +
        ((string-match "googlemail.com" wl-draft-parent-folder)
 +
        (template . "User"))
 +
        ((string-match "own-server.tld" wl-draft-parent-folder)
 +
        (template . "USER"))
 +
))
 +
 +
;; choose template with C-c C-j
 +
(setq wl-template-alist
 +
      '(("User"
 +
        (wl-from . "Full Name <User@googlemail.com>")
 +
        ("From" . wl-from)
 +
        (wl-smtp-posting-user . "User")
 +
        (wl-smtp-posting-server . "smtp.gmail.com")
 +
        (wl-smtp-authenticate-type . "plain")
 +
        (wl-smtp-connection-type . 'starttls)
 +
        (wl-smtp-posting-port . 587)
 +
        (wl-local-domain . "googlemail.com")
 +
        (wl-message-id-domain . "smtp.gmail.com")
 +
       
 +
        (wl-fcc .  "%[IMAPS]/Sent:\"User@googlemail.com\"/clear@imap.gmail.com:993!")
 +
        (wl-draft-folder .  "%[IMAPS]/Draft:\"User@googlemail.com\"/clear@imap.gmail.com:993!")
 +
        )
 +
        ("USER"
 +
        (wl-from  . "Full Name <USER@own-server.tld>")
 +
        ("From"  . wl-from)
 +
        (wl-smtp-posting-user  . "USER")
 +
        (wl-smtp-posting-server  . "smtp.own-server.tld")
 +
        (wl-local-domain . "own-server.tld")
 +
       
 +
        (wl-fcc  "%INBOX.Sent:USER/digest-md5@imap.own-server.tld:143")
 +
        (wl-draft-folder  "%INBOX.Drafts:USER/digest-md5@imap.own-server.tld:143")
 +
        )
 +
      )
 +
)
 +
 +
(define-key wl-template-mode-map (kbd "<right>") 'wl-template-next)
 +
(define-key wl-template-mode-map (kbd "<left>") 'wl-template-prev)
 +
 +
(setq wl-default-spec "%")
 +
 +
(setq wl-fcc-force-as-read t)
 +
(setq wl-auto-save-drafts-interval nil)
 
</console>
 
</console>
  
 +
==== .folders ====
 +
<console>
 +
###i## nano ~/.folders
 +
User@googlemail{
 +
        %INBOX:"User@googlemail.com"/clear@imap.gmail.com:993!    "Inbox"
 +
        [IMAPS-gmail]{
 +
                %[IMAPS]/Sent:"User@googlemail.com"/clear@imap.gmail.com:993!      "Sent"
 +
                %[IMAPS]/Draft:"User@googlemail.com"/clear@imap.gmail.com:993!      "Draft"
 +
                %[IMAPS]/Spam:"User@googlemail.com"/clear@imap.gmail.com:993!      "Spam"
 +
                %[IMAPS]/Trash:"User@googlemail.com"/clear@imap.gmail.com:993!      "Trash"
 +
        }
 +
}
 +
USER@own-server.tld{
 +
        %INBOX:USER/digest-md5@imap.own-server.tld  "Inbox"
 +
        %INBOX.Sent:USER/digest-md5@imap.own-server.tld "Sent"
 +
        %INBOX.Drafts:USER/digest-md5@imap.own-server.tld "Drafts"
 +
}
 +
</console>
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 
[[Category:Featured]]
 
[[Category:Featured]]
[[Category:Kernel]]
 

Revision as of 15:05, January 28, 2014

Emacs-logo.png

Emacs is a famous text editor, famous by its flexibility and extensibility. One manual describes it as "the extensible, customizable, self-documenting, real-time display editor".

This page is designed to give users a good place to share their config and settings for a nice emacs setup.

Installing emacs

To install app-editors/emacs (package not on wiki - please add), run the following command:

# emerge -av emacs

for the standard gnu emacs app-editors/xemacs (package not on wiki - please add) and

# emerge -av xemacs

for the 1980 created fork of emacs, both should handle the same, while emacs on its own stands here for both. If you install additional extensions for both you might need to add app-emacs or app-xemacs to the package as there are two different versions for both.

What emacs is and what it is not

  1. Emacs is primarily a text editor and not a word processor, it concentrates on manipulating any kind of text, rather than manipulating the font and look. It is client and GUI based, so can be used on local box in graphical environments with a GUI and remote on a server in a client mode.
  2. Emacs provides commands for manipulate every kind of text and syntax highlighting.

Customizability

Emacs is highly customizable:

  • the customize extension, which allows settings of customized variables, such as color themes, graphical interface, etc. This part is intended for emacs beginners, who do not want to work with Emacs lisp code.
  • combine keystrokes to execute complex makros.
  • using Emacs Lisp. Designed for the emacs professional.

Extensibility

As a result of the above points, Emacs behaviour can be easily definied to all text behavings without limit. Like some of the examples below show you:

  • AUCTeX, A suite for LaTeX and other TeX versions,
  • ERC, A Emacs IRC client,
  • ORG-mode, A Emacs PIM and Orga tool
  • Wanderlust, A highly flexible Mail tool for Emacs

User Configs

golodhrim's config

.emacs

{{{name}}}
{{{body}}}

.wl

# nano ~/.wl
;; load bbdb support
(require 'bbdb-wl)
(bbdb-wl-setup)

;; setup from where to get addresses
(setq bbdb-wl-folder-regexp "^\.INBOX|^\.inbox|^\.Sent|^\.sent|^\.\[IMAPS\]\\Sent")

;; define keybinding
(define-key wl-draft-mode-map (kbd "<C-tab>") 'bbdb-complete-name)

;; set multiple e-mail addresses
(setq wl-user-mail-address-list (quote ("User@googlemail.com" "USER@own-server.tld")))

;; handle ("d") mark
;; remove = instant removal (same as "D"), thrash = move to wl-trash-folder
;; string = move to string
(setq wl-dispose-folder-alist
      '(
        ("\.\*googlemail\\.com" "%[Imap]/Trash:"User@googlemail.com"/clear@imap.gmail.com:993!")
        ("\.\*@own\-\server\\.tld" "%INBOX.Trash:"USER"/clear@imap.own-server.tld")
))

;; notify hook
(add-hook 'wl-biff-notify-hook
          (lambda()
            (djcb-popup "Wanderlust" "You have new mail!"
                        "/usr/share/icons/gnome/32x32/status/mail-unread.png"
                        "/usr/share/sounds/purple/alert.wav")))

;; timer settings
(setq
 wl-biff-check-interval 30 ;; check every 30 seconds
 wl-biff-use-idle-timer t) ;; in the background

;; Name of top-folder, default "Desktop"
(setq wl-folder-desktop-name "e-Mail")

;; select correct email address when we _start_ writing a draft.
(add-hook 'wl-mail-setup-hook 'wl-draft-config-exec)

(setq wl-draft-config-alist
      '(
        ((string-match "googlemail.com" wl-draft-parent-folder)
         (template . "User"))
        ((string-match "own-server.tld" wl-draft-parent-folder)
         (template . "USER"))
))

;; choose template with C-c C-j
(setq wl-template-alist
      '(("User"
         (wl-from . "Full Name <User@googlemail.com>")
         ("From" . wl-from)
         (wl-smtp-posting-user . "User")
         (wl-smtp-posting-server . "smtp.gmail.com")
         (wl-smtp-authenticate-type . "plain")
         (wl-smtp-connection-type . 'starttls)
         (wl-smtp-posting-port . 587)
         (wl-local-domain . "googlemail.com")
         (wl-message-id-domain . "smtp.gmail.com")
         
         (wl-fcc .  "%[IMAPS]/Sent:\"User@googlemail.com\"/clear@imap.gmail.com:993!")
         (wl-draft-folder .  "%[IMAPS]/Draft:\"User@googlemail.com\"/clear@imap.gmail.com:993!")
        )
        ("USER"
         (wl-from  . "Full Name <USER@own-server.tld>")
         ("From"  . wl-from)
         (wl-smtp-posting-user  . "USER")
         (wl-smtp-posting-server  . "smtp.own-server.tld")
         (wl-local-domain . "own-server.tld")
         
         (wl-fcc  "%INBOX.Sent:USER/digest-md5@imap.own-server.tld:143")
         (wl-draft-folder  "%INBOX.Drafts:USER/digest-md5@imap.own-server.tld:143")
        )
       )
)

(define-key wl-template-mode-map (kbd "<right>") 'wl-template-next)
(define-key wl-template-mode-map (kbd "<left>") 'wl-template-prev)

(setq wl-default-spec "%")

(setq wl-fcc-force-as-read t)
(setq wl-auto-save-drafts-interval nil)

.folders

# nano ~/.folders
User@googlemail{
         %INBOX:"User@googlemail.com"/clear@imap.gmail.com:993!    "Inbox"
        [IMAPS-gmail]{
                %[IMAPS]/Sent:"User@googlemail.com"/clear@imap.gmail.com:993!      "Sent"
                %[IMAPS]/Draft:"User@googlemail.com"/clear@imap.gmail.com:993!      "Draft"
                %[IMAPS]/Spam:"User@googlemail.com"/clear@imap.gmail.com:993!      "Spam"
                %[IMAPS]/Trash:"User@googlemail.com"/clear@imap.gmail.com:993!      "Trash"
        }
}
USER@own-server.tld{
        %INBOX:USER/digest-md5@imap.own-server.tld   "Inbox"
        %INBOX.Sent:USER/digest-md5@imap.own-server.tld "Sent"
        %INBOX.Drafts:USER/digest-md5@imap.own-server.tld "Drafts"
}