Skip to content

Instantly share code, notes, and snippets.

@eeeeeta
Last active January 10, 2016 17:46
Show Gist options
  • Save eeeeeta/46d7ea63591b2d2937ed to your computer and use it in GitHub Desktop.
Save eeeeeta/46d7ea63591b2d2937ed to your computer and use it in GitHub Desktop.
;;; eta-notes.el --- eta's note-taking elisp hunks
;; Copyright (C) 2016 eta
;; Author: eta
;; Keywords: org-mode org note note-taking notes
;; Version: 0.0.1
;;; Commentary:
;; Various bits of elisp that do note-taking things
;; Set "org-base-path" to the place where all your subject folders are
;;; Code:
(defvar org-base-path)
(defvar eta/note-current-subj)
(defvar eta/note-current-topic)
(defun eta/new-simple-note (name)
"Make a new `org-mode` simple note in current subject with name NAME.
A simple note is one without a specific topic heading.
The current subject is given by var `eta/note-current-subj`."
(interactive "sGive a name: ")
(if (boundp 'eta/note-current-subj)
(find-file
(format "%s/%s/%s %s.org"
org-base-path
eta/note-current-subj
(format-time-string '"%Y%m%d")
name))
(error '"You are not currently editing within a subject.")))
(defun eta/new-complex-note (name)
"Make a new `org-mode` note in current subject and topic with name NAME.
The current subject and topic headings are given by the values of variables
`eta/note-current-subj` and `eta/note-current-topic` respectively."
(interactive "sGive a name: ")
(if (boundp 'eta/note-current-subj)
(if (boundp 'eta/note-current-topic)
(find-file
(format "%s/%s/%s/%s %s.org"
org-base-path
eta/note-current-subj
eta/note-current-topic
(format-time-string '"%Y%m%d")
name))
(error '"You are not currently editing under a topic."))
(error '"You are not currently editing within a subject.")))
(defun eta/new-note-and-subject (subj name)
"Make a new `org-mode` note in subject SUBJ called NAME.
Also sets `eta/note-current-subj`, so you can call `eta/new-simple-note`."
(interactive "sIn what subject? \nsGive a name: ")
(setq eta/note-current-subj subj)
(makunbound 'eta/note-current-topic)
(eta/new-simple-note name))
(defun eta/new-note-and-subject-and-topic (subj topic name)
"Make a new `org-mode` note in subject SUBJ under TOPIC, called NAME.
Also sets `eta/note-current-subj` and `eta/note-current-topic`, so you can call `eta/new-complex-note`"
(interactive "sIn what subject? \nsUnder what topic heading? \nsGive a name: ")
(setq eta/note-current-subj subj)
(setq eta/note-current-topic topic)
(eta/new-complex-note name))
(provide 'eta-notes)
;;; eta-notes.el ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment