hideshowvis icon indicating copy to clipboard operation
hideshowvis copied to clipboard

hideshowvis clutters impatient-mode output with string *hideshowvis*

Open the42 opened this issue 10 months ago • 2 comments

In a buffer with json-ts-mode enabled, enabling hideshowvis-minor-mode and impatient-mode with display on the browser results in the following html-rendering:

*hideshowvis*{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
```

Every location in the file which is a hideshow folding candidate get's prepended with the string *hideshowvis*

the42 avatar Feb 04 '25 12:02 the42

Thanks for the bug report. I can't reproduce it, though. I've tried the following with Emacs 29.1 in a macOs and nix-darwin config:

  1. Create new buffer containing (w/o the \ characters)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  \```
foobar
  \```
}
  1. M-x, json-ts-mode
  2. M-x, hideshowvis-minor-mode (unless it's already on)
  3. M-x impatient-mode (unless it's already on)
  4. Try folding at the { or ```

I've also tried with this longer example:

{
    "glossary": {
        "title": "example glossary",
		"GlossDiv": {
            "title": "S",
			"GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
					"SortAs": "SGML",
					"GlossTerm": "Standard Generalized Markup Language",
					"Acronym": "SGML",
					"Abbrev": "ISO 8879:1986",
					"GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
						"GlossSeeAlso": ["GML", "XML"]
                    },
					"GlossSee": "markup"
                }
            }
        }
    }
}

What I get is this:

Image

Could you provide more details on which versions of Emacs, tree-sitter, and the packages you're using?

sheijk avatar Feb 25 '25 17:02 sheijk

That's what I get, both using Firefox and Edge:

Image

Here is the output of M-x emacs-bug-report:

In GNU Emacs 31.0.50 (build 1, x86_64-w64-mingw32) of 2025-02-02 built on fv-az521-368 Repository revision: 5e12843fa32150d2f18ce21fc6f3ae58732df6a7 Repository branch: HEAD Windowing system distributor 'Microsoft Corp.', version 10.0.22631 System Description: Microsoft Windows 10 Enterprise (v10.0.2009.22631.4890)

Configured using: 'configure --prefix=/d/a/emacs-build/emacs-build/pkg/5e12843-ucrt-x86_64 'CFLAGS=-O2 -fno-semantic-interposition -floop-parallelize-all -ftree-parallelize-loops=4 -g3 ' --disable-build-details --without-dbus --enable-link-time-optimization --enable-build-details --with-compress-install --with-small-ja-dic --with-gif --with-gnutls --with-harfbuzz --with-jpeg --with-json --with-lcms2 --with-mps --with-native-compilation --with-png --with-rsvg --with-tree-sitter --with-xml2 --with-xpm --with-zlib --without-cairo --without-tiff'

Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES MPS NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings: value of $LANG: de_DE.UTF-8 locale-coding-system: cp65001

Major mode: JSON

Minor modes in effect: impatient-mode: t hideshowvis-minor-mode: t display-line-numbers-mode: t display-fill-column-indicator-mode: t flyspell-mode: t xterm-mouse-mode: t winner-mode: t windmove-mode: t savehist-mode: t save-place-mode: t recentf-mode: t pixel-scroll-precision-mode: t marginalia-mode: t global-auto-revert-mode: t icomplete-mode: t fido-mode: t desktop-save-mode: t delete-selection-mode: t bar-cursor-mode: t corfu-mode: t override-global-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 tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t context-menu-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t column-number-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 hs-minor-mode: t

Load-path shadows: None found.

Features: (shadow sort mail-extr comp-run comp-common emacsbug message yank-media puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils impatient-mode htmlize simple-httpd dired-aux dired dired-loaddefs flymake compile text-property-search comint ansi-osc ansi-color warnings thingatpt breadcrumb pulse color project imenu time-date hideshowvis hideshow vc-git diff-mode track-changes files-x vc-dispatcher display-line-numbers display-fill-column-indicator flyspell ispell json-ts-mode rx treesit deeper-blue-theme xt-mouse winner windmove savehist saveplace recentf tree-widget pixel-scroll cua-base ring marginalia autorevert filenotify icomplete desktop frameset delsel bar-cursor corfu edmacro kmacro use-package-bind-key bind-key easy-mmode orderless compat cl-extra help-mode use-package-ensure use-package-core cus-edit pp cus-load wid-edit finder-inf bar-cursor-autoloads breadcrumb-autoloads cape-autoloads corfu-autoloads csv-mode-autoloads d2-mode-autoloads dape-autoloads dired-sidebar-autoloads dired-subtree-autoloads dired-hacks-utils-autoloads edit-indirect-autoloads go-mode-autoloads hideshowvis-autoloads impatient-mode-autoloads htmlize-autoloads indent-bars-autoloads magit-p4-autoloads magit-autoloads pcase magit-popup-autoloads magit-section-autoloads llama-autoloads marginalia-autoloads markdown-toc-autoloads markdown-mode-autoloads mini-modeline-autoloads dash-autoloads olivetti-autoloads orderless-autoloads p4-autoloads s-autoloads simple-httpd-autoloads vundo-autoloads info with-editor-autoloads yasnippet-autoloads package browse-url xdg url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel touch-screen dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win 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 w32notify w32 lcms2 multi-tty move-toolbar make-network-process tty-child-frames native-compile mps emacs)

Memory information: ((conses 24 0 0) (symbols 56 0 0) (strings 40 0 0) (string-bytes 1 0) (vectors 24 0) (vector-slots 8 0 0) (floats 24 0 0) (intervals 64 0 0) (buffers 1000 0))

the42 avatar Feb 26 '25 15:02 the42

I could reproduce this in Emacs 31 (current development version), only. I plan to get this fixed before that version gets released but it's not a high priority for me, yet

sheijk avatar Jun 15 '25 08:06 sheijk

I've found the reason. It seems to be a bug in the htmlize lib impatient-mode uses. Repro steps:

  1. create new buffer
  2. M-x impatient-mode
  3. Insert this snippet: (insert "\n->" (propertize "hello" 'display '(left-fringe hideshowvis-hideable-marker hideshowvis-hidable-face)) "<-")
  4. M-x eval-last-sexp (or C-x C-e)

Now I see this in the browser:

Image

And htmlize-region produces:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!-- Created by htmlize-1.57 in css mode. -->
<html>
  <head>
    <title>untitled</title>
    <style type="text/css">
    <!--
      body {
        color: #000000;
        background-color: #ffffff;
      }
      .hl-line {
        /* hl-line */
        background-color: #ededed;
      }
      .region {
        /* region */
        background-color: #D0D9E2;
      }

      a {
        color: inherit;
        background-color: inherit;
        font: inherit;
        text-decoration: inherit;
      }
      a:hover {
        text-decoration: underline;
      }
    -->
    </style>
  </head>
  <body>
    <pre>
<span class="region"><span class="hl-line">-&gt;hello&lt;-</span></span></pre>
  </body>
</html>

sheijk avatar Nov 15 '25 17:11 sheijk

@the42 I've added a work-around to not trigger the limitation in htmlize anymore and opened a bug there (see above)

sheijk avatar Nov 15 '25 17:11 sheijk