Subject: args-out-of-range in redisplay_internal

From: Juri Linkov <[email-masked]>
Date: Tue, 17 Aug 2021 19:06:41 +0300

I prepared a commit message for the tab-bar patch, everything was nice,
but suddenly the commit failed with an unexpected error:

Debugger entered--Lisp error: (args-out-of-range 1737 1737)
  redisplay_internal\ \(C\ function\)()
  message("Running in foreground: %s" #("git --no-pager commit -m Redesign tab-bar event processing (bug#41342, bug#41343)\n\nInstead of emitting menu-item keys like [tab-1],\nemit normal mouse events like [mouse-1] and [mouse-2]\nfor all mouse clicks issued on the tab-bar.\n\n* lisp/mouse.el (mouse-posn-property): Handle 'tab-bar' posn-area.\n\n* lisp/tab-bar.el (tab--key-to-number): New internal function.\n(tab-bar-handle-mouse): Use tab key to select/close tab.\n(tab-bar-mouse-select-tab, tab-bar-mouse-close-tab)\n(tab-bar-mouse-context-menu): New commands.\n(tab-bar-map): Bind [down-mouse-1] to tab-bar-mouse-select-tab,\n[down-mouse-2] to tab-bar-mouse-close-tab,\n[down-mouse-3] to tab-bar-mouse-context-menu.\n(tab-bar-keymap-cache): Remove.\n(tab-bar-make-keymap): Don't use cache.\n(tab-bar--format-tab): Remove default bindings from menu items.\n(tab-bar-make-keymap-1): Prepend tab-bar-map.\n\n* src/keyboard.c (make_lispy_event): Append event->arg to position\nfor Qtab_bar.\n\n* src/term.c (handle_one_term_event): Simplify to set event arg.\n\n* src/w32inevt.c (do_mouse_event): Set emacs_ev->arg to the value\nreturned from tty_handle_tab_bar_click.\n\n* src/w32term.c (w32_handle_tab_bar_click): Return value from\nhandle_tab_bar_click.\n(w32_read_socket): Set tab_bar_key to value returned from\nw32_handle_tab_bar_click, and set event arg from it.\n\n* src/xdisp.c (handle_tab_bar_click): Instead of emitting event,\nreturn a list with Qtab_bar and tab caption with text properties\nthat contain Qmenu_item with key and binding.\n(tty_handle_tab_bar_click): Simplify to return a list of Qtab_bar,\nkey and close_p, instead of emitting event.\n\n* src/xterm.c (handle_one_xevent): Set tab_bar_key to value\nreturned from handle_tab_bar_click, and set event arg from it.\n --only -- :(literal)/tmp/emacs/etc/NEWS :(literal)/tmp/emacs/lisp/mouse.el :(literal)/tmp/emacs/lisp/tab-bar.el :(literal)/tmp/emacs/src/dispextern.h :(literal)/tmp/emacs/src/keyboard.c :(literal)/tmp/emacs/src/term.c :(literal)/tmp/emacs/src/termchar.h :(literal)/tmp/emacs/src/w32inevt.c :(literal)/tmp/emacs/src/w32term.c :(literal)/tmp/emacs/src/xdisp.c :(literal)/tmp/emacs/src/xterm.c" 25 81 (face log-edit-summary jit-lock-defer-multiline t fontified t) 81 360 (fontified t) 360 362 (font-lock-multiline t fontified t) 362 363 (face nil font-lock-multiline t fontified t) 363 417 (fontified t) 417 419 (font-lock-multiline t fontified t) 419 420 (face nil font-lock-multiline t fontified t) 420 469 (fontified t) 469 471 (font-lock-multiline t fontified t) 471 472 (face nil font-lock-multiline t fontified t) 472 513 (fontified t) 513 515 (font-lock-multiline t fontified t) 515 516 (face nil font-lock-multiline t fontified t) 516 666 (fontified t) 666 668 (font-lock-multiline t fontified t) 668 669 (face nil font-lock-multiline t fontified t) 669 698 (fontified t) 698 700 (font-lock-multiline t fontified t) 700 701 (face nil font-lock-multiline t fontified t) 701 738 (fontified t) 738 740 (font-lock-multiline t fontified t) 740 741 (face nil font-lock-multiline t fontified t) 741 802 (fontified t) 802 804 (font-lock-multiline t fontified t) 804 805 (face nil font-lock-multiline t fontified t) 805 1188 (fontified t) 1188 1190 (font-lock-multiline t fontified t) 1190 1191 (face nil font-lock-multiline t fontified t) 1191 1476 (fontified t) 1476 1478 (font-lock-multiline t fontified t) 1478 1479 (face nil font-lock-multiline t fontified t) 1479 1713 (fontified t) ))
  (let ((inhibit-message (eq (selected-window) (active-minibuffer-window)))) (message "Running in foreground: %s" full-command))
  (progn (let ((inhibit-message (eq (selected-window) (active-minibuffer-window)))) (message "Running in foreground: %s" full-command)))
  (if vc-command-messages (progn (let ((inhibit-message (eq (selected-window) (active-minibuffer-window)))) (message "Running in foreground: %s" full-command))))
  (if (eq okstatus 'async) (let ((proc (let ((process-connection-type nil)) (apply #'start-file-process command (current-buffer) command squeezed)))) (if vc-command-messages (progn (let ((inhibit-message (eq ... ...))) (message "Running in background: %s" full-command)))) (set-process-sentinel proc #'ignore) (set-process-filter proc #'vc-process-filter) (setq status proc) (if vc-command-messages (progn (vc-exec-after #'(lambda nil (let ... ...)))))) (if vc-command-messages (progn (let ((inhibit-message (eq (selected-window) (active-minibuffer-window)))) (message "Running in foreground: %s" full-command)))) (let ((buffer-undo-list t)) (setq status (apply #'process-file command nil t nil squeezed))) (if (and (not (eq t okstatus)) (or (not (integerp status)) (and okstatus (< okstatus status)))) (progn (if (eq 32 (aref (buffer-name (current-buffer)) 0)) nil (pop-to-buffer (current-buffer)) (goto-char (point-min)) (shrink-window-if-larger-than-buffer)) (error "Failed (%s): %s" (if (integerp status) (format "status %d" status) status) full-command))) (if vc-command-messages (progn (let ((inhibit-message (eq (selected-window) (active-minibuffer-window)))) (message "Done (status=%d): %s" status full-command)))))
  (let ((process-environment (cons "LC_MESSAGES=C" process-environment)) (w32-quote-process-args t)) (if (eq okstatus 'async) (let ((proc (let ((process-connection-type nil)) (apply #'start-file-process command (current-buffer) command squeezed)))) (if vc-command-messages (progn (let ((inhibit-message ...)) (message "Running in background: %s" full-command)))) (set-process-sentinel proc #'ignore) (set-process-filter proc #'vc-process-filter) (setq status proc) (if vc-command-messages (progn (vc-exec-after #'(lambda nil ...))))) (if vc-command-messages (progn (let ((inhibit-message (eq ... ...))) (message "Running in foreground: %s" full-command)))) (let ((buffer-undo-list t)) (setq status (apply #'process-file command nil t nil squeezed))) (if (and (not (eq t okstatus)) (or (not (integerp status)) (and okstatus (< okstatus status)))) (progn (if (eq 32 (aref (buffer-name ...) 0)) nil (pop-to-buffer (current-buffer)) (goto-char (point-min)) (shrink-window-if-larger-than-buffer)) (error "Failed (%s): %s" (if (integerp status) (format "status %d" status) status) full-command))) (if vc-command-messages (progn (let ((inhibit-message (eq ... ...))) (message "Done (status=%d): %s" status full-command))))))
  (let ((squeezed (remq nil flags)) (inhibit-read-only t) (status 0)) (if files (progn (setq squeezed (nconc squeezed files)))) (let ((process-environment (cons "LC_MESSAGES=C" process-environment)) (w32-quote-process-args t)) (if (eq okstatus 'async) (let ((proc (let (...) (apply ... command ... command squeezed)))) (if vc-command-messages (progn (let (...) (message "Running in background: %s" full-command)))) (set-process-sentinel proc #'ignore) (set-process-filter proc #'vc-process-filter) (setq status proc) (if vc-command-messages (progn (vc-exec-after #'...)))) (if vc-command-messages (progn (let ((inhibit-message ...)) (message "Running in foreground: %s" full-command)))) (let ((buffer-undo-list t)) (setq status (apply #'process-file command nil t nil squeezed))) (if (and (not (eq t okstatus)) (or (not (integerp status)) (and okstatus (< okstatus status)))) (progn (if (eq 32 (aref ... 0)) nil (pop-to-buffer (current-buffer)) (goto-char (point-min)) (shrink-window-if-larger-than-buffer)) (error "Failed (%s): %s" (if (integerp status) (format "status %d" status) status) full-command))) (if vc-command-messages (progn (let ((inhibit-message ...)) (message "Done (status=%d): %s" status full-command)))))) (vc-exec-after #'(lambda nil (run-hook-with-args 'vc-post-command-functions command file-or-list flags))) status)
  (save-current-buffer (if (or (eq buffer t) (and (stringp buffer) (string= (buffer-name) buffer)) (eq buffer (current-buffer))) nil (vc-setup-buffer buffer)) (let ((squeezed (remq nil flags)) (inhibit-read-only t) (status 0)) (if files (progn (setq squeezed (nconc squeezed files)))) (let ((process-environment (cons "LC_MESSAGES=C" process-environment)) (w32-quote-process-args t)) (if (eq okstatus 'async) (let ((proc (let ... ...))) (if vc-command-messages (progn (let ... ...))) (set-process-sentinel proc #'ignore) (set-process-filter proc #'vc-process-filter) (setq status proc) (if vc-command-messages (progn (vc-exec-after ...)))) (if vc-command-messages (progn (let (...) (message "Running in foreground: %s" full-command)))) (let ((buffer-undo-list t)) (setq status (apply #'process-file command nil t nil squeezed))) (if (and (not (eq t okstatus)) (or (not ...) (and okstatus ...))) (progn (if (eq 32 ...) nil (pop-to-buffer ...) (goto-char ...) (shrink-window-if-larger-than-buffer)) (error "Failed (%s): %s" (if ... ... status) full-command))) (if vc-command-messages (progn (let (...) (message "Done (status=%d): %s" status full-command)))))) (vc-exec-after #'(lambda nil (run-hook-with-args 'vc-post-command-functions command file-or-list flags))) status))
  (let* ((files (mapcar #'(lambda (f) (file-relative-name (expand-file-name f))) (if (listp file-or-list) file-or-list (list file-or-list)))) (message-truncate-lines t) (full-command (concat (if vc-tor "torsocks " "") (if (string= (substring command -1) "\n") (substring command 0 -1) command) " " (vc-delistify flags) " " (vc-delistify files)))) (save-current-buffer (if (or (eq buffer t) (and (stringp buffer) (string= (buffer-name) buffer)) (eq buffer (current-buffer))) nil (vc-setup-buffer buffer)) (let ((squeezed (remq nil flags)) (inhibit-read-only t) (status 0)) (if files (progn (setq squeezed (nconc squeezed files)))) (let ((process-environment (cons "LC_MESSAGES=C" process-environment)) (w32-quote-process-args t)) (if (eq okstatus 'async) (let ((proc ...)) (if vc-command-messages (progn ...)) (set-process-sentinel proc #'ignore) (set-process-filter proc #'vc-process-filter) (setq status proc) (if vc-command-messages (progn ...))) (if vc-command-messages (progn (let ... ...))) (let ((buffer-undo-list t)) (setq status (apply ... command nil t nil squeezed))) (if (and (not ...) (or ... ...)) (progn (if ... nil ... ... ...) (error "Failed (%s): %s" ... full-command))) (if vc-command-messages (progn (let ... ...))))) (vc-exec-after #'(lambda nil (run-hook-with-args 'vc-post-command-functions command file-or-list flags))) status)))
  vc-do-command("*vc*" 0 "git" (":(literal)/tmp/emacs/etc/NEWS" ":(literal)/tmp/emacs/lisp/mouse.el" ":(literal)/tmp/emacs/lisp/tab-bar.el" ":(literal)/tmp/emacs/src/dispextern.h" ":(literal)/tmp/emacs/src/keyboard.c" ":(literal)/tmp/emacs/src/term.c" ":(literal)/tmp/emacs/src/termchar.h" ":(literal)/tmp/emacs/src/w32inevt.c" ":(literal)/tmp/emacs/src/w32term.c" ":(literal)/tmp/emacs/src/xdisp.c" ":(literal)/tmp/emacs/src/xterm.c") "--no-pager" "commit" "-m" #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...) "--only" "--")
  vc-git-command(nil 0 (":(literal)/tmp/emacs/etc/NEWS" ":(literal)/tmp/emacs/lisp/mouse.el" ":(literal)/tmp/emacs/lisp/tab-bar.el" ":(literal)/tmp/emacs/src/dispextern.h" ":(literal)/tmp/emacs/src/keyboard.c" ":(literal)/tmp/emacs/src/term.c" ":(literal)/tmp/emacs/src/termchar.h" ":(literal)/tmp/emacs/src/w32inevt.c" ":(literal)/tmp/emacs/src/w32term.c" ":(literal)/tmp/emacs/src/xdisp.c" ":(literal)/tmp/emacs/src/xterm.c") "commit" "-m" #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...) "--only" "--")
  vc-git-checkin(("/tmp/emacs/etc/NEWS" "/tmp/emacs/lisp/mouse.el" "/tmp/emacs/lisp/tab-bar.el" "/tmp/emacs/src/dispextern.h" "/tmp/emacs/src/keyboard.c" "/tmp/emacs/src/term.c" "/tmp/emacs/src/termchar.h" "/tmp/emacs/src/w32inevt.c" "/tmp/emacs/src/w32term.c" "/tmp/emacs/src/xdisp.c" "/tmp/emacs/src/xterm.c") #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...) nil)
  apply(vc-git-checkin (("/tmp/emacs/etc/NEWS" "/tmp/emacs/lisp/mouse.el" "/tmp/emacs/lisp/tab-bar.el" "/tmp/emacs/src/dispextern.h" "/tmp/emacs/src/keyboard.c" "/tmp/emacs/src/term.c" "/tmp/emacs/src/termchar.h" "/tmp/emacs/src/w32inevt.c" "/tmp/emacs/src/w32term.c" "/tmp/emacs/src/xdisp.c" "/tmp/emacs/src/xterm.c") #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...) nil))
  vc-call-backend(Git checkin ("/tmp/emacs/etc/NEWS" "/tmp/emacs/lisp/mouse.el" "/tmp/emacs/lisp/tab-bar.el" "/tmp/emacs/src/dispextern.h" "/tmp/emacs/src/keyboard.c" "/tmp/emacs/src/term.c" "/tmp/emacs/src/termchar.h" "/tmp/emacs/src/w32inevt.c" "/tmp/emacs/src/w32term.c" "/tmp/emacs/src/xdisp.c" "/tmp/emacs/src/xterm.c") #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...) nil)
  #f(compiled-function (files comment) #<bytecode -0x19cacf9e73c10dd2>)(("/tmp/emacs/etc/NEWS" "/tmp/emacs/lisp/mouse.el" "/tmp/emacs/lisp/tab-bar.el" "/tmp/emacs/src/dispextern.h" "/tmp/emacs/src/keyboard.c" "/tmp/emacs/src/term.c" "/tmp/emacs/src/termchar.h" "/tmp/emacs/src/w32inevt.c" "/tmp/emacs/src/w32term.c" "/tmp/emacs/src/xdisp.c" "/tmp/emacs/src/xterm.c") #("Redesign tab-bar event processing (bug#41342, bug#..." 0 56 (face log-edit-summary jit-lock-defer-multiline t fontified t) 56 335 (fontified t) 335 337 (font-lock-multiline t fontified t) 337 338 (face nil font-lock-multiline t fontified t) 338 392 (fontified t) 392 394 (font-lock-multiline t fontified t) 394 395 (face nil font-lock-multiline t fontified t) 395 444 (fontified t) 444 446 (font-lock-multiline t fontified t) 446 447 (face nil font-lock-multiline t fontified t) 447 488 (fontified t) 488 490 (font-lock-multiline t fontified t) 490 491 (face nil font-lock-multiline t fontified t) 491 641 (fontified t) 641 643 (font-lock-multiline t fontified t) 643 644 (face nil font-lock-multiline t fontified t) ...))
  vc-finish-logentry()
  funcall-interactively(vc-finish-logentry)
  log-edit-done()
  funcall-interactively(log-edit-done)
  command-execute(log-edit-done)