<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.thebuble.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Bubble Sweat Bubble - Tag - emacs</title>
  <link>http://blog.thebuble.org/</link>
  <atom:link href="http://blog.thebuble.org/feed/tag/emacs/rss2" rel="self" type="application/rss+xml"/>
  <description>Les périgrinations d'un mec normal dans un monde qui ne l'est franchement pas</description>
  <language>fr</language>
  <pubDate>Sun, 22 Aug 2010 19:53:29 +0200</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Emacs : gestion transparente de GPG</title>
    <link>http://blog.thebuble.org/post/2009/12/23/Emacs-%3A-gestion-transparente-de-GPG</link>
    <guid isPermaLink="false">urn:md5:a30324ffd7c7c3d61ae4be369daaa4e1</guid>
    <pubDate>Wed, 23 Dec 2009 19:47:00 +0100</pubDate>
    <dc:creator>Olivier</dc:creator>
        <category>emacs</category>
        <category>emacs</category><category>gnupg</category>    
    <description>    &lt;p&gt;La gestion des fichiers GPG est très pratique sous emacs&amp;nbsp;: chiffrement et déchiffrement à la volée sont par exemple au programme.&lt;/p&gt;


&lt;p&gt;Pour profiter de tout cela, il suffit d'ajouter ceci à son &lt;em&gt;.emacs&lt;/em&gt;&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; load epa&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'epa&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;epa&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;enable&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use epa with files *.gpg et *.asc&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; epa&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;name&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;regexp &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;.&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;(gpg&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;|asc&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;)$&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; epa&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;cache&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;passphrase&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;for&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;symmetric&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;encryption t&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'pgg&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; default mode to gpg&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; pgg&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;scheme 'gpg&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; forgot passphrase after 600 seconds&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; pgg&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;passphrase&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;cache&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;expiry &lt;span style=&quot;color: #cc66cc;&quot;&gt;600&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; gpg default ID to use&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; pgg&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;user&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;id &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Your GPG default ID&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.thebuble.org/post/2009/12/23/Emacs-%3A-gestion-transparente-de-GPG#comment-form</comments>
      <wfw:comment>http://blog.thebuble.org/post/2009/12/23/Emacs-%3A-gestion-transparente-de-GPG#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.thebuble.org/feed/atom/comments/38</wfw:commentRss>
      </item>
    
  <item>
    <title>Emacs : sauvegarder sa session et la restaurer à chaque lancement</title>
    <link>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-sauvegarder-sa-session-et-la-restaurer-%C3%A0-chaque-lancement</link>
    <guid isPermaLink="false">urn:md5:7a107647d86d1df9a8c777de22d4c675</guid>
    <pubDate>Tue, 22 Dec 2009 20:14:00 +0100</pubDate>
    <dc:creator>Olivier</dc:creator>
        <category>emacs</category>
        <category>emacs</category>    
    <description>    &lt;p&gt;Une extension très pratique d'Emacs est la possibilité de conserver sa session de travail à chaque lancement. Il suffit de rajouter ceci à son &lt;em&gt;.emacs&lt;/em&gt;&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'session&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; save session&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;hook 'after&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;init&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;hook 'session&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;initialize&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; session&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;initialize '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;de&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;saveplace session places keys menus&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;desktop&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;mode &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; always load locked desktop when started in daemon mode&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;daemonp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
     &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; desktop&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;load&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;locked&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;desktop t&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Par défaut, session ne conserve pas les fichiers distants. Si vous le voulez (cela peut grandement ralentir le lancement d'Emacs)&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; save remote files too&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; desktop&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;files&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;not&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;^$&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-sauvegarder-sa-session-et-la-restaurer-%C3%A0-chaque-lancement#comment-form</comments>
      <wfw:comment>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-sauvegarder-sa-session-et-la-restaurer-%C3%A0-chaque-lancement#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.thebuble.org/feed/atom/comments/37</wfw:commentRss>
      </item>
    
  <item>
    <title>Emacs : compiler automatiquement son fichier .emacs</title>
    <link>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-compiler-automatiquement-son-fichier-.emacs</link>
    <guid isPermaLink="false">urn:md5:09ce504e4f673486d2b0d884300d79d2</guid>
    <pubDate>Tue, 22 Dec 2009 19:48:00 +0100</pubDate>
    <dc:creator>Olivier</dc:creator>
        <category>emacs</category>
        <category>emacs</category>    
    <description>    &lt;p&gt;Compiler ses fichiers lisps peut grandement améliorer leur temps de chargement. Ceci s'applique bien sûr également au fichier &lt;em&gt;.emacs&lt;/em&gt; lorsque celui-ci commence à se remplir de plusieurs dizaines de lignes. Voici un petit bout de code à rajouter à son fichier &lt;em&gt;.emacs&lt;/em&gt; afin qui celui-ci se compile automatiquement à chaque enregistrement&amp;nbsp;:&lt;/p&gt;

&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;hook 'after&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;hook
    &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;lambda&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'bytecomp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;string&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;buffer&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
                   &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;expand&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;name&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;concat
                                      &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;getenv &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;HOME&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
                                      &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/.emacs&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
          &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;byte&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;compile&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;buffer&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
      &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;</description>
    
    
    
          <comments>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-compiler-automatiquement-son-fichier-.emacs#comment-form</comments>
      <wfw:comment>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-compiler-automatiquement-son-fichier-.emacs#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.thebuble.org/feed/atom/comments/36</wfw:commentRss>
      </item>
    
  <item>
    <title>Emacs : accéder à des fichiers distants avec TRAMP</title>
    <link>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP</link>
    <guid isPermaLink="false">urn:md5:f416d467dc392710066aa0617043fafc</guid>
    <pubDate>Tue, 22 Dec 2009 14:53:00 +0100</pubDate>
    <dc:creator>Olivier</dc:creator>
        <category>emacs</category>
        <category>emacs</category><category>ssh</category><category>tramp</category>    
    <description>    &lt;h2&gt;TRAMP c'est quoi&amp;nbsp;?&lt;/h2&gt;


&lt;p&gt;&lt;a href=&quot;http://www.gnu.org/software/tramp/&quot; hreflang=&quot;en&quot;&gt;TRAMP&lt;/a&gt; (Transparent Remote (file) Access, Multiple Protocol) est une extension pour &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; permettant d'accéder à des machines distantes comme si leurs ressources étaient disponibles en local. De façon générale, cela permet d'ouvrir des fichiers distants, de naviguer dans l'arborescence des fichiers avec dired, d'exécuter des commandes shells, ... Les plus habitués à &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; auront de suite compris l'intérêt&amp;nbsp;: toutes ses possibilités sont donc accessibles sur les machines distantes&amp;nbsp;! Pour cela, il suffit de pouvoir s'y connecter via rsh, rlogin, telnet, ssh ou toute autre méthode de connexion similaire (par exemple sudo). Le transfert de fichiers sera effectué au choix parmi les commandes rcp, rsync, scp ou pscp (sous Windows).&lt;/p&gt;


&lt;p&gt;TRAMP est livré avec &lt;a href=&quot;http://www.emacs.org&quot; hreflang=&quot;en&quot;&gt;Emacs&lt;/a&gt; depuis la version 22. Pour les versions précédentes, il suffit de le télécharger ici&amp;nbsp;: &lt;a href=&quot;ftp://ftp.gnu.org/gnu/tramp/&quot; hreflang=&quot;en&quot;&gt;ftp://ftp.gnu.org/gnu/tramp/&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;Configuration générale&lt;/h3&gt;

&lt;h4&gt;Syntaxe TRAMP&lt;/h4&gt;

&lt;p&gt;La syntaxe par défaut pour accéder à un fichier distant est &lt;em&gt;/machine:localname&lt;/em&gt;. Personnellement je trouve que cette syntaxe manque de clarté et puis je suis habitué à la norme URL/URI. J'ai donc activé la syntaxe URL de TRAMP ce qui donne ceci&amp;nbsp;: &lt;em&gt;/protocol://machine&lt;a href=&quot;http://blog.thebuble.org/post/2009/12/22/:port&quot; title=&quot;:port&quot;&gt;:port&lt;/a&gt;/localname&lt;/em&gt;. Voici les commandes à rajouter dans votre &lt;em&gt;.emacs&lt;/em&gt; afin d'activer cette fonction&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use /protocol://host[:port]/path/to/file&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;syntax 'url&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Backups&lt;/h4&gt;

&lt;p&gt;À moins d'avoir une bonne connexion à Internet, il est souvent préférable d'enregistrer les fichiers temporaires et les backups des fichiers distants localement&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; turn off backup-directory-alist for tramp&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'backup&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;cons&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;name&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;regexp &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set a dedicated auto-save directory&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;auto&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;~/.emacs.d/tramp-autosave&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Protocoles par défaut&lt;/h4&gt;

&lt;p&gt;On peut configurer le protocole à utiliser (si non spécifié) en général ou par machine. Par exemple, pour qu'emacs utilise SSH par défaut pour toutes les machines sauf pour root@localhost, cas dans lequel il doit utiliser sudo&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; default method to SSH&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use sudo for root@localhost&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`localhost&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`root&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sudo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h4&gt;Rebonds&lt;/h4&gt;

&lt;p&gt;Une fonctionnalité très pratique de TRAMP est sa gestion des rebonds. Par exemple si vous ne pouvez accéder à la machine web1 qu'en passant par example.com, il suffit de rajouter ceci à la configuration &lt;em&gt;.emacs&lt;/em&gt;&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; when web[0-9] is requested, connect to example.com first&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;proxies&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`web[0-9]&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/ssh://example.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;p&gt;Ainsi, lorsqu'emacs devra se connecter à web1, il ouvrira d'abord une connection ssh à example.com puis sur cette machine lancera une nouvelle connection ssh à web1. Cette fonctionnalité permet donc d'accéder à n'importe quelle machine à laquelle vous avez accès, quelque que soit le nombre de rebonds nécessaires.&lt;/p&gt;


&lt;h4&gt;Exemple de configuration&lt;/h4&gt;

&lt;p&gt;Un bon exemple vaut mieux qu'un long discours, voici donc ma configuration TRAMP&amp;nbsp;:&lt;/p&gt;
&lt;pre class=&quot;lisp&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use /[protocol:]//host[:port]/path/to/file&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;syntax 'url&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;require 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; enable partial completion mode&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;partial&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;completion&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;mode &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; turn off backup-directory-alist for tramp&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'backup&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;cons&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;file&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;name&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;regexp &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set a dedicated auto-save directory&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;auto&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;save&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;directory &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;~/.emacs.d/tramp-autosave&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; default method to SSH&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;ssh&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; use sudo for root@localhost&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;method&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`localhost&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`root&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sudo&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; set the prompt pattern&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;shell&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;prompt&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;pattern &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;[^&amp;gt;$#]?[&amp;gt;$#] *&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; shell&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;prompt&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;pattern &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;[^&amp;gt;$#]?[&amp;gt;$#] *&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; make sure terminal is defined to dumb&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;setq&lt;/span&gt; tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;terminal&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;type &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;dumb&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;; when web[0-9] is requested, connect to example.com first&lt;/span&gt;
  &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;add&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;to&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #b1b100;&quot;&gt;list&lt;/span&gt; 'tramp&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;default&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;proxies&lt;span style=&quot;color: #66cc66;&quot;&gt;-&lt;/span&gt;alist
               '&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;`web[0-9]&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\\&lt;/span&gt;'&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;nil&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/ssh://example.com&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;
               &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/pre&gt;


&lt;h3&gt;Utilisation avancée&lt;/h3&gt;

&lt;p&gt;Éditer des fichiers distants est bien pratique mais il y a encore mieux&amp;nbsp;: naviguer dans les dossiers via &lt;em&gt;dired&lt;/em&gt;, exécuter des shells distants via &lt;em&gt;shell', des terminaux distants via &lt;/em&gt;term'', bref tout ce que votre emacs vous permet. Pour cela, rien de plus facile&amp;nbsp;: il suffit que le répertoire courant soit sur la machine distante pour que toutes les commandes shells soient exécutées sur cette machine.&lt;/p&gt;


&lt;p&gt;Par exemple, si vous ouvrez le dossier /mon/dossier sur la machine example.com via &lt;em&gt;/ssh://example.com/mon/dossier&lt;/em&gt;, toutes les commandes exécutées depuis ce buffer auront lieu sur example.com dans le dossier /mon/dossier. Voici les commandes les plus pratiques&amp;nbsp;:&lt;/p&gt;

&lt;pre&gt;* M-x shell =&amp;gt; ouvre un shell simple
* M-x term =&amp;gt; ouvre un terminal complet
* M-! =&amp;gt; exécute n'importe quelle commande shell&lt;/pre&gt;


&lt;p&gt;Il est donc très facile de créer des macros à lancer sur des machines distantes pour réaliser des commandes répétitives. Grâce à la puissance de TRAMP et la souplesse d'Emacs et de ses macros, on peut donc réaliser tout un jeu de commandes pour réaliser toutes les tâches répétitives quelque soit la machine concernée. La seule limite étant d'y avoir accès&amp;nbsp;!&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP#comment-form</comments>
      <wfw:comment>http://blog.thebuble.org/post/2009/12/22/Emacs-%3A-acc%C3%A9der-%C3%A0-des-fichiers-distants-avec-TRAMP#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.thebuble.org/feed/atom/comments/35</wfw:commentRss>
      </item>
    
</channel>
</rss>