1

I want three things to happen when I start emacs:

  1. to have exotica theme mode enabled, along with
  2. having org-mode launch in scratch buffer from the beginning, and
  3. to have olivetti mode enabled too.

I can do all of them manually, but I want emacs to it for me.

Moreover, launching org-mode it looks like overrides the exotica theme, so after good few hours, I think I'm still playing cat & mouse game here...

1 Answer 1

1

Presuming you've already installed olivetti and exotica-theme, I would write a function that does steps 1, 2, and 3, and then call it towards the end of your initialization file.

(defun my/initial-layout ()
  "Create my initial screen layout."
  (interactive)
  ;; 1. to have exotica theme mode enabled, along with
  (load-theme 'exotica t)
  ;; 2. having org-mode launch in scratch buffer from the beginning, and
  (switch-to-buffer "*scratch*")
  (org-mode)
  ;; (org-indent-mode)
  ;; 3. to have olivetti mode enabled too.
  (olivetti-mode)
  ;; (delete-other-windows)
  )

(my/initial-layout)

Since it's an (interactive) function, you can M-x my/initial-layout at any time to return your screen to this state. You may have noticed that I added (org-indent-mode) and (delete-other-windows) and commented them out. It's beyond what you asked for, but I think you'll like these too. org-indent-mode makes org documents look better, and the delete-other-windows is to make sure that you're looking at the scratch buffer and nothing else.

PS: You seem new to Elisp. I recommend using M-x ielm to start an Elisp REPL while experimenting with this language. Also use C-h f and C-h v to ask Emacs for documenation on various functions and variables. emacsdocs.org is also a good place to find documentation.

3
  • 1
    In terms of ability of accurate recognising where I am in emacs and what I might need and wanted more to ask you are way better than my current second half in normal life domain. @g-gundam are you free ? :-) In terms of my question: I applied your code as advised. It looks like colour of the exotica font gets overriden by org mode (the font in initial comment is white instead of expected navy blue). Also when I comment out the '(org-mode)' line '(olivetti-mode)' takes no effect. Do you have the same effect? Oct 1, 2022 at 15:02
  • None of the weird stuff you described happens to me. To solve your problem, I started from scratch with a completely unconfigured Emacs, and the first thing I did was setup MELPA so that I could install use-package. Then, I used use-package to pull in olivetti and exotica-theme. Then I wrote the function my/initial-layout and called it. This is what my $HOME/.emacs.d/init.el looks like: gist.github.com/g-gundam/06f54e13fc41ca50dc6ad5933d4d4f04
    – g-gundam
    Oct 1, 2022 at 15:42
  • 1
    I think I get what's confusing you. The scratch buffer starts out in lisp-interaction-mode, so the 2 comment lines will be colored as if they were Elisp comments. However, when the buffer is switched to org-mode, those lines are no longer interpreted as comments and are colored as if they were plain text. I wouldn't consider that a bug.
    – g-gundam
    Oct 1, 2022 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.