help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs freezes when editing a file with one extremely long line even


From: Hongyi Zhao
Subject: Re: Emacs freezes when editing a file with one extremely long line even with so-long-minor-mode enabled.
Date: Sun, 8 May 2022 13:47:33 +0800

On Sun, May 8, 2022 at 1:36 PM Michael Heerdegen
<michael_heerdegen@web.de> wrote:
>
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > I suggest to try M-: (require 'longlines) RET M-x longlines-mode RET.
>
> Please try with these settings:
>
>   (setq-default so-long-target-modes t)
>   (setq-default so-long-action 'longlines-mode)
>   (setq-default longlines-show-hard-newlines t)
>   (global-so-long-mode +1)

Wonderful trick. This works smoothly. See the attached file for more details.

> That should make opening and editing your file work ok out of the box.
> All newlines not explicitly indicated (most of them) are "virtual" and
> not included when saving.

But I'm currently using the following configuration in my
`~/.emacs.d/init.el`, I wonder how to merge your above tricks into
them, as shown below:

```
(use-package so-long
  :config
  ;; https://elpa.gnu.org/packages/so-long.html
  ;; * Example configuration
  ;; -----------------------
  ;; If you prefer to configure in code rather than via the customize interface,
  ;; then you might use something along these lines:

  ;; Enable so-long library.
  (when (require 'so-long nil :noerror)
    (global-so-long-mode 1)
    ;; Basic settings.
    (setq so-long-action 'so-long-minor-mode)
    (setq so-long-threshold 1000)
    (setq so-long-max-lines 100)
    ;; Additional target major modes to trigger for.
    (mapc (apply-partially #'add-to-list 'so-long-target-modes)
          '(sgml-mode nxml-mode))
    ;; Additional buffer-local minor modes to disable.
    (mapc (apply-partially #'add-to-list 'so-long-minor-modes)
          '(diff-hl-mode diff-hl-amend-mode diff-hl-flydiff-mode))
    ;; Additional variables to override.
    (mapc (apply-partially #'add-to-list 'so-long-variable-overrides)
          '((show-trailing-whitespace . nil)
            (truncate-lines . nil))))
  )
```

> Michael.

Yours,
HZ

Attachment: image.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]