diff --git a/init.el b/init.el index 33b9af3..2d91905 100644 --- a/init.el +++ b/init.el @@ -22,8 +22,8 @@ (require 'coding-utf8) ;;; call 1row-scroll (require '1row-scroll) -;;; call reload -(require 'reload) +;;; call reloader +(require 'reloader) ;;; Set language (set-language-environment "Japanese") diff --git a/lisp/reload.el b/lisp/reload.el deleted file mode 100644 index afa8d75..0000000 --- a/lisp/reload.el +++ /dev/null @@ -1,53 +0,0 @@ -;-*- coding:utf-8 -*- -;;; reload.el --- -*- lexical-binding: t; -*- - -;; Copyright (C) 2019 toshiki kawai - -;; Author: toshiki kawai -;; Keywords: - -;; This program is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; This program is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . - -;;; Commentary: - -;; - -;;; Code: - -;;; reference: https://www.gnu.org/software/emacs/manual/html_node/emacs/Find-Init.html#Find-Init -;;; Order to find Emacs init file. -;;; 1. ~/.emacs -;;; 2. ~/.emacs.el -;;; 3. ~/.emacs.d/init.el -(setq init-files '("~/.emacs" "~/.emacs.el" "~/.emacs.d/init.el")) - -(defun load-init-file (list) - "load init file for Emacs." - ;;(interactive) - (when list ;; recursive. - (let ((f (car list))) ;; get a first element. - ;; if (f is not nil) and (f is file) - (when (and f (file-readable-p f)) - (load-file f) - ;; output message to mini buffer. - (message (concat "reload " f " complete!"))) - (load-init-file (cdr list))) - )) - -;;(define-key global-map "\C-c\C-r" 'load-init-file) -(define-key global-map "\C-c\C-r" - '(lambda () (interactive) (load-init-file init-files))) - -(provide 'reload) -;;; reload.el ends here diff --git a/lisp/reloader.el b/lisp/reloader.el new file mode 100644 index 0000000..52231e1 --- /dev/null +++ b/lisp/reloader.el @@ -0,0 +1,53 @@ +;; -*- coding:utf-8 -*- +;;; reloader.el --- -*- lexical-binding: t; -*- + +;; Copyright (C) 2019 toshiki kawai + +;; Author: toshiki kawai +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Forked from https://www.yatex.org/gitbucket/gist/yuuji/424d8293e616d2171aad5ed9ee517e1e. + +;;; Code: +;; +;; Reload init files (defaults to .emacs, .emacs.el, .emacs.d/init.el) +;; + +(defvar reloader-default-init-files + '("~/.emacs" "~/.emacs.el" "~/.emacs.d/init.el") + "Default target files for reloading. +C-u M-x reloader-reload causes prompt for loading file.") + +(defun reloader-reload (arg) + (interactive "P") + (let ((files (if arg (list (read-file-name "Reload file: ")) + reloader-default-init-files)) + f) + (when files + (setq f (car files)) + (and (stringp f) + (file-readable-p f) + (progn + (message "Reloading %s" f) + (load-file f))) + (setq files (cdr files))))) + + +(define-key global-map "\C-cr" 'reloader-reload) +(provide 'reloader) +;;; reloader.el ends here