aboutsummaryrefslogtreecommitdiff
path: root/TODOs.org
blob: 120cc698f79817a3e3856b7a852aac9a64420aca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#+STARTUP:    align fold hidestars oddeven indent 
#+SEQ_TODO:   TODO(t) INPROGRESS(i) | DONE(d) CANCELED(c)
* why not using hn api
hn api will invole a lot of rest requests which would not be fast for emacs
also the data layout is already available at hn webiste, one curl call and 
then parse them to org would be faster
* parse front page
now what 
* parse comments
          <table border="0" class='comment-tree'>
            <tr class='athing comtr ' id='20724657'>
comment are same level in regard to html node 
but child comments have different ident block width

top level comment
                    <td class='ind'><img src="s.gif" height="1" width="0"></td>
child 

                    <td class='ind'><img src="s.gif" height="1" width="40"></td>
* CANCELED show number of child comments
https://emacs.stackexchange.com/questions/10245/counting-sub-headings-in-org-mode-using-elisp
or recursive on dom will be just fine

don't know about the performance impact
* DONE run eslip on org link
CLOSED: [2019-08-21 Wed 23:46]

#+begin_example org-mode
[[elisp:(find-function 'describe-function)]]
#+end_example

[[elisp:(hnreader-comment 20724363)][read]

      ;; (setq-local org-confirm-elisp-link-function nil)
      
 user org-add-link-type to avoid confirm message
 
 (org-add-link-type
 "grep" 'endless/follow-grep-link)

(defun endless/follow-grep-link (regexp)
  "Run `rgrep' with REGEXP as argument."
  (grep-compute-defaults)
  (rgrep regexp "*" (expand-file-name "./")))
https://endlessparentheses.com/use-org-mode-links-for-absolutely-anything.html

use this one 

(org-link-set-parameters TYPE &rest PARAMETERS)

Set link TYPE properties to PARAMETERS.
  PARAMETERS should be :key val pairs.
how can i register this handler?
autoload?

just a private flag on running

* DONE comment page show main link and intro text
* DONE display page takes page number
* DONE reload page
* DONE frontpage has next page link
* DONE remove * in text
find and replace raw htlm '>*' with '>-'
* add eww link
* DONE long links are cut off
(get-text-property (point) 'shr-url)
(get-text-property (point) 'htmlize-link)
(text-properties-at (point))

(font-lock-multiline t htmlize-link (:uri "elisp:(hnreader-comment 20751164)")
help-echo "LINK: elisp:(hnreader-comment 20751164)" keymap (keymap (follow-link
. mouse-face) (mouse-3 . org-find-file-at-mouse) (mouse-2 . org-open-at-mouse))
mouse-face highlight face org-link wrap-prefix #(" " 0 2 (face org-indent))
line-prefix #(" " 0 2 (face org-indent)) fontified t)

https://emacs.stackexchange.com/questions/16909/how-can-i-get-all-file-links-in-one-org-mode-file
Assuming the current buffer is an org-mode buffer, the following code collects paths of file links in the current buffer.

#+begin_example elisp
(org-element-map (org-element-parse-buffer) 'link
  (lambda (link)
    (when (string= (org-element-property :type link) "file")
      (org-element-property :path link))))
#+end_example

In an org buffer, (org-element-parse-buffer) returns the parse tree of the current buffer. And you can map over it with org-element-map.

with the org buffer, run through it find the text prop of htmlize-link

or hack shr insert link

** or a simple way chec in dom for a link and change it
downside is speed, no we need to iterate and look for a tag and then mutate it, the push it back to the dom. Since the dom is a list 

you need to map the whole dom

it works but it seems a bit slow (can't confirm thsi) and long links looks ugly
** got through the buffer look for each char
- get its text properties 'shr-url and 'htmlize-link 
if they are the same then ok, if not assign htmlize-link to value of 'shr-url
better use 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Property-Search.html#Property-Search
* DONE first run on comment buffer won't have right width
also need to shadow shr-use-fonts to nil
* DONE display OP post ins ask and OP infor
class fatitem is 4 long when ask it's 6 items long
just take from 1 to the peniculate item with seq-take and seq-drop
* DONE add back (history) button
a variable to hold history
* DONE option to open comment in same window
use pop-to-buffer isn't what we want, pop-to-buffer-same-window looks the same
as switch-to-buffer display-buffer returns windows most of the time, so use it
instead with select-window
        (select-window (display-buffer buf '(display-buffer-use-some-window)))
* DONE add header
in list pages
* DONE comment to open comment page
CLOSED: [2020-03-21 Sat 12:34]
(hnreader-read-item "https://news.ycombinator.com/item?id=22603129")
extract id then pass to hnreader-comment
* DONE add function to insert hn item to org buffer
CLOSED: [2020-03-21 Sat 12:48]
[[elisp:(hnreader-comment 1)][https://news.ycombinator.com/item?id=1]]
* DONE refactor hnreader-comment to take url instead of id
CLOSED: [2020-07-19 Sun 21:49]
it reads comment id 
actually we don't need it just read the url instead