diff options
author | JSDurand <mmemmew@gmail.com> | 2021-01-29 12:33:03 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-01-29 12:33:03 +0800 |
commit | c8d4224e42a710b262e8ba67d720f6eff4e89fcb (patch) | |
tree | bb631456e910e1aeb8984e00db8e3a605f438561 /org-conf.el | |
parent | 43afe6c5db55704f787aaee4cedd7f4c69206b8b (diff) |
Change the directory to .emacs.d now.
Now I don't have to use a special command to launch Emacs. And the
configuration files are placed in the normal position now.
Diffstat (limited to 'org-conf.el')
-rw-r--r-- | org-conf.el | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/org-conf.el b/org-conf.el index aafbc8d..c9e2cf5 100644 --- a/org-conf.el +++ b/org-conf.el @@ -32,7 +32,7 @@ (define-key org-mode-map (vector 3 ?\S-l) #'org-toggle-link-display) (define-key org-mode-map (vector 3 ?\C-\S-l) #'org-insert-last-stored-link) -(declare-function 'durand-pulse-pulse-line "~/Desktop/emacs.d/basic.el") +(declare-function 'durand-pulse-pulse-line "~/.emacs.d/basic.el") (add-hook 'org-follow-link-hook #'durand-pulse-recenter-top) @@ -260,6 +260,8 @@ in Lisp code use `org-set-tags' instead." (format "%s\n :PROPERTIES:\n :cost: %s\n :FROM: %s\n :RECORD_TIME: %s\n :END: \n %s%%?" which cost from inactive-time shop-and-items))) +(require 'org-ptotocol) + (setq org-capture-templates '(("d" "Record Diaries" entry (file+olp+datetree "~/org/diary.org") @@ -458,3 +460,53 @@ in Lisp code use `org-set-tags' instead." ":web_link:stack:") (t ":web_link:")))) + +;;;###autoload +(defun org-update-novels (&optional desc) + "Update the html link to a novel, or to a web_link. +If DESC is non-`nil', then it is the description of the new link." + (interactive) +;;; HACK: Refocus the selected frame. +;;; I was doing this in the applescript. But for some reason it is messed up. So +;;; I let emacs gain focus by itself now. + (select-frame-set-input-focus (selected-frame)) + (let* ((tags (completing-read "tag: " '("roman-ARCHIVE" + "web_link-ARCHIVE") + nil t)) + (roman-p (string-match "roman" tags)) + (files '("/Users/durand/org/notes.org" "/Users/durand/org/math_article_links.org")) + (prompt (if roman-p + "Chois un roman à mettre à jour: " + "Chois un web lien à mettre à jour: ")) + cands) + (setf cands + (cl-loop for file in files + append (with-current-file file nil + (org-map-entries + (lambda () + (let ((orig (durand-org-link-info t))) + (list (car orig) (cdr orig) file))) + tags)))) + (unless roman-p (setf cands (nreverse cands))) + (let* ((choix (completing-read prompt cands nil t)) + (item (cl-assoc choix cands :test #'string=)) + (lien (read-string "Le lien: " (current-kill 0 t)))) + (with-current-file (caddr item) nil + (goto-char (cadr item)) + (org-update-link lien nil nil desc))))) + +;;; filter out the title + +;;;###autoload +(defun org-filter-title () + "Filter out some unnecessary parts of the link title" + (let ((title (plist-get org-store-link-plist :description))) + (cond + ((string-match " - Mathematics Stack Exchange" title) + (replace-match "" nil nil title)) + ((string-match " - YouTube" title) + (replace-match "" nil nil title)) + ((string-match "\\(.*?\\)最新章节列表,\\1无弹窗_UU看书" title) + (replace-match "\\1" nil nil title)) + (t + title)))) |