Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Emacs 從入門到進階

Emacs 從入門到進階

COSCUP 2013 的 Emacs 社群議程介紹如何從各種角度自訂 Emacs

Kan-Ru Chen

August 03, 2013
Tweet

More Decks by Kan-Ru Chen

Other Decks in Technology

Transcript

  1. This work is licensed under the Creative Commons Attribution-ShareAlike 3.0

    Unported License. To view a copy of this license, visit http://creativecommons. org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. about:license
  2. Agenda Emacs 編輯器以其容易擴充的特性見長,本次將 介紹如何從不同的角度,用不同的方法來擴充 Emacs。從最簡單的使用內建 Customization 界 面,到安裝第三方的套件,到使用 advice 的方式

    來擴充原有的功能,到自己自訂不同的編輯器 「模式」。本講假設聽眾皆有基礎的 Emacs 操作 能力,將不介紹如何使用 Emacs。
  3. :before :around :after (defvar simple-user) (defvar simple-password) (defun simple-login ()

    (interactive) (message "login with %s:%s" simple-user simple-password)) ;; no hooks ;; plain text password
  4. :before :around :after (defadvice simple-login (before logging-before activate) (when (y-or-n-p

    "Run simple login hooks") (run-hooks 'simple-login-hook))) (defadvice simple-login (around login-read-pw activate) (let ((simple-user "somebody") (simple-password "1234")) ad-do-it))
  5. define-minor-mode (define-minor-mode highlight-fixme-mode "Highlight the document string like FIXME, XXX

    and TODO in code." nil nil nil (let ((keywords '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\|XXX\\)\\>" 1 font-lock-warning-face t)))) (if highlight-fixme-mode (font-lock-add-keywords nil keywords) (font-lock-remove-keywords nil keywords))))