Spacemacs Rocks Note Day 2
- Cursor type is a
buffer-local variable. setq will change a local buffer cursor type.
setq-default to change global setting.
Disable auto-save / auto-backup
(setq make-backup-files nil)
- There are files in the system, use this function to load them, similarly to include or import.
Deal with the recent files
(require 'recentf): activate it.
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files): such that we can open recent file by
Delete the selection words
(delete-selection-mode t): select some block and type sth, it will change. The previous version do this by append.
shortkey for entering SRC block
<s and <tab>
- Example block:
start Emacs with full screen
(setq initial-frame-alist (quote ((fullscreen . maximized))))
Show matched Parenthesis
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)
Highlight the current line
Configurate the Package Management system
- MELPA: https://melpa.org/#/
- Note: number of download is not neccessarily means it is useful.
- Use the following command to add the package:
;; Add the package source
(when (>= emacs-major-version 24)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
;; Add whatever packages you want here
(defvar LanternD/packages '(
) "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)))
(message "%s" "Refreshing package database...")
(dolist (pkg LanternD/packages))
(when (not (package-installed-p pkg))
- If the above is not working, go to Melpa’s home page to find instruction.
(require 'package) ;; You might already have this line
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(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
- We can now add package from the Package management system.
Add a new theme
- Go to Package Management, install “monokai-theme”
M-x load <enter> monokai <enter>, done.
- Delete similar stuff all at once!
Package management advanced
M-x package-list-packages <enter>: this is equivalent to open the package management system in the menu.
<u> to mark “Install”, “Delete” and “Upgrade” to the packages.
- After marking a package, press
<x> to confirm.
U to execute global upgrade to all installed packages.
- If too many packages are installed, be CAUTIOUS to upgrade all packages at once. Something terrible may happen.
M-x package-autoremove: Auto remove packages.
About smex package
- An augmented
- after key-binding, press
C-s to navigate in the command available.
About swiper package
- type in the stuff
C-p to navigate
C-x C-f now can navigate like a folder access.
About smartparens package
- Help you type in the right parenthensis after you enter the left one.
- Remember to add hook to certain major mode.
M-x customize-group, then type in the name, then we can enter the configuration for each package.
M-x customize-option: a more detailed option list.
Tips on order list in
M-<return> will match the previous format.
- Suppose we already have
js2-mode installed, we can switch to that.
js2-mode for the IDE.
'(("\\.js\\'" . js2-mode))
nodejs-repl, which is for executing the
.js file. (require
node.js installed in the system).
M-x nodejs-repl-send-buffer: execute this command in the
.js file. Then the file will be executed in the frame.
TODO Reading recommendation
M-x Info: open Info.
C-h i: same as above.
- Read “Emacs Lisp Intro” (“Introduction to Emacs Lisp Programming”), especially the section of loop and recursion.
Use org to set schedule
(setq org-agenda-files '("~/org"))
(global-set-key (kbd "C-c a") 'org-agenda)
- Bind a key to open the
C-c C-s: set a scheduled time.
C-c C-d: set the deadline time.