bug#81621: 32.0.50; regression in 6223d243da3f45 - cursor moves erratically

Platon Pronko <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
I am using lsp-mode with company-box for completions display. If completion popup is visible and I type characters, the position of the cursor jumps around, seemingly to the beginning of line or file.

How to reproduce:

1. Run latest Emacs, loading the following file (emacs -Q -l reproducer-init.el):

(require 'package)
(package-initialize)
(use-package lsp-mode
   :hook ((python-mode . #'lsp))
   :config
   (require 'company)
   (setq company-idle-delay 0.02)
   (setq company-minimum-prefix-length 1)
   (setq company-dabbrev-downcase nil)
   (require 'company-box)
   (add-hook 'company-mode-hook 'company-box-mode)
   (require 'flymake))

2. Open a .py file, start typing something, like "import".

3. Observe a completion dialog appearing and cursor jumping while you type (I've got "portim" instead of "import", for example).


I've tracked down the regression to commit 6223d243da3f45be380867c810c5cc64d17e290b, 2026-08-02, by João Távora.

Looks like the problem is in lisp/progmodes/flymake.el, in flymake-make-report-fn:

(defun flymake-make-report-fn (backend &optional token)
   "Make a suitable anonymous report function for BACKEND.
BACKEND is used to help Flymake distinguish different diagnostic
sources.  If provided, TOKEN helps Flymake distinguish between
different runs of the same backend."
   (let ((buffer (current-buffer))
         (point (point)))
     (lambda (&rest args)
       (when (buffer-live-p buffer)
         (with-current-buffer buffer
           (goto-char point)
           (apply #'flymake--handle-report backend token args))))))

If I wrap this goto-char & apply block in save-excursion, then the problem goes away.


In GNU Emacs 32.0.50 (build 21, x86_64-pc-linux-gnu, GTK+ Version
  3.24.52, cairo version 1.18.4) of 2026-08-14 built on the-big-maker
Repository revision: 4fb098ae3fa1ffa721214555b149d94caecc8d0c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101024
System Description: Arch Linux

Configured using:
  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
  --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
  --with-modules --without-m17n-flt --without-gconf
  --with-native-compilation=no --with-xinput2 --with-x-toolkit=gtk3
  --without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
  --without-compress-install 'CFLAGS=-march=x86-64 -mtune=generic -O2
  -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat
  -Werror=format-security -fstack-clash-protection -fcf-protection''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11
XDBE XIM XINERAMA XINPUT2 XPM XRANDR GTK3 ZLIB

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

Major mode: Python

Minor modes in effect:
   lsp-diagnostics-mode: t
   lsp-modeline-workspace-status-mode: t
   lsp-modeline-diagnostics-mode: t
   dap-tooltip-mode: t
   dap-ui-many-windows-mode: t
   dap-ui-controls-mode: t
   dap-ui-mode: t
   dap-auto-configure-mode: t
   dap-mode: t
   treemacs-filewatch-mode: t
   treemacs-follow-mode: t
   treemacs-git-mode: t
   treemacs-fringe-indicator-mode: t
   lsp-completion-mode: t
   flymake-mode: t
   company-box-mode: t
   company-mode: t
   lsp-managed-mode: t
   lsp-mode: t
   rainbow-delimiters-mode: t
   yas-minor-mode: t
   global-git-gutter-mode: t
   counsel-mode: t
   ivy-mode: t
   global-whitespace-mode: t
   whitespace-mode: t
   global-dvorak-mode: t
   dvorak-minor-mode: t
   global-auto-revert-mode: t
   electric-pair-mode: t
   global-so-long-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   minibuffer-nonselected-mode: t
   minibuffer-regexp-mode: t
   size-indication-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Features:
(shadow sort mail-extr emacsbug lisp-mnt message yank-media dired
dired-loaddefs rfc822 mml mml-sec epa derived gnus-util mm-decode
mm-bodies mm-encode mailabbrev gmm-utils mailheader sendmail mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
company-childframe lsp-diagnostics company-oddmuse company-keywords
company-etags company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb lsp-modeline lsp-icons dap-mouse dap-ui
gdb-mi bindat gud bui bui-list bui-info bui-entry bui-core bui-history
bui-button bui-utils cus-edit pp cus-start cus-load tramp-sh tramp-cache
time-stamp tramp trampver tramp-integration tramp-message tramp-compat
shell pcomplete parse-time iso8601 time-date tramp-loaddefs lsp-zig
lsp-yang lsp-yaml lsp-xml lsp-wgsl lsp-wat lsp-volar lsp-vimscript
lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-typos
lsp-typst lsp-typespec lsp-typeprof lsp-ttcn3 lsp-ts-query lsp-trunk
lsp-toml-tombi lsp-toml lsp-tilt lsp-tex lsp-terraform lsp-tailwindcss
lsp-svelte lsp-steep lsp-sqls lsp-sql lsp-sorbet lsp-solidity
lsp-solargraph lsp-semgrep lsp-rust lsp-ruff lsp-ruby-syntax-tree
lsp-ruby-lsp lsp-rubocop lsp-roslyn lsp-ron lsp-roc lsp-rf lsp-remark
lsp-racket lsp-r lsp-qml lsp-python-ty lsp-pyright lsp-pylsp lsp-pyls
lsp-pwsh lsp-purescript lsp-prisma lsp-postgres lsp-pls lsp-php
lsp-perlnavigator lsp-perl lsp-openscad lsp-odin lsp-ocaml lsp-nushell
lsp-nix lsp-nim lsp-nginx lsp-nextflow lsp-move lsp-mojo lsp-mint
lsp-metals view lsp-metals-treeview lsp-metals-protocol lsp-lens
dap-mode dap-tasks dap-launch posframe dap-overlays lsp-meson lsp-mdx
lsp-matlab lsp-marksman lsp-markdown lsp-magik lsp-fennel lsp-lua
lsp-lisp lsp-kubernetes-helm lsp-kotlin lsp-json lsp-jq lsp-just
lsp-javascript lsp-idris lsp-haxe lsp-hack lsp-groovy lsp-graphql
lsp-golangci-lint lsp-glsl lsp-gleam lsp-gdscript lsp-fish lsp-fsharp
lsp-futhark lsp-fortran lsp-fortitude lsp-eslint lsp-erlang lsp-emmet
lsp-elm lsp-elixir lsp-earthly lsp-dockerfile lsp-docker yaml lsp-dhall
lsp-d lsp-cypher lsp-cucumber lsp-crates lsp-copilot lsp-css lsp-c3
lsp-csharp gnutls lsp-crystal lsp-credo lsp-cobol lsp-cmake lsp-clojure
lsp-treemacs lsp-treemacs-generic lsp-treemacs-themes treemacs-treelib
treemacs treemacs-header-line treemacs-compatibility treemacs-mode
treemacs-interface treemacs-persistence treemacs-filewatch-mode
treemacs-follow-mode treemacs-rendering treemacs-annotations
treemacs-async treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator pulse face-remap treemacs-faces treemacs-icons
treemacs-scope treemacs-themes treemacs-core-utils pfuture hl-line
treemacs-logging treemacs-customization treemacs-macros lsp-clangd dom
lsp-bufls lsp-go lsp-completion lsp-beancount lsp-bash lsp-awk
lsp-autotools lsp-astro lsp-asm lsp-ansible lsp-angular lsp-ada
lsp-semantic-tokens lsp-actionscript flymake warnings company-box
company-box-doc frame-local company-box-icons company lsp-mode
lsp-protocol vc-git files-x vc-dispatcher tree-widget wid-edit spinner
network-stream puny nsm smartparens-markdown markdown-mode color
noutline outline inline imenu ht f s ewoc epg rfc6068 epg-config
smartparens-python python compat treesit smartparens-go go-mode
find-file ffap etags fileloop generator xref project compile
text-property-search comint ansi-osc ansi-color edmacro kmacro
smartparens-config smartparens-text smartparens byte-opt advice loadhist
dash rainbow-delimiters dabbrev yasnippet git-gutter-fringe
fringe-helper git-gutter counsel swiper ivy-hydra ivy ivy-faces colir rx
format-spec thingatpt hydra lv disp-table whitespace quail easy-mmode
ace-window avy ring cl-extra help-mode use-package-core bytecomp
byte-compile darcula-theme autorevert filenotify elec-pair so-long
finder-inf company-box-autoloads company-autoloads counsel-autoloads
elixir-ts-mode-autoloads erlang-autoloads frame-local-autoloads
git-gutter-autoloads go-mode-autoloads gptel-autoloads
haskell-mode-autoloads heex-ts-mode-autoloads ivy-hydra-autoloads
lorem-ipsum-autoloads lsp-metals-autoloads dap-mode-autoloads
lsp-docker-autoloads bui-autoloads lsp-pyright-autoloads
lsp-treemacs-autoloads lsp-mode-autoloads f-autoloads magit-autoloads
pcase magit-section-autoloads markdown-mode-autoloads
pyim-basedict-autoloads pyim-autoloads async-autoloads
rust-mode-autoloads scala-mode-autoloads smartparens-autoloads
solidity-mode-autoloads svg-lib-autoloads swiper-autoloads ivy-autoloads
transient-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 gv icons password-cache json subr-x mule-util
map url-vars cl-loaddefs cl-lib treemacs-autoloads cfrs-autoloads
posframe-autoloads ht-autoloads hydra-autoloads pfuture-autoloads
ace-window-autoloads avy-autoloads s-autoloads dash-autoloads
typescript-mode-autoloads web-mode-autoloads wgrep-autoloads
with-editor-autoloads llama-autoloads cond-let-autoloads xr-autoloads
yaml-autoloads yaml-mode-autoloads yasnippet-autoloads package-activate
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen 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 lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process tty-child-frames emacs)

Memory information:
((conses 16 595244 313805) (symbols 48 45344 3)
  (strings 32 198232 24534) (string-bytes 1 4885157) (vectors 16 75834)
  (vector-slots 8 690637 99604) (floats 8 360 2043)
  (intervals 56 3328 1596) (buffers 1064 21))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.