<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Ankit Gadiya - emacs</title>
    <subtitle>My little corner of the Internet 🙌</subtitle>
    <link rel="self" type="application/atom+xml" href="https://ankit.earth/tags/emacs/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://ankit.earth"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-06-26T00:18:05+00:00</updated>
    <id>https://ankit.earth/tags/emacs/atom.xml</id>
    <entry xml:lang="en">
        <title>1782413285</title>
        <published>2026-06-26T00:18:05+00:00</published>
        <updated>2026-06-26T00:18:05+00:00</updated>
        
        <author>
          <name>
            
              Ankit Gadiya
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ankit.earth/microblog/1782413285/"/>
        <id>https://ankit.earth/microblog/1782413285/</id>
        
        <content type="html" xml:base="https://ankit.earth/microblog/1782413285/">&lt;p&gt;TIL about the &lt;code&gt;which-function-mode&lt;&#x2F;code&gt; in Emacs. It is a global minor mode that
displays the current function in the mode line when enabled.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>My Emacs Presentation Stack</title>
        <published>2025-11-30T00:00:00+00:00</published>
        <updated>2025-12-02T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Ankit Gadiya
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ankit.earth/blog/my-emacs-presentation-stack/"/>
        <id>https://ankit.earth/blog/my-emacs-presentation-stack/</id>
        
        <content type="html" xml:base="https://ankit.earth/blog/my-emacs-presentation-stack/">&lt;p&gt;&lt;em&gt;This is my (last minute) submission for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;donaldh.wtf&#x2F;2025&#x2F;10&#x2F;emacs-carnival-2025-11-an-ode-to-org-babel&#x2F;&quot;&gt;Emacs Carnival 2025-11 — An Ode to Org
Babel&lt;&#x2F;a&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When I need to do presentations at work, I naturally reach for Emacs. My
presentations include diagrams, code snippets and running small shell blocks. I
found that Org Mode with Babel is the perfect fit. In this post, I&#x27;ll describe
my presentation stack based on Org mode.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a quick demo video:&lt;&#x2F;p&gt;
&lt;video controls preload=&quot;metadata&quot; width=&quot;800&quot;&gt;
  &lt;source src=&quot;&#x2F;videos&#x2F;emacs-presentation-demo.mp4&quot; type=&quot;video&#x2F;mp4&quot;&gt;
  Your browser does not support the video tag.
&lt;&#x2F;video&gt;
&lt;h2 id=&quot;base-org-mode&quot;&gt;Base — Org mode&lt;&#x2F;h2&gt;
&lt;p&gt;I like to plan my presentations using outlines. It is easy to structure the
presentation into sections and sub-sections. Outlines also let me easily
reorganize parts of the presentation. I don&#x27;t think outlines are standard
features in common presentation software. But Emacs comes with a great outline
package, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;orgmode.org&quot;&gt;Org Mode&lt;&#x2F;a&gt;. This is a subset of my configuration
to make the presentations pretty.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;lisp&quot;&gt;(use-package org
  :hook
  ;; Lets me use serif for text and monospace for code snippets.
  (org-mode . variable-pitch-mode)
  :custom
  (org-hide-emphasis-markers t)
  (org-pretty-entities t)
  (org-ellipsis &amp;quot;…&amp;quot;)
  (org-src-fontify-natively t)
  (org-src-tab-acts-natively t)
  (org-src-preserve-indentation t))
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I start with an empty Org mode file and write the outline for my presentation
using Org mode headings. Each heading (and sub-heading) becomes a slide title. I
use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;protesilaos.com&#x2F;emacs&#x2F;logos&quot;&gt;Logos&lt;&#x2F;a&gt; package to &lt;em&gt;present&lt;&#x2F;em&gt; the
Org file as slides. Logos uses Outline headings as page endings, and uses
narrowing to only show the content under that heading. Logos in turn integrates
with the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rnkn&#x2F;olivetti&quot;&gt;Olivetti&lt;&#x2F;a&gt; package to center the
content on the screen. This is the glue code to make it all work together.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;lisp&quot;&gt;(use-package logos
  :ensure t
  :init
  ;; Always expand the current Heading.
  (defun arg-reveal-entry ()
	&amp;quot;Reveal Org or Outline entry.&amp;quot;
	(cond
	 ((and (eq major-mode &amp;#39;org-mode)
           (org-at-heading-p))
      (org-show-entry))
	 ((or (eq major-mode &amp;#39;outline-mode)
          (bound-and-true-p outline-minor-mode))
      (outline-show-entry))))
  :custom
  (logos-outlines-are-pages t)
  (logos-olivetti t)
  :hook
  (logos-page-motion . arg-reveal-entry)
  :bind
  ;; Binds Logos functions for Page motions.
  (:map org-mode-map
		([remap forward-page] . logos-forward-page-dwim)
		([remap backward-page] . logos-backward-page-dwim))
  :config
  ;; Disable distracting elements during Focus mode.
  (setq-default logos-hide-mode-line t
				logos-hide-header-line t))

(use-package olivetti
  :ensure t
  :config
  ;; Fancy mode uses margins and fringes to create vertical
  ;; blocks on either sides of the content.
  (setq olivetti-style &amp;#39;fancy)
  (setq-default olivetti-body-width 0.4)
  (add-hook &amp;#39;olivetti-mode-on-hook
			(lambda ()
			  ;; Disable Line numbers.
			  (display-line-numbers-mode -1)
			  ;; Disable Buffer boundaries.
			  (setq-local indicate-buffer-boundaries nil)))
  (add-hook &amp;#39;olivetti-mode-off-hook
			(lambda ()
			  ;; Enable Line numbers.
			  (display-line-numbers-mode 1)
			  ;; Restores Buffer boundaries.
			  (setq-local indicate-buffer-boundaries &amp;#39;left))))
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;I have the &lt;code&gt;arg-start-presentation&lt;&#x2F;code&gt; and &lt;code&gt;arg-stop-presentation&lt;&#x2F;code&gt; commands to
toggle the presentation mode. In presentation mode, &lt;code&gt;logos-focus-mode&lt;&#x2F;code&gt; is
toggled with the current heading expanded. It also minimizes other elements of
the Emacs frame like Tab-bar, and Menu-bar. To move between the slides, I use
the Emacs page motion keybindings: Forward &lt;kbd&gt;C-x ]&lt;&#x2F;kbd&gt;, and Backward
&lt;kbd&gt;C-x [&lt;&#x2F;kbd&gt;.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;lisp&quot;&gt;(defun arg-start-presentation ()
  &amp;quot;Start Presentation - Configures Frame, Style, etc.&amp;quot;
  (interactive)
  (when (eq major-mode &amp;#39;org-mode)
    (setq-local arg-presentation t)
    (logos-focus-mode 1)
    (logos-narrow-dwim)
    (org-fold-show-entry)
    (toggle-frame-tab-bar (selected-frame))
    (menu-bar-mode -1)))

(defun arg-stop-presentation ()
  &amp;quot;Stop Presentation - Reverts Frame, Style, etc.&amp;quot;
  (interactive)
  (cond ((not (eq major-mode &amp;#39;org-mode))
         (error &amp;quot;This command only works in Org buffers.&amp;quot;))
        ((not arg-presentation)
         (error &amp;quot;Not presenting right now.&amp;quot;))
        (t (progn
             (logos-focus-mode -1)
             (widen)
             (toggle-frame-tab-bar (selected-frame))
             (setq-local arg-presentation nil)
             (menu-bar-mode +1)))))
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This setup is inspired by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;systemcrafters.net&#x2F;emacs-tips&#x2F;presentations-with-org-present&#x2F;&quot;&gt;System Crafter&#x27;s Presentation
style&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;magic-org-babel&quot;&gt;Magic — Org Babel&lt;&#x2F;h2&gt;
&lt;p&gt;Org mode comes with built-in support for literate programming, Org Babel. If
you&#x27;re familiar with Jupyter Notebooks, Org Babel is a bit like that but in my
opinion, Babel is more powerful and extensible. It supports most common
languages out of the box such as Python, shell, and SQL, and it can be extended
to work with almost any language using simple Emacs lisp functions. It also
supports using multiple languages in the same file.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;diagrams&quot;&gt;Diagrams&lt;&#x2F;h3&gt;
&lt;p&gt;To add diagrams to my presentations, I like to use &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pikchr.org&quot;&gt;Pikchr&lt;&#x2F;a&gt;.
It is a special purpose markup language for diagrams. Org mode allows me to
define diagrams in-line right next to the slide content using code blocks.&lt;&#x2F;p&gt;
&lt;p&gt;Using Org Babel, I can compile the diagram using &lt;kbd&gt;C-c C-c&lt;&#x2F;kbd&gt;. The
generated SVG is placed directly in the buffer using the &lt;code&gt;RESULTS&lt;&#x2F;code&gt; block. Org
mode can optionally render the SVG in-line as well using &lt;kbd&gt;C-c C-x C-v&lt;&#x2F;kbd&gt;
or &lt;kbd&gt;M-x org-toggle-inline-images&lt;&#x2F;kbd&gt;. Updating the diagrams is also
straightforward: I can edit the code block and recompile the diagram to update
the SVG. There is no hassle of exporting and importing the diagrams repeatedly.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;org&quot;&gt;#+begin_src pikchr :file hello.svg
box &amp;quot;Hello!&amp;quot;
#+end_src

#+RESULTS:
[[file:hello.svg]]
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;shell-execution&quot;&gt;Shell Execution&lt;&#x2F;h3&gt;
&lt;p&gt;If I have to present some shell commands, I add the Shell code blocks. Org Babel
supports tons of options for shell. Some options that I use are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;:results&lt;&#x2F;code&gt; – How the result is parsed. If the output is tabular, Org mode can
display it as a table, otherwise verbatim.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;:async&lt;&#x2F;code&gt; – If the command takes time, run it asynchronously without blocking
Emacs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;:dir&lt;&#x2F;code&gt; – Sets the default directory for the Shell block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For live demos, I add the shell blocks directly in my slide content. During the
presentation, I can simply execute the block using &lt;kbd&gt;C-c C-c&lt;&#x2F;kbd&gt;. This
helps me focus on my content, saves time and I can avoid embarrassing typos.&lt;&#x2F;p&gt;
&lt;p&gt;In case of pre-recorded commands, I execute the commands beforehand. Similar to
diagrams, Org mode places the output of the command in the &lt;code&gt;RESULTS&lt;&#x2F;code&gt; block. This
is convenient when the commands require external setup, or take longer to run.
Here is an example from my last presentation.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;org&quot;&gt;#+begin_src shell :results output
docker images --format &amp;quot;{{.Size}}\t{{.Repository}}&amp;quot;
#+end_src

#+RESULTS:
: 8.31MB    alpine
: 120MB     debian
: 2.33GB    ros
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;version-control&quot;&gt;Version Control&lt;&#x2F;h2&gt;
&lt;p&gt;Because Org mode uses plain text format, I can version control my presentations.
It is one of those features that you&#x27;ll appreciate when you use it. I put all my
presentations along with the SVG artifacts in a single Git repository. A nice
little bonus is that Github and Forgejo can also render Org markup. So I have a
webpage complete with table of contents for my slides for free!&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>1763127234</title>
        <published>2025-11-14T19:03:54+00:00</published>
        <updated>2025-11-14T19:03:54+00:00</updated>
        
        <author>
          <name>
            
              Ankit Gadiya
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ankit.earth/microblog/1763127234/"/>
        <id>https://ankit.earth/microblog/1763127234/</id>
        
        <content type="html" xml:base="https://ankit.earth/microblog/1763127234/">&lt;p&gt;I use the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;marcinkoziej&#x2F;org-pomodoro&quot;&gt;org-pomodoro&lt;&#x2F;a&gt; package
for focused sessions at work. But Slack notifications can easily break my flow,
so I added the simple hooks to disable visible notifications on GNOME desktop.&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;lisp&quot;&gt;(defun arg-disable-gnome-notifications ()
  (shell-command &amp;quot;gsettings set org.gnome.desktop.notifications show-banners false&amp;quot;))
(defun arg-enable-gnome-notifications () (shell-command &amp;quot;gsettings set org.gnome.desktop.notifications show-banners true&amp;quot;))

(add-hook &amp;#39;org-pomodoro-started-hook #&amp;#39;arg-disable-gnome-notifications)
(add-hook &amp;#39;org-pomodoro-finished-hook #&amp;#39;arg-enable-gnome-notifications)
(add-hook &amp;#39;org-pomodoro-break-finished-hook #&amp;#39;arg-enable-gnome-notifications)
(add-hook &amp;#39;org-pomodoro-killed-hook #&amp;#39;arg-enable-gnome-notifications)
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>1759417306</title>
        <published>2025-10-02T20:31:46+00:00</published>
        <updated>2025-10-02T20:31:46+00:00</updated>
        
        <author>
          <name>
            
              Ankit Gadiya
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ankit.earth/microblog/1759417306/"/>
        <id>https://ankit.earth/microblog/1759417306/</id>
        
        <content type="html" xml:base="https://ankit.earth/microblog/1759417306/">&lt;p&gt;TIL that in Magit buffers, pressing &lt;kbd&gt;\&lt;&#x2F;kbd&gt; (or &lt;code&gt;M-x evil-collection-magit-toggle-text-mode&lt;&#x2F;code&gt;) activates &lt;code&gt;text-mode&lt;&#x2F;code&gt;. This mode
enables standard visual motions that are unavailable in Magit buffers.&lt;&#x2F;p&gt;
</content>
        
    </entry>
    <entry xml:lang="en">
        <title>Implement Custom Tramp Method in Emacs</title>
        <published>2023-09-27T00:00:00+00:00</published>
        <updated>2023-09-27T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Ankit Gadiya
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://ankit.earth/blog/implement-custom-tramp-method-in-emacs/"/>
        <id>https://ankit.earth/blog/implement-custom-tramp-method-in-emacs/</id>
        
        <summary type="html">&lt;p&gt;Emacs supports editing remote files using the Tramp package. Emacs transparently
handles the remote files based on the special path prefixes specified, so the
experience is similar to operating on a local file. Tramp uses a remote shell
underneath to access remote files. In this article, I&#x27;ll talk about how to
extend Tramp to support custom Methods to access remote files.&lt;&#x2F;p&gt;</summary>
        
    </entry>
</feed>
