diff --git a/core/prelude-core.el b/core/prelude-core.el index d828e3f..3dc7d48 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -371,10 +371,9 @@ Doesn't mess with special buffers." (defun prelude-create-scratch-buffer () "Create a new scratch buffer." (interactive) - (progn - (switch-to-buffer - (get-buffer-create (generate-new-buffer-name "*scratch*"))) - (emacs-lisp-mode))) + (let ((buf (get-buffer-create (generate-new-buffer-name "*scratch*")))) + (set-buffer-major-mode buf) + (switch-to-buffer buf))) (defvar prelude-tips '("Press to open a file with external program." diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 2457c22..a0921ae 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -176,6 +176,12 @@ The body of the advice is in BODY." (when (version<= "24.4" emacs-version) (add-hook 'focus-out-hook 'prelude-auto-save-command)) +(defadvice set-buffer-major-mode (after set-major-mode activate compile) + "Set buffer major mode according to `auto-mode-alist'." + (let* ((name (buffer-name buffer)) + (mode (assoc-default name auto-mode-alist 'string-match))) + (with-current-buffer buffer (if mode (funcall mode))))) + ;; highlight the current line (global-hl-line-mode +1)