joostkremers / pandoc-mode

An Emacs minor mode for interacting with Pandoc.
https://joostkremers.github.io/pandoc-mode/
178 stars 14 forks source link

Loading local/project settings when opening a markdown file #87

Open fgiasson opened 5 years ago

fgiasson commented 5 years ago

I am not sure if there is a bug, something missing in the documentation or if I am missing something else but I am not able to read local/project settings for a file.

Here is my scenario:

  1. I have a markdown file open
  2. I enable pandoc-mode
  3. I change the output to org
  4. I specify a output file foo.org
  5. I close the buffer of the markdown file
  6. I re-open the markdown file
  7. I check the current settings, defaults are used

I tried with a project file Project.org.pandoc without any success. What is the name of the local settings file? I am getting .Foo.md.org.pandoc which seems accurate. When I open it I see a bunch of context loading and everything. But it is like if it is actually never loaded when I open my Markdown file.

I also added the settings to load pandoc-mode when I open a markdown or a org file.

joostkremers commented 5 years ago
  1. I have a markdown file open
  2. I enable pandoc-mode
  3. I change the output to org
  4. I specify a output file foo.org
  5. I close the buffer of the markdown file

You did not save the settings at this point?

  1. I re-open the markdown file
  2. I check the current settings, defaults are used

If you follow the scenario exactly as described, that is expected. Normally, if you activate pandoc-mode (either manually or through a hook), it sets the output format to native and doesn't load any settings. In order to load a settings file, you need to set the output format first. If you set the output format, pandoc-mode tries to find a settings file for that output format and load it.

If you want to load specific settings for a file as soon as you open it, you need to do two things: first. create a default settings file (first set the desired output format, then configure the Pandoc options and save a default settings file by selecting "Set current format as default" from the "Settings files" submenu). Second, add the function pandoc-load-default-settings to pandoc-mode-hook, as described in the documentation.

Perhaps the documentation could be a bit clearer...