Felician Nemeth writes: > Philip Kaludercic writes: > >> The idea is to have a command that can be used to open a file or >> directory using something outside Emacs. >> >> I find this useful, but it might be that there are edge-cases that I am >> not considering that don't pop up on my system. > > Shouldn't it do something when the buffer is modified? A warning is generated by `browse-url-of-file'. >> +(defun browse-url-here (arg) > > Since browse-url-of-buffer does something similar, the name could be > more descriptive. Maybe browse-url-of-buffer-external? I like that name, used it. >> + "Open current file or directory with external tools. >> +With prefix argument ARG, open the current `default-directory' instead >> +of the buffer of the current file." > > "the file of the current buffer." Done, thanks. >> + (interactive "P") >> + (let ((browse-url-default-handlers '())) > > This is strange. There are other ways to use an external browser-kind. > Maybe you could use browse-url-secondary-browser-function, which is > "usually an external browser". The thing is if `browse-url-default-handlers' includes (browse-url--non-html-file-url-p . browse-url-emacs) then this catches all the requests and the file is always opened in Emacs. In this patch I try to only filter out these entries that would open the file in Emacs: