Emacs: Another pass on the leetcode capture template

This commit is contained in:
Joseph Ferano 2023-08-24 16:35:10 +07:00
parent 5cb67f3585
commit 5a297e694d

View File

@ -2363,18 +2363,25 @@ and there's no need for a middle-man when it's already been implemented.
** Org-capture ** Org-capture
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; (defun my-org-capture-today () (defun joe/capture-leetcode-newfile ()
;; (concat "<" (format-time-string "%Y-%m-%d %a") ">")) (let* ((title (read-string "Title: "))
(title (string-replace " " "-" title))
(title (string-replace "." "" title)))
(expand-file-name (format "%s.org" title) "~/Development/coding-challenges/leetcode/")))
(defun joe/capture-leetcode-template () (defun joe/capture-leetcode-template ()
(mapconcat (mapconcat
'identity 'identity
'("#+TITLE: Leetcode %?: " '(":PROPERTIES:"
":DIFFICULTY: medium"
":END:"
""
"#+TITLE: Leetcode %?: "
"#+AUTHOR: Joseph Ferano" "#+AUTHOR: Joseph Ferano"
"#+STARTUP: show2levels" "#+STARTUP: show2levels"
"#+TAGS: " "#+TAGS: "
"" ""
"* Python Solution :python:" "* Python Solution"
":PROPERTIES:" ":PROPERTIES:"
":CompletionTime: 7m" ":CompletionTime: 7m"
":TimeComplexity: O(logn)" ":TimeComplexity: O(logn)"
@ -2389,34 +2396,28 @@ and there's no need for a middle-man when it's already been implemented.
"** Techniques & Patterns") "** Techniques & Patterns")
"\n")) "\n"))
(defun joe/capture-leetcode-newfile () (defun my-org-capture-today ()
(let* ((title (read-string "Title: ")) (concat "<" (format-time-string "%Y-%m-%d %a") ">"))
(title (string-replace " " "-" title))
(title (string-replace "." "" title)))
(expand-file-name (format "%s.org" title) "~/Development/coding-challenges/leetcode/")))
(defun joe/capture-daily ()
(concat
"* " "%^t" "\n"
"** Schedule" "\n"
"** Notes" "\n"
"** Resources" "\n"))
(setq org-capture-templates (setq org-capture-templates
`( `(
("l" "Leetcode Solution" plain ("l" "Leetcode Solution" plain
(function ,(lambda () (find-file (joe/capture-leetcode-newfile)))) (function ,(lambda () (find-file (joe/capture-leetcode-newfile))))
#'joe/capture-leetcode-template) #'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 ("d" "Daily Entry" entry
;; A relative file name is interpreted based on ;; A relative file name is interpreted based on
;; `org-directory'. ;; `org-directory'.
(file+headline "/tmp/daily.org" "Daily notes") (file "~/Notes/Daily.org")
,(concat #'joe/capture-daily)
"** " "%^t" "\n" ))
"*** Schedule" "\n" #+end_src
"*** Notes" "\n"
"*** Resources" "\n"))))
#+end_src
** Magit ** Magit
The best git porcelain/client I've ever used. Also kill stray magit buffers left The best git porcelain/client I've ever used. Also kill stray magit buffers left