My Avatar

LanternD's Castle

PhD Student in ECE @ MSU

Spacemacs Rocks Note Day 4

2017-10-25

A series of notes that I learn Emacs hacking. Package loading mechanism, auto-indentation, hippie-expand, dired-mode, basic about org-mode.

Spacemacs Rocks Note Day 4

More about require and load-file

Indent

(defun indent-whole-buffer()
  (interactive)
  (indent-region (point-min) (point-max))
  )

(defun indent-region-or-buffer()
  (interactive)
  (save-excursion 
    (if (region-active-p)
    (progn
      (indent-region (region-begin) (region-end))
      (message "Selected region is indented.")
     )
      (progn 
	(indent-whole-buffer)
	(message "The whole buffer is indented.")
       )
      )
    )
  )

(global-set-key (kbd "C-M-\\") 'indent-region-or-buffer)

More about auto-complete - hippie-expand

;; set the list for hippie-expand
(setq hippie-expand-try-functions-list '(try-expand-dabbrev
					 try-expand-dabbrev-all-buffers
					 try-expand-dabbrev-from-kill
					 try-complete-file-name-partially
					 try-complete-file-name
					 try-expand-all-abbrevs
					 try-expand-list
					 try-expand-line
					 try-complete-lisp-symbol-partially
					 try-complete-list-symbol))
(global-set-key (kbd "M-/") 'hippie-expand) ;; this is the default key set

About dired-mode

;; (require 'dired)
(with-eval-after-load 'dired)
(put 'dired-find-alternate-file 'disabled nil)
(define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file)

Save-excursion

Use org-mode to organize the initialization files

(require 'org-install)
(require 'ob-tangle)
(org-babel-load-file (expand-file-name "lanternd_int.org" user-emacs-directory))


Disqus Comment 0