Difference between pages "Help:Images" and "Package:Emacs"

(Difference between pages)
m (1 revision: Importing the public domain help content from Mediawiki)
 
(.folders)
 
Line 1: Line 1:
{{PD Help Page}}
+
[[File:emacs-logo.png]]
This page explains the '''image''' syntax when editing the wiki. You or another user must usually [[Help:Managing files|upload an image]] before you can use it on a page.
+
  
Images that are stored on a MediaWiki server are usually rendered by using the <code>File:</code> namespace prefix (but the legacy <code>Image:</code> namespace prefix is still supported as a synonym) as the target of a MediaWiki link. The alternate <code>Media:</code> namespace prefix is also usable to reference the original media file content (for rendering or downloading it separately, out of any MediaWiki page).
+
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".
  
== Supported media types for images ==
+
This page is designed to give users a good place to share their config and settings for a nice emacs setup.
The following file formats are supported by Mediawiki by default:
+
* .jpg or .jpeg : bitmap image compressed in the standard JPEG format (this lossy format is most suitable for photographs).
+
* .png : bitmap image in the ''Portable Network Graphics'' format (specified by the ''W3 Consortium'').
+
* .gif : bitmap image in the legacy ''Graphics Interchange Format''.
+
  
Other formats used on Wikimedia, and commonly enabled elsewhere (These may require extra set up beyond what is enabled by default):
+
== Installing emacs ==
* .svg : scalable image in the ''Scalable Vector Graphics'' format (specified by the ''W3 Consortium''). See [[Manual:Image_Administration#SVG]].
+
To install {{Package|app-editors/emacs}}, run the following command:
* .tiff : Tagged image format. Often used for high-resolution archival photographs. Often used with [[Extension:PagedTiffHandler]].
+
<console>
* .ogg, .oga, .ogv : Ogg multimedia (audio or video) Not an image format, but treated similarly. Often used with [[Extension:OggHandler]]
+
###i## emerge -av emacs
* .pdf : multipaged documents in the ''Portable Document Format'' (initially specified by ''Adobe''). Often used in conjunction with [[Extension:PdfHandler]]
+
</console>
* .djvu : multipaged bitmap documents in the ''DejaVu'' format (most often, scans of books). See [[Manual:How to use DjVu with MediaWiki]]
+
for the standard gnu emacs {{Package|app-editors/xemacs}} and
*: Only a single page of a .pdf or .djvu file is shown at one time.
+
<console>
 +
###i## emerge -av xemacs
 +
</console>
  
Other media types may be supported depending on how Mediawiki is set up. Typically they can be uploaded but not displayed inline unless a helper extension is installed.
+
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.
  
== Rendering a single image ==
+
== What emacs is and what it is not ==
  
=== Syntax ===
+
# 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.
The full syntax for displaying an image is:
+
# Emacs provides commands for manipulate every kind of text and syntax highlighting.
<nowiki>[[</nowiki>File:''filename.extension''|''options''|''caption'']]
+
  
where ''options'' can be zero or more of the following, separated by pipes ('''|'''):
+
=== Customizability ===
* ''[[#Format|Format]]'' option: one of '''border''' and/or '''frameless''', '''frame''', '''thumb''' (or '''thumbnail''');
+
*: Controls how the rendered image is formatted and embedded in the rest of the page.
+
* ''[[#Size and Frame|Resizing]]'' option: one of
+
** ''{width}'''''px''' — Resizes the image to fit within the given maximum width in pixels, without restricting its height;
+
** '''x'''''{height}'''''px''' — Resizes the image to fit within the given maximum height in pixels, without restricting its width;
+
** ''{width}'''''x'''''{height}'''''px''' — Resizes the image to fit within the given width and height in pixels;
+
** '''upright''' — Resizes an image to fit within reasonable dimensions, according to user preferences (suitable for images whose height is larger than width).
+
*: Note that the image will always retain its aspect ratio, and can only be reduced (not increased) in size unless it's in a scalable media type (bitmap images cannot be scaled up).
+
*: The default maximum size depends on the ''format'' and the internal image dimensions (according to its media type).
+
* ''[[#Horizontal alignment|Horizontal alignment]]'' option: one of '''left''', '''right''', '''center''', '''none''';
+
*: Controls the horizontal alignment (and inline/block or floating styles) of the image within a text (no default value).
+
* ''[[#Vertical alignment|Vertical alignment]] option'': one of '''baseline''', '''sub''', '''super''', '''top''', '''text-top''', '''middle''', '''bottom''', '''text-bottom''';
+
*: Controls the vertical alignment of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is '''middle''').
+
* ''[[#Altering the default link target|Link]] option'': one of
+
** '''link='''''{target}'' — Allows to change the target (to an arbitrary page title, or URL) of the generated link, activable on the rendered image surface;
+
** '''link=''' (with an empty value) —  ({{mediawiki|rev:41727|MediaWiki 1.14+}}) Displays an image without any activable link; e.g. <code><nowiki>[[</nowiki>File:Example.jpg|20px|link=]]</code> renders as [[File:Example.jpg|20px|link=]].
+
*: Note that the '''link''' option cannot be used in conjunction with '''thumb''' or '''thumbnail''', as '''thumb''' is always meant to link to the larger version of the image.
+
*: In addition, '''link''' cannot be used with '''frame'''.
+
* Other specific options:
+
** '''alt='''''{alternative text}'' — ({{mediawiki|rev:41837|MediaWiki 1.14+}}) Defines the alternative text (maps to the HTML attribute <code>alt="..."</code> of the generated <code>&lt;image /&gt;</code> element) of an image that will be rendered if either the referenced image cannot be downloaded and embedded, or if the support media must use the alternative description text (e.g. when using a Braille reader or with accessibility options set by the user in its browser).
+
** '''page='''''{number}'' — Renders the specified page number (currently only applicable when showing a .djvu or .pdf file).
+
  
The options can be given in any order. If the given ''options'' conflict each other, the latter is applied, except for the ''format'' options, where the options take the priority in the order of: '''frame'''; '''thumb''' (or '''thumbnail'''); '''frameless''' and/or '''border'''.
+
'''Emacs is highly customizable:'''
  
If a parameter does not match any of the other possibilities, it is assumed to be the caption text.  Caption text shows below the image in '''thumb''' and '''frame''' formats, or as mouseover text in '''border''', '''frameless''' formats or when the format is omitted. Caption text displayed in the '''thumb''' and '''frame''' formats may contain wiki links and other formatting. In the other options, wiki-formatting will not work though transclusion will.
+
* 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.
  
If no caption text is supplied, a caption is automatically created showing the file name.  To completely remove the caption, set it to <code><nowiki><span title=""></span></nowiki></code>. For example, <code><nowiki>[[File:Example.jpg|20px|<span title=""></span>]]</nowiki></code> renders as [[File:Example.jpg|20px|<span title=""></span>]].
+
=== Extensibility ===
  
=== Format ===
+
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:
The following table shows the effect of all available formats.
+
  
{|class="wikitable plainlinks"
+
* AUCTeX, A suite for LaTeX and other TeX versions,
|-
+
* ERC, A Emacs IRC client,
!Description
+
* ORG-mode, A Emacs PIM and Orga tool
!You type
+
* Wanderlust, A highly flexible Mail tool for Emacs
!You get
+
{{Help:Images/frame|frame=|ex=no format specified|float=no|inline=yes}}
+
{{Help:Images/frame|frame=border|ex='''border''' results in a very small gray border|float=no|inline=yes}}
+
{{Help:Images/frame|frame=frameless|ex='''frameless''', like thumbnail, respect user preferences for image width, but without border and no right float|float=no|inline=yes}}
+
{{Help:Images/frame|frame=frameless|2=border|ex='''frameless''' and '''border'''|float=no|inline=yes}}
+
{{Help:Images/frame|frame=frame|ex='''frame'''|float=yes|inline=no}}
+
{{Help:Images/frame|frame=thumb|ex='''thumb''' or '''thumbnail'''|float=yes|inline=no}}
+
|}
+
  
When the height of an image in thumbnail is bigger than its width (i.e. in portrait orientation rather than lansdscape) and you find it too outstanding, you may try the option <code>upright</code>, which will try to adjust its size to more desirable size by reducing the height instead the width. The alternative is to specify the desired maximum height (in pixels) explicitly.
+
== User Configs ==
 +
=== golodhrim's config ===
 +
==== .emacs ====
 +
Edit the file <tt>~/.emacs</tt>:
  
Note that by writing <code>thumb={filename}</code>, you can use a different image for the thumbnail.
+
<pre>
 +
;;;;;;;;;;;;;;;;;;;;;;
 +
;; General Settings ;;
 +
;;;;;;;;;;;;;;;;;;;;;;
  
=== Size and Frame ===
+
(setq emacs-root-dir (concat (getenv "HOME") "/em/"))
Among different formats, the effect of the size parameter may be different, as shown below.
+
* For how it appears when its size is not specified, see [[#Format|Format]] section above.
+
* When the format is not specified, or only <code>border</code>ed, the size can be both reduced and enlarged to any specified size.
+
* In the examples below, the original size of the image is 400 × 267 pixels.
+
* An image with <code>frame</code> always ignores the size specification, the original image will be reduced if it exceeds the maximum size defined in user preferences.
+
* The size of an image with <code>thumb</code> and <code>frameless</code> can be reduced, but can not be enlarged beyond the original size of the image.
+
  
{|class="wikitable"
+
(setq inhibit-startup-message t)    ;; Suppress the startup message
|-
+
(setq standard-indent 4)            ;; Default indent level is 3 chars
! Format !! Reduced !! Enlarged
+
(setq-default indent-tabs-mode nil) ;; Indent with spaces, not tabs
{{Help:Images/size|frame=}}
+
{{Help:Images/size|frame=border}}
+
{{Help:Images/size|frame=frame}}
+
{{Help:Images/size|frame=thumb}}
+
{{Help:Images/size|frame=frameless}}
+
|}
+
  
=== Horizontal alignment ===
+
(setq make-backup-files nil)          ;; Enable backup files.
Note that when using the <code>frame</code> or <code>thumb[nail]</code> formats, the default horizontal alignment will be <code>right</code>.
+
(setq version-control nil)            ;; Enable versioning with default values
 +
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))  ;; Save all backup file in this directory.
  
{|class="wikitable"
+
(line-number-mode 1)                ;; Show line-number in the mode line
|-
+
(column-number-mode 1)              ;; Show column-number in the mode line
!Description
+
!You type
+
!You get
+
{{Help:Images/frame|2=100px|frame=|ex='''no horizontal alignment specified''', or default alignment|inline=yes|float=no}}
+
{{Help:Images/frame|2=100px|frame=none|ex=specify horizontal alignment as: '''none'''|inline=no|float=no}}
+
{{Help:Images/frame|2=100px|frame=center|ex=specify horizontal alignment as: '''center'''|inline=no|float=no}}
+
{{Help:Images/frame|2=100px|frame=left|ex=specify horizontal alignment as: '''left'''|inline=no|float=yes}}
+
{{Help:Images/frame|2=100px|frame=right|ex=specify horizontal alignment as: '''right'''|inline=no|float=yes}}
+
|}
+
  
=== Vertical alignment ===
+
(setq auto-fill-mode 1)            ;; Line wrap
The vertical alignment options take effect only if the image '''is''' rendered as an inline element and '''is not''' floating. They alter the way the inlined image will be vertically aligned with the text present in the same block before and/or after this image on the same rendered row.
+
  
Note that the rendered line of text where inline images are inserted (and the lines of text rendered after the current one) may be moved down (this will increase the line-height conditionally by additional line spacing, just as it may occur with spans of text with variable font sizes, or with superscripts and subscripts) to allow the image height to be fully displayed with this alignment constraint.
+
(set-default-font "Inconsolata-12")
  
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
(setq browse-url-browser-function 'browse-url-generic
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
      browse-url-generic-program "google-chrome")
<nowiki>'''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki><sup>super:</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki><sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''default:''' [[File:Example.jpg|20px]][[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
<nowiki/>
+
<nowiki><p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2"></nowiki>
+
<nowiki><span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del></nowiki>
+
<nowiki>'''bottom:'' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]]</nowiki>
+
<nowiki><del>text</del></u></span></p></nowiki>
+
  
results in the following (to show the alignment result more clearly, the text spans are overlined and underlined, the line-height is increased to 200% of the font-height, the font-height is emphasized with a yellow background covering the line margins, and the full line-height is shown with a dark gray border; additionally images of different sizes are aligned, including one with an additional border that adds some pixels to its specified dimensions and slightly changes its vertical alignment):
+
(global-set-key (kbd "C-<prior>") 'previous-buffer)
 +
(global-set-key (kbd "C-<next>" ) 'next-buffer    )
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
 
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
 
'''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]]
 
<del>text</del></u></span></p>
 
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
(setq load-path (cons "~/.emacs.d/plugins" load-path))
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
'''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]]
+
<del>text</del></u></span></p>
+
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
(setq global-font-lock-mode 1)
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
<sup>'''super:'''</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]]
+
<del>text</del></u></span></p>
+
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
(show-paren-mode 1)
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
'''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]]
+
<del>text</del></u></span></p>
+
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
;;;;;;;;;;;;;;;;;;
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
;; el-get setup ;;
<sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]]
+
;;;;;;;;;;;;;;;;;;
<del>text</del></u></span></p>
+
(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)))
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
(el-get 'sync)
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
'''default:''' [[File:Example.jpg|20px]] [[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]]
+
<del>text</del></u></span></p>
+
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
;;;;;;;;;;;;;;;
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
;; mediawiki ;;
'''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]]
+
;;;;;;;;;;;;;;;
<del>text</del></u></span></p>
+
(require 'mediawiki)
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
;;;;;;;;;;;;;;;;;;;;
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
;; Org-mode stuff ;;
'''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]]
+
;;;;;;;;;;;;;;;;;;;;
<del>text</del></u></span></p>
+
  
<p style="border:1px solid #AAA;background:#FF0;padding:0;font-size:150%;line-height:2">
+
;; Tell emacs where org-mode is
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del>
+
;;(setq load-path (cons "/usr/share/emacs/site-lisp/org-mode/" load-path))
'''bottom:''' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]]
+
;;(setq load-path (cons "/usr/share/emacs/site-lisp/org-mode/contrib/" load-path))
<del>text</del></u></span></p>
+
(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
  
Notes:
+
;; Some key sequences
# The "middle" vertical alignment position of the image (which is also the default) usually refers to the middle between the x-height and the baseline of the text (on which the vertical middle of the image will be aligned, and on which usually the text may be overstroke), but not to the middle of the line-height of the font-height that refers to the space between the "text-top" and "text-bottom" positions ; the font-height excludes:
+
(define-key global-map "\C-cl" 'org-store-link)  
#* the additional line separation spacing normally divided equally into two line-margins (here 0.5em, according to line-height set to 200%) above and below the font-height).
+
(define-key global-map "\C-ca" 'org-agenda)
#* the additional line spacing which may be added by superscripts and subscripts.
+
(global-set-key [f9]    'org-archive-subtree-default)
# However, if the image height causes its top or bottom position to go above or below the normal full line-height of text, the middle position will be adjusted after the increasing the top and/or bottom line-margins so that the image can fit and align properly, and all images (including those with smaller heights) will be vertically centered on the adjusted middle position (for computing the effective line-height, the text of each rendered row with the larger font-height will be considered).
+
# The "text-top" and "text-bottom" alignment positions also excludes the extra line spacing added by superscripts and subscripts, but not the additional line-spacing defined by the line-height.
+
# The "top" and "bottom" alignment positions take into account all these extra line spacings (including superscripts and subscripts, if they are present in a rendered line span). When the image alignment constrains the image to grow above or below the normal line-spacing, and the image is not absolutely positioned, the image will cause the "top" and "bottom" positions to be adjusted (just like superscripts and subscripts), so the effective line-height between rendered lines of text will be higher.
+
# The "underline", "overline" and "overstrike" text-decoration positions should be somewhere within these two limits and ''may'' depend on the type and height of fonts used (the superscript and subscript styles may be taken into account in some browsers, but usually these styles are ignored and the position of these decorations may not be adjusted); so these decorations normally don't affect the vertical position of images, relatively to the text.
+
  
=== Stopping the text flow ===
+
(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
On occasion it is desirable to stop text (or other inline non-floating images) from flowing around a floating image.  Depending on the web browser's screen resolution and such, text flow on the right side of an image may cause a section header (for instance, <nowiki>== My Header ==</nowiki>) to appear to the right of the image, instead of below it, as a user may expect.  The text flow can be stopped by placing '''<nowiki><br style="clear: both" /></nowiki>''' before the text that should start below the floatting image.
+
  
All images rendered as blocks (including non-floating '''center'''ed images, '''left'''- or '''right'''-floating images, as well as '''framed''' or '''thumbnail'''ed floating images) are implicitly breaking the surrounding lines of text (terminating the current block of text before the image, and creating a new paragraph for the text after them). They will then stack vertically along their left or right alignment margin (or along the center line between these margins for '''center'''ed images).
+
(setq org-directory "~/notes")
  
=== Altering the default link target ===
+
;; Files that should be included in agenda views:
The following table shows how to alter the link target (whose default is the image description page) or how to remove it. Changing the link does not alter the format described in the previous sections.
+
(setq org-agenda-files (list "~/notes/business.org"
 +
                            "~/notes/personal.org"
 +
                            "~/notes/projects/"
 +
    "~/notes/projects/writing/"))
  
{|class="wikitable plainlinks"
+
(setq org-todo-keywords '((type "TODO" "Postponed" "Upcoming" "Doing" "|" "DONE(#)"))) ;; TODO workflows
|-
+
!Description
+
!You type
+
!You get
+
{{Help:Images/frame|2=link=Main Page|ex=internal link}}
+
{{Help:Images/frame|2=link=http://wikipedia.org|ex=external link}}
+
{{Help:Images/frame|2=link=|ex=no link (external or file page)}}
+
|}
+
  
'''Warning :'''
+
(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 licencing requirements on your wiki may not allow you to remove all links to the description page that displays the required authors attributions, the copyrights statements, the applicable licencing terms, or a more complete description of the rendered image (including its history of modifications).
+
: If you change or remove the target link of an image, you will then have to provide somewhere else on your page an explicit link to this description page, or to display the copyright and author statement and a link to the applicable licence, if they are different from the elements applicable to the embedding page itself.
+
: Your wiki policy may restrict the use of the alternate link parameter, or may even enforce a prohibition of alternate link parameters for embedded media files (in which case, the link parameter will be ignored), or may only accept to them after validation by authorized users or administrators.
+
  
== Rendering a gallery of images ==
+
;; Capture stuff
 +
(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)
  
=== Gallery syntax ===
+
(setq org-capture-templates
It's easy to make a gallery of '''thumbnails only''', not other images, with the <code><nowiki><gallery></nowiki></code> tag. The syntax is:
+
      '(("t" "Todo" entry (file+headline "~/.org/capture.org" "Tasks")
  <nowiki><gallery></nowiki>
+
            "- TODO %?\n %i\n %a")
  Image:file_name.ext|caption
+
        ("j" "Journal" entry (file+datetree "~/.org/journal.org")
Image:file_name.ext|caption
+
            "- %?\nEntered on %U\n %i\n  %a")))
{...}
+
  </gallery>
+
  
Note that the image code is not enclosed in brackets when enclosed in gallery tags.  
+
(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")
  
Captions are optional, and may contain wiki links or other formatting.
+
;;;;;;;;;;;;;;;;;;;
 +
;; Markdown Mode ;;
 +
;;;;;;;;;;;;;;;;;;;
  
for example:
+
(require 'markdown-mode)
<nowiki><gallery></nowiki>
+
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
File:Example.jpg|Item 1
+
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
File:Example.jpg|a link to <nowiki>[[</nowiki>Help:Contents]]
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg| <nowiki>''italic caption''</nowiki>
+
File:Example.jpg|on page "<nowiki>{{</nowiki>PAGENAME}}"
+
</gallery>
+
is formatted as:
+
<gallery>
+
File:Example.jpg|Item 1
+
File:Example.jpg|a link to [[Help:Contents]]
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg|''italic caption''
+
File:Example.jpg|on page "{{PAGENAME}}"
+
</gallery>
+
  
=== Optional gallery attributes ===
+
;;;;;;;;;;;;;;;;
The gallery tag itself takes several additional parameters, specified as attribute name-value pairs:
+
;; 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 . "* "))
 +
)
  
<pre><gallery {parameters}>
+
;; This is a very crude hook that auto-selects the C style depending on
{images}
+
;; whether it finds a line starting with tab in the first 3000 characters
</gallery></pre>
+
;; 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)
  
* <code>caption={caption}</code>: sets a caption on the gallery.
+
;;;;;;;;;;;;
* <code>widths={width}px</code>: sets the widths of the images, default 120px. ''Note the plural, width'''s'''''
+
;; Django ;;
* <code>heights={heights}px</code>: sets the (max) heights of the images.
+
;;;;;;;;;;;;
* <code>perrow={integer}</code>: sets the number of images per row.
+
(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))
  
Example:
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 +
;; Document Engineering (AUCTeX + ConTeXt) ;;
 +
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 +
(load "auctex.el" nil t t)
 +
(load "preview-latex.el" nil t t)
  
Coding:
+
(setq TeX-auto-save 1)
<pre>
+
(setq TeX-parse-self 1)
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy">
+
(setq TeX-auto-untabify 1)
File:Example.jpg
+
(setq TeX-display-help 1)
File:Example.jpg
+
(setq TeX-save-query nil)
File:Example.jpg
+
(setq TeX-clean-confirm nil)
File:Example.jpg
+
(setq-default TeX-master nil)
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
</gallery>
+
</pre>
+
  
Result:
+
(add-hook 'TeX-mode-hook (lambda () (TeX-fold-mode 1)))
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy">
+
(add-hook 'TeX-mode-hook (lambda () (TeX-source-specials-mode 1)))
File:Example.jpg
+
(add-hook 'TeX-mode-hook (lambda () (TeX-toggle-debug-bad-boxes)))
File:Example.jpg
+
(add-hook 'TeX-mode-hook (lambda () (TeX-toggle-debug-warnings)))
File:Example.jpg
+
(add-hook 'TeX-mode-hook (lambda () (outline-minor-mode)))
File:Example.jpg
+
(add-hook 'TeX-mode-hook (lambda () (abbrev-mode t)))
File:Example.jpg
+
(add-hook 'TeX-mode-hook (lambda () (auto-fill-mode 1)))
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
File:Example.jpg
+
</gallery>
+
  
== Linking to an image without displaying it ==
+
(add-hook 'TeX-mode-hook 'LaTeX-math-mode)
=== Link to description page ===
+
If you put a colon (<code>:</code>) before <code>{{ns:image}}:</code>, the image will not be embedded and the link will lead to the description page of the file.
+
  
<nowiki>[[</nowiki>:{{ns:image}}:{{mediawiki:image_sample}}]]
+
(autoload 'etexshow "etexshow" "Browser for ConTeXt commands." t)
<nowiki>[[</nowiki>:{{ns:image}}:{{mediawiki:image_sample}}|Sunflowers]]
+
  
results in
+
(setq etexshow-xml-files-alist
 +
  `((,(concat emacs-root-dir "libs/etexshow/cont-en.xml") .
 +
      ,(concat "/tmp/cont-en.cache"))))
  
[[:{{ns:image}}:{{mediawiki:image_sample}}]]
+
(setq etexshow-comment-file
[[:{{ns:image}}:{{mediawiki:image_sample}}|Sunflowers]]
+
  (concat emacs-root-dir "libs/etexshow/cont-en-comments.xml"))
  
=== Link to another page ===
+
(setq TeX-PDF-mode 1)
This will make a 50px width picture with a link to the page [[MediaWiki]]:
+
(setq revert-without-query '(".+pdf$"))
 +
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
  
  <nowiki>[[</nowiki>File:Wiki.png|50px|link=MediaWiki]]
+
;;;;;;;;;;
 +
;; 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")))
  
[[File:Wiki.png|50px|link=MediaWiki]]
+
;;;;;;;;;;;;;;;;;
 +
;; Jabber Mode ;;
 +
;;;;;;;;;;;;;;;;;
  
=== Link directly to the media file ===
+
(require 'jabber-autoloads)
You can use the pseudo-namespace “{{ns:media}}” to link directly to a file without rendering it, bypassing the description page.
+
(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
 +
)
  
<nowiki>[[</nowiki>{{ns:media}}:{{mediawiki:image_sample}}]]
+
(add-hook 'jabber-chat-mode-hook 'goto-address)
<nowiki>[[</nowiki>{{ns:media}}:{{mediawiki:image_sample}}|Sunflowers]]
+
  
results in
+
(load "~/.emacs.d/plugins/autosmiley.el")
 +
(require 'autosmiley)
 +
(add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
  
[[{{ns:media}}:{{mediawiki:image_sample}}]]
+
(defvar libnotify-program "/usr/bin/notify-send")
[[{{ns:media}}:{{mediawiki:image_sample}}|Sunflowers]]
+
  
You can also use:&nbsp;
+
(defun notify-send (title message)
 +
  (start-process "notify" " notify"
 +
                libnotify-program "--expire-time=4000" title message))
  
<nowiki>[[</nowiki>{{#special:Filepath}}/{{mediawiki:image_sample}}]]
+
(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)))
  
which can be used to link to a potential file, even if it doesn't exist. You can also use:
+
(add-hook 'jabber-alert-message-hooks 'libnotify-jabber-notify)
  
<nowiki>{{</nowiki>FILEPATH:{{mediawiki:image_sample}}<nowiki>}}</nowiki>
+
(defun jabber-visit-history (jid)
 +
  "Visit jabber history with JID in a new buffer.
  
which generates an external URL to the file inline: {{FILEPATH:{{mediawiki:image_sample}}}}
+
Performs well only for small files. Expect to wait a few seconds
 +
for large histories. Adapted from `jabber-chat-create-buffer'."
 +
  (interactive (list (jabber-read-jid-completing "JID: ")))
 +
  (let ((buffer (generate-new-buffer (format "*-jabber-history-%s-*"
 +
                                            (jabber-jid-displayname jid)))))
 +
    (switch-to-buffer buffer)
 +
    (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)))
  
== Requisites ==
+
;;;;;;;;;;
Before using images in your page, the system administrator of your wiki must have {{mediawiki|Manual:Configuring file uploads|enabled file uploads}} and a user has to [[Help:Managing files|upload the file]]. System administrators may also set the wiki to accept files from {{mediawiki|Manual:Image Administration#Foreign Repositories|foreign repositories}}, such as the [http://commons.wikimedia.org/wiki/Main_Page Wikimedia Commons]. For server side image resizing it is necessary to have a scaler configured (such as GD2, ImageMagick, etc.).
+
;; EMMS ;;
 +
;;;;;;;;;;
 +
(require 'emms-setup)
 +
(emms-devel)
 +
(emms-default-players)
  
== Files at other websites ==
+
;;;;;;;;;
You can link to an external file available online using the same syntax used for linking to an external web page.  With these syntaxes, the image will not be rendered, but only the text of the link to this image will be displayed.
+
;; ERC ;;
<pre>[http://url.for/some/image.png]</pre>
+
;;;;;;;;;
 +
(require 'erc)
 +
(require 'erc-extension)
 +
(require 'erc-services)
 +
(require 'erc-tex)
 +
(require 'tls)
 +
(require 'erc-nicklist)
  
Or with a different displayed text:
+
(and
<pre>[http://url.for/some/image.png link text here]</pre>
+
(require 'erc-highlight-nicknames)
 +
(add-to-list 'erc-modules 'highlight-nicknames)
 +
(erc-update-modules))
  
Additional MediaWiki markup or HTML/CSS formatting (for inline elements) is permitted in this displayed text (with the exception of embedded links that would break the surrounding link):
+
(erc-services-mode 1)
<pre>[http://www.example.com/some/image.png Example '''<del>rich</del>''' ''<ins>link text</ins>'' here.]</pre>
+
which renders as: [http://www.example.com/some/image.png Example '''<del>rich</del>''' ''<ins>link text<ins>'' here.]
+
  
If it is enabled on your wiki (see {{mediawiki|Manual:$wgAllowExternalImages}}), you can also embed external images. To do that, simply insert the image's url:
+
(setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof
<pre>http://url.for/some/image.png</pre>
+
                            -CAfile /home/USER/.ssl/USER.pem
Currently, embedded images cannot be resized, but they may be formatted by surrounding MediaWiki markup or HTML/CSS code.
+
                            -cert /home/USER/.ssl/USER.pem"
 +
                    "gnutls-cli --priority secure256
 +
                                --x509cafile /home/USER/.ssl/USER.pem
 +
                                --x509certfile /home/USER/.ssl/USER.pem -p %p %h"
 +
                    "gnutls-cli --priority secure256 -p %p %h"))
  
If this wiki option is not enabled, the image will not be embedded but rendered as a textual link to the external site, just like above.
+
(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)
 +
(eval-after-load 'erc '(erc-nick-notify-mode t))
 +
(defun irc-erc ()
 +
  "Fire up IRC."
 +
  (interactive)
 +
  (erc-tls :server "chat.freenode.net" :port 7000 :nick "USER" :full-name "FULL NAME" :password "PASSWORD"))
 +
 
 +
(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)
 +
 
 +
(require 'smiley)
 +
    (add-to-list 'smiley-regexp-alist '("\\(:-?]\\)\\W" 1 "forced"))
 +
    (add-to-list 'smiley-regexp-alist '("\\s-\\(:-?/\\)\\W" 1 "wry"))
 +
    (add-to-list 'smiley-regexp-alist '("\\(:-?(\\)\\W" 1 "sad"))
 +
    (add-to-list 'smiley-regexp-alist '("\\((-?:\\)\\W" 1 "reverse-smile"))
 +
    (add-to-list 'smiley-regexp-alist '("\\(:-?D\\)\\W" 1 "grin"))
 +
    (add-to-list 'smiley-regexp-alist '("\\(:-?P\\)\\W" 1 "poke"))
 +
 
 +
;; (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)))
 +
 
 +
;;;;;;;;;;;;;;;;;;;;;
 +
;; 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 ====
 +
<pre>
 +
;; 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)
 +
</pre>
 +
 
 +
==== .folders ====
 +
<pre>
 +
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"
 +
}
 +
</pre>
  
{{Languages}}
+
[[Category:HOWTO]]
[[Category:Help|Images]]
+
[[Category:Featured]]

Revision as of 17:35, 22 February 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, run the following command:

# emerge -av emacs

for the standard gnu emacs app-editors/xemacs 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

Edit the file ~/.emacs:

;;;;;;;;;;;;;;;;;;;;;;
;; General Settings ;;
;;;;;;;;;;;;;;;;;;;;;;

(setq emacs-root-dir (concat (getenv "HOME") "/em/"))

(setq inhibit-startup-message t)    ;; Suppress the startup message
(setq standard-indent 4)            ;; Default indent level is 3 chars
(setq-default indent-tabs-mode nil) ;; Indent with spaces, not tabs

(setq make-backup-files nil)          ;; Enable backup files.
(setq version-control nil)            ;; Enable versioning with default values
(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))  ;; Save all backup file in this directory.

(line-number-mode 1)                ;; Show line-number in the mode line
(column-number-mode 1)              ;; Show column-number in the mode line

(setq auto-fill-mode 1)             ;; Line wrap

(set-default-font "Inconsolata-12")

(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "google-chrome")

(global-set-key (kbd "C-<prior>") 'previous-buffer)
(global-set-key (kbd "C-<next>" ) 'next-buffer    )


(setq load-path (cons "~/.emacs.d/plugins" load-path))

(setq global-font-lock-mode 1)

(show-paren-mode 1)

;;;;;;;;;;;;;;;;;;
;; el-get setup ;;
;;;;;;;;;;;;;;;;;;
(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)))

(el-get 'sync)

;;;;;;;;;;;;;;;
;; mediawiki ;;
;;;;;;;;;;;;;;;
(require 'mediawiki)

;;;;;;;;;;;;;;;;;;;;
;; Org-mode stuff ;;
;;;;;;;;;;;;;;;;;;;;

;; Tell emacs where org-mode is
;;(setq load-path (cons "/usr/share/emacs/site-lisp/org-mode/" load-path))
;;(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

;; Some key sequences
(define-key global-map "\C-cl" 'org-store-link) 
(define-key global-map "\C-ca" 'org-agenda)
(global-set-key [f9]    'org-archive-subtree-default)

(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

(setq org-directory "~/notes")

;; Files that should be included in agenda views:
(setq org-agenda-files (list "~/notes/business.org"
                             "~/notes/personal.org" 
                             "~/notes/projects/"
			     "~/notes/projects/writing/"))

(setq org-todo-keywords '((type "TODO" "Postponed" "Upcoming" "Doing" "|" "DONE(#)"))) ;; TODO workflows

(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

;; Capture stuff
(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)

(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")))

(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")

;;;;;;;;;;;;;;;;;;;
;; Markdown Mode ;;
;;;;;;;;;;;;;;;;;;;

(require 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))

;;;;;;;;;;;;;;;;
;; 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 . "* "))
)

;; This is a very crude hook that auto-selects the C style depending on
;; 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)

;;;;;;;;;;;;
;; Django ;;
;;;;;;;;;;;;
(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))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Document Engineering (AUCTeX + ConTeXt) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

(setq TeX-auto-save 1)
(setq TeX-parse-self 1)
(setq TeX-auto-untabify 1)
(setq TeX-display-help 1)
(setq TeX-save-query nil)
(setq TeX-clean-confirm nil)
(setq-default TeX-master nil)

(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)))

(add-hook 'TeX-mode-hook 'LaTeX-math-mode)

(autoload 'etexshow "etexshow" "Browser for ConTeXt commands." t)

(setq etexshow-xml-files-alist
   `((,(concat emacs-root-dir "libs/etexshow/cont-en.xml") .
      ,(concat "/tmp/cont-en.cache"))))

(setq etexshow-comment-file
   (concat emacs-root-dir "libs/etexshow/cont-en-comments.xml"))

(setq TeX-PDF-mode 1)
(setq revert-without-query '(".+pdf$"))
(add-hook 'doc-view-mode-hook 'auto-revert-mode)

;;;;;;;;;;
;; 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")))

;;;;;;;;;;;;;;;;;
;; Jabber Mode ;;
;;;;;;;;;;;;;;;;;

(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
)

(add-hook 'jabber-chat-mode-hook 'goto-address)

(load "~/.emacs.d/plugins/autosmiley.el")
(require 'autosmiley)
(add-hook 'jabber-chat-mode-hook 'autosmiley-mode)

(defvar libnotify-program "/usr/bin/notify-send")

(defun notify-send (title message)
  (start-process "notify" " notify"
                 libnotify-program "--expire-time=4000" title message))

(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)))

(add-hook 'jabber-alert-message-hooks 'libnotify-jabber-notify)

(defun jabber-visit-history (jid)
  "Visit jabber history with JID in a new buffer.

Performs well only for small files. Expect to wait a few seconds
for large histories. Adapted from `jabber-chat-create-buffer'."
  (interactive (list (jabber-read-jid-completing "JID: ")))
  (let ((buffer (generate-new-buffer (format "*-jabber-history-%s-*"
                                             (jabber-jid-displayname jid)))))
    (switch-to-buffer buffer)
    (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)))

;;;;;;;;;;
;; EMMS ;;
;;;;;;;;;;
(require 'emms-setup)
(emms-devel)
(emms-default-players)

;;;;;;;;;
;; ERC ;;
;;;;;;;;;
(require 'erc)
(require 'erc-extension)
(require 'erc-services)
(require 'erc-tex)
(require 'tls)
(require 'erc-nicklist)

(and
 (require 'erc-highlight-nicknames)
 (add-to-list 'erc-modules 'highlight-nicknames)
 (erc-update-modules))

(erc-services-mode 1)

(setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof
                            -CAfile /home/USER/.ssl/USER.pem 
                            -cert /home/USER/.ssl/USER.pem"
                    "gnutls-cli --priority secure256
                                --x509cafile /home/USER/.ssl/USER.pem 
                                --x509certfile /home/USER/.ssl/USER.pem -p %p %h"
                    "gnutls-cli --priority secure256 -p %p %h"))

(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)
(eval-after-load 'erc '(erc-nick-notify-mode t))
(defun irc-erc ()
  "Fire up IRC."
  (interactive)
  (erc-tls :server "chat.freenode.net" :port 7000 :nick "USER" :full-name "FULL NAME" :password "PASSWORD"))

(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)

(require 'smiley)
    (add-to-list 'smiley-regexp-alist '("\\(:-?]\\)\\W" 1 "forced"))
    (add-to-list 'smiley-regexp-alist '("\\s-\\(:-?/\\)\\W" 1 "wry"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?(\\)\\W" 1 "sad"))
    (add-to-list 'smiley-regexp-alist '("\\((-?:\\)\\W" 1 "reverse-smile"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?D\\)\\W" 1 "grin"))
    (add-to-list 'smiley-regexp-alist '("\\(:-?P\\)\\W" 1 "poke"))

;; (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)))

;;;;;;;;;;;;;;;;;;;;;
;; 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)

.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

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"
}