Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate entries for buffers-or-files produces duplicate items in result #261

Closed
ahmed-shariff opened this issue Oct 12, 2021 · 2 comments

Comments

@ahmed-shariff
Copy link

ahmed-shariff commented Oct 12, 2021

Related to discussion in #258

If there a duplicate entries in the buffers-or-files, they are not filtered out, resulting in duplicate entries in the result.

To reproduce:
if content of file1.org are:

* heading 1 in file1
* heading 2 in file1
(let ((file-name "file1.org"))
  (with-current-buffer (find-file-noselect file-name)
    (org-ql-select (list (current-buffer) file-name) '(level 1)
      :action (lambda () (substring-no-properties (org-get-heading t t t t))))
    ;;; result: ("heading 1 in file1" "heading 2 in file1" "heading 1 in file1" "heading 2 in file1")
    (org-ql-select (list file-name file-name) '(level 1)
      :action (lambda () (substring-no-properties (org-get-heading t t t t))))
    ;;; result: ("heading 1 in file1" "heading 2 in file1" "heading 1 in file1" "heading 2 in file1")
    ))
@alphapapa
Copy link
Owner

This doesn't seem like a problem to me. Why should it be the responsibility of org-ql-select to remove these duplicate filenames rather than that of the calling code? And doing it in org-ql-select would mean imposing that cost on every call, even when it's not necessary.

@ahmed-shariff
Copy link
Author

Sounds good to me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants