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 15:42:37 +1300 Message-ID: <9463451af6d023fb4595ffa9182615b6@webmail.orcon.net.nz> References: <877dosudon.5.fsf@jidanni.org> <87wnwjco89.fsf@gnus.org> <877dojclv5.fsf@gnus.org> <8735z7chdj.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35337"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail Cc: 45652@debbugs.gnu.org, =?UTF-8?Q?=E7=A9=8D=E4=B8=B9=E5=B0=BC?= Dan Jacobson To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 12 03:43:18 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 1kz9eQ-000968-Ig for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 03:43:18 +0100 Original-Received: from localhost ([::1]:40840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz9eP-0002eX-IZ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 21:43:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz9eA-0002eM-ON for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 21:43:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz9eA-0004bf-G9 for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 21:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kz9eA-0008Bb-Cr for bug-gnu-emacs@gnu.org; Mon, 11 Jan 2021 21:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Jan 2021 02:43:02 +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.161041936331438 (code B ref 45652); Tue, 12 Jan 2021 02:43:02 +0000 Original-Received: (at 45652) by debbugs.gnu.org; 12 Jan 2021 02:42:43 +0000 Original-Received: from localhost ([127.0.0.1]:58826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz9dp-0008Az-Rg for submit@debbugs.gnu.org; Mon, 11 Jan 2021 21:42:42 -0500 Original-Received: from smtp-3.orcon.net.nz ([60.234.4.44]:52465) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kz9dn-0008Aq-ID for 45652@debbugs.gnu.org; Mon, 11 Jan 2021 21:42:40 -0500 Original-Received: from [10.253.37.70] (port=55266 helo=webmail.orcon.net.nz) by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1kz9dl-0003H2-9s; Tue, 12 Jan 2021 15:42:37 +1300 Original-Received: from wlgwil-nat-office.catalyst.net.nz ([202.78.240.7]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 12 Jan 2021 15:42:37 +1300 In-Reply-To: <8735z7chdj.fsf@gnus.org> X-Sender: psainty@orcon.net.nz X-GeoIP: -- 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:197764 Archived-At: On 12/01/21 7:39 am, Lars Ingebrigtsen wrote: > Have you considered adding a C-level primitive that just looks at the > entire buffer? It should be reasonably simple and very fast -- just > count areas between "\n"s, skipping the buffer gap. We don't have to > care about characters as such, I think, so this should be massively > faster than counting line lengths in Lisp. FYI, this also triggered a memory from several years ago: https://lists.gnu.org/archive/html/emacs-devel/2016-07/msg00761.html Stefan's thought at the time was: > I wonder if we could improve the detection part with some help from > the C code. I'm thinking of trying to keep track of "the last \n > before point" and calling a hook whenever this is larger than a > threshold. I never followed up on that (I ended up shelving the idea of releasing so-long.el for a couple of years or so, as my own use-cases at the time turned out to be due to one specific badly-behaved library which had already been fixed upstream, so for a while I thought it might not be as useful as I'd originally thought). On 2021-01-12 10:07, Lars Ingebrigtsen wrote: >> I can give writing something like that a shot... It could return, >> say, >> the length of the longest line, and the number of lines? The median >> line length would be nice, but would be slower. > > Mean would be easy, and standard deviation would be possible (but > require two passes, I guess?) I'm not sure that so-long itself would find it useful to know any kind of averages, but longest line is obviously useful, and the number of lines sounds more or less like a freebie, and might be useful too. -Phil