GNU bug report logs - #72532
[PATCH] ; lisp/progmodes/which-func.el (which-function-mode): check buffer

Previous Next

Package: emacs;

Reported by: Raffael Stocker <r.stocker <at> mnet-mail.de>

Date: Thu, 8 Aug 2024 19:50:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Raffael Stocker <r.stocker <at> mnet-mail.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 72532 <at> debbugs.gnu.org
Subject: bug#72532: [PATCH] ; lisp/progmodes/which-func.el (which-function-mode): check buffer
Date: Fri, 09 Aug 2024 19:35:08 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, but please show a couple of Lisp backtraces you get for this
> error.  We'd like to be sure we are fixing the problem you report, not
> some other problem.

See [1] and [2] below.


[1]:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Selecting deleted buffer")
  which-function-mode()
    debugger-may-continue = t
    inhibit-redisplay = nil
    inhibit-debugger = t
    inhibit-changing-match-data = nil
  run-hooks(change-major-mode-after-body-hook prog-mode-hook c-ts-base-mode-hook c-ts-mode-hook)
  apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook c-ts-base-mode-hook c-ts-mode-hook))
  run-mode-hooks(c-ts-mode-hook)
  c-ts-mode()
  set-auto-mode-0(c-mode nil)
  set-auto-mode--apply-alist((("\\.[pP][dD][fF]\\'" . #f(compiled-function () #<bytecode 0x51b1ee9548b3>))
                              ("\\.epub\\'" . nov-mode) ("\\.mac\\'" . maxima-mode)
                              ("\\.ledger$" . ledger-mode)
                              ("\\.\\(plantuml\\|pum\\|plu\\|puml\\)\\'" . plantuml-mode)
                              ("\\.mo\\'" . modelica-mode) ("\\.asy$" . asy-mode)
                              ("\\.hva\\'" . LaTeX-mode) ("\\.tsv\\'" . tsv-mode)
                              ("\\.[Cc][Ss][Vv]\\'" . csv-mode) ("\\.djvu\\'" . djvu-init-mode)
                              ("\\.rkt\\'" . scheme-mode) ("/git/ignore\\'" . gitignore-mode)
                              ("/info/exclude\\'" . gitignore-mode) ("/\\.gitignore\\'" . gitignore-mode)
                              ("/etc/gitconfig\\'" . gitconfig-mode)
                              ("/\\.gitmodules\\'" . gitconfig-mode) ("/git/config\\'" . gitconfig-mode)
                              ("/modules/.*/config\\'" . gitconfig-mode)
                              ("/\\.git/config\\'" . gitconfig-mode) ("/\\.gitconfig\\'" . gitconfig-mode)
                              ("/git/attributes\\'" . gitattributes-mode)
                              ("/info/attributes\\'" . gitattributes-mode)
                              ("/\\.gitattributes\\'" . gitattributes-mode)
                              ("\\.gv\\'" . graphviz-dot-mode) ("\\.dot\\'" . graphviz-dot-mode)
                              ("\\.pro\\'" . idlwave-mode) ("\\.hex\\'" . intel-hex-mode)
                              ("\\.jl\\'" . julia-mode) ("\\.ledger\\'" . ledger-mode)
                              ("/git-rebase-todo\\'" . git-rebase-mode) ("\\.mms" . mmix-mode)
                              ("\\.mmo" . mmix-mmo-mode)
                              ("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-mode-maybe)
                              ("\\.\\(?:php\\.inc\\|stub\\)\\'" . php-mode)
                              ("/\\.php_cs\\(?:\\.dist\\)?\\'" . php-mode)
                              ("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode)
                              ("\\.ps[dm]?1\\'" . powershell-mode) ("\\.rs\\'" . rustic-mode)
                              ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode)
                              ("\\.rs\\'" . rust-mode) ("\\.grm\\'" . sml-yacc-mode)
                              ("\\.cm\\'" . sml-cm-mode) ("\\.s\\(ml\\|ig\\)\\'" . sml-mode)
                              ("/systemd/[^z-a]+?\\.d/[^/]+?\\.conf\\'" . systemd-mode)
                              ("\\.#\\(?:[.0-9@-Z\\_a-z-]+?\\.\\(?:automount\\|busname\\|link\\|mount\\|net\\(?:dev\\|work\\)\\|s\\(?:ervice\\|lice\\|ocket\\|wap\\)\\|t\\(?:arget\\|imer\\)\\)\\|override\\.conf\\)[[:xdigit:]]\\{16\\}\\'"
                               . systemd-mode)
                              ("[.0-9@-Z\\_a-z-]+?\\.\\(?:automount\\|busname\\|link\\|mount\\|net\\(?:dev\\|work\\)\\|s\\(?:ervice\\|lice\\|ocket\\|wap\\)\\|t\\(?:arget\\|imer\\)\\)\\'"
                               . systemd-mode)
                              ("\\.nspawn\\'" . systemd-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode)
                              ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ...)
                             nil nil)
  #<subr set-auto-mode>()
  so-long--set-auto-mode(#<subr set-auto-mode>)
    so-long--set-auto-mode = t
  apply(so-long--set-auto-mode #<subr set-auto-mode> nil)
  set-auto-mode()
  normal-mode(t)
    enable-local-variables = t
  after-find-file(nil t)
  find-file-noselect-1(#<buffer android.c> "~/build/emacs/src/android.c" nil nil
                                "~/build/emacs/src/android.c" (1320625 65027))
  find-file-noselect("/home/rst/build/emacs/src/android.c" nil nil nil)
  find-file("/home/rst/build/emacs/src/android.c")
  counsel-find-file-action("/home/rst/build/emacs/src/android.c")
  ivy-call()
  ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher
           :initial-input nil :action counsel-find-file-action :preselect nil
           :require-match confirm-after-completion :history file-name-history :keymap
           (keymap (remap keymap (undo . counsel-find-file-undo))
                   (67108960 lambda (&optional arg) "nil (`nil')" (interactive "p")
                             (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b"))
                               (self-insert-command arg)))
                   (96 . counsel-file-jump-from-find)
                   (C-backspace . counsel-up-directory)
                   (67108991 . counsel-up-directory))
           :caller counsel-find-file)
    ivy-recursive-last = nil
    ivy--display-function = nil
  counsel--find-file-1("Find file: " nil counsel-find-file-action counsel-find-file)
    default-directory = "/home/rst/build/emacs/src/"
  counsel-find-file()
    default-directory = "/home/rst/build/emacs/src/"
    tramp-archive-enabled = nil
  funcall-interactively(counsel-find-file)
  command-execute(counsel-find-file)
    current-minibuffer-command = counsel-find-file
--8<---------------cut here---------------end--------------->8---


[2]:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Selecting deleted buffer")
  set-buffer(#<killed buffer>)
  (save-current-buffer
    (set-buffer buf) (which-func--header-line-remove) (which-func-ff-hook))
  (let ((buf (car tail)))
    (save-current-buffer
      (set-buffer buf) (which-func--header-line-remove) (which-func-ff-hook))
    (setq tail (cdr tail)))
  (while tail
    (let ((buf (car tail)))
      (save-current-buffer
        (set-buffer buf) (which-func--header-line-remove) (which-func-ff-hook))
      (setq tail (cdr tail))))
  (let ((tail (buffer-list)))
    (while tail
      (let ((buf (car tail)))
        (save-current-buffer
          (set-buffer buf) (which-func--header-line-remove) (which-func-ff-hook))
        (setq tail (cdr tail)))))
  (let ((last-message (current-message)))
    (progn
      (set-default 'which-function-mode
                   (cond
                    ((eq arg 'toggle) (not (default-value 'which-function-mode)))
                    ((and (numberp arg) (< arg 1)) nil) (t t))))
    (if (boundp 'global-minor-modes)
        (progn
          (setq global-minor-modes
                (delq 'which-function-mode global-minor-modes))
          (if (default-value 'which-function-mode)
              (progn
                (setq global-minor-modes
                      (cons 'which-function-mode global-minor-modes))))))
    (if (timerp which-func-update-timer)
        (progn (cancel-timer which-func-update-timer)))
    (setq which-func-update-timer nil)
    (if which-function-mode
        (progn
          (setq which-func-update-timer
                (run-with-idle-timer which-func-update-delay t
                                     #'which-func-update))))
    (let ((tail (buffer-list)))
      (while tail
        (let ((buf (car tail)))
          (save-current-buffer
            (set-buffer buf) (which-func--header-line-remove)
            (which-func-ff-hook))
          (setq tail (cdr tail)))))
    (run-hooks 'which-function-mode-hook
               (if (default-value 'which-function-mode)
                   'which-function-mode-on-hook
                 'which-function-mode-off-hook))
    (if (called-interactively-p 'any)
        (progn
          (customize-mark-as-set 'which-function-mode)
          (if
              (and (current-message)
                   (not (equal last-message (current-message))))
              nil
            (let ((local ""))
              (message "%s %sabled%s" "Which-Function mode"
                       (if (default-value ...) "en" "dis") local))))))
  which-function-mode()
    arg = nil
  run-hooks(change-major-mode-after-body-hook prog-mode-hook c-ts-base-mode-hook c-ts-mode-hook)
  apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook c-ts-base-mode-hook c-ts-mode-hook))
  run-mode-hooks(c-ts-mode-hook)
  c-ts-mode()
  set-auto-mode-0(c-mode nil)
  set-auto-mode--apply-alist((("\\.[pP][dD][fF]\\'" . #f(compiled-function () #<bytecode 0x51b1ee9548b3>))
                              ("\\.epub\\'" . nov-mode) ("\\.mac\\'" . maxima-mode)
                              ("\\.ledger$" . ledger-mode)
                              ("\\.\\(plantuml\\|pum\\|plu\\|puml\\)\\'" . plantuml-mode)
                              ("\\.mo\\'" . modelica-mode) ("\\.asy$" . asy-mode)
                              ("\\.hva\\'" . LaTeX-mode) ("\\.tsv\\'" . tsv-mode)
                              ("\\.[Cc][Ss][Vv]\\'" . csv-mode) ("\\.djvu\\'" . djvu-init-mode)
                              ("\\.rkt\\'" . scheme-mode) ("/git/ignore\\'" . gitignore-mode)
                              ("/info/exclude\\'" . gitignore-mode) ("/\\.gitignore\\'" . gitignore-mode)
                              ("/etc/gitconfig\\'" . gitconfig-mode)
                              ("/\\.gitmodules\\'" . gitconfig-mode) ("/git/config\\'" . gitconfig-mode)
                              ("/modules/.*/config\\'" . gitconfig-mode)
                              ("/\\.git/config\\'" . gitconfig-mode) ("/\\.gitconfig\\'" . gitconfig-mode)
                              ("/git/attributes\\'" . gitattributes-mode)
                              ("/info/attributes\\'" . gitattributes-mode)
                              ("/\\.gitattributes\\'" . gitattributes-mode)
                              ("\\.gv\\'" . graphviz-dot-mode) ("\\.dot\\'" . graphviz-dot-mode)
                              ("\\.pro\\'" . idlwave-mode) ("\\.hex\\'" . intel-hex-mode)
                              ("\\.jl\\'" . julia-mode) ("\\.ledger\\'" . ledger-mode)
                              ("/git-rebase-todo\\'" . git-rebase-mode) ("\\.mms" . mmix-mode)
                              ("\\.mmo" . mmix-mmo-mode)
                              ("\\.\\(?:php[s345]?\\|phtml\\)\\'" . php-mode-maybe)
                              ("\\.\\(?:php\\.inc\\|stub\\)\\'" . php-mode)
                              ("/\\.php_cs\\(?:\\.dist\\)?\\'" . php-mode)
                              ("\\.\\(plantuml\\|pum\\|plu\\)\\'" . plantuml-mode)
                              ("\\.ps[dm]?1\\'" . powershell-mode) ("\\.rs\\'" . rustic-mode)
                              ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode)
                              ("\\.rs\\'" . rust-mode) ("\\.grm\\'" . sml-yacc-mode)
                              ("\\.cm\\'" . sml-cm-mode) ("\\.s\\(ml\\|ig\\)\\'" . sml-mode)
                              ("/systemd/[^z-a]+?\\.d/[^/]+?\\.conf\\'" . systemd-mode)
                              ("\\.#\\(?:[.0-9@-Z\\_a-z-]+?\\.\\(?:automount\\|busname\\|link\\|mount\\|net\\(?:dev\\|work\\)\\|s\\(?:ervice\\|lice\\|ocket\\|wap\\)\\|t\\(?:arget\\|imer\\)\\)\\|override\\.conf\\)[[:xdigit:]]\\{16\\}\\'"
                               . systemd-mode)
                              ("[.0-9@-Z\\_a-z-]+?\\.\\(?:automount\\|busname\\|link\\|mount\\|net\\(?:dev\\|work\\)\\|s\\(?:ervice\\|lice\\|ocket\\|wap\\)\\|t\\(?:arget\\|imer\\)\\)\\'"
                               . systemd-mode)
                              ("\\.nspawn\\'" . systemd-mode) ("\\.\\(e?ya?\\|ra\\)ml\\'" . yaml-mode)
                              ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ...)
                             nil nil)
  #<subr set-auto-mode>()
  so-long--set-auto-mode(#<subr set-auto-mode>)
    so-long--set-auto-mode = t
  apply(so-long--set-auto-mode #<subr set-auto-mode> nil)
  set-auto-mode()
  normal-mode(t)
    enable-local-variables = t
  after-find-file(nil nil t nil nil)
  revert-buffer--default(t nil)
    inhibit-read-only = t
  revert-buffer(t)
    revert-buffer-preserve-modes = nil
    revert-buffer-in-progress-p = t
  funcall-interactively(revert-buffer t)
  command-execute(revert-buffer)
    current-minibuffer-command = revert-buffer
--8<---------------cut here---------------end--------------->8---





This bug report was last modified 339 days ago.

Previous Next


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