From 3666deaed5b0baf0a74f14db5872105c9e7865f9 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Wed, 13 Jan 2021 13:01:34 +0800 Subject: A temporary intermeidate step Now I got almost every functionality that we need, including pdf, mu4e, magit, et cetera. --- org-conf.el | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) (limited to 'org-conf.el') diff --git a/org-conf.el b/org-conf.el index e978e22..d252657 100644 --- a/org-conf.el +++ b/org-conf.el @@ -1,7 +1,8 @@ ;;; -*- lexical-binding: t; -*- (setq org-latex-packages-alist '(("" "amsfonts" t)) - org-format-latex-options (plist-put org-format-latex-options :scale 1.5)) + ;; org-format-latex-options (plist-put org-format-latex-options :scale 1.5) + ) ;; tempo @@ -46,6 +47,7 @@ (browse-url (concat scheme ":" url) arg)))) (use-package "tablist" 'tablist) +(setq pdf-info-epdfinfo-program "/Users/durand/elisp_packages/pdf-tools/epdfinfo" ) (load-config "org-pdftools.el") (set 'org-pdftools-link-prefix "pdfview") (org-pdftools-setup-link) @@ -238,7 +240,46 @@ in Lisp code use `org-set-tags' instead." which cost from inactive-time shop-and-items))) (setq org-capture-templates - '(("g" "GNUS" entry + '(("d" "Record Diaries" entry + (file+olp+datetree "~/org/diary.org") + "* %?\n :PROPERTIES:\n :RECORD_TIME: %U\n :END:\n\n" + :jump-to-captured t) + ("l" "Store links" entry + (file "/Users/durand/org/math_article_links.org") + "* TO-THINK %? %(org-insert-time-stamp (org-read-date nil t \"+0d\") nil t)\n%a\n" :kill-buffer t) + ("L" "for storing webpages" entry + #'org-determine-link-file + "* PENDING %(org-filter-title) %(org-determine-tag)\n :PROPERTIES:\n :RECORD_TIME: %U\n :END:\n\n %(org-filtered-link)\n %i\n %?" + :empty-lines 1 + :kill-buffer t + :immediate-finish t) + ("t" "TODO" entry + (file "~/org/aujourdhui.org") + "* TODO %? %^{Date to do:}t\n :PROPERTIES:\n :RECORD_TIME: %U\n :END:\n\n" + :kill-buffer t) + ;; ("b" "Blog posts" entry + ;; (file+headline "~/org/notes.org" "Blog posts") + ;; "* %? %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%i\n") + ;; ("a" "Abstractions" entry + ;; (file+headline "~/org/wiki.org" "Abstractions") + ;; "* ABSTRACT %?\n :PROPERTIES:\n :RECORD_TIME: %U\n :END:\n\n") + ("A" "Agenda" entry + (file+headline "~/org/agenda.org" "Agenda") + "* TODO %?\n :PROPERTIES:\n :RECORD_TIME: %U\n :DURATION: %^{Date: }t\n :END:\n\n") + ;; ("y" "YiFu" entry + ;; (file+headline "~/org/wiki.org" "Yi Fu Tips") + ;; "* MEMO %^{word}\n :PROPERTIES:\n :STORY: %\\2\n :MEANING: %\\3\n :END:\n** Yi Fu story\n %^{story}\n** Meaning\n %^{meaning}" + ;; :kill-buffer t + ;; :immediate-finish t) + ("c" "Chansons" entry + (file+headline "~/org/wiki.org" "Liste de Chansons") + "* MEMO %^{title}\n :PROPERTIES:\n :RECORD_TIME: %U\n :LINK: [[%^{link}][%^{description}]]\n :END:\n %?" + :jump-to-captured t) + ;; ("f" "français" entry + ;; (file+headline "~/org/français/français.org" "Liste de mots français") + ;; "* MEMO %^{mot} :drill:\n :PROPERTIES:\n :DRILL_CARD_TYPE: français\n :RECORD_TIME: %U\n :MEANING: %^{ce qu'il veut dire}\n :END:\n\n MEANING: %\\2\n%?" + ;; :jump-to-captured t) + ("g" "GNUS" entry (file "~/org/notes.org") "* TO-THINK %:subject\n :PROPERTIES:\n :RECORD_TIME: %U\n :END:\n %:from\n %:to\n %a\n %?" :empty-lines 1 @@ -307,3 +348,82 @@ in Lisp code use `org-set-tags' instead." ;; ("m" "sections with time" ;; ((durand-agenda-command-sections-time))) )) + +;;; novel addresses +;;;###autoload +(defvar durand-novel-addresses-regexp '("uukanshu" + "ptwxz" + "piaotian" + "101novel" + "booktxt") + "Regexp for matching a novel website.") + +;;;###autoload +(defun org-determine-link-file () + "Go to the file to capture to based upon the URL" + (let* ((link (plist-get org-store-link-plist :link)) + (file-name + (cond + ((string-match-p "https?://www.youtube.com" link) + "youtube_links.org") + ((or + (string-match-p "https?://math.stackexchange.com" link) + (string-match-p "https?://mathoverflow.net/" link)) + "math_article_links.org") + ((let ((temp durand-novel-addresses-regexp) + result) + (while (and (consp temp) (not result)) + (cond + ((string-match-p (car temp) link) + (setq result t))) + (setq temp (cdr temp))) + result) + "notes.org") + ((string-match-p "https?://stacks.math.columbia.edu/" link) + "math_article_links.org") + (t + "notes.org")))) + (find-file (expand-file-name file-name org-directory)) + (goto-char (point-max)))) + +;; filter title in the link +;;;###autoload +(defun org-filtered-link () + "Filter out some unnecessary parts in the link description" + (let* ((link (plist-get org-store-link-plist :link)) + (title (plist-get org-store-link-plist :description)) + (filtered (cond ((string-match-p " - Mathematics Stack Exchange" title) + (replace-match "" nil nil title)) + ((string-match-p " - YouTube" title) + (replace-match "" nil nil title)) + ((string-match-p "\\(.*?\\)最新章节列表,\\1无弹窗_UU看书" title) + (replace-match "\\1" nil nil title)) + (t + title)))) + (org-make-link-string link filtered))) + +;; Determine tag based upon the URL +;;;###autoload +(defun org-determine-tag () + "Determine tag based upon the URL" + (let ((link (plist-get org-store-link-plist :link))) + (cond + ((string-match-p "https?://www.youtube.com" link) + ":youtube:") + ((or + (string-match-p "https?://math.stackexchange.com" link) + (string-match-p "https?://mathoverflow.net/" link)) + ":stack:web_link:") + ((let ((temp durand-novel-addresses-regexp) + result) + (while (and (consp temp) (not result)) + (cond + ((string-match-p (car temp) link) + (setq result t))) + (setq temp (cdr temp))) + result) + ":roman:") + ((string-match-p "https?://stacks.math.columbia.edu/" link) + ":web_link:stack:") + (t + ":web_link:")))) -- cgit v1.2.3-18-g5258