From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#51809: 29.0.50; [PATCH] Support for outline default state in Diff buffers Date: Sat, 13 Nov 2021 20:27:36 +0200 Organization: LINKOV.NET Message-ID: <86pmr3c3mv.fsf@mail.linkov.net> References: <87lf1sw6ji.fsf@gmail.com> <86h7cgdk4v.fsf@mail.linkov.net> <87ee7kvshn.fsf@gmail.com> 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="1268"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 51809@debbugs.gnu.org To: Matthias Meulien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 13 19:30:11 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 1mlxn0-0000C8-Qw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Nov 2021 19:30:10 +0100 Original-Received: from localhost ([::1]:46576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mlxmz-0001QT-Ht for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Nov 2021 13:30:09 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mlxms-0001QK-94 for bug-gnu-emacs@gnu.org; Sat, 13 Nov 2021 13:30:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mlxms-0005QE-0J for bug-gnu-emacs@gnu.org; Sat, 13 Nov 2021 13:30:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mlxmr-00051e-T0 for bug-gnu-emacs@gnu.org; Sat, 13 Nov 2021 13:30:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Nov 2021 18:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51809 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51809-submit@debbugs.gnu.org id=B51809.163682815619236 (code B ref 51809); Sat, 13 Nov 2021 18:30:01 +0000 Original-Received: (at 51809) by debbugs.gnu.org; 13 Nov 2021 18:29:16 +0000 Original-Received: from localhost ([127.0.0.1]:48040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlxm8-00050B-7X for submit@debbugs.gnu.org; Sat, 13 Nov 2021 13:29:16 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:50819) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mlxm4-0004zv-Hv for 51809@debbugs.gnu.org; Sat, 13 Nov 2021 13:29:15 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 514BA240005; Sat, 13 Nov 2021 18:29:04 +0000 (UTC) In-Reply-To: <87ee7kvshn.fsf@gmail.com> (Matthias Meulien's message of "Sat, 13 Nov 2021 19:08:04 +0100") 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:219828 Archived-At: >>> +;; - Support outlining files by name (eg to skip automatically >>> +;; generated files like package-lock.json in Javascript projects). >>>… >>> +(defcustom diff-file-outline-threshold 50 >>> + "Number of lines of hunks for a file to be outlined. >> >> Often the files that need to be hidden contain just one very long line >> without newlines such as in compiled assets, etc. and eventually make >> Emacs unresponsive. This is a big problem. Would it be possible >> in your patch to check the size of the hunk counting characters >> instead of lines? > > Good point. I guess counting characters can be achieved by: > (- (overlay-end overlay) (overlay-start overlay)) > thus it looks feasible. It seems this should work. > Wouldn't it better to add a new choice "Outline hunks with long lines" > and allow multiple choices in `diff-outline-default-state' > customization? Many customizable variables that check the size such as large-file-warning-threshold etc. count bytes/characters. But if you think that someone might want to restrict only the number of lines whereas wanting to see long lines, then a new option could be added too. > It would allow to implement one more usefull choice (from my pov), > "Outline files by name" to hide automatically generated files (like > package-lock.json in Javascript projects using NPM)... > > Does it looks reasonnable to you? An option to hide by file names (I assume a regexp?) looks useful too. This is how I configured the xref output buffer to initially hide only ChangeLog and test files: #+begin_src emacs-lisp (add-hook 'xref-after-update-hook (lambda () (setq-local outline-regexp (if (eq xref-file-name-display 'abs) "/" "[^ 0-9]")) (outline-minor-mode +1) (save-excursion (goto-char (point-min)) (while (and (re-search-forward "ChangeLog\\|test/manual/etags" nil t) (get-text-property (point) 'xref-group)) (outline-cycle))))) #+end_src Something like this could be customizable in diff-mode.