unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* how to open a list of files?
@ 2009-01-05 10:58 thth
  2009-01-05 15:35 ` Tassilo Horn
  2009-01-05 16:10 ` Thierry Volpiatto
  0 siblings, 2 replies; 8+ messages in thread
From: thth @ 2009-01-05 10:58 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi,

I have a file containing pathes to several other files I want to open
(actually it is just the buffer list of a previous session saved in a file).
Opening each file by hand from this list is a bit laborious. So I wonder if
there is a way to open all files contained in a list automatically in emacs?

Cheers & Thanks for all ideas,
  Thomas
-- 
View this message in context: http://www.nabble.com/how-to-open-a-list-of-files--tp21289016p21289016.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
  2009-01-05 10:58 how to open a list of files? thth
@ 2009-01-05 15:35 ` Tassilo Horn
  2009-01-05 16:10 ` Thierry Volpiatto
  1 sibling, 0 replies; 8+ messages in thread
From: Tassilo Horn @ 2009-01-05 15:35 UTC (permalink / raw)
  To: help-gnu-emacs

thth <thomas.hartmann@uni-rostock.de> writes:

Hi Thomas,

> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a
> file).  Opening each file by hand from this list is a bit
> laborious. So I wonder if there is a way to open all files contained
> in a list automatically in emacs?

That's exactly what `desktop-save-mode' is made for.

,----[ C-h f desktop-save-mode RET ]
| desktop-save-mode is an interactive autoloaded Lisp function in `desktop.el'.
| 
| (desktop-save-mode &optional arg)
| 
| Toggle desktop saving mode.
| With numeric arg, turn desktop saving on if arg is positive, off
| otherwise.  If desktop saving is turned on, the state of Emacs is
| saved from one session to another.  See variable `desktop-save'
| and function `desktop-read' for details.
`----

And also see the info docs:

,----[ (info "(emacs)Saving Emacs Sessions") ]
| Use the desktop library to save the state of Emacs from one session to
| another.  Once you save the Emacs "desktop"--the buffers, their file
| names, major modes, buffer positions, and so on--then subsequent Emacs
| sessions reload the saved desktop.
`----

Bye,
Tassilo





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
  2009-01-05 10:58 how to open a list of files? thth
  2009-01-05 15:35 ` Tassilo Horn
@ 2009-01-05 16:10 ` Thierry Volpiatto
  1 sibling, 0 replies; 8+ messages in thread
From: Thierry Volpiatto @ 2009-01-05 16:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

thth <thomas.hartmann@uni-rostock.de> writes:

> Hi,
>
> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a file).
> Opening each file by hand from this list is a bit laborious. So I wonder if
> there is a way to open all files contained in a list automatically in emacs?
May be you can use desktop mode to save your session and restore all
your buffers.
But if you want to do that alone with a list of file name in a file, you
can do something like this:

,----
| ELISP> (defun open-all-my-files ()
|          (save-excursion
|            (find-file "file-containing-file-names")
|            (goto-char (point-min))
|            (while (not (eobp))
|              (save-excursion
|                (find-file (buffer-substring (point-at-bol)
|                                             (point-at-eol)))
|                (display-buffer (current-buffer)))
|              (forward-line))
|            (kill-buffer (current-buffer))))
`----

with a "file-containing-file-names" like:

,----
| /home/you/foo
| /home/you/bar
| /home/you/somefile
`----



-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
       [not found] <mailman.4022.1231169170.26697.help-gnu-emacs@gnu.org>
@ 2009-01-05 17:12 ` Andreas Politz
  2009-01-06  1:27   ` Chetan
  2009-01-06  1:04 ` Xah Lee
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Andreas Politz @ 2009-01-05 17:12 UTC (permalink / raw)
  To: help-gnu-emacs

thth wrote:
> Hi,
> 
> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a file).
> Opening each file by hand from this list is a bit laborious. So I wonder if
> there is a way to open all files contained in a list automatically in emacs?
> 
> Cheers & Thanks for all ideas,
>   Thomas

With already onboard functions :

M-x replace-regexp RET .+ RET \,(progn (save-match-data (find-file-noselect \&)) \&) RET

or when available

M-x shell-command-on-region RET xargs emacsclient -n RET

or a macro, approximatetly

C-x ( M-x ffap RET RET C-b RET C-n C-0 C-x e

or use a function which maps a regexp in a buffer using some function
much like the replace-regexp stuff above.  I am curious whether
such a command already exists.

Now I am out of ideas.

-ap



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
       [not found] <mailman.4022.1231169170.26697.help-gnu-emacs@gnu.org>
  2009-01-05 17:12 ` Andreas Politz
@ 2009-01-06  1:04 ` Xah Lee
  2009-01-06 14:53 ` OtherMichael
  2009-01-07  6:32 ` roodwriter
  3 siblings, 0 replies; 8+ messages in thread
From: Xah Lee @ 2009-01-06  1:04 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 5, 2:58 am, thth <thomas.hartm...@uni-rostock.de> wrote:
> Hi,
>
> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a file).
> Opening each file by hand from this list is a bit laborious. So I wonder if
> there is a way to open all files contained in a list automatically in emacs?
>
> Cheers & Thanks for all ideas,

depending on what you mean...

others has mentioned desktop mode...

if you want to open a bunch of marked files in dired, put

(require 'dired-x)

in your .emacs then you can
Alt+x dired-x and dired-do-find-marked-files.

If you have a list of paths, you can create this text

(find-file "path1")
(find-file "path2")
...

then select them then Alt+x eval-region.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
  2009-01-05 17:12 ` Andreas Politz
@ 2009-01-06  1:27   ` Chetan
  0 siblings, 0 replies; 8+ messages in thread
From: Chetan @ 2009-01-06  1:27 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Politz <politza@fh-trier.de> writes:

> thth wrote:
>> Hi,
>>
>> I have a file containing pathes to several other files I want to open
>> (actually it is just the buffer list of a previous session saved in a file).
>> Opening each file by hand from this list is a bit laborious. So I wonder if
>> there is a way to open all files contained in a list automatically in emacs?
>>
>> Cheers & Thanks for all ideas,
>>   Thomas
>
> With already onboard functions :
>
> M-x replace-regexp RET .+ RET \,(progn (save-match-data (find-file-noselect \&)) \&) RET
>
> or when available
>
> M-x shell-command-on-region RET xargs emacsclient -n RET
>
> or a macro, approximatetly
>
> C-x ( M-x ffap RET RET C-b RET C-n C-0 C-x e
>
> or use a function which maps a regexp in a buffer using some function
> much like the replace-regexp stuff above.  I am curious whether
> such a command already exists.
>
> Now I am out of ideas.
>
> -ap

There is also find-file-at-point (ffap) and
apply-macro-to-region-lines.

Chetan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
       [not found] <mailman.4022.1231169170.26697.help-gnu-emacs@gnu.org>
  2009-01-05 17:12 ` Andreas Politz
  2009-01-06  1:04 ` Xah Lee
@ 2009-01-06 14:53 ` OtherMichael
  2009-01-07  6:32 ` roodwriter
  3 siblings, 0 replies; 8+ messages in thread
From: OtherMichael @ 2009-01-06 14:53 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 5, 5:58 am, thth <thomas.hartm...@uni-rostock.de> wrote:
> Hi,
>
> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a file).
> Opening each file by hand from this list is a bit laborious. So I wonder if
> there is a way to open all files contained in a list automatically in emacs?
>
> Cheers & Thanks for all ideas,
>   Thomas

desktop-mode, dired+, or the file-processing function sounds like the
best best.

If you want to convert your file into a list of paths, however, you
could do something like the following:

(mapcar 'find-file '("~/.emacs" "~/site-lisp/w32-browser.el" "~/site-
lisp/twit.el" "/complete/path/to/file"))

--the Other michael


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: how to open a list of files?
       [not found] <mailman.4022.1231169170.26697.help-gnu-emacs@gnu.org>
                   ` (2 preceding siblings ...)
  2009-01-06 14:53 ` OtherMichael
@ 2009-01-07  6:32 ` roodwriter
  3 siblings, 0 replies; 8+ messages in thread
From: roodwriter @ 2009-01-07  6:32 UTC (permalink / raw)
  To: help-gnu-emacs

thth <thomas.hartmann@uni-rostock.de> writes:

> Hi,
>
> I have a file containing pathes to several other files I want to open
> (actually it is just the buffer list of a previous session saved in a file).
> Opening each file by hand from this list is a bit laborious. So I wonder if
> there is a way to open all files contained in a list automatically in emacs?
>
> Cheers & Thanks for all ideas,
>   Thomas
> -- 
> View this message in context: http://www.nabble.com/how-to-open-a-list-of-files--tp21289016p21289016.html
> Sent from the Emacs - Help mailing list archive at Nabble.com.

Several methods have been mentioned. Another suggestion
would be to use bookmarks. You could either do this manually
or include them in a macro.

Rod



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-07  6:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-05 10:58 how to open a list of files? thth
2009-01-05 15:35 ` Tassilo Horn
2009-01-05 16:10 ` Thierry Volpiatto
     [not found] <mailman.4022.1231169170.26697.help-gnu-emacs@gnu.org>
2009-01-05 17:12 ` Andreas Politz
2009-01-06  1:27   ` Chetan
2009-01-06  1:04 ` Xah Lee
2009-01-06 14:53 ` OtherMichael
2009-01-07  6:32 ` roodwriter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).