My Avatar

LanternD's Castle

PhD Student in ECE @ MSU

Spacemacs Rocks Note Day 8 & 9

2017-11-07

A series of notes that I learn Emacs hacking. Cask and pallet package for multi-version Emacs collaboration; Macro in emacs-lisp; use-package package introduction.

Prologue: Not too much for day 8. Previous video is 1 hour’s long, the author decrease the length of each video to 30 min for better performance. Therefore I put the content in two days’ video into single post.

Day 8

There are not too many in this video.

Visit Melpa from China

cask, a package for project monitoring

pallet package

(require 'cask "~/.cask/cask.el")
(cask-initialize)
(require 'pallet)
(pallet-mode t)

mwe-log-command package


Day 9

Macro

(defmacro inc (var)
  (list 'setq var (list '1+ var)))
(setq my-var 1)
(inc my-var)
(macroexpand '(inc my-var))
(sp-local-pair 'emacs-lisp-mode "`" nil :actions nil)
(defun my-print (number)
  (message "%d" number))
(my-print 2)

(my-print (+ 2 3))

(defmacro my-print-2 (number)
`(message "%d" ,number))
(my-print-2 2)
(my-print-2 (+ 2 3))

(defmacro inc (var)
(list 'setq var (list '1+ var)))

(setq my-var-2)
(inc my-var)

(defmacro inc2 (var1 var2 )
(list 'progn (list 'inc var1) (list 'inc var2)))
(macroexpand '(inc2 my-var my-var)) ;; this will expand only one layer.
(macroexpand-all '(inc2 my-var my-var))

use-package package

(use-package xxx
  :init 
  (progn
    (setq var1 1)
    (setq var2 "s"))
  :config 
  (setq var3 5))			
(use-package xxx
  :commands
  (global-company-mode)
  :defer t
(use-package color-moccur
  :commands (isearch-moccur iseach-all)
  :bind (("M-s O" . moccur)
	 :map isearch-mode-map
	 ("M-o" . isearch-moccur)
	 ("M-O" . isearch-moccur-all))
  :init 
  (setq isearch-lazy-highlight t)
  :config 
  (use-package moccur-edit)
  )


Disqus Comment 0