Skip to content

Commit

Permalink
Added my default capture flow
Browse files Browse the repository at this point in the history
  • Loading branch information
renatgalimov committed Jun 16, 2021
1 parent dcebd0f commit 8515e0c
Show file tree
Hide file tree
Showing 4 changed files with 332 additions and 306 deletions.
Binary file added Footnotes/2021-06-16_04-30-55_screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
306 changes: 0 additions & 306 deletions README.org
@@ -1,240 +1,6 @@
# Created 2021-06-07 Пн 06:21
#+AUTHOR: Renat Galimov

* Working notes

Here we do the actual work.

** Renat
*** Brainstorm/Braindump
- The final task is to have an article offering an opinionated
list of building blocks implementing CODE methodology.

- I want to concentrate on
- Search
- Highlighting
- Summarization

- We may want to make a set of videos/gifs demonstrating workflow
with our instrument.

- Don't hesitate to use brute force

*** Useful links
A list of useful packages for implementing CODE with Emacs.

- [[https://github.com/logseq/logseq][GitHub - logseq/logseq: A privacy-first, open-source(frontend now, backend later) platform for knowledge management and collaboration. Desktop app download link: https://github.com/logseq/logseq/releases, roadmap: https://trello.com/b/8txSM12G/roadmap]]

- [[https://www.emacswiki.org/emacs/HighlightLibrary][EmacsWiki: Highlight Library]]
Highlight the text.

- [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Enriched-Text.html][Emacs Enriched Text mode]]
Persistently store highlights and Emacs markup in text files.

- [[https://pandoc.org/][Pandoc - About pandoc]]
Transform various documents to org-mode format.

*** Keywords
- CODE

- [[file:20210530130904-divergence_convergence.org::*Divergence and convergence][Divergence and convergence]]
- Search
- [[file:~/Dropbox/org/index.org::*Read http://www.paulgraham.com/startupideas.html][Read http://www.paulgraham.com/startupideas.html]]
- [[file:20210505083712-code_methodology.org::+title: CODE methodology][CODE methodology]]
- [[file:20210328000412-zettlkasten.org::*Zettelkasten][Zettelkasten]]
- Highlight
- [[file:~/Dropbox/org/index.org::*A reader, that doesn't allow you to read until you make notes.][A reader, that doesn't allow you to read until you make notes.]]

*** Capture

Web-pages
- pandoc

Images
- test google cloud vision api
- rekognition api
I ended up using rekognition API

You need amazon account to use it.
#+caption: Rekognition script
#+begin_src bash
#!/bin/bash

set -euo pipefail

CREDENTIALS="$1"
TARGET_BASENAME="$(basename "$2")"

docker run --user "$(id -u):$(id -g)" -v /home/renat/.aws:/tmp/.aws -e HOME=/tmp -v "$(realpath "$2"):/mnt/$TARGET_BASENAME" -w /mnt --rm -i amazon/aws-cli --profile "$CREDENTIALS" rekognition detect-labels --image-bytes "fileb://$TARGET_BASENAME"
#+end_src

**** Highlighting text with enriched mode
:LOGBOOK:
CLOCK: [2021-06-13 Вс 07:16]
CLOCK: [2021-06-13 Вс 06:49]--[2021-06-13 Вс 07:15] => 0:26
:END:

When working with plain text buffers, like org-mode or markdown,
you can use the =highlight= library to highligh the text.

I'm using org-capture with highlight to work on text.

#+caption: A capture template
#+begin_src elisp :tangle ~/emacs/rc/CODE.el
;; Use =org-capture f= to put a link to the text you selected.into an
;; org entry with the current timer enabled.

(add-to-list
'org-capture-templates
'("f" "Curently watched" item (clock)
"%(with-current-buffer (org-capture-get :original-buffer) (replace-regexp-in-string \"\n\" \" \" (buffer-substring (region-beginning) (region-end)))) [[%F::%(with-current-buffer (org-capture-get :original-buffer) (replace-regexp-in-string \"\n\" \" \" (buffer-substring (region-beginning) (region-end))))][↗]]%?" :unnarrowed t))
#+end_src

This is my basic building block. Whenever I'm reading an article
in emacs (transformed to an org-mode or markdown file), I can
click =C-c f= to insert a list entry to the notebook I'm
currently on.

To keep track of important stuff inside the file I highlight the
text I selected with =highlight.el=.

#+caption: Install highlight.el
#+begin_src elisp :tangle ~/emacs/rc/CODE.el
;; If you get errors saying somethign about facemenu, try
;; uncommenting this.
;; (setq facemenu-menu nil)

;; Intalls the package
(use-package highlight :ensure t)
#+end_src

Use different colors for different highlights.
When I'm reading, I try to keep track of statements and questions
I'm interested in. The code below defines appropriate faces.

#+caption: Custom highlights
#+begin_src elisp :tangle ~/emacs/rc/CODE.el
(defface highlight-question
'((((class color) (min-colors 88) (background light))
:background "darkseagreen2")
(((class color) (min-colors 88) (background dark))
:background "darkolivegreen")
(((class color) (min-colors 16) (background light))
:background "darkseagreen2")
(((class color) (min-colors 16) (background dark))
:background "darkolivegreen")
(((class color) (min-colors 8))
:background "green" :foreground "black")
(t :inverse-video t))
"Face for highlighting questions."
:group 'basic-faces)

(defface highlight-statement
'((((class color) (min-colors 88) (background light))
:background "#3c4c7a")
(((class color) (min-colors 88) (background dark))
:background "#3c4c7a")
(((class color) (min-colors 16) (background light))
:background "#3c4c7a")
(((class color) (min-colors 16) (background dark))
:background "#3c4c7a")
(((class color) (min-colors 8))
:background "blue" :foreground "black")
(t :inverse-video t))
"Face for highlighting statements."
:group 'basic-faces)

(defface highlight-general
'((((class color) (min-colors 88) (background light))
:background "#614b61")
(((class color) (min-colors 88) (background dark))
:background "#614b61")
(((class color) (min-colors 16) (background light))
:background "#614b61")
(((class color) (min-colors 16) (background dark))
:background "#614b61")
(((class color) (min-colors 8))
:background "red" :foreground "black")
(t :inverse-video t))
"Face for highlighting."
:group 'basic-faces)
#+end_src

Helper functions and their keybindings so we can mark text
quickly. I use =ESC ESC h= prefix. Feel free to use your own.

#+begin_src elisp :tangle ~/emacs/rc/CODE.el
(defun hlt-question()
(interactive)
(hlt-highlight-region (region-beginning) (region-end) 'highlight-question))

(defun hlt-statement()
(interactive)
(hlt-highlight-region (region-beginning) (region-end) 'highlight-statement))

(defun hlt-general()
(interactive)
(message "Im in hlt-general"
(hlt-highlight-region (region-beginning) (region-end) 'highlight-general)))

(global-set-key (kbd "ESC M-h q") #'hlt-question)
(global-set-key (kbd "ESC M-h s") #'hlt-statement)
(global-set-key (kbd "ESC M-h h") #'hlt-general)
(global-set-key (kbd "ESC M-h u") #'hlt-unhighlight-region)
#+end_src

Now, let's enable automatic highlighting on our function.

#+caption: Auto-highlight
#+begin_src elisp :tangle ~/emacs/rc/CODE.el
(defun r/do-highlight-on-capture ()
"Highlight selected region of the buffer you were in at capture."
(save-excursion
(with-current-buffer (plist-get org-capture-plist :original-buffer)
(hlt-general))))

(defun r/highlight-on-capture ()
(message "Running highlight on capture hook")
(when (equal (plist-get org-capture-plist :key) "f")
(r/do-highlight-on-capture)))

(add-hook 'org-capture-after-finalize-hook #'r/highlight-on-capture)
#+end_src
*** Organize

Tagging your notes as PARA objects.

I have two approaches to manage projects, areas and resource tags:
by roam tags and by roam links.

**** Tags

For every note you assign an appropriate tag with
=org-roam-tag-add=.

Then you can see all of your projects for example just by
searching by project tag.


On roam v2 it will look like.

#+DOWNLOADED: screenshot @ 2021-06-09 09:16:32
#+attr_org: :width 400px
[[file:Working_notes/2021-06-09_09-16-32_screenshot.png]]

**** Roam linkns

You create roam fiels named =Project=, =Area=, =Resource= and
then put it into a roam entry as a link.

Then, you open the =Areas= note and in your org-roam buffer you
will see:

#+DOWNLOADED: screenshot @ 2021-06-09 09:20:55
#+attr_org: :width 400px
[[file:Working_notes/2021-06-09_09-20-55_screenshot.png]]


* Emacs CODE implementation :project:
Here will go the actual content we produce.
[[id:93AE58FD-887D-4CFC-BF4E-2238BFA35A8F][Divergence and convergence]]
Expand All @@ -249,79 +15,7 @@ A list of useful packages for implementing CODE with Emacs.
Use a guide to set up either V1 or V2 version of org-roam.

** Capture


** Organize


** Distill

** Express
** Org-roam Full-text search :table:
:DEADLINE: <2021-06-04 Пт>

- Requested features:
- helm or counsel integration.
- live search.
- result previewing support.
- a key-binding to capture results into currently clocked org
file.
- results ordering support
- Headlines
- Summary
- Hightlight
- large file-sets support

#+caption: Full text search engines features
#+begin: columnview :hlines 1 :id local :maxlevel 2 :indent t
| ITEM | FRONTEND | SPEED | SORT |
|---------------------------+----------+-------+------|
| Org-roam Full-text search | | | |
| \_ ripgrep (helm-rg) | helm ivy | fast | nil |
| \_ helm-org-rifle | helm | slow | t |
| \_ deft | helm | fast | nil |
| \_ org-ql | helm | slow | |
| \_ recoll | helm ivy | fast | nil |
| \_ org-fts | ivy | fast | |
| \_ org-agenda search | | | |
#+end:

*** ripgrep (helm-rg)
[[https://github.com/cosmicexplorer/helm-rg][GitHub - cosmicexplorer/helm-rg: ripgrep is nice]]
Now I use it as a default text search engine.

*** helm-org-rifle
[[https://github.com/alphapapa/org-rifle][GitHub - alphapapa/org-rifle: Rifle through your Org-mode buffers and acquire your target]]

This one is good. It gives you an idea about the context. But it's not ordering the data by the highlights.
=(helm-org-rifle-directories org-roam-directory)=

I find org-rifle too slow at the moment. But its output is exacly what I want.
*** deft
[[https://github.com/dfeich/helm-deft][GitHub - dfeich/helm-deft: A helm based emacs module to help search in a predetermined list of directories. Inspired by the deft module.]]

I use helm implementation. Speed is fast enough.

*** org-ql
[[https://github.com/alphapapa/org-ql][GitHub - alphapapa/org-ql: An Org-mode query language, including search commands and saved views]]

Doesn't look suitable for large filesets.

*** recoll
[[https://github.com/emacs-helm/helm-recoll][GitHub - emacs-helm/helm-recoll: helm interface for the recoll desktop search tool.]]
I found recoll being to hard to set up.
I wasn't able to get it working on MacOS.

*** org-fts
[[https://github.com/zot/microfts/tree/main/elisp][microfts/elisp at main · zot/microfts · GitHub]]

- It didn't work on MacOS from scratch.
- I tried to compile its binary manually but that didn't work
either.
- This one looks promising. Let's keep an eye on it.

*** org-agenda search
- Not trying this for now because agenda wants to open all its
files for search.

* Awesome Emacs Code
65 changes: 65 additions & 0 deletions full-text-search.org
@@ -0,0 +1,65 @@
* Org-roam Full-text search :table:

- Requested features:
- helm or counsel integration.
- live search.
- result previewing support.
- a key-binding to capture results into currently clocked org
file.
- results ordering support
- Headlines
- Summary
- Hightlight
- large file-sets support

#+caption: Full text search engines features
#+begin: columnview :hlines 1 :id local :maxlevel 2 :indent t
| ITEM | FRONTEND | SPEED | SORT |
|---------------------------+----------+-------+------|
| Org-roam Full-text search | | | |
| \_ ripgrep (helm-rg) | helm ivy | fast | nil |
| \_ helm-org-rifle | helm | slow | t |
| \_ deft | helm | fast | nil |
| \_ org-ql | helm | slow | |
| \_ recoll | helm ivy | fast | nil |
| \_ org-fts | ivy | fast | |
| \_ org-agenda search | | | |
#+end:

*** ripgrep (helm-rg)
[[https://github.com/cosmicexplorer/helm-rg][GitHub - cosmicexplorer/helm-rg: ripgrep is nice]]
Now I use it as a default text search engine.

*** helm-org-rifle
[[https://github.com/alphapapa/org-rifle][GitHub - alphapapa/org-rifle: Rifle through your Org-mode buffers and acquire your target]]

This one is good. It gives you an idea about the context. But it's not ordering the data by the highlights.
=(helm-org-rifle-directories org-roam-directory)=

I find org-rifle too slow at the moment. But its output is exacly what I want.
*** deft
[[https://github.com/dfeich/helm-deft][GitHub - dfeich/helm-deft: A helm based emacs module to help search in a predetermined list of directories. Inspired by the deft module.]]

I use helm implementation. Speed is fast enough.

*** org-ql
[[https://github.com/alphapapa/org-ql][GitHub - alphapapa/org-ql: An Org-mode query language, including search commands and saved views]]

Doesn't look suitable for large filesets.

*** recoll
[[https://github.com/emacs-helm/helm-recoll][GitHub - emacs-helm/helm-recoll: helm interface for the recoll desktop search tool.]]
I found recoll being to hard to set up.
I wasn't able to get it working on MacOS.

*** org-fts
[[https://github.com/zot/microfts/tree/main/elisp][microfts/elisp at main · zot/microfts · GitHub]]

- It didn't work on MacOS from scratch.
- I tried to compile its binary manually but that didn't work
either.
- This one looks promising. Let's keep an eye on it.

*** org-agenda search
- Not trying this for now because agenda wants to open all its
files for search.

0 comments on commit 8515e0c

Please sign in to comment.