Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding Emacs Dired Support #1007

Open
lajoskvcs opened this issue May 29, 2024 · 2 comments
Open

feat: Adding Emacs Dired Support #1007

lajoskvcs opened this issue May 29, 2024 · 2 comments

Comments

@lajoskvcs
Copy link

lajoskvcs commented May 29, 2024

Original issue: ogham/exa#1143

Emacs has a built in tool for viewing files/directories called Dired and GNU Coreutils has the --dired option within ls to complement that.

Man page states:

-D, --dired              generate output designed for Emacs' dired mode

And from their comments in source file it seems like this option formats the output differently for easier parsing in emacs.

Would be nice to have this baked in into exa as well.

Github mirror: https://github.com/coreutils/coreutils
ls file: https://github.com/coreutils/coreutils/blob/master/src/ls.c

@tertsdiepraam
Copy link
Contributor

tertsdiepraam commented May 31, 2024

I can give some additional context to this with my uutils hat on. --dired essentially is the same as --long, but it keeps track of the bytes at which the filenames have been written. This is then read by Emacs to allow navigating that list of files without actually parsing the output of ls (note how C-n and C-p jump to the filename).

Before adding this, I would first investigate whether there is any prior art for alternative ls-like programs that can be used from dired, because it seems written very tightly for ls including its formatting and the options it passes to ls.

In my opinion, this seems superfluous even in ls, because it's adapting to one specific program. It's very much GNU implementing a feature specifically for themselves because they wanted a shortcut for implementing dired, which they probably should have just baked into the editor. Whatever you do, don't keep track of all the written bytes by hand, that gets super messy really quickly (and I still have to refactor this in uutils 😄).

@mmarshall540
Copy link

which they probably should have just baked into the editor.

They actually did. You can use Emacs's baked-in version on systems that don't have ls. But it's slower than running the system's native ls when that's available.

Folks who want Dired's output to look more like eza should probably install nerd-icons.el and maybe some other Emacs packages to directly enhance Dired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants