Skip to main content
added 337 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

NamesDepending on your platform, names of any nonexistentnonexistent files and directories you enter aremight be ignored (not listed), or might raise an error. The former happens if you use ls-lisp.el (e.g. MS Windows). You can force the use of ls-lisp on any platform, if you like (but ls-lisp has fewer ls options), by doing this:

(setq ls-lisp-use-insert-directory-program nil)
(require 'ls-lisp)

If you use library Dired+ (dired+.el) then you can even do this interactively choose files and directories to list: just usegive dired a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Names of any nonexistent files and directories you enter are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Depending on your platform, names of any nonexistent files and directories you enter might be ignored (not listed), or might raise an error. The former happens if you use ls-lisp.el (e.g. MS Windows). You can force the use of ls-lisp on any platform, if you like (but ls-lisp has fewer ls options), by doing this:

(setq ls-lisp-use-insert-directory-program nil)
(require 'ls-lisp)

If you use library Dired+ (dired+.el) then you can interactively choose files and directories to list: just give dired a non-positive prefix argument (i.e., <= 0). You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

deleted 154 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Note that files you list need not even exist. They are listed anyway, and trying to access them from Dired visits buffers for them, just as if you had used C-x C-f. However, namesNames of any nonexistent files and directories you enter are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Note that files you list need not even exist. They are listed anyway, and trying to access them from Dired visits buffers for them, just as if you had used C-x C-f. However, names of nonexistent directories are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Names of any nonexistent files and directories you enter are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

added 49 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Note that files you list need not even exist. They are listed anyway, and trying to access them from Dired visits buffers for them, just as if you had used C-x C-f. However, names of nonexistent directories are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-negativepositive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-positivenegative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both -switches and files/dirs to list: first the ls switches and then the files/dirs to list.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Note that files you list need not even exist. They are listed anyway, and trying to access them from Dired visits buffers for them, just as if you had used C-x C-f. However, names of nonexistent directories are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-negative prefix argument with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-positive prefix arg prompts you for the ls listing switches. So a zero prefix arg prompts you for both - first the ls switches and then the files/dirs to list.)

C-h f dired tells you the answer. Just pass to dired, as the DIRNAME argument, a list that has as its car the Dired buffer name you want (any string) and as cdr the list of file names you want listed in the buffer. Generally, you want to use absolute file names. For example:

(dired (list "My Dired Buffer Name*"     ; The Dired buffer name
             "/usr/foo/file1.el"         ; First file
             "/usr/bar/toto/some-file.c" ; Second file
             "/whatever/directory/"      ; Third is a directory
             "/a/file/somewhere.zzz"))   ; Fourth

Note that files you list need not even exist. They are listed anyway, and trying to access them from Dired visits buffers for them, just as if you had used C-x C-f. However, names of nonexistent directories are ignored (not listed).

If you use library Dired+ (dired+.el) then you can even do this interactively: just use a non-positive prefix argument (i.e., <= 0) with command dired. You are then prompted repeatedly for the directories and file names you want listed. You can use file-name wildcards (i.e., * for globbing), to include the matching files and directories. Use C-g to end inputting.

In other words, instead of listing a single directory, the Dired buffer can list any number of directories and file names, which can even belong to different directory trees.

(A non-negative prefix arg (i.e., >= 0) prompts you for the ls listing switches. So a zero prefix arg prompts you for both switches and files/dirs to list: first the ls switches and then the files/dirs.)

added 569 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Loading
added 72 characters in body
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Loading
Source Link
Drew
  • 79.1k
  • 10
  • 123
  • 257
Loading