From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#45652: so-long mode not triggered despite big file with very long lines Date: Tue, 12 Jan 2021 08:10:40 +1300 Message-ID: <7c08fce6-843b-6b7a-ab02-e947a9952a1b@orcon.net.nz> References: <877dosudon.5.fsf@jidanni.org> <87k0sjljjp.5.fsf@jidanni.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30940"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 45652@debbugs.gnu.org To: =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 20:43:57 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz36a-0007wC-H0 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 20:43:56 +0100 Original-Received: from localhost ([::1]:55200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz36Z-0003OY-JF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 14:43:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz2ak-0006sa-Gr for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 14:11:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz2aj-0007kC-O1 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 14:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kz2aj-0002h9-JX for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 14:11:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jan 2021 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45652 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 45652-submit@debbugs.gnu.org id=B45652.161039224610336 (code B ref 45652); Mon, 11 Jan 2021 19:11:01 +0000 Original-Received: (at 45652) by debbugs.gnu.org; 11 Jan 2021 19:10:46 +0000 Original-Received: from localhost ([127.0.0.1]:58281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz2aT-0002gd-TS for submit@debbugs.gnu.org; Mon, 11 Jan 2021 14:10:46 -0500 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:42661) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz2aR-0002gU-Rn for 45652@debbugs.gnu.org; Mon, 11 Jan 2021 14:10:44 -0500 Original-Received: from [101.53.216.160] (port=49789 helo=[192.168.20.103]) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1kz2aO-0003Bn-LU; Tue, 12 Jan 2021 08:10:40 +1300 In-Reply-To: <87k0sjljjp.5.fsf@jidanni.org> Content-Language: en-GB X-GeoIP: NZ X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:197740 Archived-At: On 12/01/21 1:55 am, 積丹尼 Dan Jacobson wrote: > Let's make a deal: have so-long mode be the default (for those > who have opted in) for all "big" files in the first place. Emacs currently notices when you ask it to visit a very large file, and offers to let you open the file 'literally' which I would suggest trying if you are unsure of the contents. See (info "(emacs)Visiting") That's already a good way to improve performance in the buffer (with its own set of trade-offs), but adding a so-long option to that menu could be something to consider. That aside, a custom `so-long-predicate' could use the buffer length as a trigger, instead of scanning for newlines. > I recall for this .har, it starts out well behaved, but then > the whopping lines are closer to the bottom of the file. That might remain problematic, then. You could always configure Emacs to open all .har files in so-long-mode, if this is the only way you encounter them? > Even having emacs scan a file for big lines sounds like it > might be risky. There's no risk in checking where the newlines are, other than time expended in doing it. (It should be pretty quick, provided the number of lines being scanned isn't absolutely massive.) On that note though, I have been wondering whether the newline cache (not part of so-long) could keep tabs on the longest line seen thus far when it's being built, and store that value in a buffer-local variable which so-long could see? I don't know much about that cache; but if it's all built when the file is initially inserted into the buffer, then this could be a nice alternative to having so-long scan for long lines itself, and may let us 'see' the whole file, rather than just checking the first N lines. > PS> for `so-long-detected-long-line-p' for details. > Not yet in 27.1 It's definitely in 27.1, if so-long.el is loaded. It's a function. "C-h o so-long-detected-long-line-p" should find it. -Phil