Advertisement
mark-naylor-1701

buffer & window functions

Mar 23rd, 2024
1,367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.47 KB | None | 0 0
  1. ;; Window and buffer functions
  2.  
  3. (defun safe-delete-window ()
  4.   "Only delete the window if there are others in the frame."
  5.   (interactive)
  6.   (if (> (count-windows) 1)
  7.       (delete-window)))
  8.  
  9. (defun bury-buffer-close-window ()
  10.   "Bury the buffer, then close the window if it is the last one in
  11. the frame."
  12.   (interactive)
  13.   (bury-buffer)
  14.   (safe-delete-window))
  15.  
  16. (global-set-key (kbd "C-c b b") #'bury-buffer)
  17. (global-set-key (kbd "C-c b c") #'bury-buffer-close-window)
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement