<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>FrostyX&apos;s blog - Fedora articles</title>
    <description>Personal blog of Jakub Kadlčík (aka FrostyX)
</description>
    <link>
    http://frostyx.cz</link>
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      <item>
        <title>Emacs - Evil :set option</title>
        <description>&lt;p&gt;Do you miss all the easy-to-use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set&lt;/code&gt; commands from Vim? You know,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set wrap&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set number&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set colorcolumn&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set expandtab&lt;/code&gt;, etc.&lt;/p&gt;

&lt;h2 id=&quot;narcissistic-rant&quot;&gt;Narcissistic rant&lt;/h2&gt;

&lt;p&gt;Even though the &lt;a href=&quot;https://github.com/emacs-evil/evil&quot;&gt;Evil&lt;/a&gt; project itself doesn’t claim any such
title, urban legends say that Evil is the best Vim emulator ever
implemented. Naturally, my expectations were high. And yet, I was
blown away. Evil does everything perfectly (or at least well enough to
fool me) - modes, macros, window management, plugins, colon commands
(although not all of them are implemented - I am looking at you
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:retab&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;For me, the only major letdown was missing support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set&lt;/code&gt;
options such as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set wrap&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set number&lt;/code&gt;, and so on.
Of course, Emacs has its own commands for achieving the same behavior. My issue
is simply the non-existing&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set&lt;/code&gt; command and, therefore, inability to use the
options that I already know.&lt;/p&gt;

&lt;h2 id=&quot;introducing-evil-set-option&quot;&gt;Introducing evil-set-option&lt;/h2&gt;

&lt;p&gt;For this reason, I created &lt;a href=&quot;https://github.com/FrostyX/evil-set-option&quot;&gt;evil-set-option&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;text-center img&quot;&gt;
  &lt;img class=&quot;gifplayer&quot; src=&quot;/files/img/evil-set-option/evil-set-option.png&quot; alt=&quot;&quot; /&gt;
  &lt;p&gt;Click, it&apos;s a gif!&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;Use Quelpa (or
any package manager that you prefer) to install the package.&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;evil-set-option&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ensure&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:quelpa&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;evil-set-option&lt;/span&gt;
           &lt;span class=&quot;ss&quot;&gt;:fetcher&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;github&lt;/span&gt;
           &lt;span class=&quot;ss&quot;&gt;:repo&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;FrostyX/evil-set-option&quot;&lt;/span&gt;
           &lt;span class=&quot;ss&quot;&gt;:branch&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:config&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;evil-set-option-mode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now you can run your favorite &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:set&lt;/code&gt; commands.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;:set wrap
:set number
:set colorcolumn=80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;supported-options&quot;&gt;Supported options&lt;/h2&gt;

&lt;p&gt;Currently, only a dozen of options that seemed to be the most
popular, are supported. Vim comes with &lt;a href=&quot;http://vimdoc.sourceforge.net/htmldoc/quickref.html#option-list&quot;&gt;hundreds of
options&lt;/a&gt;, and for understandable reasons, I wasn’t going
to implement all of them within the first release. Please &lt;a href=&quot;https://github.com/FrostyX/evil-set-option/issues&quot;&gt;let me
know&lt;/a&gt; what are your favorite options that we simply must have.&lt;/p&gt;

&lt;p&gt;The list of all currently supported options &lt;a href=&quot;https://github.com/FrostyX/evil-set-option/blob/main/options.org&quot;&gt;can be found
here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;custom-option-behavior&quot;&gt;Custom option behavior&lt;/h2&gt;

&lt;p&gt;Sometimes the default implementation of an option might not be
applicable. You might want to use a different mode that suits your build more,
you might run an older version of Emacs, that doesn’t support some modes,
etc. In such cases, you can override the default implementation.&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;;; The default implementation for `:set number&apos; uses&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; `display-line-numbers-mode&apos; which is available since Emacs 26.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; See https://www.emacswiki.org/emacs/LineNumbers&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;;; You can override it to use `linum-mode&apos; instead&lt;/span&gt;

&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;evil-set-option-number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;linum-mode&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;future-plans&quot;&gt;Future plans&lt;/h2&gt;

&lt;p&gt;I have a bigger picture in mind. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;evil-set-option&lt;/code&gt; package won’t
get
bloated with another functionality apart from supporting more
and more options. My plan is to create a new package called
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;evil-vimrc&lt;/code&gt; that will provide the ability to parse a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; file -
although very naively. &lt;a href=&quot;https://learnvimscriptthehardway.stevelosh.com/&quot;&gt;VimL&lt;/a&gt; is a full-featured scripting
language and it would require executing the config file code to parse
the options accurately. I don’t think that would be time worth
spending. A dummy implementation that parses all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt; statements is
still going to be useful in many cases.&lt;/p&gt;

&lt;p&gt;The hypothetical usage will look like this&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;evil-vimrc-load&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/.vimrc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt; as expected.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;set nocompatible
set nowrap
set title
set expandtab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or alternativelly, defining the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.vimrc&lt;/code&gt; configuration within Emacs
Lisp.&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;evil-vimrc&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;nocompatible&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;nowrap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:set&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;expandtab&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Stay tuned.&lt;/p&gt;

</description>
        <pubDate>Sun, 07 Aug 2022 00:00:00 +0000</pubDate>
        <link>
        http://frostyx.cz/posts/emacs-evil-set-option</link>
        <guid isPermaLink="true">http://frostyx.cz/posts/emacs-evil-set-option</guid>
      </item>
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      <item>
        <title>A year with Emacs</title>
        <description>&lt;p&gt;After a decade of exclusively using
&lt;a href=&quot;/posts/software-tips-for-nerds#vim-for-everything&quot;&gt;Vim for all my text editing&lt;/a&gt;, I decided to
explore the other side of the barricade and see what the eternal
adversary is doing. Ever since that day, I live in &lt;a href=&quot;https://www.gnu.org/software/emacs/&quot;&gt;Emacs&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;/h2&gt;

&lt;p&gt;Why would I commit such a heinous crime? After ten years, I came close
to hitting my peak knowledge about Vim. Of course, nobody can claim to truly
know Vim in its full depth but I got to the point where the learning
curve slowed to a deadly pace and new tricks just slightly adjust your approach
when solving obscure scenarios. The only real game-changer yet to be conquered
was plugins development. I &lt;a href=&quot;/posts/vim-gbrowse-support-for-pagure&quot;&gt;tried&lt;/a&gt; but I dislike
&lt;a href=&quot;https://learnvimscriptthehardway.stevelosh.com/&quot;&gt;VimL&lt;/a&gt; as a language for writing code and thus I have no intention of
doing so.&lt;/p&gt;

&lt;p&gt;On the other hand, I am fascinated by the
&lt;a href=&quot;https://xkcd.com/1270/&quot;&gt;functional programming paradigm&lt;/a&gt; and &lt;a href=&quot;https://lisp-lang.org/&quot;&gt;Lisp&lt;/a&gt; in
particular. This alone, was a strong enough impulse for migrating to Emacs. I won’t
hit the ceiling regarding custom package development.&lt;/p&gt;

&lt;p&gt;Also, I came to realize, that my Vim workflow is different than for
most other users (at least in my social circle). Everyone seems to
have a shell-centric approach, &lt;em&gt;find-ing&lt;/em&gt;, &lt;em&gt;grep-ing&lt;/em&gt;, &lt;em&gt;cat-ing&lt;/em&gt; their way
through a project, and then opening the intended file in Vim, editing,
and closing. I do the same thing when it comes to searching within a project but
I do it in a separate terminal. When it comes to Vim, I start it once, do
everything from within, and then close it after six months when a new &lt;a href=&quot;https://en.wikipedia.org/wiki/Fedora_version_history#Version_history&quot;&gt;Fedora is
released&lt;/a&gt; and I need to upgrade. If it reminds you of
something, it’s Emacs.&lt;/p&gt;

&lt;p&gt;There is also a couple of tempting Emacs features but about them later.&lt;/p&gt;

&lt;h2 id=&quot;preview&quot;&gt;Preview&lt;/h2&gt;

&lt;p&gt;On my triple-monitor setup, two of the screens are dedicated to maximized
Emacs frames. This is how my PIM screen looks like.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/emacs-pim-frame.png&quot;&gt;
    &lt;img src=&quot;/files/img/emacs-pim-frame-thumb.png&quot; alt=&quot;My side monitor dedicated to PIM&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;The main monitor is designated for development.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/emacs-dev-frame.png&quot;&gt;
    &lt;img src=&quot;/files/img/emacs-dev-frame-thumb.png&quot; alt=&quot;My main monitor that I use for development&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;The goal was to make the development setup identical to
&lt;a href=&quot;/files/img/2019-desktop.png&quot;&gt;my previous Vim configuration&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;misconceptions&quot;&gt;Misconceptions&lt;/h2&gt;

&lt;p&gt;Due to my heavy addiction to Vim keybindings and modal editing, a
non-negotiable requisite was a decent Vim emulator inside of
Emacs. As it turned out, &lt;a href=&quot;https://github.com/emacs-evil/evil&quot;&gt;Evil&lt;/a&gt; is not only a great name but also a
great piece of software. However, it is often marketed in a way, that
you don’t have to learn Emacs key bindings at all. This was a big
selling point for me, that however, turned out not to be true.&lt;/p&gt;

&lt;p&gt;Yes, Evil is probably the best Vim emulator out there and provides
support for every Vim feature that I know of. The thing we need to
realize is that Emacs has a much broader scope than just text editing. It is
more of an application platform rather than an editor. Naturally, there
cannot be any Vim keybindings for things that are beyond its abilities.
Don’t worry though. You can get far enough by learning &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x&lt;/code&gt; for running commands,
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-:&lt;/code&gt; for Elisp evaluation, and by defining custom key bindings.&lt;/p&gt;

&lt;p&gt;Another unpleasant surprise was that my &lt;a href=&quot;https://github.com/FrostyX/dotfiles/blob/master/.vimrc&quot;&gt;.vimrc&lt;/a&gt; was completely useless
for the migration. For some reason I expected Evil to parse and apply
my current Vim configuration, and even use the Vim plugins I
had installed. You can laugh at me now. That, of course, is not
possible but in the end, it cost me just a couple extra days of fieldwork. Most
of the popular Vim plugins have authentic Emacs clones.&lt;/p&gt;

&lt;p&gt;Here is a migration table based on the plugins that I use.&lt;/p&gt;

&lt;table class=&quot;table table-striped&quot;&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Vim plugin&lt;/th&gt;
      &lt;th&gt;Emacs alternative&lt;/th&gt;
      &lt;th&gt;Note&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/VundleVim/Vundle.vim&quot;&gt;Vundle.vim&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/jwiegley/use-package&quot;&gt;use-package&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;Emacs has a built-in package manager&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/tpope/vim-fugitive&quot;&gt;vim-fugitive&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/magit/magit&quot;&gt;magit&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/tpope/vim-rhubarb&quot;&gt;vim-rhubarb&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/rmuslimov/browse-at-remote&quot;&gt;browse-at-remote&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/tpope/vim-sleuth&quot;&gt;vim-sleuth&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/jscheid/dtrt-indent&quot;&gt;dtrt-indent&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/FrostyX/vim-fugitive-pagure&quot;&gt;vim-fugitive-pagure&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/rmuslimov/browse-at-remote&quot;&gt;browse-at-remote&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/preservim/nerdtree&quot;&gt;nerdtree&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/jaypei/emacs-neotree&quot;&gt;neotree&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;Use &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html&quot;&gt;dired&lt;/a&gt; instead, trust me&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/junegunn/fzf.vim&quot;&gt;fzf.vim&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/emacs-helm/helm&quot;&gt;helm&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;Much more then just fzf&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/tomtom/tcomment_vim&quot;&gt;tcomment_vim&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/linktohack/evil-commentary&quot;&gt;evil-commentary&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/adelarsq/vim-matchit&quot;&gt;matchit&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/redguardtoo/evil-matchit&quot;&gt;evil-matchit&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/Raimondi/delimitMate&quot;&gt;delimitMate&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/Fuco1/smartparens&quot;&gt;smartparens&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/Glench/Vim-Jinja2-Syntax&quot;&gt;Vim-Jinja2-Syntax&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/paradoxxxzero/jinja2-mode&quot;&gt;jinja2-mode&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/plasticboy/vim-markdown&quot;&gt;vim-markdown&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/jrblevin/markdown-mode&quot;&gt;markdown-mode&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/vim-syntastic/syntastic&quot;&gt;syntastic&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/company-mode/company-mode&quot;&gt;company-mode&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/vimwiki/vimwiki&quot;&gt;vimwiki&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://orgmode.org/&quot;&gt;org-mode&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/junegunn/goyo.vim&quot;&gt;goyo.vim&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/joostkremers/writeroom-mode&quot;&gt;writeroom&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/chriskempson/base16-vim&quot;&gt;base16-vim&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/belak/base16-emacs&quot;&gt;base16-theme&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;a href=&quot;https://github.com/ap/vim-css-color&quot;&gt;vim-css-color&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://elpa.gnu.org/packages/rainbow-mode.html&quot;&gt;rainbow-mode&lt;/a&gt;&lt;/td&gt;
      &lt;td&gt; &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;For migrating the Vim settings themselves, you will need to read
the manual (or my Emacs config) because it is not possible to cover
here. However, I still think it would be pretty amazing if we could
write some package that would parse &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.vimrc&lt;/code&gt; and print Elisp code for doing
the same thing in Evil. Anyone wants to collaborate on that?&lt;/p&gt;

&lt;p&gt;So far, this whole thing may seem like a chore with no benefits. Well,
buckle up.&lt;/p&gt;

&lt;h2 id=&quot;ide-on-steroids&quot;&gt;IDE on steroids&lt;/h2&gt;

&lt;p&gt;During the last year, I was basically living in Emacs.
At first, it replaced only my IDE but then Emacs quickly became my RSS
aggregator, task manager, IRC client, Email client and kept consuming all
standalone programs. All of them now share the same configuration language,
keybindings, theme, etc. Thanks to Evil, those keybindings happen to be
Vim-like.&lt;/p&gt;

&lt;p&gt;I love this great paradox that thanks to Emacs, I have more Vim in my
life.&lt;/p&gt;

&lt;p&gt;As a consequence, all of these &lt;em&gt;applications&lt;/em&gt; are integrated together
and it is possible to seamlessly create tasks based on emails, paste
short pieces of code into IRC, viewing a git history and jumping to
the changed files, sending a SQL query to a coworker via email (the
possibilities are endless) without ever touching a mouse or even
needing the system clipboard. It’s all in the Vim/Evil registers, so only
yanking and pasting like a true gentleman.&lt;/p&gt;

&lt;p&gt;For the past ten years, I was trying to achieve such a setup using a
combination of &lt;a href=&quot;/posts/software-tips-for-nerds#tmux&quot;&gt;Tmux&lt;/a&gt;, &lt;a href=&quot;https://github.com/vim/vim&quot;&gt;Vim&lt;/a&gt;, &lt;a href=&quot;http://www.mutt.org/&quot;&gt;Mutt&lt;/a&gt;, &lt;a href=&quot;/posts/software-tips-for-nerds#weechat&quot;&gt;Weechat&lt;/a&gt;, and
other tools but the experience was vastly different. No matter what, it felt
like using several single-purpose programs, each of them isolated in its own
bubble and with no way of cooperating with each other.&lt;/p&gt;

&lt;h2 id=&quot;literate-config&quot;&gt;Literate config&lt;/h2&gt;

&lt;p&gt;Since the operating system becomes just a bootloader for Emacs (and
maybe a web browser), it means that every &lt;em&gt;application&lt;/em&gt; is used and
configured within Emacs. Luckily for us, it has the best configuration
apparatus ever invented. Remember the
&lt;a href=&quot;https://en.wikipedia.org/wiki/Literate_programming&quot;&gt;literate programming paradigm&lt;/a&gt;,
which was only briefly noted in a school curriculum as a slow, retarded cousin
of procedural and object-oriented paradigms? It turns out to be pretty fucking
awesome after all.&lt;/p&gt;

&lt;p&gt;Emacs configuration can be written in an &lt;a href=&quot;https://orgmode.org/&quot;&gt;Org-mode&lt;/a&gt; document and can
look like a book explaining various features, settings, and customizations, with
thorough code sample coverage. Quite literally because the document can be
exported as a web page or stylized PDF. See &lt;a href=&quot;https://github.com/FrostyX/dotfiles/blob/master/.emacs.d/frostyx.org&quot;&gt;my config on GitHub&lt;/a&gt;
to get the idea.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/emacs-config-source.png&quot;&gt;
    &lt;img src=&quot;/files/img/emacs-config-source.png&quot; alt=&quot;The whole Emacs configuration can be an Org document&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;The Org configuration file renders beautifully on GitHub and possibly other Git
forges.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/emacs-config-web.png&quot;&gt;
    &lt;img src=&quot;/files/img/emacs-config-web.png&quot; alt=&quot;The config is beautifully rendered on GitHub&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&quot;email-client-finally&quot;&gt;Email client, finally&lt;/h2&gt;

&lt;p&gt;Accessing email in the terminal was a recurring nerd-fantasy of mine ever since
I started using GNU/Linux in 2008. Up until very recently, all my
attempts of achieving this holy grail rendered futile.&lt;/p&gt;

&lt;p&gt;Finally, I could cross this off my list thanks to a combination of
&lt;a href=&quot;https://wiki.archlinux.org/title/isync&quot;&gt;mbsync&lt;/a&gt; and &lt;a href=&quot;https://www.djcbsoftware.nl/code/mu/mu4e.html&quot;&gt;mu4e&lt;/a&gt;. There is nothing much to say. It is an email
client. Inside of Emacs. But for some undefinable reason, it is the greatest
thing ever invented.&lt;/p&gt;

&lt;p&gt;The hardest part isn’t the email client configuration itself but
rather synchronization with IMAP (in the age of two-factor
authentication). If you are interested, I wrote a whole article on
this topic - &lt;a href=&quot;http://frostyx.cz/posts/synchronize-your-2fa-gmail-with-mbsync&quot;&gt;Synchronize your 2FA Gmail with mbsync&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/mu4e.png&quot;&gt;
    &lt;img src=&quot;/files/img/mu4e.png&quot; alt=&quot;Mu4e mail client&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&quot;irc-with-vim-keybindings&quot;&gt;IRC with Vim keybindings&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://weechat.org/&quot;&gt;Weechat&lt;/a&gt; is an exceptionally good piece of software but to be
honest I was aching to replace it for quite some time. There just wasn’t a
better alternative. My frustrations were caused solely by two pitfalls.&lt;/p&gt;

&lt;p&gt;&lt;del&gt;Copy-pasting from Tmux + Weechat combo is god-awful and borderline
psychotic. Imagine Weechat window vertically split into multiple
panes. Since it is an application running in a single terminal
window, the terminal has no perception of any separation, splits, or
panes that are displayed within. Selecting a multi-line text with a
mouse, therefore, isn’t limited to the desired pane but rather to
everything that stands in the way. The copied text then contains
mixed messages from multiple chat windows, ASCII symbols that were
used as separators, timestamps, and all.&lt;/del&gt; Copy-pasting from Tmux + Weechat is
quite alright if you are aware of
&lt;a href=&quot;https://superuser.com/a/693990&quot;&gt;rectangle selection&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Apart from this, I was always uncomfortable with
&lt;a href=&quot;https://weechat.org/files/doc/devel/weechat_faq.en.html#editing_config_files&quot;&gt;Weechat’s approach to generated configuration files&lt;/a&gt;.
Even though it is generally looked at as a feature allowing to configure Weechat from
within itself, saving its current state, and eliminating the need to edit the
configuration file in its written form. I never grew accustomed to this paradigm
and prefer to edit configuration files by hand.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/jorgenschaefer/circe&quot;&gt;Circe&lt;/a&gt; is in many aspects inspired by Weechat and inherits some of its
traits while eradicating the pitfalls beyond perfectly. Circe chat
windows are standard Emacs buffers with full Vim emulation and shared
registers with the whole ecosystem. Lisp configuration also surpasses
anything else we could wish for.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/circe.png&quot;&gt;
    &lt;img src=&quot;/files/img/circe.png&quot; alt=&quot;Circe IRC client&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&quot;magit&quot;&gt;Magit&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/magit/magit&quot;&gt;Magit&lt;/a&gt; is one of the tools that I would refuse to believe I might
enjoy using. What’s the point with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git diff&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git add&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git
commit&lt;/code&gt; commands already hard-wired in my muscle memory in such a
manner, that executing them resembles more of an involuntary spasm
rather than typing words.&lt;/p&gt;

&lt;p&gt;Yet, I am forever hooked to Magit now. One shall never stage a whole
file before checking its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git diff&lt;/code&gt; (because of possible unwanted
changes). That’s two commands per file, all the time. Whereas Magit
provides a compact view of files and their changes at once. Staging a
whole file or its chunks is then a matter of pressing one key.&lt;/p&gt;

&lt;p&gt;Committing, pushing, iterating over a series of commits, blaming,
rebasing, everything is a bit more convenient. I still use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git&lt;/code&gt;
command for more complicated operations though.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/magit.png&quot;&gt;
    &lt;img src=&quot;/files/img/magit.png&quot; alt=&quot;Magit&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;h2 id=&quot;emacs-in-browser&quot;&gt;Emacs in browser&lt;/h2&gt;

&lt;p&gt;As a software engineer, I frequently engage in technical discussions on
various git forge sites (such as &lt;a href=&quot;https://github.com/&quot;&gt;GitHub&lt;/a&gt;, &lt;a href=&quot;https://pagure.io/&quot;&gt;Pagure.io&lt;/a&gt;), and
&lt;a href=&quot;https://reddit.com/&quot;&gt;Reddit&lt;/a&gt;. Consequently, I write comments containing pieces of code on
daily basis (either being code reviews and suggestions, bug
reproducers, or proposed solutions).&lt;/p&gt;

&lt;p&gt;My workflow usually involved firing up the good ol’ text editor,
pre-formatting the code, and copy-pasting it into the
comment. Omitting this step and editing the code directly in the
web browser is doable but especially adjusting whitespace
sucks so much, that you eventually end up spawning a text editor and
regretting you didn’t do it in the first place.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/stsquad/emacs_chrome&quot;&gt;Edit with Emacs&lt;/a&gt; is a handy convenience tool that
provides a key binding to make a temporary Emacs frame with the
contents of your textarea. After you are done, it pipes the output
back to the browser.&lt;/p&gt;

&lt;p&gt;There is nothing special about this functionality in regards to Emacs
and there surely is a plugin compatible with any text editor. On the contrary, I
think Emacs lags behind Neovim in this scenario, which is able to transform a
textarea into a Neovim instance directly in the web browser thanks to
&lt;a href=&quot;https://github.com/glacambre/firenvim&quot;&gt;Firenvim&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/edit-with-emacs.png&quot;&gt;
    &lt;img src=&quot;/files/img/edit-with-emacs.png&quot; alt=&quot;Magit&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

</description>
        <pubDate>Wed, 12 May 2021 00:00:00 +0000</pubDate>
        <link>
        http://frostyx.cz/posts/a-year-with-emacs</link>
        <guid isPermaLink="true">http://frostyx.cz/posts/a-year-with-emacs</guid>
      </item>
	  
      
    
      
	  
      
    
      
	  
      <item>
        <title>Synchronize your 2FA Gmail with mbsync</title>
        <description>&lt;p&gt;In comparison to graphical email applications, configuring the command-line
clients can be a needlessly painful experience. Not because of the client
configuration itself but rather finding out the proper IMAP settings for your
account. Personally, I spent more hours on moving my mail into Emacs (and
previously into &lt;a href=&quot;http://www.mutt.org/&quot;&gt;Mutt&lt;/a&gt;), than I care to admit. And in the end, it turned
out that the only real obstacle was figuring out, how to get the freaking
synchronization with Gmail working. Let me share my findings to potentially ease
the pain for you.&lt;/p&gt;

&lt;p&gt;TL;DR: Jump to the last section &lt;a href=&quot;#gmail-with-2fa&quot;&gt;Gmail with 2FA&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;the-obligatory-intro-on-email-clients&quot;&gt;The obligatory intro on email clients&lt;/h2&gt;

&lt;p&gt;If you use, or ever tried to use some of the mainstream email clients
such as &lt;a href=&quot;https://www.thunderbird.net/en-US/&quot;&gt;Thunderbird&lt;/a&gt;, &lt;a href=&quot;https://wiki.gnome.org/Apps/Evolution&quot;&gt;Evolution&lt;/a&gt;, &lt;a href=&quot;https://wiki.gnome.org/Apps/Geary&quot;&gt;Geary&lt;/a&gt;,
or some mobile phone client (I am not a mobile phone nerd, so
I don’t know any of them. I just have some Gmail &lt;em&gt;thingy&lt;/em&gt; there), you
might have formed an idea what an email client is supposed to do - download
your messages, index them, filter them, and let you interactively work
with them. And of course, allowing you to send messages as well. There is
nothing groundbreaking about this, that’s just how we use email,
and therefore what we expect email clients to do.&lt;/p&gt;

&lt;p&gt;Command-line (or rather text-based) email clients do much less and
delegate a lot of work to a series of other small tools (aka the
&lt;a href=&quot;https://en.wikipedia.org/wiki/Unix_philosophy&quot;&gt;Unix philosophy&lt;/a&gt;). Typically, we have a separate program for
simply downloading the mail from a server. There are many options, such as
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt; from &lt;a href=&quot;https://isync.sourceforge.io/&quot;&gt;isync&lt;/a&gt; package, &lt;a href=&quot;http://www.offlineimap.org/&quot;&gt;OfflineIMAP&lt;/a&gt;,
&lt;a href=&quot;https://wiki.archlinux.org/index.php/Getmail&quot;&gt;getmail&lt;/a&gt;, etc. Their only job is to download the mail and save it (one
message per file) to your disk. This can be useful on its own, e.g. for
backing-up your messages in case the email provider shuts down its business.&lt;/p&gt;

&lt;p&gt;Optionally, it’s up to us to configure a spam filter either on the server-side
(e.g. in Gmail settings) or on the client by using &lt;a href=&quot;https://linux.die.net/man/1/procmail&quot;&gt;procmail&lt;/a&gt;,
&lt;a href=&quot;https://bogofilter.sourceforge.io/&quot;&gt;Bogofilter&lt;/a&gt;, or &lt;a href=&quot;https://spamassassin.apache.org/&quot;&gt;SpamAssasin&lt;/a&gt;. The next building block
is indexing. This is generally not true for everybody but after years of
countless mailing list subscriptions, many of us have our inboxes flooded with
thousands or hundreds of thousands of messages. Directory-based storages just
ain’t gonna cut it. We need some kind of a &lt;em&gt;real&lt;/em&gt; database with indexes. For
this, we can use tools like &lt;a href=&quot;https://www.djcbsoftware.nl/code/mu/mu4e/Indexing-your-messages.html&quot;&gt;Mu&lt;/a&gt;, or &lt;a href=&quot;https://notmuchmail.org/manpages/notmuch-reindex-1/&quot;&gt;Notmuch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Finally, we are getting to the fun part, which is displaying, reading,
and interacting with email. This is the most discussed and
tutorial-covered link in the chain. And while exciting, and hacker-ish
looking on screenshots, the configuration revolves mainly around color
schemes and key bindings, which is quite intuitive and also not that
big of a deal when using some default settings. Anyway, we can pick from the
following frontends - &lt;a href=&quot;https://www.djcbsoftware.nl/code/mu/mu4e.html&quot;&gt;Mu4e&lt;/a&gt;, &lt;a href=&quot;https://notmuchmail.org/&quot;&gt;Notmuch&lt;/a&gt;, &lt;a href=&quot;http://www.mutt.org/&quot;&gt;Mutt&lt;/a&gt;,
&lt;a href=&quot;https://neomutt.org/&quot;&gt;NeoMutt&lt;/a&gt;, &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/gnus/&quot;&gt;Gnus&lt;/a&gt;, &lt;a href=&quot;https://wiki.archlinux.org/index.php/alpine&quot;&gt;Alpine&lt;/a&gt;, and probably from a
bunch of less-known clients as well. For sending email messages, one would
expect to also utilize some specialized tool (and it certainly is possible) but
usually, it is handled by the frontend program itself.&lt;/p&gt;

&lt;p&gt;As you noticed, there is a lot of small, interchangeable utilities in play. Some
of them optional, some of them even more optional. The categories I
presented are not strictly defined and some tools overlap across multiple
categories. It’s up to you to choose and put those lego blocks together and
build your own email setup.&lt;/p&gt;

&lt;p&gt;Today we are going to focus on the very first category, which is downloading
email messages to your computer. We are going to utilize &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt; command, and
we are going to set it up for your enterprise 2FA Gmail account. Since the
result is a bunch of downloaded files (which is not very impressive), and every
cool blog post should have at least one screenshot, I am going to jump a few
steps forward and show you how the end-game might look like once you manage to
successfully download your mail and open it in Emacs.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/rougier-mu4e.png&quot;&gt;
    &lt;img src=&quot;/files/img/rougier-mu4e-thumb.png&quot; alt=&quot;Mu4e configuration by @rougier&quot; /&gt;
  &lt;/a&gt;
  &lt;p&gt;
	This beautiful configuration is not mine. The screenshot is taken from the
	&lt;a href=&quot;https://github.com/rougier/mu4e-dashboard&quot;&gt;rougier/mu4e-dashboard&lt;/a&gt;
	repository.
  &lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;a-less-hostile-provider-than-gmail&quot;&gt;A less hostile provider than Gmail&lt;/h2&gt;

&lt;p&gt;First, please install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isync&lt;/code&gt; package, so we can get this out of our
way. Use the package manager provided by your GNU/Linux distribution, on
Fedora I would do&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dnf &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;isync
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Configuring multiple accounts in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt; is trivial, and Gmail IMAP
is a mess. Therefore, I would recommend setting up an account from a different
email provider first (that is if you have the option) and learn how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt;
works. Let’s create the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.mbsyncrc&lt;/code&gt; configuration file and insert the
following settings.&lt;/p&gt;

&lt;div class=&quot;language-ssh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;IMAPStore&lt;/span&gt; foo-remote
&lt;span class=&quot;k&quot;&gt;Host&lt;/span&gt; imap.foo.com
&lt;span class=&quot;k&quot;&gt;SSLType&lt;/span&gt; IMAPS
&lt;span class=&quot;k&quot;&gt;User&lt;/span&gt; frostyx@foo.com
&lt;span class=&quot;k&quot;&gt;Pass&lt;/span&gt; supercomplicatedpassword

&lt;span class=&quot;k&quot;&gt;MaildirStore&lt;/span&gt; foo-local
&lt;span class=&quot;k&quot;&gt;Path&lt;/span&gt; ~/Mail/foo/
&lt;span class=&quot;k&quot;&gt;Inbox&lt;/span&gt; ~/Mail/foo/INBOX
&lt;span class=&quot;k&quot;&gt;Subfolders&lt;/span&gt; Verbatim

&lt;span class=&quot;k&quot;&gt;Channel&lt;/span&gt; foo
&lt;span class=&quot;k&quot;&gt;Master&lt;/span&gt; :foo-remote:
&lt;span class=&quot;k&quot;&gt;Slave&lt;/span&gt; :foo-local:
&lt;span class=&quot;k&quot;&gt;Create&lt;/span&gt; Both
&lt;span class=&quot;k&quot;&gt;Expunge&lt;/span&gt; Both
&lt;span class=&quot;k&quot;&gt;Patterns&lt;/span&gt; *
&lt;span class=&quot;k&quot;&gt;SyncState&lt;/span&gt; *
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A more complicated version of this snippet can be found on
&lt;a href=&quot;https://wiki.archlinux.org/index.php/Isync#Configuring&quot;&gt;ArchWiki&lt;/a&gt; and countless blogs
(&lt;a href=&quot;https://people.kernel.org/mcgrof/replacing-offlineimap-with-mbsync&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;https://rakhim.org/fastmail-setup-with-emacs-mu4e-and-mbsync-on-macos/&quot;&gt;2&lt;/a&gt;, &lt;a href=&quot;https://gist.github.com/chandraratnam/f00ab7d4a5298830f692021964fdb99f&quot;&gt;3&lt;/a&gt;,
&lt;a href=&quot;https://jherrlin.github.io/posts/emacs-mu4e/&quot;&gt;4&lt;/a&gt;, …), so I am not going to thoroughly describe the settings
here. I would by paraphrasing the &lt;a href=&quot;https://isync.sourceforge.io/mbsync.html&quot;&gt;manpage&lt;/a&gt; anyway. Let’s just
vaguely say, that the first section describes how to access your email account
provided by some third-party. The second section describes how to store the
downloaded messages on our computer. Finally, the last section configures what
messages should be synchronized between those two, he said while pretending to
understand it.&lt;/p&gt;

&lt;p&gt;Replace all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo&lt;/code&gt; symbols in the snippet with some short label for your
email account (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;personal&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;work&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;test&lt;/code&gt;, …) and properly set the
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Host&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pass&lt;/code&gt; values in the first section. Then you
should be able to successfully run the following command&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Use the short email label you chose before&lt;/span&gt;
mbsync &lt;span class=&quot;nt&quot;&gt;-V&lt;/span&gt; foo
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There is not going to be any successful message in the output. Don’t panic,
seeing a bunch of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Opening&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Synchronizing...&lt;/code&gt; lines means that it works
fine. To make sure, list the mail directory&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;ls&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-1&lt;/span&gt; ~/Mail
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Because we don’t want to store our super-secret email passwords in
plaintext, we should stash them into some keychain and let &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt; how
to get them. Don’t even think about using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpg&lt;/code&gt; command, that’s more
complicated than rocket science. Use &lt;a href=&quot;https://www.passwordstore.org/&quot;&gt;pass&lt;/a&gt; instead!&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Initialize the keychain, you will run this just once in your life&lt;/span&gt;
pass init &amp;lt;gpg-id or email&amp;gt;

&lt;span class=&quot;c&quot;&gt;# Insert the password for your email account&lt;/span&gt;
pass insert email/frostyx@foo.com

&lt;span class=&quot;c&quot;&gt;# And print it to the terminal to make sure it was stored properly&lt;/span&gt;
pass email/frostyx@foo.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is all you need to know about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pass&lt;/code&gt; (although it has some amazing
features such as storing passwords to git, which is worth checking
out). Now, remove the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Pass&lt;/code&gt; line from your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~/.mbsyncrc&lt;/code&gt; config and
use this one instead.&lt;/p&gt;

&lt;div class=&quot;language-ssh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;PassCmd&lt;/span&gt; &quot;pass email/frostyx@foo.com&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Make sure that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync -V foo&lt;/code&gt; still works, even when using a password from the
keychain.&lt;/p&gt;

&lt;h2 id=&quot;gmail-imap-sucks&quot;&gt;Gmail IMAP sucks&lt;/h2&gt;

&lt;p&gt;Before moving to the Gmail configuration, I would like to make a
disclaimer - Gmail IMAP support has limitations, idiosyncrasies, and
to be scientifically precise, it just sucks. Please have patience.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Each tag is stored as a folder, therefore messages with multiple tags
will be downloaded multiple times (into each folder)&lt;/li&gt;
  &lt;li&gt;The &lt;a href=&quot;https://support.google.com/a/answer/1071518?hl=en&quot;&gt;daily download limit is 2500 MB&lt;/a&gt;, so it may take
several days for you to initially download your mail&lt;/li&gt;
  &lt;li&gt;Your Gmail password &lt;strong&gt;will not work&lt;/strong&gt;, an &lt;a href=&quot;https://support.google.com/mail/answer/185833?hl=en&quot;&gt;App Password&lt;/a&gt; is
required&lt;/li&gt;
  &lt;li&gt;Emails are visible in the web UI for a couple of minutes before they appear in
IMAP. This is either an issue on my side or there is some delay&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of these are minor inconveniences, that can be workarounded, solved, or
lived with. It’s just something to keep in mind.&lt;/p&gt;

&lt;h2 id=&quot;gmail-with-a-plain-password&quot;&gt;Gmail with a plain password&lt;/h2&gt;

&lt;p&gt;Armored with bulletproof patience and unending determination, we
shall continue to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt; configuration for Gmail. Now, if you think
“perhaps I should try a personal Gmail account without 2FA, it is going to
be easier”, please smother the idea in this instant. &lt;strong&gt;It is not
possible&lt;/strong&gt;. Please repeat after me, it is not possible. I refused to
believe, tried over and over, failed miserably, over and over, and
ended up &lt;a href=&quot;https://support.google.com/accounts/answer/185839&quot;&gt;configuring 2FA&lt;/a&gt; anyway. Please save yourself the
time and the pain.&lt;/p&gt;

&lt;p&gt;Log-in to your &lt;a href=&quot;https://gmail.com/&quot;&gt;Gmail&lt;/a&gt; account and click to your profile
picture in the top-right. Then continue to “Manage your Google
Account”. In the left menu, click on “Security”, and turn on the 2-Step
Verification.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/gmail-2fa.png&quot;&gt;
    &lt;img src=&quot;/files/img/gmail-2fa.png&quot; alt=&quot;Gmail 2FA setting&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;Now we need to generate an &lt;a href=&quot;https://support.google.com/mail/answer/185833?hl=en&quot;&gt;App Password&lt;/a&gt;. Click on
“2-Step Verification”, then at the bottom of the page, you will find
“App passwords” section. When opening it, you will see this.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/gmail-app-passwords.png&quot;&gt;
    &lt;img src=&quot;/files/img/gmail-app-passwords.png&quot; alt=&quot;Gmail App passwords&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;Use whatever app name you want and click “Create”.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/gmail-app-passwords-create.png&quot;&gt;
    &lt;img src=&quot;/files/img/gmail-app-passwords-create.png&quot; alt=&quot;Create a new Gmail App password&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;After closing this page, you won’t be able to display it again, so please
write down the generated password. We will put it to the keychain in a minute.&lt;/p&gt;

&lt;h2 id=&quot;isnt-2fa-like-a-2fa&quot;&gt;Isn’t 2FA like a 2FA&lt;/h2&gt;

&lt;p&gt;Just a small digression in case you skipped the previous section because you
already have 2FA configured. The Google documentation about
&lt;a href=&quot;https://support.google.com/mail/answer/185833?hl=en&quot;&gt;App Passwords&lt;/a&gt; explicitly says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;App Passwords can only be used with accounts that have 2-Step
Verification turned on.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The statement is correct but it can be a bit misleading. In fact, this
happened to be one of the biggest pain-points for me. My corporate
email uses &lt;a href=&quot;https://en.wikipedia.org/wiki/Single_sign-on&quot;&gt;Single-Sign-On&lt;/a&gt; authentication through
&lt;a href=&quot;https://web.mit.edu/kerberos/&quot;&gt;Kerberos&lt;/a&gt;. The login page looks like this.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/gmail-2fa-kerberos.png&quot;&gt;
    &lt;img src=&quot;/files/img/gmail-2fa-kerberos-thumb.png&quot; alt=&quot;Corporate Kerberos SSO&quot; /&gt;
  &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;As you can see, my password consists of a PIN, which is a persistent
passphrase, followed by a TOKEN - a randomly generated short string
from a small device, that I wear in my wallet. In my view, this counts as a
2-Step verified account and should pass the constraint for using App
Passwords. This is absolutely not true though. Please follow the same exact
steps that we did in the
&lt;a href=&quot;#gmail-with-a-plain-password&quot;&gt;Gmail with a plain password&lt;/a&gt; section.&lt;/p&gt;

&lt;h2 id=&quot;gmail-with-2fa&quot;&gt;Gmail with 2FA&lt;/h2&gt;

&lt;p&gt;We finally managed to jump through all the necessary hoops and
tweaked our Google account. Now we can get back to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mbsync&lt;/code&gt;
configuration. Let’s take the snippet from the
&lt;a href=&quot;#a-less-hostile-provider-than-gmail&quot;&gt;Less hostile provider than Gmail&lt;/a&gt; section
and make just a couple of changes.&lt;/p&gt;

&lt;div class=&quot;language-ssh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;IMAPStore&lt;/span&gt; gmail-remote
&lt;span class=&quot;k&quot;&gt;Host&lt;/span&gt; imap.gmail.com
&lt;span class=&quot;k&quot;&gt;SSLType&lt;/span&gt; IMAPS
&lt;span class=&quot;k&quot;&gt;AuthMechs&lt;/span&gt; LOGIN
&lt;span class=&quot;k&quot;&gt;User&lt;/span&gt; foo@gmail.com
&lt;span class=&quot;k&quot;&gt;PassCmd&lt;/span&gt; &quot;pass email/foo@gmail.com&quot;

&lt;span class=&quot;k&quot;&gt;MaildirStore&lt;/span&gt; gmail-local
&lt;span class=&quot;k&quot;&gt;Path&lt;/span&gt; ~/Mail/gmail/
&lt;span class=&quot;k&quot;&gt;Inbox&lt;/span&gt; ~/Mail/gmail/INBOX
&lt;span class=&quot;k&quot;&gt;Subfolders&lt;/span&gt; Verbatim

&lt;span class=&quot;k&quot;&gt;Channel&lt;/span&gt; gmail
&lt;span class=&quot;k&quot;&gt;Master&lt;/span&gt; :gmail-remote:
&lt;span class=&quot;k&quot;&gt;Slave&lt;/span&gt; :gmail-local:
&lt;span class=&quot;k&quot;&gt;Create&lt;/span&gt; Both
&lt;span class=&quot;k&quot;&gt;Expunge&lt;/span&gt; Both
&lt;span class=&quot;k&quot;&gt;Patterns&lt;/span&gt; * !&quot;[Gmail]/All Mail&quot; !&quot;[Gmail]/Important&quot; !&quot;[Gmail]/Starred&quot; !&quot;[Gmail]/Bin&quot;
&lt;span class=&quot;k&quot;&gt;SyncState&lt;/span&gt; *
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The only fields that you need to modify are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;User&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PassCmd&lt;/code&gt;. Your
password is the generated App Password that we transcribed from the yellow
stripe in the previous section -
&lt;a href=&quot;#gmail-with-a-plain-password&quot;&gt;Gmail with a plain password&lt;/a&gt;. Don’t forget
to stash it to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pass&lt;/code&gt; keychain.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pass insert email/foo@gmail.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Fri, 12 Feb 2021 00:00:00 +0000</pubDate>
        <link>
        http://frostyx.cz/posts/synchronize-your-2fa-gmail-with-mbsync</link>
        <guid isPermaLink="true">http://frostyx.cz/posts/synchronize-your-2fa-gmail-with-mbsync</guid>
      </item>
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      <item>
        <title>My first Emacs contribution</title>
        <description>&lt;p&gt;You may already notice, that I like to customize and improve the tools that I use daily, share the configuration with others and write blog posts about what I learned while doing it. On today’s menu, Emacs and its packages.&lt;/p&gt;

&lt;p&gt;This year I finally dared to migrate from Vim to Emacs - utilizing &lt;a href=&quot;https://github.com/emacs-evil/evil&quot;&gt;Evil&lt;/a&gt; of course. I wasn’t capable of magically growing new extremities from my body to constantly press all the Emacs chords. Neither was I capable of doubling my brain capacity to even remember them.&lt;/p&gt;

&lt;div class=&quot;text-center img-row row&quot;&gt;
  &lt;a href=&quot;/files/img/emacs-user.jpg&quot;&gt;
    &lt;img src=&quot;/files/img/emacs-user.jpg&quot; alt=&quot;&quot; /&gt;
  &lt;/a&gt;
  &lt;p&gt;
    Thank you National Geographic and &lt;a href=&quot;http://pinterest.com/pin/518406607076836477&quot;&gt;Pinterest&lt;/a&gt; for this rare depiction of a vanilla Emacs user in his native environment.
  &lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;Even though I was using Vim for almost ten years and have a highly customized and personalized configuration with a lot of enabled plugins, the migration was quite smooth. A general rule of thumb is, for every possible Vim plugin, there is a better or worse (still sufficient) Emacs alternative. The only hard thing is to find them. Maybe let’s discuss this topic in another article.&lt;/p&gt;

&lt;p&gt;There is an exception to this rule though - one-man show plugins, particularly those you’ve written and maintain yourself. In my case, it is a &lt;a href=&quot;https://github.com/FrostyX/vim-fugitive-pagure&quot;&gt;FrostX/vim-fugitive-pagure&lt;/a&gt; plugin, which provides a &lt;a href=&quot;https://pagure.io/&quot;&gt;pagure.io&lt;/a&gt; support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:Gbrowse&lt;/code&gt; command. I collaborate with my coworkers remotely and make frequent use of it. There &lt;del&gt;is&lt;/del&gt; was no Emacs alternative so I missed the feature since migration. I finally &lt;a href=&quot;http://frostyx.cz/posts/emacs-browse-at-pagure&quot;&gt;decided to implement&lt;/a&gt; a &lt;a href=&quot;https://pagure.io/&quot;&gt;pagure.io&lt;/a&gt; support for &lt;a href=&quot;https://github.com/rmuslimov/browse-at-remote&quot;&gt;browse-at-remote&lt;/a&gt; and here follows what I learned from my first Emacs contribution.&lt;/p&gt;

&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
Disclaimer: As I repeatedly mentioned, this was my first experience with writing packages for Emacs, therefore this is not an authoritative manual of how things work and should be done.
&lt;/div&gt;

&lt;h2 id=&quot;still-ranting&quot;&gt;Still ranting&lt;/h2&gt;

&lt;p&gt;Because of the very nature of Lisp language (its ability to modify programs while they run) and Emacs philosophy to consume everything, things get very weird very fast. It is a vast underestimation to say, that workflows when using Emacs are unconventional, compared to the rest of the world. Although it is a positive thing, the problem is that there seems to be very little material showing the real-life usages of Emacs. In this case, explaining how to proceed when writing one’s own package. Don’t get me wrong, there is powerful documentation within Emacs but in 2020 I would expect a lot of youtube videos, blogs, reddit posts, etc giving an insight to custom methods of individual developers.&lt;/p&gt;

&lt;h2 id=&quot;assimilate-everything&quot;&gt;Assimilate everything&lt;/h2&gt;

&lt;p&gt;A dream of advanced Emacs users (&lt;a href=&quot;https://stallman.org/extra/church.html&quot;&gt;Emacsites&lt;/a&gt;) is to start their computer, run Emacs, and never ever leave it. If God forbids there is a need to launch and interact with any other application, we need to unite and implement the functionality within an Emacs package. Using other applications is against the beliefs of the &lt;a href=&quot;https://www.emacswiki.org/emacs/ChurchOfEmacs&quot;&gt;Church Of Emacs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For new users, this concept is initially very hard to grasp, so it makes sense to progress gradually. As a newbie myself, I tried to utilize as many command-line tools outside of Emacs and ended up with the following workflow for contributing to an existing package.&lt;/p&gt;

&lt;h2 id=&quot;my-workflow&quot;&gt;My workflow&lt;/h2&gt;

&lt;p&gt;First, we will need &lt;a href=&quot;https://cask.readthedocs.io/en/latest/&quot;&gt;Cask&lt;/a&gt;, which is a management tool for Emacs projects (packages). Please see the &lt;a href=&quot;https://cask.readthedocs.io/en/latest/guide/installation.html&quot;&gt;installation manual&lt;/a&gt;. It is a bit disappointing that there are no official packages for Linux distributions, we definitely need to repent from our sins and create a cask package for Fedora. But until then, we need to go with:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl &lt;span class=&quot;nt&quot;&gt;-fsSL&lt;/span&gt; https://raw.githubusercontent.com/cask/cask/master/go | python
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$HOME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/.cask/bin:&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;
cask upgrade-cask
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Clone a package that you are interested in and change your working directory:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git clone https://github.com/rmuslimov/browse-at-remote
&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;browse-at-remote
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Install all the package dependencies:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cask &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hopefully, the project has at least some unit tests. In my case, the author used a library called &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/ert/index.html&quot;&gt;ERT&lt;/a&gt;. I don’t know how many alternatives are there but it seems like a go-to option. You can simply run all the tests with:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cask &lt;span class=&quot;nb&quot;&gt;exec &lt;/span&gt;ert-runner
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, let’s proceed with some &lt;a href=&quot;https://en.wikipedia.org/wiki/Test-driven_development&quot;&gt;test-driven development&lt;/a&gt; until the desired feature is finished. I spend several hours &lt;a href=&quot;https://www.reddit.com/r/emacs/comments/fempfv/how_to_use_debugger/fjrdndo/?utm_source=share&amp;amp;utm_medium=web2x&quot;&gt;trying to figure out how to have an interactive debugger&lt;/a&gt; using &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html&quot;&gt;edebug&lt;/a&gt; but unsuccessfully. Therefore, I needed to get by using just &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(print foo)&lt;/code&gt; to evaluate expressions.&lt;/p&gt;

&lt;p&gt;Once the feature is done, let’s see it in action. Up until this point you probably included the package in your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init.el&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;browse-at-remote&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ensure&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Temporarily remove it and load the enhanced package from your local directory:&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;add-to-list&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;load-path&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;expand-file-name&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;~/git/browse-at-remote&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;&apos;browse-at-remote&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And reload your Emacs configuration by pressing:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;M-x load-file RET
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;or restarting the Emacs entirely. You should be done now. If not, repeat a necessary subset of previous steps.&lt;/p&gt;

&lt;div class=&quot;pull-right&quot;&gt;
&lt;code&gt;&lt;strike&gt;C-x C-c&lt;/strike&gt;&lt;/code&gt; &lt;code&gt;:wq&lt;/code&gt;
&lt;/div&gt;

</description>
        <pubDate>Sun, 15 Mar 2020 00:00:00 +0000</pubDate>
        <link>
        http://frostyx.cz/posts/my-first-emacs-contribution</link>
        <guid isPermaLink="true">http://frostyx.cz/posts/my-first-emacs-contribution</guid>
      </item>
	  
      
    
      
	  
      <item>
        <title>Emacs - Browse At Pagure</title>
        <description>&lt;p&gt;TL;DR: Work in Emacs, select some lines, press &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x browse-at-remote&lt;/code&gt; to open it on pagure.io, and share the URL.&lt;/p&gt;

&lt;p&gt;Recently I have published an article about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:Gbrowse&lt;/code&gt; command in Vim, that allows you to open a current file or line selection on a remote hosting platform, such as &lt;a href=&quot;https://github.com/tpope/vim-rhubarb&quot;&gt;GitHub&lt;/a&gt;, &lt;a href=&quot;https://github.com/shumphrey/fugitive-gitlab.vim&quot;&gt;GitLab&lt;/a&gt;, etc. The command is provided by &lt;a href=&quot;https://github.com/tpope/vim-fugitive&quot;&gt;tpope/vim-fugitive&lt;/a&gt; plugin, you should definitely check it out. Other contributors already implemented support for various hosting sites, so I decided to go ahead and create &lt;a href=&quot;https://github.com/FrostyX/vim-fugitive-pagure&quot;&gt;vim-fugitive-pagure&lt;/a&gt; extension to support also &lt;a href=&quot;https://pagure.io/&quot;&gt;pagure.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One of the annual goals that I set for myself was to finally migrate to Emacs. Everything is going well, the only thing that I am missing since then is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:Gbrowse&lt;/code&gt; feature. To be precise, there is a &lt;a href=&quot;https://github.com/rmuslimov/browse-at-remote&quot;&gt;browse-at-remote&lt;/a&gt; package providing more than sufficient alternative, but Pagure support is missing. Well, &lt;a href=&quot;https://github.com/rmuslimov/browse-at-remote/pull/63&quot;&gt;not anymore&lt;/a&gt;!&lt;/p&gt;

&lt;h2 id=&quot;usage&quot;&gt;Usage&lt;/h2&gt;

&lt;p&gt;While working with your code in Emacs, select one or more lines and run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;M-x browse-at-remote&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;text-center img&quot;&gt;
  &lt;img class=&quot;gifplayer&quot; src=&quot;/files/img/browse-at-remote/browse-at-remote.png&quot; alt=&quot;&quot; /&gt;
&lt;/div&gt;

&lt;h2 id=&quot;installation&quot;&gt;Installation&lt;/h2&gt;

&lt;p&gt;The package is available on &lt;a href=&quot;https://melpa.org/#/browse-at-remote&quot;&gt;MELPA&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-lisp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;use-package&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;browse-at-remote&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;:ensure&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Sat, 07 Mar 2020 00:00:00 +0000</pubDate>
        <link>
        http://frostyx.cz/posts/emacs-browse-at-pagure</link>
        <guid isPermaLink="true">http://frostyx.cz/posts/emacs-browse-at-pagure</guid>
      </item>
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
      
	  
      
    
  </channel>
</rss>
