reddit / emacs

Emacs Does Not Autoamtically Enable Org-Mode Upon File Open

rawlimerick · 2022-04-10 12:54
I have the following Emacs built `GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)` In my initialization file, I have the following: `(defun emacs-workflow-open ()` `;(interactive)` `(split-window-right)` `(other-window 1)` `(split-window-below)` `(other-window 1)` `(multi-term)` `(rename-buffer "term-run")` `(multi-term)` `(rename-buffer "term-test")` `(multi-term)` `(rename-buffer "term")` `(switch-to-buffer "term-run"))` `(add-hook 'after-init-hook #'emacs-workflow-open)` `(add-to-list 'package-archives '("org" . "`[`https://orgmode.org/elpa/`](https://orgmode.org/elpa/)`") t)` `(find-file "~/Dropbox/PLAN.org")` `(setq org-roam-v2-ack t)` `(setq org-roam-directory (file-truename "~/Dropbox/org-roam"))` `(org-roam-db-autosync-mode)` The issue is that [PLAN.org](https://PLAN.org) buffer never has the org-mode enabled, and I always have to enable it manually. How can I fix this?
Phil-Hudson · 2022-04-10 13:00
(add-to-list 'auto-mode-alist '("\\.\\(org\\)\\'" . org-mode))
rawlimerick · 2022-04-10 18:30
That didn't seem to work. Is there anything else?
Phil-Hudson · 2022-04-10 18:39
You may need to either close the buffer and re-visit your file, or call `M-x revert-buffer`. Does that do it?
rawlimerick · 2022-04-10 19:40
This is supposed to happen when I launch Emacs. I am expecting it to be open and have Org mode enabled.
SaltyMycologist8 · 2022-04-10 20:10
is the daemon running?
[deleted] · 2022-04-10 20:19
[deleted]
Phil-Hudson · 2022-04-10 21:36
And you have added the `auto-mode-alist` line to your init file, before the `find-file` line, and the buffer visiting the file is still not opening in Org mode?
7890yuiop · 2022-04-10 23:06
That is, of course, already there* as standard. They should not have to add it in their custom config. (*) Minus the redundant group.
7890yuiop · 2022-04-10 23:16
I trust that `org-roam-db-autosync-mode` isn't a major mode?
rawlimerick · 2022-04-11 05:56
Correct. I actually tried both before and after.
rawlimerick · 2022-04-11 05:57
What do you mean?
SaltyMycologist8 · 2022-04-11 05:59
you can run emacs as a daemon and create a new frame to attach to it. Im wondering if that might be the reason your chnages havent taken effect (because when you quit emacs you may have only closed the frame but the daemin is still running) How are you starting emacs? Command line, or application launcher?
Phil-Hudson · 2022-04-11 10:22
At this point, I start to suspect (not certain, just suspect) that there might be something unusual about your org file. For instance, it is possible, though it would be very strange indeed, to put a special comment in the file that instructs Emacs to use some mode other than Org. Edit: could you please post a link to a gist/pastebin/etc for each of the following: 1. the Org file and 2. the value of variable `load-path`. Thanks
rawlimerick · 2022-04-11 13:49
Application launcher from anew.
rawlimerick · 2022-04-18 10:06
What do you mean?
rawlimerick · 2022-04-18 10:06
Here is the file: [https://pastebin.com/yZjN9N6J](https://pastebin.com/yZjN9N6J) How do I obtain the variable?
7890yuiop · 2022-04-18 11:18
I'm not sure how else to phrase it. Either it is or it isn't. The name doesn't *sound* like a major mode, but if it *is* one then that's going to answer your question, as you're invoking it in your org buffer. As you're calling it without an argument, it's impossible to tell just from looking at the code -- normally one would pass an argument if it was a minor mode, so not doing so makes it *look* like it's a major mode, even if it's not.
Phil-Hudson · 2022-04-18 15:14
Nothing wrong that I can see with that file. Thanks for posting it anyway. Hmm. Baffling. As for getting the value of variable `load-path`, any of these: 1. In IELM: ``` M-x ielm RET load-path RET ``` 2. In the `*scratch*` buffer: ``` load-path C-u C-x C-e ``` 3. (Probably least useful) In the minibuffer: ``` M-: load-path RET ```