5

Pressing a in a dired buffer gives me a warning:

[...] disabled command dired-find-alternate-file.

It is disabled because new users find it confusing.

As far as I can tell, it just opens the file or folder. What is confusing about it? More generally, what criteria does Emacs use for marking commands as confusing?

7

Why is it confusing? Well, that's subjective. My guess is that it is an emacs-centric view of "all commands should open a new buffer for new content". But since the behavior of a file manager is usually to reuse the current window, in this very case, I find the default behavior more confusing.

What are the criteria? There is nothing very smart about it, just a label stamped onto the function by human developers (or users), e.g:

(put 'dired-find-file-other-buffer 'disabled t)

or (equivalently):

(disable-command 'dired-find-file-other-buffer)

You'll find more details in the relevant manual page.

  • File managers generally don't reuse the current window when you open a file that isn't a directory. Even when you open a directory, it depends. – Gilles 'SO- stop being evil' Sep 29 '14 at 13:29
  • File managers usually can not open files, can they? A notable (almost) exception is web browsers. I had to test it, but they seem to reuse the current tab when opening a file from a local directory (and if the file can be opened in the browser). For unsupported files, just like a bare file manager, they will rely on another program. The point is that they need to open a different program, hence a different window. (All this was tested on firefox, chrome, dolphin and windows explorer, beyond that, mileage may vary :) ) – T. Verron Sep 29 '14 at 13:54
7

There is nothing especially confusing about it. Any command can be confusing if you don't read its description.

As for criteria, no such general criteria have been stated explicitly, AFAIK. A judgment is made by the developers who distribute Emacs.

It is typically not so much about inherent confusion regarding what the command does or how it works as it is about confusion after the fact: confusion about what happened.

And even more importantly, whether inadvertent use of the command might cause changes that are difficult or impossible to reverse (undo).

In Dired, my guess is that the reason a is disabled by default is that someone who uses it, perhaps inadvertently, loses the current Dired state, with no warning and no confirmation required. The buffer is killed.

If you had gone to a lot of trouble to omit certain files and subdirs from the Dired display, to insert certain subdirs, to mark certain files or subdirs, to use particular ls switches, etc., then it would take some effort (and some memory) for you to restore the same Dired state. On the other hand, if the Dired state is the default state then you can simply use C-x d to visit the directory again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.