Last active
December 15, 2015 14:29
-
-
Save EricCrosson/94cc023108031a6ad04a to your computer and use it in GitHub Desktop.
A defun that I have used to differentiate between lectures in school notes.
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 new-lecture () | |
"Used to insert a new block and today's date." | |
(interactive) | |
(end-of-buffer) | |
(newline-and-indent) | |
(newline-and-indent) | |
(re-search-backward "\\* Lecture ") | |
(end-of-line) | |
(backward-word) | |
(kill-line) | |
(yank) | |
(end-of-buffer) | |
(insert "* Lecture ") | |
(yank) | |
(end-of-line) | |
;; This section increments the number at point | |
(skip-chars-backward "0123456789") | |
(or (looking-at "[0123456789]+") | |
(error "No number at point")) | |
(replace-match (number-to-string | |
(1+ (string-to-number (match-string 0))))) | |
;; end increment | |
(newline-and-indent) | |
(insert (format-time-string "%A %B %e, %Y")) | |
(indent-for-tab-command) | |
(newline-and-indent) | |
(newline-and-indent)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment