From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#61735: 29.0.50; String object in margin not associated correctly with buffer text Date: Thu, 23 Feb 2023 17:32:50 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000036ccb05f56091f5" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10176"; mail-complaints-to="usenet@ciao.gmane.io" To: 61735@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 23 17:34:24 2023 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 1pVEY3-0002Od-6x for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 23 Feb 2023 17:34:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVEXo-0007lr-Uu; Thu, 23 Feb 2023 11:34:08 -0500 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 1pVEXi-0007l0-O7 for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 11:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVEXi-0007tk-Fd for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 11:34:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVEXi-0001tg-7P for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 11:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Feb 2023 16:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61735 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16771699947229 (code B ref -1); Thu, 23 Feb 2023 16:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Feb 2023 16:33:14 +0000 Original-Received: from localhost ([127.0.0.1]:35123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVEWv-0001sW-Hy for submit@debbugs.gnu.org; Thu, 23 Feb 2023 11:33:14 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:44506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVEWs-0001sM-P7 for submit@debbugs.gnu.org; Thu, 23 Feb 2023 11:33:12 -0500 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 1pVEWp-0006d1-WA for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 11:33:10 -0500 Original-Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVEWm-0007YG-Ru for bug-gnu-emacs@gnu.org; Thu, 23 Feb 2023 11:33:07 -0500 Original-Received: by mail-wm1-x335.google.com with SMTP id m25-20020a7bcb99000000b003e7842b75f2so6889344wmi.3 for ; Thu, 23 Feb 2023 08:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=cuTBIA3LCjAYeleO3eBk2x4m+X18AAg6ZRXkP6hJKno=; b=hck+GSwO+iyu3SzJzXcEUTd34/CMFPAZ7jVdluHxUPfReqDZGXl0RoRxkzBDHHEDrH P/gpVf13wFMRLT9/UxqA8qR95lRCGGmRxeifIc9vrIoEnF/Ml2951X/X15iPDci64bvf 9pnOZFruxumgg5lLmQKygb8Q5zMJrQ807cpEOVWesPCHjK3Tz6qQPeqGY6Gy9ilDzac3 r/AURDdxd3gQHQpj0usjr/V6HimjYb7DvKjj7TBE2B2mWgV353b4wmifCsF11kgYXDoz 3n4ZeNx4SFe/MyE3DWhEPQihnD1n7AHG95k3nVo8DErOIIHr2veF9ms0FZB3Yn2kf5b3 ARcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cuTBIA3LCjAYeleO3eBk2x4m+X18AAg6ZRXkP6hJKno=; b=VkJ/JMhPzPjnIWhJKUZMv1Q7rZp0EdykQ6VK0I1zEV0LAVFQ0mRyiSS9nvtjjdoesg sa3Ee2FSLjdbUo9zwypozKhvG4kHn7ULxjeJOjg8s9yXkgLcDszAqKxW0GlpKu9wRs2y L1RYiS3jorP2cXMEi3EZgdEgza6zUHb8Y/degP9aT8KyCVjMFXGblRmnFCiELMMoVO+V t0AV99ECHlj3D3K0ZMZpXdGLkgG593Cre9gUqB3WOKPvPQ0RS41loQAuJ0TMGkEeDM5d QPHniW1Gt1KvbSfLZdHnwTGDPynMpbNLsmRvt7oLS5nEIC4KBrSEclnmdNxl08HRla5X ijsw== X-Gm-Message-State: AO0yUKUbenj88RQbSFrXmKGG0LRzobW+cEnD4LrnTEkouo5XcEllZLGp 9un9wplSSy6wYe9QR6bIes1x2d4TGIJY28zHrL4ews4nDWo6Ew== X-Google-Smtp-Source: AK7set913tISyN+mkSKkm+Cedm6O4G5QQFUdlxqEuil7nCq5VSjVobSNXeAZIWHvb4A6Jqy3Hhwlgi8JONIfs9VbbKA= X-Received: by 2002:a05:600c:cc8:b0:3dc:56e6:797a with SMTP id fk8-20020a05600c0cc800b003dc56e6797amr571602wmb.196.1677169982138; Thu, 23 Feb 2023 08:33:02 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=dalanicolai@gmail.com; helo=mail-wm1-x335.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256488 Archived-At: --000000000000036ccb05f56091f5 Content-Type: text/plain; charset="UTF-8" The section 'Displaying in the Margins ' of the elisp manual mentions that 'To display something in the margin in association with certain buffer text ... put a before-string property on the text and put the margin display specification on the contents of the before-string'. So this is what I am trying to achieve using the following code ``` (defun baleen-render (data) (pop-to-buffer (get-buffer-create "*baleen*")) (set-window-margins nil 5) (dolist (page data) (dolist (match (cdr page)) (let ((o (make-overlay (point) (progn (insert match) (point))))) (let ((s " ")) (put-text-property 0 1 'display `((margin left-margin) ,(format " %d" (car page))) s) (overlay-put o 'before-string s))) (insert "\n")))) (baleen-render '((1 "test1" "test2") (2 "test3"))) ``` Here, for every 'match' in a 'page' I am creating a new string 's' to which I add the margin display property to 'associate' it with some buffer text by using it as the value for its before-string property. However, although each 's' should get a different display property value via (format " %d" (car page)), all margin entries end up showing the same value of 2 (while the first two lines should show page number 1). To reproduce the error, simply evaluate the code above. Using edebug on 'baleen-render' it can be seen that the code seems correct, i.e. (car page) correctly returns the correct page number. It seems that although I am creating a different string object on each iteration, somehow the object put in the marging seems to be always the same. To me, this looks like a bug. And otherwise, if I am doing something wrong, then of course this report can be seen as a 'help/support request'. Thanks! In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-09-10 built on fedora Repository revision: 4cf9c92e27d20da9453f9abe89d84bee5d776329 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12014000 System Description: Fedora Linux 37 (Workstation Edition) Configured using: 'configure --with-modules --with-cairo --with-native-compilation --with-json' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: 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 blink-cursor-mode: t buffer-read-only: 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 emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cconv cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd 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 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 dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 77301 10328) (symbols 48 7112 0) (strings 32 19407 1642) (string-bytes 1 593504) (vectors 16 15411) (vector-slots 8 317149 17892) (floats 8 28 58) (intervals 56 372 3) (buffers 1000 13)) --000000000000036ccb05f56091f5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The section 'Displaying in the Margins= ' of the elisp manual mentions
that 'To display something in= the margin in association with certain
buffer text ... put a before-str= ing property on the text and put the
margin display specification on the= contents of the before-string'.

So this is what I am trying to = achieve using the following code

```
(defun baleen-render (data)<= br>=C2=A0 (pop-to-buffer (get-buffer-create "*baleen*"))
=C2= =A0 (set-window-margins nil 5)
=C2=A0 (dolist (page data)
=C2=A0 =C2= =A0 (dolist (match (cdr page))
=C2=A0 =C2=A0 =C2=A0 (let ((o (make-overl= ay (point)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(progn (insert match)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (point)))))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 (let ((s " "))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 (put-text-property 0 1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'display = `((margin left-margin) ,(format " %d" (car page)))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0s)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (overlay-put o= 'before-string s)))
=C2=A0 =C2=A0 =C2=A0 (insert "\n"))))=

(baleen-render '((1 "test1" "test2") (2 &qu= ot;test3")))
```

Here, for every 'match' in a 'p= age' I am creating a new string 's'
to which I add the margi= n display property to 'associate' it
with some buffer text by us= ing it as the value for its before-string
property.
However, although= each 's' should get a different display property value
via (for= mat " %d" (car page)), all margin entries end up showing the
s= ame value of 2 (while the first two lines should show page number 1).
To reproduce the error, simply evaluate the code above. Using edebug on'baleen-render' it can be seen that the code seems correct, i.e. = (car
page) correctly returns the correct page number.

It seems th= at although I am creating a different string object on each
iteration, s= omehow the object put in the marging seems to be always the
same.
To me, this looks like a bug. And otherwise, if I am doing something
wr= ong, then of course this report can be seen as a 'help/support
= request'. Thanks!

In GNU Emacs 29.0.50 (build = 1, x86_64-pc-linux-gnu, GTK+ Version
=C2=A03.24.34, cairo version 1.17.6= ) of 2022-09-10 built on fedora
Repository revision: 4cf9c92e27d20da9453= f9abe89d84bee5d776329
Repository branch: master
Windowing system dist= ributor 'The X.Org Foundation', version 11.0.12014000
System Des= cription: Fedora Linux 37 (Workstation Edition)

Configured using:=C2=A0'configure --with-modules --with-cairo --with-native-compilation=
=C2=A0--with-json'

Configured features:
ACL CAIRO DBUS FR= EETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXM= L2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQL= ITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB=

Important settings:
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0= value of $XMODIFIERS: @im=3Dibus
=C2=A0 locale-coding-system: utf-8-uni= x

Major mode: Fundamental

Minor modes in effect:
=C2=A0 to= oltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 show-paren-mode: t=C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 to= ol-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: = t
=C2=A0 global-font-lock-mode: t
=C2=A0 blink-cursor-mode: t
=C2= =A0 buffer-read-only: t
=C2=A0 line-number-mode: t
=C2=A0 indent-tabs= -mode: t
=C2=A0 transient-mark-mode: t
=C2=A0 auto-composition-mode: = t
=C2=A0 auto-encryption-mode: t
=C2=A0 auto-compression-mode: t
<= br>Load-path shadows:
None found.

Features:
(shadow sort mail-= extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc82= 2 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-uti= l text-property-search time-date mm-decode mm-bodies
mm-encode mail-pars= e rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
comp comp-cstr war= nings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte= -compile cconv cl-lib sendmail rfc2047 rfc2045
ietf-drums mm-util mail-p= rsvr mail-utils rmc iso-transl tooltip eldoc
paren electric uniquify edi= ff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/x-win x-win term= /common-win x-dnd 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 na= dvice seq simple cl-generic
indonesian philippine cham georgian utf-8-la= ng misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-= ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian c= yrillic chinese
composite emoji-zwj charscript charprop case-table epa-h= ook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loadd= efs
faces cus-face macroexp files window text-properties overlay sha1 md= 5
base64 format env code-pages mule custom widget keymap
hashtable-pr= int-readable backquote threads dbusbind inotify
dynamic-setting system-f= ont-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2= x multi-tty make-network-process
native-compile emacs)

Memory in= formation:
((conses 16 77301 10328)
=C2=A0(symbols 48 7112 0)
=C2= =A0(strings 32 19407 1642)
=C2=A0(string-bytes 1 593504)
=C2=A0(vecto= rs 16 15411)
=C2=A0(vector-slots 8 317149 17892)
=C2=A0(floats 8 28 5= 8)
=C2=A0(intervals 56 372 3)
=C2=A0(buffers 1000 13))


--000000000000036ccb05f56091f5--