diff --git a/blog/blog-2012-08-02-0027.org b/blog/blog-2012-08-02-0027.org index 1a91be7..86a205b 100644 --- a/blog/blog-2012-08-02-0027.org +++ b/blog/blog-2012-08-02-0027.org @@ -34,15 +34,16 @@ different major modes. This is handy for messing around with some (let* ((bname (if mode (concat "*" mode "-scratch*") "*scratch*")) - (buffer (get-buffer bname))) + (buffer (get-buffer bname)) + (mode-sym (intern (concat mode "-mode")))) (unless buffer (setq buffer (generate-new-buffer bname)) (with-current-buffer buffer - (add-file-local-variable-prop-line 'mode (make-symbol mode)) - (set-auto-mode t) - (goto-char (point-max)) - (newline))) + (when (fboundp mode-sym) + (funcall mode-sym) + (goto-char (point-max)) + (newline)))) (switch-to-buffer buffer))) #+end_src @@ -71,3 +72,5 @@ Of course, this approach doesn't ensure the right major mode gets chosen, but that's really up to whomever uses it. It makes me very happy to use such an extensible editor. + +*Update:* fixed my flawed code.