在macOS catalina上编译emacs 29.0.50遇到的问题

环境:

笔记本:MacBook Air(13 英寸,2020) i5
macOS:Catalina 10.15.7
clang:
  Apple clang version 12.0.0 (clang-1200.0.32.28)
  Target: x86_64-apple-darwin19.6.0
emacs: master分支
org: 9.5.2
evil: evil-20220118.2201

编译步骤:

懒得折腾gccemacs了,直接configure吧,反正在水果上emacs的速度不慢,折腾gccemacs又要多出一堆eln文件,编译速度又慢。

cd ~/workspace/emacs
./autogen.sh
./configure
make -j4
make install

编译遇到的问题

  1. ./configure时缺少makeinfo

以前已经用homebrew装了一堆的开发工具,只有texinfo没有装。

brew install texinfo

  1. ../build-aux/install-sh no such file

这个问题比较坑爹。之前在几个机器上编译都没碰到,在mba上一make就报错了,明明是install-sh是有的,但是就是报错。先google了一把,没发现什么有用的。想想执行一下这个shell吧。一执行就明白了哪里有问题了。

install-sh的回车换行是dos的,把这个shell改为unix的ok了。可以用dos2unix install-sh,也可以vim直接改。忘记在emacs里面怎么改文件格式了,哈哈。

vim build-aux/install-sh
:set ff=unix
:x

下次一定要在clone前把回车换行改为unix的。

git config --global core.autocrlf input
  1. 在用evil时,在org文件中,标题上,按TAB无法打开或者折叠子标题

回回升级emacs后org-mode就有各种问题,今天又碰到了。

在用evil时,在org文件中,标题上,按TAB无法打开或者折叠子标题报错,unexpected whilst reading, ... error in evil-commands.el里有错误。

但是在evil的instert mode中,按tab键可以正常打开或者折叠子标题。同时在evil的emacs-mode中,按tab键折叠的功能也是正常的,那肯定是evil的锅了。

一般升级emacs大版本时,旧版本编译的elc可能会有问题,先删了再说。把evil的evil-commands.elc删除了,报错依旧。

想用c-h k再按<tab>,看看tab键是绑定了什么函数,一按就报错,evil-commands.el有错。怀疑我用的helpful包也有问题,删掉里面的elc,还是报错。关掉helpful,这次不报错了,看见tab键是绑定了evil的函数,正常在org-mode中应该是绑定 org-cycle 函数的。

参考 org-cycle broken while using evil · Issue #1505 · emacs-evil/evil · GitHub(setq evil-want-C-i-jump nil) 解决。这个issue是2021.12.08才回复的啊,都2022年了,为什么不解决。

1 个赞

GitHub - daviderestivo/homebrew-emacs-head: GNU Emacs formula for the Homebrew package managerGitHub - d12frosted/homebrew-emacs-plus: Emacs Plus formulae for the Homebrew package manager 没这么多问题呀

2 个赞

我比较喜欢用自己编译的emacs,还把macOS上的切换输入法的代码加上去,只能自己编译。其实自己编译emacs问题不多,就是自己以前埋了点坑,要慢慢填。

org-mode按tab键无法折叠标题的坑是很奇怪。emacs 28.0.50上是没问题的。

1 个赞

我的编译流程:
Clone 源码: git clone --depth 1 git://git.savannah.gnu.org/emacs.git

  1. 安装依赖
brew install autoconf automake texinfo gnutls pkg-config libxml2 librsvg jansson giflib libtiff
  1. 编译
./autogen.sh
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include"
export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
./configure
make -j14
make install
  1. 拷贝 emacs/nextstep 下的 emacs.app 到 /Applications 目录
  2. 如果需要终端启动
    添加下面内容到 .zshenv 或者 .zshrc文件中:
if [ -d "/Applications/Emacs.app/Contents/MacOS/bin" ]; then
  export PATH="/Applications/Emacs.app/Contents/MacOS/bin:$PATH"
  export PATH="/Applications/Emacs.app/Contents/MacOS:$PATH"
fi
2 个赞