<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: gemmaro</title>
    <description>The latest articles on DEV Community by gemmaro (@gemmaro).</description>
    <link>https://dev.to/gemmaro</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F656518%2F92caad54-1313-464a-9910-12301ba00800.png</url>
      <title>DEV Community: gemmaro</title>
      <link>https://dev.to/gemmaro</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gemmaro"/>
    <language>en</language>
    <item>
      <title>Emacs Package Management with package-quickstart</title>
      <dc:creator>gemmaro</dc:creator>
      <pubDate>Fri, 07 Aug 2026 06:41:58 +0000</pubDate>
      <link>https://dev.to/gemmaro/emacs-package-management-with-package-quickstart-35d1</link>
      <guid>https://dev.to/gemmaro/emacs-package-management-with-package-quickstart-35d1</guid>
      <description>&lt;p&gt;(This is a manual paraphrase from my &lt;a href="https://qiita.com/gemmaro/items/80d29a9450c7861a9197" rel="noopener noreferrer"&gt;Japanese article&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This article briefly explains how to manage (download and install) Emacs packages via the quickstart feature of &lt;code&gt;package.el&lt;/code&gt;.&lt;br&gt;
With this approach, you don't have to use &lt;code&gt;package-*&lt;/code&gt; in your initialization file (e.g. &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;), let alone use-package, etc.&lt;/p&gt;

&lt;p&gt;For detailed information, please refer to the comment of "Quickstart" in &lt;code&gt;package.el&lt;/code&gt; or the Info node "(emacs) Package Installation".&lt;/p&gt;
&lt;h2&gt;
  
  
  Pros and Cons
&lt;/h2&gt;

&lt;p&gt;Pros: Startup may be faster since autoloads are calculated in advance&lt;/p&gt;

&lt;p&gt;Cons: You have to restart Emacs everytime you add packages to install&lt;/p&gt;
&lt;h2&gt;
  
  
  Example Setup
&lt;/h2&gt;

&lt;p&gt;Disable &lt;code&gt;package.el&lt;/code&gt; at startup in your &lt;code&gt;early-init.el&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;package-enable-at-startup&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the installer script file (e.g. &lt;code&gt;/path/to/installer.el&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="c1"&gt;;;; installer.el --- Generate package autoloads  -*- lexical-binding: t; -*-&lt;/span&gt;

&lt;span class="c1"&gt;;;; Commentary:&lt;/span&gt;
&lt;span class="c1"&gt;;; [...]&lt;/span&gt;

&lt;span class="c1"&gt;;;; Code:&lt;/span&gt;
&lt;span class="c1"&gt;;; `package-vc-install' doesn't have `DONT-SELECT' argument like in&lt;/span&gt;
&lt;span class="c1"&gt;;; `package-install'.&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;setq&lt;/span&gt; &lt;span class="nv"&gt;custom-file&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;make-temp-file&lt;/span&gt; &lt;span class="s"&gt;"installer"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="ss"&gt;'package&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;add-to-list&lt;/span&gt; &lt;span class="ss"&gt;'package-archives&lt;/span&gt; &lt;span class="o"&gt;'&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"melpa"&lt;/span&gt; &lt;span class="o"&gt;.&lt;/span&gt; &lt;span class="s"&gt;"https://melpa.org/packages/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="no"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-initialize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;unless&lt;/span&gt; &lt;span class="nv"&gt;package-archive-contents&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-refresh-contents&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;dolist&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;pkg&lt;/span&gt; &lt;span class="o"&gt;'&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;ddskk&lt;/span&gt;
               &lt;span class="nv"&gt;flymake-perlcritic&lt;/span&gt;
               &lt;span class="nv"&gt;auth-source-xoauth2-plugin&lt;/span&gt;
               &lt;span class="c1"&gt;;; [...]&lt;/span&gt;
               &lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;unless&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-installed-p&lt;/span&gt; &lt;span class="nv"&gt;pkg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-install&lt;/span&gt; &lt;span class="nv"&gt;pkg&lt;/span&gt; &lt;span class="ss"&gt;'dont-update-package-selected-packages&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-vc-install&lt;/span&gt; &lt;span class="s"&gt;"https://codeberg.org/gemmaro/cwmrc-mode"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-quickstart-refresh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;;; This is not a package.&lt;/span&gt;
&lt;span class="c1"&gt;;;; installer.el ends here.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;emacs &lt;span class="nt"&gt;--batch&lt;/span&gt; &lt;span class="nt"&gt;--load&lt;/span&gt; /path/to/installer.el
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the packages are downloaded under the &lt;code&gt;~/.emacs.d/elpa/&lt;/code&gt; and the &lt;code&gt;~/.emacs.d/package-quickstart.el&lt;/code&gt; is generated.&lt;/p&gt;

&lt;p&gt;Finally, load the generated file in your init file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;load-file&lt;/span&gt; &lt;span class="nv"&gt;package-quickstart-file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dynamic Module Package
&lt;/h2&gt;

&lt;p&gt;Some packages have dynamic modules, which require C compilation.&lt;br&gt;
Here is an example to install &lt;a href="https://codeberg.org/gemmaro/flymake-sqlite" rel="noopener noreferrer"&gt;flymake-sqlite&lt;/a&gt; on OpenBSD, which is a Flymake backend which utilizes the SQLite C interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;condition-case&lt;/span&gt; &lt;span class="nv"&gt;err&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;package-vc-install&lt;/span&gt; &lt;span class="s"&gt;"https://codeberg.org/gemmaro/flymake-sqlite"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;'error&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;message&lt;/span&gt; &lt;span class="s"&gt;"[error:flymake-sqlite] maybe cancelled?"&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;with-environment-variables&lt;/span&gt;
    &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="s"&gt;"C_INCLUDE_PATH"&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;concat&lt;/span&gt; &lt;span class="s"&gt;"/usr/local/include:"&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;getenv&lt;/span&gt; &lt;span class="s"&gt;"C_INCLUDE_PATH"&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
     &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"LIBRARY_PATH"&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;concat&lt;/span&gt; &lt;span class="s"&gt;"/usr/local/lib:"&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;getenv&lt;/span&gt; &lt;span class="s"&gt;"LIBRARY_PATH"&lt;/span&gt;&lt;span class="p"&gt;))))&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;let*&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;dir&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;concat&lt;/span&gt; &lt;span class="nv"&gt;user-emacs-directory&lt;/span&gt; &lt;span class="s"&gt;"elpa/flymake-sqlite"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
         &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;ls&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;process-lines&lt;/span&gt; &lt;span class="s"&gt;"gmake"&lt;/span&gt;
                            &lt;span class="s"&gt;"--directory"&lt;/span&gt; &lt;span class="nv"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;message&lt;/span&gt; &lt;span class="s"&gt;"[info:out] %S"&lt;/span&gt; &lt;span class="nv"&gt;ls&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;Copyright (C) 2026 gemmaro&lt;/p&gt;

&lt;p&gt;Copying and distribution of this file, with or without modification,&lt;br&gt;
are permitted in any medium without royalty provided the copyright&lt;br&gt;
notice and this notice are preserved.  This file is offered as-is,&lt;br&gt;
without any warranty.&lt;/p&gt;

</description>
      <category>emacs</category>
      <category>package</category>
      <category>quickstart</category>
      <category>elisp</category>
    </item>
    <item>
      <title>Bundler Quiz!</title>
      <dc:creator>gemmaro</dc:creator>
      <pubDate>Sat, 25 Jul 2026 21:19:10 +0000</pubDate>
      <link>https://dev.to/gemmaro/bundler-quiz-3fkh</link>
      <guid>https://dev.to/gemmaro/bundler-quiz-3fkh</guid>
      <description>&lt;p&gt;(Translated from the &lt;a href="https://qiita.com/gemmaro/items/d99188cd07e59a8e9faf" rel="noopener noreferrer"&gt;Japanese article&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;This is a quiz about Ruby's Bundler!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add &lt;em&gt;8 characters&lt;/em&gt; to the following &lt;code&gt;Gemfile&lt;/code&gt; so that &lt;code&gt;bundle install&lt;/code&gt; fails (with non-zero exit code) for the second time or later.&lt;/p&gt;


&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s2"&gt;"https://rubygems.org"&lt;/span&gt;
&lt;span class="n"&gt;gemspec&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundler is a fairly recent version (approximately version 3 or later).&lt;/li&gt;
&lt;li&gt;The first invocation succeeds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you find the answer (on your own), please send me a direct message on &lt;a href="https://ruby.social/@gemmaro" rel="noopener noreferrer"&gt;ruby.social&lt;/a&gt; or email, etc.!&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrong Answers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An invalid URL like &lt;code&gt;https://rubygems.org12345678&lt;/code&gt;: It doesn't fail since Bundler doesn't refer to the URL.&lt;/li&gt;
&lt;li&gt;An invalid URL and gems: It fails on the first run.  It must fail only on the second or later runs.&lt;/li&gt;
&lt;li&gt;Something like this: It exeeds 8 characters.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;  &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s2"&gt;"https://rubygems.org"&lt;/span&gt;
  &lt;span class="n"&gt;gemspec&lt;/span&gt;
  &lt;span class="no"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;file?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Gemfile.lock"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="k"&gt;raise&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;Copyright (C) 2026 gemmaro&lt;/p&gt;

&lt;p&gt;Copying and distribution of this file, with or without modification,&lt;br&gt;
are permitted in any medium without royalty provided the copyright&lt;br&gt;
notice and this notice are preserved.  This file is offered as-is,&lt;br&gt;
without any warranty.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>bundler</category>
      <category>quiz</category>
      <category>gemfile</category>
    </item>
    <item>
      <title>Easy Gmail setup with Gnus and smtpmail via OAuth2</title>
      <dc:creator>gemmaro</dc:creator>
      <pubDate>Sat, 25 Jul 2026 19:28:05 +0000</pubDate>
      <link>https://dev.to/gemmaro/easy-gmail-setup-with-gnus-and-smtpmail-via-oauth2-3ale</link>
      <guid>https://dev.to/gemmaro/easy-gmail-setup-with-gnus-and-smtpmail-via-oauth2-3ale</guid>
      <description>&lt;p&gt;(This is a manual paraphrase of the &lt;a href="https://qiita.com/gemmaro/items/06e5e9caf9449357a2b4" rel="noopener noreferrer"&gt;Japanese article&lt;/a&gt;.  It might not be fluent English; sorry in advance.)&lt;/p&gt;

&lt;p&gt;This article explains how to send and receive email on Emacs.  Particularly, we will use &lt;em&gt;Gnus&lt;/em&gt; for receiving, &lt;em&gt;smtpmail&lt;/em&gt; for sending, &lt;em&gt;Gmail&lt;/em&gt; for an email service, and &lt;em&gt;OAuth2&lt;/em&gt; for authentication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Outline
&lt;/h2&gt;

&lt;p&gt;Files: Emacs initialization file (e.g. &lt;code&gt;~/.emacs.d/init.el&lt;/code&gt;) and auth-source file (e.g. &lt;code&gt;~/.authinfo&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Emacs: Install &lt;a href="https://elpa.gnu.org/packages/auth-source-xoauth2-plugin.html" rel="noopener noreferrer"&gt;&lt;code&gt;auth-source-xoauth2-plugin&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Emacs: Set Customize variables and edit authinfo.&lt;/li&gt;
&lt;li&gt;Emacs: Restart Emacs and launch Gnus.  A prompt appears in the minibuffer.
It also opens a confirmation page in your browser.&lt;/li&gt;
&lt;li&gt;Browser: Press Continue.  It looks like an error page, but this is expected.&lt;/li&gt;
&lt;li&gt;Browser: Copy &lt;code&gt;code=&amp;lt;CODE&amp;gt;&lt;/code&gt; query parameter from the address bar.&lt;/li&gt;
&lt;li&gt;Emacs: Paste the code in the Emacs minibuffer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Customize variables to set.  Please replace &lt;code&gt;&amp;lt;NAME&amp;gt;&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight common_lisp"&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;auth-source-xoauth2-plugin-mode&lt;/span&gt; &lt;span class="no"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;gnus-secondary-select-methods&lt;/span&gt;
 &lt;span class="o"&gt;'&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;nnimap&lt;/span&gt; &lt;span class="s"&gt;"imap.gmail.com"&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;nnimap-user&lt;/span&gt; &lt;span class="s"&gt;"&amp;lt;NAME&amp;gt;@gmail.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;nnimap-server-port&lt;/span&gt; &lt;span class="s"&gt;"imaps"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;nnimap-stream&lt;/span&gt; &lt;span class="nv"&gt;tls&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;nnir-search-engine&lt;/span&gt; &lt;span class="nv"&gt;imap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;nnimap-authenticator&lt;/span&gt; &lt;span class="nv"&gt;xoauth2&lt;/span&gt;&lt;span class="p"&gt;))))&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;message-send-mail-function&lt;/span&gt; &lt;span class="ss"&gt;'smtpmail-send-it&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;smtpmail-smtp-server&lt;/span&gt; &lt;span class="s"&gt;"smtp.gmail.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;smtpmail-smtp-service&lt;/span&gt; &lt;span class="s"&gt;"587"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;smtpmail-stream-type&lt;/span&gt; &lt;span class="ss"&gt;'starttls&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;;; I recommend not to set browse-url-browser-function to eww,&lt;/span&gt;
&lt;span class="c1"&gt;;; and to keep smtpmail-smtp-user as default.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example &lt;code&gt;~/.authinfo&lt;/code&gt;.  Please replace &lt;code&gt;&amp;lt;NAME&amp;gt;&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;machine imap.gmail.com login &amp;lt;NAME&amp;gt;@gmail.com port imaps auth xoauth2 auth-source-xoauth2-predefined-service google
machine smtp.gmail.com login &amp;lt;NAME&amp;gt;@gmail.com port 587 auth xoauth2 auth-source-xoauth2-predefined-service google
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all!&lt;/p&gt;

&lt;h2&gt;
  
  
  Notes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;OAuth2&lt;/strong&gt;&lt;br&gt;
Gmail &lt;a href="https://support.google.com/mail/answer/185833?hl=ja" rel="noopener noreferrer"&gt;still support&lt;/a&gt; username/password authentication.  So you can also configure authinfo as follows, though it is not OAuth2.  Please replace &lt;code&gt;&amp;lt;NAME&amp;gt;&lt;/code&gt; and &lt;code&gt;[...]&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;machine smtp.gmail.com login &amp;lt;NAME&amp;gt;@gmail.com password [...] port 587
machine imap.gmail.com login &amp;lt;NAME&amp;gt;@gmail.com password [...] port 993
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;auth-source file&lt;/strong&gt;&lt;br&gt;
If you set up PGP, you can also use an encrypted &lt;code&gt;~/.authinfo.gpg&lt;/code&gt; file.  See also &lt;code&gt;auth-sources&lt;/code&gt; Customize variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;browse-url-browser-function&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
EWW is a great web browser, but here we don't use EWW because otherwise it won't automatically open a web browser (like Firefox) which supports JavaScript, so you have to copy the URL manually from the minibuffer.  It can be also problematic since EWW buffer might collide with Gnus buffers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;smtpmail-smtp-user&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
auth-source-xoauth2-plugin package internally handles this variable, so leaving this variable unset should cause fewer problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to send email?&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;C-x m&lt;/code&gt; (&lt;code&gt;M-x compose-mail&lt;/code&gt;) to open a buffer with message major mode.  Fill in the message and &lt;code&gt;C-c C-c&lt;/code&gt; (&lt;code&gt;M-x message-send-and-exit&lt;/code&gt;) to send the email.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;auth-source: Info "(auth) Top"&lt;/li&gt;
&lt;li&gt;smtpmail: Info "(smtpmail) Top" and "(smtpmail) Authentication"&lt;/li&gt;
&lt;li&gt;Gnus: Info "(gnus) Top"
and "(gnus) Customizing the IMAP Connection" (&lt;code&gt;nnimap-authenticator&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gitlab.com/manphiz/auth-source-xoauth2-plugin/-/blob/8f7725ef7fce48a548f997aceebfdebcf1b4d214/docs/oauth2-initial-set-up.org" rel="noopener noreferrer"&gt;Initial set up using OAuth2 and auth-source-xoauth2-plugin&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;Copyright (C) 2026 gemmaro&lt;/p&gt;

&lt;p&gt;Copying and distribution of this file, with or without modification,&lt;br&gt;
are permitted in any medium without royalty provided the copyright&lt;br&gt;
notice and this notice are preserved.  This file is offered as-is,&lt;br&gt;
without any warranty.&lt;/p&gt;

</description>
      <category>emacs</category>
      <category>gmail</category>
      <category>gnus</category>
      <category>oauth</category>
    </item>
  </channel>
</rss>
