Emacs

Compile

https://protesilaos.com/codelog/2022-07-06-build-emacs-arch-linux/

https://git.sr.ht/~protesilaos/emacs-arch-linux-pkgbuild

# Maintainer: Protesilaos Stavrou <info@protesilaos.com>

# This is not on the AUR.  It is loosely based on the 'emacs-git'
# package found there.  It is highly opinionated to only use stuff I
# need (or will most likely need).
#
# About the choice of font backend, read this from the NEWS file of
# Emacs 28:
#
#     ** The Cairo graphics library is now used by default if present.
#     '--with-cairo' is now the default, if the appropriate development
#     files are found by 'configure'.  Building with Cairo is known to cause
#     some problems with bitmap fonts.  This may require you to adjust your
#     font settings, or to build with Xft support instead.
#
#     Note also that 'FontBackend' settings in ".Xdefaults" or
#     ".Xresources", or 'font-backend' frame parameter settings in your init
#     files, may need to be adjusted, as 'xft' is no longer a valid backend
#     when using Cairo.  Use 'ftcrhb' if your Emacs was built with HarfBuzz
#     text shaping support, and 'ftcr' otherwise.  You can determine this by
#     checking 'system-configuration-features'.  The 'ftcr' backend will
#     still be available when HarfBuzz is supported, but will not be used by
#     default.  We strongly recommend building with HarfBuzz support.  'x' is
#     still a valid backend.
#
#     ** 'configure' now warns about building with libXft support.
#     libXft is unmaintained, and causes a number of problems with modern
#     fonts including but not limited to crashes; support for it may be
#     removed in a future version of Emacs.  Please consider using
#     Cairo + HarfBuzz instead.
#
#     ** 'configure' now warns about not using HarfBuzz if using Cairo.
#     We want to encourage people to use the most modern font features
#     available, and this is the Cairo graphics library + HarfBuzz for font
#     shaping, so 'configure' now recommends that combination.

_wayland="NOX" # NO = Lucid, YES = Pure GTK, NOX = No X

pkgname="emacs-git"
pkgver=30.0.50.170054
pkgrel=1
pkgdesc="GNU Emacs.  Custom build of current development target."
arch=('x86_64')
url="http://www.gnu.org/software/emacs/"
license=('GPL3')
depends=(
    'cairo'
    'dbus'
    'harfbuzz'
    'hicolor-icon-theme'
    'libgccjit'
    'librsvg'
    'libsm'
    'libxcb'
    'sqlite3'
    'tree-sitter'
    'xcb-util'
)
makedepends=('git' 'libxi' 'xorgproto')

_flags=(
    --prefix=/usr
    --sysconfdir=/etc
    --libexecdir=/usr/lib
    --localstatedir=/var
    --mandir=/usr/share/man
    # General settings
    --without-xinput2
    --without-compress-install
    --without-gpm
    --without-selinux
    --with-native-compilation=yes
    --with-sound=no
    # Image settings
    --without-gif
    --without-tiff
    # Font settings
	--with-cairo
	--with-harfbuzz
    # Editor settings
    --with-tree-sitter=ifavailable
	--with-json
    # Toolkit settings
    --without-gsettings
    --without-gconf
    # Others: error
    --with-xpm=ifavailable
)

if [ "$_wayland" = "YES" ]
then
    depends+=(
        'gtk3'
    );
    _flags+=(
        '--with-pgtk'
    );
elif [ "$_wayland" = "NOX" ]
then
    depends+=(
        'gnutls'
        'libxml2'
        'jansson'
    );
    _flags+=(
        '--with-x-toolkit=no'
        '--without-toolkit-scroll-bars'
        '--without-xft'
        '--without-xaw3d'
    );
else
    depends+=(
        'lcms2'
        'libxfixes'
        'libxinerama'
        'libxrandr'
    );
    _flags+=(
        '--with-x-toolkit=lucid'
        '--without-toolkit-scroll-bars'
        '--without-xft'
        '--without-xaw3d'
    );
fi

provides=('emacs')
conflicts=('emacs')
source=("emacs-git::git+https://git.savannah.gnu.org/git/emacs.git")
options=(!strip)
b2sums=('SKIP')

pkgver()
{
    cd "$srcdir/emacs-git"

    printf "%s.%s" \
           $(grep AC_INIT configure.ac | \
                 awk -F',' '{ gsub("[ \\[\\]]","",$2); print $2 }') \
           $(git rev-list --count HEAD)
}

# There is no need to run autogen.sh after first checkout.
# Doing so, breaks incremental compilation.
prepare()
{
    cd "$srcdir/emacs-git"
    [[ -x configure ]] || ( ./autogen.sh git && ./autogen.sh autoconf )
    mkdir -p "$srcdir/emacs-git/build"
}

build()
{
    cd "$srcdir/emacs-git/build"
    ../configure "${_flags[@]}"
    make
}

package()
{
    cd "$srcdir/emacs-git/build"

    make DESTDIR="$pkgdir/" install

    # fix user/root permissions on usr/share files
    find "$pkgdir"/usr/share/emacs/ | xargs chown root:root

    # fix permssions on /var/games
    mkdir -p "$pkgdir"/var/games/emacs
    chmod 775 "$pkgdir"/var/games
    chmod 775 "$pkgdir"/var/games/emacs
    chown -R root:games "$pkgdir"/var/games
}

post_install() {
    # fix user/root permissions on usr/share files
    find "$pkgdir"/usr/share/emacs/ | xargs chown root:root
    # make sure directory has the correct owner and group
    chown -R root:games "$pkgdir"/var/games
    # Remove all desktop files beside the main one
    find "$pkgdir"/usr/share/emacs/ -regex '.*\(emacsclient\|emacs-mail\).*\.desktop' -print0 | xargs -r0 rm
}

Setup

Emacs Hunspell

https://github.com/hunspell/hunspell#usage

# mkdir /usr/share/hunspell
# cd /usr/share/hunspell
# wget -O en_US.aff  https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.aff?id=a4473e06b56bfe35187e302754f6baaa8d75e54f
# wget -O en_US.dic https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.dic?id=a4473e06b56bfe35187e302754f6baaa8d75e54f

我想用 Emacs 做什么

搜索多个文件

M-x rgrep

用 Org-agenda 做 GTD

使用 Org 表格

腾讯云 阿里云
地域 上海
系统镜像 Ubuntu20.04
vCPU 2 核
内存 2G
每月流量 300G 800G
系统盘 40G SSD 50G ESSD
限峰值带宽 4Mbps
价格 50 元/月 90 元/月

我想让属性值相同的部分(地域、系统镜像、vCPU、内存、限峰值带宽)两列合并。

目前使用 HTML:

腾讯云 阿里云
地域 上海
系统镜像 Ubuntu20.04
vCPU 2 核
内存 2G
每月流量 300G 800G
系统盘 40G SSD 50G ESSD
限峰值带宽 4Mbps
价格 50 元/月 90 元/月

其他参考:

            
            
            
             Singular              Plural      
 Masculine   Neuter     Feminine   All genders 
 Nominative 
 Accusative 
 Dative     
 Genitive   
 *der*     
 *den*     
 *dem*     
 *dessen*  
 *das*    
 *das*    
 *dem*    
 *dessen* 
 *die*    
 *die*    
 *der*    
 *deren*  
 *die*       
 *die*       
 *denen*     
 *deren*     
table-capture is a powerful command.                      
Here are some things it can do:                           
Parse Cell Items 
                 
                 
 Using row and column delimiter regexps,
 it parses the specified text area and  
 extracts cell items into a table.      

  1. https://developer.mozilla.org/en-US/docs/Learn/HTML/Tables/Basics
  2. https://emacs.stackexchange.com/a/7313
  3. https://orgmode.org/guide/Tables.html#Tables
  4. https://orgmode.org/manual/Tables.html#Tables

使用 Org Mode checkbox

C-c C-x C-r (org-toggle-radio-button) 添加新的 checkbox

输入法及字体

我在终端环境下用 Emacs 更多,所以基本上系统输入法配置好 Fcitx5,使用我的 .emacs.d 配置,就可以正常输入中文了。但是,最近使用发现——输入中文引号时,会占据实际上没有的空白(终于找到原因:在启动 Emacs 时设置了 LC_CTYPE=zh_CN.UTF-8 )。

升级包

https://github.com/purcell/emacs.d/issues/33#issuecomment-6039572

通过定期执行 M-x package-list-packages RET ,然后按下 U 键,之后按下 x 键。

不使用 use-package

https://github.com/jwiegley/use-package 安装

    (require 'package)
    (add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)

    (unless (package-installed-p 'use-package)
      (package-install 'use-package))

配置入门

当需要安装包的时候,输入:

    (use-package ox-hugo
      :ensure t
      :pin melpa)
  • :init 在加载包前执行代码
  • :config
欢迎通过「邮件」或者点击「这里」告诉我你的想法
Welcome to tell me your thoughts via "email" or click "here"