I am trying to create a function that switches to the most recent buffer in major mode `major-mode`. An [answer](https://emacs.stackexchange.com/a/35804/32089) to a related [question](https://emacs.stackexchange.com/questions/35793/quickly-switching-to-a-buffer-with-a-particular-file-name-mode) supplies a function that should require the smallest of tweaks to serve my purpose, but I can't make it work. Here is the original function in that answer:

```el
(defun switch-to-most-recent-org-buffer ()
 (interactive)
 (let (found)
 (catch 'done
 (mapc (lambda (x)
 (when (with-current-buffer x (eq major-mode 'org-mode))
 (switch-to-buffer x)
 (setq found t)
 (throw 'done nil)))
 (buffer-list))
 (unless found (message "not found")))))
```

I thought I could just replace the first and sixth lines, respectively, with
```
(defun switch-to-most-recent-buffer-in-mode (major-mode)
```
and
```
 (when (with-current-buffer x (eq major-mode major-mode))
```

Which gives me this:

```el
(defun switch-to-most-recent-buffer-in-mode (major-mode)
 (interactive)
 (let (found)
 (catch 'done
 (mapc (lambda (x)
 (when (with-current-buffer x (eq major-mode major-mode))
 (switch-to-buffer x)
 (setq found t)
 (throw 'done nil)))
 (buffer-list))
 (unless found (message "not found")))))
```

but it doesn't work: while the original function switches to my most recent org buffer, evaluating `(switch-to-most-recent-buffer-in-mode org-mode)` returns a "not found" message. It seems I am failing to grasp something very basic about Elisp, so please excuse my ignorance: I'm not a programmer and am new to Emacs.