Skip to content

Commit 244c829

Browse files
committed
Notes: Update
1 parent badf214 commit 244c829

File tree

1 file changed

+100
-99
lines changed

1 file changed

+100
-99
lines changed

notes.org

+100-99
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#+PROPERTY: LOGGING nil
2-
#+TODO: TODO MAYBE NEXT PROJECT UNDERWAY WAITING | DONE CANCELED
2+
#+TODO: TODO MAYBE NEXT PROJECT UNDERWAY WAITING | DONE(d) CANCELED
33

44
* [#A] Contents
55
:PROPERTIES:
@@ -23,9 +23,7 @@
2323
#+BEGIN: org-ql :query "todo: tags:bug" :columns ((priority "P") ((property "milestone") "M") (todo "Keyword") heading) :sort (priority todo date) :ts-format "%Y-%m-%d %H:%M"
2424
| P | M | Keyword | Heading |
2525
|---+-----+---------+------------------------------------------------|
26-
| A | 0.5 | NEXT | [[Write tests for storing/opening links][Write tests for storing/opening links]] |
2726
| A | 0.5 | PROJECT | [[Compatibility with Org 9.4 custom link changes][Compatibility with Org 9.4 custom link changes]] |
28-
| A | 0.5 | PROJECT | [[Fix =org-ql-view--link-open= on Org 9.3+][Fix =org-ql-view--link-open= on Org 9.3+]] |
2927
#+END:
3028

3129
** Underway ([[org-ql-search:todo%253AUNDERWAY?sort=%2528priority%2529&title=%2522Underway%2522][view]])
@@ -42,13 +40,13 @@
4240
#+BEGIN: org-ql :query "todo: priority:A" :columns ((priority "P") ((property "milestone") "M") todo heading) :sort (priority date) :take 7
4341
| P | M | Todo | Heading |
4442
|---+-----+---------+--------------------------------------------------------------|
43+
| A | 0.5 | TODO | [[Add Emacs 27.1 to =test.yml=][Add Emacs 27.1 to =test.yml=]] |
4544
| A | | NEXT | [[Make dynamic blocks warn about sexp queries][Make dynamic blocks warn about sexp queries]] |
4645
| A | 0.5 | PROJECT | [[Compatibility with Org 9.4 custom link changes][Compatibility with Org 9.4 custom link changes]] |
47-
| A | 0.5 | PROJECT | [[Fix =org-ql-view--link-open= on Org 9.3+][Fix =org-ql-view--link-open= on Org 9.3+]] |
48-
| A | 0.5 | NEXT | [[Write tests for storing/opening links][Write tests for storing/opening links]] |
4946
| A | | PROJECT | [[Convert simple sexp queries to non-sexp][Convert simple sexp queries to non-sexp]] |
5047
| A | | PROJECT | [[Checking links for unsafe parameters][Checking links for unsafe parameters]] |
5148
| A | 0.5 | TODO | [[Tag org-super-agenda 1.2 and bump required version in org-ql][Tag org-super-agenda 1.2 and bump required version in org-ql]] |
49+
| A | | PROJECT | [[Org%20link%20types%20%5B2/3%5D][Org link types {2/3}]] |
5250
#+END:
5351

5452
** Stuck projects ([[org-ql-search:(and%20(todo%20"PROJECT")%20(not%20(descendants%20(todo%20"NEXT"))))?super-groups=((:auto-parent))&sort=(priority)&title="Stuck%20Projects"][view]])
@@ -70,9 +68,8 @@
7068
#+BEGIN: org-ql :query "todo: property:milestone" :columns (((property "milestone") "M") (priority "P") todo heading) :sort (priority date) :take 7
7169
| M | P | Todo | Heading |
7270
|-----+---+---------+--------------------------------------------------------------|
71+
| 0.5 | A | TODO | [[Add Emacs 27.1 to =test.yml=][Add Emacs 27.1 to =test.yml=]] |
7372
| 0.5 | A | PROJECT | [[Compatibility with Org 9.4 custom link changes][Compatibility with Org 9.4 custom link changes]] |
74-
| 0.5 | A | PROJECT | [[Fix =org-ql-view--link-open= on Org 9.3+][Fix =org-ql-view--link-open= on Org 9.3+]] |
75-
| 0.5 | A | NEXT | [[Write tests for storing/opening links][Write tests for storing/opening links]] |
7673
| 0.5 | A | TODO | [[Tag org-super-agenda 1.2 and bump required version in org-ql][Tag org-super-agenda 1.2 and bump required version in org-ql]] |
7774
| 0.6 | B | PROJECT | [[Save view to dynamic block][Save view to dynamic block]] |
7875
#+END:
@@ -96,7 +93,6 @@
9693
- [[#fancier-searching-for-inherited-tags][Fancier searching for inherited tags]]
9794
- [[#make-dynamic-blocks-warn-about-sexp-queries][Make dynamic blocks warn about sexp queries]]
9895
- [[#compatibility-with-org-94-custom-link-changes][Compatibility with Org 9.4 custom link changes]]
99-
- [[#fix-org-ql-view--link-open-on-org-93][Fix org-ql-view--link-open on Org 9.3+]]
10096
- [[#convert-simple-sexp-queries-to-non-sexp][Convert simple sexp queries to non-sexp]]
10197
- [[#checking-links-for-unsafe-parameters][Checking links for unsafe parameters]]
10298
- [[#move-this-notes-file-into-an-orphan-metanotes-branch][Move this notes file into an orphan meta/notes branch]]
@@ -113,6 +109,7 @@
113109
- [[#update-view-screenshots][Update view screenshots]]
114110
- [[#test-caching][Test caching]]
115111
- [[#node-caching]["Node" caching]]
112+
- [[#fix-org-ql-view--link-open-on-org-93][Fix org-ql-view--link-open on Org 9.3+]]
116113
- [[#fix-query-sexp-to-string-functions-handling-of-eg-descendants][Fix query-sexp-to-string function's handling of, e.g. descendants]]
117114
- [[#helm-command][Helm command]]
118115
- [[#quickly-change-sortinggrouping-in-search-views][Quickly change sorting/grouping in search views]]
@@ -262,97 +259,6 @@ Eventually, the function org-export-custom-protocol-maybe is now called with a f
262259
Unfortunately it does not say what the new, required second argument is.
263260

264261

265-
** PROJECT [#A] Fix =org-ql-view--link-open= on Org 9.3+ :compatibility:bug:
266-
:PROPERTIES:
267-
:milestone: 0.5
268-
:url: https://github.com/alphapapa/org-ql/issues/147
269-
:END:
270-
271-
The version of Org in my personal that passes a URL-decoded string (i.e. as if run through =url-unhex-string=) as the argument to =org-ql-view--link-open=. But Org 9.3 in Emacs 27.1 passes a non-URL-decoded string, so =org-ql-view--link-open= needs to pass it through =url-unhex-string= itself.
272-
273-
But I don't know which version of Org that changed in. I'm comparing the function =org-open-at-point=, but it's a 114-line function, and in neither version does it call =url-unhex-string=, so whatever code decodes the string must be elsewhere.
274-
275-
I do recall something about links changing in Org 9.3 (or thereabouts), so that was probably part of it. Maybe I can find it in the release notes. I just need to know basically which version it happened in.
276-
277-
I noticed because the CI tests on GitHub show the link-safety tests failing on the Emacs snapshot version. However, I think they're not currently vulnerable on that Org version, because the link parameters fail to be parsed correctly, so all the arguments to =org-ql-search= should end up being nil.
278-
279-
[2020-11-14 Sat 20:41] I should probably do something like this in =org-ql-view--link-open=:
280-
281-
#+BEGIN_SRC elisp
282-
(when (version<= "9.3" (org-version))
283-
;; Org 9.3+ makes a backward-incompatible change to link escaping.
284-
;; I don't think it would be a good idea to try to guess whether
285-
;; the string received by this function was made with or without
286-
;; that change, so we'll just test the current version of Org.
287-
;; Any links created with older Org versions and then opened with
288-
;; newer ones will have to be recreated.
289-
(setf path (url-unhex-string path)))
290-
#+END_SRC
291-
292-
But, first, I should write tests for saving and opening links, so it can actually be tested on different versions automatically.
293-
294-
*** NEXT [#A] Write tests for storing/opening links
295-
:PROPERTIES:
296-
:milestone: 0.5
297-
:END:
298-
299-
*** DONE [#A] Check Org release notes for link changes
300-
301-
[2020-11-13 Fri 22:44] From [[https://www.orgmode.org/Changes_old.html][the changelog]]:
302-
303-
#+BEGIN_QUOTE
304-
Change bracket link escaping syntax
305-
306-
Org used to percent-encode sensitive characters in the URI part of the bracket links.
307-
308-
Now, escaping mechanism uses the usual backslash character, according to the following rules, applied in order:
309-
310-
- All consecutive \ characters at the end of the link must be escaped;
311-
- Any ] character at the very end of the link must be escaped;
312-
- All consecutive \ characters preceding ][ or ]] patterns must be escaped;
313-
- Any ] character followed by either [ or ] must be escaped;
314-
- Others ] and \ characters need not be escaped.
315-
316-
When in doubt, use the function org-link-escape in order to turn a link string into its properly escaped form.
317-
318-
The following function will help switching your links to the new syntax:
319-
320-
(defun org-update-link-syntax (&optional no-query)
321-
"Update syntax for links in current buffer.
322-
Query before replacing a link, unless optional argument NO-QUERY
323-
is non-nil."
324-
(interactive "P")
325-
(org-with-point-at 1
326-
(let ((case-fold-search t))
327-
(while (re-search-forward "\\[\\[[^]]*?%\\(?:2[05]\\|5[BD]\\)" nil t)
328-
(let ((object (save-match-data (org-element-context))))
329-
(when (and (eq 'link (org-element-type object))
330-
(= (match-beginning 0)
331-
(org-element-property :begin object)))
332-
(goto-char (org-element-property :end object))
333-
(let* ((uri-start (+ 2 (match-beginning 0)))
334-
(uri-end (save-excursion
335-
(goto-char uri-start)
336-
(re-search-forward "\\][][]" nil t)
337-
(match-beginning 0)))
338-
(uri (buffer-substring-no-properties uri-start uri-end)))
339-
(when (or no-query
340-
(y-or-n-p
341-
(format "Possibly obsolete URI syntax: %S. Fix? "
342-
uri)))
343-
(setf (buffer-substring uri-start uri-end)
344-
(org-link-escape (org-link-decode uri)))))))))))
345-
346-
The old org-link-escape and org-link-unescape functions have been renamed into org-link-encode and org-link-decode.
347-
#+END_QUOTE
348-
349-
This is exactly the kind of breaking, backwards-incompatible change that I've said should mandate a major-version increment. It's not only a change in Org's code, and a change that affects third-party packages, but it's a change in the file format!
350-
351-
Is it even possible to support both Org 9.3+ and earlier versions at the same time?
352-
353-
This change doesn't even seem to make sense to me. Percent-encoding solves so many problems in a simple way: pass a string to the encoding function on the way in, and to the decoding function on the way out. Now, instead of a simple, standard way of encoding links, there's a list of Org-specific rules and Org-specific encoding/decoding functions. What is gained this way?
354-
355-
356262
** PROJECT [#A] Convert simple sexp queries to non-sexp
357263

358264
[2020-11-11 Wed 00:28] This will be very helpful for storing links. Surely simple ones won't be too hard...
@@ -1495,6 +1401,101 @@ This works okay (except the priority accessor needs to be fixed, because Org pri
14951401
:action #'helm-org-goto-marker))))
14961402
#+END_SRC
14971403

1404+
** DONE [#A] Fix =org-ql-view--link-open= on Org 9.3+ :compatibility:bug:
1405+
:PROPERTIES:
1406+
:milestone: 0.5
1407+
:url: https://github.com/alphapapa/org-ql/issues/147
1408+
:END:
1409+
1410+
The version of Org in my personal that passes a URL-decoded string (i.e. as if run through =url-unhex-string=) as the argument to =org-ql-view--link-open=. But Org 9.3 in Emacs 27.1 passes a non-URL-decoded string, so =org-ql-view--link-open= needs to pass it through =url-unhex-string= itself.
1411+
1412+
But I don't know which version of Org that changed in. I'm comparing the function =org-open-at-point=, but it's a 114-line function, and in neither version does it call =url-unhex-string=, so whatever code decodes the string must be elsewhere.
1413+
1414+
I do recall something about links changing in Org 9.3 (or thereabouts), so that was probably part of it. Maybe I can find it in the release notes. I just need to know basically which version it happened in.
1415+
1416+
I noticed because the CI tests on GitHub show the link-safety tests failing on the Emacs snapshot version. However, I think they're not currently vulnerable on that Org version, because the link parameters fail to be parsed correctly, so all the arguments to =org-ql-search= should end up being nil.
1417+
1418+
[2020-11-14 Sat 20:41] I should probably do something like this in =org-ql-view--link-open=:
1419+
1420+
#+BEGIN_SRC elisp
1421+
(when (version<= "9.3" (org-version))
1422+
;; Org 9.3+ makes a backward-incompatible change to link escaping.
1423+
;; I don't think it would be a good idea to try to guess whether
1424+
;; the string received by this function was made with or without
1425+
;; that change, so we'll just test the current version of Org.
1426+
;; Any links created with older Org versions and then opened with
1427+
;; newer ones will have to be recreated.
1428+
(setf path (url-unhex-string path)))
1429+
#+END_SRC
1430+
1431+
But, first, I should write tests for saving and opening links, so it can actually be tested on different versions automatically.
1432+
1433+
[2020-11-16 Mon 05:12] Finally, all of the tests pass on my Org version and on 9.3. And I tested for all the combinations of link and bookmark saving/opening I could think of. I hope they work and are safe.
1434+
1435+
*** DONE [#A] Write tests for storing/opening links
1436+
:PROPERTIES:
1437+
:milestone: 0.5
1438+
:END:
1439+
1440+
[2020-11-16 Mon 05:11] Took way longer than I expected. I hope it was worth it.
1441+
1442+
*** DONE [#A] Check Org release notes for link changes
1443+
1444+
[2020-11-13 Fri 22:44] From [[https://www.orgmode.org/Changes_old.html][the changelog]]:
1445+
1446+
#+BEGIN_QUOTE
1447+
Change bracket link escaping syntax
1448+
1449+
Org used to percent-encode sensitive characters in the URI part of the bracket links.
1450+
1451+
Now, escaping mechanism uses the usual backslash character, according to the following rules, applied in order:
1452+
1453+
- All consecutive \ characters at the end of the link must be escaped;
1454+
- Any ] character at the very end of the link must be escaped;
1455+
- All consecutive \ characters preceding ][ or ]] patterns must be escaped;
1456+
- Any ] character followed by either [ or ] must be escaped;
1457+
- Others ] and \ characters need not be escaped.
1458+
1459+
When in doubt, use the function org-link-escape in order to turn a link string into its properly escaped form.
1460+
1461+
The following function will help switching your links to the new syntax:
1462+
1463+
(defun org-update-link-syntax (&optional no-query)
1464+
"Update syntax for links in current buffer.
1465+
Query before replacing a link, unless optional argument NO-QUERY
1466+
is non-nil."
1467+
(interactive "P")
1468+
(org-with-point-at 1
1469+
(let ((case-fold-search t))
1470+
(while (re-search-forward "\\[\\[[^]]*?%\\(?:2[05]\\|5[BD]\\)" nil t)
1471+
(let ((object (save-match-data (org-element-context))))
1472+
(when (and (eq 'link (org-element-type object))
1473+
(= (match-beginning 0)
1474+
(org-element-property :begin object)))
1475+
(goto-char (org-element-property :end object))
1476+
(let* ((uri-start (+ 2 (match-beginning 0)))
1477+
(uri-end (save-excursion
1478+
(goto-char uri-start)
1479+
(re-search-forward "\\][][]" nil t)
1480+
(match-beginning 0)))
1481+
(uri (buffer-substring-no-properties uri-start uri-end)))
1482+
(when (or no-query
1483+
(y-or-n-p
1484+
(format "Possibly obsolete URI syntax: %S. Fix? "
1485+
uri)))
1486+
(setf (buffer-substring uri-start uri-end)
1487+
(org-link-escape (org-link-decode uri)))))))))))
1488+
1489+
The old org-link-escape and org-link-unescape functions have been renamed into org-link-encode and org-link-decode.
1490+
#+END_QUOTE
1491+
1492+
This is exactly the kind of breaking, backwards-incompatible change that I've said should mandate a major-version increment. It's not only a change in Org's code, and a change that affects third-party packages, but it's a change in the file format!
1493+
1494+
Is it even possible to support both Org 9.3+ and earlier versions at the same time?
1495+
1496+
This change doesn't even seem to make sense to me. Percent-encoding solves so many problems in a simple way: pass a string to the encoding function on the way in, and to the decoding function on the way out. Now, instead of a simple, standard way of encoding links, there's a list of Org-specific rules and Org-specific encoding/decoding functions. What is gained this way?
1497+
1498+
14981499
** DONE [#A] Fix query-sexp-to-string function's handling of, e.g. =descendants= :bug:
14991500
:PROPERTIES:
15001501
:milestone: 0.5

0 commit comments

Comments
 (0)