emacs-devel
[Top][All Lists]
Advanced

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

simple useful functions


From: Stephen J. Turnbull
Subject: simple useful functions
Date: Fri, 29 Oct 2010 12:39:38 +0900

Tak Ota writes:
 > If you think the following two functions are universally useful please
 > consider incorporating them in simple.el or any appropriate package.
 > If not disregard.
 > 
 > -Tak
 > 
 > (defun collect-string (regexp &optional num)
 >   "Collect strings of REGEXP (or optional NUM paren) from the
 > current buffer into a collection buffer."

What does this do that M-x occur doesn't do?  Could it be added to
occur or to occur-mode?

 > (defun source (script &optional shell keep-current-directory)
 >   "Source the specified shell script.
 > Source the shell SCRIPT and import the environment into this
 > emacs.  The optional SHELL specifies the shell other than the
 > default `shell-file-name'.  When KEEP-CURRENT-DIRECTORY is nil,
 > which is the default, the current directory is temporarily
 > changed to the directory where the script resides while sourcing
 > the script."

Probably this should be in the "shell-" namespace.

I can see why the side effect of importing the environment might be
useful, but I think that should be explicit in the name.

 >     (call-process shell nil t nil "-c" (concat "source " script "; 
 > printenv"))

Isn't "." rather than "source" the portable idiom here?




reply via email to

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