Skip to content

Commit e51b77a

Browse files
applebykaiwk
authored andcommitted
Fixes for leetcode-quit and leetcode--kill-buff-and-delete-window
Ensure that leetcode-quit can be run multiple times without killing random buffers unrelated to leetcode.
1 parent 7090bc6 commit e51b77a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

leetcode.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,9 @@ Call `leetcode-solve-problem' on the current problem id."
12661266

12671267
(defun leetcode--kill-buff-and-delete-window (buf)
12681268
"Kill BUF and delete its window."
1269-
(delete-windows-on buf t)
1270-
(kill-buffer buf))
1269+
(when buf
1270+
(delete-windows-on buf t)
1271+
(kill-buffer buf)))
12711272

12721273
(defun leetcode-quit ()
12731274
"Close and delete leetcode related buffers and windows."
@@ -1282,7 +1283,8 @@ Call `leetcode-solve-problem' on the current problem id."
12821283
(leetcode--kill-buff-and-delete-window (get-buffer (leetcode--detail-buffer-name problem-id)))
12831284
(leetcode--kill-buff-and-delete-window (get-buffer (leetcode--result-buffer-name problem-id)))
12841285
(leetcode--kill-buff-and-delete-window (get-buffer (leetcode--testcase-buffer-name problem-id)))))
1285-
leetcode--problem-titles))
1286+
leetcode--problem-titles)
1287+
(setq leetcode--problem-titles '()))
12861288

12871289
(defun leetcode--set-lang (snippets)
12881290
"Set `leetcode--lang' based on langSlug in SNIPPETS."

0 commit comments

Comments
 (0)