org-ql
org-ql copied to clipboard
Use of :initial-input in org-ql-view--expand-buffers-files conflicting with completing-read
The initial-input in the org-ql-view--expand-buffers-files
is causing an issue with completing-read. When I try the C-u r
command from org-ql-view
:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
completing-read-default("Buffers/Files: " (buffer org-agenda-files org-directory all) nil nil ("~/Documents/org/brain/research_papers.org") nil nil nil)
completing-read("Buffers/Files: " (buffer org-agenda-files org-directory all) nil nil ("~/Documents/org/brain/research_papers.org"))
(org-ql-view--expand-buffers-files (completing-read "Buffers/Files: " (list 'buffer 'org-agenda-files 'org-directory 'all) nil nil (funcall --cl-initial-input--)))
(if (and org-ql-view-buffers-files (bufferp org-ql-view-buffers-files)) org-ql-view-buffers-files (org-ql-view--expand-buffers-files (completing-read "Buffers/Files: " (list 'buffer 'org-agenda-files 'org-directory 'all) nil nil (funcall --cl-initial-input--))))
(let (--cl-initial-input--) (setq --cl-initial-input-- #'(lambda nil (if org-ql-view-buffers-files (progn (org-ql-view--contract-buffers-files org-ql-view-buffers-files))))) (message "%s" (funcall --cl-initial-input--)) (if (and org-ql-view-buffers-files (bufferp org-ql-view-buffers-files)) org-ql-view-buffers-files (org-ql-view--expand-buffers-files (completing-read "Buffers/Files: " (list 'buffer 'org-agenda-files 'org-directory 'all) nil nil (funcall --cl-initial-input--)))))
org-ql-view--complete-buffers-files()
(list (org-ql-view--complete-buffers-files) (read-string "Query: " (if org-ql-view-query (progn (format "%S" org-ql-view-query)))) :narrow (or org-ql-view-narrow (eq current-prefix-arg '(4))) :super-groups (org-ql-view--complete-super-groups) :sort (org-ql-view--complete-sort))
call-interactively(org-ql-search)
(if prompt (call-interactively #'org-ql-search) (apply #'org-ql-search defaults))
(let* ((current-line (buffer-substring-no-properties (line-beginning-position) (line-end-position))) (old-pos (point)) (defaults (list org-ql-view-buffers-files org-ql-view-query :sort org-ql-view-sort :narrow org-ql-view-narrow :super-groups org-ql-view-super-groups :title org-ql-view-title)) (org-ql-view-buffer (current-buffer))) (if prompt (call-interactively #'org-ql-search) (apply #'org-ql-search defaults)) (rename-buffer (format "%s %s*" org-ql-view-buffer-name-prefix (or org-ql-view-title org-ql-view-query)) 'unique) (goto-char (point-min)) (or (if (search-forward current-line nil t) (progn (beginning-of-line))) (goto-char old-pos)) (message "View refreshed"))
org-ql-view-refresh((4))
funcall-interactively(org-ql-view-refresh (4))
call-interactively(org-ql-view-refresh nil nil)
command-execute(org-ql-view-refresh)
The initial-input
label referred above returns a list with only one string. But according to the docs, it is expected to be a cons of the form (string . position)
. I initially noticed this with selectum, where selectrum is operating under the assumption that the cdr
of the initial-input is a number, which is what is causing the issue. Also, according to the docs, this feature is deprecated?
If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
with point positioned at the end. If it is (STRING . POSITION), the
initial input is STRING, but point is placed at _zero-indexed_
position POSITION in STRING. (*Note* that this is different from
‘read-from-minibuffer’ and related functions, which use one-indexing
for POSITION.) This feature is deprecated--it is best to pass nil
for INITIAL-INPUT and supply the default value DEF instead. The
user can yank the default value into the minibuffer easily using
M-n.
Thanks, I'll look into this.
as a temporary fix I have the following edit in org-ql-view:
(defun org-ql-view--complete-buffers-files ()
"Return value for `org-ql-view-buffers-files' using completion."
(cl-labels ((initial-input
() (when org-ql-view-buffers-files
(cons (car (org-ql-view--contract-buffers-files
org-ql-view-buffers-files))
0))))
....
Retargeting this for 0.7. 0.6 has been delayed for too long.
I'm afraid I need to defer this again. Apologies that I haven't made time to review this fully yet. With the limited time I have, I often have to prioritize features that I need myself, and this hasn't affected me much yet. In the meantime, features I do need are ready to be tagged for release.
For future reference: These issues/PRs are a part of this overall feature:
- https://github.com/alphapapa/org-ql/issues/260
- https://github.com/alphapapa/org-ql/pull/311
Also, @ahmed-shariff: I'm still hoping to upstream org-ql
into org.git eventually. Work toward that might start sometime next year. That will mean, of course, having to assign copyright to the FSF. Have you signed the FSF CA for Emacs? If not, can you do so for the sake of these changes? Thanks.
I understand.
I am glad to know org-ql could become part of org, that's exciting. I have not signed the FSF. Correct me if I am wrong - I have to follow this: https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future right?
I have to clarify a few things with my employer(s)/school. Once clarified I'll sign them.
Ahmed Shariff @.***> writes:
... Correct me if I am wrong - I have to follow this: https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future right?
Yes. Also, see https://orgmode.org/worg/org-contribute.html#copyright
-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92