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

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

Re: "source" shell commands


From: David Kastrup
Subject: Re: "source" shell commands
Date: Sat, 24 Mar 2007 15:35:22 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

Tassilo Horn <tassilo@member.fsf.org> writes:

> Matthew Flaschen <matthew.flaschen@gatech.edu> writes:
>
>> Is there an elisp function to "source" a shell file; i.e. an
>> alternative to:
>>
>> (shell-command (concat "source \"" (expand-file-name "~/.rc") "\""))
>
> Sure.
>
> --8<---------------cut here---------------start------------->8---
> (defun mf-source (file)
>   (interactive "f")
>   (shell-command (concat "source \"" file "\"")))
> --8<---------------cut here---------------end--------------->8---

Quoting is always good for trouble.  I'd rather use

(defun mf-source (file)
  (interactive "f")
  (call-process shell-file-name nil nil nil "source" file))

assuming that you don't care about the output.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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