Skip to content

Instantly share code, notes, and snippets.

@keimina
Created February 16, 2014 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keimina/9028116 to your computer and use it in GitHub Desktop.
Save keimina/9028116 to your computer and use it in GitHub Desktop.
(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