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: Manuel Giraud
Subject: Re: Emacs freezes again when I try to open a file including only one very long line.
Date: Thu, 30 Jun 2022 14:02:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix)

Manuel Giraud <manuel@ledu-giraud.fr> writes:

[...]

> My bad: I hadn't tested with this new file and here longlines-mode does
> not help that much (Emacs is still responsive for me though). It might
> be that longlines-mode is searching for space and there is none in this
> file.

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
-- 
Manuel Giraud



reply via email to

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