From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.devel Subject: Re: truncate-lines as newline property Date: Sun, 10 Mar 2024 23:48:27 +0100 Message-ID: <877ci97lfo.fsf@gmail.com> References: <86msr5vq52.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1095"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Evgeny Zajcev , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 10 23:49:17 2024 Return-path: Envelope-to: ged-emacs-devel@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 1rjRym-000Ad7-Ls for ged-emacs-devel@m.gmane-mx.org; Sun, 10 Mar 2024 23:49:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rjRy7-0000V7-0w; Sun, 10 Mar 2024 18:48:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rjRy4-0000Uc-TL for emacs-devel@gnu.org; Sun, 10 Mar 2024 18:48:32 -0400 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rjRy3-00010B-A4; Sun, 10 Mar 2024 18:48:32 -0400 Original-Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41312232c7aso18146685e9.0; Sun, 10 Mar 2024 15:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710110908; x=1710715708; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4fr2t39ynkxF4C1MVYDO2rNm9XZCX4UTtuHUwaC/k9U=; b=Ea9xkgWwFB1KAYsu0W6tIQB+k7kv2QWQFwUTt0zTKMWtj9TUWhaXv3wpfC4Li78qHT +20F/vUujl07x2di4J69PqCCpHRIcqF9h8ggIPzM3/XjdiwNtDyIW0Rb5rHavH+jg9ba nxCO1sEVPquGgBgpeTK7QCmctvEehyKwo1lFvTjhaFBRkVKpsp9R/X7zpu+QGvrf9HIO RYoSb6NxOi59p+QMEWCtx+qQwtjGs0VJWg9Fw61SaFlNPAgHSn/m/zY4y8CK0jgvmJx8 lpFAg6DhYlPAAVTYXLYSlnhW9QJVFXZ+DgxdTad3cBMSl28tCDyfvScLt4gDQX3ehcFt Y7dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710110908; x=1710715708; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4fr2t39ynkxF4C1MVYDO2rNm9XZCX4UTtuHUwaC/k9U=; b=WeBAu6dc5cMzAvg3Qpu+lpfId2BQUlSBjmYJR5Rq3U74F7pS2NQOewIom6S3lAM61K 8iEXHVoUIveIJhWCIP1XB+FCQhMCjgNhsD83lHddJTlrtf3nIm+0kFJ6lLaqvv83HLrE g/GIXsogW1WZYOGNbMWlnCFT/F+1Uq7p0ZXtdFfAgjnTE4Lucii2KTEP0798mlFP1TU7 KFsPau4dZ9u7MV4tpXjLlJFaB2cLdh4+BWauD2+8n+5jxb5sGkM9CI+6oVJwn3Qx1zxJ 6M0ugmoIapdAfYkexn1l0ox6IrMU3IFpfVzqRIadWRy8Fhhf4q9knPXPwUU6KRXiqhW1 Fh0Q== X-Forwarded-Encrypted: i=1; AJvYcCU7PJ07T0+i0gtbFPd7Q9MnWVQinuKImVHC7vVCRcoIpEb20Lru+Rq9i3bfHfYNaxflCcoMwraPpbHW/XsTsOhcYO7z X-Gm-Message-State: AOJu0Yzmgxd4ryXR+9QUJ/utm+psuw5RVT0mNPflR0OYWUK+QH8BJvXB NxNy9XekSQL4WzgCh/S8UhIRmkSGqJbOY59Jc20aQc5EE+HmZLd2xghsvaidXtY= X-Google-Smtp-Source: AGHT+IHw7NW8dX7cDIKP8w/vlXV2wC7CaN0hwR28oOfBpTekMOC1AserbOTTGwbnMY+F7pXzjyCwaw== X-Received: by 2002:a05:600c:4687:b0:412:c379:606 with SMTP id p7-20020a05600c468700b00412c3790606mr5331028wmo.2.1710110908317; Sun, 10 Mar 2024 15:48:28 -0700 (PDT) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id m18-20020adffa12000000b0033d8ce120f2sm4806391wrr.95.2024.03.10.15.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 15:48:27 -0700 (PDT) In-Reply-To: <86msr5vq52.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Mar 2024 21:32:57 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=kevin.legouguec@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316993 Archived-At: Eli Zaretskii writes: >> From: Evgeny Zajcev >> Date: Sun, 10 Mar 2024 21:53:19 +0300 >>=20 >> As I understand, truncate-lines is a buffer property, so it applies to e= very line in the buffer. >>=20 >> Is it possible with some rather small changes to redisplay make it per n= ewline property, so you can specify which line to truncate and to which app= ly buffer setting? > > Not without serious changes to the display code, specifically to the > code that lays out screen lines and decides what to do when it reaches > the edge of the window. > > Also, there's some C code outside of redisplay, and a lot of Lisp code > out there that looks at the buffer-local variable assuming all the > lines behave the same. If this can be per-line, all that code will > have to be updated. > > Any real-life rationale for adding such a feature? Selectively truncating "classes" of "noisy" lines. For example, in buffers featuring both free-flowing prose and pre-formatted text, e.g. a user's guide showcasing code samples, or a conversation where people alternate between describing symptoms and dumping backtraces. In situations where=E2=80=A6 * the prose is either filled at a sensible length with hard newlines, or completely unfilled and wrapped with visual-line-mode, * the pre-formatted text has the occasional long line that is longer than the window width, but (a) most of the information can be gleaned just from the leftmost tokens (b) visual-line-mode wrapping the rightmost tokens makes things very confusing=C2=B9, =E2=80=A6 I wish that I had a way to mark a region and tell Emacs "just tru= ncate this please". And I could imagine markup modes (rst-mode, markdown-mode, org-mode) peppering such a property on constructs where wrapping is more confusing than helpful, like code blocks or tables. TBH this is not a big itch for me; just something I've been pondering from time to time, never going past the stage of "it probably would be a terrible idea if not downright impossible to make the display engine run Lisp to answer the question =E2=80=9Cshould this line be truncated=E2=80=9D= ; but maybe if we spoon-fed the answer in a text property=E2=80=A6 ?" Figured I'd throw my 2=C2=A2 since this "use-case" sounds distinct from Evgeny's. =C2=B9 With visual-wrap-prefix-mode, wrapped code snippets are usually not too confusing; tabular data on the other hand gets unreadable fast. Taking the example of backtraces: when reading Git forge comment threads with markdown-mode, most prose is unfilled, so I'll enable visual-line-mode; but then I'll come across this: (gdb) bt #0 0x00007ffff7d069ae in write () from =E2=86=A9 /lib64/libc.so.6 #1 0x00007ffff7c8a1cd in =E2=86=A9 _IO_file_write@@GLIBC_2.2.5 () from =E2=86=A9 /lib64/libc.so.6 #2 0x00007ffff7c882e4 in new_do_write =E2=86=A9 () from /lib64/libc.so.6 =E2=80=A6 which I wish Emacs would keep truncated to: (gdb) bt #0 0x00007ffff7d069ae in write () from =E2=86=92 #1 0x00007ffff7c8a1cd in _IO_file_write=E2=86=92 #2 0x00007ffff7c882e4 in new_do_write (=E2=86=92 OT1H the latter does hide information; OTOH that information might not be crucial, and I struggle to read the former, for all its extra information.