Set Emacs As Default File Manager In Ubuntu!

In this post, lets see how to do this


I am using Ubuntu and it has nautilus as default file manager. You might need to use some other commands based on your OS.

File Manager:

If you are in terminal, to open file manager, you need to run nautilus. If you want to open file manager in specific folder, you can run nautilus /foo/bar
When you have downloaded some files using browser, if you click Show in folder in downloads page, it will open nautilus with that specific folder.
We can also make Emacs to act as file manager in dired mode. If you run
$ emacs -q --eval '(dired "~")'
In terminal, emacs starts with a dired buffer for loggined user home directory.
Now lets write a small bash script to do the same thing.
#!/bin/bash
#!/usr/bin/bash
if [ $# -gt 0 ]; then
dirname=$1
else
dirname=$HOME
fi
emacsclient -c -eval "(dired \"$dirname\")" > /dev/null
Save this file as emacsfm in /usr/local/bin. Now you can run emacsfm in terminal which open home dired buffer or you can run emacsfm /foo/bar which will open /foo/bar dired buffer.
Now lets set, emacsfm as default file manager. For that first we need to install exo-utils.
$ sudo apt-get install exo-utils
and run it
$ exo-preferred-applications
It opens a new window like this.
Go to Utilities -> File manager, select Other and goto /usr/local/bin and select emacsfm from it.
Now if you go to browser downloads and click on show in folder, it will emacs dired.

References:


Need further help with this? Feel free to send a message.