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

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

Re: Emacs freezes again when I try to open a file including only one ver


From: Eli Zaretskii
Subject: Re: Emacs freezes again when I try to open a file including only one very long line.
Date: Thu, 30 Jun 2022 16:40:07 +0300

> From: Manuel Giraud <manuel@ledu-giraud.fr>
> Cc: help-gnu-emacs@gnu.org
> Date: Thu, 30 Jun 2022 14:02:21 +0200
> 
> And that's it. It works on the "__tmp.symbols" file by modifying those
> two functions in "longlines.el" as follow (here I've just changed the
> string " " to "|"):
> 
> --8<---------------cut here---------------start------------->8---
> (defun longlines-find-break-backward ()
>   "Move point backward to the first available breakpoint and return t.
> If no breakpoint is found, return nil."
>   (and (search-backward "|" (line-beginning-position) 1)
>        (save-excursion
>          (skip-chars-backward "|" (line-beginning-position))
>          (null (bolp)))
>        (progn (forward-char 1)
>               (if (and fill-nobreak-predicate
>                        (run-hook-with-args-until-success
>                         'fill-nobreak-predicate))
>                   (progn (skip-chars-backward "|" (line-beginning-position))
>                          (longlines-find-break-backward))
>                 t))))
> 
> (defun longlines-find-break-forward ()
>   "Move point forward to the first available breakpoint and return t.
> If no break point is found, return nil."
>   (and (search-forward "|" (line-end-position) 1)
>        (progn (skip-chars-forward " " (line-end-position))
>               (null (eolp)))
>        (if (and fill-nobreak-predicate
>                 (run-hook-with-args-until-success
>                  'fill-nobreak-predicate))
>            (longlines-find-break-forward)
>          t)))
> --8<---------------cut here---------------end--------------->8---
> 
> Maybe those searches should work against a bag of separators like
> space, semicolon, veritcal bar… but it is a case to un-obsolete
> longlines.el

Feel free to suggest an improvement, like a defcustom that allows to
control what character(s) are used to break long lines.



reply via email to

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