Sometimes people put files into my home directory without giving me the ownership. This Gist fixes the problem.
Dienstag, 13. September 2016
Montag, 5. September 2016
Freitag, 2. September 2016
Replace all editors with Emacs client
I have to work on a Ubuntu system having installed some text editors I would never use. Instead I like to use Emacs client, because I have Emacs always running.
Graphical desktops like Gnome are believed to be user friendly, but it took me more than a hour to replace the useless editors with Emacs client. First it is necessary to remove all existing MIME type associations. Next it is necessary to define a new application. And finally new MIME type associations have to be set. This is done in two files in the directory $HOME/.local/share/applications.
- mimeapps.list
- This file defines your own associations overriding the system defaults.
- emacsclient.desktop
- This is a newly defined application necessary to execute Emacs client.
I have cloned the already existing Emacs application to define the Emacs client application. The original Emacs application definition is stored in /usr/share/applications/emacs24.desktop. This is the application definition.
[Desktop Entry] Name=Emacs Client Type=Application Terminal=false MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; Exec=emacsclient -n %F Categories=Utility;TextEditor;Development; Comment= Keywords=editor Icon=/usr/share/icons/hicolor/scalable/apps/emacs24.svg
Now it is necessary to override the existing MIME type associations. This is done in the section "Default Applications" of the file mimeapps.list.
[Default Applications] application/x-shellscript=emacsclient.desktop text/english=emacsclient.desktop text/plain=emacsclient.desktop text/x-c++=emacsclient.desktop text/x-c++hdr=emacsclient.desktop text/x-c++src=emacsclient.desktop text/x-c=emacsclient.desktop text/x-chdr=emacsclient.desktop text/x-csrc=emacsclient.desktop text/x-java=emacsclient.desktop text/x-makefile=emacsclient.desktop text/x-moc=emacsclient.desktop text/x-pascal=emacsclient.desktop text/x-tcl=emacsclient.desktop text/x-tex=emacsclient.desktop
And next all already existing associations have to be removed. This is done in the section "Removed Associations" of the same file.
[Removed Associations] application/x-shellscript=emacs24.desktop text/english=emacs24.desktop text/plain=emacs24.desktop;gedit.desktop;leafpad.desktop text/x-c++=emacs24.desktop text/x-c++hdr=emacs24.desktop text/x-c++src=emacs24.desktop text/x-c=emacs24.desktop text/x-chdr=emacs24.desktop text/x-csrc=emacs24.desktop text/x-java=emacs24.desktop text/x-makefile=emacs24.desktop text/x-moc=emacs24.desktop text/x-pascal=emacs24.desktop text/x-tcl=emacs24.desktop text/x-tex=emacs24.desktop
The MIME type text/plain had three associations separated by semicolon. After this modifications the file manager PCManFM does not show any useless but only one useful program in the context menu.