* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
@ 2024-08-17 2:21 Mark Hepburn
2024-08-17 7:19 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Mark Hepburn @ 2024-08-17 2:21 UTC (permalink / raw)
To: 72681
[-- Attachment #1: Type: text/plain, Size: 5256 bytes --]
--text follows this line--
The recently-merged visual-wrap-prefix-mode support for variable-pitch
fonts seems to interact badly with plain lists in org-mode, causing
visual artefacts. I think it's to do with both plain lists and a
trailing blank line. To reproduce, from emacs -Q:
* switch to a new buffer
* M-x org-mode
* Insert a couple of headings, with a plain list followed by a blank
line afterwards:
====================
* header
- item
* second header
====================
* M-x visual-wrap-prefix-mode
* This now renders for me like:
====================
* header
- item
* second header
====================
(The actual artefacts are even more pronounced for me in practice
because I have org-adapt-indentation set, so the second header is even
more visually indented)
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0) of 2024-08-17 built on x1carbon
Repository revision: 909d1d02db1c11e1309316cba2a392e1456e6053
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Ubuntu 24.04 LTS
Configured using:
'configure --with-native-compilation --without-mailutils
--with-xwidgets --with-tree-sitter --with-libsystemd'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER
PNG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB
Important settings:
value of $LANG: en_AU.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Org
Minor modes in effect:
visual-wrap-prefix-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
minibuffer-regexp-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr dabbrev emacsbug reposition compile tmm
visual-wrap oc-basic cl-extra help-mode org-element org-persist org-id
org-refile org-element-ast inline avl-tree generator ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus comp-run comp-common xml gnus-cloud nnimap nnmail
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util url-parse auth-source
cl-seq eieio eieio-core cl-macs json map byte-opt gv bytecomp
byte-compile url-vars mail-source utf7 nnoo parse-time gnus-spec
gnus-int gnus-range message sendmail mailcap yank-media puny rfc822 mml
mml-sec password-cache epa derived epg rfc6068 epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util
text-property-search mail-utils range mm-util mail-prsvr wid-edit
ol-docview doc-view filenotify jka-compr image-mode exif dired
dired-loaddefs ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi
org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie treesit executable ob-comint org-pcomplete
pcomplete comint ansi-osc ansi-color ring org-list org-footnote
org-faces org-entities time-date subr-x noutline outline icons
ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold
org-fold-core org-keys oc org-loaddefs thingatpt find-func cal-menu
calendar cal-loaddefs org-version org-compat org-macs format-spec
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk x-toolkit xinput2 x multi-tty move-toolbar make-network-process
native-compile emacs)
Memory information:
((conses 16 262343 58872) (symbols 48 21342 0) (strings 32 73561 4714)
(string-bytes 1 2291125) (vectors 16 35091)
(vector-slots 8 431581 22950) (floats 8 341 49) (intervals 56 427 0)
(buffers 992 17))
[-- Attachment #2: Type: text/html, Size: 7329 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-17 2:21 bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode Mark Hepburn
@ 2024-08-17 7:19 ` Eli Zaretskii
2024-08-17 20:29 ` Jim Porter
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2024-08-17 7:19 UTC (permalink / raw)
To: Mark Hepburn, Jim Porter; +Cc: 72681
> Date: Sat, 17 Aug 2024 12:21:45 +1000
> From: "Mark Hepburn" <mark@markhepburn.com>
>
> The recently-merged visual-wrap-prefix-mode support for variable-pitch
> fonts seems to interact badly with plain lists in org-mode, causing
> visual artefacts. I think it's to do with both plain lists and a
> trailing blank line. To reproduce, from emacs -Q:
> * switch to a new buffer
> * M-x org-mode
> * Insert a couple of headings, with a plain list followed by a blank
> line afterwards:
> ====================
> * header
>
> - item
>
> * second header
> ====================
> * M-x visual-wrap-prefix-mode
> * This now renders for me like:
> ====================
> * header
>
> - item
>
> * second header
> ====================
> (The actual artefacts are even more pronounced for me in practice
> because I have org-adapt-indentation set, so the second header is even
> more visually indented)
Thanks.
Jim, could you please look into this? Is visual-wrap-prefix-mode at
all supposed to be used in Org buffers?
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-17 7:19 ` Eli Zaretskii
@ 2024-08-17 20:29 ` Jim Porter
2024-08-18 0:02 ` Mark Hepburn
0 siblings, 1 reply; 10+ messages in thread
From: Jim Porter @ 2024-08-17 20:29 UTC (permalink / raw)
To: Eli Zaretskii, Mark Hepburn; +Cc: 72681
[-- Attachment #1: Type: text/plain, Size: 789 bytes --]
On 8/17/2024 12:19 AM, Eli Zaretskii wrote:
> Jim, could you please look into this? Is visual-wrap-prefix-mode at
> all supposed to be used in Org buffers?
Yes, I think 'visual-wrap-prefix-mode' should support Org buffers. It's
probably one of the more useful text-based modes where
'visual-wrap-prefix-mode' would be convenient.
It looks like this was just a small corner case in the visual-wrap code
for aligning prefix lines that didn't account for Org-Mode's custom
'adaptive-fill-function'. I've fixed this by being more careful to only
apply the 'min-width' display property to a single logical line.
Mark, does the attached patch fix things for you? It looks like it works
in my tests, but maybe you have some more complicated test cases you'd
like to try to verify this.
[-- Attachment #2: 0001-Be-more-careful-about-aligning-prefix-lines-in-visua.patch --]
[-- Type: text/plain, Size: 1638 bytes --]
From fe116a69a79653041817c7de9306bbc5040c9652 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sat, 17 Aug 2024 13:21:00 -0700
Subject: [PATCH] Be more careful about aligning prefix lines in
'visual-wrap-prefix-mode'
* lisp/visual-wrap.el (visual-wrap--apply-to-line): Ensure we don't
apply the 'min-width' property across multiple lines (bug#72681).
---
lisp/visual-wrap.el | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index cac3bc767b8..eb5daa89222 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -121,9 +121,15 @@ visual-wrap--apply-to-line
(next-line-prefix (visual-wrap--content-prefix
first-line-prefix position)))
(when (numberp next-line-prefix)
+ ;; Set a minimum width for the prefix so it lines up correctly
+ ;; with subsequent lines. Make sure not to do this past the end
+ ;; of the line though! (`fill-match-adaptive-prefix' could
+ ;; potentially return a number larger the length of the current
+ ;; line in the buffer.)
(put-text-property
- position (+ position (length first-line-prefix)) 'display
- `(min-width ((,next-line-prefix . width)))))
+ position (min (+ position (length first-line-prefix))
+ (line-end-position))
+ 'display `(min-width ((,next-line-prefix . width)))))
(setq next-line-prefix (visual-wrap--adjust-prefix next-line-prefix))
(put-text-property
position (line-end-position) 'wrap-prefix
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-17 20:29 ` Jim Porter
@ 2024-08-18 0:02 ` Mark Hepburn
2024-08-18 1:40 ` Jim Porter
0 siblings, 1 reply; 10+ messages in thread
From: Mark Hepburn @ 2024-08-18 0:02 UTC (permalink / raw)
To: Jim Porter, Eli Zaretskii; +Cc: 72681
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
Thanks Jim, nice work -- yes that seems to work perfectly again for all the problematic files I had before.
Cheers, Mark.
On Sun, Aug 18, 2024, at 6:29 AM, Jim Porter wrote:
> On 8/17/2024 12:19 AM, Eli Zaretskii wrote:
> > Jim, could you please look into this? Is visual-wrap-prefix-mode at
> > all supposed to be used in Org buffers?
>
> Yes, I think 'visual-wrap-prefix-mode' should support Org buffers. It's
> probably one of the more useful text-based modes where
> 'visual-wrap-prefix-mode' would be convenient.
>
> It looks like this was just a small corner case in the visual-wrap code
> for aligning prefix lines that didn't account for Org-Mode's custom
> 'adaptive-fill-function'. I've fixed this by being more careful to only
> apply the 'min-width' display property to a single logical line.
>
> Mark, does the attached patch fix things for you? It looks like it works
> in my tests, but maybe you have some more complicated test cases you'd
> like to try to verify this.
>
> *Attachments:*
> • 0001-Be-more-careful-about-aligning-prefix-lines-in-visua.patch
[-- Attachment #2: Type: text/html, Size: 1645 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-18 0:02 ` Mark Hepburn
@ 2024-08-18 1:40 ` Jim Porter
2024-08-18 9:53 ` Mark Hepburn
0 siblings, 1 reply; 10+ messages in thread
From: Jim Porter @ 2024-08-18 1:40 UTC (permalink / raw)
To: Mark Hepburn, Eli Zaretskii; +Cc: 72681-done
On 8/17/2024 5:02 PM, Mark Hepburn wrote:
> Thanks Jim, nice work -- yes that seems to work perfectly again for all
> the problematic files I had before.
Great, thanks for checking. I've therefore merged this to the master
branch as 135da3556bb. Closing this bug now.
(Though of course if you find any other issues with the new
'visual-wrap-prefix-mode' code, just let me know and I'll try to fix it.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-18 1:40 ` Jim Porter
@ 2024-08-18 9:53 ` Mark Hepburn
2024-08-18 17:11 ` Jim Porter
0 siblings, 1 reply; 10+ messages in thread
From: Mark Hepburn @ 2024-08-18 9:53 UTC (permalink / raw)
To: Jim Porter, Eli Zaretskii; +Cc: 72681-done
[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]
Hi again Jim,
I haven't isolated this one yet, but I'm flagging in case it rings any bells for you -- I'm getting rendering-lockups with dart-mode when I enable visual-wrap-prefix-mode. I've checked a couple of other programming modes which seem fine. My money was on lsp-mode (and maybe lens display), but I've disabled lsp entirely and it still locks up.
I don't get a backtrace (with debug-on-error), but I can get this (when I hit C-n to see anything is happening, as the screen goes blank):
===
Debugger entered--Lisp error: (args-out-of-range 519 519)
line-move-visual(1 nil)
line-move(1 nil nil 1)
next-line(1 1)
funcall-interactively(next-line 1 1)
command-execute(next-line)
===
I'll keep trying to isolate it. So far my repo is "open .dart file, M-x visual-wrap-prefix-mode".
cheers, Mark
On Sun, Aug 18, 2024, at 11:40 AM, Jim Porter wrote:
> On 8/17/2024 5:02 PM, Mark Hepburn wrote:
> > Thanks Jim, nice work -- yes that seems to work perfectly again for all
> > the problematic files I had before.
>
> Great, thanks for checking. I've therefore merged this to the master
> branch as 135da3556bb. Closing this bug now.
>
> (Though of course if you find any other issues with the new
> 'visual-wrap-prefix-mode' code, just let me know and I'll try to fix it.)
>
[-- Attachment #2: Type: text/html, Size: 1950 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode
2024-08-18 9:53 ` Mark Hepburn
@ 2024-08-18 17:11 ` Jim Porter
[not found] ` <a552da1e-80b9-42f1-900c-2255c65a63d4@app.fastmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: Jim Porter @ 2024-08-18 17:11 UTC (permalink / raw)
To: Mark Hepburn, Eli Zaretskii; +Cc: 72681
On 8/18/2024 2:53 AM, Mark Hepburn wrote:
> Hi again Jim,
>
> I haven't isolated this one yet, but I'm flagging in case it rings any
> bells for you -- I'm getting rendering-lockups with dart-mode when I
> enable visual-wrap-prefix-mode. I've checked a couple of other
> programming modes which seem fine. My money was on lsp-mode (and maybe
> lens display), but I've disabled lsp entirely and it still locks up.
I've tried installing dart-mode and enabling visual-wrap-prefix-mode
(and visual-line-mode) in a sample file, and wasn't able to reproduce
any hangs. If you figure out how to reproduce this, just file a new bug
and CC me.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-08-25 20:58 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-17 2:21 bug#72681: 31.0.50; visual-wrap-prefix-mode interacts badly with plain lists in org-mode Mark Hepburn
2024-08-17 7:19 ` Eli Zaretskii
2024-08-17 20:29 ` Jim Porter
2024-08-18 0:02 ` Mark Hepburn
2024-08-18 1:40 ` Jim Porter
2024-08-18 9:53 ` Mark Hepburn
2024-08-18 17:11 ` Jim Porter
[not found] ` <a552da1e-80b9-42f1-900c-2255c65a63d4@app.fastmail.com>
[not found] ` <CANh=_JH9GcCGhuLQUZeGZ89CnpYTuWmEGwKXRQ=zY-7X4WzUmg@mail.gmail.com>
[not found] ` <31873240-cedb-4a6e-825c-2ad60caa8b11@app.fastmail.com>
[not found] ` <3cbd38fd-82e5-46aa-bc51-a8cd3caf688d@app.fastmail.com>
2024-08-25 5:55 ` Eli Zaretskii
2024-08-25 18:50 ` Jim Porter
2024-08-25 20:58 ` Mark Hepburn
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.