I'm using the following to create a new buffer "untitled" with the keyboard map C-n
. This works fine for a new buffer but additional buffers of the same name where <num>
gets applied seem to inherit the Fundamental major mode rather than Text. Why is this?
(setq major-mode 'text-mode)
(defun new-buffer-by-name (arg)
"Creates a new buffer by name"
(generate-new-buffer arg)
(set-buffer-major-mode (get-buffer arg))
(switch-to-buffer arg))
(global-set-key (kbd "C-n")
(lambda () (interactive)
(new-buffer-by-name "untitled")))