help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening a list of files in Emacs


From: CloudStrife
Subject: Re: Opening a list of files in Emacs
Date: 12 Oct 2006 08:25:48 -0700
User-agent: G2/1.0

Pascal,
Wont the following suffice?
M-x find-file-at-point <RET>
<RET>
Wont it do the same thing as your script or is your script different.
As i am new to emacs and hardly know any elisp... can u be simple in
explaining?
Cloud

On Oct 12, 7:02 am, Pascal Bourguignon <p...@informatimago.com> wrote:
> venu.na...@gmail.com writes:
> > I have a file containing a list of files (full-pathname), one per line.
> > How do I open this list of files from Emacs? Is there a elisp package
> > to do this?(defun text-file-contents (path)
>   "Returns a list of strings, the lines in the text file at path."
>   (let ((lines '()))
>     (with-temp-buffer
>       (insert-file-contents path)
>       (goto-char 0)
>       (while (< (point) (point-max))
>         (push (buffer-substring-no-properties
>                (progn (beginning-of-line) (point))
>                (progn (end-of-line)       (point))) lines)
>         (forward-line 1)))
>     (nreverse lines)))
>
> (defun find-file-of-files (filename)
>   (interactive (find-file-read-args "Find file of files: " nil))
>   (dolist (file (text-file-contents filename)) (find-file file)))
>
> Perhaps:
>
> (defun string-trim (bag string)
>   (let* ((margin (format "[%s]*" (regexp-quote bag)))
>          (trimer (format "\\`%s\\(\\(.\\|\n\\)*?\\)%s\\'" margin margin)))
>     (replace-regexp-in-string  trimer "\\1" string)))
>
> (defun find-file-of-files (filename)
>   (interactive (find-file-read-args "Find file of files: " nil))
>   (dolist (file
>           (mapcan (lambda (path)
>                     (setf path (string-trim " \t" path))
>                     (if (or (string= "" path)     ; empty lines
>                             (= ?# (aref path 0))) ; comments
>                         '()
>                         (list path)))
>                    (text-file-contents "file-of-pathnames")))
>     (find-file file)))
>
> --
> __Pascal Bourguignon__                    http://www.informatimago.com/
> The rule for today:
> Touch my tail, I shred your hand.
> New rule tomorrow.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]