I'm using doom Emacs in case that's relevant.
I want a key binding to go back to the most recently used buffer in the window. When I'm in that buffer and hit the key binding, it should go back to the buffer I stared out in. So hitting the key binding repeatedly should toggle between the 2 most recently used buffers.
So far I've tried several approaches from what I've found on the internet. next-buffer
and privious-buffer
both do nothing.
I've also tried this function:
(defun switch-to-previous-buffer ()
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
When I call this function, no matter what buffers I've had opened previously, it goes to the scratch buffer (Fallback buffer), and hitting it again does nothing.
I'm now looking for an alternative, I'm new to Emacs and a total noob in elisp, so a brief explanation would be appreciated.
Edit:
The function I gave as an example actually does work, the problem is in fact with doom Emacs, more specifically with org-roam. When org-roam is installed, and I open emacsclient, I don't get a dashboard, which is part of the issue. For now, I've removed org-roam, this has solved the issue.
next-buffer
andprevious-buffer
both do nothing for me. – b3nj4m1n Dec 28 '20 at 14:17