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

Remove the restriction on printing for dirvish-data-for-dir #266

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

isamert
Copy link
Contributor

@isamert isamert commented May 17, 2024

The line

(format "%S" `(message "%s" ,(dirvish--dir-data-getter dir)))

Sometimes generates something like:

(with-temp-buffer (let ((hash ...) (bk ...)) (dolist (file ...) (let* ... ... ...)) (prin1 (cons bk hash) (current-buffer))) (buffer-substring-no-properties (point-min) (point-max)))

which is then sent to emacs -Q to run but of course it fails to run because of the ellipses all over the code. These ellipses are managed by print-length and print-level variables which are when set to nil never generates ellipses.

Possibly we need to set these variables to nil whenever we generate code using (format "%S") but I haven't had any problems with other parts so far.

The line

```elisp
(format "%S" `(message "%s" ,(dirvish--dir-data-getter dir)))
```

Sometimes generates something like:

```elisp
(with-temp-buffer (let ((hash ...) (bk ...)) (dolist (file ...) (let* ... ... ...)) (prin1 (cons bk hash) (current-buffer))) (buffer-substring-no-properties (point-min) (point-max)))
```

which is then sent to `emacs -Q` to run but of course it fails to run
because of the ellipses all over the code. These ellipses are managed
by `print-length` and `print-level` variables which are when set to
`nil` never generates ellipses.

Possibly we need to set these variables to `nil` whenever we generate
code using `(format "%S")` but I haven't had any problems with other
parts so far.
hlissner added a commit to hlissner/dirvish that referenced this pull request Aug 7, 2024
@Thaodan
Copy link

Thaodan commented Nov 8, 2024

Oh thank you so much for the workaround.
It makes me me wonder if querying the files this way is the right approach in general.

@Thaodan
Copy link

Thaodan commented Nov 10, 2024

I refactored the background process functions to use async which uses the same safe guards and more.
I also could refactor some of the code to be a little simpler:
https://github.com/alexluigit/dirvish/commits/async_package_use

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

Successfully merging this pull request may close these issues.

2 participants