Skip to content

Instantly share code, notes, and snippets.

@ivanperez-keera
Last active August 7, 2021 10:06
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ivanperez-keera/b47eb321b09005a4c440 to your computer and use it in GitHub Desktop.
Save ivanperez-keera/b47eb321b09005a4c440 to your computer and use it in GitHub Desktop.
Associate Org-mode files with emacs (on Linux)

On linux, files tend to be identified by type, not extension.

org-mode files are text files, but only a few editors support org-mode (emacs, vim, etc.)

This file can be used to associate org-mode files to a specific editor (like emacs), while using other editors for plain text files.

  • Save as /usr/share/mime/packages/org.xml;

  • Run

    $ sudo update-mime-database /usr/share/mime
    
  • If you are using Nautilus (most Ubuntu users probably are), restart it.

    $ killall nautilus
    $ nautilus -n &
    
  • Open nautilus, navigate to your file location, right click on it, select 'Open with', search for emacs, and 'Set as default'.

Created by Ivan Perez based on http://askubuntu.com/a/55684

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/emacsorgmode">
<comment>Emacs Org-mode File</comment>
<comment xml:lang="bg">Emacs Org-mode</comment>
<comment xml:lang="cs">Emacs Org-mode</comment>
<comment xml:lang="de">Emacs Org-mode</comment>
<comment xml:lang="es">Emacs Org-mode</comment>
<comment xml:lang="eu">Emacs Org-mode</comment>
<comment xml:lang="hu">Emacs Org-mode</comment>
<comment xml:lang="it">Emacs Org-mode</comment>
<comment xml:lang="ko">Emacs Org-mode</comment>
<comment xml:lang="nb">Emacs Org-mode</comment>
<comment xml:lang="nl">Emacs Org-mode</comment>
<comment xml:lang="nn">Emacs Org-mode</comment>
<comment xml:lang="sv">Emacs Org-mode</comment>
<comment xml:lang="uk">Emacs Org-mode</comment>
<comment xml:lang="vi">Emacs Org-mode</comment>
<glob pattern="*.org"/>
<alias type="application/emacsorgmode"/>
</mime-type>
</mime-info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment