Emacs
Compile
https://protesilaos.com/codelog/2022-07-06-build-emacs-arch-linux/
https://git.sr.ht/~protesilaos/emacs-arch-linux-pkgbuild
1# Maintainer: Protesilaos Stavrou <info@protesilaos.com>
2
3# This is not on the AUR. It is loosely based on the 'emacs-git'
4# package found there. It is highly opinionated to only use stuff I
5# need (or will most likely need).
6#
7# About the choice of font backend, read this from the NEWS file of
8# Emacs 28:
9#
10# ** The Cairo graphics library is now used by default if present.
11# '--with-cairo' is now the default, if the appropriate development
12# files are found by 'configure'. Building with Cairo is known to cause
13# some problems with bitmap fonts. This may require you to adjust your
14# font settings, or to build with Xft support instead.
15#
16# Note also that 'FontBackend' settings in ".Xdefaults" or
17# ".Xresources", or 'font-backend' frame parameter settings in your init
18# files, may need to be adjusted, as 'xft' is no longer a valid backend
19# when using Cairo. Use 'ftcrhb' if your Emacs was built with HarfBuzz
20# text shaping support, and 'ftcr' otherwise. You can determine this by
21# checking 'system-configuration-features'. The 'ftcr' backend will
22# still be available when HarfBuzz is supported, but will not be used by
23# default. We strongly recommend building with HarfBuzz support. 'x' is
24# still a valid backend.
25#
26# ** 'configure' now warns about building with libXft support.
27# libXft is unmaintained, and causes a number of problems with modern
28# fonts including but not limited to crashes; support for it may be
29# removed in a future version of Emacs. Please consider using
30# Cairo + HarfBuzz instead.
31#
32# ** 'configure' now warns about not using HarfBuzz if using Cairo.
33# We want to encourage people to use the most modern font features
34# available, and this is the Cairo graphics library + HarfBuzz for font
35# shaping, so 'configure' now recommends that combination.
36
37_wayland="NOX" # NO = Lucid, YES = Pure GTK, NOX = No X
38
39pkgname="emacs-git"
40pkgver=30.0.50.170054
41pkgrel=1
42pkgdesc="GNU Emacs. Custom build of current development target."
43arch=('x86_64')
44url="http://www.gnu.org/software/emacs/"
45license=('GPL3')
46depends=(
47 'cairo'
48 'dbus'
49 'harfbuzz'
50 'hicolor-icon-theme'
51 'libgccjit'
52 'librsvg'
53 'libsm'
54 'libxcb'
55 'sqlite3'
56 'tree-sitter'
57 'xcb-util'
58)
59makedepends=('git' 'libxi' 'xorgproto')
60
61_flags=(
62 --prefix=/usr
63 --sysconfdir=/etc
64 --libexecdir=/usr/lib
65 --localstatedir=/var
66 --mandir=/usr/share/man
67 # General settings
68 --without-xinput2
69 --without-compress-install
70 --without-gpm
71 --without-selinux
72 --with-native-compilation=yes
73 --with-sound=no
74 # Image settings
75 --without-gif
76 --without-tiff
77 # Font settings
78 --with-cairo
79 --with-harfbuzz
80 # Editor settings
81 --with-tree-sitter=ifavailable
82 --with-json
83 # Toolkit settings
84 --without-gsettings
85 --without-gconf
86 # Others: error
87 --with-xpm=ifavailable
88)
89
90if [ "$_wayland" = "YES" ]
91then
92 depends+=(
93 'gtk3'
94 );
95 _flags+=(
96 '--with-pgtk'
97 );
98elif [ "$_wayland" = "NOX" ]
99then
100 depends+=(
101 'gnutls'
102 'libxml2'
103 'jansson'
104 );
105 _flags+=(
106 '--with-x-toolkit=no'
107 '--without-toolkit-scroll-bars'
108 '--without-xft'
109 '--without-xaw3d'
110 );
111else
112 depends+=(
113 'lcms2'
114 'libxfixes'
115 'libxinerama'
116 'libxrandr'
117 );
118 _flags+=(
119 '--with-x-toolkit=lucid'
120 '--without-toolkit-scroll-bars'
121 '--without-xft'
122 '--without-xaw3d'
123 );
124fi
125
126provides=('emacs')
127conflicts=('emacs')
128source=("emacs-git::git+https://git.savannah.gnu.org/git/emacs.git")
129options=(!strip)
130b2sums=('SKIP')
131
132pkgver()
133{
134 cd "$srcdir/emacs-git"
135
136 printf "%s.%s" \
137 $(grep AC_INIT configure.ac | \
138 awk -F',' '{ gsub("[ \\[\\]]","",$2); print $2 }') \
139 $(git rev-list --count HEAD)
140}
141
142# There is no need to run autogen.sh after first checkout.
143# Doing so, breaks incremental compilation.
144prepare()
145{
146 cd "$srcdir/emacs-git"
147 [[ -x configure ]] || ( ./autogen.sh git && ./autogen.sh autoconf )
148 mkdir -p "$srcdir/emacs-git/build"
149}
150
151build()
152{
153 cd "$srcdir/emacs-git/build"
154 ../configure "${_flags[@]}"
155 make
156}
157
158package()
159{
160 cd "$srcdir/emacs-git/build"
161
162 make DESTDIR="$pkgdir/" install
163
164 # fix user/root permissions on usr/share files
165 find "$pkgdir"/usr/share/emacs/ | xargs chown root:root
166
167 # fix permssions on /var/games
168 mkdir -p "$pkgdir"/var/games/emacs
169 chmod 775 "$pkgdir"/var/games
170 chmod 775 "$pkgdir"/var/games/emacs
171 chown -R root:games "$pkgdir"/var/games
172}
173
174post_install() {
175 # fix user/root permissions on usr/share files
176 find "$pkgdir"/usr/share/emacs/ | xargs chown root:root
177 # make sure directory has the correct owner and group
178 chown -R root:games "$pkgdir"/var/games
179 # Remove all desktop files beside the main one
180 find "$pkgdir"/usr/share/emacs/ -regex '.*\(emacsclient\|emacs-mail\).*\.desktop' -print0 | xargs -r0 rm
181}
Setup
Emacs Hunspell
https://github.com/hunspell/hunspell#usage
1# mkdir /usr/share/hunspell
2# cd /usr/share/hunspell
3# wget -O en_US.aff https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.aff?id=a4473e06b56bfe35187e302754f6baaa8d75e54f
4# 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. |
使用 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