My Avatar

LanternD's Castle

An electronics enthusiast - survive technically

Spacemacs Rocks Note Day 2

2017-10-23

A series of notes that I learn Emacs hacking. Change variable globally, disabling auto-save and auto-backup; `require` keyword, enabling recent files opening, enabling delete selection mode; code block and example block fast typing; initializing Emacs with full screen; showing matching parenthesis, highlighting current line; package management system configuration; adding a new theme, hundgry delete mode, swiper, smartparens; customize-group; ordered list in org-mode; JavaScript IDE in Emacs; setting schedule in org-mode.

setq vs. setq-default

Disable auto-save / auto-backup

Require

Deal with the recent files

Delete the selection words

shortkey for entering SRC block

start Emacs with full screen

Show matched Parenthesis

Highlight the current line

Configurate the Package Management system

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;; Add the package source
(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
  )

(require 'cl)
;; Add whatever packages you want here
(defvar LanternD/packages '(
			    company
			    monokai-theme
			    ) "Default packages")

(defun LanternD/packages-installed-p ()
  (loop for pkg in LanternD/packages
	when(not (package-installed-p pkg)) do (return nil)
	finally (return t)))

(unless (LanternD/packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg LanternD/packages))
  (when (not (package-installed-p pkg))
    (package-install pkg))
  )
1
2
3
4
5
6
7
8
9
(require 'package) ;; You might already have this line
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
		    (not (gnutls-available-p))))
       (url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
  (add-to-list 'package-archives (cons "melpa" url) t))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

Add a new theme

Install hungry-delete-mode

Package management advanced

About smex package

About swiper package

About smartparens package

Customize group

Tips on order list in org-mode

Be careful, M-<return> will match the previous format.

About JavaScript IDE

1
2
3
4
(setq auto-mode-alist
  (append
    '(("\\.js\\'" . js2-mode))
      auto-mode-alist))

TODO Reading recommendation

Use org to set schedule

1
2
(setq org-agenda-files '("~/org"))
(global-set-key (kbd "C-c a") 'org-agenda)


Disqus Comment 0