* possible `with-current-buffer' bug
@ 2011-02-06 17:30 Le Wang
2011-02-06 19:10 ` Stephen Berman
0 siblings, 1 reply; 9+ messages in thread
From: Le Wang @ 2011-02-06 17:30 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 734 bytes --]
Hi,
Could someone follow these steps and tell me if I'm going insane?
"compilation-disable-input" seems to be set by with-current-buffer.
1. emacs -Q
2. paste into scratch:
(require 'compile)
(defun foo ()
(interactive)
(compilation-start "blahasdfasdf" 'grep-mode))
3. M-x eval-current-buffer
4. M-x foo
5. (confirm "compilation-disable-input" is nil) C-h v
compilation-disable-input
5. (instrument compilation-start and step through it) C-h f
compilation-start C-x o <tab> <return> M-x edebug-defun M-x foo
As soon as I get inside the first "(with-current-buffer () ... " form, the
value of "compilation-disable-input" changes from nil to t. I''ve seen this
with NTEmacs 23.2.1 and CVS build 20110112.
Thanks.
--
Le
[-- Attachment #2: Type: text/html, Size: 1102 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-06 17:30 possible `with-current-buffer' bug Le Wang
@ 2011-02-06 19:10 ` Stephen Berman
2011-02-07 7:26 ` Le Wang
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Berman @ 2011-02-06 19:10 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 7 Feb 2011 01:30:30 +0800 Le Wang <l26wang@gmail.com> wrote:
> Hi,
>
>
> Could someone follow these steps and tell me if I'm going insane?
> "compilation-disable-input" seems to be set by with-current-buffer.
>
> 1. emacs -Q
>
> 2. paste into scratch:
>
> (require 'compile)
>
> (defun foo ()
> (interactive)
> (compilation-start "blahasdfasdf" 'grep-mode))
>
> 3. M-x eval-current-buffer
> 4. M-x foo
> 5. (confirm "compilation-disable-input" is nil) C-h v
> compilation-disable-input
> 5. (instrument compilation-start and step through it) C-h f compilation-start
> C-x o <tab> <return> M-x edebug-defun M-x foo
>
> As soon as I get inside the first "(with-current-buffer () ... " form, the
> value of "compilation-disable-input" changes from nil to t. I''ve seen this
> with NTEmacs 23.2.1 and CVS build 20110112.
See grep.el:
(define-compilation-mode grep-mode "Grep"
"Sets `grep-last-buffer' and `compilation-window-height'."
(setq grep-last-buffer (current-buffer))
(set (make-local-variable 'tool-bar-map) grep-mode-tool-bar-map)
(set (make-local-variable 'compilation-error-face)
grep-hit-face)
(set (make-local-variable 'compilation-error-regexp-alist)
grep-regexp-alist)
(set (make-local-variable 'compilation-process-setup-function)
'grep-process-setup)
(set (make-local-variable 'compilation-disable-input) t))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Steve Berman
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-06 19:10 ` Stephen Berman
@ 2011-02-07 7:26 ` Le Wang
2011-02-07 8:44 ` Tassilo Horn
0 siblings, 1 reply; 9+ messages in thread
From: Le Wang @ 2011-02-07 7:26 UTC (permalink / raw)
To: Stephen Berman; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
So you say "with-current-buffer" actually changes the evaluation environment
to a different buffer? Outrageous! Yeah, okay, that was a brain fart.
I made xargs-grep with your help.
https://github.com/lewang/le_emacs_xargs_grep/blob/master/xargs-grep.el
> Steve Berman
>
>
>
--
Le
[-- Attachment #2: Type: text/html, Size: 791 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 7:26 ` Le Wang
@ 2011-02-07 8:44 ` Tassilo Horn
2011-02-07 9:23 ` Le Wang
0 siblings, 1 reply; 9+ messages in thread
From: Tassilo Horn @ 2011-02-07 8:44 UTC (permalink / raw)
To: help-gnu-emacs
Le Wang <l26wang@gmail.com> writes:
Hi!
> I made xargs-grep with your help.
> https://github.com/lewang/le_emacs_xargs_grep/blob/master/xargs-grep.el
Just curious, but what's the difference between xargs-grep.el and the
usual grepping commands that comes with emacs anyway (`rgrep', `lgrep',
or `grep-find')?
Bye,
Tassilo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 8:44 ` Tassilo Horn
@ 2011-02-07 9:23 ` Le Wang
2011-02-07 9:43 ` Tassilo Horn
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Le Wang @ 2011-02-07 9:23 UTC (permalink / raw)
To: Tassilo Horn; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
It lets you grep through a list of files. Files may contain space in their
names. The most important thing is concatenated length of the file names is
not a restricting factor. i.e. grep unlimited number of files.
I'm not sure what the command line length limit is for other OS, but on
Vista, it's pretty short.
On Mon, Feb 7, 2011 at 4:44 PM, Tassilo Horn <tassilo@member.fsf.org> wrote:
> Le Wang <l26wang@gmail.com> writes:
>
> Hi!
>
> > I made xargs-grep with your help.
> > https://github.com/lewang/le_emacs_xargs_grep/blob/master/xargs-grep.el
>
> Just curious, but what's the difference between xargs-grep.el and the
> usual grepping commands that comes with emacs anyway (`rgrep', `lgrep',
> or `grep-find')?
>
> Bye,
> Tassilo
>
>
>
--
Le
[-- Attachment #2: Type: text/html, Size: 1330 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 9:23 ` Le Wang
@ 2011-02-07 9:43 ` Tassilo Horn
2011-02-07 9:44 ` Thierry Volpiatto
2011-02-07 10:16 ` Eli Zaretskii
2 siblings, 0 replies; 9+ messages in thread
From: Tassilo Horn @ 2011-02-07 9:43 UTC (permalink / raw)
To: Le Wang; +Cc: help-gnu-emacs
Le Wang <l26wang@gmail.com> writes:
> It lets you grep through a list of files. Files may contain space in
> their names. The most important thing is concatenated length of the
> file names is not a restricting factor. i.e. grep unlimited number of
> files.
If `rgrep' and friends don't allow whitespaces in filenames and hit the
command line limit much earlier than your version, I'd consider it a bug
that should be reported using M-x report-emacs-bug. But since `rgrep'
uses `find' (or, on Windows, the find emulation of dired) in conjunction
with -print0, it shouldn't suffer problems with filenames with spaces or
maximum length of command lines...
> I'm not sure what the command line length limit is for other OS, but
> on Vista, it's pretty short.
On my Gentoo/GNU Linux box, it is...
--8<---------------cut here---------------start------------->8---
% getconf ARG_MAX
2097152
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 9:23 ` Le Wang
2011-02-07 9:43 ` Tassilo Horn
@ 2011-02-07 9:44 ` Thierry Volpiatto
2011-02-07 10:16 ` Eli Zaretskii
2 siblings, 0 replies; 9+ messages in thread
From: Thierry Volpiatto @ 2011-02-07 9:44 UTC (permalink / raw)
To: help-gnu-emacs
Le Wang <l26wang@gmail.com> writes:
> It lets you grep through a list of files. Files may contain space in their
> names. The most important thing is concatenated length of the file names is
> not a restricting factor. i.e. grep unlimited number of files.
>
> I'm not sure what the command line length limit is for other OS, but on
> Vista, it's pretty short.
FYI anything have a grep interface that is able to take list of files as
arguments by marking files.(you can mark files not only in
default-directory but anywhere)
--
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 9:23 ` Le Wang
2011-02-07 9:43 ` Tassilo Horn
2011-02-07 9:44 ` Thierry Volpiatto
@ 2011-02-07 10:16 ` Eli Zaretskii
2011-02-07 12:10 ` Le Wang
2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-02-07 10:16 UTC (permalink / raw)
To: Le Wang; +Cc: tassilo, help-gnu-emacs
> Date: Mon, 7 Feb 2011 17:23:09 +0800
> From: Le Wang <l26wang@gmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> I'm not sure what the command line length limit is for other OS, but on
> Vista, it's pretty short.
How short is "pretty short"? It should be 32K if we invoke commands
directly, or 8K if we do that through a Windows shell (which should
only happen if there's a pipe in the command).
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: possible `with-current-buffer' bug
2011-02-07 10:16 ` Eli Zaretskii
@ 2011-02-07 12:10 ` Le Wang
0 siblings, 0 replies; 9+ messages in thread
From: Le Wang @ 2011-02-07 12:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: tassilo, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 954 bytes --]
On Mon, Feb 7, 2011 at 6:16 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> How short is "pretty short"? It should be 32K if we invoke commands
> directly, or 8K if we do that through a Windows shell (which should
> only happen if there's a pipe in the command).
>
Actually maybe not that short. The string with all the filenames is 38k
characters. I'm not sure when exactly grep starts failing, but it takes 2
invocations of grep to process that string, so 32k sounds entirely
plausible. I'm using cygwin grep with NTEmacs with "c:\cygwin\bin\zsh.exe"
as my shell, if that's relevant.
Since I already have the list of files, doing grep this way is really fast.
I don't expect this is a use-case that comes up often for everyone, but if
anyone looks for something similar in the future, hopefully this helps.
Also, despite what I've implied, Emacs' grep family of functions have very
good support for whitespaces. Sorry about the confusion.
--
Le
[-- Attachment #2: Type: text/html, Size: 1316 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-02-07 12:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-06 17:30 possible `with-current-buffer' bug Le Wang
2011-02-06 19:10 ` Stephen Berman
2011-02-07 7:26 ` Le Wang
2011-02-07 8:44 ` Tassilo Horn
2011-02-07 9:23 ` Le Wang
2011-02-07 9:43 ` Tassilo Horn
2011-02-07 9:44 ` Thierry Volpiatto
2011-02-07 10:16 ` Eli Zaretskii
2011-02-07 12:10 ` Le Wang
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).