Skip to content

Commit 1c8c89f

Browse files
committed
Add: (defface org-ql-view-title) Use in -view--header-line-format
Note that we also add a safety check in ORG-QL-VIEW--LINK-FOLLOW, because the addition of a call to PROPERTIZE in ORG-QL-VIEW--HEADER-LINE-FORMAT effectively removes what was functioning as a safety check there (as CONCAT had been signaling an error for the unsafe argument, whereas PROPERTIZE, which is called to apply the new face, does not). We also change the expected error in the tests accordingly.
1 parent c3519fb commit 1c8c89f

File tree

4 files changed

+65
-52
lines changed

4 files changed

+65
-52
lines changed

README.org

+3
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,9 @@ Simple links may also be written manually in either sexp or non-sexp form, like:
556556

557557
** 0.9-pre
558558

559+
*Additions*
560+
+ Face ~org-ql-view-title~, applied to view titles in header line.
561+
559562
*Changes*
560563
+ Command ~org-ql-find~ respects narrowing of the current buffer by default, allowing searching within the narrowed region. (Using one ~C-u~ argument widens the current buffer, and using two ~C-u~ arguments prompts for the buffers to search.)
561564
+ Function ~org-ql-completing-read~ accepts a new ~NARROWP~ argument, which is passed to ~org-ql-select~.

org-ql-view.el

+8-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
"Face for due dates in `org-ql-view' views."
6060
:group 'org-ql)
6161

62+
(defface org-ql-view-title '((t :weight bold))
63+
"View title in header line."
64+
:group 'org-ql-view)
65+
6266
;;;; Variables
6367

6468
(defvar org-ql-view-buffer-name-prefix "*Org QL View:"
@@ -459,7 +463,8 @@ subsequent refreshing of the buffer: `org-ql-view-buffers-files',
459463
If TITLE, prepend it to the header."
460464
(let* ((title (if title
461465
(concat (propertize "View:" 'face 'transient-argument)
462-
title " ")
466+
(propertize title 'face 'org-ql-view-title)
467+
" ")
463468
""))
464469
(query-formatted (when query
465470
(org-ql-view--format-query query)))
@@ -645,6 +650,8 @@ purposes of compatibility with changes in Org 9.4."
645650
(stringp buffers-files)
646651
(cl-every #'stringp buffers-files))
647652
(error "CAUTION: Link not opened because unsafe buffers-files parameter detected: %s" buffers-files))
653+
(unless (or (stringp title) (null title))
654+
(error "CAUTION: Link not opened because unsafe title parameter detected: %S" title))
648655
(when (or (listp query)
649656
(string-match (rx bol (0+ space) "(") query))
650657
;; SAFETY: Query is in sexp form: ask for confirmation, because it could contain arbitrary code.

org-ql.info

+51-48
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,10 @@ File: README.info, Node: 09-pre, Next: 089, Up: Changelog
10951095
5.1 0.9-pre
10961096
===========
10971097

1098-
*Changes*
1098+
*Additions*
1099+
• Face ‘org-ql-view-title’, applied to view titles in header line.
1100+
1101+
*Changes*
10991102
• Command ‘org-ql-find’ respects narrowing of the current buffer by
11001103
default, allowing searching within the narrowed region. (Using one
11011104
‘C-u’ argument widens the current buffer, and using two ‘C-u’
@@ -2147,53 +2150,53 @@ Node: Links39051
21472150
Node: Tips39738
21482151
Node: Changelog40062
21492152
Node: 09-pre41029
2150-
Node: helm-org-ql (1)41575
2151-
Node: 08941716
2152-
Node: 08842858
2153-
Node: 08743934
2154-
Node: 08645162
2155-
Node: 08545396
2156-
Node: 08446052
2157-
Node: 08346504
2158-
Node: 08246845
2159-
Node: 08147238
2160-
Node: 0847661
2161-
Node: 07450387
2162-
Node: 07350612
2163-
Node: 07251346
2164-
Node: 07152267
2165-
Node: 0753078
2166-
Node: 06355944
2167-
Node: 06256477
2168-
Node: 06156784
2169-
Node: 0657354
2170-
Node: 05260410
2171-
Node: 05160712
2172-
Node: 0561137
2173-
Node: 04962668
2174-
Node: 04862950
2175-
Node: 04763299
2176-
Node: 04663708
2177-
Node: 04564116
2178-
Node: 04464477
2179-
Node: 04364836
2180-
Node: 04265039
2181-
Node: 04165200
2182-
Node: 0465447
2183-
Node: 03269548
2184-
Node: 03169951
2185-
Node: 0370148
2186-
Node: 02373448
2187-
Node: 02273682
2188-
Node: 02173962
2189-
Node: 0274167
2190-
Node: 0178245
2191-
Node: Development78346
2192-
Node: Copyright assignment78579
2193-
Node: Notes79169
2194-
Node: Comparison with Org Agenda searches79333
2195-
Node: org-sidebar80222
2196-
Node: License80501
2153+
Node: helm-org-ql (1)41667
2154+
Node: 08941808
2155+
Node: 08842950
2156+
Node: 08744026
2157+
Node: 08645254
2158+
Node: 08545488
2159+
Node: 08446144
2160+
Node: 08346596
2161+
Node: 08246937
2162+
Node: 08147330
2163+
Node: 0847753
2164+
Node: 07450479
2165+
Node: 07350704
2166+
Node: 07251438
2167+
Node: 07152359
2168+
Node: 0753170
2169+
Node: 06356036
2170+
Node: 06256569
2171+
Node: 06156876
2172+
Node: 0657446
2173+
Node: 05260502
2174+
Node: 05160804
2175+
Node: 0561229
2176+
Node: 04962760
2177+
Node: 04863042
2178+
Node: 04763391
2179+
Node: 04663800
2180+
Node: 04564208
2181+
Node: 04464569
2182+
Node: 04364928
2183+
Node: 04265131
2184+
Node: 04165292
2185+
Node: 0465539
2186+
Node: 03269640
2187+
Node: 03170043
2188+
Node: 0370240
2189+
Node: 02373540
2190+
Node: 02273774
2191+
Node: 02174054
2192+
Node: 0274259
2193+
Node: 0178337
2194+
Node: Development78438
2195+
Node: Copyright assignment78671
2196+
Node: Notes79261
2197+
Node: Comparison with Org Agenda searches79425
2198+
Node: org-sidebar80314
2199+
Node: License80593
21972200

21982201
End Tag Table
21992202

tests/test-org-ql.el

+3-3
Original file line numberDiff line numberDiff line change
@@ -1986,13 +1986,13 @@ with keyword arg NOW in PLIST."
19861986
(expression-link "[[org-ql-search:todo:?title%3D%28error%20%22UNSAFE%22%29]]"))
19871987
(it "Errors for a quoted lambda"
19881988
(expect (open-link quoted-lambda-link)
1989-
:to-throw 'wrong-type-argument '(characterp lambda)))
1989+
:to-throw 'error '("CAUTION: Link not opened because unsafe title parameter detected: (lambda (_ _) (error \"UNSAFE\"))")))
19901990
(it "Errors for an unquoted lambda"
19911991
(expect (open-link unquoted-lambda-link)
1992-
:to-throw 'wrong-type-argument '(characterp lambda)))
1992+
:to-throw 'error '("CAUTION: Link not opened because unsafe title parameter detected: (lambda (_ _) (error \"UNSAFE\"))")))
19931993
(it "Errors for an expression"
19941994
(expect (open-link expression-link)
1995-
:to-throw 'wrong-type-argument '(characterp error))))
1995+
:to-throw 'error '("CAUTION: Link not opened because unsafe title parameter detected: (error \"UNSAFE\")"))))
19961996

19971997
(describe "sort parameter"
19981998
:var ((quoted-lambda-link "[[org-ql-search:todo:?sort%3D%28lambda%20%28_%20_%29%20%28error%20%22UNSAFE%22%29%29]]")

0 commit comments

Comments
 (0)