Emacs: First org-capture templates for Leetcode
This commit is contained in:
parent
c60c7ed631
commit
cd217883df
@ -1553,6 +1553,7 @@ When called interactively, prompt for BUFFER."
|
|||||||
("b" "~/Documents/Books/" "Books")
|
("b" "~/Documents/Books/" "Books")
|
||||||
("p" "~/Development/" "Dev")
|
("p" "~/Development/" "Dev")
|
||||||
("t" "~/TYCS/" "Teachyourselfcs")
|
("t" "~/TYCS/" "Teachyourselfcs")
|
||||||
|
("n" "~/Notes/" "OrgNotes")
|
||||||
("r" "~/Repositories" "Repos")
|
("r" "~/Repositories" "Repos")
|
||||||
("B" "~/pCloudDrive/" "pCloud")))
|
("B" "~/pCloudDrive/" "pCloud")))
|
||||||
|
|
||||||
@ -1837,7 +1838,6 @@ the right frame, I'm going to use the frame's name to close and remove the hook
|
|||||||
(add-hook 'delete-frame-functions #'joe/kill-vterm-scratch)
|
(add-hook 'delete-frame-functions #'joe/kill-vterm-scratch)
|
||||||
(add-hook 'kill-buffer-hook #'joe/kill-frame))))
|
(add-hook 'kill-buffer-hook #'joe/kill-frame))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Undo Fu
|
** Undo Fu
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(require 'undo-fu)
|
(require 'undo-fu)
|
||||||
@ -2295,6 +2295,7 @@ and there's no need for a middle-man when it's already been implemented.
|
|||||||
(defun joe/org-init ()
|
(defun joe/org-init ()
|
||||||
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
|
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
|
||||||
(setq org-agenda-files '("~/Notes/Schedule.org"))
|
(setq org-agenda-files '("~/Notes/Schedule.org"))
|
||||||
|
(setq org-directory "~/Notes/")
|
||||||
|
|
||||||
(org-babel-do-load-languages
|
(org-babel-do-load-languages
|
||||||
'org-babel-load-languages
|
'org-babel-load-languages
|
||||||
@ -2356,16 +2357,64 @@ and there's no need for a middle-man when it's already been implemented.
|
|||||||
|
|
||||||
(evil-define-key 'normal calendar-mode-map (kbd "RET") #'org-calendar-select)
|
(evil-define-key 'normal calendar-mode-map (kbd "RET") #'org-calendar-select)
|
||||||
|
|
||||||
(defun org-capture-today()
|
|
||||||
(concat "<" (format-time-string "%Y-%m-%d") ">"))
|
|
||||||
|
|
||||||
;; (setq org-capture-templates
|
#+end_src
|
||||||
;; '(("d" "New Coding Challenge" entry
|
** Org-capture
|
||||||
;; (file+headline "~/Notes/Daily.org")
|
#+begin_src emacs-lisp
|
||||||
;; (concat "* Today's Date" "\n"
|
|
||||||
;; "** Schedule" "\n"
|
|
||||||
;; "** Notes & Resources" "\n"))))
|
|
||||||
|
|
||||||
|
;; (defun my-org-capture-today ()
|
||||||
|
;; (concat "<" (format-time-string "%Y-%m-%d %a") ">"))
|
||||||
|
|
||||||
|
(defun joe/capture-leetcode-template ()
|
||||||
|
(mapconcat
|
||||||
|
'identity
|
||||||
|
'("#+TITLE: Leetcode %?: "
|
||||||
|
"#+AUTHOR: Joseph Ferano"
|
||||||
|
"#+STARTUP: show2levels"
|
||||||
|
"#+TAGS: "
|
||||||
|
""
|
||||||
|
"* Python Solution :python:"
|
||||||
|
":PROPERTIES:"
|
||||||
|
":CompletionTime: 7m"
|
||||||
|
":TimeComplexity: O(logn)"
|
||||||
|
":MemoryComplexity: O(h)"
|
||||||
|
":END:"
|
||||||
|
":LOGBOOK:"
|
||||||
|
":END:"
|
||||||
|
""
|
||||||
|
"#+begin_src python"
|
||||||
|
"#+end_src"
|
||||||
|
"** Review"
|
||||||
|
"** Techniques & Patterns")
|
||||||
|
"\n"))
|
||||||
|
|
||||||
|
(defun joe/capture-leetcode-newfile ()
|
||||||
|
(let* ((title (read-string "Title: "))
|
||||||
|
(title (string-replace " " "-" title))
|
||||||
|
(title (string-replace "." "" title)))
|
||||||
|
(expand-file-name (format "%s.org" title) "~/Development/coding-challenges/leetcode/")))
|
||||||
|
|
||||||
|
|
||||||
|
(setq org-capture-templates
|
||||||
|
`(
|
||||||
|
("l" "Leetcode Solution" plain
|
||||||
|
(function ,(lambda () (find-file (joe/capture-leetcode-newfile))))
|
||||||
|
#'joe/capture-leetcode-template)
|
||||||
|
("d" "Demo of adding to a daily.org" entry
|
||||||
|
;; A relative file name is interpreted based on
|
||||||
|
;; `org-directory'.
|
||||||
|
(file+headline "/tmp/daily.org" "Daily notes")
|
||||||
|
#'my-org-capture-daily-note)
|
||||||
|
|
||||||
|
("D" "Demo of adding to a daily.org with a prompt" entry
|
||||||
|
;; A relative file name is interpreted based on
|
||||||
|
;; `org-directory'.
|
||||||
|
(file+headline "/tmp/daily.org" "Daily notes")
|
||||||
|
,(concat
|
||||||
|
"** " "%^t" "\n"
|
||||||
|
"*** Schedule" "\n"
|
||||||
|
"*** Notes" "\n"
|
||||||
|
"*** Resources" "\n"))))
|
||||||
#+end_src
|
#+end_src
|
||||||
** Magit
|
** Magit
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user