Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


support a file suffix for automatically enabling mode #140

aspiers opened this Issue · 9 comments

4 participants


It's tedious to have to manually enable the minor mode via M-x org2blog/wp-mode each time a blog post file is loaded. Better would be to support a standard filename suffix such as .o2b and then automatically enable the minor mode, e.g.

(add-to-list 'auto-mode-alist ("\\.o2b$" . org-mode))
(add-hook 'org-mode-hook
          (lambda ()
            (and (buffer-file-name)
                 (string-match "\\.o2b$" (buffer-file-name))

There's also the option of each user growing their own auto-minor-mode-alist, but I think this should favour a sensible convention over configuration.


I personally would rather have o2b work with auto-minor-mode-alist, if
only because I have a couple of hundred o2b posts that I revisit every
year, and it'd be nice to have o2b work perfetly with them as they are.

I'm not sure I follow your logic here. Whether you use the above
org-mode-hook hack, or the auto-minor-mode-alist approach, the
end result is exactly the same. The only difference is that the
latter makes it easier to automatically trigger other minor modes -
even those which have nothing to do with org-mode.

Also, both approaches would require you to rename your posts to have
an .o2b suffix, since presumably you wouldn't want the org2blog
minor mode enabled for non-o2b .org files.

I wonder if you and I are the only real users left of o2b? Would be
sad to learn that.

Me too :-/ But I very much doubt it; googling for "org2blog"
immediately reveals several users, including Sacha Chua.


Hey guys, another org2blog user here.

Personally I don't feel it's inconvenient to manually trigger org2blog/wp-mode as I spend much more time on editing blogs than typing in M-x org2blog/xxxxx. However I do agree that it would be good to have the minor mode enabled automatically.

@aspiers 's ideas are good, but instead of using a different file extension name that requires an user to remember one more thing, I'd recommend inserting a line (maybe #+org2blog) at the beginning of a org2blog file to distinguish it from ordinary org files.


#+org2blog sounds like a good suggestion to me too.


@aspiers @titaniumbones

Actually, an easier solution could be:

(setq org2blog/wp-buffer-template
      (concat "#+-*- mode: org; eval: (org2blog/wp-mode 1); -*-\n" org2blog/wp-buffer-template))

By evaluating the above sexp, the first line of a newly created org2blog entry would be #+-*- mode: org; eval: (org2blog/wp-mode 1); -*- and when the file is saved and reopened, Emacs would evaluate (org2blog/wp-mode 1), which is what we want.

Could you please give it a go and let me know if there are any problems. If you are happy with it, I'll create a pull request (will modify the initial value of org2blog/wp-buffer-template in this case) against this issue.



That looks like it should work fine, but it is quite ugly to look at ;-) #+org2blog would be significantly prettier, and is presumably similarly easy to implement?


Does anyone want to take a stab at this? Or has o2b lost all its users by now? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.