开发者

Elisp for expressing directory hierarchy in plain text

开发者 https://www.devze.com 2023-02-22 10:51 出处:网络
On emacs mailing lists I\'ve seen people paste their directory hierarchy like so: -- .yas-make-grou开发者_StackOverflow社区ps

On emacs mailing lists I've seen people paste their directory hierarchy like so:

|-- .yas-make-grou开发者_StackOverflow社区ps
|-- collections
|   |-- each
|   `-- ...
|-- control structure
|   |-- forin
|   `-- ...
|-- definitions
|   `-- ...
`-- general
    `-- ...

where .yas-make-groups would be a file, and collections would be a directory, etc.

I'm guessing this is a naive question, but is there some elisp code that no one told me about that I can use for this, or some package that does this?


I don't think this is emacs or lisp, but the tree command. Have a look at http://linux.die.net/man/1/tree

The package containing this is also named tree. A visit to Google should find you a package for your favorite OS.

///BR, Jens


The tree command-line program's the right answer, but if you also use org-mode (and you should!), check out org-fstree.


Untested, quick and dirty. Piggy backs on the shell tree command

(defun tree (directory) 
  (interactive "D")
  (save-excursion
    (let ((b (get-buffer-create "*tree")))
      (switch-to-buffer b)
      (shell-command (concat "/usr/bin/tree " directory) b))))
0

精彩评论

暂无评论...
验证码 换一张
取 消