From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: not-instantly-obvious method to get output of shell command to variable Date: Thu, 31 Jul 2014 07:54:54 +0300 Message-ID: <83tx5yruu9.fsf@gnu.org> References: <87y4vah3nv.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1406782504 20510 80.91.229.3 (31 Jul 2014 04:55:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Jul 2014 04:55:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 31 06:54:57 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XCiOH-0006tO-Oa for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Jul 2014 06:54:57 +0200 Original-Received: from localhost ([::1]:54272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCiOH-0001tA-Ej for geh-help-gnu-emacs@m.gmane.org; Thu, 31 Jul 2014 00:54:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCiO1-0001t5-K7 for help-gnu-emacs@gnu.org; Thu, 31 Jul 2014 00:54:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCiNu-000560-Nu for help-gnu-emacs@gnu.org; Thu, 31 Jul 2014 00:54:41 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:39610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCiNu-00055j-GG for help-gnu-emacs@gnu.org; Thu, 31 Jul 2014 00:54:34 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0N9K00I007HK4V00@mtaout24.012.net.il> for help-gnu-emacs@gnu.org; Thu, 31 Jul 2014 07:50:28 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N9K00F9M844MO40@mtaout24.012.net.il> for help-gnu-emacs@gnu.org; Thu, 31 Jul 2014 07:50:28 +0300 (IDT) In-reply-to: <87y4vah3nv.fsf@debian.uxu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.180 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99014 Archived-At: > From: Emanuel Berg > Date: Thu, 31 Jul 2014 00:39:48 +0200 > > Just wrote this to load the configuration files from > .emacs. > > Did spend some (pleasant) time getting the output of > the shell (zsh) command "ls" into the variable `files' > (check it out). > > Perhaps that is yet another thing to add for everyone > to use from the holster? No need to add it, see below. > (let ((files (with-temp-buffer > (call-process-shell-command > "ls ~/.emacs.d/emacs-init/**/*.elc ~/.emacs-no-bc" > nil ; no INFILE > t) ; BUFFER (t = current buffer, i.e. the temp one) > (buffer-substring (point-min) (point-max)) ))) > (dolist (f (split-string files)) (load-file f)) ) Emacs has the shell-command-to-string function to do this. No need to roll your own. We also have the find-lisp package that can recursively traverse directories, so no need to employ zsh-specific features.