3 ms·
Dired is just one of the great examples of "everything is a buffer" benefits. It lets you do some pretty gimmicky stuff like for example, converting the textual
by iLemming 4y ago
Dired is just one of the great examples of "everything is a buffer" benefits. It lets you do some pretty gimmicky stuff like for example, converting the textual representation of a directory (the output of `ls -lR`) to a proper Dired structure you can navigate through (google 'Virtual Dired').
One of the more utilitarian examples is the use of Indirect buffers. You can, for example, create an indirect clone buffer of a file, narrow some portion of text in the original buffer, and in the cloned buffer, move the cursor to a different location. And then work with two buffers as if they're related to completely different files - narrowing, widening, selecting and deleting things. And when you save, the changes from multiple places get reflected in the same file. The total bananas about this stuff is that you can change the major mode of the indirect buffer. That for example, lets you edit comments in e.g., python code containing json snippets having highlighting, syntax checking, etc. for json, as if the underlying file is not .py, but .json.
- pama 4y agoDired is indeed a neat example. As per the linked post, one fancy thing one can do is make the buffer view of the directory editable, rewrite names for the files using the full power of Emacs editing and then dump the modified file names to disk. It is also cool that a new shell in a dired buffer starts in that directory. If the dired buffer was displaying a directory in a remote machine, then the shell starts in that directory on that machine. Just like things should be.