* Compilation buffer
@ 2010-11-24 23:17 Andrea Crotti
2010-11-24 23:32 ` Burton Samograd
2010-11-25 14:34 ` Thien-Thi Nguyen
0 siblings, 2 replies; 10+ messages in thread
From: Andrea Crotti @ 2010-11-24 23:17 UTC (permalink / raw)
To: help-gnu-emacs
I stole this nice trick somewhere
--8<---------------cut here---------------start------------->8---
(defun kill-compile-buffer-if-successful (buffer string)
(if (string-match "finished" string)
(run-with-timer 1 nil
'kill-buffer
buffer)))
(add-hook 'compilation-finish-functions 'kill-compile-buffer-if-successful)
--8<---------------cut here---------------end--------------->8---
And actually it's very nice, in short if the compilation succeeds the
buffer is killed, but there are two small problems:
- not just "compile" uses compilation mode, for example grep also does
but then the buffer disappears too soon.
Is there a way to distiguish between those different things?
- I would also like to see warnings if there are, so the "finished"
maybe it's not enough, here now other ways that just doing
"string-matching" right?
Another thing it would be nice is a way to jump, from everywhere, to the
next error/warning.
Now I have to
- go to the compilation buffer
- go to the next error
- press Enter
Is there some function already to automate it or should I create a macro/function?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-24 23:17 Compilation buffer Andrea Crotti
@ 2010-11-24 23:32 ` Burton Samograd
2010-11-25 7:12 ` Deniz Dogan
2010-11-25 14:34 ` Thien-Thi Nguyen
1 sibling, 1 reply; 10+ messages in thread
From: Burton Samograd @ 2010-11-24 23:32 UTC (permalink / raw)
To: help-gnu-emacs
Andrea Crotti <andrea.crotti.0@gmail.com> writes:
> Another thing it would be nice is a way to jump, from everywhere, to the
> next error/warning.
>
> Now I have to
> - go to the compilation buffer
> - go to the next error
> - press Enter
>
> Is there some function already to automate it or should I create a macro/function?
C-x `
This is bound to 'next-error'. There is also 'previous-error' but I'm
not sure what that is bound to.
--
Burton Samograd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-24 23:32 ` Burton Samograd
@ 2010-11-25 7:12 ` Deniz Dogan
0 siblings, 0 replies; 10+ messages in thread
From: Deniz Dogan @ 2010-11-25 7:12 UTC (permalink / raw)
To: Burton Samograd; +Cc: help-gnu-emacs
2010/11/25 Burton Samograd <burton@userful.com>:
> Andrea Crotti <andrea.crotti.0@gmail.com> writes:
>
>> Another thing it would be nice is a way to jump, from everywhere, to the
>> next error/warning.
>>
>> Now I have to
>> - go to the compilation buffer
>> - go to the next error
>> - press Enter
>>
>> Is there some function already to automate it or should I create a macro/function?
>
> C-x `
>
> This is bound to 'next-error'. There is also 'previous-error' but I'm
> not sure what that is bound to.
>
It's easier to remember with M-g M-n and M-g M-p. previous-error is
only bound to M-g p and M-g M-p.
To find out what keys a command is bound to, do e.g. C-h f previous-error.
--
Deniz Dogan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-24 23:17 Compilation buffer Andrea Crotti
2010-11-24 23:32 ` Burton Samograd
@ 2010-11-25 14:34 ` Thien-Thi Nguyen
2010-11-25 16:57 ` Andrea Crotti
1 sibling, 1 reply; 10+ messages in thread
From: Thien-Thi Nguyen @ 2010-11-25 14:34 UTC (permalink / raw)
To: help-gnu-emacs
() Andrea Crotti <andrea.crotti.0@gmail.com>
() Thu, 25 Nov 2010 00:17:00 +0100
I stole this nice trick somewhere
(defun kill-compile-buffer-if-successful (buffer string)
(if (string-match "finished" string) ^
(run-with-timer 1 nil |
'kill-buffer |
buffer))) |
|
(add-hook 'compilation-finish-functions 'kill | ompile-buffer-if-successful)
|
And actually it's very nice, in short if the co | ilation succeeds the
buffer is killed, but there are two small probl | s:
|
- not just "compile" uses compilation mode, for | xample grep also does
but then the buffer disappears too soon. |
Is there a way to distiguish between those di | erent things?
|
The first arg to the function is the buffer. ------+
You can test that.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-25 14:34 ` Thien-Thi Nguyen
@ 2010-11-25 16:57 ` Andrea Crotti
2010-11-25 21:05 ` Thien-Thi Nguyen
0 siblings, 1 reply; 10+ messages in thread
From: Andrea Crotti @ 2010-11-25 16:57 UTC (permalink / raw)
To: help-gnu-emacs
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
> () Andrea Crotti <andrea.crotti.0@gmail.com>
> () Thu, 25 Nov 2010 00:17:00 +0100
>
> I stole this nice trick somewhere
>
> (defun kill-compile-buffer-if-successful (buffer string)
> (if (string-match "finished" string) ^
> (run-with-timer 1 nil |
> 'kill-buffer |
> buffer))) |
> |
> (add-hook 'compilation-finish-functions 'kill | ompile-buffer-if-successful)
> |
> And actually it's very nice, in short if the co | ilation succeeds the
> buffer is killed, but there are two small probl | s:
> |
> - not just "compile" uses compilation mode, for | xample grep also does
> but then the buffer disappears too soon. |
> Is there a way to distiguish between those di | erent things?
> |
> The first arg to the function is the buffer. ------+
> You can test that.
Ah ok thanks good, so now is
--8<---------------cut here---------------start------------->8---
(defun kill-compile-buffer-if-successful (buffer string)
" kill a compilation buffer if succeeded without warnings "
(if (and
(string-match "compilation" (buffer-name buffer))
(string-match "finished" string))
(run-with-timer 1 nil
'kill-buffer
buffer)))
--8<---------------cut here---------------end--------------->8---
I also wanted to check for "warnings", but how from a buffer do I get
easily IF there is a string in it?
I found (buffer-string) for example but I can't pass a buffer to it...
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-25 16:57 ` Andrea Crotti
@ 2010-11-25 21:05 ` Thien-Thi Nguyen
2010-11-25 23:22 ` Andrea Crotti
0 siblings, 1 reply; 10+ messages in thread
From: Thien-Thi Nguyen @ 2010-11-25 21:05 UTC (permalink / raw)
To: help-gnu-emacs
() Andrea Crotti <andrea.crotti.0@gmail.com>
() Thu, 25 Nov 2010 17:57:18 +0100
how from a buffer do I get
easily IF there is a string in it?
See ‘with-current-buffer’ and ‘search-forward’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-25 21:05 ` Thien-Thi Nguyen
@ 2010-11-25 23:22 ` Andrea Crotti
2010-11-26 6:59 ` Thien-Thi Nguyen
0 siblings, 1 reply; 10+ messages in thread
From: Andrea Crotti @ 2010-11-25 23:22 UTC (permalink / raw)
To: help-gnu-emacs
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
> () Andrea Crotti <andrea.crotti.0@gmail.com>
> () Thu, 25 Nov 2010 17:57:18 +0100
>
> how from a buffer do I get
> easily IF there is a string in it?
>
> See ‘with-current-buffer’ and ‘search-forward’.
Very nic here it is then the solution:
--8<---------------cut here---------------start------------->8---
(defun kill-compile-buffer-if-successful (buffer string)
" kill a compilation buffer if succeeded without warnings "
(if (and
(string-match "compilation" (buffer-name buffer))
(string-match "finished" string)
(not
(with-current-buffer buffer
(search-forward "warning" nil t))))
(run-with-timer 1 nil
'kill-buffer
buffer)))
--8<---------------cut here---------------end--------------->8---
The third argument in search-forward to "t" is important otherwise it
doesn't work as expected.
Now it's not the most beautiful code I've ever seen but it works pretty
well :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compilation buffer
2010-11-25 23:22 ` Andrea Crotti
@ 2010-11-26 6:59 ` Thien-Thi Nguyen
2010-11-29 4:42 ` Has anything thought of this before: having clipboard and deleted text separate Maindoor
0 siblings, 1 reply; 10+ messages in thread
From: Thien-Thi Nguyen @ 2010-11-26 6:59 UTC (permalink / raw)
To: help-gnu-emacs
() Andrea Crotti <andrea.crotti.0@gmail.com>
() Fri, 26 Nov 2010 00:22:56 +0100
Now it's not the most beautiful code I've ever seen
but it works pretty well :)
Sounds like a good start.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Has anything thought of this before: having clipboard and deleted text separate
2010-11-26 6:59 ` Thien-Thi Nguyen
@ 2010-11-29 4:42 ` Maindoor
2010-11-29 7:01 ` PJ Weisberg
0 siblings, 1 reply; 10+ messages in thread
From: Maindoor @ 2010-11-29 4:42 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I am finding this a nuisance when we copy/cut text in emacs...then do some
editing, then when we paste, the edit text is pasted rather than
the copied/cut text. Is it possible to keep it separate ?
Thanks,
Maindoor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Has anything thought of this before: having clipboard and deleted text separate
2010-11-29 4:42 ` Has anything thought of this before: having clipboard and deleted text separate Maindoor
@ 2010-11-29 7:01 ` PJ Weisberg
0 siblings, 0 replies; 10+ messages in thread
From: PJ Weisberg @ 2010-11-29 7:01 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
On Sun, Nov 28, 2010 at 8:42 PM, Maindoor <sanjeevfiles@yahoo.com> wrote:
> Hi,
>
> I am finding this a nuisance when we copy/cut text in emacs...then do some
> editing, then when we paste, the edit text is pasted rather than
> the copied/cut text. Is it possible to keep it separate ?
>
>
Not a direct answer to your question, but next time that happens, see if you
find M-y useful.
-PJ
[-- Attachment #2: Type: text/html, Size: 681 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-11-29 7:01 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-24 23:17 Compilation buffer Andrea Crotti
2010-11-24 23:32 ` Burton Samograd
2010-11-25 7:12 ` Deniz Dogan
2010-11-25 14:34 ` Thien-Thi Nguyen
2010-11-25 16:57 ` Andrea Crotti
2010-11-25 21:05 ` Thien-Thi Nguyen
2010-11-25 23:22 ` Andrea Crotti
2010-11-26 6:59 ` Thien-Thi Nguyen
2010-11-29 4:42 ` Has anything thought of this before: having clipboard and deleted text separate Maindoor
2010-11-29 7:01 ` PJ Weisberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).