Fix: (org-ql-completing-read) Warn about empty headings
This commit is contained in:
parent
be20dc3d5b
commit
56e203110b
3 changed files with 49 additions and 39 deletions
|
|
@ -549,6 +549,7 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
|
|||
+ Query parser ignores leading whitespace (e.g. preventing errors while the user is typing a query into ~org-ql-find~).
|
||||
+ Use of ~org-ql-find~ with ~:query-prefix~ argument prevented selection of results. ([[https://github.com/alphapapa/org-ql/issues/351][#351]]. Thanks to [[https://github.com/danielfleischer][Daniel Fleischer]] for reporting.)
|
||||
+ Handle narrowed buffers correctly in ~org-ql-find~.
|
||||
+ Warn about empty headings in ~org-ql-completing-read~ (the Org format allows a heading line to have no text, but it's useless for this purpose, and usually indicates unnoticed corruption).
|
||||
|
||||
** 0.7.1
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,12 @@ single predicate)."
|
|||
;; optional arguments in a certain Org version, so in those versions, it will
|
||||
;; return priority cookies and comment strings.
|
||||
(let ((heading (org-link-display-format (org-entry-get (point) "ITEM"))))
|
||||
(if (string-empty-p heading)
|
||||
;; A heading's string can be empty, but we can't use one because it
|
||||
;; wouldn't be useful to the user; and if one is found, it's very
|
||||
;; likely to indicate an unnoticed mistake or corruption in the
|
||||
;; file: so display a warning and don't record it as a candidate.
|
||||
(warn "Empty heading at %S in %S" (point) (buffer-name))
|
||||
(when (gethash heading table)
|
||||
;; Disambiguate heading (even adding the path isn't enough, because that could
|
||||
;; also be duplicated).
|
||||
|
|
@ -124,7 +130,7 @@ single predicate)."
|
|||
(setf heading (format "%s <%s>" heading (cl-incf suffix)))
|
||||
(setf heading (format "%s <%s>" heading (puthash heading 2 disambiguations)))))
|
||||
(let ((marker (point-marker)))
|
||||
(puthash (propertize heading 'org-marker marker) marker table))))
|
||||
(puthash (propertize heading 'org-marker marker) marker table)))))
|
||||
(path (marker)
|
||||
(org-with-point-at marker
|
||||
(let* ((path (thread-first (org-get-outline-path nil t)
|
||||
|
|
|
|||
65
org-ql.info
65
org-ql.info
|
|
@ -1038,6 +1038,9 @@ File: README.info, Node: 072-pre, Next: 071, Up: Changelog
|
|||
(https://github.com/alphapapa/org-ql/issues/351). Thanks to Daniel
|
||||
Fleischer (https://github.com/danielfleischer) for reporting.)
|
||||
• Handle narrowed buffers correctly in ‘org-ql-find’.
|
||||
• Warn about empty headings in ‘org-ql-completing-read’ (the Org
|
||||
format allows a heading line to have no text, but it’s useless for
|
||||
this purpose, and usually indicates unnoticed corruption).
|
||||
|
||||
|
||||
File: README.info, Node: 071, Next: 07, Prev: 072-pre, Up: Changelog
|
||||
|
|
@ -1779,37 +1782,37 @@ Node: Links37257
|
|||
Node: Tips37944
|
||||
Node: Changelog38268
|
||||
Node: 072-pre39053
|
||||
Node: 07139760
|
||||
Node: 0740573
|
||||
Node: 06343497
|
||||
Node: 06244028
|
||||
Node: 06144333
|
||||
Node: 0644901
|
||||
Node: 05247955
|
||||
Node: 05148255
|
||||
Node: 0548678
|
||||
Node: 04950209
|
||||
Node: 04850491
|
||||
Node: 04750840
|
||||
Node: 04651249
|
||||
Node: 04551657
|
||||
Node: 04452018
|
||||
Node: 04352377
|
||||
Node: 04252580
|
||||
Node: 04152741
|
||||
Node: 0452988
|
||||
Node: 03257089
|
||||
Node: 03157492
|
||||
Node: 0357689
|
||||
Node: 02360989
|
||||
Node: 02261223
|
||||
Node: 02161503
|
||||
Node: 0261708
|
||||
Node: 0165786
|
||||
Node: Notes65887
|
||||
Node: Comparison with Org Agenda searches66049
|
||||
Node: org-sidebar66938
|
||||
Node: License67217
|
||||
Node: 07139972
|
||||
Node: 0740785
|
||||
Node: 06343709
|
||||
Node: 06244240
|
||||
Node: 06144545
|
||||
Node: 0645113
|
||||
Node: 05248167
|
||||
Node: 05148467
|
||||
Node: 0548890
|
||||
Node: 04950421
|
||||
Node: 04850703
|
||||
Node: 04751052
|
||||
Node: 04651461
|
||||
Node: 04551869
|
||||
Node: 04452230
|
||||
Node: 04352589
|
||||
Node: 04252792
|
||||
Node: 04152953
|
||||
Node: 0453200
|
||||
Node: 03257301
|
||||
Node: 03157704
|
||||
Node: 0357901
|
||||
Node: 02361201
|
||||
Node: 02261435
|
||||
Node: 02161715
|
||||
Node: 0261920
|
||||
Node: 0165998
|
||||
Node: Notes66099
|
||||
Node: Comparison with Org Agenda searches66261
|
||||
Node: org-sidebar67150
|
||||
Node: License67429
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue