Fix: (-view--link-store, -view--link-open) Types, current-buffer
This is regrettably complicated. Maybe someday Elsa will help... Fixes #147 (again). Thanks to @tpeacock19 for reporting.
This commit is contained in:
parent
60b457eea4
commit
23e73addcf
1 changed files with 14 additions and 7 deletions
|
|
@ -619,8 +619,9 @@ protocol. See, e.g. `org-ql-view--link-store'."
|
||||||
(read it)))
|
(read it)))
|
||||||
(title (--when-let (alist-get "title" params nil nil #'string=)
|
(title (--when-let (alist-get "title" params nil nil #'string=)
|
||||||
(read it)))
|
(read it)))
|
||||||
(buffers-files (--when-let (alist-get "buffers-files" params nil nil #'string=)
|
(buffers-files (--if-let (alist-get "buffers-files" params nil nil #'string=)
|
||||||
(read it))))
|
(read it)
|
||||||
|
(current-buffer))))
|
||||||
(when (and org-ql-view-ask-unsafe-links
|
(when (and org-ql-view-ask-unsafe-links
|
||||||
(or (string-match (rx bol (0+ space) "(") query)
|
(or (string-match (rx bol (0+ space) "(") query)
|
||||||
(listp query)))
|
(listp query)))
|
||||||
|
|
@ -644,12 +645,18 @@ When opened, the link searches the buffer it's opened from."
|
||||||
(require 'url-parse)
|
(require 'url-parse)
|
||||||
(require 'url-util)
|
(require 'url-util)
|
||||||
(when org-ql-view-query
|
(when org-ql-view-query
|
||||||
(unless (or (bufferp org-ql-view-buffers-files)
|
(unless (cl-etypecase org-ql-view-buffers-files
|
||||||
(file-exists-p org-ql-view-buffers-files)
|
;; I really wish `anaphora' were in ELPA, because `aetypecase' would be
|
||||||
(and (listp org-ql-view-buffers-files)
|
;; nice here, and I'd prefer to avoid adding more MELPA-only dependencies.
|
||||||
(cl-every #'file-exists-p org-ql-view-buffers-files)))
|
(buffer t)
|
||||||
|
(string (file-exists-p org-ql-view-buffers-files))
|
||||||
|
(list (and (cl-every #'stringp org-ql-view-buffers-files)
|
||||||
|
(cl-every #'file-exists-p org-ql-view-buffers-files))))
|
||||||
(user-error "Can only store links to views of either a single buffer/file or a list of files"))
|
(user-error "Can only store links to views of either a single buffer/file or a list of files"))
|
||||||
(let* ((params (list (when org-ql-view-buffers-files
|
(let* ((params (list (when (and org-ql-view-buffers-files
|
||||||
|
;; If it's one buffer (i.e. the view searches the current
|
||||||
|
;; buffer), don't serialize it, because buffers are unreadable.
|
||||||
|
(not (bufferp org-ql-view-buffers-files)))
|
||||||
(list "buffers-files" (prin1-to-string org-ql-view-buffers-files)))
|
(list "buffers-files" (prin1-to-string org-ql-view-buffers-files)))
|
||||||
(when org-ql-view-super-groups
|
(when org-ql-view-super-groups
|
||||||
(list "super-groups" (prin1-to-string org-ql-view-super-groups)))
|
(list "super-groups" (prin1-to-string org-ql-view-super-groups)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue