[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: simple useful functions
From: |
Tak Ota |
Subject: |
Re: simple useful functions |
Date: |
Fri, 29 Oct 2010 11:13:46 -0700 |
Thanks for the quick feedback.
Thu, 28 Oct 2010 20:39:38 -0700: "Stephen J. Turnbull" <address@hidden> wrote:
> 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?
I don't think you can perform M-1 M-x collect-string with an input
string of (defun \([^ ]+\)
It's handy to collect function names from source code or make a list
of image URLs from a given HTML file and so on.
Correct me if I'm wrong. To my understanding occur is like running
grep to the current buffer while collect-string is running a special
case of sed or awk to the current buffer.
> > (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 agree. That makes sense.
> 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?
You are correct. "." is better.
-Tak
- simple useful functions, Tak Ota, 2010/10/28
- simple useful functions, Stephen J. Turnbull, 2010/10/29
- Re: simple useful functions,
Tak Ota <=
- RE: simple useful functions, Drew Adams, 2010/10/29
- Re: simple useful functions, Andreas Schwab, 2010/10/29
- RE: simple useful functions, Drew Adams, 2010/10/29
- Re: simple useful functions, Andreas Schwab, 2010/10/29
- Re: simple useful functions, Chad Brown, 2010/10/29
- RE: simple useful functions, Drew Adams, 2010/10/29
- RE: simple useful functions, Stephen J. Turnbull, 2010/10/30
- Re: simple useful functions, Thierry Volpiatto, 2010/10/30
Re: simple useful functions, Andreas Schwab, 2010/10/29