elisp-format
elisp-format copied to clipboard
elisp-format-region might run into an infinite loop
Hi there,
thank you very much for this package.
I encountered a small bug a few days ago. Formatting the code in the attached file will send elisp-format into an infinite loop (more precisely, the while loop in elisp-format-region never terminates). The occurence of the bug seems to depend on the value of elisp-format-column, which is 100 for me.
Sorry late reply. Recently, I don't write elisp codes...
If someone can make PR, then I can verify, and accept.
I find the same bug.
When I run elisp-format-buffer
in following buffer,
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
(use-package treemacs
:config (progn
(setq treemacs-goto-tag-strategy 'refetch-index
treemacs-header-scroll-indicators '(nil . "asd"))))
(setq elisp-format-debug-mode t)
(setq elisp-format-column 100)
the formating seems not terminates.
This is the message output:
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
8
Format string at 8 completed.
I find the same bug. When I run
elisp-format-buffer
in following buffer,;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. (use-package treemacs :config (progn (setq treemacs-goto-tag-strategy 'refetch-index treemacs-header-scroll-indicators '(nil . "asd")))) (setq elisp-format-debug-mode t) (setq elisp-format-column 100)
the formating seems not terminates.
This is the message output:
Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed. 8 Format string at 8 completed.
It seems that some format process could not reduce the current-column
so that the while loop never terminates.