From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Performance degradation from long lines Date: Sat, 12 Jan 2019 13:08:21 +0200 Message-ID: <83pnt2f80q.fsf@gnu.org> References: <665d5f3d84c071632f87f66ffedb6aed@webmail.orcon.net.nz> <83sh0uqhw8.fsf@gnu.org> <83h8haqd2g.fsf@gnu.org> <1c7973ecaeb4478a81dcf17e9257620c@webmail.orcon.net.nz> <34b92ce4-7b3d-97c7-f59e-e61e9564a7b0@orcon.net.nz> <55c0781a-8c15-f0c5-a80b-40e7c37507da@orcon.net.nz> <71558cda-bfb1-22c0-1b9c-ad8f458817da@orcon.net.nz> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1547292033 19741 195.159.176.226 (12 Jan 2019 11:20:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2019 11:20:33 +0000 (UTC) Cc: mithraeum@protonmail.com, monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Phil Sainty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 12 12:20:29 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1giHL2-000507-MU for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2019 12:20:28 +0100 Original-Received: from localhost ([127.0.0.1]:48081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giHN9-0006IA-OV for ged-emacs-devel@m.gmane.org; Sat, 12 Jan 2019 06:22:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giHLq-0005wl-4E for emacs-devel@gnu.org; Sat, 12 Jan 2019 06:21:19 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1giH9e-0005yQ-Hx; Sat, 12 Jan 2019 06:08:42 -0500 Original-Received: from [176.228.60.248] (port=3985 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1giH9e-0008Kx-5F; Sat, 12 Jan 2019 06:08:42 -0500 In-reply-to: <71558cda-bfb1-22c0-1b9c-ad8f458817da@orcon.net.nz> (message from Phil Sainty on Sat, 12 Jan 2019 14:03:14 +1300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232320 Archived-At: > From: Phil Sainty > Cc: Eli Zaretskii , Stefan Monnier , > mithraeum > Date: Sat, 12 Jan 2019 14:03:14 +1300 > > I've pushed a branch scratch/so-long with release-candidate code for > including so-long.el in Emacs 27 (and for the GNU ELPA package). > > http://git.savannah.gnu.org/cgit/emacs.git/log?h=scratch/so-long Thanks. I think we can land this on master, but see a few minor comments below, mostly about documentation. +** so-long.el helps to mitigate performance problems with long lines. +When `so-long-enable' has been called, visiting a file with very long +lines will (subject to configuration) cause the user's preferred +`so-long-action' to be automatically invoked (by default, the buffer's +major mode is replaced by `so-long-mode'). In extreme cases this can +prevent delays of several minutes, and make Emacs responsive almost +immediately. Type 'M-x so-long-commentary' for full documentation. Please use quoting 'like this' consistently. +;; This library advises `set-auto-mode' (in order to react after Emacs has +;; chosen the major mode for a buffer), and `hack-local-variables' (so that we +;; may behave differently when a file-local mode is set). In earlier versions +;; of Emacs (< 26.1) we also advise `hack-one-local-variable' (to prevent a +;; file-local mode from restoring the original major mode if we had changed it). I'd prefer not to use advices in bundled code. Is it feasible to instead include hooks in Emacs that so-long-mode could use? If the problem is older versions of Emacs, I'm okay with using advices only for those old versions. +(defgroup so-long nil + "Prevent unacceptable performance degradation with very long lines." + :prefix "so-long" + :group 'convenience) + +(defcustom so-long-threshold 250 + "Maximum line length permitted before invoking `so-long-function'. + +See `so-long-detected-long-line-p' for details." + :type 'integer + :package-version '(so-long . "1.0") + :group 'so-long) Please add :version tags to all the customizable options. +(defcustom so-long-target-modes + '(prog-mode css-mode sgml-mode nxml-mode) + "`so-long' affects only these modes and their derivatives. I've heard complaints from users of JASON and JavaScript -- should the default value cover those as well? +(defun so-long-action-alist-setter (option value) + "The :set function for `so-long-action-alist'." For non-internal functions, please reference the arguments in the first line of the doc string. +(defun so-long-change-major-mode () + "Ensures that `so-long-mode' knows the original `major-mode' +even when invoked interactively. "Ensure", to be consistent with our style of writing the first sentence of the doc strings. Also, please make the first sentence fit on a single line -- this is important for Apropos commands, which only display one line. +(defun so-long-menu () + "Dynamically generate the \"So Long\" menu." + ;; (info "(elisp) Menu Example") How about providing some help-echo for this menu? +(defun so-long-menu-item-revert () + "Invoke `so-long-revert'." This doc string is not very informative, and neither is that of so-long-revert. How about adding more detailed description here? I believe this is an important command that users will want to know about. Thanks again for working on this.