Sapcemacs21天学习视频-学习笔记-Day4

Sapcemacs21天学习视频-学习笔记-Day4

Talk more about load,load-file,require,provide and auto-load...

  • 什么是feature?
;; 加入到symbol_name到feature
(provide 'symbol_name)
  • load-file,load,require,autoload之间的区别?
  • load-file加载指定文件
  • load从load-path路径中搜索文件,然后加载
  • require加载还没有加载的插件
  • autoload 仅在函数调用时加载文件,使用此方式可节省编辑器启动时间

更好的默认配置 Better defaults


  • 文件修改后自动加载刷新
(global-auto-revert-mode 1)
  • popwin插件可以自动将光标移动到新窗口
(require 'popwin)
(popwin-mode 1)
  • 关闭警告提示音
(setq ring-bell-function 'igonre)
  • 配置yes/no简写形式y/n
(fset 'yes-or-no-p 'y-or-n-p)
  • 代码缩进
;; 定义函数实现代码缩进
(defun indent-buffer()
  (interactive)
  (indent-region (point-min) (point-max))
)
(defun indent-region-or-buffer()
  (interactive)
  (save-excursion
    (if (region-active-p)
        (indent-region (region-beginning) (region-end))
        (message "Indent selected region.")
      (progn
        (indent-buffer)
        (message "Indent buffer.")
      )
    )
  )
)

;; 设置函数执行快捷键
(global-set-key (kbd "C-M-\\") 'indent-region-or-buffer)
  • 缩写补全
  • Dired Mode 目录模式,类似于资源管理器

Dired mode and file related operations...

Bonus Time.Use Org-mode literate programming to organize your Emacs configurations...

Exercises

你可能感兴趣的:(Sapcemacs21天学习视频-学习笔记-Day4)