Subject: bug#39074: closed (Re: bug#39074: 27.0.60; [PATCH] Horizontal line messes with variable value display in Custom buffers)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 10 Jan 2020 21:55:02 +0000

Your bug report

#39074: 27.0.60; [PATCH] Horizontal line messes with variable value display in Custom buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
39074: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39074
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#39074: 27.0.60; [PATCH] Horizontal line messes with variable value display in Custom buffers
From: Kévin Le Gouguec <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Fri, 10 Jan 2020 22:53:54 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Eli Zaretskii <[email-masked]> writes:

> Thanks, should be fixed now.

Confirmed, thank you!

Subject: 27.0.60; [PATCH] Horizontal line messes with variable value display in Custom buffers
From: Kévin Le Gouguec <[email-masked]>
To: [email-masked]
Date: Fri, 10 Jan 2020 18:27:59 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Unless I'm mistaken, commit 84a3793b19 introduced a bug when the user
pushes the button to show the value of the last variable in a Custom
buffer.  From emacs -Q:

- M-x customize-group RET visual-line RET
- move point to the "Show Value" button for "Visual Line Fringe
  Indicators" (shown with the etc/images/custom/right icon on a GUI)
- hit RET
- the variable's description has moved *after* the horizontal line
  (cf. screenshot)

AFAICT, this is because the function that was introduced to de-duplicate
the horizontal line code does

(let ((p (point)))
  (insert "\n")
  …)

whereas the code to draw the last line did:

(let ((p (1+ (point))))
  (insert "\n\n")
  …)

If I'm not mistaken, this can be fixed simply by adding (insert "\n")
before the final call to custom-group--draw-horizontal-line, as done in
this patch:

>From 889dd1b972a72120b51e72d1ac74110891597a58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <[email-masked]>
Date: Wed, 8 Jan 2020 18:35:49 +0100
Subject: [PATCH] Fix glitch with horizontal lines in Custom buffers

Bug introduced in 2019-11-03T16:45:[email-masked].

* lisp/cus-edit.el (custom-group-value-create): add a blank line
before drawing the final horizontal line.
---
 lisp/cus-edit.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 79c235783d..0ca3f1ede8 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4295,6 +4295,7 @@ custom-group-value-create
 	     (widget-put widget :children children)
 	     (custom-group-state-update widget))
 	   ;; End line
+           (insert "\n")
            (custom-group--draw-horizontal-line)))))
 
 (defvar custom-group-menu
-- 
2.20.1

I'm not entirely sure why this extra newline is necessary; I haven't
done much digging other than looking at the commit that introduced this
issue.  Maybe the rest of custom-group-value-create does something fishy
and this patch only works around that…

WDYT?

Thank you for your time.

In GNU Emacs 28.0.50 (build 4, i686-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-01-08 built on little-buster
Repository revision: 724af7671590cd91df37f64df6be73f6dca0144d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Configured using:
 'configure --with-xwidgets --with-cairo'

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS
LIBSYSTEMD JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix