====== Emacs 通用基础笔记 ====== ===== 查看设置文件编码 ===== [[https://www.cnblogs.com/heshizhu/archive/2013/01/05/2846568.html|来源]] 查看Emacs编码格式 M-x describe-coding-system 设置当前buffer编码格式 M-x revert-buffer-with-coding-system 可以在.emacs文件中加入 ;;设置默认读入文件编码 (prefer-coding-system 'utf-8) ;;设置写入文件编码 (setq default-buffer-file-coding-system 'utf-8) ===== 用 Homebrew 安装最新 Emacs 的命令 ===== brew install -v emacs --HEAD --use-git-head --cocoa 首次安装完后用这条命令来链接 GUI 程序: ln -s /usr/local/Cellar/emacs/HEAD/Emacs.app /Applications ===== 编译成功后自动关闭编译窗口 ===== From: snlee@newsmth.net-SPAM.no (潜水员) Newsgroups: cn.bbs.comp.emacs Date: Sun, 24 Jan 2010 11:22:01 -0600 http://www.bloomington.in.us/~brutt/emacs-c-dev.html 每次编译成功后90%以上都不需要看编译结果,得手动执行 ''C-x 1'' 来关闭它。 以下让它编译成功后延迟 1 秒自动关闭,如果失败则不关闭 (setq compilation-finish-functions (lambda (buf str) (if (string-match "exited abnormally" str) ;;there were errors (message "compilation errors, press C-x ` to visit") ;;no errors, make the compilation window go away in 1 seconds (run-at-time 1 nil 'delete-windows-on buf) (message "NO COMPILATION ERRORS!")))) 另外一些设置可使编译过程更好看、省事一些 (setq compilation-window-height 15) (setq compilation-auto-jump-to-first-error t) (setq compilation-scroll-output t) ---- ※ 来源:·水木社区 http://newsmth.net·[FROM: 61.50.219.*] ===== 生成 TAGS 文件 ===== [[http://www.emacswiki.org/emacs/BuildTags|EmacsWiki - BuildTags]] 有详细的描述。 find . -type f -iname "*.php" | etags --lang=php - 另一种方法,可以递归索引多种后缀的文件: find . -name "*.c" -print -or -name "*.h" -print -or -name "*.el" -print | xargs etags ===== 编译 Emacs for Cocoa ===== ==== 获得源代码 ==== 两种方法 * bzr branch --stacked bzr://bzr.savannah.gnu.org/emacs/trunk (加 --stacked 参数让下载更快) * git clone git://repo.or.cz/emacs.git 建议使用 git。 ==== 编译 ==== ./configure --with-ns make bootstrap make make install ''./nextstep/Emacs.app/'' 就是编译好之后的文件,可以移动到 ''/Applications'' 目录里了。 ===== Emacs 宏 ===== ==== 录制一个宏 ==== 以删除行首空格为例: * 开始录制宏,用 ''C-x ('' * 输入你删除的动作,''C-d C-d C-d'' * 移动到下一行,''C-n'' * 结束录制宏,用 ''C-x )'' ==== 使用 ==== * 用 ''C-x e'' 来使用宏,用 ''C-u 10 C-x e'' 来重复使用宏。 * 用 ''M-x name-last-kbd-macro'' 来命名刚刚录制的宏。 * 用 ''M-x insert-kbd-macro'' 来保存一个宏。 ===== Info ===== * m 跳到指定节点 * C-u C-h i 打开 .info 文件 * 扩充 info 路径:(add-to-list 'Info-default-directory-list "~/emacs/info") 或者 (add-to-list 'Info-directory-list "~/emacs/info") 尚未验证([[http://blog.waterlin.org/articles/%E6%89%A9%E5%85%85emacs%E7%9A%84info%E8%B7%AF%E5%BE%84.html|来源]]) ===== Dired 操作 ===== * ''m'' 标记需要操作的文件 * ''u'' 去除标记 * ''C'' 复制文件 (setq dired-recursive-copies 'always) 操作目录时不再询问是否递归子目录 * ''D'' 删除文件 (setq dired-recursive-deletes 'always) 同上 * ''R'' 重命名文件,也是移动命令 * ''!'' 执行命令 例如转换文本文件的编码:按 ''!'' 后输入 piconv -f gb2312 -t utf8 > output.txt ===== Emacs Rime ===== '''注:在 Fedora 36 下面也遇到了相同的问题,用同样的方法可以解决。''' 过去在 Arch Linux 下面曾经配置过 Emacs Rime。因为 Fcitx 在 Emacs 等一些程序里面不显示候选词,完全盲打还是有些困难。于是我选择了在 Emacs 里面用 Rime 来输入中文,效果还不错。当时用的其实不错,但在 opneSUSE 下面却遇到了一些问题。比起在 Arch Linux 下面需要更多的配置。 * 首先是 openSUSE 默认没有安装 make,可以使用 opi 来安装,也可以从网页上一键安装。我安装的是 Factory 源里的,比较奇怪怎么会是这样。 * 其次要安装 ''librime-devel'' 包,这是官方文档上标明的。 * 再就是需要 ''emacs-module.h'' 文件,我估计是安装文档上说的 ''emacs-el'' 包里的内容,不过我没有安装官方源里的 27.2 版本,不符合安装要求。所以按照[[https://github.com/DogLooksGood/emacs-rime/issues/141|这个页面]]上的说明,把文件保存下来,放在了 ''.emacs.d'' 目录里,然后在配置文件里指定了 ''rime-emacs-module-header-root'' 这个变量,之后就可以了。 ==== emacs-module.h 文件内容 ==== /* emacs-module.h - GNU Emacs module API. Copyright (C) 2015-2021 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ /* This file defines the Emacs module API. Please see the chapter `Dynamic Modules' in the GNU Emacs Lisp Reference Manual for information how to write modules and use this header file. */ #ifndef EMACS_MODULE_H #define EMACS_MODULE_H #include #include #include #ifndef __cplusplus #include #endif #define EMACS_MAJOR_VERSION 28 #if defined __cplusplus && __cplusplus >= 201103L # define EMACS_NOEXCEPT noexcept #else # define EMACS_NOEXCEPT #endif #if defined __cplusplus && __cplusplus >= 201703L # define EMACS_NOEXCEPT_TYPEDEF noexcept #else # define EMACS_NOEXCEPT_TYPEDEF #endif #if 3 < __GNUC__ + (3 <= __GNUC_MINOR__) # define EMACS_ATTRIBUTE_NONNULL(...) \ __attribute__ ((__nonnull__ (__VA_ARGS__))) #elif defined __has_attribute # if __has_attribute (__nonnull__) # define EMACS_ATTRIBUTE_NONNULL(...) \ __attribute__ ((__nonnull__ (__VA_ARGS__))) # endif #endif #ifndef EMACS_ATTRIBUTE_NONNULL # define EMACS_ATTRIBUTE_NONNULL(...) #endif #ifdef __cplusplus extern "C" { #endif /* Current environment. */ typedef struct emacs_env_28 emacs_env; /* Opaque pointer representing an Emacs Lisp value. BEWARE: Do not assume NULL is a valid value! */ typedef struct emacs_value_tag *emacs_value; enum { emacs_variadic_function = -2 }; /* Struct passed to a module init function (emacs_module_init). */ struct emacs_runtime { /* Structure size (for version checking). */ ptrdiff_t size; /* Private data; users should not touch this. */ struct emacs_runtime_private *private_members; /* Return an environment pointer. */ emacs_env *(*get_environment) (struct emacs_runtime *runtime) EMACS_ATTRIBUTE_NONNULL (1); }; /* Type aliases for function pointer types used in the module API. Note that we don't use these aliases directly in the API to be able to mark the function arguments as 'noexcept' before C++20. However, users can use them if they want. */ /* Function prototype for the module Lisp functions. These must not throw C++ exceptions. */ typedef emacs_value (*emacs_function) (emacs_env *env, ptrdiff_t nargs, emacs_value *args, void *data) EMACS_NOEXCEPT_TYPEDEF EMACS_ATTRIBUTE_NONNULL (1); /* Function prototype for module user-pointer and function finalizers. These must not throw C++ exceptions. */ typedef void (*emacs_finalizer) (void *data) EMACS_NOEXCEPT_TYPEDEF; /* Possible Emacs function call outcomes. */ enum emacs_funcall_exit { /* Function has returned normally. */ emacs_funcall_exit_return = 0, /* Function has signaled an error using `signal'. */ emacs_funcall_exit_signal = 1, /* Function has exit using `throw'. */ emacs_funcall_exit_throw = 2 }; /* Possible return values for emacs_env.process_input. */ enum emacs_process_input_result { /* Module code may continue */ emacs_process_input_continue = 0, /* Module code should return control to Emacs as soon as possible. */ emacs_process_input_quit = 1 }; /* Define emacs_limb_t so that it is likely to match GMP's mp_limb_t. This micro-optimization can help modules that use mpz_export and mpz_import, which operate more efficiently on mp_limb_t. It's OK (if perhaps a bit slower) if the two types do not match, and modules shouldn't rely on the two types matching. */ typedef size_t emacs_limb_t; #define EMACS_LIMB_MAX SIZE_MAX struct emacs_env_25 { /* Structure size (for version checking). */ ptrdiff_t size; /* Private data; users should not touch this. */ struct emacs_env_private *private_members; /* Memory management. */ emacs_value (*make_global_ref) (emacs_env *env, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); void (*free_global_ref) (emacs_env *env, emacs_value global_value) EMACS_ATTRIBUTE_NONNULL(1); /* Non-local exit handling. */ enum emacs_funcall_exit (*non_local_exit_check) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_clear) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); enum emacs_funcall_exit (*non_local_exit_get) (emacs_env *env, emacs_value *symbol, emacs_value *data) EMACS_ATTRIBUTE_NONNULL(1, 2, 3); void (*non_local_exit_signal) (emacs_env *env, emacs_value symbol, emacs_value data) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_throw) (emacs_env *env, emacs_value tag, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); /* Function registration. */ emacs_value (*make_function) (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, emacs_value (*func) (emacs_env *env, ptrdiff_t nargs, emacs_value* args, void *data) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1), const char *docstring, void *data) EMACS_ATTRIBUTE_NONNULL(1, 4); emacs_value (*funcall) (emacs_env *env, emacs_value func, ptrdiff_t nargs, emacs_value* args) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*intern) (emacs_env *env, const char *name) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Type conversion. */ emacs_value (*type_of) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*is_not_nil) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) EMACS_ATTRIBUTE_NONNULL(1); intmax_t (*extract_integer) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_integer) (emacs_env *env, intmax_t n) EMACS_ATTRIBUTE_NONNULL(1); double (*extract_float) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_float) (emacs_env *env, double d) EMACS_ATTRIBUTE_NONNULL(1); /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 null-terminated string. SIZE must point to the total size of the buffer. If BUFFER is NULL or if SIZE is not big enough, write the required buffer size to SIZE and return true. Note that SIZE must include the last null byte (e.g. "abc" needs a buffer of size 4). Return true if the string was successfully copied. */ bool (*copy_string_contents) (emacs_env *env, emacs_value value, char *buf, ptrdiff_t *len) EMACS_ATTRIBUTE_NONNULL(1, 4); /* Create a Lisp string from a utf8 encoded string. */ emacs_value (*make_string) (emacs_env *env, const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void *(*get_user_ptr) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_ptr) (emacs_env *env, emacs_value arg, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_finalizer) (emacs_env *env, emacs_value arg, void (*fin) (void *) EMACS_NOEXCEPT) EMACS_ATTRIBUTE_NONNULL(1); /* Vector functions. */ emacs_value (*vec_get) (emacs_env *env, emacs_value vector, ptrdiff_t index) EMACS_ATTRIBUTE_NONNULL(1); void (*vec_set) (emacs_env *env, emacs_value vector, ptrdiff_t index, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vector) EMACS_ATTRIBUTE_NONNULL(1); }; struct emacs_env_26 { /* Structure size (for version checking). */ ptrdiff_t size; /* Private data; users should not touch this. */ struct emacs_env_private *private_members; /* Memory management. */ emacs_value (*make_global_ref) (emacs_env *env, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); void (*free_global_ref) (emacs_env *env, emacs_value global_value) EMACS_ATTRIBUTE_NONNULL(1); /* Non-local exit handling. */ enum emacs_funcall_exit (*non_local_exit_check) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_clear) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); enum emacs_funcall_exit (*non_local_exit_get) (emacs_env *env, emacs_value *symbol, emacs_value *data) EMACS_ATTRIBUTE_NONNULL(1, 2, 3); void (*non_local_exit_signal) (emacs_env *env, emacs_value symbol, emacs_value data) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_throw) (emacs_env *env, emacs_value tag, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); /* Function registration. */ emacs_value (*make_function) (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, emacs_value (*func) (emacs_env *env, ptrdiff_t nargs, emacs_value* args, void *data) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1), const char *docstring, void *data) EMACS_ATTRIBUTE_NONNULL(1, 4); emacs_value (*funcall) (emacs_env *env, emacs_value func, ptrdiff_t nargs, emacs_value* args) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*intern) (emacs_env *env, const char *name) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Type conversion. */ emacs_value (*type_of) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*is_not_nil) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) EMACS_ATTRIBUTE_NONNULL(1); intmax_t (*extract_integer) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_integer) (emacs_env *env, intmax_t n) EMACS_ATTRIBUTE_NONNULL(1); double (*extract_float) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_float) (emacs_env *env, double d) EMACS_ATTRIBUTE_NONNULL(1); /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 null-terminated string. SIZE must point to the total size of the buffer. If BUFFER is NULL or if SIZE is not big enough, write the required buffer size to SIZE and return true. Note that SIZE must include the last null byte (e.g. "abc" needs a buffer of size 4). Return true if the string was successfully copied. */ bool (*copy_string_contents) (emacs_env *env, emacs_value value, char *buf, ptrdiff_t *len) EMACS_ATTRIBUTE_NONNULL(1, 4); /* Create a Lisp string from a utf8 encoded string. */ emacs_value (*make_string) (emacs_env *env, const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void *(*get_user_ptr) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_ptr) (emacs_env *env, emacs_value arg, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_finalizer) (emacs_env *env, emacs_value arg, void (*fin) (void *) EMACS_NOEXCEPT) EMACS_ATTRIBUTE_NONNULL(1); /* Vector functions. */ emacs_value (*vec_get) (emacs_env *env, emacs_value vector, ptrdiff_t index) EMACS_ATTRIBUTE_NONNULL(1); void (*vec_set) (emacs_env *env, emacs_value vector, ptrdiff_t index, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vector) EMACS_ATTRIBUTE_NONNULL(1); /* Returns whether a quit is pending. */ bool (*should_quit) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); }; struct emacs_env_27 { /* Structure size (for version checking). */ ptrdiff_t size; /* Private data; users should not touch this. */ struct emacs_env_private *private_members; /* Memory management. */ emacs_value (*make_global_ref) (emacs_env *env, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); void (*free_global_ref) (emacs_env *env, emacs_value global_value) EMACS_ATTRIBUTE_NONNULL(1); /* Non-local exit handling. */ enum emacs_funcall_exit (*non_local_exit_check) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_clear) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); enum emacs_funcall_exit (*non_local_exit_get) (emacs_env *env, emacs_value *symbol, emacs_value *data) EMACS_ATTRIBUTE_NONNULL(1, 2, 3); void (*non_local_exit_signal) (emacs_env *env, emacs_value symbol, emacs_value data) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_throw) (emacs_env *env, emacs_value tag, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); /* Function registration. */ emacs_value (*make_function) (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, emacs_value (*func) (emacs_env *env, ptrdiff_t nargs, emacs_value* args, void *data) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1), const char *docstring, void *data) EMACS_ATTRIBUTE_NONNULL(1, 4); emacs_value (*funcall) (emacs_env *env, emacs_value func, ptrdiff_t nargs, emacs_value* args) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*intern) (emacs_env *env, const char *name) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Type conversion. */ emacs_value (*type_of) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*is_not_nil) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) EMACS_ATTRIBUTE_NONNULL(1); intmax_t (*extract_integer) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_integer) (emacs_env *env, intmax_t n) EMACS_ATTRIBUTE_NONNULL(1); double (*extract_float) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_float) (emacs_env *env, double d) EMACS_ATTRIBUTE_NONNULL(1); /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 null-terminated string. SIZE must point to the total size of the buffer. If BUFFER is NULL or if SIZE is not big enough, write the required buffer size to SIZE and return true. Note that SIZE must include the last null byte (e.g. "abc" needs a buffer of size 4). Return true if the string was successfully copied. */ bool (*copy_string_contents) (emacs_env *env, emacs_value value, char *buf, ptrdiff_t *len) EMACS_ATTRIBUTE_NONNULL(1, 4); /* Create a Lisp string from a utf8 encoded string. */ emacs_value (*make_string) (emacs_env *env, const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void *(*get_user_ptr) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_ptr) (emacs_env *env, emacs_value arg, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_finalizer) (emacs_env *env, emacs_value arg, void (*fin) (void *) EMACS_NOEXCEPT) EMACS_ATTRIBUTE_NONNULL(1); /* Vector functions. */ emacs_value (*vec_get) (emacs_env *env, emacs_value vector, ptrdiff_t index) EMACS_ATTRIBUTE_NONNULL(1); void (*vec_set) (emacs_env *env, emacs_value vector, ptrdiff_t index, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vector) EMACS_ATTRIBUTE_NONNULL(1); /* Returns whether a quit is pending. */ bool (*should_quit) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); /* Processes pending input events and returns whether the module function should quit. */ enum emacs_process_input_result (*process_input) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL (1); struct timespec (*extract_time) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL (1); emacs_value (*make_time) (emacs_env *env, struct timespec time) EMACS_ATTRIBUTE_NONNULL (1); bool (*extract_big_integer) (emacs_env *env, emacs_value arg, int *sign, ptrdiff_t *count, emacs_limb_t *magnitude) EMACS_ATTRIBUTE_NONNULL (1); emacs_value (*make_big_integer) (emacs_env *env, int sign, ptrdiff_t count, const emacs_limb_t *magnitude) EMACS_ATTRIBUTE_NONNULL (1); }; struct emacs_env_28 { /* Structure size (for version checking). */ ptrdiff_t size; /* Private data; users should not touch this. */ struct emacs_env_private *private_members; /* Memory management. */ emacs_value (*make_global_ref) (emacs_env *env, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); void (*free_global_ref) (emacs_env *env, emacs_value global_value) EMACS_ATTRIBUTE_NONNULL(1); /* Non-local exit handling. */ enum emacs_funcall_exit (*non_local_exit_check) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_clear) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); enum emacs_funcall_exit (*non_local_exit_get) (emacs_env *env, emacs_value *symbol, emacs_value *data) EMACS_ATTRIBUTE_NONNULL(1, 2, 3); void (*non_local_exit_signal) (emacs_env *env, emacs_value symbol, emacs_value data) EMACS_ATTRIBUTE_NONNULL(1); void (*non_local_exit_throw) (emacs_env *env, emacs_value tag, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); /* Function registration. */ emacs_value (*make_function) (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, emacs_value (*func) (emacs_env *env, ptrdiff_t nargs, emacs_value* args, void *data) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1), const char *docstring, void *data) EMACS_ATTRIBUTE_NONNULL(1, 4); emacs_value (*funcall) (emacs_env *env, emacs_value func, ptrdiff_t nargs, emacs_value* args) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*intern) (emacs_env *env, const char *name) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Type conversion. */ emacs_value (*type_of) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*is_not_nil) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); bool (*eq) (emacs_env *env, emacs_value a, emacs_value b) EMACS_ATTRIBUTE_NONNULL(1); intmax_t (*extract_integer) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_integer) (emacs_env *env, intmax_t n) EMACS_ATTRIBUTE_NONNULL(1); double (*extract_float) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); emacs_value (*make_float) (emacs_env *env, double d) EMACS_ATTRIBUTE_NONNULL(1); /* Copy the content of the Lisp string VALUE to BUFFER as an utf8 null-terminated string. SIZE must point to the total size of the buffer. If BUFFER is NULL or if SIZE is not big enough, write the required buffer size to SIZE and return true. Note that SIZE must include the last null byte (e.g. "abc" needs a buffer of size 4). Return true if the string was successfully copied. */ bool (*copy_string_contents) (emacs_env *env, emacs_value value, char *buf, ptrdiff_t *len) EMACS_ATTRIBUTE_NONNULL(1, 4); /* Create a Lisp string from a utf8 encoded string. */ emacs_value (*make_string) (emacs_env *env, const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); /* Embedded pointer type. */ emacs_value (*make_user_ptr) (emacs_env *env, void (*fin) (void *) EMACS_NOEXCEPT, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void *(*get_user_ptr) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_ptr) (emacs_env *env, emacs_value arg, void *ptr) EMACS_ATTRIBUTE_NONNULL(1); void (*(*get_user_finalizer) (emacs_env *env, emacs_value uptr)) (void *) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL(1); void (*set_user_finalizer) (emacs_env *env, emacs_value arg, void (*fin) (void *) EMACS_NOEXCEPT) EMACS_ATTRIBUTE_NONNULL(1); /* Vector functions. */ emacs_value (*vec_get) (emacs_env *env, emacs_value vector, ptrdiff_t index) EMACS_ATTRIBUTE_NONNULL(1); void (*vec_set) (emacs_env *env, emacs_value vector, ptrdiff_t index, emacs_value value) EMACS_ATTRIBUTE_NONNULL(1); ptrdiff_t (*vec_size) (emacs_env *env, emacs_value vector) EMACS_ATTRIBUTE_NONNULL(1); /* Returns whether a quit is pending. */ bool (*should_quit) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL(1); /* Processes pending input events and returns whether the module function should quit. */ enum emacs_process_input_result (*process_input) (emacs_env *env) EMACS_ATTRIBUTE_NONNULL (1); struct timespec (*extract_time) (emacs_env *env, emacs_value arg) EMACS_ATTRIBUTE_NONNULL (1); emacs_value (*make_time) (emacs_env *env, struct timespec time) EMACS_ATTRIBUTE_NONNULL (1); bool (*extract_big_integer) (emacs_env *env, emacs_value arg, int *sign, ptrdiff_t *count, emacs_limb_t *magnitude) EMACS_ATTRIBUTE_NONNULL (1); emacs_value (*make_big_integer) (emacs_env *env, int sign, ptrdiff_t count, const emacs_limb_t *magnitude) EMACS_ATTRIBUTE_NONNULL (1); /* Add module environment functions newly added in Emacs 28 here. Before Emacs 28 is released, remove this comment and start module-env-29.h on the master branch. */ void (*(*EMACS_ATTRIBUTE_NONNULL (1) get_function_finalizer) (emacs_env *env, emacs_value arg)) (void *) EMACS_NOEXCEPT; void (*set_function_finalizer) (emacs_env *env, emacs_value arg, void (*fin) (void *) EMACS_NOEXCEPT) EMACS_ATTRIBUTE_NONNULL (1); int (*open_channel) (emacs_env *env, emacs_value pipe_process) EMACS_ATTRIBUTE_NONNULL (1); void (*make_interactive) (emacs_env *env, emacs_value function, emacs_value spec) EMACS_ATTRIBUTE_NONNULL (1); /* Create a unibyte Lisp string from a string. */ emacs_value (*make_unibyte_string) (emacs_env *env, const char *str, ptrdiff_t len) EMACS_ATTRIBUTE_NONNULL(1, 2); }; /* Every module should define a function as follows. */ extern int emacs_module_init (struct emacs_runtime *runtime) EMACS_NOEXCEPT EMACS_ATTRIBUTE_NONNULL (1); #ifdef __cplusplus } #endif #endif /* EMACS_MODULE_H */ ===== 中文字体 ===== 最近不到半年吧,Linux 下面 Emacs 的中文字体不知道什么原因变成了楷体,看着十分别扭。之前我记得不需要特别配置字体,显示的已经很完美了。这次拖了挺长时间,终于今天找到了方式解决问题。参考了[[http://xahlee.info/emacs/emacs/emacs_list_and_set_font.html|李杀的页面]],非常有效。 ;; set font for chinese (set-fontset-font t 'han (cond ((string-equal system-type "windows-nt") (cond ((member "Microsoft YaHei" (font-family-list)) "Microsoft YaHei") ((member "Microsoft JhengHei" (font-family-list)) "Microsoft JhengHei") ((member "SimHei" (font-family-list)) "SimHei"))) ((string-equal system-type "darwin") (cond ((member "Hei" (font-family-list)) "Hei") ((member "Heiti SC" (font-family-list)) "Heiti SC") ((member "Heiti TC" (font-family-list)) "Heiti TC"))) ((string-equal system-type "gnu/linux") (cond ((member "WenQuanYi Micro Hei" (font-family-list)) "WenQuanYi Micro Hei"))))) 我参考了这段配置代码,把字体改成了 "Noto Sans Mono CJK SC",解决问题。当然字体要提前安装好。其他系统下中文字体还没出问题,我删除了相关的判断代码,只放到 Linux 专属的配置下面了。目前显示完美,没发现异常。 ===== 在线文章 ===== * [[http://www.ibm.com/developerworks/cn/linux/l-cn-emacs-shell/index.html|当 Shell 遇见 Emacs -- 大话 Emacs Shell Mode]] [[http://www.ibm.com/developerworks/cn/linux/l-cn-emacs-shell2/index.html|第二部分]] [[http://www.ibm.com/developerworks/cn/linux/l-cn-emacs-shell3/|第三部分]] * [[http://olabini.com/blog/2009/12/path-problem-with-emacs-on-mac-os-x/|PATH PROBLEM WITH EMACS ON MAC OS X]] * [[http://www.masteringemacs.org/|MASTERING EMACS]] A blog about multiple Emacs topics. * [[http://wenshanren.org/?p=312|Emacs:简化 ERC 登录]] * [[http://a-nickels-worth.blogspot.ca/2007/11/effective-emacs.html|Effective .emacs]] * [[http://emacsredux.com/|Emacs Redux]] ---- * [[http://superuser.com/questions/256404/fullscreen-emacs-in-osx|Fullscreen Emacs in OSX]] * [[http://www.emacswiki.org/emacs/FullScreen#toc23|EmacsWiki: Full Screen]] * [[http://emacsblog.org/2007/02/22/maximize-on-startup-part-2/|Maximize on Startup, Part 2]] ===== 资源目录 ===== * [[http://www.reddit.com/r/emacs/comments/12oydd/resources_for_expanding_emacs_knowledge/|Resources for Expanding Emacs Knowledge? : emacs]] 相当相当多的资源链接 ===== 视频 ===== * [[https://www.youtube.com/playlist?list=PL5--8gKSku15uYCnmxWPO17Dq6hVabAB4|DistroTube的Emacs系列视频(YouTube播放列表)]] 他使用Doom Emacs,里面有些相关的知识。