emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61735: closed (29.0.50; String object in margin not associated corre


From: GNU bug Tracking System
Subject: bug#61735: closed (29.0.50; String object in margin not associated correctly with buffer text)
Date: Tue, 12 Sep 2023 01:07:01 +0000

Your message dated Mon, 11 Sep 2023 18:06:10 -0700
with message-id 
<CADwFkm=G84cMFYx+dM6zueSTO3DczF7qP2kjPHvk-0bHXv+cBQ@mail.gmail.com>
and subject line Re: bug#61735: 29.0.50; String object in margin not associated 
correctly with buffer text
has caused the debbugs.gnu.org bug report #61735,
regarding 29.0.50; String object in margin not associated correctly with buffer 
text
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
61735: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61735
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 29.0.50; String object in margin not associated correctly with buffer text Date: Thu, 23 Feb 2023 17:32:50 +0100
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))



--- End Message ---
--- Begin Message --- Subject: Re: bug#61735: 29.0.50; String object in margin not associated correctly with buffer text Date: Mon, 11 Sep 2023 18:06:10 -0700
dalanicolai <dalanicolai@gmail.com> writes:

> Thanks for that explanation. Indeed, I found it hard to find a thorough
> explanation anywhere. Also, thanks for reminding me about propertize.

I think the conclusion here is that this was not a bug, so I'm closing
this now.

If this conclusion is incorrect, please reply to this email (use "Reply
to all" in your email client) and we can reopen the bug report.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]