Created
February 16, 2014 01:49
-
-
Save keimina/9028116 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun my-open-new-memo () | |
(interactive) | |
(let ((my-regexp "\\([0-9]+\\)[.]memo") | |
(my-max 1) | |
(my-matched-num 0) | |
(file-list (directory-files "~/.emacs.d/memo/"))) | |
(dolist (i file-list) | |
(setq my-matched-num (string-to-number (replace-regexp-in-string my-regexp "\\1" i))) | |
(if (< my-max my-matched-num) | |
(setq my-max my-matched-num))) | |
(find-file (format "~/.emacs.d/memo/%d.memo" (1+ my-max))) | |
(when (not (file-exists-p (buffer-name))) | |
(set-buffer-modified-p t)) | |
(save-buffer) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment