summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
78d731e)
* .emacs.d/init.el (b/*scratch*): Rewrite to use the new
`get-scratch-buffer-create' function in emacs.git master branch if
available, otherwise use the old `startup--get-buffer-create-scratch'.
(defun b/*scratch* ()
"Switch to `*scratch*' buffer, creating it if it does not exist."
(interactive)
(defun b/*scratch* ()
"Switch to `*scratch*' buffer, creating it if it does not exist."
(interactive)
- (switch-to-buffer
- (or (get-buffer "*scratch*")
- (with-current-buffer (get-buffer-create "*scratch*")
- (set-buffer-major-mode (current-buffer))
- (current-buffer)))))
+ (let ((fun (if (functionp #'get-scratch-buffer-create)
+ #'get-scratch-buffer-create ; (version<= "29" emacs-version)
+ #'startup--get-buffer-create-scratch))) ; (version< emacs-version "29")
+ (switch-to-buffer (funcall fun))))
(global-set-key (kbd "C-c s") #'b/*scratch*)
;; ,----
(global-set-key (kbd "C-c s") #'b/*scratch*)
;; ,----