<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="../feed.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Susam's Book Pages</title>
  <subtitle>Feed for Susam's Book Pages</subtitle>
  <link href="https://susam.net/"/>
  <link href="https://susam.net/tag/book.xml" rel="self"/>
  <id>https://susam.net/tag/book.xml</id>
  <updated>2023-12-29T00:00:00Z</updated>
  <author><name>Susam Pal</name></author>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 7: Conclusion</title>
    <link href="https://susam.net/cc/mastering-emacs/ch07.html"/>
    <id>urn:uuid:9909faf4-c481-46bf-9f48-508bc49cbada</id>
    <updated>2023-12-29T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 6 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#third-party-packages-and-tools&quot;&gt;Third-Party Packages and Tools&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#communities&quot;&gt;Communities&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;third-party-packages-and-tools&quot;&gt;Third-Party Packages and Tools&lt;/h2&gt;
&lt;p&gt;
  Here is a list of third-party packages and tools this chapter
  introduces to the reader:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;nov, an EPUB reader&lt;/li&gt;
  &lt;li&gt;Magit, a Git UI system with a chord-based key system&lt;/li&gt;
  &lt;li&gt;Multiple Cursors&lt;/li&gt;
  &lt;li&gt;LSP Mode, a language server interface for Emacs&lt;/li&gt;
  &lt;li&gt;Eglot, another language server interface for Emacs&lt;/li&gt;
  &lt;li&gt;Helm, a powerful completion framework&lt;/li&gt;
  &lt;li&gt;Flycheck, a generic framework for linting and syntax error checking&lt;/li&gt;
  &lt;li&gt;Org mode, an organiser for notes, agenda, literate programming, etc.&lt;/li&gt;
  &lt;li&gt;YASnippet, a text snippet expansion tool&lt;/li&gt;
  &lt;li&gt;Hydra, a package to build flexible popup UIs for key bindings&lt;/li&gt;
  &lt;li&gt;dumb-jump, a package to jump to definitions from symbols&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that Eglot comes out of the box since Emacs version 29.1.
&lt;/p&gt;
&lt;h2 id=&quot;communities&quot;&gt;Communities&lt;/h2&gt;
&lt;p&gt;
  Some of the communities recommended by this chapter are:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://old.reddit.com/r/emacs/&quot;&gt;Reddit r/emacs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://emacs.stackexchange.com/&quot;&gt;Emacs Stack Exchange&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://planet.emacslife.com/&quot;&gt;Planet Emacslife&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch07.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 6: The Practicals of Emacs</title>
    <link href="https://susam.net/cc/mastering-emacs/ch06.html"/>
    <id>urn:uuid:b0bdfa9a-4e48-4c66-8f34-39418ca744a3</id>
    <updated>2023-12-28T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 6 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#exploring-emacs&quot;&gt;Exploring Emacs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#project-management&quot;&gt;Project Management&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#xref&quot;&gt;Xref&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#xref-setup&quot;&gt;Xref Setup&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#search-tools-for-xref&quot;&gt;Search Tools for Xref&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#four-most-common-xref-commands&quot;&gt;Four Most Common Xref Commands&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#xref-and-dired&quot;&gt;Xref and Dired&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#working-with-log-files&quot;&gt;Working with Log Files&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#highlighting&quot;&gt;Highlighting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#auto-revert-mode&quot;&gt;Auto-Revert Mode&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#auto-revert-tail-mode&quot;&gt;Auto Revert Tail Mode&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#browsing-tarballs&quot;&gt;Browsing Tarballs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dired-thumbnail-image-browser&quot;&gt;Dired: Thumbnail Image Browser&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#preview-buffer-quirks&quot;&gt;Preview Buffer Quirks&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#working-on-marked-files&quot;&gt;Working on Marked Files&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#deleting-images&quot;&gt;Deleting Images&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#tagging-and-untagging&quot;&gt;Tagging and Untagging&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#using-tags&quot;&gt;Using Tags&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#display-buffer&quot;&gt;Display Buffer&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#docview&quot;&gt;DocView&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#docview-resolution&quot;&gt;DocView Resolution&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#tramp&quot;&gt;TRAMP&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#default-directory&quot;&gt;Default Directory&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#multi-hops&quot;&gt;Multi-Hops&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#eww&quot;&gt;EWW: Emacs Web Wowser&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#invoking-external-browser&quot;&gt;Invoking External Browser&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dired&quot;&gt;Dired&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-getting-started&quot;&gt;Dired: Getting Started&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-navigation&quot;&gt;Dired: Navigation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-marking-and-unmarking&quot;&gt;Dired: Marking and Unmarking&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-operations&quot;&gt;Dired: Operations&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-copying-or-renaming-between-buffers&quot;&gt;Dired: Copying or Renaming Between Buffers&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-more-keys&quot;&gt;Dired: More Keys&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-x&quot;&gt;Dired-X&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dired-working-across-directories&quot;&gt;Dired: Working Across Directories&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#shell-commands&quot;&gt;Shell Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#compiling-in-emacs&quot;&gt;Compiling in Emacs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#shells-in-emacs&quot;&gt;Shells in Emacs&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#m-x-shell&quot;&gt;M-x shell&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#m-x-ansi-term&quot;&gt;M-x ansi-term&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#m-x-eshell&quot;&gt;M-x eshell&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;exploring-emacs&quot;&gt;Exploring Emacs&lt;/h2&gt;
&lt;p&gt;
  The book suggests the following techniques to explore Emacs:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;
      Reading the manual.  For example, type &lt;code&gt;M-x info RET&lt;/code&gt;
      or &lt;code&gt;C-h i&lt;/code&gt;, then navigate to the &lt;code&gt;Emacs&lt;/code&gt;
      hyperlink, then type &lt;code&gt;C-s version control RET&lt;/code&gt; and
      then navigate to the node named &lt;code&gt;Version Control&lt;/code&gt; to
      read the corresponding manual.
    &lt;/p&gt;
    &lt;p&gt;
      Note that the section named &lt;em&gt;The Info Manual&lt;/em&gt; in Chapter
      3 offers more alternatives to reach a specific node in a more
      straightforward manner.  For example, &lt;code&gt;C-h i m emacs RET m
      Version Control RET&lt;/code&gt; accomplishes the same result.
      Alternatively, &lt;code&gt;C-h R emacs RET m Version Control
      RET&lt;/code&gt; also accomplishes the same result.  Yet another way
      to accomplish the same result is to evaluate the Elisp
      expression &lt;code&gt;(info &quot;(emacs)Version Control&quot;)&lt;/code&gt;.  See
      section &lt;a href=&quot;ch03.html#info&quot;&gt;Info&lt;/a&gt; in chapter 3 notes for
      more details.
    &lt;/p&gt;
    &lt;p&gt;
      Yet another way to explore the manual is to use
      the &lt;code&gt;info-apropos&lt;/code&gt; command.  For example,
      type &lt;code&gt;M-x info-apropos RET version control RET&lt;/code&gt; to
      find manuals which have the string &quot;version control&quot; in them.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Using apropos.  For example, type &lt;code&gt;C-h d version control
      RET&lt;/code&gt; to search for all symbols whose documentation string
      contains the specified pattern.  Then type &lt;code&gt;C-h a ^vc-
      RET&lt;/code&gt; to search for all commands that match this pattern.
      This is a convenient way to list the vc commands.  Also, see
      section &lt;a href=&quot;ch03.html#apropos&quot;&gt;Apropos&lt;/a&gt; in chapter 3
      notes for more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Exploring prefix keys.  For example, type &lt;code&gt;C-x v C-h&lt;/code&gt;
      to list all key sequences bound to the prefix key &lt;code&gt;C-x
      v&lt;/code&gt;.  This is in fact a convenient way to list all the vc
      key bindings.  Also, see section
      &lt;a href=&quot;ch03.html#discovering-and-remembering-keys&quot;&gt;Discovering
      and Remembering Keys&lt;/a&gt; in chapter 3 notes for more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Describe what a key does.  For example, type &lt;code&gt;C-h k&lt;/code&gt;
      followed by &lt;code&gt;C-x v v&lt;/code&gt; to see the command that is
      bound to the latter key sequence as well as its documentation
      string along with other details like the keymap where the key
      binding is found, the file where the command is defined, other
      key bindings for the same command, etc.  See
      section &lt;a href=&quot;ch03.html#describe&quot;&gt;Describe&lt;/a&gt; in chapter 3
      notes for some more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Describe commands.  For example, type &lt;code&gt;C-h f vc-dir
      RET&lt;/code&gt; to see information about the &lt;code&gt;vc-dir&lt;/code&gt;
      command.  See section &lt;a href=&quot;ch03.html#describe&quot;&gt;Describe&lt;/a&gt;
      in chapter 3 notes for some more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Find mode commands.  Type &lt;code&gt;C-h m&lt;/code&gt; to see the
      documentation strings of the current major mode and minor modes.
      A brief summary of the minor modes is shown first, followed by
      the major mode description.  This is followed by documentation
      strings of the minor modes separated by page breaks (the form
      feed character that is rendered as &lt;code&gt;^L&lt;/code&gt; in Emacs).
      See section &lt;a href=&quot;ch03.html#describe&quot;&gt;Describe&lt;/a&gt; in chapter
      3 notes for some more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-X&lt;/code&gt; to run
      &lt;code&gt;execute-extended-command-for-buffer&lt;/code&gt; which executes
      commands that are relevant to the current buffer.  While
      offering completions, it limits the completions to commands
      relevant to the current buffer.  See
      section &lt;a href=&quot;ch03.html#m-x-execute-extended-command-for-buffer&quot;&gt;M-X:
      Execute Extended Command for Buffer&lt;/a&gt; of chapter 3 notes for
      more details.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;project-management&quot;&gt;Project Management&lt;/h2&gt;
&lt;p&gt;
  Emacs comes with a project management package
  named &lt;code&gt;project.el&lt;/code&gt; which offers commands to operate on
  projects.  When we use a project management command like &lt;code&gt;C-x p
  f&lt;/code&gt; to visit a file in the current project, this package
  automatically detects the top-level directory of the project by
  checking parent directories for version control system artifacts
  (e.g. &lt;code&gt;.git&lt;/code&gt; directory) and presents files within that
  top-level directory as autocomplete options.
&lt;/p&gt;
&lt;p&gt;
  The following complete key sequences demonstrate the package
  management commands mentioned in the book:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p p ... TAB RET ~/git/foo/ RET f README.md&lt;/code&gt;:
      This awkward key sequence discovers a new project directory
      at &lt;code&gt;~/git/foo/&lt;/code&gt; and then finds the file
      named &lt;code&gt;README.md&lt;/code&gt; in it.  As soon as the key
      sequence &lt;code&gt;f&lt;/code&gt; is typed above, the new project
      directory is discovered and added
      to &lt;code&gt;~/.emacs.d/projects&lt;/code&gt; which is where the list of
      known projects is saved.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p p bar TAB RET f Makefile&lt;/code&gt;: Assuming there is
      already a known project with &lt;code&gt;bar&lt;/code&gt; in its name
      (say, &lt;code&gt;~/git/bar/&lt;/code&gt;) that was discovered earlier, this
      key sequence switches to that project and finds the file named
      in &lt;code&gt;Makefile&lt;/code&gt; in it.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p f dev/build.sh RET&lt;/code&gt;: Find file
      named &lt;code&gt;dev/build.sh&lt;/code&gt; in the current project.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p f build TAB RET&lt;/code&gt;: Same as above
      if &lt;code&gt;dev/build.sh&lt;/code&gt; is the only match
      for &lt;code&gt;build&lt;/code&gt;.  Otherwise, it presents all files in the
      current project containing &lt;code&gt;build&lt;/code&gt; anywhere in its
      path name as autocomplete options.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p f bar TAB RET build TAB RET&lt;/code&gt;: When we
      type &lt;code&gt;C-x p f&lt;/code&gt; while visiting a file that does not
      belong to any project, then its prompts for a project name.  In
      this example, we type &lt;code&gt;bar TAB RET&lt;/code&gt; to automatically
      expand it to a known project name such
      as &lt;code&gt;~/git/bar/&lt;/code&gt; and enter it.  Then we
      type &lt;code&gt;build TAB RET&lt;/code&gt; to automatically expand it to a
      file name such as &lt;code&gt;dev/build.sh&lt;/code&gt; and enter it.
    &lt;/p&gt;
    &lt;p&gt;
      It is worth noting a general point that whenever we invoke a
      project command while visiting a file that does not belong to a
      project, the project command prompts for the project name.
      After we enter the project name, the project command runs on our
      chosen project.  This general point applies to other project
      commands that come later in this list.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p b Makefile RET&lt;/code&gt;: Switch to a buffer
      named &lt;code&gt;Makefile&lt;/code&gt; in the current project.  While
      entering the buffer name when &lt;code&gt;TAB&lt;/code&gt; is typed,
      completion options present buffer names from the current project
      only.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p k yes RET&lt;/code&gt;: Kill all buffers belonging to the
      current project.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p g ^key\&amp;gt; RET&lt;/code&gt;: Find all matches for the
      regular expression &lt;code&gt;^key\&amp;gt;&lt;/code&gt; in the current
      project.  The matches are found in all files in the project
      regardless of whether they are currently open in Emacs or not.
      The matches are displayed in a buffer named &lt;code&gt;*xref*&lt;/code&gt;.
      We can navigate this buffer using key sequences
      like &lt;code&gt;n&lt;/code&gt;, &lt;code&gt;p&lt;/code&gt;, etc.  Type
      &lt;code&gt;C-h m&lt;/code&gt; in this buffer to see a list of key sequences
      supported in this buffer.  As we navigate this buffer and go
      from one match to another using &lt;code&gt;n&lt;/code&gt;, &lt;code&gt;p&lt;/code&gt;,
      etc. the files containing the match are loaded in a split window
      automatically with the matching lines automatically centred in
      that window.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p r ^key\&amp;gt; RET =key= RET&lt;/code&gt;: Find all matches
      for the regular expression pattern &lt;code&gt;^key\&amp;gt;&lt;/code&gt; in the
      current project and replace them with &lt;code&gt;=key=&lt;/code&gt;.  The
      modified files are not automatically saved though.  They needed
      to be saved later explicitly.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p c RET&lt;/code&gt;: Compiles the current project.  By
      default, it offers as &lt;code&gt;make -f&lt;/code&gt; as the command to be
      run in the project root.  If a specific &lt;code&gt;make&lt;/code&gt; target
      needs to be executed or if another command needs to be executed,
      then the default command offered may be edited before
      typing &lt;code&gt;RET&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p v&lt;/code&gt;: Runs VC-Dir in the current project&apos;s root
      which in turn shows version control status for the project root.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p s&lt;/code&gt;: Start shell in the current project&apos;s root
      directory.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p d RET&lt;/code&gt;: Start Dired in the current project&apos;s
      root directory.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p D&lt;/code&gt;: Same as above.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-x p d doc/tutorial/ RET&lt;/code&gt;: Start Dired in
      the &lt;code&gt;doc/tutorial/&lt;/code&gt; subdirectory in the current
      project.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  There are several more project management key bindings.
  Type &lt;code&gt;C-x p C-h&lt;/code&gt; to see a complete list of them.
&lt;/p&gt;
&lt;h2 id=&quot;xref&quot;&gt;Xref&lt;/h2&gt;
&lt;p&gt;
  Xref provides a generic framework to support commands for
  cross-referencing in Emacs.  While there are several ways to set it
  up and configure it, the book mentions a particular way to set it up
  using a couple of external tools.  The next two subsections discuss
  the setup work involved before we can use Xref in a modern way.  The
  remaining subsections discuss how to use Xref.
&lt;/p&gt;
&lt;h3 id=&quot;xref-setup&quot;&gt;Xref Setup&lt;/h3&gt;
&lt;p&gt;
  By default when we try to look up a definition of an identifier in,
  say, a C file or Python file, by typing &lt;code&gt;M-.&lt;/code&gt;, it
  presents a minibuffer for us to select a tags table file (typically
  named &lt;code&gt;TAGS&lt;/code&gt;).  This requires setting up
  a &lt;code&gt;TAGS&lt;/code&gt; file with a tool like &lt;code&gt;ctags&lt;/code&gt;.  The
  book, however, does not explore this method for good reason.
  Typically the &lt;code&gt;TAGS&lt;/code&gt; file needs to be created with a tool
  like &lt;code&gt;ctags&lt;/code&gt; or &lt;code&gt;etags&lt;/code&gt; for every project we
  work on.  This file contains an index of names found in source code
  files.  We need to periodically update it as the code of our
  projects evolve, so that this index remains up-to-date.  For a long
  time, this was the only way to maintain an index of the names found
  in a source code, so that we could perform cross-referencing in
  editors like Vim and Emacs.  Relying on a tool
  like &lt;code&gt;grep&lt;/code&gt; to search the code on the fly was deemed to
  be quite slow.  However, with modern, fast hardware we do not have
  to work like this anymore.  Further, there are search tools
  like &lt;code&gt;ag&lt;/code&gt; and &lt;code&gt;rg&lt;/code&gt; which are extremely fast.
  Given these modern developments, there are simpler ways to set up
  cross-referencing in Emacs.
&lt;/p&gt;
&lt;p&gt;
  The book suggets installing an external package
  named &lt;code&gt;dumb-jump&lt;/code&gt;.  It can be installed from MELPA with
  the key sequence &lt;code&gt;M-x package-install dumb-jump RET&lt;/code&gt;.
  See &lt;a href=&quot;https://github.com/jacktasia/dumb-jump&quot;&gt;github.com/jacktasia/dumb-jump&lt;/a&gt;
  for more details about this package.  After installing this package,
  add the following code to the Emacs initialisation file:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(add-hook &apos;xref-backend-functions #&apos;dumb-jump-xref-activate)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Here is a minimal Elisp code that sets up &lt;code&gt;dumb-jump&lt;/code&gt;
  from scratch and configures it as mentioned above:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require &apos;package)
(add-to-list &apos;package-archives &apos;(&quot;melpa&quot; . &quot;https://melpa.org/packages/&quot;) t)
(package-initialize)
(unless package-archive-contents
  (package-refresh-contents))
(dolist (package &apos;(dumb-jump))
  (unless (package-installed-p package)
    (package-install package)))
(add-hook &apos;xref-backend-functions #&apos;dumb-jump-xref-activate)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The above code configures Emacs to use MELPA, retrieve the latest
  list of packages available there, install &lt;code&gt;dumb-jump&lt;/code&gt;
  from it, as well as set up a hook to activate it automatically when
  we use certain Xref commands.
&lt;/p&gt;
&lt;h3 id=&quot;search-tools-for-xref&quot;&gt;Search Tools for Xref&lt;/h3&gt;
&lt;p&gt;
  Once Xref is set up with &lt;code&gt;dumb-jump&lt;/code&gt; as explained in the
  previous section, open a source code file (say, a C file or a Python
  file), move the cursor over to some identifier and
  type &lt;code&gt;M-.&lt;/code&gt; to search that identifier in your environment.
  By default, it searches for the identifier in files of the same type
  found under the home directory with a tool like &lt;code&gt;ag&lt;/code&gt;,
  &lt;code&gt;rg&lt;/code&gt; or &lt;code&gt;grep&lt;/code&gt; (the first one it finds).
  There is an exception to this rule though.  If
  neither &lt;code&gt;ag&lt;/code&gt; nor &lt;code&gt;rg&lt;/code&gt; is found and only GNU
  grep is found, then typing &lt;code&gt;M-.&lt;/code&gt; on an indentifier
  searches the identifier in all files in the home directory (as
  opposed to searching for files of a specific type).  If BSD grep is
  found instead, then this is not a problem and only files of the
  current type is searched for the identifier.
&lt;/p&gt;
&lt;p&gt;
  Further, while looking up definitions within a Git repository, this
  package invokes the &lt;code&gt;git grep&lt;/code&gt; command to restrict
  searches to the repository directory.
&lt;/p&gt;
&lt;p&gt;
  Let us now look at a few examples of the actual search commands that
  are executed under the hood when we type &lt;code&gt;M-.&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  If neither &lt;code&gt;ag&lt;/code&gt; nor &lt;code&gt;rg&lt;/code&gt; is installed and we
  only have &lt;code&gt;grep&lt;/code&gt; on our system, typing &lt;code&gt;M-.&lt;/code&gt;
  while the cursor is on an identifier named &lt;code&gt;foo&lt;/code&gt; in a
  Python file leads to the execution of a command like this when BSD
  grep is found:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;grep -REn --include &apos;*.py&apos; -e &apos;\s*\bfoo\s*=[^=\n]+&apos; -e &apos;def\s*foo\b\s*\(&apos; -e &apos;class\s*foo\b\s*\(?&apos; /Users/susam&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  If GNU grep is found instead, then all files (not
  just &lt;code&gt;*.py&lt;/code&gt; files) are searched with a command like this:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;grep -rEn -e &apos;[[:space:]]*\bfoo[[:space:]]*=[^=\n]+&apos; -e &apos;def[[:space:]]*foo\b[[:space:]]*\(&apos; -e &apos;class[[:space:]]*foo\b[[:space:]]*\(?&apos; /home/susam&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  If &lt;code&gt;rg&lt;/code&gt; is the only additional search tool installed,
  then the following command is executed:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rg --color never --no-heading --line-number -U --pcre2 --type py &apos;\s*\bfoo\s*=[^=\n]+|def\s*foo\b\s*\(|class\s*foo\b\s*\(?&apos; /home/susam&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  If &lt;code&gt;ag&lt;/code&gt; is installed, then the following command is
  executed:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ag --nocolor --nogroup --python &apos;\s*\bfoo\s*=[^=\n]+|def\s*foo\b\s*\(|class\s*foo\b\s*\(?&apos; /home/susam&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  When we type &lt;code&gt;M-.&lt;/code&gt; in a file that belongs to a Git
  repository, only the repository directory is searched with a command
  like this:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git grep --color=never --line-number --untracked -E &apos;\s*\bfoo\s*=[^=\n]+|def\s*foo\b\s*\(|class\s*foo\b\s*\(?&apos; -- /home/susam/repo/*.py&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The book makes a mention of &lt;code&gt;rg&lt;/code&gt; and remarks about the
  impressive speed with which it searches the file system.  I
  recommend it too.  Since the &lt;code&gt;M-.&lt;/code&gt; command may search the
  whole home directory, if the home directory is very large, having a
  fast search tool like &lt;code&gt;rg&lt;/code&gt; or &lt;code&gt;ag&lt;/code&gt; makes a
  significant difference.  For example what could normally take 10 to
  20 seconds to search using &lt;code&gt;grep&lt;/code&gt; might only take a
  second or two with &lt;code&gt;rg&lt;/code&gt; or &lt;code&gt;ag&lt;/code&gt;.  I
  use &lt;code&gt;M-.&lt;/code&gt; with &lt;code&gt;rg&lt;/code&gt;.
&lt;/p&gt;
&lt;h3 id=&quot;four-most-common-xref-commands&quot;&gt;Four Most Common Xref Commands&lt;/h3&gt;
&lt;p&gt;
  The book mentions the following commands as the four most common
  commands we should know about:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-.&lt;/code&gt;: Find definitions of the identifier at point.
      If a unique definition is found, then the file containing the
      definition is automatically opened and the definition is centred
      in the window.  If multiple possible candidates are found, then
      they are displayed in an Xref buffer that we can navigate using
      key sequences like &lt;code&gt;n&lt;/code&gt; or &lt;code&gt;p&lt;/code&gt;.  As we
      navigate the Xref buffer, the source of each match is
      automatically opened in a split window and the matching line is
      centred.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-,&lt;/code&gt;: Go back to where &lt;code&gt;M-.&lt;/code&gt; was last
      invoked.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-? foo RET ~/git/foo/ RET&lt;/code&gt;: Find all occurrences of
      the word &lt;code&gt;foo&lt;/code&gt; in files of the same type as the
      current file in the project directory &lt;code&gt;~/git/foo/&lt;/code&gt;.
      It does not restrict the search to definitions only.  If the
      current file belongs to a project already, then we could simply
      type &lt;code&gt;M-? foo RET&lt;/code&gt;.  In fact, since the input to the
      minibuffer prompt is the identifier at the point by default, we
      could simply type &lt;code&gt;M-? RET&lt;/code&gt; to search for the current
      identifier in the current project.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-M-. foo RET&lt;/code&gt;: Find symbols matching the given
      pattern.  Although the documentation mentions that this supports
      regular expressions, it seemed to treat the given pattern as an
      identifier and searched for that identifier literally.  In fact,
      the &lt;code&gt;rg&lt;/code&gt; commands that were executed under the hood
      were exactly the same as the ones executed by &lt;code&gt;M-.&lt;/code&gt;.
      Thus with &lt;code&gt;dumb-jump&lt;/code&gt; enabled, both &lt;code&gt;M-.&lt;/code&gt;
      and &lt;code&gt;C-M-.&lt;/code&gt; behave similarly.  The only difference is
      that &lt;code&gt;M-.&lt;/code&gt; searches for the identifier at the point
      whereas &lt;code&gt;C-M-.&lt;/code&gt; searches for the identifier we enter
      at the minibuffer as input.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  When multiple cross-references are displayed in the Xref buffer, we
  can use the following key sequences to work with the Xref buffer.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;n&lt;/code&gt;: Move to the next cross-reference.  The source of
      the cross-reference is automatically displayed in another
      window.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;n&lt;/code&gt;: Move to the previous cross-reference.  The source
      of the cross-reference is automatically displayed in another
      window.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;.&lt;/code&gt;: Same as &lt;code&gt;n&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;,&lt;/code&gt;: Same as &lt;code&gt;p&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;RET&lt;/code&gt;: Jump to the source of the current
      cross-reference.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;TAB&lt;/code&gt;: Hide Xref buffer and jump to the source.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;C-o&lt;/code&gt;: Show the source of the cross-reference at
      point in a separate window but keep the point in the Xref
      window.  This is useful when we navigate the Xref buffer using
      normal Emacs commands like &lt;code&gt;C-p&lt;/code&gt;, &lt;code&gt;C-n&lt;/code&gt;,
      &lt;code&gt;C-s&lt;/code&gt;, etc.  While navigating the Xref buffer with
      these normal Emacs commands, the source of the cross-references at
      the point is not automatically displayed.  The key
      sequence &lt;code&gt;C-o&lt;/code&gt; helps us to display the cross-reference
      at the point in this case.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;r&lt;/code&gt;: Perform search and replace in the names of the
      references displayed in the Xref buffer.  However, I did not
      find this to be working successfully
      with &lt;code&gt;dumb-jump&lt;/code&gt;.  Any attempt to use this command
      with &lt;code&gt;dumb-jump&lt;/code&gt; always led me to the following
      error: &lt;code&gt;No suitable matches here&lt;/code&gt;.  This key sequence
      does work as expected when Xref is invoked from Dired as going
      to be explained in the next section.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;xref-and-dired&quot;&gt;Xref and Dired&lt;/h3&gt;
&lt;p&gt;
  Here are some key sequences that demonstrate how we can use Xref
  with Dired.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x d RET&lt;/code&gt;: Edit current directory using Dired.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;n&lt;/code&gt;: Move to the next line.  &lt;code&gt;C-n&lt;/code&gt; also
    works.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;p&lt;/code&gt;: Move to the previous line.  &lt;code&gt;C-p&lt;/code&gt; also
    works.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;m&lt;/code&gt;: Mark the file or subdirectory at the point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;u&lt;/code&gt;: Unmark the file or subdirectory at the point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;A f.. RET&lt;/code&gt;: Find all matches for the regular
    expression &lt;code&gt;f..&lt;/code&gt; in the marked files and
    subdirectories.  The matches are always displayed in an Xref
    buffer, even when a single match is found.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;Q f.. RET bar RET&lt;/code&gt;: Find all matches for the regular
    expression &lt;code&gt;f..&lt;/code&gt; in the marked files and subdirectories
    and replace them with &lt;code&gt;bar&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;working-with-log-files&quot;&gt;Working with Log Files&lt;/h2&gt;
&lt;p&gt;
  In this section of the book, it discusses a set of commands that are
  useful for working with log files.  Note that some of these commands
  have been already introduced in the previous chapters.  The
  following list presents the commands discussed in this section of
  the book:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f&lt;/code&gt;: Find a file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-r&lt;/code&gt;: Find file and open in read-only mode.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-q&lt;/code&gt;: Toggle read-only mode.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x flush-lines RET b.. RET&lt;/code&gt;: Delete lines in region
    that match the regular expression &lt;code&gt;b..&lt;/code&gt;.  If no region
    is active, then delete matching lines between the point and end of
    buffer.  The deleted lines are not copied to kill ring.  See
    section &lt;a href=&quot;ch05.html#deleting-and-keeping-lines&quot;&gt;Deleting
    and Keeping Lines&lt;/a&gt; of chapter 5 notes for more details.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x keep-lines RET b.. RET&lt;/code&gt;: Keep lines in region that
    match the regular expression &lt;code&gt;b..&lt;/code&gt; and delete the rest.
    If no region is active, then keep matching lines between the point
    and end of buffer and delete the rest.  The deleted lines are not
    copied to kill ring.  See section
    &lt;a href=&quot;ch05.html#deleting-and-keeping-lines&quot;&gt;Deleting and
    Keeping Lines&lt;/a&gt; of chapter 5 notes for more details.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-s o b.. RET&lt;/code&gt;: Show all lines in the current buffer
    matching the regular expression &lt;code&gt;b..&lt;/code&gt;.  If the region
    is active, then show matching lines from the region only.  The
    matches are shown in a new Occur mode buffer.  The book makes a
    special mention that we can run &lt;code&gt;M-s o&lt;/code&gt; on an Occur
    mode buffer to filter it further and get the results in another
    Occur mode buffer.  See section
    &lt;a href=&quot;ch04.html#occur-mode&quot;&gt;Occur Mode&lt;/a&gt; in chapter 4 notes
    for more details.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;highlighting&quot;&gt;Highlighting&lt;/h2&gt;
&lt;p&gt;
  Section &lt;em&gt;Working with Log Files&lt;/em&gt; of Chapter 6 of the book
  also introduces highlighting commands that can be very useful for
  highlighting certain strings in the log file.  The highlighting
  commands are demonstrated below with an example.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      First create a buffer with the following content.
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo bar baz
Foo Bar Baz
FOO BAR BAZ
foo  bar  baz
Foo  Bar  Baz
FOO  BAR  BAZ&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now type &lt;code&gt;M-s h p f.. SPC b.. RET RET&lt;/code&gt; to highlight
      the phrases matching the regular expression &lt;code&gt;f.. b..&lt;/code&gt;
      in a case-insensitive and whitespace-insensitive manner.  A
      total of six matches will be highlighted because the first two
      words and the whitespace between them in all lines match this
      phrase pattern when we ignore the case of the words and the
      amount of whitespace.  The second &lt;code&gt;RET&lt;/code&gt; is meant to
      accept the default face offered to us for highlighting.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now type &lt;code&gt;M-s h p b.z RET RET&lt;/code&gt; to highlight the
      phrases matching the regular expression &lt;code&gt;b.z&lt;/code&gt;.  Again
      we select the default face offered to us for highlighting.  At
      this point, we should see two sets of highlighting in two
      different faces.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now move the cursor to one of the first set of highlights and
      type &lt;code&gt;M-s h u RET&lt;/code&gt;.  Those highlights will be
      unhighlighted.  The &lt;code&gt;RET&lt;/code&gt; key accepts the default
      unhighlighting pattern offered to us.  It happens to be the
      pattern with which the highlight under the cursor was
      highlighted.  That is why this key sequence ends up
      unhighlighting the highlight under the cursor.
    &lt;/p&gt;
    &lt;p&gt;
      If the cursor were not over a highlgiht, then the default
      unhighlighting pattern offered to us would have been the pattern
      we used for the last highlight.  In that case, we could
      type &lt;code&gt;M-s h u f.. b.. RET&lt;/code&gt; to explicitly specify the
      unhighlighting pattern.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now type &lt;code&gt;M-s h u RET&lt;/code&gt; again to remove the second set
      of highlights too.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-s h p F.. SPC B.. RET RET&lt;/code&gt; to perform a
      case-sensitive but whitespace-insensitive highlighting.  When
      there is an uppercase letter in the pattern, the highlighting
      becomes case-sensitive.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-s h u RET&lt;/code&gt; to remove the previous
      highlighting.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-s h r f.. SPC b.. RET RET&lt;/code&gt; to perform a
      case-insensitive but whitespace-sensitive highlighting.  This
      time, there are only three matches from the first three lines.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-s h u RET&lt;/code&gt; to remove the previous
      highlighting.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-s h r F.. SPC B.. RET RET&lt;/code&gt; to perform a
      case-sensitive and whitespace-sensitive highlighting.  The
      matching strings are found in the second and third lines.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Move the cursor to lowercase &lt;code&gt;bar&lt;/code&gt; and type &lt;code&gt;M-s
      h .&lt;/code&gt; to highlight symbol at point.  All six occurrences of
      this symbol are highlighted in a case-insensitive manner because
      the symbol at point is written in all lowercase.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Move the cursor to &lt;code&gt;Baz&lt;/code&gt; and type &lt;code&gt;M-s h
      .&lt;/code&gt; to highlight symbol at point.  Only two occurrences of
      this symbol get highlighted.  The highlighted symbols match the
      symbol &lt;code&gt;Baz&lt;/code&gt; exactly (case-sensitive match).  The
      highlighting is done in case-sensitive manner because the symbol
      at point has at least one uppercase letter.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;auto-revert-mode&quot;&gt;Auto-Revert Mode&lt;/h2&gt;
&lt;p&gt;
  The following steps demonstrate how to use
  the &lt;code&gt;revert-buffer&lt;/code&gt; command and then how to
  use &lt;code&gt;auto-revert-mode&lt;/code&gt;.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      In a terminal, run the following command:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;: &amp;gt; /tmp/log.txt &amp;amp;&amp;amp; while true; do date &amp;gt;&amp;gt; /tmp/log.txt; sleep 1; done&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      You could use &lt;code&gt;ansi-term&lt;/code&gt; within Emacs too as the
      terminal if you are familiar with it.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now within Emacs, type &lt;code&gt;C-x C-f /tmp/log.txt RET&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Wait for a few seconds and type &lt;code&gt;M-x revert-buffer RET yes
      RET&lt;/code&gt; to update the buffer with the latest content of the
      file from the file system.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x auto-revert-mode RET&lt;/code&gt; to enable automatic
      update of the buffer as the file changes on the file system.
      Note that this reloads the entire file whenever a change is
      detected, so this could be inefficient while working with very
      large files.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-&amp;gt;&lt;/code&gt; to go to the end of the buffer.  This
      moves the cursor to the end of the buffer.  Doing this ensures
      that as the buffer is automatically updated, the cursor
      automatically keeps moving to the end of the file.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Terminate the command of step 1 and run this command in a
      terminal:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;echo hello &amp;gt; /tmp/log.txt&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      The content of the buffer should now automatically truncate and
      update to just the text &lt;code&gt;hello&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Run the command in step 1 again and confirm that the content of
      the buffer in Emacs gets updated automatically.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x auto-revert-mode RET&lt;/code&gt; to disable automatic
      update of the buffer.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;auto-revert-tail-mode&quot;&gt;Auto Revert Tail Mode&lt;/h2&gt;
&lt;p&gt;
  The mode named &lt;code&gt;auto-revert-tail-mode&lt;/code&gt; is similar
  to &lt;code&gt;auto-revert-mode&lt;/code&gt;.  However,
  unlike &lt;code&gt;auto-revert-mode&lt;/code&gt; which reloads the entire file
  on every update, the &lt;code&gt;auto-revert-tail-mode&lt;/code&gt; only follows
  the tail of the buffer and appends any new text found to the buffer.
  The following steps demonstrate this:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Like in the previous section, run the following command:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;: &amp;gt; /tmp/log.txt &amp;amp;&amp;amp; while true; do date &amp;gt;&amp;gt; /tmp/log.txt; sleep 1; done&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x auto-revert-tail-mode RET&lt;/code&gt;.  Note that this
      command follows the tail of the file only.  It does not reload
      the entire file.  This can be confirmed with the next step.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Terminate the command of step 1 and run this command in a
      terminal:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;echo hello &amp;gt; /tmp/log.txt&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      The buffer for this file in Emacs should automatically update to
      show the text &lt;code&gt;hello&lt;/code&gt; at the bottom.  But notice all
      the earlier text remains intact.  The earlier text does not
      disappear from the buffer because Emacs does not reload the
      entire file when &lt;code&gt;auto-revert-tail-mode&lt;/code&gt; is enabled.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Run the command in step 1 again and confirm that the content of
      the buffer begins to get updated automatically again.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      As of Emacs 28.2, unfortunately running &lt;code&gt;M-x
      auto-revert-tail-mode RET&lt;/code&gt; is not sufficient to disable
      automatic updates in the buffer.  This command does disable the
      mode but the buffer continues to be updated everytime the file
      changes.  This is very likely a bug in this mode.
    &lt;/p&gt;
    &lt;p&gt;
      As a workaround, disabling &lt;code&gt;auto-revert-mode&lt;/code&gt; ends up
      stopping the auto-update behaviour.  There are two ways to do
      this.  You could type &lt;code&gt;M-x auto-revert-mode RET&lt;/code&gt;
      twice: once to enable it and a second time to disable it.
      Alternatively, just simply type &lt;code&gt;C-0 M-x auto-revert-mode
      RET&lt;/code&gt; which invokes the mode with a prefix argument of zero
      which ends up disabling the mode.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;browsing-tarballs&quot;&gt;Browsing Tarballs&lt;/h2&gt;
&lt;p&gt;
  The following steps demonstrate how we can not only browse a tarball
  but also edit files in it and save them back to the tarball.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      First, create a directory of text files with the following shell
      commands:
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir -p foo/bar/baz/
echo hello foo &amp;gt; foo/foo.txt
echo hello bar &amp;gt; foo/bar/bar.txt
echo hello baz &amp;gt; foo/bar/baz/baz.txt
tar -caf /tmp/foo.tgz foo/&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Confirm that the tarball looks good with these shell commands:
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tar -tf /tmp/foo.tgz
tar -xOf /tmp/foo.tgz&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Within Emacs, type &lt;code&gt;C-x C-f /tmp/foo.tgz RET&lt;/code&gt; to open
      the tarball.  A list of all entries in the tarball is displayed
      in a Tar buffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;n&lt;/code&gt; and &lt;code&gt;p&lt;/code&gt; to navigate the Tar
      buffer down and up respectively.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      With the cursor on the line
      containing &lt;code&gt;foo/bar/baz/baz.txt&lt;/code&gt;,
      type &lt;code&gt;RET&lt;/code&gt;.  The content of this entry is now
      displayed in a new buffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now in the buffer that displays the content
      of &lt;code&gt;baz.txt&lt;/code&gt;, edit its content.  Say, type &lt;code&gt;C-a
      !&lt;/code&gt; to append an exclamation point to this buffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x C-s&lt;/code&gt; to save this buffer.  This updates the
      entry of &lt;code&gt;foo/bar/baz/baz.txt&lt;/code&gt; within the buffer
      for &lt;code&gt;foo.tgz&lt;/code&gt;.  However, the updated tarball is not
      written to the file system yet.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x b foo.tgz RET&lt;/code&gt; to go back to the buffer
      with the tarball entry listing.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Finally, type &lt;code&gt;C-x C-s&lt;/code&gt; to save the tarball to the
      file system.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now repeat step 2.  The updated content
      of &lt;code&gt;foo/bar/baz/baz.txt&lt;/code&gt; should now appear in the
      output.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;dired-thumbnail-image-browser&quot;&gt;Dired: Thumbnail Image Browser&lt;/h2&gt;
&lt;p&gt;
  Assuming there is a directory &lt;code&gt;~/foo/&lt;/code&gt; that contains
  several image files as well as files of other types, the
  command &lt;code&gt;M-x image-dired RET ~/foo/ RET&lt;/code&gt; creates a
  preview buffer of all images in the directory and displays it along
  with a normal dired buffer showing the directory listing.  Both
  buffers are displayed in two separate windows.
&lt;/p&gt;
&lt;p&gt;
  When the preview buffer is first launched, all image files found in
  the directory are automatically &lt;em&gt;marked&lt;/em&gt;.  This can be seen
  in the Dired buffer.  However the preview buffer does not reflect
  this immediately.  Type &lt;code&gt;m&lt;/code&gt; in the preview buffer to
  force it to pick the current list of marked images and highlight
  them.
&lt;/p&gt;
&lt;p&gt;
  As a best practice, remember to type &lt;code&gt;m&lt;/code&gt; soon after
  launching &lt;code&gt;image-dired&lt;/code&gt; so that the marked images are
  accurately displayed in the preview buffer.
&lt;/p&gt;
&lt;p&gt;
  Within the preview buffer, the following key sequences are
  supported:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-f&lt;/code&gt;: Move to next image.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-b&lt;/code&gt;: Move to the previous image.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-n&lt;/code&gt;: Move to next row of images.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-p&lt;/code&gt;: Move to previous row of images.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;RET&lt;/code&gt;: Display the original image in a display buffer.
  &lt;li&gt;
    &lt;code&gt;m&lt;/code&gt;: Mark an image file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;u&lt;/code&gt;: Unmark an image file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;d&lt;/code&gt;: Flag an image file for deletion.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;t t&lt;/code&gt;: Tag marked thumbnails.  If no thumbnails are
    marked, tag the current thumbnail.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;t r&lt;/code&gt;: Remove tag from marked thumbnails.  If no
    thumbnails are marked, remove tag from the current thumbnail.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;l&lt;/code&gt;: Rotate thumbnail left.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;r&lt;/code&gt;: Rotate thumbnail right.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;preview-buffer-quirks&quot;&gt;Preview Buffer Quirks&lt;/h3&gt;
&lt;p&gt;
  The &lt;code&gt;m&lt;/code&gt;, &lt;code&gt;u&lt;/code&gt; or &lt;code&gt;d&lt;/code&gt; commands in the
  preview buffer are actually meant to mark, unmark or flag the
  corresponding files in the Dired buffer.  The highlighting or
  unhighlighting that occurs in the preview buffer is merely a
  convenience feature.  The preview buffer may not always accurately
  reflect the most recent list of all marked and flagged files.
  Always keep an eye on the Dired buffer to check the most recent
  state of the files.
&lt;/p&gt;
&lt;p&gt;
  Especially, if we go back to the Dired buffer and mark, unmark or
  flag files, the preview buffer does not reflect it automatically.
  We need to go to the preview buffer again and perform at least one
  similar operation (&lt;code&gt;m&lt;/code&gt;, &lt;code&gt;u&lt;/code&gt; or
  &lt;code&gt;d&lt;/code&gt;) in the preview buffer for it to be updated again.
  This is why it is important to keep an eye on the Dired buffer to
  get an accurate account of which files are marked or flagged.
&lt;/p&gt;
&lt;h3 id=&quot;working-on-marked-files&quot;&gt;Working on Marked Files&lt;/h3&gt;
&lt;p&gt;
  Say we have marked some image files using the key
  sequence &lt;code&gt;m&lt;/code&gt; in the preview buffer.  Now we can perform
  various operations on these marked files.  For example, to copy the
  marked files to &lt;code&gt;/tmp/&lt;/code&gt; directory, in a Dired buffer,
  type &lt;code&gt;C /tmp/ RET&lt;/code&gt;.  To move them instead, type &lt;code&gt;R
  /tmp/&lt;/code&gt;.
&lt;/p&gt;
&lt;h3 id=&quot;deleting-images&quot;&gt;Deleting Images&lt;/h3&gt;
&lt;p&gt;
  When we flag thumbnails by typing &lt;code&gt;d&lt;/code&gt; in the preview
  buffer, the corresponding files are flagged for deletion in the
  Dired buffer.  The first column of the flagged file entries contain
  the letter &lt;code&gt;D&lt;/code&gt; in the Dired buffer.  Type &lt;code&gt;x&lt;/code&gt;
  in the Dired buffer to permanently delete (expunge) the flagged
  files.
&lt;/p&gt;
&lt;h3 id=&quot;tagging-and-untagging&quot;&gt;Tagging and Untagging&lt;/h3&gt;
&lt;p&gt;
  If there are marked images, then the tagging and untagging commands
  executed in the preview buffer work on those marked images.
  Otherwise, they work on image corresponding to the current
  thumbnail.  We will refer to these images that the tagging or
  untagging commands work on as &lt;em&gt;target&lt;/em&gt; images in the next few
  paragraphs..
&lt;/p&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;t t trip;oxford;uk RET&lt;/code&gt; tags the target
  images with the tags &lt;code&gt;trip&lt;/code&gt;, &lt;code&gt;oxford&lt;/code&gt;
  and &lt;code&gt;uk&lt;/code&gt;.  The tags must be separated by semicolon as
  shown in the preceding example.  The tags are saved in a path set in
  the &lt;code&gt;image-dired-db-file&lt;/code&gt; variable.  Type &lt;code&gt;C-h v
  image-dired-db-file&lt;/code&gt; to read this path.  Typically, it is
  something like &lt;code&gt;~/.emacs.d/image-dired/.image-dired_db&lt;/code&gt;.
  We will call this the DB file.  This file may be manually inspected
  to see how this command and the next command affect the tags for
  each thumbnail.  Alternatively, type &lt;code&gt;C-t e&lt;/code&gt; in a Dired
  buffer to view and edit the tags of the target files.
&lt;/p&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;t r trip RET&lt;/code&gt; removes the
  tag &lt;code&gt;trip&lt;/code&gt; from the target images.  By virtue of how this
  functionality is implemented, a key sequence like &lt;code&gt;t r
  t.*d&lt;/code&gt; removes the tags &lt;code&gt;trip;oxford&lt;/code&gt;
  and &lt;code&gt;trip;salford&lt;/code&gt; (if present) from the DB file but it
  does not remove a tag like &lt;code&gt;trip;cambridge&lt;/code&gt; (if present).
&lt;/p&gt;
&lt;h3 id=&quot;using-tags&quot;&gt;Using Tags&lt;/h3&gt;
&lt;p&gt;
  Tagging thumbnails could be useful if we want to later mark files by
  tags.  In a Dired buffer, the key sequence &lt;code&gt;C-t f t.*d&lt;/code&gt;
  will mark all files whose thumbnails have tags (as they appear in
  the tags file) matching the regular expression &lt;code&gt;t.*d&lt;/code&gt;.
  For example, images that have with tags &lt;code&gt;trip;oxford;uk&lt;/code&gt;
  as well as &lt;code&gt;trip;london;uk&lt;/code&gt; will be marked but images
  with tags &lt;code&gt;trip;bath;uk&lt;/code&gt;
  and &lt;code&gt;trip;liverpool;uk&lt;/code&gt; will not be marked.
&lt;/p&gt;
&lt;h3 id=&quot;display-buffer&quot;&gt;Display Buffer&lt;/h3&gt;
&lt;p&gt;
  When we type &lt;code&gt;RET&lt;/code&gt; in the preview buffer, the original
  image is displayed in a display buffer.  The following key sequences
  are supported in the display buffer:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;s&lt;/code&gt;: Resize image to fit window.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;f&lt;/code&gt;: Display current image in full size.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;q&lt;/code&gt;: Quit window.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The book makes a note that when we open an image file directly from
  a Dired buffer, the image is opened in &lt;code&gt;image-mode&lt;/code&gt; which
  is more powerful than the display buffer we get when we open an
  image from the thumbnail preview window.
&lt;/p&gt;
&lt;h2 id=&quot;docview&quot;&gt;DocView&lt;/h2&gt;
&lt;p&gt;
  When a PDF or another document of a supported format is opened in
  Emacs, they are converted to images on the fly and displayed in
  Emacs.  In this section, we will discuss working with PDFs only.
  The converted images are cached at the directory set in
  the &lt;code&gt;doc-view-cache-directory&lt;/code&gt; variable.
&lt;/p&gt;
&lt;p&gt;
  Type &lt;code&gt;C-h v auto-mode-alist RET&lt;/code&gt; and search
  for &lt;code&gt;doc-view&lt;/code&gt; in the help buffer to see the list of file
  formats that Emacs tries to open in DocView.
&lt;/p&gt;
&lt;p&gt;
  Ghostscript needs to be installed so that DocView can convert the
  PDF into images.  Further, for some commands where we perform
  text-based operations on the PDF, we need the &lt;code&gt;pdftotext&lt;/code&gt;
  command so that DocView can extract text from the PDF.
  Type &lt;code&gt;C-h v doc-view-ghostscript-program RET&lt;/code&gt;
  and &lt;code&gt;C-h v doc-view-pdftotext-program RET&lt;/code&gt; to see the
  external programs that DocView depends on.  These programs can be
  installed with the following command on a Debian or Debian-based
  Linux distribution:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get install ghostscript poppler-utils&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  On a macOS system, run the following command instead:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;brew install ghostscript poppler&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The following list presents some of the key bindings supported by
  DocView:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;n&lt;/code&gt;: Go to next page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;p&lt;/code&gt;: Go to previous page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x ]&lt;/code&gt;: Same as &lt;code&gt;n&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x [&lt;/code&gt;: Same as &lt;code&gt;p&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;SPC&lt;/code&gt;: Scroll up if possible or go to next page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;DEL&lt;/code&gt;: Scroll down if possible or go to the previous page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;S-SPC&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-&amp;lt;&lt;/code&gt;: View the first page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-&amp;gt;&lt;/code&gt;: View the last page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;+&lt;/code&gt;: Enlarge the document.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;-&lt;/code&gt;: Shrink the document.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;0&lt;/code&gt;: Reset the document size to the initial one.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;W&lt;/code&gt;: Fit the image width to the window width.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;H&lt;/code&gt;: Fit the image height to the window height.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;P&lt;/code&gt;: Fit the image to the window such that neither the
    document width nor the document height exceed the window width or
    height respectively.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;F&lt;/code&gt;: Resize the window so it just fits the page.  When
    there is only window in the frame, the window cannot be resized
    independently of the frame, so the frame is resized instead.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x doc-view-presentation RET&lt;/code&gt;: Display document in
    presentation mode, i.e. as a full screen slide show.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Although not mentioned in the book, here are some commands that show
  how to perform text-based operations on the PDF.  These commands
  need &lt;code&gt;pdftotext&lt;/code&gt; to be installed.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-s ^f..\&amp;gt; RET&lt;/code&gt;: Initiate a new search for lines
    that begin with a three-lettered word beginning with the
    letter &lt;code&gt;f&lt;/code&gt;.  The cursor does not move to the first
    match automatically.  To make the cursor move to the first match,
    type &lt;code&gt;C-s&lt;/code&gt;.  This is also explained in the next point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-s&lt;/code&gt;: When a search has been initiated, jump to the
    next match for the last search that was initiated.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u C-s ^b..\&amp;gt; RET&lt;/code&gt;: Initiate a new search.  This
    is useful when a search was already initiated and we want to
    abandon that search and start another new search.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-r&lt;/code&gt;: Similar to &lt;code&gt;C-s&lt;/code&gt; but works in reverse
    direction.  All three commands mentioned above work
    with &lt;code&gt;C-r&lt;/code&gt; too.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-t&lt;/code&gt;: Show tooltip for the current location.
    Normally, this shows a tooltip like &quot;Page 100 of 314&quot; to describe
    the current page.  When a search is in progress, the tooltip
    includes all the matches from the current page too.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-t&lt;/code&gt;: Show the current document&apos;s content as text.
    Then type the key sequence &lt;code&gt;C-c C-c&lt;/code&gt; to switch to
    editing the document and &lt;code&gt;C-c C-c&lt;/code&gt; again to switch to
    viewing the document.  The key sequence &lt;code&gt;C-c C-c&lt;/code&gt; is
    elaborated a little more in the next point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-c&lt;/code&gt;: Toggle between editing or viewing the
    document.  In case of PDF, switching to editing the document may
    not be very helpful because the binary code of the document is
    opened for editing in this mode which is quite non-trivial to edit
    directly.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;docview-resolution&quot;&gt;DocView Resolution&lt;/h3&gt;
&lt;p&gt;
  If the text in the document looks pixelated in Emacs, set
  the &lt;code&gt;doc-view-resolution&lt;/code&gt; variable to 300 as follows:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq doc-view-resolution 300)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  This sets the dots per inch resolution used to render the documents
  to 300.  This offers a good trade-off between high quality rendering
  and fast rendering.  After setting this variable, type the following
  key sequences:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x doc-view-clear-cache RET&lt;/code&gt; to delete the cache
    directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x k&lt;/code&gt; to kill the existing DocView buffer (if any).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f document.pdf RET&lt;/code&gt; to open the document
    (say &lt;code&gt;document.pdf&lt;/code&gt;) again!
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Clearing the cache directory and reopening the document in this
  manner regenerates the images from the documents with the updated
  resolution.
&lt;/p&gt;
&lt;h2 id=&quot;tramp&quot;&gt;TRAMP&lt;/h2&gt;
&lt;p&gt;
  TRAMP stands for Transparent Remote Access, Multiple Protocol.  The
  general syntax of paths supported by TRAMP is:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/method:[user@][hostname[#port]]:[path]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Here
  are some complete key sequences that demonstrate various ways to
  open a remote file using TRAMP:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box:~/foo.txt RET&lt;/code&gt;: Edit file in a
    remote host via SSH.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:susam@box#22:~/foo.txt RET&lt;/code&gt;: Same as
    above.  However the port is explicitly specified this time.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /scp:alice@box:~/foo.txt RET&lt;/code&gt;: Edit file in a
    remote host via SCP.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:box:~/foo.txt RET&lt;/code&gt;: Edit file in a
    remote host via SSH after logging into it with the username of the
    current user in the current shell.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@:~/foo.txt RET&lt;/code&gt;: Edit file in
    localhost via SSH after logging into it as a specific user.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh::~/foo.txt RET&lt;/code&gt;: Edit file in localhost
    via SSH after logging into it with the username of the current
    user in current shell.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /sudo::/etc/hosts&lt;/code&gt;: Edit file as superuser.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x c-f /sudo:alice@:~/foo.txt RET&lt;/code&gt;: Edit file as
    a specific user.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /sudoedit::/etc/hosts&lt;/code&gt;: Edit file as superuser
    but do not keep an open session running in the background for
    security reasons.  This method has worse performance than
    the &lt;code&gt;sudo&lt;/code&gt; method.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /su::/etc/hosts&lt;/code&gt;: Edit file as
    the &lt;code&gt;root&lt;/code&gt; user.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;/su:alice@:~/foo.txt&lt;/code&gt;: Edit file as a specific user.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;/su:alice@localhost:~/foo.txt&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /sudo:: RET&lt;/code&gt;: Browse the &lt;code&gt;root&lt;/code&gt;
    user&apos;s home directory as superuser.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /su:: RET&lt;/code&gt;: Browse the &lt;code&gt;root&lt;/code&gt;
    user&apos;s home directory with Dired.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /-:: RET&lt;/code&gt;:
    Use &lt;code&gt;tramp-default-method&lt;/code&gt; (&lt;code&gt;scp&lt;/code&gt; by
    default) to connect to &lt;code&gt;tramp-default-host&lt;/code&gt;
    (current &lt;code&gt;hostname&lt;/code&gt; by default).  With the default
    values of these variables, this leads to connecting to the local
    system as the current user via SCP and browsing the current user&apos;s
    home directory in Dired.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  This chapter recommends looking up the info manual
  page &lt;code&gt;(tramp) Internal methods&lt;/code&gt; but this is very likely
  an error.  For example, evaluating &lt;code&gt;(info &quot;(tramp)Internal
  methods&quot;)&lt;/code&gt; leads to the following error:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user-error: No such node or anchor: Internal methods&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Instead evaluate &lt;code&gt;(info &quot;(tramp)Inline methods&quot;)&lt;/code&gt; to
  reach the correct node that describes the various connection
  methods.
&lt;/p&gt;
&lt;h3 id=&quot;default-directory&quot;&gt;Default Directory&lt;/h3&gt;
&lt;p&gt;
  The variable &lt;code&gt;default-directory&lt;/code&gt; is buffer local.
  Typically, this is automatically set to the directory where Emacs
  was launched or to the directory of the currently visited file.
  Commands like &lt;code&gt;C-x C-f&lt;/code&gt; defaults to looking up files in
  this directory.
&lt;/p&gt;
&lt;p&gt;
  While editing a remote file via TRAMP, the value for this variable
  may look something like &lt;code&gt;/ssh:alice@box:/home/alice/&lt;/code&gt;.
  The &lt;code&gt;@&lt;/code&gt; character is displayed in the mode line while
  editng a remote file.
&lt;/p&gt;
&lt;p&gt;
  The chapter presents the following examples of commands that work
  seamlessly on a remote machine:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x d&lt;/code&gt;: Manage remote files and directories.  We can
    even copy files (using the key sequence &lt;code&gt;C&lt;/code&gt;) between
    remote and local dired sessions.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x compile RET RET&lt;/code&gt;: Run &lt;code&gt;make -k&lt;/code&gt; (the
    default) or an arbitrary command remotely.  The result is shown in
    the &lt;code&gt;*compilation*&lt;/code&gt; buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x rgrep RET f.. RET *.txt RET RET&lt;/code&gt;:
    Use &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt; together to search for
    the pattern &lt;code&gt;f..&lt;/code&gt; in files matching the
    pattern &lt;code&gt;*.txt&lt;/code&gt; in the current remote directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x shell RET&lt;/code&gt;: Open shell on the remote system in the
    current remote directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eshell RET&lt;/code&gt;: Open Eshell on the remote system in
    the current remote directory.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  With Eshell we can go directly into remote directories seamlessly.
  The following Eshell session illustrates this:
&lt;/p&gt;
&lt;pre&gt;&lt;samp&gt;Welcome to the Emacs shell

~ $ &lt;kbd&gt;uname&lt;/kbd&gt;
Darwin
~ $ &lt;kbd&gt;cd /ssh:alice@box:~/foo/&lt;/kbd&gt;
/ssh:alice@box:/home/alice/foo $ &lt;kbd&gt;hostname&lt;/kbd&gt;
debian
/ssh:alice@box:/home/alice/foo $&lt;/samp&gt;&lt;/pre&gt;
&lt;h3 id=&quot;multi-hops&quot;&gt;Multi-Hops&lt;/h3&gt;
&lt;p&gt;
  Here are some commands that illustrate how multi-hops work:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|ssh:bob@localhost:~/foo.txt
    RET&lt;/code&gt;: First log in as &lt;code&gt;alice&lt;/code&gt;
    into &lt;code&gt;box&lt;/code&gt; and then from there log in
    as &lt;code&gt;bob&lt;/code&gt; into the same system.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|sudo:box:/etc/hosts RET&lt;/code&gt;: First
    log in as &lt;code&gt;alice&lt;/code&gt; into &lt;code&gt;box&lt;/code&gt; and then edit
    file as superuser.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|sudo::/etc/hosts RET&lt;/code&gt;: Same as
    above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|sudo:bob@box:~/bar.txt RET&lt;/code&gt;:
    First log in as &lt;code&gt;alice&lt;/code&gt; into &lt;code&gt;box&lt;/code&gt; and then
    use &lt;code&gt;sudo&lt;/code&gt; to edit file as &lt;code&gt;bob&lt;/code&gt; in the
    latter user&apos;s home directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|su::/etc/hosts RET&lt;/code&gt;: First log
    in as &lt;code&gt;alice&lt;/code&gt; into &lt;code&gt;box&lt;/code&gt; and then edit file
    as &lt;code&gt;root&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|su:bob@:~/bar.txt RET&lt;/code&gt;: First log
    in as &lt;code&gt;alice&lt;/code&gt; into &lt;code&gt;box&lt;/code&gt; and then edit file
    as &lt;code&gt;bob&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box|su:bob@box:~/bar.txt RET&lt;/code&gt;: Same
    as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f /ssh:alice@box1|ssh:bob@box2|ssh:carol@box3:~/foo.txt&lt;/code&gt;:
    An example of two hops.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Bookmarks with key sequences like &lt;code&gt;C-x r m&lt;/code&gt;
  (&lt;code&gt;bookmark-set&lt;/code&gt;), &lt;code&gt;C-x r l&lt;/code&gt;
  (&lt;code&gt;bookmark-bmenu-list&lt;/code&gt;) and &lt;code&gt;C-x r b&lt;/code&gt;
  (&lt;code&gt;bookmark-jump&lt;/code&gt;) work seamlessly for remote files
  (including multi-hops).
&lt;/p&gt;
&lt;p&gt;
  Eshell works seamlessy too across multi-hops.  Here is an Eshell
  session that illustrates it:
&lt;/p&gt;
&lt;pre&gt;&lt;samp&gt;~ $ &lt;kbd&gt;uname&lt;/kbd&gt;
Darwin
~ $ &lt;kbd&gt;cd &apos;/ssh:alice@box1|ssh:bob@box2|ssh:carol@box3:/home/carol/foo/bar/&apos;&lt;/kbd&gt;
/ssh:alice@box1|ssh:bob@box2|ssh:carol@box3:/home/carol/foo/bar $ &lt;kbd&gt;uname&lt;/kbd&gt;
Linux
/ssh:alice@box1|ssh:bob@box2|ssh:carol@box3:/home/carol/foo/bar $&lt;/samp&gt;&lt;/pre&gt;
&lt;h2 id=&quot;eww&quot;&gt;EWW: Emacs Web Wowser&lt;/h2&gt;
&lt;p&gt;
  The following commands are useful to get started with EWW.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eww RET hello RET&lt;/code&gt;: Search for the word &quot;hello&quot;
    with DuckDuckGo.  If the buffer &lt;code&gt;*eww*&lt;/code&gt; already exists,
    then reuse that buffer, otherwise create such a buffer.  The
    search engine can be customised by setting the
    variable &lt;code&gt;eww-search-prefix&lt;/code&gt; (it
    is &lt;code&gt;&quot;https://duckduckgo.com/html/?q=&quot;&lt;/code&gt; by default).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-x eww RET hello RET&lt;/code&gt;: Like previous command
    except that it creates a new EWW buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eww RET example.net RET&lt;/code&gt;: Visit the
    URL &lt;a href=&quot;http://example.net/&quot;&gt;http://example.net&lt;/a&gt;.  Reuses
    the &lt;code&gt;*eww*&lt;/code&gt; buffer if it exists.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eww RET http://example.net/ RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-x eww RET example.net RET&lt;/code&gt;: Like before but
    creates a new EWW buffer.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  In the EWW buffer, the following navigation keys work:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;TAB&lt;/code&gt;: Skip to the next link.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;S-TAB&lt;/code&gt; or &lt;code&gt;C-M-i&lt;/code&gt;: Skip to the previous link.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;RET&lt;/code&gt;: Browse the URL under point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u RET&lt;/code&gt;: Browse the URL under point using an external
    browser.  This is especially useful when we know that the URL we
    want to open does not render well in EWW.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;amp;&lt;/code&gt;: Open the current page in an external browser.
    Note that unlike the previous command, this command opens
    the &lt;em&gt;current&lt;/em&gt; page.  The previous command opens the URL
    under point instead.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;q&lt;/code&gt;: Quit EWW.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;l&lt;/code&gt;: Go to the previously displayed page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;r&lt;/code&gt;: Go to the next displayed page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;b&lt;/code&gt;: Bookmark the current page.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;B&lt;/code&gt;: Show bookmarks.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;H&lt;/code&gt;: Show history of the current EWW buffer.  The most
    recently visited URLs are displayed on top and the oldest ones are
    shown at the bottom.  The current URL is not displayed in the
    history.  Only the older URLs are shown in the history.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;R&lt;/code&gt;: View the main &quot;readable&quot; parts of the current
    page.  This command uses heuristics to find the parts of the web
    page that contains the main content and omits the non-content part
    like navigation menus etc.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-s M-w&lt;/code&gt;: Search the web for the text in the region.
    If there is no region, then prompt for a search string.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-RET&lt;/code&gt;: Open link in a new EWW buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;s&lt;/code&gt;: Prompt for an EWW buffer to display and switch to
    the selected buffer.  This is similar to changing to tabs in a
    desktop web browser.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;w&lt;/code&gt;: If the point is on a URL or just after a URL, then
    copy that URL to the kill ring.  If the point is at any other
    place, copy the URL of the current page.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Further, EWW supports a few semantic browsing methods.  The
  pertaining commands are presented below.  However note that whether
  these commands would work on a page or not depends on whether the
  page provides the relevant navigation aids required by these
  commands.  Here are the key sequences for such commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;p&lt;/code&gt;: Go to the page marked &lt;em&gt;previous&lt;/em&gt;.  A page
    is marked &lt;em&gt;previous&lt;/em&gt; if there is
    a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag or an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag
    for it with the attribute &lt;code&gt;rel=&quot;prev&quot;&lt;/code&gt; (a standard
    value for the attribute) or &lt;code&gt;rel=&quot;previous&quot;&lt;/code&gt;
    (non-standard value supported by EWW).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;n&lt;/code&gt;: Go to the page marked &lt;em&gt;next&lt;/em&gt;.  A page is
    marked &lt;em&gt;next&lt;/em&gt; if there is a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag
    or an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag for it with the
    attribute &lt;code&gt;rel=&quot;next&quot;&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;u&lt;/code&gt;: Go to the page marked &lt;em&gt;up&lt;/em&gt;.  A page is
    marked &lt;em&gt;up&lt;/em&gt; if there is a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt;
    or an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag for it with the
    attribute &lt;code&gt;rel=&quot;up&quot;&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;t&lt;/code&gt;: Go to the page marked &lt;em&gt;top&lt;/em&gt;.  A page is
    marked &lt;em&gt;top&lt;/em&gt; if there is a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tag or
    an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag for it with the
    attribute &lt;code&gt;rel=&quot;start&quot;&lt;/code&gt; or &lt;code&gt;rel=&quot;home&quot;&lt;/code&gt;
    or &lt;code&gt;rel=&quot;contents&quot;&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;invoking-external-browser&quot;&gt;Invoking External Browser&lt;/h2&gt;
&lt;p&gt;
  If we would rather open a URL using our desktop web browser, then we
  can use the &lt;code&gt;browse-url&lt;/code&gt; command like this: &lt;code&gt;M-x
  browse-url RET http://example.net/ RET&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  This command very conveniently picks up the word or domain name at
  the point or just before the point and uses that as the default
  value for the URL input.  Therefore if the cursor is already on a
  URL, then we can simply type &lt;code&gt;M-x browse-url RET RET&lt;/code&gt; to
  visit it.
&lt;/p&gt;
&lt;h2 id=&quot;dired&quot;&gt;Dired&lt;/h2&gt;
&lt;h3 id=&quot;dired-getting-started&quot;&gt;Dired: Getting Started&lt;/h3&gt;
&lt;p&gt;
  There are several ways to start Dired.  Some examples are presented
  below:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f ~/foo/bar/ C-d&lt;/code&gt;: If IDO or FIDO mode is
    enabled, then this key sequence automatically opens Dired in the
    given directory path.  Essentially, while using &lt;code&gt;C-x
    C-f&lt;/code&gt; with IDO/FIDO mode, we can type &lt;code&gt;C-d&lt;/code&gt;
    anytime and Dired is opened in the path entered so far.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dired RET ~/foo/bar/ RET&lt;/code&gt;: Opens Dired in the
    given directory path.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dired RET RET&lt;/code&gt;: In the previous command, the
    default input is the path of the current directory
    (&lt;code&gt;default-directory&lt;/code&gt;), so this key sequence
    conveniently opens Dired in the current directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x d&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x 4 d&lt;/code&gt;: Like before but open Dired in another
    window.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;dired-navigation&quot;&gt;Dired: Navigation&lt;/h3&gt;
&lt;p&gt;
  The following keys work in a Dired buffer:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;RET&lt;/code&gt;: Visit the file or directory on the current line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;^&lt;/code&gt;: Go up by one directory.  If the parent directory
    is found in an existing buffer, then switch to that buffer.
    Otherwise create a new buffer to show the parent directory in
    Dired.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;q&lt;/code&gt;: Quit Dired window.  The buffer remains intact,
    i.e. the buffer is only buried, not killed.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u q&lt;/code&gt;: Quit Dired window and kill the buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;p&lt;/code&gt; or &lt;code&gt;C-p&lt;/code&gt;: Move to the previous line and
    position the point on the filename.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;n&lt;/code&gt; or &lt;code&gt;C-n&lt;/code&gt;: Move to the next line and
    position the point on the filename.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that when we go from one Dired buffer to another (say, by
  typing &lt;code&gt;RET&lt;/code&gt; to enter a subdirectory from a parent
  directory), then typing &lt;code&gt;q&lt;/code&gt; or &lt;code&gt;C-u q&lt;/code&gt; buries
  or kills (respectively) the current buffer and takes us back to the
  last Dired buffer.
&lt;/p&gt;
&lt;h3 id=&quot;dired-marking-and-unmarking&quot;&gt;Dired: Marking and Unmarking&lt;/h3&gt;
&lt;p&gt;
  The following list describes marking and unmarking commands of
  Dired:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;m&lt;/code&gt;: Mark the file or directory at point.  If the
    region is active, mark all files or directories in the region.
    Note that at least one character of the filename or directory name
    must lie within the region for a file to be marked.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;u&lt;/code&gt;: Unmark the file or directory at point.  If the
    region is active, unmark all files or directories in the region.
    Note that this also removes the flag for deletion (introduced
    later in this list).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;U&lt;/code&gt;: Unmark everything.  Note that this also removes
    flags for deletion.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;d&lt;/code&gt;: Flag the file or directory for deletion.  If the
    region is active, flag all files or directories in the region for
    deletion.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The following key sequences describe the effects of prefix arguments
  with marking, unmarking and flagging commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-5 m&lt;/code&gt;: Mark 5 files from the current line to 4 more
    lines below.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-5 u&lt;/code&gt;: Unmark 5 files from the current line for
    deletion..
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-5 d&lt;/code&gt;: Flag 5 files from the current line for deletion.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-1 m&lt;/code&gt;: Mark the file on the previous line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-1 u&lt;/code&gt;: Unmark the file on the previous line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-1 d&lt;/code&gt;: Flag the file on the previous line for deletion.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-5 m&lt;/code&gt;: Mark files in the 5 previous lines.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-5 u&lt;/code&gt;: Unmark files in the 5 previous lines.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-- C-5 d&lt;/code&gt;: Flag files in the 5 previous lines for
    deletion.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Additionally, the chapter mentions the following commands in a
  separate table but on Emacs 28.2, they seem to have the same effect
  as one of the commands discussed earlier:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;* m&lt;/code&gt;: Behaves the same as &lt;code&gt;m&lt;/code&gt; and marks
    files.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;* u&lt;/code&gt;: Behaves the same as &lt;code&gt;u&lt;/code&gt; and unmarks
    files.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  However the following commands (also introduced briefly in the same
  table but illustrated with complete key sequences below) provide
  additional marking and unmarking facilities:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;* % f.. RET&lt;/code&gt;: Mark files with names that match the
    regular expression &lt;code&gt;f..&lt;/code&gt;.  If the region is active,
    then only the files in the region that match the pattern are
    marked.  The directories &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt; are
    never marked.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;% m f.. RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u * % f.. RET&lt;/code&gt;: Unmark files with names that match
    the regular expression &lt;code&gt;f..&lt;/code&gt;.  If the region is active,
    then only the files in the region that match the pattern are
    unmarked.  The directories &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt; are
    never unmarked.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u % m f.. RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;t&lt;/code&gt; or &lt;code&gt;* t&lt;/code&gt;: Toggle marks.  The marked
    files become unmarked and vice versa.  If the region is active,
    toggle the marks of only the files in the region.  The
    directories &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;..&lt;/code&gt; are never toggled.
    Flagged files are not toggled.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;* c * D&lt;/code&gt;: Change all files marked with &lt;code&gt;*&lt;/code&gt;
    to be now marked with &lt;code&gt;D&lt;/code&gt; (i.e. flagged for deletion).
    Note that unlike the other commands, this command ignores the
    active region.  It performs the change in the whole buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;* c D SPC&lt;/code&gt;: Change all files marked
    with &lt;code&gt;D&lt;/code&gt; to be now unmarked.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The chapter also mentions a key sequence &lt;code&gt;* .&lt;/code&gt; to mark
  files by extension but this requires &lt;code&gt;dired-x&lt;/code&gt;, so this
  is discussed in a later section of this page.
&lt;/p&gt;
&lt;h3 id=&quot;dired-operations&quot;&gt;Dired: Operations&lt;/h3&gt;
&lt;p&gt;
  This section explains some operations we can perform in Dired.  If
  there are one or more items marked in the Dired buffer, then the
  operations work on the marked items.  Otherwise, the operations work
  on the item under the cursor.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C&lt;/code&gt;: Copy marked files or copy the current file.  If
    one file is being copied, this command prompts for the target file
    path.  If multiple files are being copied, this command prompts
    for the target directory path.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;R&lt;/code&gt;: Rename marked files or the current file.  If one
    file is being renamed, this command prompts for the target file
    path.  If multiple file are being renamed, this command prompts
    for the target directory path.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;O&lt;/code&gt;: Change owner of the marked files or the current
    file.  A complete key sequence may look like &lt;code&gt;O root
    RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;G&lt;/code&gt;: Change group of the marked files or the current
    file.  A complete sequence may look like &lt;code&gt;G wheel RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M&lt;/code&gt;: Change the mode of the marked files or the current
    file.  A complete key sequence may look like &lt;code&gt;M u+x
    RET&lt;/code&gt; or &lt;code&gt;M 600 RET&lt;/code&gt;.  Both symbolic modes
    like &lt;code&gt;u+x&lt;/code&gt; and numeric modes like &lt;code&gt;600&lt;/code&gt; are
    supported.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;D&lt;/code&gt;: Delete marked files, i.e. the files that are
    marked with &lt;code&gt;*&lt;/code&gt; on the leftmost column of the Dired
    buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;x&lt;/code&gt;: Delete the files flagged for deletion, i.e. the
    files that are marked with &lt;code&gt;D&lt;/code&gt; on the leftmost column
    of the Dired buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;c&lt;/code&gt;: Compress marked files or current file into an
    archive.  The archive file name is prompted.  The format of the
    archive is automatically deduced from the extension of the file
    name entered at the prompt.  A complete key sequence may look
    like &lt;code&gt;c foo.tar.gz RET&lt;/code&gt; or &lt;code&gt;c foo.zip RET&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note the difference between &lt;code&gt;D&lt;/code&gt; and &lt;code&gt;x&lt;/code&gt;.  The
  key &lt;code&gt;D&lt;/code&gt; deletes marked files but the key &lt;code&gt;x&lt;/code&gt;
  deletes flagged files.  Therefore there are two ways of deleting
  files:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    Mark files with &lt;code&gt;m&lt;/code&gt; and delete them with &lt;code&gt;D&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Flag files with &lt;code&gt;d&lt;/code&gt; and delete them with &lt;code&gt;x&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  I normally prefer the second way of deleting files.  Since deleting
  file is a destructive operation which is possibly risky, I like to
  flag them first with &lt;code&gt;d&lt;/code&gt; before deleting them
  with &lt;code&gt;x&lt;/code&gt;.  In other words, I flag files for deletions and
  mark files for everything else.  Since I do not use
  the &lt;code&gt;D&lt;/code&gt; key, I can be confident that my marked files are
  always safe and there is no risk of inadvertently deleting them.
&lt;/p&gt;
&lt;h3 id=&quot;dired-copying-or-renaming-between-buffers&quot;&gt;Dired: Copying or Renaming Between Buffers&lt;/h3&gt;
&lt;p&gt;
  The following steps explain how we can copy or move files from one
  Dired buffer to another.  First we will see the default behaviour
  and then we will customise Dired to copy or move files to a
  particular Dired directory.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x d /usr/ RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x 2&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x d /tmp/ RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x 2&lt;/code&gt; agian.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x d /etc/ RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Move the cursor on some file in &lt;code&gt;/etc/&lt;/code&gt; and then
    type &lt;code&gt;C&lt;/code&gt; or &lt;code&gt;R&lt;/code&gt; and we will see that the
    default directory to copy/move the file to is &lt;code&gt;/etc/&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Now type &lt;code&gt;(setq dired-dwim-target t)&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Now type &lt;code&gt;C&lt;/code&gt; or &lt;code&gt;R&lt;/code&gt; again while the cursor
    is on some file in &lt;code&gt;/etc/&lt;/code&gt;.  We will see that the
    default directory to copy/move the file to is &lt;code&gt;/tmp/&lt;/code&gt;
    now.  Since &lt;code&gt;dired-dwim-target&lt;/code&gt; is set to non-nil,
    Dired picks the directory from the next window with a Dired buffer
    and uses that as the target buffer.
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;dired-more-keys&quot;&gt;Dired: More Keys&lt;/h3&gt;
&lt;p&gt;
  Here are some examples of Dired keys that do not act on marked files
  but does other interesting work:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;g&lt;/code&gt;: Refresh the Dired buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;+&lt;/code&gt;: Create directory.  A complete key sequence may
    look like &lt;code&gt;+ bar RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;s&lt;/code&gt;: Toggle sorting by date.  By default, the items in
    the Dired buffer are sorted by file/directory names.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;lt;&lt;/code&gt;: Jump to the next directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;gt;&lt;/code&gt;: Jump to the previous directory.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;j&lt;/code&gt;: Jump to a file by name.  A complete sequence may
    look like &lt;code&gt;j hosts RET&lt;/code&gt;.  Note that this only moves the
    cursor to the line in Dired buffer with the provided filename.  It
    does not visit the file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-s a C-s&lt;/code&gt;: Perform multi-file incremental search
    through all marked files or the current file.  Marked directories
    are ignored.  Action region is also ignored.  It performs the
    search across all marked files.  A complete key sequence may look
    like &lt;code&gt;M-s a C-s foo&lt;/code&gt; and then repeat &lt;code&gt;C-s&lt;/code&gt;
    over and over again to jump through all the matches.  When the
    search reaches the end of one file, the next &lt;code&gt;C-s&lt;/code&gt;
    automatically jumps to the match in the next file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;Q&lt;/code&gt;: Perform multi-file regex-based search-and-replace
    operation through all marked files or the current file.  For any
    marked directories, the search-and-replace operation is performed
    in all its files recursively.  The active region is ignored.  A
    complete key sequence may look like &lt;code&gt;Q f.. RET \&amp;amp;\&amp;amp;
    RET&lt;/code&gt; which searches for strings matching the
    pattern &lt;code&gt;f..&lt;/code&gt;  and duplicates that string.  The key
    sequences supported by &lt;code&gt;C-M-%&lt;/code&gt;
    (&lt;code&gt;query-replace-regexp&lt;/code&gt;)
    like &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt;, etc. work here.  See
    section &lt;a href=&quot;ch05.html#search-and-replace&quot;&gt;Search and
    Replace&lt;/a&gt; for an account of the supported key sequences.  The
    search results are also displayed in a
    separate &lt;code&gt;*xref*&lt;/code&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;A&lt;/code&gt;: Find matches for a regular expression pattern in
    all marked files or the current file.  For any marked directories,
    all its files are searched recursively.  The active region is
    ignored.  A complete key sequence may look like &lt;code&gt;A
    f.. RET&lt;/code&gt;.  Note that this does not perform incremental
    search.  Instead the search results are displayed in
    &lt;code&gt;*xref*&lt;/code&gt; buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;!&lt;/code&gt;: Run a shell command on each marked file or
    directory (or the current file or directory if nothing is marked).
    The command is executed synchronously.  The active region is
    ignored or the current file or directory.  The command works on
    all marked files and directories.  The output is displayed in a
    separate buffer.  If &lt;code&gt;*&lt;/code&gt; is present in the command,
    then each &lt;code&gt;*&lt;/code&gt; is replaced with the entire file list and
    the command runs only once (not multiple times, once for each
    file).  If &lt;code&gt;?&lt;/code&gt; is present in the command, then the
    command runs multiple times, once for each marked file, with
    each &lt;code&gt;?&lt;/code&gt; replaced with the name of the file being
    operated on.  It is an error to specify both &lt;code&gt;*&lt;/code&gt;
    and &lt;code&gt;?&lt;/code&gt;.  If neither is present, then the command runs
    multiple times, once for each marked file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;amp;&lt;/code&gt;: Like the previous command but runs the command
    asynchronously.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  To understand the usefulness of &lt;code&gt;g&lt;/code&gt;, while Dired is open
  create a new file in the current directory with, say, &lt;code&gt;C-x C-f
  foo.txt RET&lt;/code&gt; and save it with &lt;code&gt;C-x s&lt;/code&gt;.  Then kill
  the buffer for the file with &lt;code&gt;C-x k&lt;/code&gt; and return to the
  Dired buffer.  The Dired buffer does not show the new
  file &lt;code&gt;foo.txt&lt;/code&gt;.  Now type &lt;code&gt;g&lt;/code&gt; to refresh the
  Dired buffer.  As soon as &lt;code&gt;g&lt;/code&gt; is typed, the buffer gets
  updated to display the new file.
&lt;/p&gt;
&lt;p&gt;
  To understand the difference between &lt;code&gt;!&lt;/code&gt; and
  &lt;code&gt;&amp;amp;&lt;/code&gt; mark five files and then type the key
  sequence &lt;code&gt;! sleep 1; echo&lt;/code&gt;.  Emacs blocks (i.e. does not
  react to our keystrokes) for 5 seconds while it runs the given
  command for each file.  When the &lt;code&gt;echo&lt;/code&gt; output for all
  files is obtained after 5 seconds, the output appears and Emacs
  unblocks again.  Now type &lt;code&gt;&amp;amp; sleep 1; echo&lt;/code&gt;.  Now
  Emacs remains unblocked while the output of each &lt;code&gt;echo&lt;/code&gt;
  command appears at one second intervals in the output buffer.
&lt;/p&gt;
&lt;h3 id=&quot;dired-x&quot;&gt;Dired-X&lt;/h3&gt;
&lt;p&gt;
  Dired-X provides extra Dired functionality.  It is not enabled by
  default.  To enable it, add the following line to the Emacs
  initialisation file:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(require &apos;dired-x)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The following key sequences are supported by Dired-X:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;F&lt;/code&gt;: Visit the marked files or the current file.  When
    multiple files are visited, they are opened in split windows
    distributed as evenly as possible.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u F&lt;/code&gt;: Visit the marked files or the current file but
    open them in background, i.e. do not show them on any window.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;* .&lt;/code&gt;: Mark files with a certain extension.  If the
    region is active, then mark only the files in the region that have
    the given extension.  A complete key sequence may look
    like &lt;code&gt;* . txt&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;!&lt;/code&gt; and &lt;code&gt;&amp;amp;&lt;/code&gt;: These commands still work
    the way they were described in the previous section.  However with
    Dired-X enabled, when &lt;code&gt;!&lt;/code&gt; or &lt;code&gt;&amp;amp;&lt;/code&gt; is
    invoked on a single file (either a single marked file or no marked
    file in which case it operates on the current file), it
    automatically determines the command to execute for the current
    file type and offers that as the default input.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;dired-working-across-directories&quot;&gt;Dired: Working Across Directories&lt;/h3&gt;
&lt;p&gt;
  The following key sequences offer some support for working across
  multiple directories in the same Dired buffer:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;i&lt;/code&gt;: While the cursor is on a line for a directory, it
    expands the directory listing for that directory in the same Dired
    buffer.  Now we could use the mark, unmark, etc. commands to
    select files that belong to multiple directories and operate on
    them from the same Dired buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;$&lt;/code&gt;: Collapse or expand the current directory listing.
    If there are multiple directory listings (such as the ones created
    with &lt;code&gt;i&lt;/code&gt;), then move to the next directory listing
    after collapsing or expanding the current one.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Using &lt;code&gt;i&lt;/code&gt; to insert the directory listing of a
  subdirectory into the current Dired buffer could feel tedious if we
  want to recursively work on multiple directories.  The commands
  (illustrated with complete key sequences below) may be more suitable
  for such operations:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-x find-dired RET RET -name SPC &quot;f*.txt&quot; RET&lt;/code&gt;: Find
      all files and directories in the current directory and its
      subdirectories recursively with name matching the
      pattern &lt;code&gt;f*.txt&lt;/code&gt; and show the results in the buffer
      named &lt;code&gt;*Find*&lt;/code&gt; with Dired mode enabled in it.  Emacs
      runs the following command to get the results:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;find . \( -name &quot;f*.txt&quot; \) -ls&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-x find-name-dired RET RET f*.txt RET&lt;/code&gt;: Same as
      above.  Emacs runs the following command to get the results:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;find . \( -name f\*.txt \) -l&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Further on a system with case-insensitive filenames, Emacs is
      clever enough to use the &lt;code&gt;-iname&lt;/code&gt; argument instead
      of &lt;code&gt;-name&lt;/code&gt; so that case-insensitive search is
      performed.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-x find-grep-dired RET RET f.. RET&lt;/code&gt;: Find all files
      in the current directory and its subdirectories recursively and
      list the files where lines matching the regular
      expression &lt;code&gt;..&lt;/code&gt; is found.  The result is shown in a
      the buffer named &lt;code&gt;*Find&lt;/code&gt; with Dired mode enabled in
      it.  Emacs runs the following command to get the results:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;find . \( -type f -exec grep -q -e f.. \{\} \; \) -ls&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      &lt;code&gt;M-x find-lisp-find-dired RET RET f.. RET&lt;/code&gt;: Find all
      files in the current directory and subdirectories recursively
      and list the files with names that match the regular expression
      pattern &lt;code&gt;..&lt;/code&gt;.  Note that this is different from
      both &lt;code&gt;find-name-dired&lt;/code&gt;
      and &lt;code&gt;find-grep-dired&lt;/code&gt;.  The former relies on the
      Unix &lt;code&gt;find&lt;/code&gt; command to match filenames using glob
      patterns.  The latter uses both &lt;code&gt;find&lt;/code&gt;
      and &lt;code&gt;grep&lt;/code&gt; to list files that contain a line with a
      matching regular expression pattern.  However this command lists
      files with names that match a regular expression pattern (not
      glob pattern).  Further this command is implemented purely in
      Elisp and does not have any external dependencies on tools
      like &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;shell-commands&quot;&gt;Shell Commands&lt;/h2&gt;
&lt;p&gt;
  The following complete key sequences demonstrate how we can invoke
  shell commands from Emacs.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-! uname RET&lt;/code&gt;: Execute shell command and show output.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-! uname RET&lt;/code&gt;: Like above but insert the output
    into the buffer wherever the cursor is.  The cursor remains at the
    same place.  The mark is set to the character just after the last
    character of the output.  Therefore, typing &lt;code&gt;C-x C-x&lt;/code&gt;
    (&lt;code&gt;exchange-point-and-mark&lt;/code&gt;) is a quick way to highlight
    the output just inserted as an active region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-! ping SPC -c SPC 4 SPC localhost RET&lt;/code&gt;: Execute a
    slightly long running shell command that takes about 4 seconds to
    complete.  Emacs blocks while the command is running because the
    command is executed synchronously.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-! ping SPC -c SPC 4 SPC localhost RET&lt;/code&gt;: Like
    before but the output is inserted into the buffer.  Again, Emacs
    blocks while the command is executed.  The output appears in the
    buffer only after the command completes execution.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-&amp;amp; ping SPC -c SPC 4 SPC localhost RET&lt;/code&gt;:
    Like &lt;code&gt;M-!&lt;/code&gt; but execute shell command asynchronously.
    Emacs remains unblocked and the output appears in the output
    buffer as soon as the output is printed by the command.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-| wc RET&lt;/code&gt;: Pipe region to shell command and show
    output.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-| wc RET&lt;/code&gt;: Pipe region to shell command and
    replace the region with the output.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The book also mentions that &lt;code&gt;C-u M-&amp;amp;&lt;/code&gt; is supposed to
  work like &lt;code&gt;C-u M-!&lt;/code&gt; but asynchronously but I did not find
  this to be true.  For example, &lt;code&gt;C-u M-&amp;amp; uname RET&lt;/code&gt;
  led to the following error &lt;code&gt;Wrong type argument: stringp,
  (4)&lt;/code&gt;.  This may be a bug in Emacs 28.2.
&lt;/p&gt;
&lt;h2 id=&quot;compiling-in-emacs&quot;&gt;Compiling in Emacs&lt;/h2&gt;
&lt;p&gt;
  The following complete key sequences demonstrate this feature:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x compile RET&lt;/code&gt;: Runs &lt;code&gt;make -f&lt;/code&gt; by
    default.  The default command is offered as a minibuffer input
    before we type &lt;code&gt;RET&lt;/code&gt;.  Therefore we can edit the
    command to any arbitrary command before typing &lt;code&gt;RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x recompile RET&lt;/code&gt;: Runs the last compile command
    again.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x p c&lt;/code&gt;: Compile in the current project.  See
    section &lt;a href=&quot;#project-management&quot;&gt;Project Management&lt;/a&gt; for
    more details.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The compile commands display the output in
  the &lt;code&gt;*compilation*&lt;/code&gt; buffer where the following key
  sequences work:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-g M-n&lt;/code&gt;: Jump to the next error.  The cursor jumps to
    the next error line in the &lt;code&gt;*compilation*&lt;/code&gt; and the
    source of the matching error line is opened in a separated window.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-g M-p&lt;/code&gt;: Jump to the previous error.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;g&lt;/code&gt;: Recompile, i.e. run the last compile command
    again.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;shells-in-emacs&quot;&gt;Shells in Emacs&lt;/h2&gt;
&lt;h3 id=&quot;m-x-shell&quot;&gt;M-x shell&lt;/h3&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x shell RET&lt;/code&gt; starts a shell with
  input/output done via a buffer.  Some important points to keep in
  mind while using this:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    The TAB-completion mechanism of the underlying shell (e.g. Bash,
    Zsh, etc.) does not work.  In fact, &lt;code&gt;TAB&lt;/code&gt; invokes
    Emacs&apos;s own completion mechanism.
  &lt;/li&gt;
  &lt;li&gt;
    Programs like &lt;code&gt;top&lt;/code&gt; and &lt;code&gt;man&lt;/code&gt; that need to
    control the terminal do not work.  Only programs that perform
    input/output via standard input, standard output and standard
    error, etc. work well.
  &lt;/li&gt;
  &lt;li&gt;
    Since the shell buffer is made completely of text, all text
    editing commands of Emacs work seamlessly on the buffer.
  &lt;/li&gt;
  &lt;li&gt;
    We can take the cursor to absolutely anywhere in the buffer and
    type &lt;code&gt;RET&lt;/code&gt; to execute whatever is on that line as a
    shell command.  Shell prompt on the line is automatically excluded
    from the command to be executed.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Here are some key bindings that work in the shell buffer:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-p&lt;/code&gt;: Cycle backwards through input history.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-n&lt;/code&gt;: Cycle forwards through input history.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-&amp;lt;up&amp;gt;&lt;/code&gt;: Same as &lt;code&gt;M-p&lt;/code&gt;.  May not work
    if the desktop environment gobbles up this keystroke.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-&amp;lt;down&amp;gt;&lt;/code&gt;: Same as &lt;code&gt;M-n&lt;/code&gt;.  May not
    work if the desktop environment gobbles up this keystroke.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-r f..&lt;/code&gt;: Search history backwards for all commands
    that match the pattern &lt;code&gt;f..&lt;/code&gt;.  Within the search, we
    can use incremental search key bindings
    like &lt;code&gt;C-r&lt;/code&gt;, &lt;code&gt;C-s&lt;/code&gt;, etc. to search backward,
    forward, etc. respectively.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-p&lt;/code&gt;: Move to the previous prompt.  The cursor
    moves to the place just after the prompt.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-n&lt;/code&gt;: Move to the next prompt.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-s out.txt RET&lt;/code&gt;: Write output since the last
    input to a file.  Any prompt at the end of the output is not
    written.  Note that by default the output on shell contains the
    input command as well.  The input command is echoed back, so our
    input command appears twice in the buffer: once where we typed it
    and once more echoed just before the beginning of the output.
    This echoed input command is also saved to the file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-o&lt;/code&gt;: Delete all output since the last input.  Any
    prompt is of course left intact.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u C-c C-o&lt;/code&gt;: Delete all output since the last input
    and save it to the kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-l&lt;/code&gt;: Show the list of recent inputs in
    the &lt;code&gt;*Input History*&lt;/code&gt; buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-d&lt;/code&gt;: If the cursor is at the end of the buffer and
    there is no input, send EOF.  Otherwise delete a character forward.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-z&lt;/code&gt;: Suspend the current job.  This performs the
    same function as &lt;code&gt;C-z&lt;/code&gt; in the underlying shell.  We can
    then use job control commands like &lt;code&gt;bg&lt;/code&gt;
    or &lt;code&gt;fg&lt;/code&gt; to resume the job as a background process or
    foreground process.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;TAB&lt;/code&gt;: Perform completion at point.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;m-x-ansi-term&quot;&gt;M-x ansi-term&lt;/h3&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x ansi-term RET RET&lt;/code&gt; launches an
  ANSI-capable terminal emulator.  It can run sophisticated programs
  like &lt;code&gt;top&lt;/code&gt;, &lt;code&gt;man&lt;/code&gt;, etc. that require terminal
  capabilities fine.  The following key sequences are useful in this
  terminal emulator:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-j&lt;/code&gt;: Switch to line (&quot;cooked&quot;) sub-mode.  Emacs
    editing key sequences work normally in this mode,
    except &lt;code&gt;RET&lt;/code&gt; which sends the current line as a command
    to the underlying shell.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-k&lt;/code&gt;: Switch to char (&quot;raw&quot;) sub-mode.  By
    default, the terminal starts in this mode.  Each character we type
    in this sub-mode is sent directly to the shell, except for the
    escape character &lt;code&gt;C-c&lt;/code&gt; which is used as the prefix keys
    for the key sequences described in this list.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-c C-c&lt;/code&gt;: Interrupt the current subjob.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;m-x-eshell&quot;&gt;M-x eshell&lt;/h3&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x eshell RET&lt;/code&gt; creates an interactive
  Eshell buffer if none exists or switches to an existing one.  Eshell
  is implemented in Elisp.  It provides Elisp implementation of Unix
  commands like &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, etc.
&lt;/p&gt;
&lt;p&gt;
  The list below provides examples of some commands we can enter
  directly into Eshell:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;which ls&lt;/code&gt;: The output should show that &lt;code&gt;ls&lt;/code&gt;
    is an Elisp function.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;which which&lt;/code&gt;: The output should show
    that &lt;code&gt;which&lt;/code&gt; itself is an Elisp function.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;which top&lt;/code&gt;: The output should show the file path of
    the external program &lt;code&gt;top&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;ls -l&lt;/code&gt;: Run Eshell&apos;s implementation of &lt;code&gt;ls&lt;/code&gt;
    written in Elisp.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;find-file /etc/hosts&lt;/code&gt;: Run the Elisp function
    named &lt;code&gt;find-file&lt;/code&gt; with the
    argument &lt;code&gt;/etc/hosts&lt;/code&gt; thus opening the file in a
    buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;/bin/ls -l&lt;/code&gt;: Run the external command &lt;code&gt;ls&lt;/code&gt;
    available provided by the operating system utilities.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;python3 --version&lt;/code&gt;: Run the external
    program &lt;code&gt;python3&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;top&lt;/code&gt;: Start the program &lt;code&gt;top&lt;/code&gt; in a separate
    buffer with &lt;code&gt;term-mode&lt;/code&gt; as the major mode.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  In the last point we see that for programs like &lt;code&gt;top&lt;/code&gt;
  which need terminal capabilities to show output in a visual fashion
  (as opposed to just printing output to standard output or standard
  error), Eshell automatically runs the program in
  a &lt;code&gt;term-mode&lt;/code&gt; buffer, so that the output of the visual
  program can be handled and displayed correctly.  Eshell looks at the
  list in the variable &lt;code&gt;eshell-visual-commands&lt;/code&gt; to
  determine if a command needs terminal support or not.  By default,
  commands like &lt;code&gt;vi&lt;/code&gt;, &lt;code&gt;screen&lt;/code&gt;,
  &lt;code&gt;tmux&lt;/code&gt;, &lt;code&gt;top&lt;/code&gt;, etc. belong to this list.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch06.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 5: The Theory of Editing</title>
    <link href="https://susam.net/cc/mastering-emacs/ch05.html"/>
    <id>urn:uuid:b4fb79b2-c506-45b0-a516-de50171d4b0c</id>
    <updated>2023-09-16T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 5 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#killing-text&quot;&gt;Killing Text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#append-kill&quot;&gt;Append Kill&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#digit-and-negative-arguments&quot;&gt;Digit and Negative Arguments&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yanking-text&quot;&gt;Yanking Text&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yank-pop&quot;&gt;Yank Pop&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#maximum-length-of-kill-ring&quot;&gt;Maximum Length of Kill Ring&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#killing-lines&quot;&gt;Killing Lines&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#transpose&quot;&gt;Transpose&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#filling&quot;&gt;Filling&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#commenting&quot;&gt;Commenting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#search-and-replace&quot;&gt;Search and Replace&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#regular-expressions&quot;&gt;Regular Expressions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#changing-case&quot;&gt;Changing Case&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#counting&quot;&gt;Counting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#deleting-and-keeping-lines&quot;&gt;Deleting and Keeping Lines&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#splitting-and-joining-lines&quot;&gt;Splitting and Joining Lines&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#examining-and-fixing-whitespace-issues&quot;&gt;Examining and Fixing Whitespace Issues&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#keyboard-macros&quot;&gt;Keyboard Macros&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#text-expansion&quot;&gt;Text Expansion&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#abbrev&quot;&gt;Abbrev&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#dabbrev&quot;&gt;DAbbrev&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#hippie-expand&quot;&gt;Hippie Expand&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#indenting&quot;&gt;Indenting&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#electric-indentation&quot;&gt;Electric Indentation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#indenting-current-line&quot;&gt;Indenting Current Line&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#use-only-spaces-for-indentation&quot;&gt;Use Only Spaces for Indentation&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#tab-width&quot;&gt;Tab Width&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#edit-tab-stops&quot;&gt;Edit Tab Stops&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#indent-regions&quot;&gt;Indent Region&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#indent-rigidly&quot;&gt;Indent Rigidly&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#sorting&quot;&gt;Sorting&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#aligning&quot;&gt;Aligning&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#zap-to-char&quot;&gt;Zap to Char&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#zap-up-to-char&quot;&gt;Zap up to Char&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#spell-check&quot;&gt;Spell Check&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#dictionary-lookup&quot;&gt;Dictionary Lookup&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#quoted-insert&quot;&gt;Quoted Insert&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#links&quot;&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;killing-text&quot;&gt;Killing Text&lt;/h2&gt;
&lt;p&gt;
  Killing text is equivalent to what we call as cutting text in other
  editors.  Killing some text removes the text from the buffer and
  adds it to the kill ring.  The kill ring is the clipboard of Emacs.
&lt;/p&gt;
&lt;p&gt;
  To discover kill commands using the apropos functionality,
  type &lt;code&gt;C-h a ^kill-&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  Here is a list of commands introduced in the first section of this
  chapter:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-d&lt;/code&gt;: Delete the next character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;lt;backspace&amp;gt;&lt;/code&gt;: Delete the previous character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-d&lt;/code&gt;: Kill until the end of a word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-&amp;lt;backspace&amp;gt;&lt;/code&gt;: Kill backward until the
    beginning of a word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-k&lt;/code&gt;: Kill the rest of the current line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-k&lt;/code&gt;: Kill until the end of sentence.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-k&lt;/code&gt;: Kill expression following point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-S-&amp;lt;backspace&amp;gt;&lt;/code&gt;: Kill current line.  Does not
    work in terminal Emacs.  Use &lt;code&gt;C-a C-k&lt;/code&gt; as alternative.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-w&lt;/code&gt;: Kill text between point and mark.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-w&lt;/code&gt;: Copy text between point and mark to kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-w&lt;/code&gt;: Cause the following command, if it kills, to
    append to the last stretch of text in the kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-y&lt;/code&gt;: Yank (paste) the last stretch of text in the
    kill ring to the buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-y&lt;/code&gt;: Cycle through kill ring.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  I have observed that some Emacs users do not bother
  using &lt;code&gt;M-w&lt;/code&gt; to copy to kill ring.  Instead they
  type &lt;code&gt;C-w C-/&lt;/code&gt; to cut the text and immediately undo the
  cut which effectively leaves the buffer unchanged but inserts a copy
  of the text that was cut into the kill ring.  For example,
  while &lt;code&gt;C-a C-SPC C-n C-n M-w&lt;/code&gt; copies two lines into the
  kill ring, so does &lt;code&gt;C-a C-SPC C-n C-n C-w C-/&lt;/code&gt;.  The
  latter key sequence avoids having to use &lt;code&gt;M-w&lt;/code&gt; but it is
  worth noting that this key sequence does not work in a readonly
  buffer while the former does.  To quickly see the difference,
  open &lt;code&gt;/etc/hosts&lt;/code&gt; as a non-root and non-privileged user
  and try both the key sequences.  The former key sequence does not
  modify the buffer, so it works perfectly in a readonly buffer.  The
  latter key sequence modifies the buffer when we
  type &lt;code&gt;C-w&lt;/code&gt;, so it does not work in a readonly buffer.
&lt;/p&gt;
&lt;p&gt;
  I have also observed that many Emacs users do not bother
  learning &lt;code&gt;C-S-&amp;lt;backspace&amp;gt;&lt;/code&gt; because they can achieve
  the same results using &lt;code&gt;C-a C-k&lt;/code&gt;.
  Further, &lt;code&gt;C-S-&amp;lt;backspace&amp;gt;&lt;/code&gt; does not work in
  terminal Emacs due to terminal limitations.  The key
  sequence &lt;code&gt;C-a&lt;/code&gt; moves the cursor to the beginning of the
  line and &lt;code&gt;C-k&lt;/code&gt; kills everything until the end of the
  line.
&lt;/p&gt;
&lt;p&gt;
  There is a difference between &lt;em&gt;deleting&lt;/em&gt; and
  &lt;em&gt;killing&lt;/em&gt;.  The first two commands &lt;code&gt;C-d&lt;/code&gt;
  and &lt;code&gt;&amp;lt;backspace&amp;gt;&lt;/code&gt; delete characters but the deleted
  characters are not added to the kill ring.  The remaining commands
  in the list above kill text, i.e. remove the text from the buffer
  and add it to the kill ring.  The killed text can be pasted into the
  buffer using &lt;code&gt;C-y&lt;/code&gt;.  For example, &lt;code&gt;M-d M-d M-d C-p
  C-p C-y&lt;/code&gt; kills the next three words and pastes them two lines
  above.
&lt;/p&gt;
&lt;h2 id=&quot;append-kill&quot;&gt;Append Kill&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;C-M-w&lt;/code&gt; is used to ensure that if the
  next command happens to be a kill command, then the killed text is
  appended to the last stretch of text in the kill ring.
&lt;/p&gt;
&lt;p&gt;
  To understand what this command does we must first understand that
  after a kill command adds a new stretch of text to the kill ring,
  subsequent consecutive kills append to the same stretch of text in
  the kill ring, i.e. consecutive kills form a single large stretch of
  text in the kill ring.  This can be tested by performing consecutive
  kills and then pasting with &lt;code&gt;C-y&lt;/code&gt;.  For example,
  &lt;code&gt;M-d M-d M-d C-p C-p C-y&lt;/code&gt; kills 3 words, creates a single
  stretch of text consisting of those 3 words in the kill ring and
  pastes that text two lines above.
&lt;/p&gt;
&lt;p&gt;
  However, the moment a non-kill command is used, it seals the stretch
  of text in the kill ring.  Any subsequent kill command begins a new
  stretch of text.  For example, &lt;code&gt;M-d M-d M-d C-p M-d M-d C-p
  C-y&lt;/code&gt; kills 3 words at first but then it moves to the previous
  line sealing that kill text consisting of 3 words.  Then it kills 2
  words and creates a new stretch of text in the kill ring.
  Therefore, the final yank command pastes only those 2 words from the
  kill ring.
&lt;/p&gt;
&lt;p&gt;
  This can be a problem if we want to kill text from various parts of
  the buffer and yet create a single stretch of text that we want to
  paste somewhere.  That&apos;s when &lt;code&gt;C-M-w&lt;/code&gt; comes useful.  For
  example, &lt;code&gt;M-d M-d M-d C-p C-M-w M-d M-d C-p C-y&lt;/code&gt; kills 3
  words and creates a single stretch of text in the kill ring
  consisting of those 3 words.  Then it moves one line up and kills 2
  more words but this time it appends those 2 words to the existing
  stretch of text in the kill ring.  Finally, it moves two lines up
  and pastes the entire stretch of text consisting of 5 words into the
  buffer.
&lt;/p&gt;
&lt;h2 id=&quot;digit-and-negative-arguments&quot;&gt;Digit and Negative Arguments&lt;/h2&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate digit and
  negative arguments:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-3 M-d&lt;/code&gt;: Kill the next 3 words.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M- M-d &lt;/code&gt;: Kill the previous word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-- M-3 M-d &lt;/code&gt;: Kill the previous 3 words.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-3 C-M-k&lt;/code&gt;: Kill the next 3 expressions.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-- C-M-k&lt;/code&gt;: Kill the previous expression.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-- C-M-3 C-M-k&lt;/code&gt;: Kill the previous 3 expressions.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;yanking-text&quot;&gt;Yanking Text&lt;/h2&gt;
&lt;p&gt;
  There are two key bindings to learn here.  The key
  sequence &lt;code&gt;C-y&lt;/code&gt; executes the &lt;code&gt;yank&lt;/code&gt; command
  which yanks the last stretch of text from the kill ring.
&lt;/p&gt;
&lt;p&gt;
  In the apropos system, &lt;code&gt;paste&lt;/code&gt; is a synonym
  of &lt;code&gt;yank&lt;/code&gt;.  Type &lt;code&gt;C-h v apropos-synonyms RET&lt;/code&gt;
  to see all the synonyms define for the apropos system.
  Thus &lt;code&gt;C-h a paste RET&lt;/code&gt; includes the results
  for &lt;code&gt;yank&lt;/code&gt; too.
&lt;/p&gt;
&lt;h2 id=&quot;yank-pop&quot;&gt;Yank Pop&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-y&lt;/code&gt; executes the &lt;code&gt;yank-pop&lt;/code&gt;
  command which replaces a just-yanked kill with an older kill.  This
  key sequence helps us to cycle through the kill ring and fetch older
  and older kills to be pasted into the buffer.
&lt;/p&gt;
&lt;p&gt;
  Here is an experiment to see how we can use &lt;code&gt;C-y&lt;/code&gt;
  and &lt;code&gt;M-y&lt;/code&gt; can be used together:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    Open a new buffer and type these five words in a single
    line: &lt;code&gt;foo bar baz qux quux&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Then type &lt;code&gt;C-a M-d C-g M-d C-g M-d&lt;/code&gt;.  At this point
    three stretches of text have been inserted into the kill ring.
    The &lt;code&gt;C-g&lt;/code&gt; between every &lt;code&gt;M-d&lt;/code&gt; is there to
    avoid appending kills to the existing stretch of text in the kill
    ring.  This ensures that we have three separate stretches of text
    in the kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    Now type &lt;code&gt;C-y&lt;/code&gt;.  The last stretched of kill text, i.e.
    &lt;code&gt;baz&lt;/code&gt; is now pasted into the buffer.
  &lt;/li&gt;
  &lt;li&gt;
    Now without typing any other key sequence, type &lt;code&gt;M-y&lt;/code&gt;.
    The earlier pasted text &lt;code&gt;baz&lt;/code&gt; is now replaced with an
    older stretch of text from the kill ring.  Thus &lt;code&gt;baz&lt;/code&gt;
    is replaced with &lt;code&gt;bar&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Now once again type &lt;code&gt;M-y&lt;/code&gt;.  The earlier pasted
    text &lt;code&gt;bar&lt;/code&gt; is now replaced with a further older stretch
    of text from the kill ring.  Thus &lt;code&gt;bar&lt;/code&gt; is replaced
    with &lt;code&gt;foo&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
  Note in the previous steps how we are not supposed to type any other
  key between the first &lt;code&gt;C-y&lt;/code&gt; and &lt;code&gt;M-y&lt;/code&gt;.
  Similarly, while cycling through the kill ring, we must not type any
  other key between the consecutive &lt;code&gt;M-y&lt;/code&gt; key sequences.
  While cycling through the kill ring, when we reach the oldest kill,
  the next &lt;code&gt;M-y&lt;/code&gt; wraps around and brings back the newest
  kill.
&lt;/p&gt;
&lt;p&gt;
  Since Emacs 28, the key sequence &lt;code&gt;M-y&lt;/code&gt; also supports
  browsing the kill ring and yanking any arbitrary entry from the kill
  ring.  For example, after trying the above experiment,
  type &lt;code&gt;C-g&lt;/code&gt; just to make sure that we are breaking any
  existing &lt;code&gt;C-y&lt;/code&gt; or &lt;code&gt;M-y&lt;/code&gt; cycle.  Then
  type &lt;code&gt;M-y&lt;/code&gt; and a minibuffer prompt appears to yank an
  arbitrary kill from the kill ring.  If we remember the previous
  kill, we can type it out partially and type &lt;code&gt;TAB&lt;/code&gt; to
  autocomplete it.  Alternatively, we could also type &lt;code&gt;TAB&lt;/code&gt;
  initially itself to browse all the kills in the kill ring.
&lt;/p&gt;
&lt;h2 id=&quot;maximum-length-of-kill-ring&quot;&gt;Maximum Length of Kill Ring&lt;/h2&gt;
&lt;p&gt;
  Type &lt;code&gt;C-h v kill-ring-max RET&lt;/code&gt; to see the maximum length
  of the kill ring.  It is &lt;code&gt;60&lt;/code&gt; by default.
&lt;/p&gt;
&lt;h2 id=&quot;killing-lines&quot;&gt;Killing Lines&lt;/h2&gt;
&lt;p&gt;
  Since &lt;code&gt;C-S-&amp;lt;backspace&amp;gt;&lt;/code&gt; works only in GUI Emacs and
  not in terminal Emacs due to terminal limitations, in the
  section &lt;em&gt;Killing Lines&lt;/em&gt; the author recommends installing the
  package &lt;code&gt;whole-line-or-region&lt;/code&gt; which modifies the
  behaviour of &lt;code&gt;C-w&lt;/code&gt; to kill the current line if there is
  no active region.
&lt;/p&gt;
&lt;p&gt;
  This package can be installed with the following command:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M-x package-install whole-line-or-region RET&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Then a mode offered by this package can be enabled by adding this
  line to the Emacs initialisation file:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(whole-line-or-region-global-mode)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  After Emacs is started with the updated initialisation file,
  typing &lt;code&gt;C-w&lt;/code&gt; kills the current line if there is no active
  region.  However, if there is an active region then &lt;code&gt;C-w&lt;/code&gt;
  retains the default behaviour of killing the region.
&lt;/p&gt;
&lt;p&gt;
  Although the author recommends this package, I do not use this
  package.  I have found &lt;code&gt;C-a C-k&lt;/code&gt; to be very effective for
  killing the current line.  However, it is worth noting that for
  non-empty lines, &lt;code&gt;C-k&lt;/code&gt; does not include the newline in
  the kill by default.  If we want to remove the newline too, we must
  type &lt;code&gt;C-k&lt;/code&gt; another time.  Therefore, to faithfully
  reproduce the behaviour of &lt;code&gt;C-w&lt;/code&gt;
  (of &lt;code&gt;whole-line-or-region&lt;/code&gt;) or that
  of &lt;code&gt;C-S-&amp;lt;backspace&amp;gt;&lt;/code&gt;, we need to type &lt;code&gt;C-a C-k
  C-k&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  It is possible to change the default behaviour of &lt;code&gt;C-k&lt;/code&gt;
  such that when we type it at the beginning of a line, the trailing
  newline is included in the kill.  To do so, add this to the Emacs
  initialisation file:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq kill-whole-line t)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  After Emacs is started with this initialisation
  file, &lt;code&gt;C-k&lt;/code&gt; kills a whole line along with the trailing
  newline only if cursor is at the start of a line.  In other words,
  with this setting, &lt;code&gt;C-a C-k&lt;/code&gt; always kills a whole line
  along with the trailing newline.
&lt;/p&gt;
&lt;h2 id=&quot;transpose&quot;&gt;Transpose&lt;/h2&gt;
&lt;p&gt;
  Here are some transpose commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-t&lt;/code&gt;: Interchange characters around point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-t&lt;/code&gt;: Interchange words around point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-t&lt;/code&gt;: Interchange expressions around point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-t&lt;/code&gt;: Exchange current line and previous line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x transpose-paragraphs RET&lt;/code&gt;: Interchange current
    paragraph with next one.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x transpose-sentences RET&lt;/code&gt;: Interchange the current
    sentence with the next one.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  While using &lt;code&gt;C-t&lt;/code&gt; remember that the point is the logical
  place between two characters.  For example if the cursor blinking on
  the letter &lt;code&gt;e&lt;/code&gt; of the word &lt;code&gt;hello&lt;/code&gt;, then the
  point is between the letters &lt;code&gt;h&lt;/code&gt; and &lt;code&gt;e&lt;/code&gt;.
  When we type a new character, the new character is inserted where
  the point is.  The key sequence &lt;code&gt;C-t&lt;/code&gt; interchanges the
  characters on both sides of the point, i.e. it exchanges the
  character the cursor is blinking on with the character just before
  it.
&lt;/p&gt;
&lt;p&gt;
  There is a subtle difference between the way &lt;code&gt;C-x C-t&lt;/code&gt;
  works and the way the other commands work.  The other commands
  exchange the current or previous object with the next one.
  However, &lt;code&gt;C-x C-t&lt;/code&gt; exchanges the current line with the
  previous one.
&lt;/p&gt;
&lt;p&gt;
  Note that the cursor moves to the end of the next object after
  performing an exchange.  This allows the object that moved forward
  to be dragged further forward by repeated application of the same
  command.  Note again that while the other commands drag the thing at
  point forward, &lt;code&gt;C-x C-t&lt;/code&gt; drags the previous line forward.
&lt;/p&gt;
&lt;p&gt;
  If the cursor is on a space between &lt;code&gt;&quot;foo&quot; :: &quot;bar&quot;&lt;/code&gt;,
  note that &lt;code&gt;M-t&lt;/code&gt; will transpose it to &lt;code&gt;&quot;bar&quot; ::
  &quot;foo&quot;&lt;/code&gt; because it ignores symbols.
&lt;/p&gt;
&lt;h2 id=&quot;filling&quot;&gt;Filling&lt;/h2&gt;
&lt;p&gt;
  Here are some complete key sequences that perform paragraph filling:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-q&lt;/code&gt;: Refill paragraph.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-q&lt;/code&gt;: Refill paragraph and justify text too.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x f 40 RET&lt;/code&gt;: Set &lt;code&gt;fill-column&lt;/code&gt; to 40.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x .&lt;/code&gt;: Set the fill prefix to the current line up to
    point.  On performing a fill operation, the fill prefix is
    inserted at the beginning of every new line created.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-a C-x .&lt;/code&gt;: To cancel the fill prefix, type &lt;code&gt;C-x
    .&lt;/code&gt; at the beginning of a line.  Thus &lt;code&gt;C-a C-x .&lt;/code&gt;
    cancels the fill prefix.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x auto-fill-mode RET&lt;/code&gt;: Toggle auto-filling.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;commenting&quot;&gt;Commenting&lt;/h2&gt;
&lt;p&gt;
  Here are some key bindings to add comments to code in various ways:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-;&lt;/code&gt;: Insert or remove comment in a &lt;em&gt;do what I
    mean&lt;/em&gt; (DWIM) fashion.  If the line is empty, a comment is
    inserted at the beginning of the line.  If the line is not empty,
    a comment is inserted at the end of the line and then indented to
    the column numbered &lt;code&gt;comment-column&lt;/code&gt; if it can.  If a
    region is selected, it comments or uncomments that region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-;&lt;/code&gt;: Comment out or uncomment the current line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x comment-box RET&lt;/code&gt;: Comment a region by drawing a
    box made of comment characters around the selected region.
    Running this command repeatedly on the same region creates
    multiple nested comment boxes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-j&lt;/code&gt;: Insert a new line and continue with the comment
    if the current line has an open comment.  If there is no open
    comment in the current line, then create a new line and indent.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-j&lt;/code&gt;: Same as above.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Here are some variables that control the behaviour of
  comment-related commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;comment-style&lt;/code&gt;: The default is &lt;code&gt;indent&lt;/code&gt;
    which ensures that new comments created with the comment commands
    are correctly indented.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;comment-styles&lt;/code&gt;: An association list with all the
    available comment styles.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;comment-start&lt;/code&gt;: String to insert to start a new
    comment.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;comment-end&lt;/code&gt;: String to insert to end a new comment.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;comment-padding&lt;/code&gt;: Extra spacing between the comment
    characters and the comment text.  This is the minimum number of
    spaces (only if the value of this variable is made of spaces) that
    Emacs tries to keep between the comment characters and comment
    text.  No spaces are inserted if &lt;code&gt;comment-start&lt;/code&gt;
    and &lt;code&gt;comment-end&lt;/code&gt; already
    provide &lt;code&gt;comment-padding&lt;/code&gt; number of spaces or more to
    separate the comment text.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  To demonstrate how changing &lt;code&gt;comment-style&lt;/code&gt; changes the
  commenting behaviour try &lt;code&gt;M-x (setq comment-style &apos;indent)
  RET&lt;/code&gt;, then select a region and type &lt;code&gt;M-;&lt;/code&gt;.  The
  selected region will be commented out with a comment box.
&lt;/p&gt;
&lt;p&gt;
  However running &lt;code&gt;M-x (setq comment-style &apos;aligned) RET&lt;/code&gt;,
  selecting a region in a C buffer and typing &lt;code&gt;M-;&lt;/code&gt; does
  not seem to do anything interesting.
&lt;/p&gt;
&lt;h2 id=&quot;search-and-replace&quot;&gt;Search and Replace&lt;/h2&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate search and
  replace commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-% foo RET bar RET&lt;/code&gt;: Replace the
    string &lt;code&gt;foo&lt;/code&gt; with &lt;code&gt;bar&lt;/code&gt; while prompting for
    instruction at every match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% f.. RET bar RET&lt;/code&gt;: Replace matches for regular
    expression &lt;code&gt;f..&lt;/code&gt; with &lt;code&gt;bar&lt;/code&gt; while prompting
    for instruction at every match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x query-replace RET foo RET bar RET&lt;/code&gt;: Same
    as &lt;code&gt;M-% foo RET bar RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x query-replace-regexp RET f.. RET bar RET&lt;/code&gt;: Same
    as &lt;code&gt;C-M-% f.. RET bar RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x replace-string RET foo RET bar RET&lt;/code&gt;: Replace the
    string &lt;code&gt;foo&lt;/code&gt; with &lt;code&gt;bar&lt;/code&gt; but do not prompt
    for instruction at every match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x replace-string RET f.. RET bar RET&lt;/code&gt;: Replace
    matches for regular expression &lt;code&gt;f..&lt;/code&gt;
    with &lt;code&gt;bar&lt;/code&gt; but do not prompt for instruction at every
    match.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The following key bindings work while a query replace operation is
  in progress:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;y&lt;/code&gt;: Replace one match and continue.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;SPC&lt;/code&gt;: Same as &lt;code&gt;y&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;n&lt;/code&gt;: Skip to next match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;DEL&lt;/code&gt;: Same as &lt;code&gt;n&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;q&lt;/code&gt;: Exit query replace.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;RET&lt;/code&gt;: Same as &lt;code&gt;q&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;.&lt;/code&gt;: Replace one match and exit.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;,&lt;/code&gt;: Replace and stay at current match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;!&lt;/code&gt;: Replace all remaining matches in the buffer with
    no more questions.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;^&lt;/code&gt;: Move point back to the previous match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;u&lt;/code&gt;: Undo previous replacement.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;U&lt;/code&gt;: Undo all replacements.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;E&lt;/code&gt;: Edit replacement string and replace next match.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Just like incremental search (&lt;code&gt;C-s&lt;/code&gt; or
  &lt;code&gt;C-M-s&lt;/code&gt;), search and replace performs case folding,
  i.e. performs case-insensitive match if the search string is a
  lowercase string.  However, the moment we include an uppercase
  character in the search string, search and replace performs
  case-sensitive search and replace.
&lt;/p&gt;
&lt;h2 id=&quot;regular-expressions&quot;&gt;Regular Expressions&lt;/h2&gt;
&lt;p&gt;
  This section presents some examples of regular-expression-based
  search as well as search-and-replace.  Here is a simple text buffer
  where the commands to be presented later can be tried out.
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo-bar-baz
foo-baar-baz
foo-baaar-baz
foo-baaaar-baz
foo-baaaaar-baz
foo-baaaaaar-baz

web
server
webserver
web server
web_server
web-&amp;gt;server
web::server
web.server
securewebserver
secure web server
web server port 80

web-server
web-api-server
secure-web-server
web-server-port-80
web-server-port-http
web-server-port-HTTP-80

(1, 2, 3)
[4, 5, 6]
{7, 8, 9}
((10 + 20) * 30)
&amp;lt;40, 50, 60&amp;gt;

&quot;hello, world&quot;
&apos;hello, world&apos;

; comment
# comment
// comment
/* comment */&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate regular
  expressions in search operations:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s f..&lt;/code&gt;: Search for the letter &lt;code&gt;f&lt;/code&gt;
    followed by two characters.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s foo\|bar&lt;/code&gt;: Search for the
    string &lt;code&gt;foo&lt;/code&gt; or &lt;code&gt;bar&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s ba\{3\}r&lt;/code&gt;: Search for the letter &lt;code&gt;b&lt;/code&gt;
    followed by the string &lt;code&gt;aaa&lt;/code&gt; and the
    letter &lt;code&gt;r&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s ba\{3,5\}r&lt;/code&gt;: Search for the
    letter &lt;code&gt;b&lt;/code&gt; followed by 3 to 5 repetitions of the
    letter &lt;code&gt;a&lt;/code&gt; followed by the letter &lt;code&gt;r&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s port-[0-9]+&lt;/code&gt;: Search for the
    string &lt;code&gt;port-&lt;/code&gt; followed by one or more digits.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s port-[[:digit:]]+&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s port-[[:alnum:]]+&lt;/code&gt;: Search for the
    string &lt;code&gt;port-&lt;/code&gt; followed by one or more alphanumeric
    characters.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s port-[[:upper:][:digit:]-]+&lt;/code&gt;: Search for the
    string &lt;code&gt;port-&lt;/code&gt; followed by consecutive sequence of one
    or more upper-case letters, digits or hyphen.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \&amp;lt;web&lt;/code&gt;: Search for the
    string &lt;code&gt;web&lt;/code&gt; at the beginning of a word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s web\&amp;gt;&lt;/code&gt;: Search for the
    string &lt;code&gt;web&lt;/code&gt; at the end of a word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \&amp;lt;web.+server\&amp;gt;&lt;/code&gt;: Search for the
    string &lt;code&gt;web&lt;/code&gt; at the beginning of a word followed by one
    or more characters and the string &lt;code&gt;server&lt;/code&gt; at the end
    of a word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \_&amp;lt;web.+server\_&amp;gt;&lt;/code&gt;: Search for the
    string &lt;code&gt;web&lt;/code&gt; at the beginning of a symbol followed by
    one or more characters and the string &lt;code&gt;server&lt;/code&gt; at the
    end of a symbol.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s web\s server&lt;/code&gt;: Search for the
    string &lt;code&gt;web&lt;/code&gt; followed by one whitespace character and
    the string &lt;code&gt;server&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s web\s-server&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s &lt;/code&gt;: Search for whitespace character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s-&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \sw&lt;/code&gt;: Search for word constituent character.
    Typically uppercase letters, lowercase letters and digits are
    considered word constituents.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s_&lt;/code&gt;: Search for a symbol character that is used
    in variable names or command names.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s.&lt;/code&gt;: Search for punctuation character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s(&lt;/code&gt;: Search for opening pair of a grouping
    character, e.g. &lt;code&gt;(&lt;/code&gt;, &lt;code&gt;[&lt;/code&gt;, &lt;code&gt;{&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s)&lt;/code&gt;: Search for closing pair of a grouping
    character, e.g. &lt;code&gt;)&lt;/code&gt;, &lt;code&gt;]&lt;/code&gt;, &lt;code&gt;}&lt;/code&gt;,
    etc.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s&quot;&lt;/code&gt;: Search for string delimiter.  This does
    not work in text mode but does work in programming modes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s&amp;lt;&lt;/code&gt;: Search for opening comment delimiter.
    This too does not work in text mode but does work in programming
    modes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \s&amp;gt;&lt;/code&gt;: Search for closing comment delimiter.
    This too does not work in text mode but does work in programming
    modes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-s \Sw&lt;/code&gt;: Search for character that is not a word
    constituent.  The pattern &lt;code&gt;\S&lt;/code&gt; matches any character
    whose syntax code is not the given syntax code (&lt;code&gt;w&lt;/code&gt; in
    this example).
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  All examples above that contain the regular
  expression &lt;code&gt;\s&lt;/code&gt; followed by a character matches a
  character that belongs to a specific syntax class.  For
  example &lt;code&gt;\s.&lt;/code&gt; matches characters that belong to the
  punctuation syntax class.  The syntax class for each character is
  decided by the current major mode.  Thus the same character may
  belong to different syntax classes in different modes.  For example,
  while the character &lt;code&gt;#&lt;/code&gt; belongs to the punctuation syntax
  class in text mode, it belongs to the comment syntax class in Python
  mode.
&lt;/p&gt;
&lt;p&gt;
  To find out which syntax class a particular character belongs to,
  place the cursor on the character and type &lt;code&gt;C-u C-x =&lt;/code&gt;.
  The &lt;em&gt;syntax&lt;/em&gt; field in the output buffer shows the syntax
  class of the character.
&lt;/p&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate various
  search-and-replace features:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% \(web\)\(\s-\)\(server\) RET \3\2\1 RET&lt;/code&gt;: Search
    for the string &lt;code&gt;web&lt;/code&gt; followed by a whitespace and the
    string &lt;code&gt;server&lt;/code&gt; and swap &lt;code&gt;web&lt;/code&gt;
    with &lt;code&gt;server&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% \(foo-\)\sw+\(-baz\) RET \1\?\2 RET&lt;/code&gt;: Search for
    the string &lt;code&gt;foo-&lt;/code&gt; followed by a word and the
    string &lt;code&gt;baz&lt;/code&gt; and replace the middle word with text
    input provided by the user.  Before each replace operation, Emacs
    will prompt the user to edit the replacement pattern by putting
    the point where &lt;code&gt;\?&lt;/code&gt; was in the original replacement
    string.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% foo RET \# RET&lt;/code&gt;: Search for the
    string &lt;code&gt;foo&lt;/code&gt; and replace each match with an
    autoincrementing number.  The first match is replaced
    with &lt;code&gt;0&lt;/code&gt;, the second one with &lt;code&gt;1&lt;/code&gt;, the third
    one with &lt;code&gt;2&lt;/code&gt; and so on.  Precisely speaking, the
    backreference &lt;code&gt;\#&lt;/code&gt; refers to the count of the
    replacements already made in the current search and replace
    operation.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% foo RET \&amp;amp;\&amp;amp; RET&lt;/code&gt;: Search for the
    string &lt;code&gt;foo&lt;/code&gt; and duplicate it.  The replacement
    pattern &lt;code&gt;\&amp;amp;&lt;/code&gt; stands for the whole match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% f.. RET \,(upcase \&amp;amp;) RET&lt;/code&gt;: Search for the
    letter &lt;code&gt;f&lt;/code&gt; followed by two characters and replace the
    match with an uppercase form of the match.  The
    syntax &lt;code&gt;\,(&lt;em&gt;form&lt;/em&gt;)&lt;/code&gt; is used to evaluate an Elisp
    form and use its result in the replacement string.  The
    backreference &lt;code&gt;\&amp;amp;&lt;/code&gt; refers to the whole match as a
    string in the Elisp expression.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% [0-9]+ RET \,(+ 1000 \#&amp;amp;)&lt;/code&gt;: Search for
    numbers and add 1000 to each match.  The
    backreference &lt;code&gt;\#&amp;amp;&lt;/code&gt; refers to the whole match as a
    number within the Elisp expression.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% \(\sw+\)-\(\sw+\) RET \,(upcase \2)-\1 RET&lt;/code&gt;:
    Search for two words separated by a hyphen and then swap them but
    convert the second word in each match to uppercase.  The
    backreference &lt;code&gt;\2&lt;/code&gt; refers to the string matched by the
    second capturing group as a string within the Elisp expression.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-% port-\([0-9]+\) RET port-\,(+ 1000 \#1) RET&lt;/code&gt;:
    Search for the string &lt;code&gt;port-&lt;/code&gt; followed by a number and
    add 1000 to the number.  The backreference &lt;code&gt;\#1&lt;/code&gt; refers
    to the string matched by the first capturing group as a string
    within the Elisp expression.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;changing-case&quot;&gt;Changing Case&lt;/h2&gt;
&lt;p&gt;
  Here are some commands to change case of text:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-l&lt;/code&gt;: Convert string from point to the end of word to
    lowercase.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-u&lt;/code&gt;: Convert string from point to the end of word to
    uppercase.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-c&lt;/code&gt;: Capitalise string from point to the end of word.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-l&lt;/code&gt;: Convert region to lower case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-u&lt;/code&gt;: Convert region to upper case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x upcase-initials-region RET&lt;/code&gt;: Capitalise region.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that the commands &lt;code&gt;C-x C-l&lt;/code&gt;
  (&lt;code&gt;downcase-region&lt;/code&gt;) and &lt;code&gt;C-x C-u&lt;/code&gt;
  (&lt;code&gt;upcase-region&lt;/code&gt;) are disabled by default.  Follow the
  prompts to try it or enable it.  A quick way to try it is to
  type &lt;code&gt;SPC&lt;/code&gt;.  Also, adding the following to the Emacs
  initialisation file permanently enables it.
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(put &apos;downcase-region &apos;disabled nil)
(put &apos;upcase-region &apos;disabled nil)&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;counting&quot;&gt;Counting&lt;/h2&gt;
&lt;p&gt;
  Here are some commands to count lines, words, characters, patterns,
  etc:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-=&lt;/code&gt;: Count lines, words and characters in region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x count-words-region RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x count-words RET&lt;/code&gt;: Similar to above.  If no region
    is selected, then counts in the entire buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x how-many RET f.. RET&lt;/code&gt;: Show the number of matches
    for the regular expression &lt;code&gt;f..&lt;/code&gt; following point.  If
    region is selected, then show the number of matches in the region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x count-matches RET f.. RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;deleting-and-keeping-lines&quot;&gt;Deleting and Keeping Lines&lt;/h2&gt;
&lt;p&gt;
  The commands that are presented in this section can be tested with a
  buffer like this:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo
bar

foo
bar

foo
foo

bar
foo



baz
baz
baz&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Here are the commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x delete-duplicate-lines RET&lt;/code&gt;: Delete all but one
    copy of duplicate lines in region.  When executed on the whole of
    the example buffer presented above, it leaves us with three
    non-empty lines and one blank line.  When duplicate lines are
    encountered, the first instance of each line is kept intact and
    the others are deleted.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-x delete-duplicate-lines RET&lt;/code&gt;: Like the previous
    command but search backwards.  Thus effectively, the last instance
    of each repeated line is left intact while the other duplicates
    are deleted.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u C-u M-x delete-duplicate-lines RET&lt;/code&gt;: Delete only
    those duplicate lines that are adjacent to each other.  In every
    contiguous group of duplicate lines, the first one is left intact
    and the rest are deleted.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u C-u C-u M-x delete-duplicate-lines RET&lt;/code&gt;: Like the
    first command in this list but repeated blank lines are left
    intact.  When executed on the whole of the example buffer
    presented above, it leaves us with three non-empty lines and six
    blank lines.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x flush-lines RET b.. RET&lt;/code&gt;: Delete lines in region
    that match the regular expression &lt;code&gt;b..&lt;/code&gt;.  If no region
    is active, then delete matching lines between the point and end of
    buffer.  The deleted lines are not copied to kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x keep-lines RET b.. RET&lt;/code&gt;: Keep lines in region that
    match the regular expression &lt;code&gt;b..&lt;/code&gt; and delete the rest.
    If no region is active, then keep matching lines between the point
    and end of buffer and delete the rest.  The deleted lines are not
    copied to kill ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x copy-matching-lines RET b.. RET&lt;/code&gt;: Copy lines in
    region that match the regular expression &lt;code&gt;b..&lt;/code&gt; to the
    kill ring.  If no region is active, then copy matching lines
    between the point and end of buffer.  (Available since Emacs 28.1)
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x kill-matching-lines RET b.. RET&lt;/code&gt;: Kill lines in
    region that match the regular expression &lt;code&gt;b..&lt;/code&gt; to the
    kill ring.  If no region is active, then kill matching lines
    between the point and end of buffer.  (Available since Emacs 28.1)
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  To try each command on the entire buffer, first type &lt;code&gt;C-x
  h&lt;/code&gt; to select the entire buffer as the region and then type a
  command mentioned above.
&lt;/p&gt;
&lt;h2 id=&quot;splitting-and-joining-lines&quot;&gt;Splitting and Joining Lines&lt;/h2&gt;
&lt;p&gt;
  Here is a list of commands that help with splitting and joining
  lines:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-o&lt;/code&gt;: Insert a newline after the point but do not move
    the point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-o&lt;/code&gt;: On blank line, delete all surrounding blank
    lines, leaving just one.  On isolated blank line, delete the blank
    line.  On non-blank line, delete all consecutive blank lines that
    follow the non-blank lines.  While deleting blank lines it also
    deletes lines that consist only of whitespaces.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-o&lt;/code&gt;: Split current line at the next non-whitespace
    character after the point while maintaining its indentation.
    Everything from the next non-whitespace character after the point
    to the end of the line moves down by one line but the new line is
    indented so that the column numbers of all the characters that
    moved down remain the same.  If a fill-prefix has been set, say
    with &lt;code&gt;C-x .&lt;/code&gt;, then the fill-prefix is inserted in the
    new line.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-^&lt;/code&gt;: Join current line with previous line and leave
    exactly one space between the joined lines.  If a fill-prefix is
    set, say with &lt;code&gt;C-x .&lt;/code&gt;, then the fill-prefix is removed
    while joining lines.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;C-x C-o&lt;/code&gt; is very useful for removing
  spurious blank lines between paragraphs.
&lt;/p&gt;
&lt;p&gt;
  Note that &lt;code&gt;M-^&lt;/code&gt; also works on a region.  When a region is
  active, it joins all lines in the region.
&lt;/p&gt;
&lt;h2 id=&quot;examining-and-fixing-whitespace-issues&quot;&gt;Examining and Fixing Whitespace Issues&lt;/h2&gt;
&lt;p&gt;
  Here is a list of commands that are useful in examining whitespace
  in the current buffer:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-mode RET&lt;/code&gt;: Toggle visualisation of
    spaces, tabs, newlines and lines longer
    than &lt;code&gt;whitespace-line-column&lt;/code&gt; number of columns (80 by
    default) with special glyphs and colour.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-newline-mode RET&lt;/code&gt;: Toggle visualisation
    of newlines.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-toggle-options RET&lt;/code&gt;: Toggle local
    options for &lt;code&gt;whitespace-mode&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  After typing &lt;code&gt;M-x whitespace-toggle-options RET&lt;/code&gt;, type a
  key to tell it what to do.  For example, type &lt;code&gt;N&lt;/code&gt; and it
  will start or restart &lt;code&gt;whitespace-mode&lt;/code&gt; with the
  visualisation of newline toggled.  Type &lt;code&gt;?&lt;/code&gt; to see the
  list of all key inputs it supports.
&lt;/p&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x whitespace-toggle-options RET&lt;/code&gt; may
  be typed anytime regardless of whether &lt;code&gt;whitespace-mode&lt;/code&gt;
  is currently enabled or not.  If &lt;code&gt;whitespace-mode&lt;/code&gt; is not
  enabled, running &lt;code&gt;whitespace-toggle-options&lt;/code&gt;
  automatically enables it.  If &lt;code&gt;whitespace-mode&lt;/code&gt; is
  already enabled, then running &lt;code&gt;whitespace-toggle-options&lt;/code&gt;
  and toggling an option, restarts local &lt;code&gt;whitespace-mode&lt;/code&gt;
  with the updated option setting.
&lt;/p&gt;
&lt;p&gt;
  Here are some commands to report and clean up whitespace issues:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-report RET&lt;/code&gt;: Shows a report of
    whitespace issues.  The &quot;Current setting&quot; column on left shows the
    current settings found in the
    variable &lt;code&gt;whitespace-style&lt;/code&gt;.  The &quot;Whitespace Problem&quot;
    column on the right shows the whitespace problems found in the
    buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-report-region RET&lt;/code&gt;: Like the previous
    command but reports problems in a region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-cleanup RET&lt;/code&gt;: Cleans up whitespace
    issues in the buffer.  This command checks
    the &lt;code&gt;whitespace-style&lt;/code&gt; variable to decide which issues
    to fix.  See &lt;code&gt;C-h f whitespace-cleanup RET&lt;/code&gt; for
    complete details.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x whitespace-cleanup-region RET&lt;/code&gt;: Cleans up
    whitespace issues in a region.  Unlike the previous command, this
    command does not fix empty lines at the beginning or end of
    buffer.  See &lt;code&gt;C-h f whitespace-cleanup-region RET&lt;/code&gt; for
    complete details.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  As mentioned in the list above, the whitespace cleanup functions
  read the variable &lt;code&gt;whitespace-style&lt;/code&gt; to decide which
  whitespace issues to fix.  Say, we do not want to fix trailing
  whitespace issue but do want to fix other whitespace issues selected
  by default (e.g. empty lines at the beginning or end of buffer,
  spaces before tab, etc.), then we need to update
  the &lt;code&gt;whitespace-style&lt;/code&gt; variable as follows:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq whitespace-style (delete &apos;trailing whitespace-style))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Now running &lt;code&gt;whitespace-cleanup&lt;/code&gt;
  or &lt;code&gt;whitespace-cleanup-region&lt;/code&gt; is going to skip fixing
  trailing spaces but it will perform the other cleanups determined by
  the value of &lt;code&gt;whitespace-style&lt;/code&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;keyboard-macros&quot;&gt;Keyboard Macros&lt;/h2&gt;
&lt;p&gt;
  The behaviour of keyboard macro key sequences depend on the current
  context.  So they are presented as table below.
&lt;/p&gt;
&lt;table class=&quot;grid&quot;&gt;
  &lt;tr&gt;
    &lt;th&gt;
      Key
    &lt;/th&gt;
    &lt;th&gt;
      Command
    &lt;/th&gt;
    &lt;th&gt;
      While not recording
    &lt;/th&gt;
    &lt;th&gt;
      While recording
    &lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;code&gt;F3&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;code&gt;kmacro-start-macro-or-insert-counter&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      Start recording
    &lt;/td&gt;
    &lt;td&gt;
      Insert counter
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;code&gt;F4&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;code&gt;kmacro-end-or-call-macro&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      Call macro
    &lt;/td&gt;
    &lt;td&gt;
      End recording
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;code&gt;C-x&amp;nbsp;(&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;code&gt;kmacro-start-macro&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      Start recording
    &lt;/td&gt;
    &lt;td&gt;
      Do nothing
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;code&gt;C-x&amp;nbsp;)&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;code&gt;kmacro-end-macro&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      End recording
    &lt;/td&gt;
    &lt;td&gt;
      Do nothing
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;code&gt;C-x&amp;nbsp;e&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;code&gt;kmacro-end-and-call-macro&lt;/code&gt;
    &lt;/td&gt;
    &lt;td&gt;
      Call macro
    &lt;/td&gt;
    &lt;td&gt;
      End recording and call macro
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
  The key sequences in the table above can be divided into three
  groups:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x (&lt;/code&gt; and &lt;code&gt;C-x )&lt;/code&gt;: These invoke simple
    commands that start and stop macro recording.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;F3&lt;/code&gt; and &lt;code&gt;F3&lt;/code&gt;: These are wrappers around the
    simple commands.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x e&lt;/code&gt;: This is a slightly high level command too that
    wraps around simpler macro commands and functions that end
    recording and calls a macro.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Given these details, there are broadly two ways these macro key
  sequences can be used.  They are shown in the table below.
&lt;/p&gt;
&lt;table class=&quot;grid&quot;&gt;
  &lt;tr&gt;
    &lt;th&gt;Operation&lt;/th&gt;
    &lt;th&gt;Using Function Keys&lt;/th&gt;
    &lt;th&gt;Using Control Keys&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Start recording&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;F3&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;C-x (&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Stop recording&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;F4&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;C-x )&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Call macro&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;F4&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;C-x e&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Stop recording and call macro&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;F4 F4&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;C-x e&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Repeat call macro&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;F4&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;e&lt;/code&gt;&lt;/td&gt;
&lt;/table&gt;
&lt;p&gt;
  If you are comfortable using function keys, you might want to follow
  the second column in the table above.  Otherwise, you might want to
  follow the third column in the table above.
&lt;/p&gt;
&lt;p&gt;
  The last row is not mentioned in the book but the fact
  that &lt;code&gt;e&lt;/code&gt; may be used to repeat a macro call performed
  with &lt;code&gt;C-x e&lt;/code&gt; is documented in the Emacs
  manual: &lt;a href=&quot;https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic-Keyboard-Macro.html&quot;&gt;Keyboard
  Macros: Basic Use&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Note that &lt;code&gt;F3&lt;/code&gt; inserts a counter value and increments the
  counter value by 1 or by the number specified via a digit argument.
  Here is an example key sequence that may be typed in a buffer with
  multiple lines to demonstrate this:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x (&lt;/code&gt; to start macro recording.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-a F3 . SPC M-c C-n&lt;/code&gt; to insert macro counter
    which &lt;code&gt;0&lt;/code&gt; by default, followed by dot and space at the
    beginning of the line, capitalise the first word and move to the
    next line.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-x e&lt;/code&gt; to stop macro recording and call the
    recorded macro.  Now &lt;code&gt;1&lt;/code&gt;, dot and space is inserted at
    the beginning of the line.  The first word of the current line is
    capitalised and the cursor moves to the next line.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;e&lt;/code&gt; to repeat the macro call.  Keep
    typing &lt;code&gt;e&lt;/code&gt; to repeat the macro call.
  &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
  The behaviour of the the macro commands change with universal
  arguments and digit arguments as follows:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-u F3&lt;/code&gt;: Execute the last macro, then record new macro
    and append it to the last macro.  Set
    &lt;code&gt;kmacro-execute-before-append&lt;/code&gt; to &lt;code&gt;nil&lt;/code&gt;
    (it is &lt;code&gt;t&lt;/code&gt; by default) to prevent executing the last
    macro before appending a new macro to the last macro.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u C-x (&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-5 F3&lt;/code&gt;: Start recording but set counter to 5, i.e.
    while a macro is being recorded, typing &lt;code&gt;F3&lt;/code&gt; inserts 5
    the first time, 6 the second time and so on.  The numeric prefix
    argument sets the counter value.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-5 C-x (&lt;/code&gt;: Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u F4&lt;/code&gt;: Execute the second macro in the ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-7 F4&lt;/code&gt;: Repeat the last macro 7 times.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-7 C-x e&lt;/code&gt;: Repeat the last macro 7 times.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-0 F3&lt;/code&gt;: Repeat macro until there is an error (e.g.
    reaching the end of a buffer).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-0 C-x e&lt;/code&gt;: Same as above.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Type &lt;code&gt;C-x C-k C-h&lt;/code&gt; to discover keyboard macro commands
  and their key bindings.  The list below shows some of the
  interesting ones mentioned in the book.  In the list below, complete
  key sequences are used, so that they serve as a demonstration of the
  macro commands.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k C-a 20 RET&lt;/code&gt;: Add 20 value to the counter.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k TAB&lt;/code&gt;: Insert counter.  Note that we saw earlier
    that this can also be done with &lt;code&gt;F3&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k C-c&lt;/code&gt;: Set counter.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k C-f %02x&lt;/code&gt;: Set macro counter format to
    zero-padded two-digit hexadecimal numbers with a minimum width of
    2.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that all of the above commands work fine even when no macro
  recording is in progress.  For example, earlier we saw
  that &lt;code&gt;F3&lt;/code&gt; inserts the macro counter value only when a
  macro recording is in progress.  However, &lt;code&gt;C-x C-k TAB&lt;/code&gt;
  inserts the macro counter value even when a macro recording is not
  in progress.
&lt;/p&gt;
&lt;p&gt;
  Another interesting feature mentioned in the book is querying for
  user input while recording a keyboard macro.  The key sequence to
  query the user is &lt;code&gt;C-x C-k q&lt;/code&gt; or &lt;code&gt;C-x q&lt;/code&gt;.
  Here are a few complete key sequences that may be used to
  demonstrate this feature:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;F3 C-n C-a foo: C-x q C-e :bar F4&lt;/code&gt;: This defines a
    macro such that when we execute the macro by
    typing &lt;code&gt;F4&lt;/code&gt; one more time, the macro first
    inserts &lt;code&gt;foo&lt;/code&gt; at the beginning of the next line, then
    it prompts us to decide if we want to continue with macro
    execution.  If we type type &lt;code&gt;y&lt;/code&gt;, then it continues with
    the remainder of the macro execution.  If we type &lt;code&gt;n&lt;/code&gt;,
    it skips the rest of the macro iteration and continue with the
    next iteration of the macro (such as when we are replaying the
    macro multiple times with a digit argument).  If we
    type &lt;code&gt;RET&lt;/code&gt;, it skips the rest of the macro execution as
    well as skip any further iterations of the macro (in case we are
    replaying the macro multiple times).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;F3 C-a foo: C-x C-k q C-e :bar F4&lt;/code&gt;: Same as above but
    slightly longer key sequence.  The key sequence in the previous
    point is easier to remember and type.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  In the above examples, when the macro playback prompts queries for
  user input, we can also type &lt;code&gt;C-l&lt;/code&gt; to recentre the
  screen, &lt;code&gt;C-r&lt;/code&gt; to enter recursive edit or
  &lt;code&gt;C-M-c&lt;/code&gt; to exit recursive edit.
&lt;/p&gt;
&lt;p&gt;
  Note that the key sequence &lt;code&gt;C-l&lt;/code&gt; behaves a little
  differently from the regular &lt;code&gt;C-l&lt;/code&gt;.  Unlike the
  regular &lt;code&gt;C-l&lt;/code&gt;, successive invocations of this key
  sequence during macro query does not cause the window to reposition
  at various places (centre, top and bottom by default) in a cyclical
  order.  Successive invocations of &lt;code&gt;C-l&lt;/code&gt; during macro
  query, leaves the screen centred.
&lt;/p&gt;
&lt;p&gt;
  Here are some key sequences to save and recall macros:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k C-p&lt;/code&gt;: Move to the previous keyboard macro in
    the keyboard macro ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k C-n&lt;/code&gt;: Move to the next keyboard macro in the
    keyboard macro ring.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k n foo RET&lt;/code&gt;: Assign the name &lt;code&gt;foo&lt;/code&gt;
    to the current keyboard macro in the keyboard macro ring.  Now the
    macro can be executed by simply typing &lt;code&gt;M-x foo RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x insert-kbd-macro foo RET&lt;/code&gt;: Insert the definition
    of the named keyboard macro &lt;code&gt;foo&lt;/code&gt; as Elisp code into
    the current buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k b C-c 1&lt;/code&gt;: Assign the key sequence &lt;code&gt;C-c
    1&lt;/code&gt; to the current keyboard macro in the keyboard macro ring.
    Now the macro can be executed by simply typing &lt;code&gt;C-c 1&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Finally, here are some commands to edit keyboard macros:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k e C-x e&lt;/code&gt;: Edit the current keyboard macro.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k e M-x foo RET&lt;/code&gt;: Edit the keyboard macro
    named &lt;code&gt;foo&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k e C-c 1&lt;/code&gt;: Edit the keyboard macro
    bound to &lt;code&gt;C-c 1&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-k l&lt;/code&gt;: View the most recent 300 keystrokes and
    edit it to create a new keyboard macro.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x kmacro-edit-lossage RET&lt;/code&gt;: Same as above.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  A few additional commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-h l&lt;/code&gt;: See the last 300 characters typed (lossage).
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x open-dribble-file foo.txt RET&lt;/code&gt;: Write input events
    to a dribble file named &lt;code&gt;foo.txt&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-: (open-dribble-file nil) RET&lt;/code&gt;: Close the dribble file.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;text-expansion&quot;&gt;Text Expansion&lt;/h2&gt;
&lt;h3 id=&quot;abbrev&quot;&gt;Abbrev&lt;/h3&gt;
&lt;p&gt;
  Here are some Abbrev commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x a l&lt;/code&gt;: Take the word before the cursor and define a
    mode-specific abbreviation for it.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x a g&lt;/code&gt;: Take the word before the cursor and define a
    global abbreviation for it.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x a i l&lt;/code&gt;: Take the abbreviated word before the
    cursor and define a mode-specific expansion for it.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x a i l&lt;/code&gt;: Take the abbreviated word before the
    cursor and define a global expansion for it.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that for the expansions to work Abbrev mode should be enabled,
  say with &lt;code&gt;M-x abbrev-mode RET&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate how we can use
  Abbrev to define an abbreviation, i.e. text that automatically gets
  replaced by another text:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;Use SPC Debian C-x a l deb RET&lt;/code&gt;: Define a
    mode-specific abbreviation &lt;code&gt;deb&lt;/code&gt; such that whenever we
    type &lt;code&gt;deb&lt;/code&gt;, it automatically expands
    to &lt;code&gt;Debian&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;Use SPC Linux C-x a g lnx RET&lt;/code&gt;: Define a global
    abbreviation &lt;code&gt;lnx&lt;/code&gt; such that whenever we
    type &lt;code&gt;lin&lt;/code&gt;, it automatically expands
    to &lt;code&gt;Linux&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;Hello SPC wld C-x a i l World RET&lt;/code&gt;: Define a
    mode-specific abbreviation &lt;code&gt;wld&lt;/code&gt; such that whenever we
    type &lt;code&gt;wld&lt;/code&gt;, it automatically expands
    to &lt;code&gt;World&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;Hello SPC evry C-x a i g Everyone RET&lt;/code&gt;: Define a
    global abbreviation &lt;code&gt;evry&lt;/code&gt; such that whenever we
    type &lt;code&gt;evry&lt;/code&gt;, it automatically expands
    to &lt;code&gt;Everyone&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Although not mentioned in the book, these commands can be used with
  a numeric prefix argument to specify the number of words before the
  cursor to be picked for expansion for the abbreviation we are about
  to define.  Here are some complete key sequences that demonstrate
  this:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;I use Debian GNU/Linux C-3 C-x a l dgl&lt;/code&gt;: Define a
    mode-specific abbreviation &lt;code&gt;dgl&lt;/code&gt; such that whenever we
    type &lt;code&gt;dgl&lt;/code&gt;, it automatically expands to &lt;code&gt;Debian
    GNU/Linux&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;I use Debian GNU/Linux C-3 C-x a g dgl&lt;/code&gt;: Similar to
    above but define a global abbreviation.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;dabbrev&quot;&gt;DAbbrev&lt;/h3&gt;
&lt;p&gt;
  There are two key bindings discussed in the book:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-/&lt;/code&gt;: Expand the word just before the cursor to the
    nearest preceding word for which the current word is a prefix.  If
    no suitable preceding word is found, expand it to the nearest
    succeeding word for which the current word is a prefix.  Repeating
    this command cycles between the other matches found.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-/&lt;/code&gt;: Find all words in the buffer that has the
    current word before the cursor as the prefix and expand the
    current word to the longest common prefix of all these matching
    words.  However, if the longest common prefix of the matching
    words is same as the word before the cursor, then present them as
    suggestions for completion.  If there is exactly one matching
    word, expand the word before the cursor to that word.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The last command above takes a little while to get used to it.  The
  following steps demonstrate how it works.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Create a text buffer with the following line:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;abacus apple appliance application&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;ap&lt;/code&gt; followed by &lt;code&gt;C-M-/&lt;/code&gt;, the word
    expands to &lt;code&gt;appl&lt;/code&gt; since that is the longest common
    prefix among the matching words.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;C-M-/&lt;/code&gt; again.  The matching
    words &lt;code&gt;apple&lt;/code&gt;, &lt;code&gt;appliance&lt;/code&gt;
    and &lt;code&gt;application&lt;/code&gt; are presented as possible completions
    in a temporary buffer named &lt;code&gt;*Completions*&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Now type &lt;code&gt;ic&lt;/code&gt;, so that the word before the cursor
    becomes &lt;code&gt;applic&lt;/code&gt; and type &lt;code&gt;C-M-/&lt;/code&gt; again.
    Now the word before the cursor expands to &lt;code&gt;application&lt;/code&gt;
    because that is the only possible completion now.
  &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
  Note that by default DAbbrev looks for matching words in other open
  buffers too and offers them as completions.
&lt;/p&gt;
&lt;h3 id=&quot;hippie-expand&quot;&gt;Hippie Expand&lt;/h3&gt;
&lt;p&gt;
  Unlike DAbbrev, Hippie Expand goes beyond open buffers to look for
  expansions.  The variable
  &lt;code&gt;hippie-expand-try-functions-list&lt;/code&gt; contains a list of
  expansion functions that &lt;code&gt;hippie-expand&lt;/code&gt; uses to look for
  completions.  The book suggests remapping &lt;code&gt;M-/&lt;/code&gt; to
  invoke &lt;code&gt;hippie-expand&lt;/code&gt; with this Elisp code:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(global-set-key [remap dabbrev-expand] &apos;hippie-expand)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  By default, Hippie Expand can complete file names, complete lines,
  etc.  For example, if there is a line for which the current line is
  a prefix (leading whitespace is ignored while checking for matches),
  then the current line is expanded to the other matchine line.
&lt;/p&gt;
&lt;p&gt;
  Repeated invocations of this command cycles between the matches.
&lt;/p&gt;
&lt;p&gt;
  As mentioned earlier, the
  variable &lt;code&gt;hippie-expand-try-functions-list&lt;/code&gt; determines
  which expansion algorithms are used.  Here is an example that
  demonstrates how we can alter this variable:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq hippie-expand-try-functions-list &apos;(try-complete-lisp-symbol))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The above rather unrealistic example severely restricts the
  expansions Hippie Expand can perform.  With the above example, word
  expansion, line expansion, file name completion, etc. are disabled.
  Only Elisp symbols are expanded.  For example,
  typing &lt;code&gt;white&lt;/code&gt; followed by &lt;code&gt;M-/&lt;/code&gt; first expands
  the word to &lt;code&gt;whitespace&lt;/code&gt; because all matching Elisp
  symbols have that as the longest common prefix.
  Typing &lt;code&gt;M-/&lt;/code&gt; over and over again, completes the expansion
  further with various Elisp symbols.
&lt;/p&gt;
&lt;p&gt;
  As mentioned before, the above example is highly atypical.  The
  above example is only meant for demonstrating how this variable can
  be set.  Typically, users add more functions to this variable to add
  more expansion capabilities.
&lt;/p&gt;
&lt;h2 id=&quot;indenting&quot;&gt;Indenting&lt;/h2&gt;
&lt;h3 id=&quot;electric-indentation&quot;&gt;Electric Indentation&lt;/h3&gt;
&lt;p&gt;
  Emacs automatically indents code as we type.  The major mode decides
  the automatic indentation behaviour.  The automatic identation is
  provided by a global minor mode named
  &lt;code&gt;electric-indent-mode&lt;/code&gt; which is enabled by default.
&lt;/p&gt;
&lt;h3 id=&quot;indenting-current-line&quot;&gt;Indenting Current Line&lt;/h3&gt;
&lt;p&gt;
  Typing &lt;code&gt;TAB&lt;/code&gt; indents the current line.  In many modes
  like &lt;code&gt;emacs-lisp-mode&lt;/code&gt;, &lt;code&gt;python-mode&lt;/code&gt;,
  &lt;code&gt;text-mode&lt;/code&gt;, etc. the command
  &lt;code&gt;indent-for-tab-command&lt;/code&gt; is bound to it.  But there are
  modes that bind another command to &lt;code&gt;TAB&lt;/code&gt;.  For example,
  in &lt;code&gt;c-mode&lt;/code&gt;, the command
  &lt;code&gt;c-indent-line-or-region&lt;/code&gt; is bound to &lt;code&gt;TAB&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  The behaviour of &lt;code&gt;indent-for-tab-command&lt;/code&gt; is determined
  by the variables &lt;code&gt;tab-always-indent&lt;/code&gt;.  It
  is &lt;code&gt;t&lt;/code&gt; by default which causes &lt;code&gt;TAB&lt;/code&gt; to just
  indent the current line.  If set to &lt;code&gt;nil&lt;/code&gt;,
  hitting &lt;code&gt;TAB&lt;/code&gt; indents the current line only if the point
  is before the first non-whitespace character of the line.  Otherwise
  it inserts tabs or spaces to move the point to the next tab stop
  column.  If set to &lt;code&gt;&apos;complete&lt;/code&gt;, typing &lt;code&gt;TAB&lt;/code&gt;
  first tries to indent the current line but if the line is already
  correctly indented, then it tries to complete the thing at point.
&lt;/p&gt;
&lt;p&gt;
  When &lt;code&gt;indent-for-tab-command&lt;/code&gt; is bound
  to &lt;code&gt;TAB&lt;/code&gt; and when &lt;code&gt;indent-for-tab-command&lt;/code&gt;
  decides to indent the current line, it calls the function in the
  variable &lt;code&gt;indent-line-function&lt;/code&gt; to perform the
  indentation.  Here is a table that shows
  what &lt;code&gt;indent-line-function&lt;/code&gt; contains in a few major modes
  where &lt;code&gt;indent-for-tab-command&lt;/code&gt; command is bound
  to &lt;code&gt;TAB&lt;/code&gt;:
&lt;/p&gt;
&lt;table class=&quot;grid&quot;&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;major-mode&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;indent-line-function&lt;/code&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;code&gt;emacs-lisp-mode&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;lisp-indent-line&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;code&gt;python-mode&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;python-indent-line-function&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;code&gt;text-mode&lt;/code&gt;&lt;/td&gt;
    &lt;td&gt;&lt;code&gt;indent-relative&lt;/code&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
  While &lt;code&gt;lisp-indent-line&lt;/code&gt; and
  &lt;code&gt;python-indent-line&lt;/code&gt; attempt to indent the current line
  according to the syntax of the language,
  &lt;code&gt;indent-relative&lt;/code&gt; inserts tabs and spaces to move the
  point to the next indentation point where the indentation point is
  defined as the next non-whitespace character following whitespace.
  This can be useful in aligning the point with words in the previous
  line.  If the previous line has no indentation point (e.g. the
  previous line is an empty line or does not have whitespace),
  then &lt;code&gt;tab-to-tab-stop&lt;/code&gt; is invoked which inserts tabs or
  spaces to move the point to the next tab stop column.
&lt;/p&gt;
&lt;p&gt;
  The command &lt;code&gt;tab-to-tab-stop&lt;/code&gt; command introduced in the
  previous paragraph can also be invoked with &lt;code&gt;M-i&lt;/code&gt;.
&lt;/p&gt;
&lt;h3 id=&quot;use-only-spaces-for-indentation&quot;&gt;Use Only Spaces for Indentation&lt;/h3&gt;
&lt;p&gt;
  By default, Emacs uses a mix of tabs and spaces for indentation and
  alignment.  When it needs to align the first non-whitespace
  character of a line with a certain token in the previous line, it
  would insert as many tabs as it can followed by a few spaces if
  necessary to attain the desired alignment.  To force Emacs to always
  use spaces for indentation and alignment, add the following Elisp
  code to the Emacs initialisation file:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq-default indent-tabs-mode nil)&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;tab-width&quot;&gt;Tab Width&lt;/h3&gt;
&lt;p&gt;
  The variable &lt;code&gt;tab-width&lt;/code&gt; is used in various contexts
  while performing indentation and alignment.  For example,
  when &lt;code&gt;indent-tabs-mode&lt;/code&gt; is enabled, for
  every &lt;code&gt;tab-width&lt;/code&gt; columns of indentation required, Emacs
  inserts a tab to indent the code.
&lt;/p&gt;
&lt;p&gt;
  Also, when &lt;code&gt;indent-tabs-mode&lt;/code&gt; is set to &lt;code&gt;nil&lt;/code&gt;,
  typing &lt;code&gt;M-i&lt;/code&gt; inserts as many spaces as necessary to move
  the point to the next tab stop column where the distance between two
  tab stops is assumed to be &lt;code&gt;tab-width&lt;/code&gt;.
&lt;/p&gt;
&lt;h3 id=&quot;edit-tab-stops&quot;&gt;Edit Tab Stops&lt;/h3&gt;
&lt;p&gt;
  The behaviour of &lt;code&gt;M-i&lt;/code&gt; can be customised further by
  manually defining tab stop columns.  Type &lt;code&gt;M-x edit-tab-stops
  RET&lt;/code&gt; first.  A buffer named &lt;code&gt;*Tab Stops*&lt;/code&gt; appears.
  The second and third line of this buffer contains a ruler to
  indicate the column numbers.  Type &lt;code&gt;:&lt;/code&gt; (i.e. colon) in
  the first line whereever you want to define tab stops.  Then
  type &lt;code&gt;C-c C-c&lt;/code&gt; to install the changes.  Now
  when &lt;code&gt;M-i&lt;/code&gt; is typed in a text buffer, each time it
  inserts as many tabs (if &lt;code&gt;indent-tabs-mode&lt;/code&gt;
  is &lt;code&gt;t&lt;/code&gt;) or spaces as necessary to move the point to the
  next tab stop column as defined earlier in the &lt;code&gt;*Tab
  Stops*&lt;/code&gt; buffer.
&lt;/p&gt;
&lt;h3 id=&quot;indent-regions&quot;&gt;Indent Region&lt;/h3&gt;
&lt;p&gt;
  Typing &lt;code&gt;TAB&lt;/code&gt; when a region is active indents the region
  according to the major mode&apos;s indentation rules.  It invokes the
  same command as the one invoked when we type &lt;code&gt;TAB&lt;/code&gt; to
  indent a line.  The command bound to it takes care of indenting
  region.  For example, if &lt;code&gt;TAB&lt;/code&gt; is bound
  to &lt;code&gt;indent-for-tab-command&lt;/code&gt;, the latter checks if a
  region is active and if it is, then it simply
  calls &lt;code&gt;indent-region&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  The &lt;code&gt;indent-region&lt;/code&gt; command can be invoked explicitly
  using &lt;code&gt;C-M-\&lt;/code&gt;.  If &lt;code&gt;fill-prefix&lt;/code&gt; has been set,
  say with &lt;code&gt;C-x .&lt;/code&gt;, then it is added to every line in the
  region being indented.  With a numeric prefix argument, each line in
  the region is indented to the column indicated by the argument.  For
  example, &lt;code&gt;C-M-1 C-M-0 C-M-\&lt;/code&gt; indents each line of the
  region to column 10.
&lt;/p&gt;
&lt;h3 id=&quot;indent-rigidly&quot;&gt;Indent Rigidly&lt;/h3&gt;
&lt;p&gt;
  When we want to rigidly control how a region must be indented, we
  can type &lt;code&gt;C-x TAB&lt;/code&gt; to perform rigid indentation.  Doing
  so allows us to bypass the indentation rules of the major mode.
  Instead we control exactly how the indentation must be done.  The
  following complete key sequences demonstrates a few examples of
  rigid indentation:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x TAB&lt;/code&gt;: Interactively indent region.
    Type &lt;code&gt;&amp;lt;right&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;left&amp;gt;&lt;/code&gt; to
    increase or decrease indentation by one space respectively.
    Type &lt;code&gt;&amp;lt;right&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;left&amp;gt;&lt;/code&gt; to
    increase or decrease indentation by one tab stop respectively.
  &lt;/li&gt;
  &lt;li&gt;
	&lt;code&gt;C-6 C-x TAB&lt;/code&gt;: Indent region by 6 spaces.  Appropriate
	number of tabs and spaces are inserted to achieve an apparent 6
	spaces of indentation.  Whether tabs are inserted or not and how
	many tabs are inserted depend on the values
	of &lt;code&gt;indent-tabs-mode&lt;/code&gt; and &lt;code&gt;tab-width&lt;/code&gt; as
	explained in the previous sections.
  &lt;/li&gt;
  &lt;li&gt;
	&lt;code&gt;C-- C-6 C-x TAB&lt;/code&gt;: Reduce indentation of region by 6
	spaces.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;sorting&quot;&gt;Sorting&lt;/h2&gt;
&lt;p&gt;
  Assuming a region is active, here are some complete key sequences
  for various sorting commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x sort-lines RET&lt;/code&gt;: Sort lines alphabetically.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-x sort-lines RET&lt;/code&gt;: Reverse sort lines
    alphabetically.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x sort-fields RET&lt;/code&gt;: Sort lines alphabetically by the
    first field alphabetically.  Fields are separated by whitespace.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-2 M-x sort-fields RET&lt;/code&gt;: Sort lines alphabetically
    by the second field.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-2 M-x sort-numeric-fields RET&lt;/code&gt;: Sort lines
    numerically by the second field.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x sort-columns RET&lt;/code&gt;: Sort columns between the column
    position of mark and column position of point.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x sort-regexp-fields RET [A-Z]*-&amp;gt;\(.*\) RET \1 RET&lt;/code&gt;:
    Sort the strings in each line matched by the given regular
    expression by the field matched by the first (and the only)
    capturing group in the regular expression.  The part of each line
    that is not matched by the regular expression remains intact.
    They never move.  Only the part of each line that is matched by
    the regular expression moves around during the sorting operation.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x sort-regexp-fields RET&lt;/code&gt;: Sort paragraphs
    alphabetically.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;aligning&quot;&gt;Aligning&lt;/h2&gt;
&lt;p&gt;
  The two simple commands for aligning text introduced first in the
  book are:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x align RET&lt;/code&gt;: Aligns current region.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x align-current RET&lt;/code&gt;: Aligns current section.  A
    section is a group of consecutive lines both below, above and
    including the current line for which the first alignment rule
    (according to the major mode) applies.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Consider the following Elisp buffer:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defvar person &apos;((&quot;name&quot; . &quot;Alice&quot;)
                 (&quot;city&quot; . &quot;London&quot;)
                 (&quot;country&quot; . &quot;UK&quot;)))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  If we type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;M-x align RET&lt;/code&gt;
  or if we put the cursor on any line of the above code and
  type &lt;code&gt;M-x align-current RET&lt;/code&gt;, we get the following
  result:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defvar alice &apos;((&quot;name&quot;    . &quot;Alice&quot;)
                (&quot;city&quot;    . &quot;London&quot;)
                (&quot;country&quot; . &quot;UK&quot;)))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  There is also an &lt;code&gt;align-regexp&lt;/code&gt; command that allows us to
  parts of lines by regular expressions.  The following experiments
  demonstrate this command.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    First create a buffer with the following text:
&lt;pre&gt;&lt;code&gt;Alice:London:UK
Bob:Paris:France
Carol:Tokyo:Japan&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;C-u M-x align-regexp
        \(\s-*\): RET 1 RET 1 RET y RET&lt;/code&gt;.  The result looks like
        this:
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Alice :London :UK
Bob   :Paris  :France
Carol :Tokyo  :Japan&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Note that the regular expression capturing
      group &lt;code&gt;\(\s-*\)&lt;/code&gt; appears as the default in the
      minibuffer.  We only add &lt;code&gt;:&lt;/code&gt; to it.  Similarly the
      two occurrences of &lt;code&gt;1&lt;/code&gt; appear as default values.  The
      first &lt;code&gt;1&lt;/code&gt; is the default for determining which
      parenthesis group to modify.  The second &lt;code&gt;1&lt;/code&gt; is the
      default for amount of spacing to be used during alignment.
      The &lt;code&gt;y&lt;/code&gt; in the end specifies that we want to repeat
      the alignment throughout the line.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
      Type &lt;code&gt;C-/&lt;/code&gt; to undo the changes done in the last step.
      Then type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;M-x align-regexp
      : RET&lt;/code&gt;.  This is a shorter equivalent to the previous
      command.  The output is same as before.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-/&lt;/code&gt; to undo the changes done in the last step.
      Then type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;C-u M-x
      align-regexp :\(\s-*\) RET 1 RET 1 y RET&lt;/code&gt;.  Note that the
      only difference this time is that we place the colon before the
      parenthesis group.  The result looks like this:
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Alice: London: UK
Bob:   Paris:  France
Carol: Tokyo:  Japan&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-/&lt;/code&gt; to undo the changes done in the last step.
      Then type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;C-u M-x
      align-regexp \(\s-*\): RET 1 RET 0 y RET&lt;/code&gt;.  Note that the
      only difference this time is that we place the colon before the
      parenthesis group.  We specify &lt;code&gt;0&lt;/code&gt; as the amount of
      spacing this time, so a minimum of zero spacing is used for
      alignment when possible.  The result looks like the following.
      Notice the lack of space after &lt;code&gt;Alice&lt;/code&gt;
      and &lt;code&gt;Carol&lt;/code&gt;.
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Alice:London:UK
Bob  :Paris :France
Carol:Tokyo :Japan&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-/&lt;/code&gt; to undo the changes done in the last step.
      Then type &lt;code&gt;C-x h&lt;/code&gt; followed by &lt;code&gt;C-u M-x
      align-regexp \(\s-*\): RET 1 RET 5 y RET&lt;/code&gt;.  Note that the
      only difference this time is that we place the colon before the
      parenthesis group.  We specify &lt;code&gt;5&lt;/code&gt; as the amount of
      spacing this time, so a minimum of 5 spaces are used for
      alignment.
    &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Alice     :London     :UK
Bob       :Paris      :France
Carol     :Tokyo      :Japan&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;zap-to-char&quot;&gt;Zap to Char&lt;/h2&gt;
&lt;p&gt;
  The steps below demonstrate the &lt;code&gt;zap-to-char&lt;/code&gt; command
  that is bound to the key sequence &lt;code&gt;M-z&lt;/code&gt;.  This command
  kills up to and including the given character.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Create a buffer with the following text:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;foo bar baz qux quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-&amp;lt;&lt;/code&gt; to go to the beginning of the buffer
      and then type &lt;code&gt;M-z r&lt;/code&gt; to kill text up to and
      including the first occurrence of the letter &lt;code&gt;r&lt;/code&gt;.
      The buffer now looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;  baz qux quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-&amp;lt;&lt;/code&gt; to go to the beginning of the buffer
      and then type &lt;code&gt;M-z x&lt;/code&gt; to kill text up to and
      including the first occurrence of the letter &lt;code&gt;x&lt;/code&gt;.
      The buffer now looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt; quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now type &lt;code&gt;C-e SPC C-y&lt;/code&gt; to reinsert the killed text at
      the end of the line.  The buffer now looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt; quux foo bar baz qux&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Note that the last step yanks both chunks of text that were
      killed in the previous two steps.  This is due to the fact that
      consecutive kills append to the same stretch of text in the kill
      ring.  This fact was discussed earlier in
      section &lt;a href=&quot;#append-kill&quot;&gt;Append Kill&lt;/a&gt;
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now type &lt;code&gt;M-&amp;lt;&lt;/code&gt; to go back to the beginning of the
      buffer again.  Then type &lt;code&gt;M-2 M-z a&lt;/code&gt;.  The numeric
      argument &lt;code&gt;2&lt;/code&gt; specifies that we want to zap up to the
      second occurrence of the letter &lt;code&gt;a&lt;/code&gt;.  The buffer
      looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;z qux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-e SPC C-y&lt;/code&gt; to reinsert the text killed in the
      previous step at the end of the line.  The buffer looks like
      this now:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;z qux quux foo bar ba&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-- M-2 M-z x&lt;/code&gt; to zap backward up to the second
      occurrence of the letter &lt;code&gt;x&lt;/code&gt;.  The buffer looks like
      this now:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;z qu&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;zap-up-to-char&quot;&gt;Zap up to Char&lt;/h2&gt;
&lt;p&gt;
  Here are some steps that demonstrate the &lt;code&gt;zap-up-to-char&lt;/code&gt;
  command.  This command kills text up to, but not including, the
  given character.
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Create a buffer with the following text:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;foo bar baz qux quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-&amp;lt;&lt;/code&gt; to go to the beginning of the buffer.
      Then type &lt;code&gt;M-x zap-up-to-char RET b&lt;/code&gt;.  The result now
      looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;bar baz qux quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-2 M-x zap-up-to-char RET q&lt;/code&gt;.  The result now
      looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;quux&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-e SPC C-y&lt;/code&gt; to reinsert the killed text at the end
      of the buffer:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;quux foo bar baz qux &lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-- M-2 M-x zap-up-to-char RET b&lt;/code&gt;.  The buffer
      now looks like this:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;quux foo b&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
  The author of the book suggests binding this command
  to &lt;code&gt;M-S-z&lt;/code&gt; with the following Elisp code:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(global-set-key (kbd &quot;M-S-z&quot;) &apos;zap-up-to-char)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The above code, however, does not create the binding successfully.
  Therefore, use the following Elisp code instead:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(global-set-key (kbd &quot;M-Z&quot;) &apos;zap-up-to-char)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Now the commands presented in this section above can be typed as
  follows:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;M-Z b&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-2 M-Z q&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-- M-Z b&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;spell-check&quot;&gt;Spell Check&lt;/h2&gt;
&lt;p&gt;
  The spell checking commands of Emacs require a spell checking
  program to be installed on the system.  Emacs supports the spell
  checking programs &lt;code&gt;aspell&lt;/code&gt;, &lt;code&gt;ispell&lt;/code&gt;,
  &lt;code&gt;hunspell&lt;/code&gt; and &lt;code&gt;enchant-2&lt;/code&gt;.  If multiple
  programs are present, it looks for them one by one in the order
  specified in the previous sentence and picks the first one that is
  found.  The following spell checking commands are introduced in the
  book:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-$&lt;/code&gt;: Check spelling of word under or before the
    cursor.  Possible corrections are offered in a new window.  If the
    word under or before the cursor is already correct, a message
    like &lt;code&gt;APPLE is correct&lt;/code&gt; appears in the echo area.  When
    corrections are offered, each correction is numbered.
    Type &lt;code&gt;SPC&lt;/code&gt; to leave the word unchanged or type a number
    to choose a numbered correction.  Type &lt;code&gt;x&lt;/code&gt; to exit the
    the spelling buffer (the one that shows corrections).
    Type &lt;code&gt;q&lt;/code&gt; to quit the spelling session (kills the
    spelling program process).  To see the list of all key bindings
    supported, type &lt;code&gt;C-h f ispell-help RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x flyspell-mode RET&lt;/code&gt;: Toggle on-the-fly spell
    checking.  Misspelled words are underlined with squiggly lines.
    Type &lt;code&gt;C-M-i&lt;/code&gt; or &lt;code&gt;C-.&lt;/code&gt; to correct a
    misspelled word under or before the cursor.  All possible
    corrections appear in the echo area.  Repeat &lt;code&gt;C-M-i&lt;/code&gt;
    or &lt;code&gt;C-.&lt;/code&gt; to cycle through the possible corrections.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x flyspell-prog-mode RET&lt;/code&gt;: Turns
    on &lt;code&gt;flyspell-mode&lt;/code&gt; for comments and strings only.  This
    is useful while working in a buffer with a programming mode
    enabled.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x ispell-buffer RET&lt;/code&gt;: Check the current buffer for
    spelling errors interactively.  Each misspelled word is
    highlighted and corrections are offered in a new window.  The
    interface and key sequences for making corrections are the same as
    the ones for &lt;code&gt;M-$&lt;/code&gt; introduced above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x ispell-region RET&lt;/code&gt;: Like the previous command but
    checks the current region for spelling errors.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;dictionary-lookup&quot;&gt;Dictionary Lookup&lt;/h2&gt;
&lt;p&gt;
  The following complete key sequences demonstrate some of the
  dictionary commands introduced in the book:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dictionary-lookup-definition RET&lt;/code&gt;: Look up
    definitions of the word at or before the cursor.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dictionary-search RET programming RET&lt;/code&gt;: Search
    definitions of the word &lt;code&gt;programming&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dictionary-select-dictionary RET&lt;/code&gt;: This command
    presents a list of available dictionaries in a new buffer.
    Navigate the buffer and click on a dictionary or
    type &lt;code&gt;RET&lt;/code&gt; while the cursor is on a dictionary entry to
    select it.  For example, move the cursor down to the entry that
    begins with the text &lt;code&gt;jargon:&lt;/code&gt; and
    type &lt;code&gt;RET&lt;/code&gt; and then type &lt;code&gt;M-x dictionary-search
    RET programming RET&lt;/code&gt; to see the definition of the
    word &lt;code&gt;programming&lt;/code&gt; from the Jargon File only.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The dictionary commands first attempt to connect to a locally
  running dictionary server.  If the connection does not succeed, it
  prompts for consent to connect to
  &lt;a href=&quot;https://dict.org/&quot;&gt;dict.org&lt;/a&gt;.  Typing &lt;code&gt;y&lt;/code&gt; at
  the prompt allows the command to proceed and complete the command.
&lt;/p&gt;
&lt;h2 id=&quot;quoted-insert&quot;&gt;Quoted Insert&lt;/h2&gt;
&lt;p&gt;
  Here are some complete key sequences that demonstrate quoted insert:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-q C-l&lt;/code&gt;: Insert form feed character.  This is
    displayed as &lt;samp&gt;^L&lt;/samp&gt; in Emacs using the face
    named &lt;code&gt;escape-glyph&lt;/code&gt;.  Emacs treats each form feed
    character as a page break and we can navigate back and forth
    between pages with &lt;code&gt;C-x [&lt;/code&gt; and &lt;code&gt;C-x ]&lt;/code&gt;
    respectively.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q (&lt;/code&gt;: Insert a literal open parenthesis.  Useful
    in &lt;code&gt;paredit-mode&lt;/code&gt; where the key sequence &lt;code&gt;(&lt;/code&gt;
    is bound to &lt;code&gt;paredit-open-round&lt;/code&gt; which inserts a
    balanced pair of parentheses.  To insert a single parenthesis
    instead, we can perform a quoted insert with &lt;code&gt;C-q (&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q TAB&lt;/code&gt;: Insert a literal tab character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q C-j&lt;/code&gt;: Insert a literal line feed character, i.e.
    a newline character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q RET&lt;/code&gt;: Insert a literal carriage return.  This is
    displayed as &lt;samp&gt;^M&lt;/samp&gt; in Emacs.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q ESC&lt;/code&gt;: Insert a literal escape character.  This is
    displayed as &lt;samp&gt;^[&lt;/samp&gt; in Emacs.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-q C-[&lt;/code&gt;: Same as above.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;links&quot;&gt;Links&lt;/h2&gt;
&lt;p&gt;
  The following list includes some links that were discussed during
  the book discussion group meetings:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://battlepenguin.com/tech/aspell-and-hunspell-a-tale-of-two-spell-checkers/&quot;&gt;Aspell and Hunspell: A Tale of Two Spell Checkers&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://www.reddit.com/r/emacs/comments/fxs92h/&quot;&gt;Spell
      checkers in Emacs in 2020&lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch05.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 4: The Theory of Movement</title>
    <link href="https://susam.net/cc/mastering-emacs/ch04.html"/>
    <id>urn:uuid:98f60488-e2c0-4cbf-9bb6-f8c10c2394d6</id>
    <updated>2023-03-25T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 4 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#basics&quot;&gt;Basics&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#major-mode-load-order&quot;&gt;Major Mode Load Order&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#file-local-variables&quot;&gt;File-Local Variables&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#occur-mode&quot;&gt;Occur Mode&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;basics&quot;&gt;Basics&lt;/h2&gt;
&lt;p&gt;
  The following complete key sequences illustrate a few basic
  commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f foo.txt RET&lt;/code&gt;: Edit file
    named &lt;code&gt;foo.txt&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-s&lt;/code&gt;: Save current buffer to file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x b *scratch* RET&lt;/code&gt;: Switch to the buffer
    named &lt;code&gt;*scratch*&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x k *scratch* RET&lt;/code&gt;: Kill the buffer
    named &lt;code&gt;*scratch*&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x k RET&lt;/code&gt;: Kill current buffer.  In fact, like the
    previous key sequence above, typing &lt;code&gt;C-x k&lt;/code&gt; first
    prompts for the buffer name.  However, the current buffer name is
    selected as the default value already.  As a result,
    typing &lt;code&gt;RET&lt;/code&gt; kills the current buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-b&lt;/code&gt;: List buffers.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-c&lt;/code&gt;: Exit Emacs.  This command offers to save all
    unsaved buffers before exiting Emacs.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;ESC ESC ESC&lt;/code&gt;: This command exits the current context.
    What that means depends very much on the context.  It performs
    exactly one of the following actions: If there is an active
    region, then it is deactivated; if a minibuffer is open, it gets
    rid of it; if recursive edit is in progress, it quits one level of
    recursive editing; if multiple windows are open, it deletes other
    windows so that the current window becomes the only window in the
    frame.  The aforementioned conditions are tested one by one and as
    soon as one of the conditions is met, the corresponding action is
    executed and the other conditions are skipped.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-/&lt;/code&gt;: Undo changes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;F10&lt;/code&gt;: Activate the menu bar.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  In my experience, I have found that &lt;code&gt;ESC ESC ESC&lt;/code&gt; is most
  useful when a stray minibuffer is open but the cursor is on some
  other buffer instead of the minibuffer and I need to close the
  minibuffer.  Here are some steps that demonstrate this usage:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x white&lt;/code&gt; and pause.  We now have a partially
      typed command in the minibuffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now pretend that we get distracted by some imperfections in the
      text buffer that was open earlier and we want to fix those
      first.  Type &lt;code&gt;C-x o&lt;/code&gt; to move away from the minibuffer
      and go back to the text buffer to perform some editing tasks.
    &lt;/p&gt;
    &lt;p&gt;
      In this step, we could have typed &lt;code&gt;C-g&lt;/code&gt; to quit the
      minibuffer first but we did not do that.  We pretended to get
      distracted by the text buffer and went straight to it from the
      minibuffer by typing &lt;code&gt;C-x o&lt;/code&gt;.  At this point, the
      cursor is in the text buffer and the minibuffer remains open at
      the bottom.  The open minibuffer can be distracting while
      performing the text editing tasks.  Typing &lt;code&gt;C-g&lt;/code&gt; now
      will not get rid of the minibuffer because the cursor is no
      longer in the minibuffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now one way to close the open minibuffer could be to
      type &lt;code&gt;C-x o&lt;/code&gt; to go back to the minibuffer window and
      type &lt;code&gt;C-g&lt;/code&gt;.  However, there is a more direct way to
      do this as explained in the next point.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;ESC ESC ESC&lt;/code&gt; to get rid of the minibuffer at
      the bottom.  This works even when the cursor is not in the
      minibuffer but is in the text buffer instead.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;major-mode-load-order&quot;&gt;Major Mode Load Order&lt;/h2&gt;
&lt;p&gt;
  The chapter mentions the following order for detecting major mode:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;File-local variables&lt;/li&gt;
  &lt;li&gt;Program loader directives&lt;/li&gt;
  &lt;li&gt;Magic mode detection&lt;/li&gt;
  &lt;li&gt;Automatic mode detection&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Let us start from the bottom of the list and share some experimental
  results that illustrate how the major mode detection works.
&lt;/p&gt;
&lt;h3 id=&quot;file-local-variables&quot;&gt;File-Local Variables&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Create a text file named &lt;code&gt;foo.txt&lt;/code&gt; with the following
      content:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;

int main() {
  std::cout &amp;lt;&amp;lt; &quot;hello, world\n&quot;;
  return 0;
}&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Then open this file in Emacs (say, with &lt;code&gt;C-x C-f foo.txt
      RET&lt;/code&gt;).  Emacs sets the major mode to &lt;code&gt;Text&lt;/code&gt;
      (i.e. &lt;code&gt;text-mode&lt;/code&gt;).
    &lt;/p&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-: major-mode RET&lt;/code&gt; to confirm that indeed the
      value of &lt;code&gt;major-mode&lt;/code&gt; is &lt;code&gt;text-mode&lt;/code&gt;.
      This happens due to automatic mode detection which determines
      the major mode based on the file name.  In this case it sees
      that the file name ends with &lt;code&gt;.txt&lt;/code&gt; and
      enables &lt;code&gt;text-mode&lt;/code&gt;.  We will discuss automatic mode
      detection further in the
      section &lt;a href=&quot;#automatic-mode-detection&quot;&gt;Automatic Mode
      Detection&lt;/a&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now edit the previous file to add file-local variables in the
      header as follows:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;// -*- mode: c++; c-basic-offset: 4 -*-

#include &amp;lt;iostream&amp;gt;

int main() {
  std::cout &amp;lt;&amp;lt; &quot;hello, world\n&quot;;
  return 0;
}&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Now reload the buffer.  You could simply kill the buffer
      with &lt;code&gt;C-x k&lt;/code&gt; and reopen the file with &lt;code&gt;C-x C-f
      foo.txt RET&lt;/code&gt; or alternatively, reload the buffer
      with &lt;code&gt;M-x revert-buffer RET yes RET&lt;/code&gt;.
    &lt;/p&gt;
    &lt;p&gt;
      After reloading the buffer, you should see that
      the &lt;code&gt;C++&lt;/code&gt; mode (i.e. &lt;code&gt;c++-mode&lt;/code&gt;) is
      enabled.  As a result, C++ syntax highlighting should be
      visible.  Further &lt;code&gt;C-x h TAB&lt;/code&gt; should reformat the
      code to use 4 spaces for each level of indentation.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      File-local variables may be specified in the footer too as shown
      below:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;

int main() {
    std::cout &amp;lt;&amp;lt; &quot;hello, world\n&quot;;
    return 0;
}

// Local Variables:
// mode: c++
// c-basic-offset: 6
// End:&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Now reloading the buffer should show that &lt;code&gt;c++-mode&lt;/code&gt;
      is enabled and typing &lt;code&gt;C-x h TAB&lt;/code&gt; should reformat the
      code to use 6 spaces for each level of indentation.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      What happens if the file-local variables in the header and
      footer contradict each other?  To test this out, edit the buffer
      to have the following content:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;// -*- mode: c++; c-basic-offset: 4 -*-

#include &amp;lt;iostream&amp;gt;

int main() {
      std::cout &amp;lt;&amp;lt; &quot;hello, world\n&quot;;
      return 0;
}

// Local Variables:
// mode: python
// c-basic-offset: 6
// End:&lt;/code&gt;&lt;/pre&gt;
    &lt;p&gt;
      Reloading the buffer should show that &lt;code&gt;c++-mode&lt;/code&gt; is
      active.  Typing &lt;code&gt;C-x h TAB&lt;/code&gt; should reformat the code
      to use 6 spaces for each level of indentation.  Therefore the
      mode specified in the header remains effective.  For other
      variables, the ones specified in the footer have precedence.
    &lt;/p&gt;
    &lt;p&gt;
      Of course, the example above is intended for curiosity and
      exploration.  In practical use, however, it is best to avoid
      assigning conflicting values to file-local variables in both the
      header and footer.  Such inconsistencies can lead to confusion
      and make the effect of the variables difficult to understand.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;occur-mode&quot;&gt;Occur Mode&lt;/h2&gt;
&lt;p&gt;
  TODO: More notes coming up here soon!
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch04.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 3: First Steps</title>
    <link href="https://susam.net/cc/mastering-emacs/ch03.html"/>
    <id>urn:uuid:41ccf675-1e61-4d1a-a0b9-4c097edeaec1</id>
    <updated>2023-01-07T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 3 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#starting-emacs&quot;&gt;Starting Emacs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#emacs-client-server&quot;&gt;Emacs Client-Server&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#the-emacs-interface&quot;&gt;The Emacs Interface&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#keys&quot;&gt;Keys&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#terminal-limitations&quot;&gt;Terminal Limitations&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#definitions-for-key-sequences&quot;&gt;Definitions for Key Sequences&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#key-examples&quot;&gt;Key Examples&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ctrl-g&quot;&gt;C-g: Universal Bail Me Out&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#caps-lock-as-control&quot;&gt;Caps Lock as Control&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#M-x-execute-extended-command&quot;&gt;M-x: Execute Extended Command&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#interactive-commands&quot;&gt;Interactive Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#m-x-execute-extended-command-for-buffer&quot;&gt;M-X: Execute Extended Command for Buffer&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#universal-arguments&quot;&gt;Universal Arguments&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#discovering-and-remembering-keys&quot;&gt;Discovering and Remembering Keys&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#true-colour&quot;&gt;True Colour&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#the-customise-interface&quot;&gt;The Customise Interface&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#customise-commands&quot;&gt;Customise Commands&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#evaluating-elisp-code&quot;&gt;Evaluating Elisp Code&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#info&quot;&gt;Info&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#apropos&quot;&gt;Apropos&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#describe&quot;&gt;Describe&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#links&quot;&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;starting-emacs&quot;&gt;Starting Emacs&lt;/h2&gt;
&lt;p&gt;
  Here are some frequently used commands to start Emacs:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;emacs -nw&lt;/code&gt;: Tell Emacs not to create a graphical
    frame, i.e. run Emacs within a terminal instead.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;emacs -q&lt;/code&gt;: Do not load an init file, i.e. do not
    load &lt;code&gt;~/.emacs&lt;/code&gt;, &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;, etc.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;emacs -Q&lt;/code&gt;: Do not load init file, site-wide startup
    file or X resources.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;emacs-client-server&quot;&gt;Emacs Client-Server&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x server-start RET&lt;/code&gt; turns the current
  instance of Emacs into a server.  If we kill this instance of Emacs,
  it kills the server too.
&lt;/p&gt;
&lt;p&gt;
  Another way to start an Emacs server is to enter the
  command &lt;code&gt;emacs --daemon&lt;/code&gt;.  This too internally
  invokes &lt;code&gt;server-start&lt;/code&gt; to start an Emacs server but this
  command ensures that Emacs runs in background mode.  Therefore,
  killing any particular instance of Emacs window does not end up
  killing the Emacs server.
&lt;/p&gt;
&lt;p&gt;
  To open files, say &lt;code&gt;foo.txt&lt;/code&gt; and &lt;code&gt;bar.txt&lt;/code&gt; in
  an already running Emacs server, enter the command &lt;code&gt;emacsclient
  foo.txt bar.txt&lt;/code&gt;.  This command blocks the terminal and waits
  for us to finish editing the files.  While editing the files, we
  need to type &lt;code&gt;C-x #&lt;/code&gt; to tell Emacs that we are done
  editing the current file.  Emacs then switches to the next file we
  are editing.  When we are done editing all the files
  opened, &lt;code&gt;emacsclient&lt;/code&gt; quits and returns control to the
  terminal.
&lt;/p&gt;
&lt;p&gt;
  The book does not mention how to stop an Emacs daemon.  One of the
  several ways to stop an Emacs daemon is the
  command &lt;code&gt;emacsclient -e &apos;(kill-emacs)&apos;&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  Here are some commands to run &lt;code&gt;emacsclient&lt;/code&gt;:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;emacsclient -c&lt;/code&gt;: Create a frame.  A graphical frame is
    created if graphics is available, otherwise a terminal frame is
    created.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;emacsclient -nw&lt;/code&gt;: Create a terminal frame.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;emacsclient -n&lt;/code&gt;: Client returns immediately without
    waiting for us to finish editing the file.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-emacs-interface&quot;&gt;The Emacs Interface&lt;/h2&gt;
&lt;p&gt;
  The book mentions that many Emacs users disable the menu bar, tool
  bar and the splash screen.  The following Elisp code shows how these
  UI elements can be disabled:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(menu-bar-mode 0)
(when (display-graphic-p)
  (tool-bar-mode 0)
  (scroll-bar-mode 0))
(setq inhibit-startup-screen t)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  After saving the code in the initialisation file (such
  as &lt;code&gt;~/.emacs&lt;/code&gt;, &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;, etc.) and
  restarting Emacs, these UI elements disappear.
&lt;/p&gt;
&lt;p&gt;
  It is worth mentioning here that disabling the menu bar may not be a
  good idea, especially, for beginners to Emacs.  The menu bar
  contains a lot of helpful shortcuts that could be useful to
  beginners.  Further, the menu bar often displays certain menus that
  are specific to the current buffer.  Therefore, it may be a good
  idea to leave the menu bar enabled.
&lt;/p&gt;
&lt;p&gt;
  Regardless of whether the menu bar is enabled or disabled, the menu
  bar can accessed easily by typing &lt;kbd&gt;F10&lt;/kbd&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;keys&quot;&gt;Keys&lt;/h2&gt;
&lt;p&gt;
  The book mentions the following notation for modifier keys:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;C-&lt;/code&gt;: Control&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-&lt;/code&gt;: Meta&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;S-&lt;/code&gt;: Shift&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;s-&lt;/code&gt;: Super&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;H-&lt;/code&gt;: Hyper&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;A-&lt;/code&gt;: Alt&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Although not mentioned in the book, here is a quick way to test out
  all of these modifier keys:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(global-set-key (kbd &quot;C-j&quot;) (lambda () (interactive) (message &quot;You typed C-j&quot;)))
(global-set-key (kbd &quot;M-j&quot;) (lambda () (interactive) (message &quot;You typed M-j&quot;)))
(global-set-key (kbd &quot;C-S-j&quot;) (lambda () (interactive) (message &quot;You typed C-S-j&quot;)))
(global-set-key (kbd &quot;s-j&quot;) (lambda () (interactive) (message &quot;You typed s-j&quot;)))
(global-set-key (kbd &quot;H-j&quot;) (lambda () (interactive) (message &quot;You typed H-j&quot;)))
(global-set-key (kbd &quot;A-j&quot;) (lambda () (interactive) (message &quot;You typed A-j&quot;)))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Go to some buffer, say, the scratch buffer with
  &lt;code&gt;C-x b *scratch* RET&lt;/code&gt;, then copy the above code to it,
  then place the cursor at the end of each line of code and
  type &lt;code&gt;C-x e&lt;/code&gt; to evaluate each line.
&lt;/p&gt;
&lt;p&gt;
  Then open a new buffer, say with &lt;code&gt;C-x b foo RET&lt;/code&gt; and
  type &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;j&lt;/kbd&gt;, &lt;kbd&gt;alt&lt;/kbd&gt;+&lt;kbd&gt;j&lt;/kbd&gt;
  and &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;j&lt;/kbd&gt; to test the first
  three key bindings.
&lt;/p&gt;
&lt;p&gt;
  The fourth key-binding &lt;code&gt;s-j&lt;/code&gt; can usually be invoked by
  typing &lt;kbd&gt;command&lt;/kbd&gt;+&lt;kbd&gt;j&lt;/kbd&gt;
  or &lt;kbd&gt;win&lt;/kbd&gt;+&lt;kbd&gt;j&lt;/kbd&gt; depending on the type of keyboard you
  have.
&lt;/p&gt;
&lt;p&gt;
  The &lt;code&gt;H-&lt;/code&gt; and &lt;code&gt;A-&lt;/code&gt; modifier keys are generally
  not mapped to any actual key in modern systems.  However, it is
  possible to invoke the &lt;code&gt;H-j&lt;/code&gt; and &lt;code&gt;A-j&lt;/code&gt; key
  bindings with the key sequences &lt;code&gt;C-x @ h j&lt;/code&gt; and &lt;code&gt;C-x
  @ a j&lt;/code&gt; respectively, i.e.
  &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;x&lt;/kbd&gt; &lt;kbd&gt;@&lt;/kbd&gt; &lt;kbd&gt;h&lt;/kbd&gt; &lt;kbd&gt;j&lt;/kbd&gt;
  and &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;x&lt;/kbd&gt; &lt;kbd&gt;@&lt;/kbd&gt; &lt;kbd&gt;a&lt;/kbd&gt; &lt;kbd&gt;j&lt;/kbd&gt;
  respectively.
&lt;/p&gt;
&lt;p&gt;
  In fact, similarly, &lt;code&gt;s-j&lt;/code&gt; too can be invoked
  with &lt;code&gt;C-x @ s j&lt;/code&gt;, i.e.
  &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;x&lt;/kbd&gt; &lt;kbd&gt;@&lt;/kbd&gt; &lt;kbd&gt;s&lt;/kbd&gt; &lt;kbd&gt;j&lt;/kbd&gt;
  but that is rarely necessary because &lt;code&gt;s-&lt;/code&gt; is often bound
  to a GUI key like the &lt;kbd&gt;command&lt;/kbd&gt; key on Apple keyboards and
  the &lt;kbd&gt;win&lt;/kbd&gt; key on Windows keyboards.
&lt;/p&gt;
&lt;p&gt;
  A practical example of a real and useful &lt;code&gt;s-&lt;/code&gt; key binding
  from vanilla Emacs is &lt;code&gt;s-u&lt;/code&gt; to invoke
  the &lt;code&gt;revert-buffer&lt;/code&gt; command that reloads a file from the
  disk.
&lt;/p&gt;
&lt;h2 id=&quot;terminal-limitations&quot;&gt;Terminal Limitations&lt;/h2&gt;
&lt;p&gt;
  The book mentions that there are some key bindings that we cannot
  use if we are running Emacs in the terminal.  That is because a
  terminal supports a very limited set of key bindings.  An example
  is &lt;code&gt;C-/&lt;/code&gt; that invokes the &lt;code&gt;undo&lt;/code&gt; command in
  GUI Emacs.  The terminal does not recognise that key sequence.
  However, the &lt;code&gt;undo&lt;/code&gt; command is also bound
  to &lt;code&gt;C-_&lt;/code&gt; and &lt;code&gt;C-x u&lt;/code&gt;, so one of these key
  sequences can be used to undo changes in terminal Emacs.
&lt;/p&gt;
&lt;h2 id=&quot;definitions-for-key-sequences&quot;&gt;Definitions for Key Sequences&lt;/h2&gt;
&lt;p&gt;
  The book provides a few definitions of key sequences that can be
  summarised as follows:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;em&gt;Key sequence&lt;/em&gt; (or just &lt;em&gt;key&lt;/em&gt;): A sequence of
    keyboard or mouse actions, e.g. &lt;code&gt;C-d&lt;/code&gt;,
    &lt;code&gt;C-M-d&lt;/code&gt;, &lt;code&gt;C-x C-f&lt;/code&gt;, &lt;code&gt;C-x 8
    P&lt;/code&gt;, &lt;code&gt;C-x&lt;/code&gt;, &lt;code&gt;C-x 8&lt;/code&gt;, etc.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;em&gt;Complete key&lt;/em&gt;: A key sequence that invokes a command, e.g.
    &lt;code&gt;C-d&lt;/code&gt;, &lt;code&gt;C-M-d&lt;/code&gt;, &lt;code&gt;C-x
    C-f&lt;/code&gt;, &lt;code&gt;C-x 8 P&lt;/code&gt;, etc.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;em&gt;Prefix key&lt;/em&gt;: A key sequence that is not a complete key,
    e.g. &lt;code&gt;C-x&lt;/code&gt;, &lt;code&gt;C-x 8&lt;/code&gt;, etc.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;key-examples&quot;&gt;Key Examples&lt;/h2&gt;
&lt;p&gt;
  The section &lt;em&gt;Keys&lt;/em&gt; presents the following examples of key
  sequences:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-d&lt;/code&gt;: Calls &lt;code&gt;delete-char&lt;/code&gt; which deletes the
    following character.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-d&lt;/code&gt;: Calls &lt;code&gt;down-list&lt;/code&gt; which moves
    forward down one level of parentheses.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-f&lt;/code&gt;: Calls &lt;code&gt;find-file&lt;/code&gt; which is used
    for editing a file.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-x 8 P&lt;/code&gt;: Insersts pilcrow, i.e. the symbol &amp;para;,
    also known as the paragraph symbol.  Here both &lt;code&gt;C-x&lt;/code&gt;
    and &lt;code&gt;8&lt;/code&gt; are prefix keys.  There are many more key
    bindings available under the &lt;code&gt;C-x 8&lt;/code&gt; prefix.  For
    example, &lt;code&gt;C-x 8 C&lt;/code&gt; inserts the copyright symbol, i.e.
    the symbol &amp;copy;.  A set of keys like this that belong to a
    particular prefix key is called a &lt;em&gt;key map&lt;/em&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-%&lt;/code&gt;: Calls &lt;code&gt;query-replace-regexp&lt;/code&gt; to
    replace text with regula-expression based matching.  Since the
    key &lt;kbd&gt;%&lt;/kbd&gt; is normally typed
    as &lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;5&lt;/kbd&gt;, this key sequence involves
    holding down 4 keys together,
    i.e. &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;alt&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;5&lt;/kbd&gt;.
    Annoyingly, this happens to be an example of a key sequence that
    does not work in terminal Emacs due to terminal limitations.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;TAB&lt;/code&gt;: Calls &lt;code&gt;indent-for-tab-command&lt;/code&gt; that
    either indents the current line or region or inserts a tab,
    depending on the context.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;&amp;lt;f1&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;f2&amp;gt;&lt;/code&gt;,
    ..., &lt;code&gt;&amp;lt;f10&amp;gt;&lt;/code&gt;: Functions keys that invoke various
    functions.  Some of these are prefix keys while others are
    complete key sequence.  For example, &lt;code&gt;&amp;lt;f1&amp;gt;&lt;/code&gt; is a
    prefix key that is available as an alternative to
    the &lt;code&gt;C-h&lt;/code&gt; prefix key.  The key sequence &lt;code&gt;C-h
    m&lt;/code&gt; shows help for the current major and minor modes and so
    does &lt;code&gt;&amp;lt;f1&amp;gt; m&lt;/code&gt;.  However, &lt;code&gt;&amp;lt;f10&amp;gt;&lt;/code&gt;
    is a complete key sequence that calls the
    command &lt;code&gt;menu-bar-open&lt;/code&gt; that shows the menu bar.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;ctrl-g&quot;&gt;C-g: Universal Bail Me Out&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;C-g&lt;/code&gt; is used to cancel a partially
  completed command.  For example, normally, the key
  sequence &lt;code&gt;M-x whitespace-mode RET&lt;/code&gt; toggles the visibility
  of whitespace in the current buffer.  However, let us say, we type
  the partial key sequence &lt;code&gt;M-x white&lt;/code&gt; and then we change
  our mind about it and want to cancel entering the command any
  further, we can simply type &lt;code&gt;C-g&lt;/code&gt; to
  run &lt;code&gt;keyboard-quit&lt;/code&gt; that signals a quit condition and
  cancels the input.
&lt;/p&gt;
&lt;p&gt;
  Similarly, say, we type &lt;code&gt;C-x&lt;/code&gt; and then we change our mind
  about it and want to cancel this partially entered key sequence, we
  can simply type &lt;code&gt;C-g&lt;/code&gt;.  The following message appears in
  the echo area but this is by design:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;C-x C-g is undefined&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Don&apos;t let that message make you feel that you did something wrong by
  entering an undefined key sequence.  Key sequences ending
  with &lt;code&gt;C-g&lt;/code&gt; have been intentionally left undefined, so
  that it can be used reliably as the universal &lt;em&gt;bail me out&lt;/em&gt;
  key sequence.
&lt;/p&gt;
&lt;p&gt;
  Now of course, nothing stops us from binding &lt;code&gt;C-x C-g&lt;/code&gt; to
  a command of our choice.  For example, the following Elisp code
  binds it to a command that prints a message:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(global-set-key (kbd &quot;C-x C-g&quot;) (lambda () (interactive) (message &quot;You typed C-x C-g&quot;)))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  However, a key binding like the above one is a very bad idea because
  such a key binding flies against Emacs conventions.  If we were to
  create a key binding like the above one, we can longer rely
  on &lt;code&gt;C-g&lt;/code&gt; to be our universal bail out command.  Key
  sequences ending with &lt;code&gt;C-g&lt;/code&gt; are best left undefined.
&lt;/p&gt;
&lt;h2 id=&quot;caps-lock-as-control&quot;&gt;Caps Lock as Control&lt;/h2&gt;
&lt;p&gt;
  The book recommends configuring our operating system to make
  the &lt;kbd&gt;caps lock&lt;/kbd&gt; key behave like &lt;kbd&gt;ctrl&lt;/kbd&gt;.  Many
  people do find this type of remapping very convenient.  Many
  discussions can be found online where people have claimed that this
  remapping has helped with overcoming repetitive strain injury (RSI).
  However, the
  article &lt;a href=&quot;https://www.emacswiki.org/emacs/MovingTheCtrlKey&quot;&gt;Moving
  the Ctrl Key&lt;/a&gt; on Emacs Wiki claims that for some people this
  remapping &lt;em&gt;causes&lt;/em&gt; RSI.
&lt;/p&gt;
&lt;p&gt;
  I use the original &lt;kbd&gt;ctrl&lt;/kbd&gt; keys as they come with the
  keyboard.  Most keyboards have two &lt;kbd&gt;ctrl&lt;/kbd&gt; keys on either
  side of the keyboard which I find very convenient.  I touch type
  while editing text, so the two &lt;kbd&gt;ctrl&lt;/kbd&gt; keys on either side
  of the keyboard turn out to be really useful.  For example, when I
  need to type &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;a&lt;/kbd&gt;, I can hold
  down &lt;kbd&gt;ctrl&lt;/kbd&gt; with the little finger of the right hand and
  type &lt;kbd&gt;a&lt;/kbd&gt; with the little finger of the left hand.
  Similarly, if I need to type &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;p&lt;/kbd&gt;, I can
  hold down &lt;kbd&gt;ctrl&lt;/kbd&gt; with the little finger of the left hand
  and type &lt;kbd&gt;p&lt;/kbd&gt; with the little finger of the right hand.
  Using the original &lt;kbd&gt;ctrl&lt;/kbd&gt; keys offers this advantage of
  distributing the usage of the &lt;kbd&gt;ctrl&lt;/kbd&gt; to both hands.
  However, some Apple keyboards provide only a single &lt;kbd&gt;ctrl&lt;/kbd&gt;
  key on the left hand side which can be quite annoying to touch
  typists.  In such keyboards, remapping the &lt;kbd&gt;caps lock&lt;/kbd&gt; key
  to behave like &lt;kbd&gt;ctrl&lt;/kbd&gt; key can indeed be more convenient.
&lt;/p&gt;
&lt;h2 id=&quot;M-x-execute-extended-command&quot;&gt;M-x: Execute Extended Command&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x&lt;/code&gt; is pronounced &lt;em&gt;mex&lt;/em&gt;, &lt;em&gt;M
  x&lt;/em&gt; or &lt;em&gt;meta x&lt;/em&gt;.  It invokes the
  command &lt;code&gt;execute-extended-command&lt;/code&gt; that brings up a
  minibuffer to read a command name and execute it.
&lt;/p&gt;
&lt;p&gt;
  When &lt;code&gt;M-x&lt;/code&gt; key sequences are presented in written form,
  often they may be written in a precise manner that includes
  the &lt;code&gt;M-x&lt;/code&gt; key sequence, then the command name and finally
  the &lt;code&gt;RET&lt;/code&gt; key in the end, e.g. &lt;code&gt;M-x lunar-phases
  RET&lt;/code&gt;.  But sometimes they may also be written without
  the &lt;code&gt;RET&lt;/code&gt; key, e.g. &lt;code&gt;M-x lunar-phases&lt;/code&gt;.
  The &lt;code&gt;RET&lt;/code&gt; key is automatically implied in the latter
  form.
&lt;/p&gt;
&lt;h2 id=&quot;interactive-commands&quot;&gt;Interactive Commands&lt;/h2&gt;
&lt;p&gt;
  The following function written in Elisp is interactive:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defun hello ()
  (interactive)
  (message &quot;hello&quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  However, the following function is not interactive:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defun hola ()
  (message &quot;hola&quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The &lt;code&gt;(interactive)&lt;/code&gt; expression declares a function as
  interactive which allows it to be called interactively
  using &lt;code&gt;M-x&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
  To see the difference between the two functions, copy both functions
  to some buffer, say, the scratch buffer and then put the cursor
  after the closing parentheses of each function and type &lt;code&gt;C-x
  C-e&lt;/code&gt; to evaluate the &lt;code&gt;defun&lt;/code&gt; expressions thus
  defining the functions.  After doing so, &lt;code&gt;M-x hello RET&lt;/code&gt;
  executes the &lt;code&gt;hello&lt;/code&gt; function and produces the &quot;hello&quot;
  message in the echo area.  However, typing &lt;code&gt;M-x hola RET&lt;/code&gt;
  produces no match for a function named &lt;code&gt;hola&lt;/code&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;m-x-execute-extended-command-for-buffer&quot;&gt;M-X: Execute Extended Command for Buffer&lt;/h2&gt;
&lt;p&gt;
  Emacs 28 introduces &lt;code&gt;M-X&lt;/code&gt; that runs the
  command &lt;code&gt;execute-extended-command-for-buffer&lt;/code&gt;.  The book
  mentions this key binding as &lt;code&gt;M-S-x&lt;/code&gt; which is in
  fact &lt;code&gt;M-X&lt;/code&gt;.  In these notes, we&apos;ll write &lt;code&gt;M-X&lt;/code&gt;
  for consistency with how this key sequence is actually defined and
  represented in Emacs (for example, note that &lt;code&gt;C-h k
  M-S-x&lt;/code&gt; shows the key as &lt;code&gt;M-X&lt;/code&gt;).
&lt;/p&gt;
&lt;p&gt;
  To see how this function works, first open a file,
  say, &lt;code&gt;foo.el&lt;/code&gt; with &lt;code&gt;C-x C-f foo.el RET&lt;/code&gt;, then
  type &lt;code&gt;M-x e RET&lt;/code&gt;.  A large list of function names
  beginning with the letter &quot;e&quot; as choices appears.  Now
  type &lt;code&gt;M-X e RET&lt;/code&gt;.  A much smaller list of choices that
  are relevant for the current Elisp buffer appears.
&lt;/p&gt;
&lt;h2 id=&quot;universal-arguments&quot;&gt;Universal Arguments&lt;/h2&gt;
&lt;p&gt;
  Universal arguments are also called &lt;em&gt;prefix arguments&lt;/em&gt;.  The
  list below presents some examples of complete key sequences where we
  apply various prefix arguments to the key sequence &lt;code&gt;C-n&lt;/code&gt;.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;C-u C-n&lt;/code&gt;: Move cursor down 4 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-u C-u C-n&lt;/code&gt;: Move cursor down 16 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-u C-u C-u C-n&lt;/code&gt;: Move cursor down 64 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-u 5 C-n&lt;/code&gt;: Move cursor down 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-u 15 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-5 C-n&lt;/code&gt;: Move cursor down 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-1 C-5 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-- C-n&lt;/code&gt;: Move cursor up 1 line.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-- C-5 C-n&lt;/code&gt;: Move cursor up 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-- C-1 C-5 C-n&lt;/code&gt;: Move cursor up 15 lines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Note that negative arguments (the last three examples above)
  reverses the direction of operation.  The digit arguments of the
  form &lt;code&gt;C-&amp;lt;digit&amp;gt;&lt;/code&gt; can also be entered
  using &lt;code&gt;M-&amp;lt;digit&amp;gt;&lt;/code&gt;
  or &lt;code&gt;C-M-&amp;lt;digit&amp;gt;&lt;/code&gt;.  Here are some examples:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;M-5 C-n&lt;/code&gt;: Move cursor down 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-M-5 C-n&lt;/code&gt;: Move cursor down 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-1 M-5 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-M-1 C-M-5 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-- C-n&lt;/code&gt;: Move cursor up 1 line.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-- M-5 C-n&lt;/code&gt;: Move cursor up 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;M-- M-1 M-5 C-n&lt;/code&gt;: Move cursor up 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-M-- C-n&lt;/code&gt;: Move cursor up 1 line.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-M-- C-M-5 C-n&lt;/code&gt;: Move cursor up 5 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-M-- C-M-1 C-M-5 C-n&lt;/code&gt;: Move cursor up 15 lines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  While entering multiple digits in a digit argument, we can also mix
  and match modifier keys as shown below, however doing so would be
  pointless and unwieldy:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;C-1 M-5 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-1 C-M-5 C-n&lt;/code&gt;: Move cursor down 15 lines.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  The reason why Emacs supports entering digit arguments or negative
  arguments with all three modifier
  combinations &lt;code&gt;C-&lt;/code&gt;, &lt;code&gt;M-&lt;/code&gt;, &lt;code&gt;C-M-&lt;/code&gt;, is
  so that we can choose a modifier that is convenient.  Usually, this
  would be the modifier we anticipate that we&apos;ll use next for the
  command we are prefixing with the digit or negative argument.  For
  example, if we are going to move forward by 5 words, then &lt;code&gt;M-5
  M-f&lt;/code&gt; is going to be more convenient than &lt;code&gt;C-5 M-f&lt;/code&gt;
  or &lt;code&gt;C-M-5 M-f&lt;/code&gt;.  To type &lt;code&gt;M-5 M-f&lt;/code&gt;, we can
  simply press and hold down &lt;kbd&gt;alt&lt;/kbd&gt;, then type &lt;kbd&gt;5&lt;/kbd&gt;
  followed by &lt;kbd&gt;f&lt;/kbd&gt; and finally release &lt;kbd&gt;alt&lt;/kbd&gt;.
  Similarly, if we are going to move forward by 5 expressions,
  then &lt;code&gt;C-M-5 C-M-f&lt;/code&gt; is going to be more convenient than
  using any other modifier for the digit argument.
&lt;/p&gt;
&lt;p&gt;
  Choosing the modifier combination for a universal argument such that
  it matches the modifier combination for the key sequence coming up
  next helps maintain good &lt;em&gt;tempo&lt;/em&gt; while typing the key
  sequences.  The book often puts emphasis on the subject of tempo in
  various chapters.
&lt;/p&gt;
&lt;p&gt;
  While discussing tempo, the book presents the example of &lt;code&gt;M--
  M-d&lt;/code&gt; which can be used to kill the previous word.  Note
  that &lt;code&gt;M-d&lt;/code&gt; kills one word forward, so &lt;code&gt;M--
  M-d&lt;/code&gt; reverses the direction of the operation and kills one
  word backward.  The book notes that &lt;code&gt;M-- M-d&lt;/code&gt; maintains
  tempo while &lt;code&gt;C-- M-d&lt;/code&gt; which does exactly the same thing
  disrupts tempo.
&lt;/p&gt;
&lt;p&gt;
  Another example that the section &lt;em&gt;Univeral Arguments&lt;/em&gt; briefly
  alludes to but does not provide a concrete example of is changing
  the case of a word that we just typed.  Here are some concrete
  examples for it:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-l&lt;/code&gt;: Convert the text from the point to the end of
    the current or next word to lower case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-u&lt;/code&gt;: Convert the text from the point to the end of
    the current or next word to upper case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-c&lt;/code&gt;: Capitalise the text from the point to the end of
    the current or next word.  Capitalisation involves changing only
    the first letter to upper case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M- M-l&lt;/code&gt;: Convert the text from the point to the
    beginning of the current or previous word to upper case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M- M-u&lt;/code&gt;: Convert the text from the point to the
    beginning of the current or previous word to upper case.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M- M-c&lt;/code&gt;: Capitalise the text from the point to the
    beginning of the current or previous word.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;discovering-and-remembering-keys&quot;&gt;Discovering and Remembering Keys&lt;/h2&gt;
&lt;p&gt;
  To get help for a prefix key, type the prefix key followed
  by &lt;code&gt;C-h&lt;/code&gt;.  Here are some examples:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;C-x C-h&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-x 8 C-h&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-x 8 &quot; C-h&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-x 8 &apos; C-h&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;C-x 8 * C-h&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Getting help for a prefix key in this manner shows an automatically
  generated list of all keys that belong to the key map associated
  with the prefix key.  Note that a key map for a prefix key may
  itself contain more prefix keys.  For example, in the above
  examples, we see that the key map for &lt;code&gt;C-x 8&lt;/code&gt; contains
  prefix keys &lt;code&gt;C-x 8 &quot;&lt;/code&gt;, &lt;code&gt;C-x 8 &apos;&lt;/code&gt;, etc.  Such
  nested prefix keys are clearly marked in the output as &quot;Prefix
  Command&quot;.
&lt;/p&gt;
&lt;h2 id=&quot;true-colour&quot;&gt;True Colour&lt;/h2&gt;
&lt;p&gt;
  There is a note with the title &lt;em&gt;Supported colors&lt;/em&gt; in the
  section &lt;em&gt;The Customize Interface&lt;/em&gt; that introduces the
  following commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x list-color-display RET&lt;/code&gt;: Display names of defined
    colours and show what they look like.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x info-apropos RET Colors on a TTY RET&lt;/code&gt;: Find an
    info page on the subject of using colours on a TTY.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Since Emacs 28, we can easily enable 24-bit colour in terminal Emacs
  by setting the environment variable
  &lt;code&gt;COLORTERM=truecolor&lt;/code&gt;.  To quickly test it out,
  first enter the following command in the terminal:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;COLORTERM=truecolor emacs -nw&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Then type the following in Emacs:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M-x list-color-display RET&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-customise-interface&quot;&gt;The Customise Interface&lt;/h2&gt;
&lt;p&gt;
  The customise interface allows us to customise two things: faces and
  options.  Here are some steps to get started with the customise
  interface:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x 2&lt;/code&gt; to split the current window into two.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x C-f foo.el RET&lt;/code&gt; to open a new Elisp file.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type some code into the file such that it contains at least one
      string, for example:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;(message &quot;hello&quot;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x o&lt;/code&gt; to go to the other window.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x customize RET&lt;/code&gt;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Move the cursor to the editable text area.  This can be done
      with motion key sequences or with the mouse.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Then type &lt;code&gt;font-lock-string-face&lt;/code&gt; and
      press &lt;kbd&gt;enter&lt;/kbd&gt;.  The customisation interface for the
      chosen face now appears in the buffer.  The message next to the
      &quot;State&quot; button shows &quot;STANDARD.&quot; which indicates that the face
      is set to its default value.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Then move the cursor to the editable text area next to the
      &quot;Foreground:&quot; label, type &lt;code&gt;blue&lt;/code&gt;.  At this point, a
      preview of blue text is shown next to the &quot;Choose&quot; button.
      However, the string in the Elisp buffer still appears in its
      previous colour.  The message next to the &quot;State&quot; button shows
      &quot;EDITED, shown value does not take effect until you set or save
      it.&quot;
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now click the &quot;Apply&quot; button to apply the new string colour.
      Alternatively, move the cursor over to &quot;Apply&quot; and
      press &lt;kbd&gt;enter&lt;/kbd&gt;.  As soon as this button is clicked, the
      string in the Elisp buffer appears blue.  The message next to
      the &quot;State&quot; button says &quot;Set for current session only.&quot;
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now click the &quot;Revert...&quot; button and then click
      &quot;Revert This Session&apos;s Customizations&quot; to revert the customisation.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now change the string colour to blue again and click &quot;Apply and
      Save&quot;.  The message next to the &quot;State&quot; button now changes to
      &quot;SAVED and set.&quot;  Then check Emacs initialisation file (such
      as &lt;code&gt;~/.emacs&lt;/code&gt;, &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;, etc.)
      and there should be a &lt;code&gt;custom-set-faces&lt;/code&gt; call added
      to the initialisation file to set the string colour to blue.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      To erase the customisation from the initialisation file, click
      &quot;Revert ...&quot; and then click &quot;Erase Customizations&quot;.  At this
      point, the customisation is no longer present in the
      initialisation file.  However, the customise interface shows a
      confusing message next to the &quot;State&quot; button, &quot;EDITED, shown
      value does not take effect until you set or save it.&quot;  Further,
      the face is set to &quot;-- Empty face --&quot; in the customisation
      interface.  To add to the confusion, the &quot;Apply and Save&quot; button
      is enabled!  Beware though!  If &quot;Apply and Save&quot; is clicked now,
      it will set &lt;code&gt;nil&lt;/code&gt; as the value for the face which
      will cause the face to appear black or white (not the default
      colour).
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      To get rid of the confusing state of the customisation buffer
      discussed in the previous point and restore the customisation
      buffer to a sane state, click &quot;Revert ...&quot; and then click either
      &quot;Undo Edits in Customization Buffer&quot; or click
      &quot;Revert This Session&apos;s Customizations&quot;.  Doing so would end up
      showing the default colour of the face in the customise
      interface.  The message next to the &quot;State&quot; button shows
      &quot;STANDARD.&quot; again.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;customise-commands&quot;&gt;Customise Commands&lt;/h2&gt;
&lt;p&gt;
  Here are some examples of complete key sequences that invoke various
  customise commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize RET&lt;/code&gt;: Display customise interface.  We
    can reach a specific item to be customised by navigating the
    groups presented and the subgroups within them.  For example, to
    customise &lt;code&gt;font-lock-string-face&lt;/code&gt;, we can naviage to
    Faces &amp;gt; Font Lock &amp;gt; Font Lock Faces &amp;gt; Font Lock String
    Face.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-browse RET&lt;/code&gt;: Create a tree browser for
    the customise hierarchy.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-option RET global-display-line-numbers
    RET&lt;/code&gt;: Customise a specific option.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-face RET font-lock-string-face RET&lt;/code&gt;:
    Customise a specific face.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-group RET faces RET&lt;/code&gt;: Customise a
    specific group.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-group RET font-lock-faces RET&lt;/code&gt;: Another
    example similar to the previous one.  This one customises
    the &lt;em&gt;Font Lock Faces&lt;/em&gt; subgroup within the &lt;em&gt;Faces&lt;/em&gt;
    group.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-mode RET&lt;/code&gt;: Customise the major mode of
    the current buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-mode RET python-mode RET&lt;/code&gt;: Customise a
    specific mode.  After the first &lt;code&gt;RET&lt;/code&gt;, a prompt to
    enter the mode appears only if the current major mode has no known
    customise group.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-u M-x customize-mode RET python-mode RET&lt;/code&gt;: Yet
    another way to customise a specific mode.  Using the prefix
    argument ensures that we are always prompted for the mode name.
    This can be useful when we want to customise a minor mode or a
    major mode that is different from the current major mode.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-themes RET&lt;/code&gt;: Display a selectable list
    of custom themes.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-customized RET&lt;/code&gt;: Customise all
    customisations set in the session but not saved.  This is very
    useful to see all unsaved customisations together at one place.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-saved RET&lt;/code&gt;: Customise all saved
    customisations.  This is very useful to see all saved
    customisations together at one place.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-changed RET&lt;/code&gt;: Customise all settings
    whose meanings have changed since the previous major Emacs
    release.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x customize-changed RET 26.1 RET&lt;/code&gt;: Customise all
    settings whose meanings have changed since a particular previous
    major Emacs release.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  One thing worth keeping in mind is that when we apply, save or
  revert customisations, only the customisations shown in the current
  buffer are applied, saved or reverted.  Here is an experiment that
  demonstrates what this means:
&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;C-x 2&lt;/code&gt; followed by &lt;code&gt;C-x C-f foo.el
      RET&lt;/code&gt; to split the current window into two and load an
      Elisp file in one window.  Then insert the following code:
    &lt;/p&gt;
    &lt;pre&gt;&lt;code&gt;(defun foo () (message &quot;hello&quot;)) ;; Demo&lt;/code&gt;&lt;/pre&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x customize RET&lt;/code&gt;, search
      for &lt;code&gt;font-lock-keyword-face&lt;/code&gt;, set its colour
      to &lt;code&gt;red&lt;/code&gt; and click &quot;Apply&quot;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Then search for &lt;code&gt;font-lock-function-name-face&lt;/code&gt;, set
      its colour to &lt;code&gt;green&lt;/code&gt; and click &quot;Apply&quot;.  At this
      point the macro name &lt;code&gt;defun&lt;/code&gt; is coloured red and the
      function name &lt;code&gt;foo&lt;/code&gt; is coloured green in the Elisp
      buffer.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now click &quot;Revert ...&quot; and then click
      &quot;Revert This Session&apos;s Customizations&quot;.  Only the colour of the
      function name reverts to the default colour.  The colour of the
      macro name remains red in the Elisp buffer.  This confirms that
      the revert operation takes only the customisations in the buffer
      into account.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Search for &lt;code&gt;font-lock-string-face&lt;/code&gt;, set its colour
      to &lt;code&gt;blue&lt;/code&gt; and click &quot;Apply and Save&quot;.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Search for &lt;code&gt;font-lock-comment-face&lt;/code&gt;, set its colour
      to &lt;code&gt;magenta&lt;/code&gt; and click &quot;Apply and Save&quot;.  Inspecting
      the Emacs initialisation file shows that only the customisations
      for the string and comment faces have been saved to the file.
      This confirms that only the customisations shown in the current
      buffer are saved.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x customize-customized RET&lt;/code&gt;.  A new buffer
      appears and shows the customisation for keyword because it was
      customised and applied but not saved.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Type &lt;code&gt;M-x customize-saved RET&lt;/code&gt;.  A new buffer appears
      and shows the customisations for string and comment because they
      were customised and saved.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;
      Now search for &lt;code&gt;font-lock-comment-face&lt;/code&gt; so that the
      customise buffer contains only the customisation entry for
      comment.  Click &quot;Revert ...&quot; and then click
      &quot;Erase Customizations&quot;.  Inspecting the Emacs initialisation
      file shows that the customisation for comment is removed but the
      customisation for string is still intact.  This confirms that
      only the customisation shown in the current buffer is erased.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;evaluating-elisp-code&quot;&gt;Evaluating Elisp Code&lt;/h2&gt;
&lt;p&gt;
  The chapter introduces two commands:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eval-buffer RET&lt;/code&gt;: Evaluate the entire buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x eval-region RET&lt;/code&gt;: Evaluates only the marked
    region.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Here are some additional key sequences that I find very useful:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-x C-e&lt;/code&gt;: Evaluate the expression before the cursor.
    This key binding is available in &lt;code&gt;global-map&lt;/code&gt;, so this
    key sequence works in any buffer.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-M-x&lt;/code&gt;: Evaluate the top-level expression on the
    cursor.  This key binding is not available in the global map.
    Therefore this key sequence works only in those major modes that
    support it.  For example, this key sequence works in Elisp buffers
    because this key binding is available
    in &lt;code&gt;emacs-lisp-mode-map&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;info&quot;&gt;Info&lt;/h2&gt;
&lt;p&gt;
  &lt;em&gt;Info&lt;/em&gt;, also known as the &lt;em&gt;Info Reader&lt;/em&gt;, is the
  documentation browser of Emacs.  Type
  &lt;code&gt;M-x info RET&lt;/code&gt; or &lt;code&gt;C-h i&lt;/code&gt; to enter
  Info.
&lt;/p&gt;
&lt;p&gt;
  The following points explain the navigation commands of Info:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    Type &lt;code&gt;[&lt;/code&gt; or &lt;code&gt;]&lt;/code&gt; to go to the previous or
    next node respectively.  Typing &lt;code&gt;]&lt;/code&gt; repeatedly is a
    nice way to go from one node to the next one without skipping any
    content.  This provides an experience that very close to reading a
    book page by page although &lt;code&gt;SPC&lt;/code&gt; (explained below)
    might be an even better way.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;l&lt;/code&gt; or &lt;code&gt;r&lt;/code&gt; to go back or forward in
    history respectively.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;n&lt;/code&gt; or &lt;code&gt;p&lt;/code&gt; to go to the previous or
    next sibling node.  This is a nice way to go from one chapter to
    next while skipping all the child nodes or to go from one section
    to the next sibling section while skipping all child subsections.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;u&lt;/code&gt; to go up one level to the parent node.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;SPC&lt;/code&gt; to scroll one screen forward at a time.
    Type &lt;code&gt;DEL&lt;/code&gt; or &lt;code&gt;S-SPC&lt;/code&gt; to scroll one screen
    backward at a time.  When a node boundary is reached, these
    commands automatically load the next or previous node.  Thus
    typing &lt;code&gt;SPC&lt;/code&gt; over and over again is a nice way to read
    all the text in a node and then go to the next node.  This
    provides an experience that is closest to reading a book paragraph
    by paragraph and page by page.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;TAB&lt;/code&gt; to go to the next cross-reference or menu
    item, i.e. anything that looks like a link.
    Type &lt;code&gt;S-TAB&lt;/code&gt; or &lt;code&gt;C-M-i&lt;/code&gt; to go back to the
    previous cross-reference or menu item.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;RET&lt;/code&gt; to follow a node reference near point.  This
    behaves like visiting a link.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;m&lt;/code&gt; to prompt for a menu item to go to.  The menu
    item near the point is automatically selected as the default
    answer to the prompt.
  &lt;/li&gt;
  &lt;li&gt;
    Type &lt;code&gt;q&lt;/code&gt; to quit Info.  The Info buffer is not killed.
    Therefore typing &lt;code&gt;C-h i&lt;/code&gt; will switch to the Info buffer
    and we can read the last node we visited again.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  To summarise, the commands &lt;code&gt;[&lt;/code&gt; and &lt;code&gt;]&lt;/code&gt; are
  great for browsing every node.  The command &lt;code&gt;SPC&lt;/code&gt;
  and &lt;code&gt;DEL&lt;/code&gt; are good for reading everything paragraph by
  paragraph and page by page.
&lt;/p&gt;
&lt;p&gt;
  There are several ways to reach a specific node of a specific
  manual.  The following points describe some of them:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    When we open the Info reader with &lt;code&gt;C-h i&lt;/code&gt; for the first
    time, immediately typing &lt;code&gt;m&lt;/code&gt; is a convenient way to
    enter a particular menu item for a manual and jump to that manual,
    e.g. type &lt;code&gt;C-h i m org RET&lt;/code&gt; to go to the Org manual.
  &lt;/li&gt;
  &lt;li&gt;
    Since Emacs 28, we can also use &lt;code&gt;C-h R&lt;/code&gt; to open a
    specific manual from any buffer, i.e. we do not need to
    type &lt;code&gt;C-h i&lt;/code&gt; first to enter Info.  For example,
    type &lt;code&gt;C-h R org RET&lt;/code&gt; to enter the Org manual.
  &lt;/li&gt;
  &lt;li&gt;
    To look up the documentation for a command, type &lt;code&gt;C-h
    F&lt;/code&gt;, e.g. &lt;code&gt;C-h F find-file RET&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    Although not mentioned in the book, a popular way to point others
    to a specific node in the manual is to provide an Elisp expression
    to visit a node.  For example, to read the node
    named &lt;code&gt;Internal Links&lt;/code&gt; in the &lt;code&gt;org&lt;/code&gt; manual,
    evaluate the expression &lt;code&gt;(info &quot;(org)Internal Links&quot;)&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    An alternative to the Elisp expression in the previous point could
    be typing &lt;code&gt;C-h R org RET m Hyperlinks RET m Internal Links
    RET&lt;/code&gt; or even &lt;code&gt;C-h R org RET m Internal Links
    RET&lt;/code&gt;.  However, the Elisp expression in the previous point
    is a convenient way to share a pointer to a specific node in a
    specific manual with other Emacs users.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;apropos&quot;&gt;Apropos&lt;/h2&gt;
&lt;p&gt;
  The following key sequences demonstrate how to use the apropos
  system:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-h a ^whitespace RET&lt;/code&gt;: Find all commands that match
    the regular expression pattern &lt;code&gt;^whitespace&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos-command RET ^whitespace RET&lt;/code&gt;: Same as
    above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos RET ^whitespace RET&lt;/code&gt;: Show all symbols
    that match the given regular expression pattern.  The matches
    include symbols defined as functions, variables and faces.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-h d cleanup-region RET&lt;/code&gt;: Show symbols whose
    documentation strings match the given regular expression pattern.
    Note that this command shows symbols
    like &lt;code&gt;whitespace-cleanup&lt;/code&gt;
    and &lt;code&gt;whitespace-report-region&lt;/code&gt; in the results because
    their documentation strings contain the
    string &lt;code&gt;&quot;cleanup-region&quot;&lt;/code&gt;.  However, it does not show
    the symbol &lt;code&gt;whitespace-cleanup-region&lt;/code&gt; because its
    documentation string does not contain this string.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos-documentation RET cleanup-region RET&lt;/code&gt;:
    Same as above.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos-library RET whitespace RET&lt;/code&gt;: Show all
    variables and functions defined by the library
    &lt;code&gt;whitespace&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos-user-option RET ^whitespace RET&lt;/code&gt;: Show
    user options that match the given pattern.  This includes
    variables that can be customised in the customise interface.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x apropos-value RET ^[^ ]*text RET&lt;/code&gt;: Show all
    symbols which have values whose printed representation matches the
    given pattern.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  By default, the apropos commands show the results in alphabetical
  order.  To sort them by scores, evaluate the following Elisp
  expression:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq apropos-sort-by-scores t)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  To sort the matches by score as well as show the scores within
  parentheses next to the matches, evaluate the following Elisp
  expression:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(setq apropos-sort-by-scores &apos;verbose)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  Note that sorting by score does not work for &lt;code&gt;C-h d&lt;/code&gt;
  (&lt;code&gt;apropos-documentation&lt;/code&gt;).
&lt;/p&gt;
&lt;h2 id=&quot;describe&quot;&gt;Describe&lt;/h2&gt;
&lt;p&gt;
  The following key sequences demonstrate the describe system:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;C-h m&lt;/code&gt;: Display documentation of current major mode
    and minor modes along with key bindings introduced by the modes.
    Mode-specific commands that are not bound to any key are not
    shown.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-h x calc RET&lt;/code&gt;: Display documentation of
    the &lt;code&gt;calc&lt;/code&gt; command.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-h f calc RET&lt;/code&gt;: Same as above.  However, note that
    while &lt;code&gt;C-h f&lt;/code&gt; can display documentation of any
    function, &lt;code&gt;C-h x&lt;/code&gt; on the other hand can display
    documentation of only those functions that are also commands.  For
    example, &lt;code&gt;C-h f string-join RET&lt;/code&gt; works fine
    but &lt;code&gt;C-h x string-join RET&lt;/code&gt; complains about no match.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-h v tab-width RET&lt;/code&gt;: Display documentation of the
    variable &lt;code&gt;tab-width&lt;/code&gt;.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;C-h k C-x C-f&lt;/code&gt;: Display documentation of the command
    bound to the key sequence &lt;code&gt;C-x C-f&lt;/code&gt;.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;links&quot;&gt;Links&lt;/h2&gt;
&lt;p&gt;
  The following list includes some links that were discussed during
  the book discussion group meetings:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://commons.wikimedia.org/wiki/File:Space-cadet.jpg&quot;&gt;Picture
      of the space-cadet keyboard with Hyper, Super and Meta keys&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://www.emacswiki.org/emacs/MovingTheCtrlKey&quot;&gt;Moving
    the Ctrl Key&lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch03.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 2: The Way of Emacs</title>
    <link href="https://susam.net/cc/mastering-emacs/ch02.html"/>
    <id>urn:uuid:71ff9dcc-499b-42f0-b65f-d12c8b3bf03c</id>
    <updated>2022-12-18T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 2 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#magpie-nest-of-shiny-things&quot;&gt;Magpie&apos;s Nest of Shiny Things&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cornerstore-of-emacs&quot;&gt;Cornerstone of Emacs&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#uptime&quot;&gt;Uptime&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#rpn-calculator&quot;&gt;RPN Calculator&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#point-and-mark&quot;&gt;Point and Mark&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#returning-to-mark&quot;&gt;Returning to Mark&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#font-locking&quot;&gt;Font Locking&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#change-major-mode&quot;&gt;Change Major Mode&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#links&quot;&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;magpie-nest-of-shiny-things&quot;&gt;Magpie&apos;s Nest of Shiny Things&lt;/h2&gt;
&lt;p&gt;
  The following commands mentioned in the book invoke some interesting
  functions:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;code&gt;M-x zone RET&lt;/code&gt;: Zone out, completely; a built-in screensaver.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x dunnet RET&lt;/code&gt;: Dungeon text adventure game.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x tetris RET&lt;/code&gt;: Tetris clone.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x lunar-phases RET&lt;/code&gt;: Lunar phases calendar.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;code&gt;M-x doctor RET&lt;/code&gt;: ELIZA chatterbot.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;cornerstore-of-emacs&quot;&gt;Cornerstone of Emacs&lt;/h2&gt;
&lt;p&gt;
  The chapter mentions the Elisp interpreter as the cornerstone of
  Emacs.  In fact, Emacs is an editor program that runs in the Elisp
  interpreter.  When we start Emacs, what really starts first is an
  Elisp interpreter.  It executes the Elisp code of an editor program.
  When that program executes, we get Emacs, the editor!
&lt;/p&gt;
&lt;p&gt;
  This behaviour is quite the opposite of how Vim and other editors
  behave.  For example, when we start Vim or Visual Studio Code, first
  the editor runs.  The editor then provides an embedded programming
  language that we can use to write plugins and extend the editor.
  For example, Vim offers VimScript to let us write code using
  VimScript and extend the functionality of Vim.  However, when we
  start Emacs, first the Elisp interpreter runs and this interpreter
  executes a program that results in Emacs, the editor.
&lt;/p&gt;
&lt;h2 id=&quot;uptime&quot;&gt;Uptime&lt;/h2&gt;
&lt;p&gt;
  The key sequence &lt;code&gt;M-x emacs-uptime RET&lt;/code&gt; shows how long
  the current instance of Emacs has been running.  Many users have
  month-long uptimes.
&lt;/p&gt;
&lt;h2 id=&quot;rpn-calculator&quot;&gt;RPN Calculator&lt;/h2&gt;
&lt;p&gt;
  To try out the calculator, type &lt;code&gt;C-x * c&lt;/code&gt; or &lt;code&gt;M-x
  calc RET&lt;/code&gt; to start the calculator.  Then to calculate
  something like, say, 1 + (2 * 3), type &lt;code&gt;1 RET 2 RET 3 RET *
  +&lt;/code&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;point-and-mark&quot;&gt;Point and Mark&lt;/h2&gt;
&lt;p&gt;
  To try out point and mark quickly, first open a buffer with some
  text in it.  For example, open a file, say, &lt;code&gt;foo.txt&lt;/code&gt;
  using the key sequence &lt;code&gt;C-x C-f foo.txt RET&lt;/code&gt;.  Make sure
  there are a few lines of text in the buffer.  If it is a new buffer,
  type some lines of text into it.  Then move the point (cursor) to
  any arbitrary place within the text.  The motion keys
  like &lt;code&gt;C-p&lt;/code&gt;, &lt;code&gt;C-n&lt;/code&gt;, &lt;code&gt;C-b&lt;/code&gt;, &lt;code&gt;C-f&lt;/code&gt;,
  etc. or simply &lt;code&gt;&amp;lt;up&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;down&amp;gt;&lt;/code&gt;,
  &lt;code&gt;&amp;lt;left&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;right&amp;gt;&lt;/code&gt;, etc. may be
  used to do this.
&lt;/p&gt;
&lt;p&gt;
  Then type &lt;code&gt;C-SPC&lt;/code&gt; (i.e. &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;space&lt;/kbd&gt;)
  to set the mark at the current position of the point.  Then move the
  point around.  Emacs should now be highlighting the region between
  the mark (set earlier) and the point.  Then type &lt;code&gt;M-w&lt;/code&gt;
  (i.e. &lt;kbd&gt;alt&lt;/kbd&gt;+&lt;kbd&gt;w&lt;/kbd&gt;) to copy the text in the selected
  region or type &lt;code&gt;C-w&lt;/code&gt; to cut the text instead.  Finally,
  move the point around again and type &lt;code&gt;C-y&lt;/code&gt; to paste the
  copied/cut text.
&lt;/p&gt;
&lt;h2 id=&quot;returning-to-mark&quot;&gt;Returning to Mark&lt;/h2&gt;
&lt;p&gt;
  Marks can also be used to remember a position in the buffer to which
  we may wish to return to later.  To try it out, first move the point
  to some place in the buffer where a mark needs to be set.  Then
  type &lt;code&gt;C-SPC C-SPC&lt;/code&gt; to set the mark without activating it
  (activating a mark causes Emacs to highlight the region as explained
  in the previous section).  Then move the point to some other place
  in the buffer.  Finally, type &lt;code&gt;C-u C-SPC&lt;/code&gt; to return to
  the marked position.
&lt;/p&gt;
&lt;h2 id=&quot;font-locking&quot;&gt;Font Locking&lt;/h2&gt;
&lt;p&gt;
  Font locking (syntax highlighting) in Emacs is made up of faces of
  properties (colour, font, size, etc.).  Type &lt;code&gt;C-u C-x =&lt;/code&gt;
  to describe the current character (the character the cursor is on).
  The output displays the face details as well.  Alternatively,
  type &lt;code&gt;M-x describe-face RET&lt;/code&gt; to describe the face of the
  character the cursor is on.
&lt;/p&gt;
&lt;h2 id=&quot;change-major-mode&quot;&gt;Change Major Mode&lt;/h2&gt;
&lt;p&gt;
  Emacs almost always sets the appropriate major mode by inspecting
  the filename or the content of the buffer.  However, sometimes it
  can be useful to set the major mode manually.  For example, consider
  a file named &lt;code&gt;foo.html&lt;/code&gt; which is open in Emacs and has
  the following text:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;h1&amp;gt;Euler&apos;s Identity&amp;lt;/h1&amp;gt;
&amp;lt;p&amp;gt;
  In mathematics, &amp;lt;em&amp;gt;Euler&apos;s identity&amp;lt;/em&amp;gt; is the
  equality

  \[
    e^{i \pi} + 1 = 0.
  \]

  Euler&apos;s identity is a special case of Euler&apos;s formula from complex
  analysis, which states that for any real number \( x, \)

  \[
    e^{ix} = \cos x + i \sin x.
  \]
&amp;lt;/p&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  This is an HTML file with some LaTeX snippets that would perhaps be
  rendered using a LaTeX rendering tool such as MathJax or KaTeX.  By
  default, when this file is opened in Emacs, the major mode is set to
  HTML+.  However, if one wants to focus on editing the embedded LaTeX
  content, it is possible to change the major mode to LaTeX by
  typing &lt;code&gt;M-x latex-mode RET&lt;/code&gt;.  To change the major mode
  back to HTML+, type &lt;code&gt;M-x mhtml-mode RET&lt;/code&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;links&quot;&gt;Links&lt;/h2&gt;
&lt;p&gt;
  The following list includes some links that were discussed during
  the book discussion group meetings:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.html&quot;&gt;Org
    as a spreadsheet system: a short introduction&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://orgmode.org/manual/The-Spreadsheet.html&quot;&gt;The
    Spreadsheet (The Org Manual)&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://blog.polaris64.net/post/emacs-using-org-mode-to-track-exercises/&quot;&gt;Using
    Org Mode to keep track of exercise&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://github.com/jkitchin/scimax&quot;&gt;scimax: An emacs
      starterkit for scientists and engineers&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://www.iro.umontreal.ca/~monnier/oclosure.pdf&quot;&gt;Open
    Closures: Disclosing lambda&apos;s inner monomaniac object!&lt;/a&gt; by
    Stefan Monnier
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;http://dantorop.info/project/emacs-animation/&quot;&gt;Emacs Lisp
    Animations&lt;/a&gt; by Dan Torop
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://github.com/karthink/org-auctex&quot;&gt;org-auctex:
      Better LaTeX previews for org-mode&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://emacsconf.org/2022/talks/eshell/&quot;&gt;Top 10 reasons
    why you should be using Eshell&lt;/a&gt; by Howard Abrams
  &lt;/li&gt;
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch02.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes from Mastering Emacs Meetups</title>
    <link href="https://susam.net/cc/mastering-emacs/notes.html"/>
    <id>urn:uuid:b379fc2e-d03e-49f9-a5bf-e576cd614f79</id>
    <updated>2022-12-17T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;h1&gt;Notes from Mastering Emacs Meetups&lt;/h1&gt;
&lt;p&gt;
  The following notes were taken while discussing the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  Note that these notes are not a good substitute for the actual book.
  Not everything in the book is captured in these notes.  While some
  points mentioned in the book are missing from the notes, there are
  also some points from the book where these notes discuss them in
  much greater detail than the book does.
&lt;/p&gt;
&lt;ul class=&quot;blog&quot;&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch01.html&quot;&gt;Notes on Mastering Emacs: Chapter 1: Introduction&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch02.html&quot;&gt;Notes on Mastering Emacs: Chapter 2: The Way of Emacs&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch03.html&quot;&gt;Notes on Mastering Emacs: Chapter 3: First Steps&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch04.html&quot;&gt;Notes on Mastering Emacs: Chapter 4: The Theory of Movement&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch05.html&quot;&gt;Notes on Mastering Emacs: Chapter 5: The Theory of Editing&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch06.html&quot;&gt;Notes on Mastering Emacs: Chapter 6: The Practicals of Emacs&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch07.html&quot;&gt;Notes on Mastering Emacs: Chapter 7: Conclusion&lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/notes.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Mastering Emacs: Chapter 1: Introduction</title>
    <link href="https://susam.net/cc/mastering-emacs/ch01.html"/>
    <id>urn:uuid:14be8e39-2d50-47bd-9fd7-7ccde69e3b05</id>
    <updated>2022-12-16T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  The following notes were taken while discussing Chapter 1 of the
  book &lt;em&gt;Mastering Emacs&lt;/em&gt; by Mickey Petersen (2022 edition) in
  &lt;a href=&quot;./&quot;&gt;book discussion group meetings&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  An index of notes for all chapters are available
  at &lt;a href=&quot;notes.html&quot;&gt;notes.html&lt;/a&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;contents&quot;&gt;Contents&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#describe-system&quot;&gt;Describe System&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#language-servers&quot;&gt;Language Servers&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#baroque-terminology&quot;&gt;Baroque Terminology&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#active-friendly-community&quot;&gt;Active, Friendly Community&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#vim-emulation-layer&quot;&gt;Vim Emulation Layer&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#links&quot;&gt;Links&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;describe-system&quot;&gt;Describe System&lt;/h2&gt;
&lt;p&gt;
  To get a glimpse of the powerful describe system available in Emacs,
  type the following key sequence: &lt;code&gt;C-h C-k C-p&lt;/code&gt;.  This
  shows the documentation associated with the keys
  sequence &lt;code&gt;C-p&lt;/code&gt; that invokes the command
  named &lt;code&gt;previous-line&lt;/code&gt; to move the cursor to the previous
  line.  The documentation mentions that this command is defined in a
  file named &lt;code&gt;simple.el&lt;/code&gt;.  Click on the file name to jump
  straight into the source code of &lt;code&gt;simple.el&lt;/code&gt; where this
  command is defined.  With Emacs, the source code of Emacs is not
  hidden from the user.  The describe system is discussed in Chapter 3
  of the book.
&lt;/p&gt;
&lt;h2 id=&quot;language-servers&quot;&gt;Language Servers&lt;/h2&gt;
&lt;p&gt;
  The two popular language server implementations for Emacs are LSP
  Mode and Eglot.  Since Emacs 29, Eglot is part of Emacs core and
  does not require installing a separate package.  It can be run with
  the key sequence &lt;code&gt;M-x eglot RET&lt;/code&gt;.
&lt;/p&gt;
&lt;h2 id=&quot;baroque-terminology&quot;&gt;Baroque Terminology&lt;/h2&gt;
&lt;p&gt;
  Some examples are:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    The term &lt;em&gt;point&lt;/em&gt; to refer to the cursor.
  &lt;/li&gt;
  &lt;li&gt;
    The term &lt;em&gt;yank&lt;/em&gt; to paste text.  What can be especially
    confusing for users with prior Vim experience is that Vim uses the
    term &lt;em&gt;yank&lt;/em&gt; to mean copying text but Emacs uses this term
    to mean pasting text.
  &lt;/li&gt;
  &lt;li&gt;
    An OS-level or desktop-environment-level window is known
    as &lt;em&gt;frame&lt;/em&gt; in Emacs.  We can split an Emacs frame into
    multiple panes and these panes are called &lt;em&gt;windows&lt;/em&gt; in
    Emacs.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  There are many more such examples.  The above examples illustrate
  the kind of surprises one should be ready for while reading Emacs
  documentation.  Fortunately, it is often possible to understand the
  meaning of these terms from the context.
&lt;/p&gt;
&lt;h2 id=&quot;active-friendly-community&quot;&gt;Active, Friendly Community&lt;/h2&gt;
&lt;p&gt;
  There are three good places to hang out with other Emacs users, seek
  help or help others with Emacs:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    Reddit &lt;a href=&quot;https://www.reddit.com/r/emacs/&quot;&gt;r/emacs&lt;/a&gt;
    community.
  &lt;/li&gt;
  &lt;li&gt;
    Libera &lt;a href=&quot;https://web.libera.chat/#emacs&quot;&gt;#emacs&lt;/a&gt;
    channel.
  &lt;/li&gt;
  &lt;li&gt;
    Matrix &lt;a href=&quot;https://app.element.io/#/room/#emacs:matrix.org&quot;&gt;#emacs&lt;/a&gt;
    room.
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  All three places appear to be quite friendly to beginners to Emacs!
&lt;/p&gt;
&lt;h2 id=&quot;vim-emulation-layer&quot;&gt;Vim Emulation Layer&lt;/h2&gt;
&lt;p&gt;
  The most popular Vim emulation layer these days is Evil Mode.  It is
  often said that the best implementation of Vim is written in Emacs
  Lisp.  Some people also claim that Evil Mode is a better Vim than
  Vim itself.  In fact, the next chapter, i.e. Chapter 3, says the
  following:
&lt;/p&gt;
&lt;blockquote&gt;
  Vim users are migrating to Emacs because, well, Emacs is often a
  better Vim than Vim.
&lt;/blockquote&gt;
&lt;h2 id=&quot;links&quot;&gt;Links&lt;/h2&gt;
&lt;p&gt;
  The following list includes some links that were discussed during
  the book discussion group meetings:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://github.com/Wilfred/helpful&quot;&gt;Helpful&lt;/a&gt; is an
    alternative to the built-in Emacs help that provides much more
    contextual information.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://github.com/xuchunyang/elisp-demos&quot;&gt;Elisp API
    Demos&lt;/a&gt; injects Elisp demo examples in &lt;code&gt;*Help*&lt;/code&gt;
    buffers.
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;https://planet.emacslife.com/&quot;&gt;Planet Emacslife&lt;/a&gt; is a
    feed aggregrator for Emacs-related blogs.
&lt;/ul&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/ch01.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Mastering Emacs Book Club</title>
    <link href="https://susam.net/cc/mastering-emacs/"/>
    <id>urn:uuid:0117f91c-775e-4235-aba0-f4ef38039015</id>
    <updated>2022-12-15T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;h1&gt;Mastering Emacs Book Club&lt;/h1&gt;
&lt;div class=&quot;highlight&quot;&gt;
  This meeting series is complete!  There are no new meetings
  happening for this book.  Go to the meetings
  &lt;a href=&quot;../&quot;&gt;main page&lt;/a&gt; to find out about current
  active meetings.
&lt;/div&gt;
&lt;p&gt;
  The following content on this page is an archive of the content as
  it appeared on the last day of meeting for this book.
&lt;/p&gt;
&lt;hr&gt;
&lt;div class=&quot;highlight&quot;&gt;
  &lt;p&gt;
    Meeting times:
    Usually at 20:00 UTC on Fri, Sat and Sun&lt;sup&gt;&amp;dagger;&lt;/sup&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Meeting duration:
    40 minutes.
  &lt;/p&gt;
  &lt;p&gt;
    Meeting link:
    &lt;a href=&quot;../../meet/&quot;&gt;susam.net/meet&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Meeting log:
    &lt;a href=&quot;log.html#upcoming&quot;&gt;72 meetings&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Reference book:
    &lt;a href=&quot;https://www.masteringemacs.org/&quot;&gt;&lt;em&gt;Mastering Emacs&lt;/em&gt;&lt;/a&gt;
    by Mickey Petersen (2022 edition)
  &lt;/p&gt;
  &lt;p&gt;
    Chapter notes:
    &lt;a href=&quot;notes.html&quot;&gt;Notes&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Club channel:
    &lt;a href=&quot;https://app.element.io/#/room/#susam:matrix.org&quot;&gt;#susam:matrix.org&lt;/a&gt; /
    &lt;a href=&quot;https://web.libera.chat/#susam&quot;&gt;#susam:libera.chat&lt;/a&gt;&lt;sup&gt;&amp;ddagger;&lt;/sup&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Mastodon:
    &lt;a href=&quot;https://mastodon.social/@susam&quot;&gt;@susam@mastodon.social&lt;/a&gt;
  &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
  &lt;small&gt;&amp;dagger; There are some exceptions to this schedule
  occasionally.  Join
  &lt;a href=&quot;https://app.element.io/#/room/#susam:matrix.org&quot;&gt;#susam:matrix.org&lt;/a&gt;
  or &lt;a href=&quot;https://web.libera.chat/#susam&quot;&gt;#susam:libera.chat&lt;/a&gt;
  or follow &lt;a href=&quot;https://mastodon.social/@susam&quot;&gt;@susam@mastodon.social&lt;/a&gt;
  to receive schedule updates.&lt;/small&gt;
&lt;/p&gt;
&lt;p&gt;
  &lt;small&gt;&amp;ddagger; You only need to join either the Matrix channel or
  the Libera channel, not both.  Both channels are bridged together.
  If you are not an active IRC user, prefer joining the Matrix channel
  because it is more convenient for someone unfamiliar with IRC.  For
  example, you can close your browser or client and your chat session
  will still stay alive on Matrix.  You can connect back the next day
  and catch up with the messages.  Doing that with IRC requires
  slightly more work such as setting up IRC bouncers etc.&lt;/small&gt;
&lt;/p&gt;
&lt;p&gt;
  The primary reference book for these meetings is
  &lt;em&gt;Mastering Emacs&lt;/em&gt; written by Mickey Petersen (2022 edition).
  PDF and EPUB copies of this book can be purchased
  from &lt;a href=&quot;https://www.masteringemacs.org/&quot;&gt;masteringemacs.org&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  In case you miss any meeting, you can find recordings of the
  meetings that occurred in the last 7 days here:
  &lt;a href=&quot;https://www.twitch.tv/susampal&quot;&gt;twitch.tv/susampal&lt;/a&gt;.
  These recordings are deleted automatically after 7 days.
&lt;/p&gt;
&lt;h2 id=&quot;faq&quot;&gt;FAQ&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;what-is-this-club-about&quot;&gt;What is this club about?&lt;/h3&gt;
    &lt;p&gt;
      This is a hobby club with a focus on mathematics and
      computation.  This club picks reading material about concepts
      and technologies that have been around for a long time and have
      an air of timelessness around them.  See the blog
      post &lt;a href=&quot;../../reading-classic-computation-books.html&quot;&gt;Reading
      Classic Computation Books&lt;/a&gt; for more details.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;who-runs-this-club&quot;&gt;Who runs this club?&lt;/h3&gt;
    &lt;p&gt;
      My name is Susam.  This is my website.  I run this club.  I host
      the book club meetings.  The last series of book club meetings I
      hosted was about &lt;a href=&quot;../iant/&quot;&gt;analytic number
      theory&lt;/a&gt;.  Some members of Libera IRC network and Hacker News
      participated in those meetings.  This new series is going to be
      about Emacs.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;what-is-planned&quot;&gt;What is planned for the next few meetings?&lt;/h3&gt;
    &lt;p&gt;
      See the &lt;a href=&quot;log.html&quot;&gt;meeting log&lt;/a&gt; which contains a
      rough plan for the next few meetings along with an archive of
      all previous meetings.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;do-i-need-to-read-in-advance&quot;&gt;Do I need to read the planned chapters/pages in advance before coming to the meetings?&lt;/h3&gt;
    &lt;p&gt;
      Not at all.  It is up to you, really.  If you would like to read
      the chapters in advance and come, that&apos;s great.  But it is not
      necessary.  We are going to discuss every page of the book in
      detail anyway.  Further, we will demonstrate the concepts we
      learn from the book live using an actual Emacs editor.  So it is
      perfectly fine if you want to join the meetings without any
      preparation.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;can-beginners-join&quot;&gt;I have little to no knowledge of Emacs.  Can I join?&lt;/h3&gt;
    &lt;p&gt;
      Yes, certainly!  The reference book selected for these meetings
      teaches Emacs from scratch.  No prior knowledge is expected from
      the participants of these meeetings.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;can-experts-join&quot;&gt;I am an expert in Emacs.  Will the meetings be useful to me?&lt;/h3&gt;
    &lt;p&gt;
      In online discussions, often people with many years of Emacs
      experience have claimed that despite their high degree of
      expertise in Emacs, the book taught them new stuff.  Whether
      attending 40-minute meetings, a few days a week, with a
      possibility of learning something new is a good return of your
      investment or not, is something you might want to consider.
    &lt;/p&gt;
    &lt;p&gt;
      Having said that, expert Emacs users and developers are very
      welcome to these meetings.  In the previous meetings on analytic
      number theory, we found that the experts often contributed to
      the meetings with new insights and interesting background
      information that helped everyone learn the reading material
      better.
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;can-i-lurk&quot;&gt;Can I just lurk in the meetings?&lt;/h3&gt;
    &lt;p&gt;
      Yes!  Lurking is absolutely fine in our club meetings.  In fact,
      most members of the club join in and stay silent throughout the
      meetings.  Only a few members talk via audio/video or chat.
      This is considered absolutely normal in this club, so please do
      not hesitate to join our meetings!
    &lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;vim-or-emacs&quot;&gt;Tell me honestly.  Which is better?  Vim or Emacs?&lt;/h3&gt;
    &lt;p&gt;
      Sorry, we don&apos;t do this here!  &lt;!-- Emacs!  Definitely Emacs!  --&gt;
    &lt;/p&gt;
  &lt;li&gt;
    &lt;h3 id=&quot;where-can-i-ask-questions&quot;&gt;I have more questions.  Where can I ask?&lt;/h3&gt;
    &lt;p&gt;
      Join the club channel
      at &lt;a href=&quot;https://app.element.io/#/room/#susam:matrix.org&quot;&gt;#susam:matrix.org&lt;/a&gt;
      or &lt;a href=&quot;https://web.libera.chat/#susam&quot;&gt;#susam:libera.chat&lt;/a&gt;
      to ask more questions.
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/mastering-emacs/"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/emacs.html&quot;&gt;#emacs&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Chapter 3: Averages of Arithmetical Functions</title>
    <link href="https://susam.net/cc/iant/ch03.html"/>
    <id>urn:uuid:eebea036-59fb-499b-b42e-a66ca8ab2a13</id>
    <updated>2021-04-09T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->

&lt;!-- Section 3.3 --&gt;
&lt;h2 id=&quot;3.3&quot;&gt;&amp;sect; 3.3: Euler&apos;s summation formula&lt;/h2&gt;
&lt;h3 id=&quot;main-idea-behind-the-proof-of-eulers-summation-formula&quot;&gt;Main idea behind the proof of Euler&apos;s summation formula&lt;/h3&gt;
&lt;p&gt;
  Important numbers in the proof:

  \[
    0, \quad
    \underbrace{[y]}_{=\,m}, \quad
    y, \quad
    \underbrace{[y] + 1}_{=\,m + 1}, \quad
    \underbrace{[x]}_{=\,k}, \quad
    x.
  \]

  Splitting the definite integral:

  \[
    \int_y^x f(t)\,dt
    = \int_{y}^{[y] + 1} f(t)\,dt
    + \underbrace{\int_{[y] + 1}^{[y] + 2} f(t)\,dt + \dots
    + \int_{[x] - 1}^{[x]} f(t)\,dt}_{=\,\int_{[y] + 1}^{[x]} f(t)\, dt}
    + \int_{[x]}^{x} f(t)\,dt.
  \]

  Using the more convenient variables \( m \) and \( k, \) we get:

  \[
    \int_y^x f(t)\,dt
    = \int_m^{m + 1} f(t)\,dt
    + \underbrace{\int_{m + 1}^{m + 2} f(t)\,dt + \dots
    + \int_{k - 1}^{k} f(t)\,dt}_{=\,\int_{m + 1}^{k} f(t)\, dt}
    + \int_{k}^{x} f(t)\,dt.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;sum-of-integrals-in-the-proof-of-eulers-summation-formula&quot;&gt;Sum of integrals in the proof Euler&apos;s summation formula&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    \int_{m + 1}^{k} [t] f&apos;(t) dt
    &amp;amp; = \int_{m + 1}^{m + 2} [t] f&apos;(t) dt
    + \int_{m + 2}^{m + 3} [t] f&apos;(t) dt + \dots
    + \int_{k - 1}^{k} [t] f&apos;(t) dt \\
    &amp;amp; =
    \begin{aligned}[t]
      &amp;amp; (m + 2) f(m + 2) - (m + 1) f(m + 1) - f(m + 2) \\
    + &amp;amp; (m + 3) f(m + 3) - (m + 2) f(m + 2) - f(m + 3) \\
      &amp;amp; \dots \\
    + &amp;amp; (k) f(k) - (k - 1) f(k - 1) - f(k)
    \end{aligned} \\
    &amp;amp; = kf(k) - (m + 1)f(m + 1) - \sum_{n=m + 2}^{k} f(n) \\
    &amp;amp; = kf(k) - mf(m + 1) - f(m + 1) - \sum_{n=m + 2}^{k} f(n) \\
    &amp;amp; = kf(k) - mf(m + 1) - \sum_{n=m + 1}^{k} f(n) \\
    &amp;amp; = kf(k) - mf(m + 1) - \sum_{y \lt n \le x} f(n).
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;equation-6-in-the-proof-of-eulers-summation-formula&quot;&gt;Equation (6) in the proof of Euler&apos;s summation formula&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    \sum_{y \lt n \le x} f(n)
    &amp;amp; = - \int_{m + 1}^k [t] f&apos;(t) \, dt + k f(k) - m f(m + 1) \\
    &amp;amp; = \begin{aligned}[t]
          &amp;amp; \left( - \int_y^{m + 1} [t] f&apos;(t) \, dt
                       - \int_{m + 1}^k [t] f&apos;(t) \, dt
                       - \int_k^x [t] f&apos;(t) \, dt \right) \\
          &amp;amp; + f(k) - m f(m + 1)
                + \int_y^{m + 1} [t] f&apos;(t) \, dt
                + \int_k^x [t] f&apos;(t) \, dt
        \end{aligned} \\
    &amp;amp; = - \int_y^x [t] f&apos;(t) \, dt + k f(k) - m f(m + 1)
            + \int_y^{m + 1} m f&apos;(t) \, dt + \int_k^x k f&apos;(t) \, dt \\
    &amp;amp; = - \int_y^x [t] f&apos;(t) \, dt + k f(k) - m f(m + 1)
            + \biggl( m f(m + 1) - m f(y) \biggr) + \biggl( k f(x) - k f(k) \biggr) \\
    &amp;amp; = - \int_y^x [t] f&apos;(t) \, dt + k f(x) - m f(y).
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;using-integration-by-parts-in-the-proof-of-eulers-summation-formula&quot;&gt;Using integration by parts in the proof of Euler&apos;s summation formula&lt;/h3&gt;
&lt;p&gt;
  Integration by parts:

  \[
    \int uv \, dt = u \int v \, dt - \int u&apos; \left( \int v \, dt \right) \, dt.
  \]

  \[
    \int_y^x t f&apos;(t) \, dt
    = \left. \left( t f(t) - \int f(t) \, dt \right) \right|_y^x
    = x f(x) - y f(y) - \int_y^x f(t) \, dt.
  \]

  Final step of the proof:

  \begin{align*}
    \sum_{y \lt n \le x} f(n)
    &amp;amp; = -\int_y^x [t] f&apos;(t) \, dt + k f(x) - m f(y) \\
    &amp;amp; = \begin{aligned}[t]
          &amp;amp; -\int_y^x [t] f&apos;(t) \, dt + [x] f(x) - [y] f(y) \\
          &amp;amp; + \underbrace{
            \left( \int_y^x t f&apos;(t) \, dt - x f(x) + y f(y)
                   + \int_y^x f(t) \, dt \right)}_{0 \text{ by above definite integral}}
        \end{aligned} \\
    &amp;amp; = \int_y^x f(t) \, dt + \int_y^x (t - [t]) f&apos;(t) \, dt
        + f(x)([x] - x) - f(y)([y] - y).
  \end{align*}
&lt;/p&gt;

&lt;!-- Section 3.4 --&gt;
&lt;h2 id=&quot;3.4&quot;&gt;&amp;sect; 3.3: Some elementary asymptotic formulas&lt;/h2&gt;
&lt;h3 id=&quot;splitting-integral-in-the-proof-of-theorem-3.2&quot;&gt;Splitting integral in the proof of Theorem 3.2&lt;/h3&gt;
&lt;p&gt;
  Splitting definite integral:

  \begin{align*}
    &amp;amp; \int_1^{\infty} f(t) \, dt = \int_1^{x} f(t) \, dt + \int_x^{\infty} f(t) \, dt \\
    &amp;amp; \iff
    \int_1^{\infty} f(t) \, dt - \int_x^{\infty} f(t) \, dt = \int_1^x f(t) \, dt.
  \end{align*}

  Solving improper integral:

  \[
    \int_x^{\infty} \frac{1}{t^2} \, dt
    = \lim_{b \to \infty} \int_x^b \frac{1}{t^2} dt
    = \lim_{b \to \infty} \frac{-1}{t} \Biggr|_x^b
    = \left( \lim_{b \to \infty} \frac{-1}{b} \right) + \frac{1}{x}
    = 0 + \frac{1}{x} = \frac{1}{x}.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;eulers-constant-in-the-proof-of-theorem-3.2-a&quot;&gt;Euler&apos;s constant in the proof of Theorem 3.2 (a)&lt;/h3&gt;
&lt;p&gt;
  Definition of Euler&apos;s constant:

  \[
    C = \lim_{n \to \infty}
        \left( 1 + \frac{1}{2} + \frac{1}{3} + \dots + \frac{1}{n} - \log n \right)
      = \lim_{x \to \infty} \left( \sum_{n \le x} \frac{1}{n} - \log x \right).
  \]

  We begin with

  \[
    \sum_{n \le x} \frac{1}{n}
    = \log x
    + \underbrace{1 - \int_1^{\infty} \frac{t - [t]}{t^2} \, dt}_{\text{We will show below that this is \( C \)}}
    + O\left( \frac{1}{x} \right).
  \]

  Rearranging the terms, we get

  \[
    \sum_{n \le x} \frac{1}{n} - \log x
    = 1 - \int_1^{\infty} \frac{t - [t]}{t^2} \, dt
    + O\left( \frac{1}{x} \right).
  \]

  Using the definition of \( C, \) we get

  \begin{align*}
    C
    &amp;amp; = \lim_{x \to \infty}
            \left( \sum_{n \le x} \frac{1}{n} - \log x \right) \\
    &amp;amp; = \lim_{x \to \infty}
            \left( 1 - \int_1^{\infty} \frac{t - [t]}{t^2} \, dt
                     + O\left( \frac{1}{x} \right) \right) \\
    &amp;amp; = 1 - \int_1^{\infty} \frac{t - [t]}{t^2} \, dt.
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;some-integrals-in-the-proof-of-theorem-3.2-b&quot;&gt;Some integrals in the proof of Theorem 3.2 (b)&lt;/h3&gt;
&lt;p&gt;
  \[
    \int_1^x \frac{dt}{t^s}
    = \frac{t^{-s + 1}}{-s + 1} \Biggr|_1^x
    = \frac{t^{1 - s}}{1 - s} \Biggr|_1^x
    = \frac{x^{1 - s}}{1 - s} - \frac{1}{1 - s}.
  \]

  \[
    \int_1^x \frac{t - [t]}{t^{s + 1}} \, dt
    =   \int_1^{\infty} \frac{t - [t]}{t^{s + 1}} \, dt
      - \int_x^{\infty} \frac{t - [t]}{t^{s + 1}} \, dt
    = \int_1^{\infty} \frac{t - [t]}{t^{s + 1}} \, dt
    + \underbrace{\frac{1}{s} O\left( x^{-s}\right)}_{\text{explained below}}.
  \]

  \[
    0
    \le \int_x^{\infty} \frac{t - [t]}{t^{s + 1}} \, dt
    \le \int_x^{\infty} \frac{1}{t^{s + 1}} \, dt
    = \frac{-1}{st^s} \Biggr|_x^\infty = \frac{1}{sx^s} = \frac{1}{s} x^{-s}.
  \]

  \begin{align*}
    \sum_{n \le x} \frac{1}{n^s}
    &amp;amp; = \int_1^x \frac{dt}{t^s}
            - s \int_1^x \frac{t - [t]}{t^{s + 1}} + 1
            - \frac{x - [x]}{x^s} \, dt \\
    &amp;amp; = \frac{x^{1 - s}}{1 - s} - \frac{1}{1 - s}
            - s \int_1^{\infty} \frac{t - [t]}{t^{s + 1}} \, dt + 1 + O(x^{-s}).
  \end{align*}
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/iant/ch03.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/number-theory.html&quot;&gt;#number-theory&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Chapter 2: Arithmetical Functions and Dirichlet Multiplication</title>
    <link href="https://susam.net/cc/iant/ch02.html"/>
    <id>urn:uuid:331435b5-4577-48ac-a5cc-727bafa58b68</id>
    <updated>2021-03-26T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->

&lt;!-- Section 2.11 --&gt;
&lt;h2 id=&quot;2.11&quot;&gt;&amp;sect; 2.11: The inverse of a completely multiplicative function&lt;/h2&gt;
&lt;h3 id=&quot;completely-multiplicative-function&quot;&gt;Completely Multiplicative Function&lt;/h3&gt;
&lt;p&gt;
  \[
    f(mn) = f(m) f(n) \text{ for all } m, n.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;identity-function-dirichlet-product&quot;&gt;Identity function (Dirichlet product)&lt;/h3&gt;
&lt;p&gt;
  \[
    I(n) =
    \begin{cases}
    1 &amp;amp; \text{ if } n = 1, \\
    0 &amp;amp; \text{ if } n \gt 1.
    \end{cases}
  \]
&lt;/p&gt;
&lt;p&gt;
  \begin{align*}
    f(n)I(n)
    &amp;amp; =
    \begin{cases}
      1 \cdot 1    &amp;amp; \text{ if } n = 1, \\
      f(n) \cdot 0 &amp;amp; \text{ if } n \gt 1.
    \end{cases} \\
    &amp;amp; = \begin{cases}
      1 &amp;amp; \text{ if } n = 1, \\
      0 &amp;amp; \text{ if } n \gt 1.
    \end{cases} \\
    &amp;amp; = I(n).
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;mobius-function-for-prime-powers&quot;&gt;M&amp;ouml;bius function for prime powers&lt;/h3&gt;
&lt;p&gt;
  \[
    \mu(1) = 1, \qquad
    \mu(p) = -1, \qquad
    \mu(p^2) = \mu(p^3) = \dots = 0.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;third-equation-in-the-proof-of-theorem-2.17&quot;&gt;Third equation in the proof of Theorem 2.17&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    \sum_{d \mid p^a} \mu(d) f(d) f\left(\frac{p^a}{d}\right)
    &amp;amp; = \sum_{d = 1, p, p^2, \dots, p^a} \mu(d) f(d) f\left(\frac{p^a}{d}\right) \\
    &amp;amp; = \begin{aligned}[t]
           &amp;amp; \mu(1) f(1) f\left( \frac{p^a}{1} \right) +
                 \mu(p) f(p) f\left( \frac{p^a}{p} \right) \\
           &amp;amp; + \underbrace{\mu(p^2) f(p^2) f\left( \frac{p^a}{p^2} \right) + \dots +
                               \mu(p^a) f(p^a) f\left( \frac{p^a}{p^a} \right)}_{=\,0}
        \end{aligned} \\
    &amp;amp; = \mu(1) f(1) f(p^a) + \mu(p) f(p) f(p^{a - 1}) \\
    &amp;amp; = f(p^a) - f(p) f(p^{a - 1}).
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;final-step-in-the-proof-of-theorem-2.17&quot;&gt;Final step in the proof of Theorem 2.17&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    f(p^a)
    &amp;amp; = f(p)f(p^{a - 1}) \\
    &amp;amp; = f(p)f(p)f(p^{a - 2}) \\
    &amp;amp; = \dots \\
    &amp;amp; = \underbrace{f(p)f(p)f(p) \dots f(p)}_{a \text{ times}} \\
    &amp;amp; = \left( f(p) \right)^a.
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;how-the-completely-multiplicative-property-works-for-prime-powers&quot;&gt;How the completely multiplicative property works for prime powers&lt;/h3&gt;
&lt;p&gt;
  \[
    f(mn) = f(m)f(n) \text{ whenever } (m, n) = 1.
  \]
&lt;/p&gt;
&lt;p&gt;
  \[
    f(p_1^{\alpha_1} p_2^{\alpha_2} \dots p_k^{\alpha_k})
    = f(p_1^{\alpha_1}) f(p_2^{\alpha_2}) \dots f(p_k^{\alpha_k}).
  \]
&lt;/p&gt;
&lt;h3 id=&quot;euler-totient-function-as-dirichlet-product&quot;&gt;Euler totient function as Dirichlet product&lt;/h3&gt;
&lt;p&gt;
  \[
    \varphi(n)
    = \sum_{d \mid n} \mu(d) \frac{n}{d}
    = \sum_{d \mid n} \mu(d) N\left(\frac{n}{d}\right)
    = (\mu * N)(n).
  \]
&lt;/p&gt;
&lt;h3 id=&quot;proof-of-theorem-2.18&quot;&gt;Proof of Theorem 2.18&lt;/h3&gt;
&lt;p&gt;
  Let \( f \) be multiplicative.  We want to show that

  \[
    \sum_{d \mid n} \mu(d) f(d) = \prod_{p \mid n} (1 - f(p)).
  \]

  Note the following:

  \[
    g(n)
    = \sum_{d \mid n} \mu(d) f(d)
    = \sum_{d \mid n} (\mu f) (d)
    u\left( \frac{n}{d} \right)
    = (\mu f) * u.
  \]

  The functions \( \mu \) and \( f \) are multiplicative.  Thus \( \mu
  f \) is multiplicative.  Thus \( (\mu f) * u \) is multiplicative.
  Therefore

  \[
    g(n) = g(p_1^{a_1} p_2^{a_2} \dots p_k^{a_k}) =
    g(p_1^{a_1}) g(p_2^{a_2}) \dots g(p_k^{a_k}).
  \]

  But

  \begin{align*}
    g(p_i^{a_i})
    &amp;amp; = \sum_{d \mid p_i^{a_i}} \mu(d) f(d) \\
    &amp;amp; = \mu(1) f(1) + \mu(p_i) f(p_i) +
             \underbrace{\mu(p_i^2) f(p_i^2) + \dots + \mu(p_i^{a_i}) f(p_i^{a_i})}_{=\,0} \\
    &amp;amp; = 1 - f(p).
  \end{align*}

  From the two equations above, we get

  \begin{align*}
    g(n)
    &amp;amp; = g(p_1^{a_1}) g(p_2^{a_2}) \dots g(p_k^{a_k}) \\
    &amp;amp; = (1 - f(p_1)) (1 - f(p_2)) \dots (1 - f(p_k)) \\
    &amp;amp; = \prod_{p \mid n} (1 - f(p)).
  \end{align*}
&lt;/p&gt;

&lt;!-- Section 2.15 --&gt;
&lt;h2 id=&quot;2.15&quot;&gt;&amp;sect; 2.15: Formal power series&lt;/h2&gt;

&lt;h3 id=&quot;product-of-formal-power-series&quot;&gt;Product of formal power series&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    A(x)B(x)
    &amp;amp; = \left( \sum_{n=0}^{\infty} a(n) x^n \right) \left( \sum_{n=0}^{\infty} b(n) x^n \right) \\
    &amp;amp; = \left( a(0) + a(1)x + a(2)x^2 + \dots \right)
            \left( b(0) + b(1)x + b(2)x^2 + \dots \right) \\
    &amp;amp; = a(0)b(0) +
            \Bigl( a(0)b(1) + a(1)b(0) \Bigr) x +
            \Bigl( a(0)b(2) + a(1)b(1) + a(2)b(0) \Bigr) x^2 + \dots \\
    &amp;amp; = \sum_{k=0}^0 a(k)b(n - k) + \sum_{k=0}^1 a(k)b(1 - k)x + \sum_{k=0}^2 a(k)b(2 - k)x^2 + \dots \\
    &amp;amp; = \sum_{n=0}^{\infty} \sum_{k=0}^n a(k)b(n - k).
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;commutativity-of-product-of-formal-power-series&quot;&gt;Commutativity of product of formal power series&lt;/h3&gt;
&lt;p&gt;
  \[
    A(x)B(x)
    = \sum_{n=0}^{\infty} \underbrace{\left\{ \sum_{k=0}^{n} a(k) b(n - k) \right\}}_{c(n)} x^n.
  \]
  \[
    B(x)A(x)
    = \sum_{n=0}^{\infty} \underbrace{\left\{ \sum_{k=0}^{n} a(n - k) b(k) \right\}}_{c&apos;(n)} x^n.
  \]
  \[
    c(3) = a(0)b(3) + a(1)b(2) + a(2)b(1) + a(3)b(0).
  \]
  \[
    c&apos;(3) = a(3)b(0) + a(2)b(1) + a(1)b(2) + a(0)b(3).
  \]
&lt;/p&gt;
&lt;h3 id=&quot;distributivity-of-multiplication-over-addition-in-formal-power-series&quot;&gt;Distributivity of multiplication over addition in formal power series&lt;/h3&gt;
&lt;p&gt;
  \[
    A(x)\Bigl(B(x) + C(x)\Bigr) = A(x)B(x) + A(x)C(x).
  \]
  \[
    \Bigl(B(x) + C(x)\Bigr)A(x) = B(x)A(x) + C(x)A(x).
  \]

  \begin{align*}
    A(x)\Bigl(B(x) + C(x)\Bigr)
    &amp;amp; = \left( \sum_{n=0}^{\infty} a(n) x^n \right)
        \left( \sum_{n=0}^{\infty} \Bigl( b(n) + c(n) \Bigr) x^n \right) \\
    &amp;amp; = \sum_{n=0}^{\infty} \Bigl\{ \sum_{k=0}^{n} a(k) \Bigl( b(n - k) + c(n - k) \Bigr) \Bigr\} x^n.
  \end{align*}

  \[
    A(x)B(x) + A(x)C(x)
    = \sum_{n=0}^{\infty} \sum_{k=0}^n a(k) b(n - k) x^n +
    \sum_{n=0}^{\infty} \sum_{k=0}^n a(k) c(n - k) x^n.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;determining-coefficients-of-inverse-of-power-series&quot;&gt;Determining coefficients of inverse of power series&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    A(x)B(x)
    &amp;amp; = \sum_{n=0}^{\infty} \Bigl( \sum_{k=0}^{n} a(k) b(n - k) \Bigr) x^n \\
    &amp;amp; = \Bigl( a(0) b(0) \Bigr) x^0 +
            \Bigl( a(0) b(1) + a(1) b(0) \Bigr) x^1 +
            \Bigl( a(0) b(2) + a(1) b(1) + a(2) b(0) \Bigr) x^2 +
            \dots \\
    &amp;amp; = 1.
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;inverse-of-geometric-series&quot;&gt;Inverse of geometric series&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    A(x) &amp;amp; = 1 + ax + (ax)^2 + (ax)^3 + \dots, \\
    B(x) &amp;amp; = 1 - ax.
  \end{align*}

  \begin{align*}
    A(x) B(x)
    &amp;amp; = \Bigl( 1 + ax + (ax)^2 + (ax)^3 + \dots \Bigr) (1 - ax) \\
    &amp;amp; = \Bigl( 1 + ax + (ax)^2 + (ax)^3 + \dots \Bigr) -
            \Bigl( (ax) - (ax)^2 - (ax)^3 - \dots \Bigr)
    = 1.
  \end{align*}
&lt;/p&gt;

&lt;!-- Section 2.16 --&gt;
&lt;h2 id=&quot;2.16&quot;&gt;&amp;sect; 2.16: The Bell series of an arithmetical function&lt;/h2&gt;
&lt;h3 id=&quot;bell-series-of-f-modulo-p&quot;&gt;Bell series of \( f \) modulo \( p \)&lt;/h3&gt;
&lt;p&gt;
  \[
    f_p(x)
    = \sum_{n=0}^{\infty} f(p^n) x^n
    = f(1) + f(p) x + f(p^2) x^2 + f(p^3) x^3 + \dots
  \]
&lt;/p&gt;
&lt;h3 id=&quot;theorem-2.24-uniqueness-theorem&quot;&gt;Theorem 2.24: Uniqueness theorem&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    f(n)
    &amp;amp; = f(p_1^{a_1} p_2^{a_2} \dots p_k^{a_k})
    = f(p_1^{a_1}) f(p_2^{a_2}) \dots f(p_k^{a_k}), \\ \\

    g(n)
    &amp;amp; = g(p_1^{a_1} p_2^{a_2} \dots p_k^{a_k})
    = g(p_1^{a_1}) g(p_2^{a_2}) \dots g(p_k^{a_k}).  \\
  \end{align*}
&lt;/p&gt;
&lt;h3 id=&quot;example-1-mobius-funcion&quot;&gt;Example 1: Möbius function&lt;/h3&gt;
&lt;p&gt;
  \begin{align*}
    \mu_p(x) = \sum_{n=0}^{\infty} \mu(p^n) x^n
    &amp;amp; = \mu(1) + \mu(p) x + \mu(p^2) x^2 + \mu(p^3) x^3 + \dots \\
    &amp;amp; = 1 - x + 0 + 0 + \dots \\
    &amp;amp; = 1 - x.
  \end{align*}
&lt;/p&gt;

&lt;!-- Section 2.17 --&gt;
&lt;h2 id=&quot;2.17&quot;&gt;&amp;sect; 2.17: Bell series and Dirichlet multiplication&lt;/h2&gt;
&lt;h3 id=&quot;power-series-multiplication&quot;&gt;Power series multiplication&lt;/h3&gt;
&lt;p&gt;
  \[
    A(x) = \sum_{n=0}^{\infty} a(n) x^n, \quad
    B(x) = \sum_{n=0}^{\infty} b(n) x^n, \quad
    A(x) B(x) = \sum_{n=0}^{\infty} \underbrace{\sum_{k=0}^n a(k) b(n - k)}_{c(n)} x^n.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;relationship-with-dirichlet-multiplication&quot;&gt;Relationship with Dirichlet multiplication&lt;/h3&gt;
&lt;p&gt;
  \[
    (f * g)_p(x) = f_p(x) g_p(x).
  \]

  \[
    f_p(x) = \sum_{n=0}^{\infty} f(p^n) x^n, \quad
    g_p(x) = \sum_{n=0}^{\infty} g(p^n) x^n, \quad
    f_p(x) g_p(x) = \sum_{n=0}^{\infty} \sum_{k=0}^n f(p^k) g(p^{n-k}) x^n.
  \]

  \[
    h = f * g = \sum_{d \mid n} f(d) g\left( \frac{n}{d} \right).
  \]

  \[
    h_p(x)
    = \sum_{n=0}^{\infty} h(p^n) x^n
    = \sum_{n=0}^{\infty} \sum_{d \mid p^n} f(d) g\left( \frac{p^n}{d} \right) x^n
    = \sum_{n=0}^{\infty} \sum_{k=0}^{n} f(p^k) g(p^{n-k}) x^n.
  \]
&lt;/p&gt;
&lt;p&gt;
  Some steps of Example 1:

  \[
    I(n)= \mu^2(n) * \lambda(n)
    \implies I_p(x) = \mu_p^2(x) \lambda_p(x)
  \]

  \[
    I_p(x) = \mu_p^2(x) \lambda_p(x)
    \iff 1 = \mu_p^2(x) \cdot \frac{1}{1 + x}
    \iff \mu_p^2(x) = 1 + x.
  \]
&lt;/p&gt;
&lt;p&gt;
  Some steps of Example 2:

  \begin{align*}
    \frac{1}{1 - p^{\alpha}} \cdot \frac{1}{1 - x}
    &amp;amp; = \frac{1}{1 - x - p^{\alpha}x + p^{\alpha}x^2} \\
    &amp;amp; = \frac{1}{1 - (1 + p^{\alpha})x + p^{\alpha}x^2} \\
    &amp;amp; = \frac{1}{1 - \sigma_{\alpha}(p)x + p^{\alpha}x^2}.
  \end{align*}

  Note that \( \sigma_{\alpha}(n) = \sum_{d\,\mid\,n} d^{\alpha}, \) so

  \[
    \sigma_{\alpha}(p)
    = \sum_{d\,\mid\,p} d^{\alpha}
    = 1^{\alpha} + p^{\alpha}
    = 1 + p^{\alpha}.
  \]
&lt;/p&gt;
&lt;p&gt;
  Some steps of Example 3: Showing That \( f(n) = 2^{\nu(n)} \) is
  multiplicative:

  \[
    f(n) = 2^{\nu(n)}.
  \]

  \[
    f(p_1^{\alpha_1} p_2^{\alpha_2} \dots p_k^{\alpha_k})
    = 2^{\nu(p_1^{\alpha_1} p_2^{\alpha_2} \dots p_k^{\alpha_k})} = 2^k.
  \]

  \[
    f(p_1^{\alpha_1}) f(p_2^{\alpha_2}) \dots f(p_k^{\alpha_k})
    = 2^{\nu(p_1^{\alpha_1})} 2^{\nu(p_2^{\alpha_2})} \dots 2^{\nu(p_k^{\alpha_k})}
    = \underbrace{2 \cdot 2 \cdot \dots \cdot 2}_{k \text{ times}}.
    = 2^k.
  \]
&lt;/p&gt;

&lt;!-- Section 2.18 --&gt;
&lt;h2 id=&quot;2.18&quot;&gt;&amp;sect; 2.18: Derivatives of arithmetical functions&lt;/h2&gt;
&lt;h3 id=&quot;ordinary-derivative&quot;&gt;Ordinary derivative&lt;/h3&gt;
&lt;p&gt;
  \[
    (f + g)&apos; = f&apos; + g&apos;.
  \]

  \[
    (fg)&apos; = f&apos;g + fg&apos;.
  \]

  \[
    \left( f^{-1} \right)&apos; = \frac{-f&apos;}{f^2} = -f&apos; \cdot (f \cdot f)^{-1}.
  \]
&lt;/p&gt;
&lt;h3 id=&quot;similarities-in-special-derivative&quot;&gt;Similarities in special derivative&lt;/h3&gt;
&lt;p&gt;
  \[
    f&apos;(n) = f(n) \log n.
  \]

  \[
    (f + g)&apos; = f&apos; + g&apos;.
  \]

  \[
    (f * g)&apos; = f&apos; * g + f * g&apos;.
  \]

  \[
    \left( f^{-1} \right)&apos; = -f&apos; * (f * f)^{-1}.
  \]
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/iant/ch02.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/number-theory.html&quot;&gt;#number-theory&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Notes on Introduction to Analytic Number Theory</title>
    <link href="https://susam.net/cc/iant/notes.html"/>
    <id>urn:uuid:541eab4a-e243-4115-9728-36327d8b7913</id>
    <updated>2021-03-07T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;h1&gt;Notes on Introduction to Analytic Number Theory&lt;/h1&gt;
&lt;p&gt;
  This page contains an archive of notes from the book
  &lt;em&gt;Introduction to Analytic Number Theory&lt;/em&gt; by Tom M. Apostol
  (1976).
&lt;/p&gt;
&lt;p&gt;
  Note that this set of notes is not meant to be a systematic
  exposition of analytic number theory.  Instead this is just a
  collection of examples that illustrate some of the theorems in the
  reference textbook and intermediate steps that are not explicitly
  expressed in the book.  These boards were used to aid the
  discussions during book discussion meetings.  As a result, the
  content of these boards is informal in nature and is not intended to
  be a substitute for the book or the actual discussion meetings.
&lt;/p&gt;
&lt;p&gt;
  If you find any mistakes in the content of the board files, please
  &lt;a href=&quot;https://github.com/susam/susam.net/issues/new&quot;&gt;create a new
  issue&lt;/a&gt; or &lt;a href=&quot;https://github.com/susam/susam.net&quot;&gt;send a
  pull request&lt;/a&gt;.
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch02.html&quot;&gt;Notes on Chapter 2: Arithmetical Functions and Dirichlet Multiplication&lt;/a&gt;
  &lt;/li&gt;
  &lt;!--
  &lt;li&gt;
    &lt;a href=&quot;ch03.html&quot;&gt;Notes on Chapter 3: Averages of Arithmetical Functions&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch04.html&quot;&gt;Notes on Chapter 4: Some Elementary Theorems on the Distribution of Prime Numbers&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch05.html&quot;&gt;Notes on Chapter 5: Congruences&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch06.html&quot;&gt;Notes on Chapter 6: Finite Abelian Groups and Their Characters&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch07.html&quot;&gt;Notes on Chapter 7: Dirichlet&apos;s Theorem on Primes in Arithmetical Progressions&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch08.html&quot;&gt;Notes on Chapter 8: Periodic Arithmetical Functions and Gauss Sums&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch09.html&quot;&gt;Notes on Chapter 9: Quadratic Residues and the Quadratic Reciprocity Law&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch10.html&quot;&gt;Notes on Chapter 10: Primitive Roots&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch11.html&quot;&gt;Notes on Chapter 11: Dirichlet Series and Euler Products&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch12.html&quot;&gt;Notes on Chapter 12: The Functions and \( \zeta(s) \) and \( L(s, \chi) \)&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch13.html&quot;&gt;Notes on Chapter 13: Analytic Proof of Prime Number Theorem&lt;/a&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;ch14.html&quot;&gt;Notes on Chapter 14: Partitions&lt;/a&gt;
  &lt;/li&gt;
  --&gt;
&lt;/ul&gt;
&lt;p&gt;
  More notes coming soon!  We have all the meeting notes safely
  archived.  Just need to format them and publish them here.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/iant/notes.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/number-theory.html&quot;&gt;#number-theory&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Introduction to Analytic Number Theory Book Discussions</title>
    <link href="https://susam.net/cc/iant/"/>
    <id>urn:uuid:03bb0d52-4dbc-4e91-a612-1624345bd60c</id>
    <updated>2021-03-05T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;h1&gt;Introduction to Analytic Number Theory Book Discussions&lt;/h1&gt;
&lt;div class=&quot;highlight&quot;&gt;
  This meeting series is complete!  There are no new meetings
  happening for this book.  Go to the meetings
  &lt;a href=&quot;../&quot;&gt;main page&lt;/a&gt; to find out about current
  active meetings.
&lt;/div&gt;
&lt;p&gt;
  The following content on this page is an archive of the content as
  it appeared on the last day of meeting for this book.
&lt;/p&gt;
&lt;hr&gt;
&lt;div class=&quot;highlight&quot;&gt;
  &lt;p&gt;
    Meeting time: 17:00 UTC from Tuesday to Friday,
    usually.&lt;sup&gt;&amp;dagger;&lt;/sup&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Meeting duration: 40 minutes.
  &lt;/p&gt;
  &lt;p&gt;
    Meeting link: &lt;a href=&quot;https://bit.ly/spzoom2&quot;&gt;bit.ly/spzoom2&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Meeting log: &lt;a href=&quot;log.html&quot;&gt;120 meetings&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Reference Book: &lt;a href=&quot;https://www.springer.com/gp/book/9780387901633&quot;&gt;&lt;em&gt;Introduction
    to Analytic Number Theory&lt;/em&gt;&lt;/a&gt; by Tom M. Apostol (1976)
  &lt;/p&gt;
  &lt;p&gt;
    Chapter notes: &lt;a href=&quot;notes.html&quot;&gt;Notes&lt;/a&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Started: 05 Mar 2021
  &lt;/p&gt;
  &lt;p&gt;
    Ended: 01 Oct 2021
  &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
  &lt;small&gt;&amp;dagger; There are some exceptions to this schedule
  occasionally.  &lt;a href=&quot;../#join&quot;&gt;Join our channel&lt;/a&gt; to
  receive schedule updates.&lt;/small&gt;
&lt;/p&gt;
&lt;p&gt;
  The primary reference book for these meetings is
  &lt;em&gt;Introduction to Analytic Number Theory&lt;/em&gt; written by Tom
  M. Apostol.  Admittedly, the book is quite expensive but you may
  find a relatively cheap paperback (softcover) copy on some websites.
&lt;/p&gt;
&lt;p&gt;
  These meetings are hosted by Susam and attended by some members of
  &lt;code&gt;#math&lt;/code&gt; and &lt;code&gt;#algorithms&lt;/code&gt; channels of Libera
  IRC network as well as by some members
  from &lt;a href=&quot;https://news.ycombinator.com/&quot;&gt;Hacker News&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
  You are welcome to join these meetings anytime.  If you are
  concerned that the meetings may not make sense if you join when we
  are in the middle of a chapter, please free to talk to us about it
  in the &lt;a href=&quot;../#join&quot;&gt;group channel&lt;/a&gt;.  I can
  recommend the next best time to begin joining the meetings.
  Usually, it would be when we begin reading a new section or chapter
  that is fairly self-contained and does not depend a lot on material
  we have read previously.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/cc/iant/"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/number-theory.html&quot;&gt;#number-theory&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/meetup.html&quot;&gt;#meetup&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Pointers in K&amp;R</title>
    <link href="https://susam.net/pointers-in-knr.html"/>
    <id>urn:uuid:c2c4bac5-9ec6-483b-aa3e-f212c158e82d</id>
    <updated>2020-09-05T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  I learnt C from the book &lt;em&gt;The C Programming Language, 2nd
  ed.&lt;/em&gt; (K&amp;amp;R) written by Brian Kernighan and Dennis Ritchie
  about 18 years ago during my engineering studies.  The subject of
  pointers was generally believed to be scary among fellow students
  and many of them bought pretty fat books that were dedicated solely
  to the topic of pointers.  However, when I reached Chapter 5 of the
  book , I found that it did a wonderful job at teaching pointers in
  merely 34 pages.  The chapter opens with this sentence:
&lt;/p&gt;
&lt;blockquote&gt;
  A pointer is a variable that contains the address of a variable.
&lt;/blockquote&gt;
&lt;p&gt;
  The exact point at which the whole topic of pointers became crystal
  clear was when I encountered this sentence in &amp;sect; 5.3 Pointers
  and Arrays:
&lt;/p&gt;
&lt;blockquote&gt;
  Rather more surprising, at first sight, is the fact that a reference
  to &lt;code&gt;a[i]&lt;/code&gt; can also be written as &lt;code&gt;*(a+i)&lt;/code&gt;.
&lt;/blockquote&gt;
&lt;p&gt;
  Indeed, it was easy to confirm that by compiling and running the
  following program:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

int main() {
    int a[] = {2, 3, 5, 7, 11};
    printf(&quot;%d\n&quot;, *(a + 2));
    printf(&quot;%d\n&quot;, a[2]);
    printf(&quot;%d\n&quot;, 2[a]);
    return 0;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  The output is:
&lt;/p&gt;
&lt;pre&gt;&lt;samp&gt;5
5
5&lt;/samp&gt;&lt;/pre&gt;
&lt;p&gt;
  C was the first serious programming language I was learning back
  then and at that time, I don&apos;t think I could have come across a
  better book than K&amp;amp;R to learn this subject.  Like many others, I
  too feel that this book is a model for technical writing.  I wish
  more technical books were written like this with clear presentation
  and concise treatment.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/pointers-in-knr.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/c.html&quot;&gt;#c&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/programming.html&quot;&gt;#programming&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>Leap Year Test in K&amp;R</title>
    <link href="https://susam.net/leap-year-test-in-knr.html"/>
    <id>urn:uuid:fafe7979-e9d4-4b0e-affc-a2e62b7b5a27</id>
    <updated>2020-02-29T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  About 18 years ago, while learning to program a computer using C, I
  learnt the following test for leap year from the book &lt;em&gt;The C
  Programming Language, 2nd ed.&lt;/em&gt; (K&amp;amp;R) written by Brian
  Kernighan and Dennis Ritchie.  Section 2.5 (Arithmetic Operators) of
  the book uses the following test:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(year % 4 == 0 &amp;amp;&amp;amp; year % 100 != 0) || year % 400 == 0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
  It came as a surprise to me.  Prior to reading this, I did not know
  that centurial years are not leap years except for those centurial
  years that are also divisible by 400.  Until then, I always
  incorrectly thought that all years divisible by 4 are leap years.  I
  have witnessed only one centurial year, namely the year 2000, which
  happens to be divisible by 400.  As a result, the year 2000 proved
  to be a leap year and my misconception remained unchallenged for
  another few years until I finally came across the above test in
  K&amp;amp;R.
&lt;/p&gt;
&lt;p&gt;
  Now that I understand that centurial years are not leap years unless
  divisible by 400, it is easy to confirm this with the
  Unix &lt;code&gt;cal&lt;/code&gt; command.  Enter &lt;code&gt;cal 1800&lt;/code&gt;
  or &lt;code&gt;cal 1900&lt;/code&gt; and we see calendars of non-leap years.
  But enter &lt;code&gt;cal 2000&lt;/code&gt; and we see the calendar of a leap
  year.
&lt;/p&gt;
&lt;p&gt;
  By the way, the following leap year test is equally effective:
&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;year % 4 == 0 &amp;amp;&amp;amp; (year % 100 != 0 || year % 400 == 0)&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;
  &lt;strong&gt;Update:&lt;/strong&gt; In the
  &lt;a href=&quot;comments/leap-year-test-in-knr.html&quot;&gt;comments section&lt;/a&gt;,
  Thaumasiotes explains why both tests work.  Let me take the liberty
  of elaborating that comment further with a truth table.  We use the
  notation &lt;code&gt;A&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt; and &lt;code&gt;C&lt;/code&gt;
  respectively, for the three comparisons in the above expressions.
  Then the two tests above can be expressed as the following boolean
  expressions:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;(A &amp;amp;&amp;amp; B) || C&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;A &amp;amp;&amp;amp; (B || C)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
  Now normally these two boolean expressions are not equivalent.  The
  truth table below shows this:
&lt;/p&gt;
&lt;table class=&quot;grid center textcenter&quot;&gt;
  &lt;tr&gt;
    &lt;th&gt;&lt;code&gt;A&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;B&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;C&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;(A &amp;amp;&amp;amp; B) || C&lt;/code&gt;&lt;/th&gt;
    &lt;th&gt;&lt;code&gt;A &amp;amp;&amp;amp; (B || C)&lt;/code&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;F&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
    &lt;td&gt;T&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;
  We see that there are two cases where the last two columns differ.
  This confirms that the two boolean expressions are not equivalent.
  The two cases where the boolean expressions yield different results
  occur when &lt;code&gt;A&lt;/code&gt; is false and &lt;code&gt;C&lt;/code&gt; is true.  But
  these cases are impossible!  If &lt;code&gt;A&lt;/code&gt; is false
  and &lt;code&gt;C&lt;/code&gt; is true, it means we have &lt;code&gt;year % 4 !=
  0&lt;/code&gt; and &lt;code&gt;year % 400 == 0&lt;/code&gt; which is impossible.
&lt;/p&gt;
&lt;p&gt;
  If &lt;code&gt;year % 400 == 0&lt;/code&gt; is true, then &lt;code&gt;year % 4 ==
  0&lt;/code&gt; must also hold true.  In other words, if &lt;code&gt;C&lt;/code&gt; is
  true, &lt;code&gt;A&lt;/code&gt; must also be true.  Therefore, the two cases
  where the last two columns differ cannot occur and may be ignored.
  The last two columns are equal in all other cases and that is why
  the two tests we have are equivalent.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/leap-year-test-in-knr.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/c.html&quot;&gt;#c&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/programming.html&quot;&gt;#programming&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>ADAC and HE Puzzles from GEB</title>
    <link href="https://susam.net/adac-and-he-puzzles-from-geb.html"/>
    <id>urn:uuid:284dbf6c-422c-43a1-bbc1-417e60733706</id>
    <updated>2009-05-16T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  I have been reading
  &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/G%C3%B6del,_Escher,_Bach&quot;
  class=&quot;title&quot;&gt;G&amp;ouml;del, Escher, Bach: An Eternal Golden
  Braid&lt;/a&gt;&lt;/em&gt; by Douglas R. Hofstadter for a few weeks.  The book
  follows an interesting format of alternating between chapters and
  dialogues between imaginary charaters.  In the words of the author:
&lt;/p&gt;
&lt;blockquote&gt;
  The long and the short of it is that I eventually decided - but this
  took many months - that the optimal structure would be a strict
  alternation between chapters and dialogues.  Once that was clear,
  then I had the joyous task of trying to pinpoint the most crucial
  ideas that I wanted to get across to my readers and then somehow
  embodying them in both the form and the content of fanciful, often
  punning dialogues between Achilles and the Tortoise (plus a few new
  friends).
&lt;/blockquote&gt;
&lt;p&gt;
  After the second chapter (Chapter II: Meaning and Form in
  Mathematics) there is a dialogue between Achilles and the Tortoise
  on telephone.  The title of the dialogue is &lt;em&gt;Sonata for
  Unaccompanied Achilles&lt;/em&gt;.  The text shows the transcript of only
  one end of the call, only what Achilles speaks.  The Tortoise is at
  the far end of the call.  The sentences spoken by the Tortoise at
  the other end are not present in the text.  This makes the reading
  experience very interesting as we keep guessing about what is going
  on at the other end.
&lt;/p&gt;
&lt;p&gt;
  It starts in this manner:
&lt;/p&gt;
&lt;blockquote&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Hello, this is Achilles.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Oh, hello, Mr. T. How are you?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; A torticollis?  Oh, I&apos;m sorry to hear it.  Do you
  have any idea what caused it?
&lt;/blockquote&gt;
&lt;p&gt;
  As the dialogue proceeds, they share a few puzzles.  Here is the
  first one from the Tortoise.
&lt;/p&gt;
&lt;blockquote&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; A word with the letters &apos;A&apos;, &apos;D&apos;, &apos;A&apos;, &apos;C&apos;
  consecutively inside it &amp;hellip; Hmm &amp;hellip; What about
  &quot;abracadabra&quot;?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; True, &quot;ADAC&quot; occurs backwards, not forwards, in
  that word.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Hours and hours?  It sounds like I&apos;m in for a
  long puzzle, then.  Where did you hear this infernal riddle?
&lt;/blockquote&gt;
&lt;p&gt;
  Here is the second puzzle from Achilles:
&lt;/p&gt;
&lt;blockquote&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Say, I once heard a word puzzle a little bit like
  this one.  Do you want to hear it?  Or would it just drive you
  further into distraction?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; I agree - can&apos;t do any harm.  Here it is: What&apos;s
  a word that begins with the letters &quot;HE&quot; and also ends with
  &quot;HE&quot;?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Very ingenious - but that&apos;s almost cheating.
  It&apos;s certainly not what I meant!&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Of course you&apos;re right - it fulfills the
  conditions, but it&apos;s a sort of &quot;degenerate&quot; solution.  There&apos;s
  another solution which I had in mind.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; That&apos;s exactly it!  How did you come up with it
  so fast?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; So here&apos;s a case where having a headache actually
  might have helped you, rather than hindering you.  Excellent!  But
  I&apos;m still in the dark on your &quot;ADAC&quot; puzzle.
&lt;/blockquote&gt;
&lt;p&gt;
  &lt;em&gt;If you want to think about these puzzles, this is a good time to
  pause and think about them.  There are spoilers ahead.&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
  It did not take much time for me to solve the puzzle because I
  cheated with the word list file available on Linux distributions.
  Here is what I found with my Debian 5.0 (lenny) system:
&lt;/p&gt;
&lt;pre&gt;&lt;samp&gt;$ &lt;kbd&gt;grep &apos;adac&apos; /usr/share/dict/words&lt;/kbd&gt;
headache
headache&apos;s
headaches
$ &lt;kbd&gt;grep &apos;^he.*he$&apos; /usr/share/dict/words&lt;/kbd&gt;
headache
heartache&lt;/samp&gt;&lt;/pre&gt;
&lt;p&gt;
  The answers to both puzzles seem to be &quot;HEADACHE&quot;.  Take another
  look at the last sentence in the dialogue above.  It makes sense now
  as Achilles says that having a &lt;em&gt;headache&lt;/em&gt; might have helped
  the Tortoise.
&lt;/p&gt;
&lt;p&gt;
  Later in the dialogue the Tortoise offers &lt;em&gt;figure&lt;/em&gt; and
  &lt;em&gt;ground&lt;/em&gt; as hints to the &quot;ADAC&quot; puzzle.
&lt;/p&gt;
&lt;blockquote&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Well, normally I don&apos;t like hints, but all right.
  What&apos;s your hint?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; I don&apos;t know what you mean by &quot;figure&quot; and
  &quot;ground&quot; in this case.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Certainly I know Mosaic II!  I know ALL of
  Escher&apos;s works.  After all, he&apos;s my favorite artist.  In any case,
  I&apos;ve got a print of Mosaic II hanging on my wall, in plain view from
  here.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Yes, I see all the black animals.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Yes, I also see how their &quot;negative&quot; space -
  what&apos;s left out - defines the white animals.&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; So THAT&apos;s what you mean by &quot;figure&quot; and &quot;ground&quot;.
  But what does that have to do with the &quot;ADAC&quot; puzzle?&lt;br&gt;
  &lt;em&gt;Achilles:&lt;/em&gt; Oh, this is too tricky to me.  I think I&apos;M
  starting to get a headache.
&lt;/blockquote&gt;
&lt;p&gt;
  The famous painting discussed in the dialogue can be found
  here: &lt;a href=&quot;https://www.wikiart.org/en/m-c-escher/mosaic-ii&quot;&gt;https://www.wikiart.org/en/m-c-escher/mosaic-ii&lt;/a&gt;.
  We can see how the black animals form the &lt;em&gt;figure&lt;/em&gt; (the
  positive space) and how the background or &lt;em&gt;ground&lt;/em&gt; (the
  negative space) beautifully fits all the white animals.
&lt;/p&gt;
&lt;p&gt;
  The &lt;em&gt;figure&lt;/em&gt; and &lt;em&gt;ground&lt;/em&gt; in hints make sense now.
  The first puzzle has &quot;ADAC&quot; in the question.  Let us consider &quot;ADAC&quot;
  as the figure or the positive space.  If we remove &quot;ADAC&quot; from
  &quot;HEADACHE&quot;, we are left with the ground or negative space, which
  consists of &quot;HE&quot; and &quot;HE&quot; at the beginning and the end of the word.
  The &lt;em&gt;figure&lt;/em&gt; is used in the first puzzle and
  the &lt;em&gt;ground&lt;/em&gt; is used in the second puzzle.
&lt;/p&gt;
&lt;p&gt;
  By the way, what is the first answer from the Tortoise that Achilles
  finds very ingenious but degenerate?  I believe, it is &quot;HE&quot; as this
  word both begins and ends with &quot;HE&quot;.
&lt;/p&gt;
&lt;p&gt;
  The funny thing about this dialogue is that both of them asked two
  puzzles to each other without knowing that the answers to them were
  the same.  A similar thing happened to me when a colleague of mine
  and I challenged each other with combinatorics puzzles.  See this
  blog post for the story:
  &lt;a href=&quot;combinatorics-coincidence.html&quot;&gt;Combinatorics Coincidence&lt;/a&gt;.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/adac-and-he-puzzles-from-geb.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/miscellaneous.html&quot;&gt;#miscellaneous&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/puzzle.html&quot;&gt;#puzzle&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
  <entry>
    <title>From Perl to Pi</title>
    <link href="https://susam.net/from-perl-to-pi.html"/>
    <id>urn:uuid:358ca3e6-6a98-4b4a-b0af-0ed1290a6042</id>
    <updated>2008-04-15T00:00:00Z</updated>
    <content type="html">
<!-- BEGIN HTML -->
&lt;p&gt;
  I was learning Perl last weekend from the book &lt;em&gt;Learning
  Perl&lt;/em&gt;, 3rd Edition by Randal L. Schwartz and Tom Phoenix.  While
  reading the book, I came across these lines:
&lt;/p&gt;
&lt;blockquote&gt;
  It&apos;s easier to type &lt;code&gt;$pi&lt;/code&gt; than \( \pi, \) especially if
  you don&apos;t have Unicode.  And it will be easy to maintain the program
  in case the value of \( \pi \) ever changes.&lt;sup&gt;379&lt;/sup&gt;
&lt;/blockquote&gt;
&lt;p&gt;
  The corresponding footnote mentions:
&lt;/p&gt;
&lt;blockquote&gt;
  &lt;em&gt;
    &lt;sup&gt;379&lt;/sup&gt; It nearly did change by a legislative act in the
    state of Indiana.
    &lt;a href=&quot;http://www.urbanlegends.com/legal/pi_indiana.htm&quot;&gt;http://www.urbanlegends.com/legal/pi_indiana.htm&lt;/a&gt;
  &lt;/em&gt;
&lt;/blockquote&gt;
&lt;p&gt;
  I searched the web and found that the original urbanlegends.com
  website is no longer there.  However while searching for it, I came
  across this brilliant piece of humour archived in the article titled
  &lt;a href=&quot;https://www.snopes.com/fact-check/alabamas-slice-of-pi/&quot;&gt;Alabama&apos;s
  Slice of Pi&lt;/a&gt; on Snopes.  It is a fictitious report on a state
  legislature redefining the value of \( \pi \) to 3.
&lt;/p&gt;
&lt;p&gt;
  The Snopes article mentions that this piece of humour was first
  posted in a newsgroup.  Then people started circulating it as hoax
  from there.  Here are some of the intriguing and funny bits from it:
&lt;/p&gt;
&lt;blockquote&gt;
  Lawson called into question the usefulness of any number that cannot
  be calculated exactly, and suggested that never knowing the exact
  answer could harm students&apos; self-esteem.
&lt;/blockquote&gt;
&lt;blockquote&gt;
  Scientists have arbitrarily assumed that space is Euclidean, he
  says.  He points out that a circle drawn on a spherical surface has
  a different value for the ratio of circumfence to diameter.
&lt;/blockquote&gt;
&lt;p&gt;
  In fact, with a little geometry we can see that if a
  &lt;a href=&quot;https://en.wikipedia.org/wiki/Flatland&quot;&gt;flatlander&lt;/a&gt;
  living on a globe with diameter \( D \) draws a circle of diameter
  \( d \) assuming that he is on a flat surface, then the ratio of the
  circumference \( c \) to the diameter \( d \) is

  \[
    \frac{c}{d} = \frac{\pi D}{d} \sin{\frac{d}{D}}.
  \]

  Here are a few more excerpts from the Snopes article:
&lt;/p&gt;
&lt;blockquote&gt;
  &quot;These nabobs waltzed into the capital with an arrogance that was
  breathtaking,&quot; Learned said.  &quot;Their prefatorial deficit resulted in
  a polemical stance at absolute contraposition to the legislature&apos;s
  puissance.&quot;
&lt;/blockquote&gt;
&lt;blockquote&gt;
  One member of the state school board, Lily Ponja, is anxious to get
  the new value of pi into the state&apos;s math textbooks, but thinks that
  the old value should be retained as an alternative.  She said, &quot;As
  far as I am concerned, the value of pi is only a theory, and we
  should be open to all interpretations.&quot;  She looks forward to
  students having the freedom to decide for themselves what value pi
  should have.
&lt;/blockquote&gt;
&lt;p&gt;
  By the way, the real event that the footnote in the
  &lt;em&gt;Learning Perl&lt;/em&gt; book mentioned is
  the &lt;a href=&quot;http://en.wikipedia.org/wiki/Indiana_Pi_Bill&quot;&gt;Indiana
  Pi Bill&lt;/a&gt;.
&lt;/p&gt;
<!-- ### -->
&lt;p&gt;
  &lt;a href="https://susam.net/from-perl-to-pi.html"&gt;Read on website&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/mathematics.html&quot;&gt;#mathematics&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/book.html&quot;&gt;#book&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/programming.html&quot;&gt;#programming&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/technology.html&quot;&gt;#technology&lt;/a&gt; |
  &lt;a href=&quot;https://susam.net/tag/quote.html&quot;&gt;#quote&lt;/a&gt;
&lt;/p&gt;
<!-- END HTML -->
    </content>
  </entry>
</feed>
