在.emacs中添加配置加载目录:
(mapc 'load(directory-files "d:/doc/emacs-conf" t "\\.el$"))
在目录:d:/doc/emacs-conf下面放入以.el结尾的elisp配置文件:
例如:.emacs.el
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t)
'(make-backup-files nil))
.insert-date-and-time.el
(defvar current-date-time-format "%A %D %r")
(defvar current-time-format "%a %H:%M:%S")
(defun insert-current-date-time ()
(interactive)
(insert (format-time-string current-date-time-format (current-time)))
(insert "\n")
)
(defun insert-current-time ()
(interactive)
(insert (format-time-string current-time-format (current-time)))
(insert "\n")
)
(global-set-key "\C-c\C-d" 'insert-current-date-time)
(global-set-key "\C-c\C-t" 'insert-current-time)
(mapc 'load(directory-files "d:/doc/emacs-conf" t "\\.el$"))
在目录:d:/doc/emacs-conf下面放入以.el结尾的elisp配置文件:
例如:.emacs.el
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(inhibit-startup-screen t)
'(make-backup-files nil))
.insert-date-and-time.el
(defvar current-date-time-format "%A %D %r")
(defvar current-time-format "%a %H:%M:%S")
(defun insert-current-date-time ()
(interactive)
(insert (format-time-string current-date-time-format (current-time)))
(insert "\n")
)
(defun insert-current-time ()
(interactive)
(insert (format-time-string current-time-format (current-time)))
(insert "\n")
)
(global-set-key "\C-c\C-d" 'insert-current-date-time)
(global-set-key "\C-c\C-t" 'insert-current-time)
本文介绍了如何在.emacs编辑器中添加配置加载目录,并将.d:/doc/emacs-conf目录下的.elisp配置文件自动加载。同时,展示了如何使用这些配置文件实现插入当前日期时间和时间的功能。
922

被折叠的 条评论
为什么被折叠?



