优酷视频地址:
百度网盘地址:
Spacemacs Rocks Season 2 (Day 19)
Topic: Elisp Hacking Tips
Generic tips
- hooks
- write elisp functions
Advice
;;mimic "nzz" behaviou in vim
(defadvice evil-search-next (after advice-for-evil-search-next activate)
(evil-scroll-line-to-center (line-number-at-pos)))
(defadvice evil-search-previous (after advice-for-evil-search-previous activate)
(evil-scroll-line-to-center (line-number-at-pos)))
Debug elisp functions
http://www.jianshu.com/p/f509c9a9cac0?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io
(defun aborn/debug-demo ()
"debug demo function"
(interactive)
(let ((a "a")
(b "value b")
(c 1))
(message "middle")
(setq c (+ 1 c))
(xyz "a")
(message "ggg")
))
Write your own minor mode
http://nullprogram.com/blog/2013/02/06/
(define-minor-mode
shadowsocks-proxy-mode
:global t
:init-value nil
:lighter " SS"
(if shadowsocks-proxy-mode
(setq url-gateway-method 'socks)
(setq url-gateway-method 'native)))
(define-global-minor-mode
global-shadowsocks-proxy-mode shadowsocks-proxy-mode shadowsocks-proxy-mode
:group 'shadowsocks-proxy)