[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22143: 24.5; Emacs blocked on long lines.
From: |
Stefan Kangas |
Subject: |
bug#22143: 24.5; Emacs blocked on long lines. |
Date: |
Fri, 21 Aug 2020 06:53:24 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Oleksandr Gavenko <gavenkoa@gmail.com> writes:
> It is usual for me to open files with large lines in Emacs.
>
> Some times this was log, or executable, or dump.
>
> But usually this was minified .js or .json file.
>
> And only thing I can do is to live with slowness or to kill Emacs and may be
> clean corresponding desktop-mode entries for *bad* file.
>
> I contribute piece to:
>
>
> http://emacs.stackexchange.com/questions/598/how-do-i-handle-files-with-extremely-long-lines
>
> Here it is:
>
> (setq line-number-display-limit large-file-warning-threshold)
> (setq line-number-display-limit-width 200)
>
> (defun my--is-file-large ()
> "If buffer too large and my cause performance issue."
> (< large-file-warning-threshold (buffer-size)))
>
> (define-derived-mode my-large-file-mode fundamental-mode "LargeFile"
> "Fixes performance issues in Emacs for large files."
> ;; (setq buffer-read-only t)
> (setq bidi-display-reordering nil)
> (jit-lock-mode nil)
> (buffer-disable-undo)
> (set (make-variable-buffer-local 'global-hl-line-mode) nil)
> (set (make-variable-buffer-local 'line-number-mode) nil)
> (set (make-variable-buffer-local 'column-number-mode) nil) )
>
> (add-to-list 'magic-mode-alist (cons #'my--is-file-large
> #'my-large-file-mode))
>
> But it is for a large files (but help me in many case because files with long
> lines usually also themselves big). I didn't investigate how to make test for
> long
> lines jet.
>
> Even with those settings some files (usually minified .js libraries or .json
> files) froze Emacs. I think due to js-mode, but...
>
> I would like to hear solution for long line issue or a way to detect long
> lines and prevent file from opening (or decide to risk if lines is not toooo
> long).
>
> My point instead of restarting Emacs daemon - safely warn about long lines so
> I have a chance to preserve my Emacs session before Emacs die.
Is this better with so-long.el?
etc/PROBLEMS says:
*** Editing files with very long lines is slow.
For example, simply moving through a file that contains hundreds of
thousands of characters per line is slow, and consumes a lot of CPU.
This is a known limitation of Emacs with no solution at this time.
Is there anything more we can/should do in this case short of rewriting
the display engine? Does it make sense to track this limitation in a
bug report?
Best regards,
Stefan Kangas
- bug#22143: 24.5; Emacs blocked on long lines.,
Stefan Kangas <=