From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Brent Goodrick Newsgroups: gmane.emacs.bugs Subject: bug#8684: 24.0.50; Grep mode trips up on Entering directory lines Date: Tue, 17 May 2011 08:52:12 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1305647595 5733 80.91.229.12 (17 May 2011 15:53:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 May 2011 15:53:15 +0000 (UTC) To: 8684@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 17 17:53:10 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QMMa4-0007YD-GW for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 May 2011 17:53:08 +0200 Original-Received: from localhost ([::1]:56793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMa4-0004ij-1v for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 May 2011 11:53:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40399) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMa0-0004iT-Bv for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:53:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMMZz-0007Ej-2R for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:53:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMZy-0007Ee-TB for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:53:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QMMZy-00031c-8I; Tue, 17 May 2011 11:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Brent Goodrick Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 May 2011 15:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8684 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130564754611573 (code B ref -1); Tue, 17 May 2011 15:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 May 2011 15:52:26 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMMZO-00030c-0O for submit@debbugs.gnu.org; Tue, 17 May 2011 11:52:26 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMMZM-00030Q-C6 for submit@debbugs.gnu.org; Tue, 17 May 2011 11:52:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMMZF-00076l-V7 for submit@debbugs.gnu.org; Tue, 17 May 2011 11:52:19 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:38273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMZF-00076h-TX for submit@debbugs.gnu.org; Tue, 17 May 2011 11:52:17 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMZE-0004hA-Dc for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:52:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMMZC-00076L-VQ for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:52:16 -0400 Original-Received: from mail-qy0-f169.google.com ([209.85.216.169]:40601) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMMZC-00076E-Pe for bug-gnu-emacs@gnu.org; Tue, 17 May 2011 11:52:14 -0400 Original-Received: by qyk2 with SMTP id 2so2644492qyk.0 for ; Tue, 17 May 2011 08:52:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=MbPwsuW1FwYFqDM1fBPhnYcP1+fizvrFtAyICAbat94=; b=ZEpnsuQsxrtd3zRMfOV4E0ZATNg65N+NfK3BXPbfvsOT+eZhuuJCQ3R1w+lET/UCOn tsqz0SW+lfaWt5ugwz1XKPnRuz5NLxvB3P53itsKv/+/Siq45Ai8cYBChYYKKFH5c/AA 3UEtSzMQOEkCh04dryTVpTk2saE93RF6q9boU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=JJ5OfRAN1N+JWCe1E4amjYyPZTR/ALfM2xIGlfxqqJ9b3d/rHgMlBL05kKQ9RyqwXs oIDmJpTOv00zxejYRqLSjietRrfj7nCnM7mqVvhjUCaggf1bJwY/FvitIzL9ZvzWP6Nr roK8X1srEO9+QY11b/5Ewly6PxqfTgJPg9FGs= Original-Received: by 10.229.37.7 with SMTP id v7mr559345qcd.299.1305647533231; Tue, 17 May 2011 08:52:13 -0700 (PDT) Original-Received: by 10.229.189.85 with HTTP; Tue, 17 May 2011 08:52:12 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 17 May 2011 11:53:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:46515 Archived-At: This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your report will be posted to the bug-gnu-emacs@gnu.org mailing list and the gnu.emacs.bug news group, and at http://debbugs.gnu.org. Please describe exactly what actions triggered the bug and the precise symptoms of the bug.=A0 If you can, give a recipe starting from `emacs -Q': When you are searching build logs for matches using M-x grep, and the resulting grep matches lines of the form: =A0 Entering directory `/some/bogus/directory/here' And if you then click on lines _after_ the line such as the "Entering directory" line, then you get a prompt asking about "Find this grep hit in" which is not correct grep mode like it probably is correct in compile mode. For some reason, this seems to only occur for cases where the grep buffer is saved to a file and then reloaded, but I have seen this occur in my non-"-Q" session for my own scripts I use to run grep (versus running grep directly), and I have not debugged it further than this bug I am reporting now that relies upon first saving the grep mode buffer to a file and reloading it (see below). You can reproduce this on Emacs built from scratch by following the following recipe that simulates it: 1. On Linux, cut and paste the following into a file called =A0=A0 /tmp/demo-bug.el: --- cut here --- (let* ((tmpdir (expand-file-name (make-temp-name "emacs-bug-demo-dir") temporary-file-directory)) =A0=A0=A0=A0=A0=A0 (fn1 (expand-file-name "somefile1.txt" tmpdir)) =A0=A0=A0=A0=A0=A0 (fn2 (expand-file-name "somefile2.txt" tmpdir)) =A0=A0=A0=A0=A0=A0 (saved-grep-file (expand-file-name "somegrep.txt" tmpdir= ))) =A0 (make-directory tmpdir t) =A0 (with-temp-file fn1 =A0=A0=A0 (insert "# | make[3]: Entering directory `/some/bogus/directory/h= ere'")) =A0 (with-temp-file fn2 =A0=A0=A0 (insert "This is a line that also has the Entering word on it. Click on this line in grep mode.")) =A0 ;; For debugging, just wipe out all other grep buffers from the current =A0 ;; session: =A0 (mapc (lambda (buffer) =A0=A0=A0 =A0 (with-current-buffer buffer =A0=A0=A0 =A0=A0=A0 (when (eq major-mode 'grep-mode) =A0=A0=A0 =A0=A0=A0=A0=A0 (kill-buffer buffer)))) =A0=A0=A0 (buffer-list)) =A0 ;; Force default-directory in some buffer to be that where our temporar= y files =A0 ;; reside, e.g., fn2 is good enough: =A0 (with-current-buffer (progn =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0(find-file fn2) =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0(current-buffer)) =A0=A0=A0 (grep "grep -n Entering *.txt") =A0=A0=A0 ;; Let the grep finish: =A0=A0=A0 (accept-process-output nil 1)) =A0 (with-current-buffer (get-buffer "*grep*") =A0=A0=A0 (let ((contents (buffer-string))) =A0=A0=A0=A0=A0 ;; Store the grep contents into a file (without this, the e= rror does not =A0=A0=A0=A0=A0 ;; reproduce ... I do not know why): =A0=A0=A0=A0=A0 (with-temp-file saved-grep-file =A0=A0=A0 (insert contents)) =A0=A0=A0=A0=A0 (find-file saved-grep-file) =A0=A0=A0=A0=A0 (goto-char (point-min)) =A0=A0=A0=A0=A0 (re-search-forward "Click on this line in grep mode") =A0=A0=A0=A0=A0 (call-interactively 'compile-goto-error)))) --- cut here --- 2. Execute the above file via this command: =A0=A0 emacs -Q -l /tmp/demo-bug.el: Notice that I call `compile-goto-error' interactively above to simulate what you would do if you hit the RETurn key on that line. You should expect to see a prompt for "Find this grep hit in" versus what it should do which is drive straight to that line that contains the "Click on this line in grep mode" string shown. Theory of cause: I conjecture that the fault lies in the fact that grep mode needs to define a variable called `grep-directory-matcher' that is the analog of `compilation-directory-matcher' which is deployed as a buffer local variable when the grep mode is defined with its call to `define-compilation-mode'. I have proved this by my hackaround this bug that I have in place right now, which is this in my .emacs: ;; Require grep mode first (require 'grep) ;; Hack in our definition of grep-directory-matcher and force grep mode to ;; use it. We have to do this after the above require of grep: (defvar grep-directory-matcher nil) (let* ((base (find-lisp-object-file-name 'grep (symbol-function 'grep))) =A0=A0=A0=A0=A0=A0 (grep-defining-elisp-file =A0=A0=A0 (car =A0=A0=A0 =A0(remove-if-not (lambda (fn) =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0 (file-exists-p fn)) =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 (list base =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (concat base ".gz")))))) =A0 (unless grep-defining-elisp-file =A0=A0=A0 (error "ASSERTION FAILED: Could not find grep defining file in order to hack it")) =A0 ;; Force the file to load which forces another evaluation of the call t= o =A0 ;; define-compilation-mode from within that file. This is the only way = I could =A0 ;; figure out how to hack around this problem other than globally setti= ng =A0 ;; compilation-directory-matcher to nil which is not right for all comp= ilation =A0 ;; mode buffers in general: =A0 (load grep-defining-elisp-file)) Thanks, bgoodr If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: =A0=A0=A0 `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /home/brentg/install/Linux.x86_64/share/emacs/24.0.50/etc/DEBUG. In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1) =A0of 2011-01-15 on hungover Windowing system distributor `The X.Org Foundation', version 11.0.10707000 configured using `configure=A0 '--with-x-toolkit' '--with-xft' '--prefix=3D/home/brentg/install/Linux.x86_64'' Important settings: =A0 value of $LC_ALL: nil =A0 value of $LC_COLLATE: nil =A0 value of $LC_CTYPE: nil =A0 value of $LC_MESSAGES: nil =A0 value of $LC_MONETARY: nil =A0 value of $LC_NUMERIC: nil =A0 value of $LC_TIME: nil =A0 value of $LANG: en_US.UTF-8 =A0 value of $XMODIFIERS: nil =A0 locale-coding-system: utf-8-unix =A0 default enable-multibyte-characters: t Major mode: Grep Minor modes in effect: =A0 tooltip-mode: t =A0 mouse-wheel-mode: t =A0 tool-bar-mode: t =A0 menu-bar-mode: t =A0 file-name-shadow-mode: t =A0 global-font-lock-mode: t =A0 font-lock-mode: t =A0 blink-cursor-mode: t =A0 auto-composition-mode: t =A0 auto-encryption-mode: t =A0 auto-compression-mode: t =A0 line-number-mode: t =A0 transient-mark-mode: t Recent input: C-g M-x r e p o r t - e m a Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Grep finished (matches found) Mark set Quit Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr message sendmail rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug grep compile comint regexp-opt ring tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)