Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Selecting deleted buffer" error upon common commands #8729

Closed
mathpunk opened this issue Apr 17, 2017 · 37 comments
Closed

"Selecting deleted buffer" error upon common commands #8729

mathpunk opened this issue Apr 17, 2017 · 37 comments

Comments

@mathpunk
Copy link
Contributor

"Selecting deleted buffer" error upon many commands (search, buffer, file, help...)

Description :octocat:

Everything works normally on startup. But at some point --- I have not found the triggering condition --- commands like SPC f f or SPC b b or even / result in a "Selecting deleted buffer" message instead of the desired behavior.

Reproduction guide 🪲

  • Start Emacs
  • Do work for a few minutes (sorry) --- I'm generally working in an org-mode file, and lately I've been using tables but I'm not sure if these are related.

Observed behaviour: 👀 💔
"Selecting deleted buffer" is the response to many basic commands. Sometimes, but not always, one or more sometimes-incorrectly closed (defun dotspacemacs/emacs-custom-settings ()) ...) forms appear in the .spacemacs file, which I've been deleting manually to get the .spacemacs file to not crash so my configuration gets loaded correctly. Maybe this issue is like #7898 ?

Expected behaviour: ❤️ 😄
Stuff works.

System Info 💻

  • OS: gnu/linux
  • Emacs: 25.1.1
  • Spacemacs: 0.200.9
  • Spacemacs branch: develop (rev. 4361254)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(sql python html ivy better-defaults
     (auto-completion :variables auto-completion-tab-key-behavior 'cycle auto-completion-space-key-behavior 'reject auto-completion-return-key-behavior 'reject auto-completion-enable-help-tooltip t auto-completion-enable-snippets-in-popup t auto-completion-enable-sort-by-usage t auto-completion-complete-with-key-sequence "jk" auto-completion-complete-with-key-sequence-delay 0.3)
     (shell :variables shell-default-shell 'term shell-default-term-shell "/usr/bin/zsh" shell-default-height 40 shell-default-position 'bottom)
     emacs-lisp javascript clojure latex git github restclient syntax-checking markdown deft org themes-megapack typography)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Backtrace 🐾

I don't know how to find a backtrace because the bug kills my ability to navigate buffers.
@mathpunk
Copy link
Contributor Author

mathpunk commented Apr 17, 2017

Update: I'm trying to find a minimal example of something that breaks everything. I went from working state, to deleting rows from one org-mode table and pasting them below another org-mode table, and saved, and that resulted in breakage. I have a couple functions that run on save which I will also try commenting out from my config.

@mathpunk
Copy link
Contributor Author

A-ha! With these two functions no longer running after save, pasting rows and saving no longer breaks everything. These are the only 'after-save-hook functions I had.

;; Tangle Org files when we save them
;; (defun tangle-on-save-org-mode-file()
;;   (when (string= (message "%s" major-mode) "org-mode")
;;     (org-babel-tangle)))

;; (add-hook 'after-save-hook 'tangle-on-save-org-mode-file)
(defun to-agenda-on-save-org-mode-file()
  (when (string= (message "%s" major-mode) "org-mode")
    (org-agenda-file-to-front)))

;; (add-hook 'after-save-hook 'to-agenda-on-save-org-mode-file)

@jdelStrother
Copy link
Contributor

I've found that simply running org-agenda-file-to-front is enough to trigger this

@fiveNinePlusR
Copy link
Contributor

The selecting deleted buffer happens to me from time to time as well and I cannot do a spc b b or pretty much anything until I restart emacs.

@duianto
Copy link
Collaborator

duianto commented May 10, 2017

Killing a ranger buffer and closing the new frame that was opened, puts you in a state where a lot of key bindings show the message: Selecting deleted buffer

Reproduction steps with the ranger layer installed

Open a ranger "session": SPC a r
Kill the selected ranger buffer: SPC b d
The messages buffer shows:

Ranger window was overwritten. Redirecting window to new frame

and a new frame opens, where the key bindings seem to work as expected. But when the new frame is closed: SPC q f (SPC q z in the master branch). Then the initial frame gets selected and when SPC is pressed, then this message is shown:

Error running timer ‘which-key--update’: (error "Selecting deleted buffer")

The frame splits with the bottom window showing <M> where the window number used to be. The top window shows 1 as the window number. The <M> window doesn't close when the cursor is in the top window and SPC w m is pressed to maximize that window.

A lot of key bindings show these messages (without opening a new frame):

Ranger window was overwritten. Redirecting window to new frame
apply: Selecting deleted buffer

SPC q r doesn't restart, it just shows the selecting deleted buffer message. But one way of restarting, is to open a new frame SPC w F, where SPC q r works.

Sometimes it's also possible to get back to normal, without restarting, by pressing SPC b n to switch to the ranger buffer. Or if the ranger buffer isn't found then open a new ranger buffer SPC a r.
Press q to close it.

System Info 💻

  • OS: windows-nt
  • Emacs: 25.2.2
  • Spacemacs: 0.200.9
  • Spacemacs branch: develop (rev. a213729)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(autohotkey markdown ranger emacs-lisp git github helm org syntax-checking version-control)
  • System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS MODULES

@duianto
Copy link
Collaborator

duianto commented May 23, 2017

I'm unable to reproduce the "Selecting deleted buffer" issue with ranger. The steps above, seems to have been related to another ranger issue, where the middle column, didn't show any text for files and some folders. That issue was fixed a couple of days ago.

@duianto
Copy link
Collaborator

duianto commented Jun 4, 2017

Maybe this could be helpful:

It seems most likely that you've captured the buffer object for the original (and now deleted) buffer, and have passed that object to with-current-buffer, rather than the object for the new buffer. – phils Jun 27 '14 at 5:52

https://stackoverflow.com/questions/24443236/selecting-deleted-buffer-error-in-elisp?rq=1#comment37825323_24443236

@hendrikcech
Copy link

I encountered this bug for the first time a few days ago. Mostly happens when working in org-mode, but can't nail it down any further yet. I can confirm that running org-agenda-file-to-front is enough to trigger this behavior. I'm on the develop branch, using Emacs 25.1 on OS X 10.11.6 if that helps.

Has anyone found a workaround that isn't "restart emacs"?

@jb55

This comment was marked as duplicate.

@jb55
Copy link
Contributor

jb55 commented Oct 9, 2017

This reproduces it for me every time:

  1. Start Spacemacs
  2. SPC : customize-variable
  3. org-adapt-indentation
  4. Set to off
  5. Click Apply and Save

@wizmer
Copy link
Contributor

wizmer commented Nov 30, 2017

Any call to customize-variable followed by Apply and Save triggers the bug for me.

@jb55

This comment was marked as duplicate.

@tekacs
Copy link
Contributor

tekacs commented Dec 1, 2017

This occurs for me if I open a multi-term and kill the buffer (with SPC b d). The only way I can close multi-terms is by sending an EOF to the terminal, which isn't feasible if the application in the terminal has crashed or is spewing a lot of output, for example (but this fails even if the shell is responding).

As above, having to kill the entire session and resurrect is... not fun. 😕

@kprav33n
Copy link

kprav33n commented Jan 4, 2018

Turning off the Spacemacs layer nlinum made my problem go away. Looks like some timer in nlinum implementation was causing this issue. By default, Spacemacs comes with nlinum-relative to enable line number support. I didn't know why I added nlinum layer. I didn't notice any functionality missing after I removed that layer from my configuration.

@jb55
Copy link
Contributor

jb55 commented Jan 5, 2018 via email

@jb55
Copy link
Contributor

jb55 commented Feb 1, 2018

I was able to fix this my moving my custom-set-variables into their own file as described here: #7891 (comment)

@PhoenixStarEclipse
Copy link

I had the same problem, and triggering it only needs moving the cursor to some space character and wait for a few seconds.

@soverton
Copy link

I get this when calling "cider-jack-in" and the command "sesman-quit" seems to fix it.

@temco
Copy link

temco commented Dec 24, 2018

I get this when calling "cider-jack-in" and the command "sesman-quit" seems to fix it.

Yes, it works. I cider-jack-in the cider-nrepl and then cider-connect to another repl, then I kill the latter buffer. When I cider-connect the latter repl again, the problem is produced. Then I new a frame, sesman-quit it, and cider-connect again, it works.

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 28, 2020
@npit
Copy link

npit commented Apr 1, 2020

I'm getting this error when invoking any agenda view.
Using the develop branch.

@duianto duianto removed the stale marked as a stale issue/pr (usually by a bot) label Apr 6, 2020
@duianto
Copy link
Collaborator

duianto commented Apr 6, 2020

Opening org agenda views under the prefix: SPC a o o

  • a Agenda for current week or day
  • t List of all TODO entries
  • n Agenda and all TODOs

works for me without any errors.

Windows 1903
#### System Info :computer:
- OS: windows-nt
- Emacs: 26.3
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. c3f13d039)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(autohotkey auto-completion command-log emacs-lisp git helm helpful html imenu-list
            (java :variables java-backend 'meghanda)
            javascript latex lsp
            (markdown :variables markdown-live-preview-engine 'vmd markdown-command "vmd")
            multiple-cursors
            (org :variables org-agenda-files
                 '("~/org/notes.org"))
            pdf python
            (shell :variables shell-default-shell 'shell shell-default-height 30 shell-default-position 'bottom)
            spell-checking
            (syntax-checking :variables syntax-checking-enable-by-default nil)
            treemacs version-control)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2

@npit If you meant something else, then could you provide some reproduction steps.
And it might help to narrow down when the issue is occurring if you include your system info.
Press SPC h d s to copy your system info to the clipboard.

@npit
Copy link

npit commented Apr 13, 2020

Currently, I'm getting the error when I invoke the GUI version of spacemacs, eg:

  • running emacsclient -c from the terminal
  • running from my program launcher in plasma KDE, with an command of emacsclient ~/path/to/file.org or emacsclient -c

On the other hand, running emacsclient ~/path/to/file.org from the terminal successfully spawns spacemacs, but in a terminal environment.

FWIW, after the *ERROR*: Selecting deleted buffer error, the messages buffer displays a warning: [persp-mode] Warning: Can not restore the window configuration, because of the error -- (error Window #<window 49 on *scratch*> too small to accommodate state)

The system info:

#### System Info :computer:
- OS: gnu/linux
- Emacs: 26.3
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 3a1bfc2a9)
- Graphic display: nil
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
‘‘‘elisp
(windows-scripts sql vimscript javascript shell-scripts dap helm html lsp search-engine git neotree
                 (auto-completion :variables auto-completion-enable-snippets-in-popup t auto-completion-enable-help-tooltip t)
                 c-c++ better-defaults emacs-lisp yaml csv themes-megapack markdown
                 (python :variables python-backend ’lsp python-lsp-server ’mspyls python-fill-column 99 python-formatter ’yapf python-format-on-save nil python-sort-imports-on-save t python-pipenv-activate t)
                 (ranger :variables ranger-cleanup-on-disable t ranger-show-literal nil ranger-show-preview t)
                 imenu-list colors
                 (colors :variables colors-enable-nyan-cat-progress-bar t)
                 org
                 (latex :variables latex-enable-auto-fill nil org-startup-indented t org-pretty-entities t latex-enable-folding t)
                 (shell :variables shell-default-height 30 shell-default-position ’bottom)
                 (spell-checking :variables spell-checking-enable-auto-dictionary t spell-checking-enable-by-default nil)
                 (languagetool :variables langtool-java-classpath "/usr/share/languagetool:/usr/share/java/languagetool/*" langtool-default-language "en-US")
                 (syntax-checking :variables syntax-checking-enable-by-default t)
                 mu4e)
‘‘‘
- System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES T\
HREADS LIBSYSTEMD LCMS2

@duianto
Copy link
Collaborator

duianto commented Apr 19, 2020

I haven't been able to reproduce the error: Selecting deleted buffer.

But I'm able to reproduce the warning (In Linux, but not in Windows):

[persp-mode] Warning: Can not restore the window configuration, because of the error -- (error Window #<window 5 on scratch> too small to accommodate state)

By first starting Spacemacs with a Gui client, then with a terminal client:

  • emacs --daemon
  • start Spacemacs with a gui: emacsclient -c
  • close the gui: SPC F d
  • start Spacemacs in a terminal: emacsclient -nw

The warning is shown for a split second in the minibuffer during startup, then it's visible in the messages buffer.

PopOS 19.10
#### System Info :computer:
- OS: gnu/linux
- Emacs: 26.3.50
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 0a7ab7873)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(auto-completion command-log emacs-lisp git helm markdown multiple-cursors
                 (org :variables org-agenda-files
                      '("~/org/notes.org"))
                 pdf python
                 (shell :variables shell-default-shell 'term shell-default-height 30 shell-default-position 'bottom)
                 spell-checking syntax-checking treemacs version-control)
```
- System configuration features: XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS

@Anton-Latukha

This comment was marked as duplicate.

@duianto
Copy link
Collaborator

duianto commented Oct 10, 2020

I have updated packages on the latest develop branch and both org agenda and magit sems to be working.

Can you:

  • Provide some reproduction steps.
  • Include your system info. Press SPC h d s to copy them to your clipboard.
Manjaro, System Info (Click to expand)
#### System Info :computer:
- OS: gnu/linux
- Emacs: 27.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. b606d82df)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(emacs-lisp git helm lsp multiple-cursors org rust spell-checking syntax-checking version-control treemacs)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
Windows 10, System Info (Click to expand)
#### System Info :computer:
- OS: windows-nt
- Emacs: 27.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. b606d82df)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
```elisp
(autohotkey emacs-lisp git helm javascript lsp multiple-cursors
            (org :variables org-agenda-files "c:/Users/username/org/notes.org")
            python rust spell-checking syntax-checking version-control treemacs)
```
- System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2 HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP

@Anton-Latukha

This comment was marked as resolved.

@mtyzz
Copy link

mtyzz commented Oct 13, 2020

Just hit this issue after:
cider-jack-in
spc-b-d to kill buffer
cider-jack-in attempt to start new repl

Running sesman-quit cleared the error for me and allowed cider-jack-in to work again.

@togakangaroo

This comment was marked as duplicate.

@dschrempf
Copy link
Contributor

I had the same problem (mostly using SPC g s for magit status). I had to delete ~/.emacs.d/elpa and ~/.emacs.d/.cache. Now it works. I also reset the environement variables using spacemacs/force-init-spacemacs-env.

@AleXoundOS
Copy link

AleXoundOS commented Nov 22, 2021

For me ~/.emacs.d deletion does not help (while keeping the same ~/.spacemacs.d). emacs version 27.2. Very annoying when having to open files 2 times with "HELM Find Files" (succeeds on the second run).

@AleXoundOS
Copy link

After upgrading to emacs 28.0.90 the issue has gone!

Repository owner deleted a comment from github-actions bot Apr 30, 2022
@bzy-debug
Copy link

experiencing this issue when using tree-sitter.
adding (global-tree-sitter-mode) to dotspacemacs/user-config triggers this issue when start up spacemacs

@lebensterben
Copy link
Collaborator

experiencing this issue when using tree-sitter.

adding (global-tree-sitter-mode) to dotspacemacs/user-config triggers this issue when start up spacemacs

@bzy-debug Cannot reproduce.

@stites
Copy link

stites commented Apr 10, 2023

@bzy-debug I saw this (just with a vanilla config) but I think this gets fixed in more recent versions of emacs

@sid-kap
Copy link
Contributor

sid-kap commented Jan 8, 2024

adding (global-tree-sitter-mode) to dotspacemacs/user-config triggers this issue when start up spacemacs

This happens to me too

@smile13241324
Copy link
Collaborator

I cannot reproduce this anymore on emacs 29.3. Please tag me if you run into this issue again on emacs 29.3 and I will have a look into this.

@smile13241324 smile13241324 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 14, 2024
@eeriemyxi
Copy link

eeriemyxi commented Nov 15, 2024

@smile13241324

I cannot reproduce this anymore on emacs 29.3. Please tag me if you run into this issue again on emacs 29.3 and I will have a look into this.

I can reproduce this on 29.4.

myxi :: ~ » emacs --version
GNU Emacs 29.4

I compiled my Emacs using this guide on Ubuntu 22.04.
This is my.spacemacs file at the moment: https://github.com/eeriemyxi/dotfiles/blob/c180f81c1a8fcdb3ecd21cff5f01229acf1a7bba/.spacemacs
I have tried logging out of my desktop, then deleting ~/.emacs.d/.cache and ~/.emacs.d/elpa but it doesn't help. If I do SPC a t r r to open Ranger then select a file and then reopen Ranger using the same shortcut it starts saying "Selecting deleted buffer" until I restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests