GNU bug report logs - #80170
30.2; describe-mode incorrectly shows binding shadowed by minor mode

Previous Next

Package: emacs;

Reported by: Gal Lakovnik Gorenec <gal.lakovnik.gorenec <at> proton.me>

Date: Sat, 10 Jan 2026 07:45:02 UTC

Severity: normal

Found in version 30.2

To reply to this bug, email your comments to 80170 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#80170; Package emacs. (Sat, 10 Jan 2026 07:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gal Lakovnik Gorenec <gal.lakovnik.gorenec <at> proton.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 10 Jan 2026 07:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gal Lakovnik Gorenec <gal.lakovnik.gorenec <at> proton.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.2; describe-mode incorrectly shows binding shadowed by minor mode
Date: Sat, 10 Jan 2026 00:22:47 +0000
Bug reproducible from a clean emacs:

Shell command:
emacs -Q --init-directory="$(mktemp -d)"

From within emacs:
package-install RET haskell-mode RET

eval the following use-package invocation:
NOTE: This is not a bug about tidal-mode

(use-package tidal
  :vc
  (:url "https://codeberg.org/uzu/tidal"))

Open an empty tidal file:
C-c C-f ~/test.tidal

Check describe-mode, describe-key and describe-bindings:
C-h m         -> (incorrectly) shows C-c C-c as bound to tidal-run-line
C-h k C-c C-c ->
  (correctly) shows C-c C-c as bound to haskell-process-cabal-build
C-h b         ->
  (correctly) shows C-c C-c as bound to haskell-process-cabal-build

tidal-mode is a fairly simple major-mode, derived from haskell-mode.
C-c C-c is part of its default keymap.
haskell-process-cabal-build belongs to the minor
haskell-interactive-mode,
enabled by the haskell-mode default hook.

-------------

In GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.50,
cairo version 1.18.4)
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --sysconfdir=/etc --prefix=/usr
 --libexecdir=/usr/lib --localstatedir=/var --disable-build-details
 --with-cairo --with-harfbuzz --with-libsystemd --with-modules
 --with-native-compilation=aot --with-tree-sitter 'CFLAGS=-march=x86-64
 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3
 -Wformat -Werror=format-security -fstack-clash-protection
 -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto'
 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro
 -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto'
 'CXXFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g
 -ffile-prefix-map=/build/emacs/src=/usr/src/debug/emacs -flto=auto''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

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

Major mode: Haskell Tidal

Minor modes in effect:
  interactive-haskell-mode: t
  haskell-indentation-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
  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 shortdoc help-fns tidal pulse color
find-lisp scheme tidal-autoloads vc-hg vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs log-view pcvs-util vc-git diff-mode track-changes
package-vc vc vc-dispatcher cl-extra use-package-core haskell-indent
haskell-doc advice comp-run comp-common haskell-c2hs ert ewoc debug
backtrace find-func quail help-mode inf-haskell haskell-decl-scan shell
pcomplete imenu haskell haskell-completions haskell-load
haskell-commands highlight-uses-mode haskell-modules haskell-sandbox
haskell-navigate-imports haskell-repl haskell-svg haskell-collapse
hideshow haskell-debug haskell-interactive-mode
haskell-presentation-mode haskell-compile haskell-process
haskell-session haskell-hoogle view haskell-mode haskell-cabal
haskell-utils haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme rx haskell-align-imports
haskell-complete-module haskell-ghc-support noutline outline
flymake-proc flymake warnings thingatpt etags fileloop generator xref
project dabbrev haskell-customize compile comint ansi-osc ansi-color
ring info haskell-mode-autoloads easy-mmode loaddefs-gen lisp-mnt
radix-tree tar-mode arc-mode archive-mode cus-edit pp cus-start cus-load
wid-edit mm-archive message sendmail yank-media dired dired-loaddefs
rfc822 mml mml-sec epa derived gnus-util text-property-search time-date
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils
gnutls network-stream url-cache url-http url-auth mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny epg
rfc6068 epg-config finder-inf package browse-url 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 term/pgtk-win pgtk-win
term/common-win touch-screen pgtk-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
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 dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk pgtk
lcms2 multi-tty move-toolbar make-network-process native-compile emacs)

Memory information:
((conses 16 343852 61074) (symbols 48 19172 6) (strings 32 81018 3736)
 (string-bytes 1 2626118) (vectors 16 34054)
 (vector-slots 8 452873 27821) (floats 8 240 316)
 (intervals 56 1773 151) (buffers 992 22))

-- 
Kind regards,
  Gal Lakovnik Gorenec





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80170; Package emacs. (Sat, 10 Jan 2026 10:49:01 GMT) Full text and rfc822 format available.

Message #8 received at 80170 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gal Lakovnik Gorenec <gal.lakovnik.gorenec <at> proton.me>
Cc: 80170 <at> debbugs.gnu.org
Subject: Re: bug#80170: 30.2;
 describe-mode incorrectly shows binding shadowed by minor mode
Date: Sat, 10 Jan 2026 12:48:29 +0200
> Date: Sat, 10 Jan 2026 00:22:47 +0000
> From:  Gal Lakovnik Gorenec via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> 
> Bug reproducible from a clean emacs:
> 
> Shell command:
> emacs -Q --init-directory="$(mktemp -d)"
> 
> >From within emacs:
> package-install RET haskell-mode RET
> 
> eval the following use-package invocation:
> NOTE: This is not a bug about tidal-mode
> 
> (use-package tidal
>   :vc
>   (:url "https://codeberg.org/uzu/tidal"))
> 
> Open an empty tidal file:
> C-c C-f ~/test.tidal
> 
> Check describe-mode, describe-key and describe-bindings:
> C-h m         -> (incorrectly) shows C-c C-c as bound to tidal-run-line
> C-h k C-c C-c ->
>   (correctly) shows C-c C-c as bound to haskell-process-cabal-build
> C-h b         ->
>   (correctly) shows C-c C-c as bound to haskell-process-cabal-build
> 
> tidal-mode is a fairly simple major-mode, derived from haskell-mode.
> C-c C-c is part of its default keymap.
> haskell-process-cabal-build belongs to the minor
> haskell-interactive-mode,
> enabled by the haskell-mode default hook.

Thanks, but is it possible to show a reproduction recipe that requires
neither haskell nor tidal being installed?  If the problem is inherent
in the Emacs core, and this report is neither against haskell-mode nor
against tidal-modem there should be no problem with coming up with a
recipe that uses only the built-in features, right?

A recipe that doesn't depend on external packages is likely to be
handled faster and in a more efficient way.

TIA




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80170; Package emacs. (Sat, 10 Jan 2026 19:52:02 GMT) Full text and rfc822 format available.

Message #11 received at 80170 <at> debbugs.gnu.org (full text, mbox):

From: Gal Lakovnik Gorenec <gal.lakovnik.gorenec <at> proton.me>
To: 80170 <at> debbugs.gnu.org
Subject: Re: bug#80170: 30.2;
 describe-mode incorrectly shows binding shadowed by minor mode
Date: Sat, 10 Jan 2026 18:14:09 +0000
Hello Eli,

  my apologies. Pushing through my laziness would have saved me a bit of
  embarassment, and you a bit of time. In my defense, it was around 3 a.m. :)

  Evaluating the following code reproduces the issue (again, starting from a clean
  emacs session):

      (defvar shadow-bindings-mode-map
      (let ((map (make-sparse-keymap)))
        (define-key map (kbd "C-c C-c") 'shadow-message)
        map)
      "Keymap for shadow-bindings-mode")

      ;;;###autoload
      (define-minor-mode
        shadow-bindings-mode
        "A minor mode defining a binding that conflicts with a binding of a derived mode.
      Enabled by parent"
        :lighter " Shadowed"
        :keymap shadow-bindings-mode-map)

      ;;;###autoload
      (defun shadow-message ()
        (interactive)
        (message "This binding shadows a derived mode's binding"))

      (defvar parent-mode-hook '(shadow-bindings-mode))

      ;;;###autoload
      (define-derived-mode
        parent-mode
        prog-mode
        "Parent"
        "A parent mode that enables a minor mode via its startup hook.")

      (defun child-message ()
        (interactive)
        (message "Child-mode's binding calls this command."))

      (defvar child-mode-map
        (let ((map (make-sparse-keymap "Child Keymap")))
          (define-key map (kbd "C-c C-c") 'child-message)
          map)
        "Keymap for child-mode")

      ;;;###autoload
      (define-derived-mode
        child-mode
        parent-mode
        "Child"
        "A derived mode.")

      ;;;###autoload
      (add-to-list 'auto-mode-alist '("\\.xyz\\'" . child-mode))

  After evaluation, opening "test.xyz" exhibits the problem referred to
  in the original report, namely:
    C-c C-c runs 'shadow-message
    C-h m incorrectly lists "C-c C-c" as bound to 'child-message
    
  C-h k C-c C-c and C-h b both correctly show the binding.
  The issue persists regardless of whether the minor mode is enabled from
  the parent hook or manually.

  While writing this I noticed that the binding is correctly shown in
  the description of the minor mode. Is this the intended functionality?
  Is describe-mode supposed to show shadowed bindings without indicating
  said shadowing?

  Anyway, if this is NOT intended functionality -- I've been lurking in
  emacs-devel with the intention of starting to contribute and this
  (famous last words) doesn't seem too complicated. I'd be happy to
  submit a patch.

  P.S: Thank you and everyone else involved for your wonderful work.
  
-- 
Kind regards,
  Gal Lakovnik Gorenec





This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.