* Run Shell Command on Buffer
@ 2007-01-24 21:02 super-nub
2007-01-24 21:24 ` Peter Dyballa
0 siblings, 1 reply; 14+ messages in thread
From: super-nub @ 2007-01-24 21:02 UTC (permalink / raw)
To: Help-gnu-emacs
Hi!
1) Is it possible to run `shell-command' <some command> <RET> on the current
buffer? Or is there a shortcut to the file name of the current buffer, so
that I would type e.g. `ls -l %' as a command and % is replaced by the name
of the current file?
2) `fit-window-to-buffer' is cool :) Is it possible to fit another than the
currently active window to its buffer without switching to it?
Thx!
super-nub
--
View this message in context: http://www.nabble.com/Run-Shell-Command-on-Buffer-tf3084566.html#a8572445
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-24 21:02 super-nub
@ 2007-01-24 21:24 ` Peter Dyballa
2007-01-24 23:40 ` super-nub
[not found] ` <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 14+ messages in thread
From: Peter Dyballa @ 2007-01-24 21:24 UTC (permalink / raw)
To: super-nub; +Cc: Help-gnu-emacs
Am 24.01.2007 um 22:02 schrieb super-nub:
> 1) Is it possible to run `shell-command' <some command> <RET> on
> the current
> buffer? Or is there a shortcut to the file name of the current
> buffer, so
> that I would type e.g. `ls -l %' as a command and % is replaced by
> the name
> of the current file?
Have you checked shell-command-on-region?
What do you want to achieve?
--
Greetings
Pete
’Twas a woman who drove me to drink, and I never had the courtesy
to thank her for it. — W.C. Fields
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
[not found] <mailman.3538.1169672554.2155.help-gnu-emacs@gnu.org>
@ 2007-01-24 21:58 ` Marc Tfardy
2007-01-25 0:01 ` scame
0 siblings, 1 reply; 14+ messages in thread
From: Marc Tfardy @ 2007-01-24 21:58 UTC (permalink / raw)
To: help-gnu-emacs
super-nub wrote:
> Hi!
>
> is there a shortcut to the file name of the current buffer
(buffer-file-name) ;; function
or
buffer-file-name ;; variable
regards
Marc
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-24 21:24 ` Peter Dyballa
@ 2007-01-24 23:40 ` super-nub
2007-01-25 6:47 ` reader
[not found] ` <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 14+ messages in thread
From: super-nub @ 2007-01-24 23:40 UTC (permalink / raw)
To: Help-gnu-emacs
Hi Pete,
for example I want to execute `grep' on my buffer/file to get a survey of the section headings in my document (that I keep in a special format for this purpose), e.g.:
$ egrep '^\s*-[[:upper:]]+' myfile
$ -INTRODUCTION
$ -BLA BLA
$ -BLA 2
$ -MAIN PART
$ -MISCELLANEOUS
$ -ETC BLA BLA
shell-command-on-region turned out to be a bit impractical, because I lose my current position in the document, as the cursor jumps to the beginning when running shell-command-on-region. I guess I would have to write a LISP macro to fix that...!?
Regards,
super-nub
On Wed, Jan 24, 2007 at 10:24:30PM +0100, Peter Dyballa wrote:
>
> Am 24.01.2007 um 22:02 schrieb super-nub:
>
> >1) Is it possible to run `shell-command' <some command> <RET> on
> >the current
> >buffer? Or is there a shortcut to the file name of the current
> >buffer, so
> >that I would type e.g. `ls -l %' as a command and % is replaced by
> >the name
> >of the current file?
>
> Have you checked shell-command-on-region?
>
> What do you want to achieve?
>
> --
> Greetings
>
> Pete
>
> ’Twas a woman who drove me to drink, and I never had the courtesy
> to thank her for it. — W.C. Fields
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-24 21:58 ` Marc Tfardy
@ 2007-01-25 0:01 ` scame
0 siblings, 0 replies; 14+ messages in thread
From: scame @ 2007-01-25 0:01 UTC (permalink / raw)
To: help-gnu-emacs
That looks promising... is it possible to use the variable "inside"
shell-command? I'm thinking of something like
M-x shell-command <RET>
grep 'bla' $buffer-file-name
Thx,
super-nub
On Wed, 24 Jan 2007 22:58:57 +0100, "Marc Tfardy" <m-t-o@web.de> said:
> super-nub wrote:
> > Hi!
> >
> > is there a shortcut to the file name of the current buffer
>
> (buffer-file-name) ;; function
>
> or
>
> buffer-file-name ;; variable
>
>
> regards
>
> Marc
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
[not found] ` <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>
@ 2007-01-25 2:32 ` Barry Margolin
2007-01-25 10:11 ` scame
0 siblings, 1 reply; 14+ messages in thread
From: Barry Margolin @ 2007-01-25 2:32 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>,
super-nub <scame@fastmail.fm> wrote:
> Hi Pete,
>
> for example I want to execute `grep' on my buffer/file to get a survey of the
> section headings in my document (that I keep in a special format for this
> purpose), e.g.:
>
> $ egrep '^\s*-[[:upper:]]+' myfile
> $ -INTRODUCTION
> $ -BLA BLA
> $ -BLA 2
> $ -MAIN PART
> $ -MISCELLANEOUS
> $ -ETC BLA BLA
>
> shell-command-on-region turned out to be a bit impractical, because I lose my
> current position in the document, as the cursor jumps to the beginning when
> running shell-command-on-region. I guess I would have to write a LISP macro
> to fix that...!?
The mark-whole-buffer command (C-x h) pushes a mark at the original
location. So after you run shell-command-on-region, you can use C-u
C-space C-u C-space to get back to where you were.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-24 23:40 ` super-nub
@ 2007-01-25 6:47 ` reader
2007-01-25 10:52 ` super-nub
0 siblings, 1 reply; 14+ messages in thread
From: reader @ 2007-01-25 6:47 UTC (permalink / raw)
To: help-gnu-emacs
super-nub <scame@fastmail.fm> writes:
> Hi Pete,
>
> for example I want to execute `grep' on my buffer/file to get a
> survey of the section headings in my document (that I keep in a
> special format for this purpose), e.g.:
>
> $ egrep '^\s*-[[:upper:]]+' myfile
> $ -INTRODUCTION
> $ -BLA BLA
> $ -BLA 2
> $ -MAIN PART
> $ -MISCELLANEOUS
> $ -ETC BLA BLA
It looks like `M-x occur' may be what you want. It will display all the
hits in a separate buffer.
Another nifty aspect is that you can use the hits provided as links to
jump to them in the parent buffer.
If I understood your usage M-x occur will be just the ticket.
If you like this tool... type M-x occur<spc><spc> to see other
formulations of using it.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-25 2:32 ` Barry Margolin
@ 2007-01-25 10:11 ` scame
2007-01-25 10:44 ` super-nub
0 siblings, 1 reply; 14+ messages in thread
From: scame @ 2007-01-25 10:11 UTC (permalink / raw)
To: help-gnu-emacs
Wow, "occur" totally RULES! That's even more than I wanted to achieve!
:) Thanks!
The problem how to run an arbitrary shell command on the current file --
be it via the text in the buffer or via the filename -- remains. Any
ideas on that?
On Wed, 24 Jan 2007 21:32:16 -0500, "Barry Margolin"
<barmar@alum.mit.edu> said:
> In article <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>,
> super-nub <scame@fastmail.fm> wrote:
>
> > Hi Pete,
> >
> > for example I want to execute `grep' on my buffer/file to get a survey of the
> > section headings in my document (that I keep in a special format for this
> > purpose), e.g.:
> >
> > $ egrep '^\s*-[[:upper:]]+' myfile
> > $ -INTRODUCTION
> > $ -BLA BLA
> > $ -BLA 2
> > $ -MAIN PART
> > $ -MISCELLANEOUS
> > $ -ETC BLA BLA
> >
> > shell-command-on-region turned out to be a bit impractical, because I lose my
> > current position in the document, as the cursor jumps to the beginning when
> > running shell-command-on-region. I guess I would have to write a LISP macro
> > to fix that...!?
>
> The mark-whole-buffer command (C-x h) pushes a mark at the original
> location. So after you run shell-command-on-region, you can use C-u
> C-space C-u C-space to get back to where you were.
>
> --
> Barry Margolin, barmar@alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-25 10:11 ` scame
@ 2007-01-25 10:44 ` super-nub
0 siblings, 0 replies; 14+ messages in thread
From: super-nub @ 2007-01-25 10:44 UTC (permalink / raw)
To: Help-gnu-emacs
Whoops, sorry, replied to the wrong post...
C-u C-space is also quite handy, I will try to write a macro that automates
eveything, thx!
super-nub wrote:
>
> Wow, "occur" totally RULES! That's even more than I wanted to achieve!
> :) Thanks!
> The problem how to run an arbitrary shell command on the current file --
> be it via the text in the buffer or via the filename -- remains. Any
> ideas on that?
>
> On Wed, 24 Jan 2007 21:32:16 -0500, "Barry Margolin"
> <barmar@alum.mit.edu> said:
>> In article <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>,
>> super-nub <scame@fastmail.fm> wrote:
>>
>> > Hi Pete,
>> >
>> > for example I want to execute `grep' on my buffer/file to get a survey
>> of the
>> > section headings in my document (that I keep in a special format for
>> this
>> > purpose), e.g.:
>> >
>> > $ egrep '^\s*-[[:upper:]]+' myfile
>> > $ -INTRODUCTION
>> > $ -BLA BLA
>> > $ -BLA 2
>> > $ -MAIN PART
>> > $ -MISCELLANEOUS
>> > $ -ETC BLA BLA
>> >
>> > shell-command-on-region turned out to be a bit impractical, because I
>> lose my
>> > current position in the document, as the cursor jumps to the beginning
>> when
>> > running shell-command-on-region. I guess I would have to write a LISP
>> macro
>> > to fix that...!?
>>
>> The mark-whole-buffer command (C-x h) pushes a mark at the original
>> location. So after you run shell-command-on-region, you can use C-u
>> C-space C-u C-space to get back to where you were.
>>
>> --
>> Barry Margolin, barmar@alum.mit.edu
>> Arlington, MA
>> *** PLEASE post questions in newsgroups, not directly to me ***
>> *** PLEASE don't copy me on replies, I'll read them in the group ***
>> _______________________________________________
>> help-gnu-emacs mailing list
>> help-gnu-emacs@gnu.org
>> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>
>
--
View this message in context: http://www.nabble.com/Run-Shell-Command-on-Buffer-tf3084566.html#a8599699
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
2007-01-25 6:47 ` reader
@ 2007-01-25 10:52 ` super-nub
2007-01-25 15:45 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: super-nub @ 2007-01-25 10:52 UTC (permalink / raw)
To: Help-gnu-emacs
Yes, that is exactly it, thanks very much!
reader-2 wrote:
>
> It looks like `M-x occur' may be what you want.
>
--
View this message in context: http://www.nabble.com/Run-Shell-Command-on-Buffer-tf3084566.html#a8599789
Sent from the Emacs - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: Run Shell Command on Buffer
2007-01-25 10:52 ` super-nub
@ 2007-01-25 15:45 ` Drew Adams
0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2007-01-25 15:45 UTC (permalink / raw)
To: super-nub, Help-gnu-emacs
> > It looks like `M-x occur' may be what you want.
>
> Yes, that is exactly it, thanks very much!
If you like `occur', you might also be interested in this page:
http://www.emacswiki.org/cgi-bin/wiki/OccurMode.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
[not found] <mailman.3575.1169739977.2155.help-gnu-emacs@gnu.org>
@ 2007-01-25 20:11 ` Ted Zlatanov
2007-01-25 21:04 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: Ted Zlatanov @ 2007-01-25 20:11 UTC (permalink / raw)
To: help-gnu-emacs
On 25 Jan 2007, drew.adams@oracle.com wrote:
>>> It looks like `M-x occur' may be what you want.
>>
>> Yes, that is exactly it, thanks very much!
>
> If you like `occur', you might also be interested in this page:
> http://www.emacswiki.org/cgi-bin/wiki/OccurMode.
Also, the next-error/previous-error commands, which work under
grep/occur/compilation modes, are very useful. Try them. I bind mine
to F6/F7:
(global-set-key [f6] 'next-error)
(global-set-key [f7] 'previous-error)
They will jump to the next/previous point of interest out of all the
grep/occur/compilation points of interest related to the current
buffer.
Drew: can you update the wiki with this info, or I'll do it? Also,
can you check that your replace+.el (mentioned in the Emacs wiki)
works with next/previous error?
Ted
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: Run Shell Command on Buffer
2007-01-25 20:11 ` Run Shell Command on Buffer Ted Zlatanov
@ 2007-01-25 21:04 ` Drew Adams
0 siblings, 0 replies; 14+ messages in thread
From: Drew Adams @ 2007-01-25 21:04 UTC (permalink / raw)
To: Ted Zlatanov, help-gnu-emacs
> > If you like `occur', you might also be interested in this page:
> > http://www.emacswiki.org/cgi-bin/wiki/OccurMode.
>
> Also, the next-error/previous-error commands, which work under
> grep/occur/compilation modes, are very useful. Try them. I bind mine
> to F6/F7:
>
> (global-set-key [f6] 'next-error)
> (global-set-key [f7] 'previous-error)
>
> They will jump to the next/previous point of interest out of all the
> grep/occur/compilation points of interest related to the current
> buffer.
I think that is only the case for Emacs 22.
> Drew: can you update the wiki with this info, or I'll do it?
Done.
> Also, can you check that your replace+.el (mentioned in the Emacs wiki)
> works with next/previous error?
Yes, it works.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Run Shell Command on Buffer
[not found] <mailman.3595.1169759151.2155.help-gnu-emacs@gnu.org>
@ 2007-01-26 15:57 ` Ted Zlatanov
0 siblings, 0 replies; 14+ messages in thread
From: Ted Zlatanov @ 2007-01-26 15:57 UTC (permalink / raw)
To: help-gnu-emacs
On 25 Jan 2007, drew.adams@oracle.com wrote:
>>> If you like `occur', you might also be interested in this page:
>>> http://www.emacswiki.org/cgi-bin/wiki/OccurMode.
>>
>> Also, the next-error/previous-error commands, which work under
>> grep/occur/compilation modes, are very useful. Try them. I bind mine
>> to F6/F7:
>>
>> (global-set-key [f6] 'next-error)
>> (global-set-key [f7] 'previous-error)
>>
>> They will jump to the next/previous point of interest out of all the
>> grep/occur/compilation points of interest related to the current
>> buffer.
>
> I think that is only the case for Emacs 22.
You're right, I forgot. Sorry.
Ted
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-01-26 15:57 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.3575.1169739977.2155.help-gnu-emacs@gnu.org>
2007-01-25 20:11 ` Run Shell Command on Buffer Ted Zlatanov
2007-01-25 21:04 ` Drew Adams
[not found] <mailman.3595.1169759151.2155.help-gnu-emacs@gnu.org>
2007-01-26 15:57 ` Ted Zlatanov
[not found] <mailman.3538.1169672554.2155.help-gnu-emacs@gnu.org>
2007-01-24 21:58 ` Marc Tfardy
2007-01-25 0:01 ` scame
2007-01-24 21:02 super-nub
2007-01-24 21:24 ` Peter Dyballa
2007-01-24 23:40 ` super-nub
2007-01-25 6:47 ` reader
2007-01-25 10:52 ` super-nub
2007-01-25 15:45 ` Drew Adams
[not found] ` <mailman.3545.1169683280.2155.help-gnu-emacs@gnu.org>
2007-01-25 2:32 ` Barry Margolin
2007-01-25 10:11 ` scame
2007-01-25 10:44 ` super-nub
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.