From 25665457f4cd99e6e9402d16620786536c29613b Mon Sep 17 00:00:00 2001 From: cho Date: Thu, 28 Sep 2023 20:11:31 +0700 Subject: [PATCH] Revert "Revert "add org-download and config"" This reverts commit 617c86d44b7579e5c9c755e57a38933638f4e355. --- home/default/.config/doom/config.el | 44 +++++++++++++++----- home/default/.config/doom/packages.el | 1 + home/default/.local/bin/convert-paste-png.sh | 10 +++++ 3 files changed, 45 insertions(+), 10 deletions(-) create mode 100755 home/default/.local/bin/convert-paste-png.sh diff --git a/home/default/.config/doom/config.el b/home/default/.config/doom/config.el index 9a572ae..a0600b7 100644 --- a/home/default/.config/doom/config.el +++ b/home/default/.config/doom/config.el @@ -33,14 +33,15 @@ ;; There are two ways to load a theme. Both assume the theme is installed and ;; available. You can either set `doom-theme' or manually load a theme with the ;; `load-theme' function. This is the default: -(setq doom-theme 'doom-tomorrow-night) +;(setq doom-theme 'doom-tomorrow-night) ;(setq doom-theme 'doom-one) ;(setq doom-theme 'doom-wilmersdorf) ;(setq doom-theme 'doom-plain-dark) ;(setq doom-theme 'doom-feather-dark) +;(setq doom-theme 'doom-monokai-ristretto) ;(setq doom-theme 'doom-plain) -;(setq doom-theme 'doom-flatwhite) +(setq doom-theme 'doom-flatwhite) ;; This determines the style of line numbers in effect. If set to `nil', line ;; numbers are disabled. For relative line numbers, set this to `relative'. @@ -195,11 +196,14 @@ ; (concat "${type:15} ${title:*} " (propertize "${tags:10}" 'face 'org-tag))) ;;; org-capture stuff + ;;; examples: file:~/.emacs.d/modules/lang/org/config.el + ; my location of the todo.org file (setq +org-capture-todo-file "ag/todo.org") - ;; this sets Personal notes to refile instead + (defvar +org-capture-refile-file "refile.org") (setq +org-capture-refile-file (expand-file-name +org-capture-refile-file org-directory)) + ; refile.org at the root of org-directory ;(add-to-list 'org-capture-templates ; '(("s" "Slipbox" entry (file "braindump/org/inbox.org") @@ -212,16 +216,20 @@ (setq org-capture-templates '(("t" "Personal todo" entry (file+headline +org-capture-todo-file "todo") - "* [ ] %?\n%i\n%a") - ("T" "Personal todo (single)" entry + "* [ ] %?\n%i\n%a" :prepend t) + ("T" "Personal todo (no link)" entry (file+headline +org-capture-todo-file "todo") - "* [ ] %?\n") + "* [ ] %?\n" :prepend t) - ("n" "Personal notes" entry + ;;; i never use this + ;("n" "Personal notes" entry + ;(file+headline +org-capture-notes-file "Inbox") + ;"* %u %?\n%i\n%a" :prepend t) + ("r" "Personal refile file" entry (file +org-capture-refile-file) "* %u %?\n%i\n%a" :prepend t) - ;; using org-journal atm.. + ;; using org-journal atm, i will likely never use this ;("j" "Journal" entry ;(file+olp+datetree +org-capture-journal-file) ;"* %U %?\n%i\n%a" :prepend t) @@ -241,6 +249,7 @@ (file+headline +org-capture-project-changelog-file "Unreleased") "* %U %?\n%i\n%a" :prepend t) + ;; reference for function: [[file:~/.emacs.d/modules/lang/org/autoload/org-capture.el::defun +org--capture-central-file (file project]] ;; Will use {org-directory}/{+org-capture-projects-file} and store ;; these under {ProjectName}/{Tasks,Notes,Changelog} headings. They ;; support `:parents' to specify what headings to put them under, e.g. @@ -263,13 +272,16 @@ :prepend t) ;; org books / general logging - ("b" "Book log" item (function org-books-visit-book-log) + ("b" "Book log / General log (org)" item (function org-books-visit-book-log) "- %U %?" :prepend t) ;; zettelkasten ("s" "Slipbox" entry (file "roam/inbox.org") - "* %?\n"))) + "* %U %?\n") + ("S" "Slipbox link" entry (file "roam/inbox.org") + "* %U %?\n %i\n %a"))) + (setq org-attach-directory "~/notebook/images/attach/") ) ;;; end of (!after org ... @@ -317,3 +329,15 @@ "Archive all done tasks." (interactive) (org-map-entries 'org-archive-subtree "/DONE" 'file)) + +(require 'org-download) +(setq-default + org-download-method 'directory + ;; org-download-screenshot-method "grimshot save window %s" + ;; org-download-screenshot-method "wl-paste -t image/png > '%s'" + ;; below script is available on dotfiles: ../.local/bin + org-download-screenshot-method "convert-paste-png.sh '%s'" + org-download-image-dir "~/notebook/images/org-download" + org-download-heading-lvl nil + org-download-timestamp "%Y%m%d-%H%M%S_") +(add-hook 'dired-mode-hook 'org-download-enable) diff --git a/home/default/.config/doom/packages.el b/home/default/.config/doom/packages.el index 6e4894f..ac213ee 100644 --- a/home/default/.config/doom/packages.el +++ b/home/default/.config/doom/packages.el @@ -56,6 +56,7 @@ ;(package! org :pin "ca873f7") (package! org-books) +(package! org-download) ;;; customized to support repeated tasks, see https://github.com/akhramov/org-wild-notifier.el/issues/41 (package! org-wild-notifier diff --git a/home/default/.local/bin/convert-paste-png.sh b/home/default/.local/bin/convert-paste-png.sh new file mode 100755 index 0000000..f788741 --- /dev/null +++ b/home/default/.local/bin/convert-paste-png.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +wl-paste -t image > /tmp/convert-paste-png.data +#convert /tmp/convert-paste-png.data -format png "$1" + +case "$(file --dereference --brief --mime-type -- "/tmp/convert-paste-png.data")" in + image/jpg|image/jpeg) convert /tmp/convert-paste-png.data -format png "$1" ;; + image/png) wl-paste -t image/png > "$1" ;; +esac +