alphapapa / alphapapa/org-ql

Use of :initial-input in org-ql-view--expand-buffers-files conflicting with completing-read

Aberta
#227 7 comentários 0 reações 1 responsável Reivindicada por @alphapapa Ver no GitHub
bug
Linguagem predominante
Emacs Lisp
Estrelas
1.6k
Forks
120
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

The [initial-input](https://github.com/alphapapa/org-ql/blob/8342656b2d9af4bb6af9daa0a8b037d3693bd940/org-ql-view.el#L1055) 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.
```

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.