-
Notifications
You must be signed in to change notification settings - Fork 2
emacs
- Install it from https://emacsformacosx.com
- Copy .emacs from this repository.
- Follow the steps in http://www.braveclojure.com/basic-emacs/.
Make sure to upgrade the emacs packages following the instructions in README.md.
- Add my org stuff in its own file: ~/.emacs.d/customization/org-stuff.el
- Include the org-stuff.el in ~/.emacs.d/init.el.
- Troubleshooting
- Install latest colure-mode package, see issue
;; Set the default shell to be gitbash. Should add an if for only windows (setq explicit-shell-file-name "C:/Program Files/Git/bin/bash.exe") (setq shell-file-name explicit-shell-file-name) (add-to-list 'exec-path "C:/Program Files/Git/bin") (add-to-list 'exec-path "C:/Program Files/GnuGlobal/glo662wb/bin") ;; Prevent issues with the Windows null device (NUL) ;; when using git-bash find with rgrep. (defadvice grep-compute-defaults (around grep-compute-defaults-advice-null-device) "Use gitbash /dev/null as the null-device." (let ((null-device "/dev/null")) ad-do-it)) (ad-activate 'grep-compute-defaults)
也可以替换为 WSL 的那个 bash.exe。
(setq explicit-shell-file-name "C:/Windows/System32/bash.exe") (setq shell-file-name explicit-shell-file-name)
^-x shell 进去的是 bash 了。但是里头的 grep 还是 emacs 的。 ^-x grep 可以用 bash 里头的 grep 了。
常用模板中需要专门给 images 目录设置一个发布规则。它只有在 C-c C-e P RET p RET 发布整个项目的时候生效。
(setq org-publish-project-alist '(("myprojectorg" :base-directory "~/path/to/myproject/" :publishing-directory "/ssh:user@server:~/public_html/myproject/" :publishing-function org-html-publish-to-html :auto-preamble t ) ("myprojectother" :base-directory "~/path/to/myproject/" :base-extension "css\\|pdf\\|sh" :publishing-directory "/ssh:user@server:~/public_html/myproject" :publishing-function org-publish-attachment ) ("myprojectimages" :base-directory "~/path/to/myproject/images" :base-extension "png\\|jpg" :publishing-directory "/ssh:user@server:~/public_html/myproject/images" :publishing-function org-publish-attachment ) ("myprojectweb" :components("myprojectorg" "myprojectother" "myprojectimages")) ) )
如果需要代理,按照下面的链接配置一下,不然安装不了 ox-gfm 等包。
;; https://www.emacswiki.org/emacs/InstallingPackages (setq url-proxy-services '(("no_proxy" . "^\\(localhost\\|10.*\\)") ("http" . "proxy.sample.com:port") ("https" . "proxy.sample.com:port")))
默认字符集是 GBK,org 文件发布出去后的编码设置是 UTF-8,但是实际的文件内容还是 GBK。Chrome 的最新版本需要安装一个选择字符集的插件(Set Character Encoding)才能正确显示。
;; encoding (prefer-coding-system 'utf-8)
;; single instance (require 'server) (unless (server-running-p) (server-start))
右键打开将 emacs 设置为默认的程序,要选择 emacsclientw.exe。这种方式有个缺点,要求 emacs 必须已经启动了。
在 Options 菜单中搜索并设置最近打开的文件选项。
(recentf-mode t)
默认不支持图片的直接显示,原因是依赖的 DLL 没有安装。
(image-type-available-p 'png) (image-type-available-p 'jpeg) (image-type-available-p 'gif) (image-type-available-p 'tiff) (image-type-available-p 'xbm) (image-type-available-p 'xpm)
在每行的最后按下 C-x C-e,支持的就会返回 t,否则返回 nil。
通过 C-h v 查看对应的 DLL 名字(和版本)。变量名字为:dynamic-library-alist。查到的类似:
Value: ((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll") (png "libpng16.dll" "libpng16-16.dll") (tiff "libtiff-5.dll" "libtiff3.dll" "libtiff.dll") (jpeg "libjpeg-8.dll") (gif "libgif-7.dll") (svg "librsvg-2-2.dll") (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") (glib "libglib-2.0-0.dll") (gobject "libgobject-2.0-0.dll") (gnutls "libgnutls-30.dll") (libxml2 "libxml2-2.dll" "libxml2.dll") (zlib "zlib1.dll" "libz-1.dll"))
xbm、xpm 之类的是内置的。其他的例如 png、jpeg 要确认版本号,并且将 DLL 拷贝到 emacs 所在的目录。此外,64 位的与 32 位的是不同的版本。
- Emacs 25 之后的 Windows 版本会有个配套的 deps 压缩包,例如 64 位的:deps 。
- 这里的是 32 位版本:二进制下载地址 Files ,源代码下载地址:libpng 、libjpeg。
可以将动态库拷贝到 Emacs 的 bin 目录或者安装到独立的目录并将其加入到 PATH 路径。安装完毕后再次检查一下下面的这些开关是否为 t 了。
(image-type-available-p ‘png) (image-type-available-p ‘jpeg) (image-type-available-p ‘gif) (image-type-available-p ‘tiff) (image-type-available-p ‘xbm) (image-type-available-p ‘xpm)
详细步骤参见 Windows 图片显示。
- MySQL 的配置
- tab 显示为 2 个空格宽度
(setq default-tab-width 2)
- A.vim 类似的功能
Meta-x ff-find-other-file
- 显示行号
(global-linum-mode t) (setq linum-format “%d “)
(setq org-startup-indented t)
Move the buffer/window around per buffer-move
Save it as ~/.emacs.d/customizations/buffer-move.el, and load it in ~/.emacs.d/init.el.
Created by Wenliang Zhang.