Humus numericus - Emacs, Gnus2019-05-09T20:00:29+02:00urn:md5:c2531a830c9d2a52c5500061b4d5077eDotclearel-get, un gestionnaire de script/package/extension pour Emacsurn:md5:b89aa2205ea8e6c0f238c66ecb4bb97f2011-09-20T21:06:00+02:002011-09-20T23:19:18+02:00JubaEmacs, Gnus
<p>Un des aspects parfois fastidieux d'Emacs est la gestion de tous les scripts et extensions non inclus dans la distribution de base, qu'on récupère deci-delà et dont il faut gérer les version, les mises à jour, l'inclusion dans son <code>.emacs</code>, etc. </p> <p> Pour remédier à ce problème, différents scripts existent, comme <a href="http://www.emacswiki.org/emacs/AutoInstall">Auto Install</a>, plutôt centré sur les scripts hébergés sur <a href="http://www.emacswiki.org">EmacsWiki</a>, <a href="http://tromey.com/elpa/">ELPA et l'extension package</a>, et <a href="http://www.emacswiki.org/emacs/CategoryPackaging">bien d'autres</a>… </p> <p> Or je viens de découvrir grâce à <a href="http://twitter.com/#!/tapoueh/status/114682699544920064">un retweet</a> de <a href="http://julien.danjou.info/blog/">Julien Danjou</a> un projet que je ne connaissais pas : <a href="https://github.com/dimitri/el-get">el-get</a>. Et il s'avère que ce système est tout simplement génial, et que j'y ai du coup migré dans la foulée la gestion de la totalité de mes scripts Emacs. </p> <p> Pour le dire vite, <code>el-get</code> permet d'installer des scripts et extensions depuis quasiment toutes les sources imaginables (git, url, fichier, emacswiki, elpa, etc.), automatise leur installation, ajoute automatiquement les <code>require</code> et autres directives qui vont bien, et permet une mise à jour et une synchronisation très simple des extensions installées. </p> <div id="outline-container-1" class="outline-3"> <h3 id="sec-1">Installation</h3> <div class="outline-text-3" id="text-1"> <p> L'installation d'<code>el-get</code> se fait en ajoutant les lignes suivantes dans son <code>.emacs</code> et en les exécutant : </p> <pre class="src src-emacs-lisp">(add-to-list 'load-path <span class="org-string">"~/.emacs.d/el-get/el-get"</span>)
(<span class="org-keyword">unless</span> (<span class="org-keyword">require</span> '<span class="org-constant">el-get</span> nil t)
(url-retrieve
<span class="org-string">"https://raw.github.com/dimitri/el-get/master/el-get-install.el"</span>
(<span class="org-keyword">lambda</span> (s)
(end-of-buffer)
(eval-print-last-sexp))))
</pre> <p> Ces instructions vérifient qu'<code>el-get</code> est déjà installé et, sinon, le télécharge via git et l'installe dans <code>~/.emacs.d/el-get/el-get</code>. </p> <blockquote>
<p><b>Note :</b> en cas de message d'erreur lié à la variable <code>el-get-verbose</code>,
ajouter la ligne <code>(setq el-get-verbose t)</code> dans son <code>.emacs</code> peut suffire à
résoudre le problème.
</p>
</blockquote> </div> </div> <div id="outline-container-2" class="outline-3"> <h3 id="sec-2">Utilisation interactive</h3> <div class="outline-text-3" id="text-2"> <p> <code>el-get</code> est fourni avec un certain nombre de «recettes» (<i>recipes</i>) qui décrivent l'installation d'<a href="https://github.com/dimitri/el-get/tree/master/recipes">un grand nombre d'extensions</a>. </p> <p> Imaginons que nous souhaitons installer <a href="http://julien.danjou.info/rainbow-mode.html">rainbow-mode</a> par exemple. Rien de plus simple. Il suffit de faire <code>M-x el-get-install</code>, de saisir <code>rainbow-mode</code> au prompt, et de laisser <code>el-get</code> faire le boulot, c'est à dire : </p> <ul> <li>télécharger les fichiers nécessaires </li> <li>les installer dans <code>~/.emacs/el-get</code> </li> <li>byte-compiler les fichiers </li> <li>installer et exécuter automatiquement les <code>require</code> et autre <code>autoloads</code> nécessaires à l'utilisation de l'extension </li> <li>et, en cadeau bonux, il fait tout ça de manière <i>asynchrone</i> (vous pouvez continuer à utiliser Emacs pendant ce temps) et vous prévient qu'il a fini avec une jolie notification ! </li> </ul> <p> Une fois l'opération effectuée, même pas besoin d'éditer son <code>.emacs</code>, l'extension est immédiatement disponible et un <code>M-x rainbow-mode</code> marche immédiatement. </p> <p> Le plus fort, c'est que ça fonctionne pour des extensions de petite taille, mais aussi pour des mastodontes nécessitant dépendances et compilations, comme <a href="http://orgmode.org/">org-mode</a> ou <a href="http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html">nXhtml</a> ! </p> <p> Vous avez testé une extension et vous ne souhaitez pas la conserver ? Hop, <code>el-get-remove</code>. Vous souhaitez mettre à jour l'une d'entre elles ? Hop, <code>el-get-update</code>. Etc., etc. </p> </div> </div> <div id="outline-container-3" class="outline-3"> <h3 id="sec-3">Installation depuis EmacsWiki</h3> <div class="outline-text-3" id="text-3"> <p> Vous souhaitez installer un fichier hébergé sur EmacsWiki ? Pas de problème, il suffit de faire un petit <code>M-x el-get-emacswiki-refresh</code>, d'attendre la jolie notification, et à partir de là <i>l'intégralité</i> des fichiers hébergés sur EmacsWiki sont automatiquement disponibles et installables avec <code>el-get-install</code> ! </p> </div> </div> <div id="outline-container-4" class="outline-3"> <h3 id="sec-4">Sauvegarde et synchronisation de la liste des extensions</h3> <div class="outline-text-3" id="text-4"> <p> Jusqu'à présent je gérais mes différents fichiers de configuration emacs dans un dépôt git, qui me permettait à la fois de garder l'historique et de synchroniser entre différentes machines. Là où ça devient plus compliqué, c'est quand on installe des extensions elles-mêmes sous git (problèmes de conflits pour des dépôts inclus dans des dépôts, même si git sait gérer ça très bien) ou sous d'autres gestionnaires de version. </p> <p> <code>el-get</code> permet de gérer cela de manière très élégantes : il suffit de déclarer dans son <code>.emacs</code> la liste des extensions utilisées pour qu'elles soient automatiquement vérifiées au démarrage et installées si nécessaire. </p> <p> Par exemple, voici ce que j'ai dans mon <code>.emacs</code> : </p> <pre class="src src-emacs-lisp">(setq my:el-get-packages
'(xml-rpc-el
yasnippet
org-mode
anything
auto-dictionnary
autopair
calfw
coffee-mode
color-theme
dired+
edit-server
fixme-mode
flymake-ruby
gist
google-maps
js2-mode
nxhtml
org2blog
rainbow-mode
r-autoyas
rvm
switch-window
sr-speedbar
typopunct
))
(el-get 'sync my:el-get-packages)
</pre> <p> La variable <code>my:el-get-packages</code> contient la liste des extensions utilisées, et la fonction <code>(el get 'sync)</code> va automatiquement vérifier que toutes les extensions spécifiées sont installées sur le système. Et si ça n'est pas le cas, elle les installe. </p> <p> Donc, plus besoin d'enregistrer les fichiers des extensions proprement dites dans le dépôt git de sa config emacs, il suffit de spécifier leur liste dans son <code>.emacs</code> et <code>el-get</code> se charge du reste. </p> </div> </div> <div id="outline-container-5" class="outline-3"> <h3 id="sec-5">Ajouter ses propres recettes</h3> <div class="outline-text-3" id="text-5"> <p> Il peut arriver qu'une extension ne soit disponible ni sur EmacsWiki ni parmi les recettes fournies. Dans ce cas il est possible et assez simple de créer sa propre recette. </p> <p> Prenons par exemple le fichier <code>pwsafe.el</code>, qui est une interface entre Emacs et <a href="http://nsd.dyndns.org/pwsafe/">pwsafe</a>. Celui-ci n'est disponible qu'en téléchargement direct <a href="http://www.xsteve.at/prg/emacs/pwsafe.html">depuis le site de son auteur.</a> </p> <p> La «recette» d'installation correspondante est très simple : </p> <pre class="src src-emacs-lisp">(<span class="org-builtin">:name</span> pwsafe
<span class="org-builtin">:description</span> <span class="org-string">"Emacs interface to pwsafe, by Stefan Reichoer"</span>
<span class="org-builtin">:type</span> http
<span class="org-builtin">:url</span> <span class="org-string">"http://www.xsteve.at/prg/emacs/pwsafe.el"</span>)
</pre> <p> Dans le cas du thème <a href="http://blog.nozav.org/post/2010/07/12/Updated-tangotango-emacs-color-theme">color-theme-tangotango</a>, hébergé sur GtiHub, c'est pas plus compliqué : </p> <pre class="src src-emacs-lisp">(<span class="org-builtin">:name</span> color-theme-tangotango
<span class="org-builtin">:description</span> <span class="org-string">"Another color theme based on the Tango palette."</span>
<span class="org-builtin">:type</span> git
<span class="org-builtin">:url</span> <span class="org-string">"https://github.com/juba/color-theme-tangotango.git"</span>)
</pre> <p> Pour ajouter une recette à <code>el-get</code>, on peut l'ajouter directement dans son <code>.emacs</code> : </p> <pre class="src src-emacs-lisp">(setq my:el-get-packages
'(xml-rpc-el
yasnippet
org-mode
[…]
))
(setq el-get-sources
'((<span class="org-builtin">:name</span> pwsafe
<span class="org-builtin">:description</span> <span class="org-string">"Emacs interface to pwsafe, by Stefan Reichoer"</span>
<span class="org-builtin">:type</span> http
<span class="org-builtin">:url</span> <span class="org-string">"http://www.xsteve.at/prg/emacs/pwsafe.el"</span>)))
(setq my-packages
(append
my:el-get-packages
(mapcar 'el-get-source-name el-get-sources)))
(el-get 'sync my-packages)
</pre> </div> </div> <div id="outline-container-6" class="outline-3"> <h3 id="sec-6">Aller plus loin</h3> <div class="outline-text-3" id="text-6"> <p> Pour avoir un aperçu plus complet des fonctionnalités d'<code>el-get</code>, l'idéal est de consulter le <a href="https://github.com/dimitri/el-get/blob/master/README.asciidoc">README</a> sur GitHub. </p></div> </div> Une fonction Emacs qu'elle est utileurn:md5:cfa880060cbdae3c32f38433249768ed2011-09-15T11:47:00+02:002011-09-15T13:48:35+02:00JubaEmacs, Gnus
<p>Un des trucs que j'adore sous <a href="http://www.orgmode.org">org-mode</a>, c'est la possibilité de déplacer des éléments (items de listes, titres, sections, etc.) avec <code>M-haut</code> et <code>M-bas</code>. </p> <p> J'ai réalisé ce matin que je passais quand même un certain temps, lors de l'édition de fichiers, à enchaîner les <code>C-k</code> et <code>C-y</code> pour déplacer des lignes entières. Ça serait-y pas plus pratique de pouvoir utiliser <code>M-haut</code> et <code>M-bas</code> partout pour déplacer les lignes de la même manière que sous org-mode ? </p> <p> Un petit tour sur <a href="http://www.emacswiki.org/emacs/MoveLine">EmacsWiki</a>, et voilà : </p> <pre class="src src-emacs-lisp">(<span class="org-keyword">defun</span> <span class="org-function-name">move-line</span> (n)
<span class="org-doc">"Move the current line up or down by N lines."</span>
(interactive <span class="org-string">"p"</span>)
(setq col (current-column))
(beginning-of-line) (setq start (point))
(end-of-line) (forward-char) (setq end (point))
(<span class="org-keyword">let</span> ((line-text (delete-and-extract-region start end)))
(forward-line n)
(insert line-text)
<span class="org-comment-delimiter">;; </span><span class="org-comment">restore point to original column in moved line</span>
(forward-line -1)
(forward-char col)))
(<span class="org-keyword">defun</span> <span class="org-function-name">move-line-up</span> (n)
<span class="org-doc">"Move the current line up by N lines."</span>
(interactive <span class="org-string">"p"</span>)
(move-line (<span class="org-keyword">if</span> (null n) -1 (- n))))
(<span class="org-keyword">defun</span> <span class="org-function-name">move-line-down</span> (n)
<span class="org-doc">"Move the current line down by N lines."</span>
(interactive <span class="org-string">"p"</span>)
(move-line (<span class="org-keyword">if</span> (null n) 1 n)))
(global-set-key (kbd <span class="org-string">"M-<up>"</span>) 'move-line-up)
(global-set-key (kbd <span class="org-string">"M-<down>"</span>) 'move-line-down)
</pre> <p> On rajoute ça à son <code>.emacs</code>, et boudiou que c'est pratique ! </p>How to post on a dotclear blog with org-modeurn:md5:3fc2674b03d07b231cf964f22647c37d2011-01-03T23:36:00+01:002015-12-04T01:16:05+01:00JubaEmacs, Gnus <p>I just discovered a very great tool called <i>org2blog</i> that allows to post articles to a <i>Wordpress</i> blog directly from Emacs’ <i>org-mode</i> :</p><p><a href="https://github.com/punchagan/org2blog">https://github.com/punchagan/org2blog</a></p><p>You just have to set up <i>org2blog</i> with the xmlrpc interface of your blog, and then you can create a new org-mode buffer which will be automatically exported to html and then published to your blog.</p><p>Some very great features :</p><ul><li>HTML export, source code highlighting, org-babel, etc. are fully supported out of the box !</li><li>you can use an existing org-mode buffer or create a new one to post your article</li><li>thanks to the embedded post id in the org-mode buffer, you can edit and update an already posted article</li><li>categories and tags are supported as <code>CATEGORY</code> and <code>TAGS</code> buffer properties, and it even features autocompletion !</li></ul><p>You can even post some images directly form your org-file :</p><p><img alt="/public/_____________20110104_org2mode.jpg" src="https://blog.nozav.org/public/_____________20110104_org2mode.jpg" /></p><p>And, finally, I also discovered that <i>org2blog</i> fully supports <a href="http://www.dotclear.org">Dotclear</a> via it’s xml-rpc interface. So I think I know how I will post content on this blog now.</p><p>And, finally, just a little proof that org-babel works :</p><pre class="src src-R">x <span style="color: #8ae234;"><-</span> rnorm(100)
summary(x)
</pre><pre class="example"> Min. 1st Qu. Median Mean 3rd Qu. Max.
-1.9840 -0.5460 0.1608 0.1768 0.8476 2.2070
</pre>Updated tangotango emacs color themeurn:md5:0f1851d93f2f10adc4cc4dda897e03f12010-07-12T11:45:00+02:002012-10-14T21:00:08+02:00JubaEmacs, Gnusemacsgnusorg-modetangotango <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://github.com/juba/color-theme-tangotango"></a>
<p><strong>EDIT : This post is now quite deprecated. Installation instructions and new versions are posted on the <a href="https://github.com/juba/color-theme-tangotango" hreflang="en">github project page</a>.</strong></p>
<p>I just updated my <a href="https://blog.nozav.org/post/2010/02/10/Tangotango-emacs-color-theme" hreflang="en">original ”tangotango” emacs color theme</a>, based on the tango palette colors. I’ve tweaked some details and moved the source code to <a href="http://github.com/juba/color-theme-tangotango" hreflang="en">github</a>. Here are updated installation instructions and screenshots :</p>
<h3>Installation instructions</h3>
<ol>
<li>Download and install the <code>color-theme</code> emacs package either via your linux distribution or <a href="http://www.nongnu.org/color-theme/#sec5" hreflang="en">via the source tarball</a></li>
<li>Download and install <code>color-theme-tangotango.el</code> <a href="http://github.com/juba/color-theme-tangotango/raw/master/color-theme-tangotango.el">from github</a></li>
<li>Make sure that both <code>color-theme.el</code> and <code>color-theme-tangotango.el</code> are in your load path</li>
</ol>
<p>There are several ways to load the <em>tangotango</em> color theme from your <code>.emacs</code>, as documented <a href="http://www.emacswiki.org/emacs/ColorTheme" hreflang="en">on emacswiki</a>. The way I currently use should work for a daemonized emacs and allows the selection of different themes for GUI or console based frames :</p>
<pre>
(require 'color-theme)
(setq color-theme-load-all-themes nil)
(require 'color-theme-tangotango)
;; select theme - first list element is for windowing system, second is for console/terminal
;; Source : http://www.emacswiki.org/emacs/ColorTheme#toc9
(setq color-theme-choices
'(color-theme-tangotango color-theme-tangotango))
;; default-start
(funcall (lambda (cols)
(let ((color-theme-is-global nil))
(eval
(append '(if (window-system))
(mapcar (lambda (x) (cons x nil))
cols)))))
color-theme-choices)
;; test for each additional frame or console
(require 'cl)
(fset 'test-win-sys
(funcall (lambda (cols)
(lexical-let ((cols cols))
(lambda (frame)
(let ((color-theme-is-global nil))
;; must be current for local ctheme
(select-frame frame)
;; test winsystem
(eval
(append '(if (window-system frame))
(mapcar (lambda (x) (cons x nil))
cols)))))))
color-theme-choices ))
;; hook on after-make-frame-functions
(add-hook 'after-make-frame-functions 'test-win-sys)
(color-theme-tangotango)
</pre>
<p>Note that I also had to add a <code>(color-theme-tangotango)</code> line at the end of my <code>.gnus</code> file in order to apply the color theme to Gnus.</p>
<h3>Screenshots</h3>
<p>Here is a screenshot of the color theme with an emacs-lisp file :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_elisp.png" alt="tangotango_elisp.png" style="display:block; margin:0 auto;" title="tangotango_elisp.png, juillet 2010" /></p>
<p>One with a Gnus summary and article buffers :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_gnus.png" alt="tangotango_gnus.png" style="display:block; margin:0 auto;" title="tangotango_gnus.png, juillet 2010" /></p>
<p>And one with an org-mode buffer :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_org.png" alt="tangotango_org.png" style="display:block; margin:0 auto;" title="tangotango_org.png, juillet 2010" /></p>Tangotango dark emacs color themeurn:md5:b0030d2c51b71fedb2948876d4c2e3002010-02-10T16:54:00+01:002010-07-12T11:49:24+02:00JubaEmacs, Gnusemacsgnusorg-modetangotango <p><strong>UPDATE :</strong> This entry is <strong>deprecated</strong> ! Source code has been moved to Github and installation instructions <a href="https://blog.nozav.org/post/2010/07/12/Updated-tangotango-emacs-color-theme" hreflang="en">have been rewritten</a>.</p>
<p>I always have used the default Emacs color theme, with a white background. Recently I wanted to switch to a dark background but didn’t find a color scheme taht I’d like enough to use, so Is tarted to create one myself. In fact I started with <a href="http://www.emacswiki.org/emacs/color-theme-tango.el" hreflang="en">the tango color theme on EmacsWiki</a>, modified a bit, and added some faces to support gnus and org-mode as I use them a lot.</p>
<p>The result is a color theme named <em>tangotango</em> whose code is the following :</p>
<pre>
(defun color-theme-tangotango ()
"A color theme based on Tango Palette."
(interactive)
(color-theme-install
'(color-theme-tango
((background-color . "#2e3436")
(background-mode . dark)
(border-color . "#888a85")
(cursor-color . "#fce94f")
(foreground-color . "#eeeeec")
(mouse-color . "#8ae234"))
((help-highlight-face . underline)
(ibuffer-dired-buffer-face . font-lock-function-name-face)
(ibuffer-help-buffer-face . font-lock-comment-face)
(ibuffer-hidden-buffer-face . font-lock-warning-face)
(ibuffer-occur-match-face . font-lock-warning-face)
(ibuffer-read-only-buffer-face . font-lock-type-face)
(ibuffer-special-buffer-face . font-lock-keyword-face)
(ibuffer-title-face . font-lock-type-face))
(highlight ((t (:background "brown4" :foreground nil))))
(border ((t (:background "#888a85"))))
(fringe ((t (:background "grey10"))))
(mode-line ((t (:foreground "#bbbbbc" :background "#222222" :box (:line-width 1 :color nil :style released-button)))))
(mode-line-inactive ((t (:foreground "#bbbbbc" :background "#555753"))))
(mode-line-buffer-id ((t (:bold t :foreground "orange" :background nil))))
(region ((t (:background "dark slate blue"))))
(link ((t (:underline t :foreground "dodger blue"))))
(custom-link ((t (:inherit 'link))))
(match ((t (:bold t :background "#e9b96e" :foreground "#2e3436"))))
(tool-tips ((t (:inherit 'variable-pitch :foreground "black" :background "lightyellow"))))
(tooltip ((t (:inherit 'variable-pitch :foreground "black" :background "lightyellow"))))
(bold ((t (:bold t :underline nil :background nil))))
(italic ((t (:italic t :underline nil :background nil))))
(font-lock-builtin-face ((t (:foreground "#729fcf"))))
(font-lock-comment-face ((t (:foreground "#888a85"))))
(font-lock-constant-face ((t (:foreground "#8ae234"))))
(font-lock-doc-face ((t (:foreground "#888a85"))))
(font-lock-keyword-face ((t (:foreground "#729fcf" :bold t))))
(font-lock-string-face ((t (:foreground "#ad7fa8" :italic t))))
(font-lock-type-face ((t (:foreground "#8ae234" :bold t))))
(font-lock-variable-name-face ((t (:foreground "tomato"))))
(font-lock-warning-face ((t (:bold t :foreground "#f57900"))))
(font-lock-function-name-face ((t (:foreground "#edd400" :bold t))))
(comint-highlight-input ((t (:italic t :bold t))))
(comint-highlight-prompt ((t (:foreground "#8ae234"))))
(isearch ((t (:background "#f57900" :foreground "#2e3436"))))
(isearch-lazy-highlight-face ((t (:foreground "#2e3436" :background "#e9b96e"))))
(show-paren-match-face ((t (:foreground "#2e3436" :background "#73d216"))))
(show-paren-mismatch-face ((t (:background "#ad7fa8" :foreground "#2e3436"))))
(minibuffer-prompt ((t (:foreground "#729fcf" :bold t))))
(info-xref ((t (:foreground "#729fcf"))))
(info-xref-visited ((t (:foreground "#ad7fa8"))))
(diary-face ((t (:bold t :foreground "IndianRed"))))
(eshell-ls-clutter-face ((t (:bold t :foreground "DimGray"))))
(eshell-ls-executable-face ((t (:bold t :foreground "Coral"))))
(eshell-ls-missing-face ((t (:bold t :foreground "black"))))
(eshell-ls-special-face ((t (:bold t :foreground "Gold"))))
(eshell-ls-symlink-face ((t (:bold t :foreground "White"))))
(widget-button ((t (:bold t))))
(widget-mouse-face ((t (:bold t :foreground "white" :background "brown4"))))
(widget-field ((t (:foreground "orange" :background "gray30"))))
(widget-single-line-field ((t (:foreground "orange" :background "gray30"))))
(custom-group-tag ((t (:bold t :foreground "#edd400" :height 1.3))))
(custom-variable-tag ((t (:bold t :foreground "#edd400" :height 1.1))))
(custom-face-tag ((t (:bold t :foreground "#edd400" :height 1.1))))
(custom-state-face ((t (:foreground "#729fcf"))))
(custom-button ((t (:box (:line-width 1 :style released-button) :background "grey50" :foreground "black"))))
(custom-variable-button ((t (:inherit 'custom-button))))
(custom-button-mouse ((t (:inherit 'custom-button :background "grey60"))))
(custom-button-unraised ((t (:background "grey50" :foreground "black"))))
(custom-button-mouse-unraised ((t (:inherit 'custom-button-unraised :background "grey60"))))
(custom-button-pressed ((t (:inherit 'custom-button :box (:style pressed-button)))))
(custom-button-mouse-pressed-unraised ((t (:inherit 'custom-button-unraised :background "grey60"))))
(custom-documentation ((t (:italic t))))
(message-cited-text ((t (:foreground "#edd400"))))
(gnus-cite-face-1 ((t (:foreground "#ad7fa8"))))
(gnus-cite-face-2 ((t (:foreground "sienna4"))))
(gnus-cite-face-3 ((t (:foreground "khaki4"))))
(gnus-cite-face-4 ((t (:foreground "PaleTurquoise4"))))
(gnus-group-mail-1-empty-face ((t (:foreground "light cyan"))))
(gnus-group-mail-1-face ((t (:bold t :foreground "light cyan"))))
(gnus-group-mail-2-empty-face ((t (:foreground "turquoise"))))
(gnus-group-mail-2-face ((t (:bold t :foreground "turquoise"))))
(gnus-group-mail-3-empty-face ((t (:foreground "#729fcf"))))
(gnus-group-mail-3-face ((t (:bold t :foreground "#edd400"))))
(gnus-group-mail-low-empty-face ((t (:foreground "dodger blue"))))
(gnus-group-mail-low-face ((t (:bold t :foreground "dodger blue"))))
(gnus-group-news-1-empty-face ((t (:foreground "light cyan"))))
(gnus-group-news-1-face ((t (:bold t :foreground "light cyan"))))
(gnus-group-news-2-empty-face ((t (:foreground "turquoise"))))
(gnus-group-news-2-face ((t (:bold t :foreground "turquoise"))))
(gnus-group-news-3-empty-face ((t (:foreground "#729fcf"))))
(gnus-group-news-3-face ((t (:bold t :foreground "#edd400"))))
(gnus-group-news-low-empty-face ((t (:foreground "dodger blue"))))
(gnus-group-news-low-face ((t (:bold t :foreground "dodger blue"))))
(gnus-header-name-face ((t (:bold t :foreground "#729fcf"))))
(gnus-header-from ((t (:bold t :foreground "#edd400"))))
(gnus-header-subject ((t (:foreground "#edd400"))))
(gnus-header-content ((t (:italic t :foreground "#8ae234"))))
(gnus-header-newsgroups-face ((t (:italic t :bold t :foreground "LightSkyBlue3"))))
(gnus-signature-face ((t (:italic t :foreground "dark grey"))))
(gnus-summary-cancelled-face ((t (:background "black" :foreground "yellow"))))
(gnus-summary-high-ancient-face ((t (:bold t :foreground "rotal blue"))))
(gnus-summary-high-read-face ((t (:bold t :foreground "lime green"))))
(gnus-summary-high-ticked-face ((t (:bold t :foreground "tomato"))))
(gnus-summary-high-unread-face ((t (:bold t :foreground "white"))))
(gnus-summary-low-ancient-face ((t (:italic t :foreground "lime green"))))
(gnus-summary-low-read-face ((t (:italic t :foreground "royal blue"))))
(gnus-summary-low-ticked-face ((t (:italic t :foreground "dark red"))))
(gnus-summary-low-unread-face ((t (:italic t :foreground "white"))))
(gnus-summary-normal-ancient-face ((t (:foreground "royal blue"))))
(gnus-summary-normal-read-face ((t (:foreground "lime green"))))
(gnus-summary-normal-ticked-face ((t (:foreground "indian red"))))
(gnus-summary-normal-unread-face ((t (:foreground "white"))))
(gnus-summary-selected ((t (:background "brown4" :foreground "white"))))
(message-header-name-face ((t (:foreground "tomato"))))
(message-header-newsgroups-face ((t (:italic t :bold t :foreground "LightSkyBlue3"))))
(message-header-other-face ((t (:foreground "LightSkyBlue3"))))
(message-header-xheader-face ((t (:foreground "DodgerBlue3"))))
(message-header-subject ((t (:foreground "white"))))
(message-header-to ((t (:foreground "white"))))
(message-header-cc ((t (:foreground "white"))))
(org-hide ((t (:foreground "#2e3436"))))
(org-level-1 ((t (:bold t :foreground "dodger blue" :height 1.5))))
(org-level-2 ((t (:bold t :foreground "#6ac214" :height 1.2))))
(org-level-3 ((t (:bold t :foreground "#edd400" :height 1.1))))
(org-level-4 ((t (:bold t :foreground "tomato" :height 1.0))))
(org-date ((t (:underline t :foreground "magenta3"))))
(org-footnote ((t (:underline t :foreground "magenta3"))))
(org-link ((t (:foreground "skyblue2" :background "#2e3436"))))
(org-special-keyword ((t (:foreground "brown"))))
(org-verbatim ((t (:foreground "#eeeeec" :underline t :slant italic))))
(org-block ((t (:foreground "#bbbbbc"))))
(org-quote ((t (:inherit org-block :slant italic))))
(org-verse ((t (:inherit org-block :slant italic))))
(org-todo ((t (:bold t :foreground "Red"))))
(org-done ((t (:bold t :foreground "ForestGreen"))))
(anything-header ((t (:bold t :background "grey15" :foreground "#edd400"))))
)))
</pre>
<p>Obviously you need to install and configure the color-theme Emacs extension to use it. You will find instructions on <a href="http://www.emacswiki.org/emacs/ColorTheme">the dedicated EmacsWiki page</a>. The setup I use is the following :</p>
<pre>
(require 'color-theme)
(color-theme-initialize)
(setq color-theme-is-global t)
(setq color-theme-is-cumulative t)
(setq color-theme-load-all-themes nil)
(color-theme-tangotango)
(add-hook 'message-mode-hook 'color-theme-tangotango)
(add-hook 'gnus-article-mode-hook 'color-theme-tangotango)
(add-hook 'after-make-frame-functions
(lambda (frame)
(set-variable 'color-theme-is-global nil)
(select-frame frame)
(if window-system
(color-theme-tangotango)
(color-theme-tty-dark))))
</pre>
<p>Here is a screenshot of the color theme with an emacs-lisp file :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_elisp.png" alt="tangotango_elisp.png" style="display:block; margin:0 auto;" title="tangotango_elisp.png, fév. 2010" /></p>
<p>One with a Gnus summary and article buffers :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_gnus.png" alt="tangotango_gnus.png" style="display:block; margin:0 auto;" title="tangotango_gnus.png, fév. 2010" /></p>
<p>And one with an org-mode buffer :</p>
<p><img src="https://blog.nozav.org/public/images/tangotango_org.png" alt="tangotango_org.png" style="display:block; margin:0 auto;" title="tangotango_org.png, fév. 2010" /></p>
<p>Feel free to give any feedback !</p>Textile modeurn:md5:5b5fc1bddab80807be5a09dd276be9e32006-04-05T09:33:05+00:002006-04-05T09:33:05+00:00JubaEmacs, Gnusemacsscripttextile <p>Youpi, youpla, je viens de créer mon premier <em>major mode</em> pour Emacs. C'est un mode visant à faciliter l'écriture de document suivant la syntaxe de balisage Textile.</p>
<p>Pour l'instant il ne fait pas grand-chose, c'est à dire seulement de la coloration syntaxique, et il est en version vraiment alpha, pas plus testée que ça. N'hésitez pas à me faire remonter tout bug ou commentaire.</p>
<p>La dernière version du script peut être téléchargée là :</p>
<p><a href="http://svn.nozav.org/scripts/elisp/textile-mode/textile-mode.el">http://svn.nozav.org/scripts/elisp/textile-mode/textile-mode.el</a></p>
<p>Pour plus d'informations sur Textile, vous pouvez consulter :</p>
<ul>
<li><a href="http://www.textism.com/tools/textile/">http://www.textism.com/tools/textile/</a></li>
<li><a href="http://hobix.com/textile/">http://hobix.com/textile/</a></li>
</ul>erc2htmlurn:md5:9a353f19ff10d643d4a2aa7152e5ab3c2006-01-07T23:50:51+00:002006-01-07T23:50:51+00:00JubaEmacs, Gnusemacsrubyscript <p>Je viens de pondre un tout petit script en Ruby qui me permet de transformer un log de discussion IRC enregistré sous ERC (<em>Emacs Relay Chat</em>) en fichier HTML pour publication. Le script supprime les sauts de ligne superflus, supprime les messages serveur et colorise deux trois bricoles. C'est loin d'être parfait, mais si ça peut être utile à quelqu'un...</p>
<pre>require "cgi"
str = IO.read("/home/julien/lautre_20060107.log.txt")
titre = "Titre de la page"
charset = "UTF-8"
head = <<EOL
<html>
<head>
<title>#{titre}</title>
<meta http-equiv="Content-Type" content="text/html; charset=#{charset}" />
<style type="text/css">
* {font-family: monospace;}
.nick {font-weight: bold; color: #A00;}
.ref {font-style: italic; color: #090;}
.timestamp {color: #AAA;}
.me {color: #00B;}
</style>
</head>
<body>
<h1>#{titre}</h1>
<p>
EOL
foot = <<EOL
</p>
</body>
</html>
EOL
str.gsub!(/^ERC>.*$/n, "")
str.gsub!(/
\s+/n, " ")
str.gsub!(/[\d\d:\d\d]/) { |s| "
"+s+"
"}
str.gsub!(/\s+$/n, "")
str.gsub!(/^\*\*\* .*$/n, "")
5.times {str.gsub!(/
\s*
/n, "
")}
str = CGI::escapeHTML(str)
str.gsub!(/^&lt;.*?&gt;/n) {|s| '<span class="nick">'+s+'</span>'}
str.gsub!(/(<\/span>) (\w+\s?:)/n) {|s| $1+' <span class="ref">'+$2+'</span>'}
str.gsub!(/[\d\d:\d\d]/) { |s| '<span class="timestamp">'+s+'</span>'}
str.gsub!(/^\* .*$/n) {|s| '<span class="me">'+s+'</span>'}
str.gsub!(/
/, "<br />
")
str = head + str
str = str + foot
puts str</pre>Utiliser Mozilla Firefox pour ouvrir les liens sous Emacs/Gnusurn:md5:5a0b9c0bcc71c39ab607e1d82d9752b02004-10-21T10:59:02+00:002005-02-04T15:36:16+00:00JubaEmacs, Gnusemacsfirefoxgnus <p>La commande utilisée sous Emacs (et donc sous Gnus) pour ouvrir et afficher le contenu d'url contenues dans des documents ou des mails est à définir sous la forme d'une fonction à rattacher à la fonction browse-url-browser-function. Il existe un cetain nombre de fonctions par défaut, mais aucune pour Mozilla Firefox (en tous cas pour ma version d'Emacs, la 21.3.1). Grâce à <a href="http://www.emacswiki.org">EmacsWiki</a> et à <a href="http://groups.google.com">Google Groups</a>, j'ai pu bricoler une fonction qui permet d'ouvrir le lien dans un nouveau tab si une instance de Firefox tourne déjà, et de lancer le navigateur sinon.</p>
<p>A priori ça fonctionne pour Firefox 0.9 et au-delà. Voici le code à rajouter dans votre .emacs :</p>
<pre>(defun browse-url-firefox-new-tab (url &optional new-window)
"Open URL in a new tab in Firefox."
(interactive (browse-url-interactive-arg "URL: "))
(let ((cmd (shell-command-to-string
(concat "mozilla-firefox -a firefox -remote 'openURL("
url ",new-tab)' > /dev/null"))))
(unless (string= "" cmd)
(message "Starting Firefox...")
(start-process (concat "firefox " url) nil "/bin/sh" "-c"
(concat "mozilla-firefox " url "|| true"))
(message "Starting Firefox...done"))))</pre>
<pre>(setq browse-url-browser-function 'browse-url-firefox-new-tab)</pre>Lire des fils RSS avec Gnusurn:md5:1c87fd112caa3af35c8f1e4151ad84872004-10-21T10:15:42+00:002005-02-04T15:34:45+00:00JubaEmacs, Gnusemacsgnus <p><a href="http://www.gnus.org/">Gnus</a> (le lecteur de news mail et autres sous Emacs) sait tout faire, ça n'est pas nouveau. Il sait aussi lire des fils d'informations au format XML-RSS, mais la marche à suivre indiquée dans la documentation ne fonctionne pas chez moi. Celle-ci suggère de créer un nouveau groupe à l'aide des touches G R, mais chez moi ça débouche sur un message d'erreur :</p>
<pre>No such newsgroup: nnrss:xxxxxxxxxx</pre>
<p>Une autre méthode qui semble fonctionner est de créer le groupe dans un premier temps à l'aide de G m, de choisir un nom et indiquer nnrss comme 'From method'. Ensuite, à la première ouverture du nouveau groupe, Gnus vous demandera l'url du fichier RSS, et le tour est joué !</p>