From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 11:16:13 2018 Received: (at submit) by debbugs.gnu.org; 17 Feb 2018 16:16:13 +0000 Received: from localhost ([127.0.0.1]:48492 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en59o-0007od-Uj for submit@debbugs.gnu.org; Sat, 17 Feb 2018 11:16:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en59n-0007oR-K1 for submit@debbugs.gnu.org; Sat, 17 Feb 2018 11:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en59h-0005ZA-FQ for submit@debbugs.gnu.org; Sat, 17 Feb 2018 11:16:06 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47169) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1en59h-0005Yv-C0 for submit@debbugs.gnu.org; Sat, 17 Feb 2018 11:16:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en59f-0004pe-7q for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:16:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en59b-0005UL-8C for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:16:03 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:51727) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1en59a-0005SV-Uu for bug-gnu-emacs@gnu.org; Sat, 17 Feb 2018 11:15:59 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 00CBA22690 for ; Sat, 17 Feb 2018 16:16:15 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= subject:subject:to:from:from:message-id:date:date; s=dkim; t= 1518884174; x=1519748175; bh=7lBfTNWS3/B2MIJh9+d2EZA0RTd/WoSxVtx xcKovrpU=; b=rWHC909mkFuRK6EDByCY9u1F9wI8pM0DthLBAVveY9s04UL0unM Pm735czD2RE1zCVmrm5KY+UEi3LeoVwj/ZTiBgUIFKGYfSk01ndIxnlavAvXDc5w KizJuuVjxTvoS/bkuwEhf/wKIuE1eB9rg910C0qzW4rp6sAgcugyXZrE= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ruMMK_Fsdf1m for ; Sat, 17 Feb 2018 16:16:14 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 5BAC72264C for ; Sat, 17 Feb 2018 16:16:14 +0000 (UTC) Date: Sat, 17 Feb 2018 17:25:20 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: bug-gnu-emacs@gnu.org Subject: 27.0.50; allow hiding M-x grep command line X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.1 (----) The first thing you see after M-x grep is a 1382-character line like this: find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o -type f \( -iname \* -o -iname .\[\!.\]\* -o -iname ..\?\* \) -exec grep --color -nH --null -e Emacs \{\} + Could we provide an option to hide the barrage of ignored directories and files? It might also be worth adding a text button or keybinding to toggle their visibility interactively. From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 12:06:52 2018 Received: (at 30503) by debbugs.gnu.org; 17 Feb 2018 17:06:52 +0000 Received: from localhost ([127.0.0.1]:48560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en5wq-0000fo-0b for submit@debbugs.gnu.org; Sat, 17 Feb 2018 12:06:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en5wp-0000fb-00 for 30503@debbugs.gnu.org; Sat, 17 Feb 2018 12:06:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1en5we-0002kk-Tz for 30503@debbugs.gnu.org; Sat, 17 Feb 2018 12:06:45 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1en5we-0002kc-Q6; Sat, 17 Feb 2018 12:06:40 -0500 Received: from [176.228.60.248] (port=4152 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1en5we-00016R-9W; Sat, 17 Feb 2018 12:06:40 -0500 Date: Sat, 17 Feb 2018 19:06:42 +0200 Message-Id: <83o9knbl5p.fsf@gnu.org> From: Eli Zaretskii To: charles@aurox.ch (Charles A. Roelli) In-reply-to: (charles@aurox.ch) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Date: Sat, 17 Feb 2018 17:25:20 +0100 > From: charles@aurox.ch (Charles A. Roelli) > > The first thing you see after M-x grep is a 1382-character line like > this: You mean "M-x rgrep", right? From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 17 14:04:17 2018 Received: (at 30503) by debbugs.gnu.org; 17 Feb 2018 19:04:17 +0000 Received: from localhost ([127.0.0.1]:48626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en7mT-0003kA-ET for submit@debbugs.gnu.org; Sat, 17 Feb 2018 14:04:17 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:45896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1en7mQ-0003js-Vp for 30503@debbugs.gnu.org; Sat, 17 Feb 2018 14:04:16 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id A87DE22694 for <30503@debbugs.gnu.org>; Sat, 17 Feb 2018 19:04:26 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1518894265; x=1519758266; bh=H0jn9t3p1If+1 4wybNM8F+P4Y/tGogUzXx2WLyMUUbg=; b=gTJpJsiBnEuBG39vY3c1kJNQXRMxt BBG3GU49qb5nkkGTbChobG1/oGq/CY56SuosAvul8KFWxMZf5gxfvd06Yo+PALC7 WqPD+bOFgzBDj93zd7Vl6zT+mBTzNOwI4zmEUiidb0DfDdeHF8wA245r8r5iksoz 6rjNVRLELNURvc= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Lsramni3nvKN for <30503@debbugs.gnu.org>; Sat, 17 Feb 2018 19:04:25 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 533462264C; Sat, 17 Feb 2018 19:04:25 +0000 (UTC) Date: Sat, 17 Feb 2018 20:13:34 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: Eli Zaretskii In-reply-to: <83o9knbl5p.fsf@gnu.org> (message from Eli Zaretskii on Sat, 17 Feb 2018 19:06:42 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <83o9knbl5p.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) retitle 30503 allow hiding M-x rgrep/lgrep/zrgrep command line -- > You mean "M-x rgrep", right? Yes (mea culpa), and in principle "lgrep" and "zrgrep" too. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 20 16:36:14 2018 Received: (at 30503) by debbugs.gnu.org; 20 Feb 2018 21:36:14 +0000 Received: from localhost ([127.0.0.1]:53322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoFa8-00039C-0B for submit@debbugs.gnu.org; Tue, 20 Feb 2018 16:36:14 -0500 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:59995 helo=homiemail-a15.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoFa6-000391-79; Tue, 20 Feb 2018 16:36:10 -0500 Received: from homiemail-a15.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTP id B546276C06B; Tue, 20 Feb 2018 13:36:09 -0800 (PST) Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPSA id 5B94E76C069; Tue, 20 Feb 2018 13:36:08 -0800 (PST) From: Juri Linkov To: charles@aurox.ch (Charles A. Roelli) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line Organization: LINKOV.NET References: Date: Tue, 20 Feb 2018 22:54:34 +0200 In-Reply-To: (Charles A. Roelli's message of "Sat, 17 Feb 2018 17:25:20 +0100") Message-ID: <87sh9vs7p1.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain retitle 30503 allow hiding M-x rgrep/lgrep/zrgrep command line thanks > The first thing you see after M-x grep is a 1382-character line like > this: > > find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path > \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path > \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path > \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name > \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name > \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name > \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name > \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name > \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name > \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name > \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name > \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name > \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name > \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name > \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o > -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name > \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name > \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name > \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o -type > f \( -iname \* -o -iname .\[\!.\]\* -o -iname ..\?\* \) -exec > grep --color -nH --null -e Emacs \{\} + > > Could we provide an option to hide the barrage of ignored directories > and files? It might also be worth adding a text button or keybinding > to toggle their visibility interactively. Yes, this is a real problem. Even though I set truncate-lines to t, often there is a need to see grep switches at the end of the command line. So there is a patch to hide uninteresting parts under a button like is used to hide part of output by elisp-last-sexp-toggle-display. It supports rgrep, lgrep and zrgrep. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=grep-hide.patch diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 14e251e..34a9b2f 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -452,7 +452,13 @@ grep-mode-font-lock-keywords ;; "filename=linenumber=" for lines with function names in "git grep -p". ("^.+?\\([-=\0]\\)[0-9]+\\([-=]\\).*\n" (0 grep-context-face) (1 (if (eq (char-after (match-beginning 1)) ?\0) - `(face nil display ,(match-string 2)))))) + `(face nil display ,(match-string 2))))) + ;; Hide excessive part of the command from rgrep + ("^find \\(\\. -type d .*\\\\)\\)" + (1 (rgrep-command-hide))) + ;; Hide excessive part of the command from lgrep + ("^grep \\( *--exclude.*--exclude[^ ]+\\)" + (1 (rgrep-command-hide)))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -1166,6 +1173,32 @@ rgrep-default-command (shell-quote-argument ")") " -prune -o "))))) +(defun rgrep-command-hide () + (let ((map (make-sparse-keymap))) + (define-key map [down-mouse-2] 'mouse-set-point) + (define-key map [mouse-2] 'rgrep-command-show) + (define-key map "\C-m" 'rgrep-command-show) + `(face nil display "[...]" mouse-face highlight + help-echo "RET, mouse-2: toggle truncated command" + keymap ,map))) + +(defun rgrep-command-show () + (interactive) + (when (get-text-property (point) 'display) + (let ((beg (or (previous-single-property-change + (min (point-max) (1+ (point))) 'display) + (point))) + (end (or (next-single-property-change + (point) 'display) + (point))) + (inhibit-modification-hooks t) + (inhibit-read-only t) + (buffer-undo-list t) + (modified (buffer-modified-p))) + (remove-list-of-text-properties + beg end '(display help-echo mouse-face help-echo keymap)) + (set-buffer-modified-p modified)))) + ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 20 22:44:44 2018 Received: (at 30503) by debbugs.gnu.org; 21 Feb 2018 03:44:44 +0000 Received: from localhost ([127.0.0.1]:53508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoLKl-0007T6-PD for submit@debbugs.gnu.org; Tue, 20 Feb 2018 22:44:43 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoLKi-0007Sr-Gz for 30503@debbugs.gnu.org; Tue, 20 Feb 2018 22:44:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eoLKa-0005Gv-Aj for 30503@debbugs.gnu.org; Tue, 20 Feb 2018 22:44:35 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eoLKa-0005Gl-6m; Tue, 20 Feb 2018 22:44:32 -0500 Received: from [176.228.60.248] (port=4162 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eoLKZ-0006FN-OV; Tue, 20 Feb 2018 22:44:32 -0500 Date: Wed, 21 Feb 2018 05:44:44 +0200 Message-Id: <83k1v76m6r.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-reply-to: <87sh9vs7p1.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 20 Feb 2018 22:54:34 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org, charles@aurox.ch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Juri Linkov > Date: Tue, 20 Feb 2018 22:54:34 +0200 > Cc: 30503@debbugs.gnu.org > > > Could we provide an option to hide the barrage of ignored directories > > and files? It might also be worth adding a text button or keybinding > > to toggle their visibility interactively. > > Yes, this is a real problem. Even though I set truncate-lines to t, > often there is a need to see grep switches at the end of the > command line. So there is a patch to hide uninteresting parts > under a button like is used to hide part of output by > elisp-last-sexp-toggle-display. It supports rgrep, lgrep and zrgrep. Thanks, but where's the option to hide the long list? It looks like this patch changes the behavior unconditionally, and makes it strikingly different from the previous behavior. In any case, this needs to be documented in NEWS and the manual, I think. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 21 15:21:05 2018 Received: (at 30503) by debbugs.gnu.org; 21 Feb 2018 20:21:05 +0000 Received: from localhost ([127.0.0.1]:54923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoasx-00016u-1j for submit@debbugs.gnu.org; Wed, 21 Feb 2018 15:21:03 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:47868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoasu-000163-9J for 30503@debbugs.gnu.org; Wed, 21 Feb 2018 15:21:00 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 388942269F for <30503@debbugs.gnu.org>; Wed, 21 Feb 2018 20:21:16 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1519244473; x=1520108474; bh=NKXmcaLVLIfOo WypnrZ8brzOZi48/RsBZ+ZeASEtY4U=; b=BK8T6s/66E1gypdZ/3QbRoTWpyVjB kjjCBtNLlHzsromWWw9X5BROVG1tXVsgzLi4oTBXEN4ENgHkdvOPTrOWTSiDx+rY Kppt20Fnzn7Tzh32EUOpZSbRG4rNLOja/vSQ5pLwht392NlH95dP3te2W60+XSPO cdTT/pHaL4qUb0= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 6L_dSIqPr4FV for <30503@debbugs.gnu.org>; Wed, 21 Feb 2018 20:21:13 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 313AF22688; Wed, 21 Feb 2018 20:21:12 +0000 (UTC) Date: Wed, 21 Feb 2018 21:30:40 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: Juri Linkov In-reply-to: <87sh9vs7p1.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 20 Feb 2018 22:54:34 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > From: Juri Linkov > Organization: LINKOV.NET > Date: Tue, 20 Feb 2018 22:54:34 +0200 > > retitle 30503 allow hiding M-x rgrep/lgrep/zrgrep command line > thanks > > > The first thing you see after M-x grep is a 1382-character line like > > this: > > > > find . -type d \( -path \*/SCCS -o -path \*/RCS -o -path \*/CVS -o -path > > \*/MCVS -o -path \*/.src -o -path \*/.svn -o -path \*/.git -o -path > > \*/.hg -o -path \*/.bzr -o -path \*/_MTN -o -path \*/_darcs -o -path > > \*/\{arch\} \) -prune -o \! -type d \( -name .\#\* -o -name \*.o -o -name > > \*\~ -o -name \*.bin -o -name \*.lbin -o -name \*.so -o -name \*.a -o -name > > \*.ln -o -name \*.blg -o -name \*.bbl -o -name \*.elc -o -name > > \*.lof -o -name \*.glo -o -name \*.idx -o -name \*.lot -o -name > > \*.fmt -o -name \*.tfm -o -name \*.class -o -name \*.fas -o -name > > \*.lib -o -name \*.mem -o -name \*.x86f -o -name \*.sparcf -o -name > > \*.dfsl -o -name \*.pfsl -o -name \*.d64fsl -o -name \*.p64fsl -o -name > > \*.lx64fsl -o -name \*.lx32fsl -o -name \*.dx64fsl -o -name > > \*.dx32fsl -o -name \*.fx64fsl -o -name \*.fx32fsl -o -name > > \*.sx64fsl -o -name \*.sx32fsl -o -name \*.wx64fsl -o -name > > \*.wx32fsl -o -name \*.fasl -o -name \*.ufsl -o -name \*.fsl -o -name > > \*.dxl -o -name \*.lo -o -name \*.la -o -name \*.gmo -o > > -name \*.mo -o -name \*.toc -o -name \*.aux -o -name \*.cp -o -name > > \*.fn -o -name \*.ky -o -name \*.pg -o -name \*.tp -o -name \*.vr -o -name > > \*.cps -o -name \*.fns -o -name \*.kys -o -name \*.pgs -o -name > > \*.tps -o -name \*.vrs -o -name \*.pyc -o -name \*.pyo \) -prune -o -type > > f \( -iname \* -o -iname .\[\!.\]\* -o -iname ..\?\* \) -exec > > grep --color -nH --null -e Emacs \{\} + > > > > Could we provide an option to hide the barrage of ignored directories > > and files? It might also be worth adding a text button or keybinding > > to toggle their visibility interactively. > > Yes, this is a real problem. Even though I set truncate-lines to t, > often there is a need to see grep switches at the end of the > command line. So there is a patch to hide uninteresting parts > under a button like is used to hide part of output by > elisp-last-sexp-toggle-display. It supports rgrep, lgrep and zrgrep. > > > diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el > index 14e251e..34a9b2f 100644 > --- a/lisp/progmodes/grep.el > +++ b/lisp/progmodes/grep.el > @@ -452,7 +452,13 @@ grep-mode-font-lock-keywords > ;; "filename=linenumber=" for lines with function names in "git grep -p". > ("^.+?\\([-=\0]\\)[0-9]+\\([-=]\\).*\n" (0 grep-context-face) > (1 (if (eq (char-after (match-beginning 1)) ?\0) > - `(face nil display ,(match-string 2)))))) > + `(face nil display ,(match-string 2))))) > + ;; Hide excessive part of the command from rgrep > + ("^find \\(\\. -type d .*\\\\)\\)" > + (1 (rgrep-command-hide))) > + ;; Hide excessive part of the command from lgrep > + ("^grep \\( *--exclude.*--exclude[^ ]+\\)" > + (1 (rgrep-command-hide)))) > "Additional things to highlight in grep output. > This gets tacked on the end of the generated expressions.") > > @@ -1166,6 +1173,32 @@ rgrep-default-command > (shell-quote-argument ")") > " -prune -o "))))) > > +(defun rgrep-command-hide () > + (let ((map (make-sparse-keymap))) > + (define-key map [down-mouse-2] 'mouse-set-point) > + (define-key map [mouse-2] 'rgrep-command-show) > + (define-key map "\C-m" 'rgrep-command-show) > + `(face nil display "[...]" mouse-face highlight > + help-echo "RET, mouse-2: toggle truncated command" > + keymap ,map))) > + > +(defun rgrep-command-show () > + (interactive) > + (when (get-text-property (point) 'display) > + (let ((beg (or (previous-single-property-change > + (min (point-max) (1+ (point))) 'display) > + (point))) > + (end (or (next-single-property-change > + (point) 'display) > + (point))) > + (inhibit-modification-hooks t) > + (inhibit-read-only t) > + (buffer-undo-list t) > + (modified (buffer-modified-p))) > + (remove-list-of-text-properties > + beg end '(display help-echo mouse-face help-echo keymap)) > + (set-buffer-modified-p modified)))) > + > ;;;###autoload > (defun zrgrep (regexp &optional files dir confirm template) > "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. Thanks, this is a great start. I iterated on your patch, with a few changes: - Change naming to start with `grep' instead of `rgrep' (the position of the functions may still have to change within the file). - Use `with-silent-modifications'. - Provide a toggling command for hiding/showing the shortened command. What still remains to be added is the doc, a possible keybinding/menu item, and a customization variable that determines whether the hiding is done immediately for every rgrep/lgrep/rzgrep buffer. And I think there's some room for error in my change to the beg/end let-bindings in grep-toggle-shortened-command (e.g. if beg ends up being nil), so I'll fix that eventually as well. diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 14e251e..6699787 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -452,7 +452,13 @@ grep-mode-font-lock-keywords ;; "filename=linenumber=" for lines with function names in "git grep -p". ("^.+?\\([-=\0]\\)[0-9]+\\([-=]\\).*\n" (0 grep-context-face) (1 (if (eq (char-after (match-beginning 1)) ?\0) - `(face nil display ,(match-string 2)))))) + `(face nil display ,(match-string 2))))) + ;; Hide excessive part of the command from rgrep + ("^find \\(\\. -type d .*\\\\)\\)" + (1 (grep-shortened-command-properties))) + ;; Hide excessive part of the command from lgrep + ("^grep \\( *--exclude.*--exclude[^ ]+\\)" + (1 (grep-shortened-command-properties)))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -1166,6 +1172,30 @@ rgrep-default-command (shell-quote-argument ")") " -prune -o "))))) +(defun grep-shortened-command-properties () + "Return a list of text properties applied to verbose command arguments." + (let ((map (make-sparse-keymap))) + (define-key map [down-mouse-2] 'mouse-set-point) + (define-key map [mouse-2] 'grep-toggle-shortened-command) + (define-key map "\C-m" 'grep-toggle-shortened-command) + `(face nil display "[...]" mouse-face highlight + help-echo "RET, mouse-2: toggle shortened command" + keymap ,map + shortened-command t))) + +(defun grep-toggle-shortened-command () + "Toggle the display of a shortened command in `grep-mode' buffers." + (interactive) + (with-silent-modifications + (let* ((beg (next-single-property-change + (point-min) 'shortened-command)) + (end (next-single-property-change + beg 'shortened-command))) + (if (get-text-property beg 'display) + (remove-list-of-text-properties + beg end '(display help-echo mouse-face help-echo keymap)) + (add-text-properties beg end (grep-shortened-command-properties)))))) + ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 21 15:31:41 2018 Received: (at 30503) by debbugs.gnu.org; 21 Feb 2018 20:31:41 +0000 Received: from localhost ([127.0.0.1]:54929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eob3F-0001NW-FC for submit@debbugs.gnu.org; Wed, 21 Feb 2018 15:31:41 -0500 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:42300 helo=homiemail-a100.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eob3B-0001NF-RC for 30503@debbugs.gnu.org; Wed, 21 Feb 2018 15:31:38 -0500 Received: from homiemail-a100.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a100.g.dreamhost.com (Postfix) with ESMTP id D22E631A075; Wed, 21 Feb 2018 12:31:36 -0800 (PST) Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a100.g.dreamhost.com (Postfix) with ESMTPSA id 82E0C31A070; Wed, 21 Feb 2018 12:31:35 -0800 (PST) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line Organization: LINKOV.NET References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> Date: Wed, 21 Feb 2018 22:20:55 +0200 In-Reply-To: <83k1v76m6r.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Feb 2018 05:44:44 +0200") Message-ID: <87vaeq3yfc.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org, charles@aurox.ch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> > Could we provide an option to hide the barrage of ignored directorie= s >> > and files? It might also be worth adding a text button or keybindin= g >> > to toggle their visibility interactively. >> >> Yes, this is a real problem. Even though I set truncate-lines to t, >> often there is a need to see grep switches at the end of the >> command line. So there is a patch to hide uninteresting parts >> under a button like is used to hide part of output by >> elisp-last-sexp-toggle-display. It supports rgrep, lgrep and zrgrep. > > Thanks, but where's the option to hide the long list? It looks like > this patch changes the behavior unconditionally, and makes it > strikingly different from the previous behavior. Like there is the option eval-expression-print-length to disable hiding of long output from eval-last-sexp, we could add a similar option here as well. > In any case, this needs to be documented in NEWS and the manual, I > think. Changes to NEWS are added in this patch without =E2=80=9C---=E2=80=9D to = not forget to document it in the manual before the release of Emacs 27.1. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=grep-hide.2.patch Content-Transfer-Encoding: quoted-printable diff --git a/etc/NEWS b/etc/NEWS index 71569c9..0ba369e7 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -158,6 +158,13 @@ by default. =20 ** Gamegrid =20 +** grep + +*** rgrep, lgrep and zrgrep now hide part of the command line +that contains a list of ignored directories and files. +Clicking on the button with ellipsis unhides the truncated part. +This truncation can be disabled by the new option 'rgrep-command-hide'. + ** ERT =20 +++ diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 14e251e..d249c51 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -433,6 +433,26 @@ grep-mode-line-matches help-echo "Number of matches so far") "]")) =20 +(defcustom rgrep-command-hide t + "If non-nil, hide part of rgrep/lgrep/zrgrep command line. +The hidden part contains a list of ignored directories and files. +Clicking on the button-like ellipsis unhides the abbreviated part +and reveals the entire command line." + :type 'boolean + :version "27.1" + :group 'grep) + +(defvar rgrep-command-hide-properties + (let ((ellipsis (if (char-displayable-p ?=E2=80=A6) "[=E2=80=A6]" "[..= .]")) + (map (make-sparse-keymap))) + (define-key map [down-mouse-2] 'mouse-set-point) + (define-key map [mouse-2] 'rgrep-command-show) + (define-key map "\C-m" 'rgrep-command-show) + `(face nil display ,ellipsis mouse-face highlight + help-echo "RET, mouse-2: show unabbreviated command" + keymap ,map)) + "Properties of button-like ellipsis on part of rgrep command line.") + (defvar grep-mode-font-lock-keywords '(;; Command output lines. (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directo= ry\\|device or address\\)\\)$" @@ -452,7 +472,13 @@ grep-mode-font-lock-keywords ;; "filename=3Dlinenumber=3D" for lines with function names in "git= grep -p". ("^.+?\\([-=3D\0]\\)[0-9]+\\([-=3D]\\).*\n" (0 grep-context-face) (1 (if (eq (char-after (match-beginning 1)) ?\0) - `(face nil display ,(match-string 2)))))) + `(face nil display ,(match-string 2))))) + ;; Hide excessive part of rgrep command + ("^find \\(\\. -type d .*\\\\)\\)" + (1 (when rgrep-command-hide rgrep-command-hide-properties))) + ;; Hide excessive part of lgrep command + ("^grep \\( *--exclude.*--exclude[^ ]+\\)" + (1 (when rgrep-command-hide rgrep-command-hide-properties)))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") =20 @@ -1166,6 +1192,24 @@ rgrep-default-command (shell-quote-argument ")") " -prune -o "))))) =20 +(defun rgrep-command-show () + "Show the hidden part of rgrep/lgrep/zrgrep command line." + (interactive) + (when (get-text-property (point) 'display) + (let ((beg (or (previous-single-property-change + (min (point-max) (1+ (point))) 'display) + (point))) + (end (or (next-single-property-change + (point) 'display) + (point))) + (inhibit-modification-hooks t) + (inhibit-read-only t) + (buffer-undo-list t) + (modified (buffer-modified-p))) + (remove-list-of-text-properties + beg end '(display help-echo mouse-face help-echo keymap)) + (set-buffer-modified-p modified)))) + ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) "Recursively grep for REGEXP in gzipped FILES in tree rooted at DIR. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 22 02:43:10 2018 Received: (at 30503) by debbugs.gnu.org; 22 Feb 2018 07:43:10 +0000 Received: from localhost ([127.0.0.1]:55252 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eolX4-0002cK-9l for submit@debbugs.gnu.org; Thu, 22 Feb 2018 02:43:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:50206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eolX2-0002c7-NQ for 30503@debbugs.gnu.org; Thu, 22 Feb 2018 02:43:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eolWu-0005UW-Ex for 30503@debbugs.gnu.org; Thu, 22 Feb 2018 02:43:03 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eolWu-0005UB-CO; Thu, 22 Feb 2018 02:43:00 -0500 Received: from [176.228.60.248] (port=1672 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eolWt-0007ch-FO; Thu, 22 Feb 2018 02:43:00 -0500 Date: Thu, 22 Feb 2018 09:43:14 +0200 Message-Id: <83fu5t5v1p.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-reply-to: <87vaeq3yfc.fsf@mail.linkov.net> (message from Juri Linkov on Wed, 21 Feb 2018 22:20:55 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org, charles@aurox.ch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Juri Linkov > Cc: charles@aurox.ch, 30503@debbugs.gnu.org > Date: Wed, 21 Feb 2018 22:20:55 +0200 > > > In any case, this needs to be documented in NEWS and the manual, I > > think. > > Changes to NEWS are added in this patch without “---” to not forget > to document it in the manual before the release of Emacs 27.1. Thanks, but I'd prefer that we update the manual as part of this changeset. Leaving manuals outdated tends to create a very large job to be done before a pretest can be released, which I find to be sub-optimal. It also prevents users who track the development from finding possible mistakes in the manual, because they don't have enough time to d that before an official release. Would you like to make the corrections in the manual as well? From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 22 16:52:39 2018 Received: (at 30503) by debbugs.gnu.org; 22 Feb 2018 21:52:39 +0000 Received: from localhost ([127.0.0.1]:56915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoyn9-0001xA-2b for submit@debbugs.gnu.org; Thu, 22 Feb 2018 16:52:39 -0500 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:49431 helo=homiemail-a15.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eoyn6-0001x2-3l for 30503@debbugs.gnu.org; Thu, 22 Feb 2018 16:52:38 -0500 Received: from homiemail-a15.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTP id 5865B76C06B; Thu, 22 Feb 2018 13:52:35 -0800 (PST) Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a15.g.dreamhost.com (Postfix) with ESMTPSA id 449C176C065; Thu, 22 Feb 2018 13:52:34 -0800 (PST) From: Juri Linkov To: Eli Zaretskii Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line Organization: LINKOV.NET References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> Date: Thu, 22 Feb 2018 23:51:57 +0200 In-Reply-To: <83fu5t5v1p.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 22 Feb 2018 09:43:14 +0200") Message-ID: <87vaeo7w7k.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org, charles@aurox.ch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) >> > In any case, this needs to be documented in NEWS and the manual, I >> > think. >> >> Changes to NEWS are added in this patch without =E2=80=9C---=E2=80=9D = to not forget >> to document it in the manual before the release of Emacs 27.1. > > Thanks, but I'd prefer that we update the manual as part of this > changeset. Leaving manuals outdated tends to create a very large job > to be done before a pretest can be released, which I find to be > sub-optimal. It also prevents users who track the development from > finding possible mistakes in the manual, because they don't have > enough time to d that before an official release. > > Would you like to make the corrections in the manual as well? Pushed to master together with the corrections in the manual. Charles, please update your patch from master, you have many good improvements in your previous patch. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 23 01:56:42 2018 Received: (at 30503) by debbugs.gnu.org; 23 Feb 2018 06:56:42 +0000 Received: from localhost ([127.0.0.1]:57053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ep7He-0006Zb-1s for submit@debbugs.gnu.org; Fri, 23 Feb 2018 01:56:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ep7Hc-0006ZP-22 for 30503@debbugs.gnu.org; Fri, 23 Feb 2018 01:56:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ep7GS-0002TM-SW for 30503@debbugs.gnu.org; Fri, 23 Feb 2018 01:56:34 -0500 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ep7GR-0002R6-Tc; Fri, 23 Feb 2018 01:55:28 -0500 Received: from [176.228.60.248] (port=3038 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ep7GP-0000TK-CI; Fri, 23 Feb 2018 01:55:26 -0500 Date: Fri, 23 Feb 2018 08:55:43 +0200 Message-Id: <838tbk5h5c.fsf@gnu.org> From: Eli Zaretskii To: Juri Linkov In-reply-to: <87vaeo7w7k.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 22 Feb 2018 23:51:57 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> <87vaeo7w7k.fsf@mail.linkov.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30503 Cc: 30503@debbugs.gnu.org, charles@aurox.ch X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Juri Linkov > Cc: charles@aurox.ch, 30503@debbugs.gnu.org > Date: Thu, 22 Feb 2018 23:51:57 +0200 > > > Thanks, but I'd prefer that we update the manual as part of this > > changeset. Leaving manuals outdated tends to create a very large job > > to be done before a pretest can be released, which I find to be > > sub-optimal. It also prevents users who track the development from > > finding possible mistakes in the manual, because they don't have > > enough time to d that before an official release. > > > > Would you like to make the corrections in the manual as well? > > Pushed to master together with the corrections in the manual. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 25 14:40:46 2018 Received: (at 30503) by debbugs.gnu.org; 25 Feb 2018 19:40:46 +0000 Received: from localhost ([127.0.0.1]:60643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eq2A9-0008AY-GB for submit@debbugs.gnu.org; Sun, 25 Feb 2018 14:40:46 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:49827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eq2A7-0008AK-LF for 30503@debbugs.gnu.org; Sun, 25 Feb 2018 14:40:44 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 7185F226AA for <30503@debbugs.gnu.org>; Sun, 25 Feb 2018 19:41:03 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:mime-version :references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1519587661; x=1520451662; bh=guMYoyJrX9pHW vA/KnwWu8Gadfz0z0/HawDxA4a/h9E=; b=FTIoz5Ihc5n8/iE2g+cS4bXDaYOTI /AshoiWlCHfApuatmecFhY6Dl9C9MnI7gihpWGX3B5F+CFFaDDUc8Wn6j1PkKvXu Oda4FwYiTeFAzGnQVvz8m2sTXsDN/fvmfM8SPJ+rFdtvfEcnHSfStfU+E141+4XV JOm9PtRvOiKS8g= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ro3QCVo439q0 for <30503@debbugs.gnu.org>; Sun, 25 Feb 2018 19:41:01 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 6A2D722688; Sun, 25 Feb 2018 19:41:00 +0000 (UTC) Date: Sun, 25 Feb 2018 20:50:47 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: Juri Linkov In-reply-to: <87vaeo7w7k.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 22 Feb 2018 23:51:57 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> <87vaeo7w7k.fsf@mail.linkov.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30503 Cc: eliz@gnu.org, 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > From: Juri Linkov > Cc: charles@aurox.ch, 30503@debbugs.gnu.org > Organization: LINKOV.NET > Date: Thu, 22 Feb 2018 23:51:57 +0200 > > >> > In any case, this needs to be documented in NEWS and the manual, I > >> > think. > >> > >> Changes to NEWS are added in this patch without “---” to not forget > >> to document it in the manual before the release of Emacs 27.1. > > > > Thanks, but I'd prefer that we update the manual as part of this > > changeset. Leaving manuals outdated tends to create a very large job > > to be done before a pretest can be released, which I find to be > > sub-optimal. It also prevents users who track the development from > > finding possible mistakes in the manual, because they don't have > > enough time to d that before an official release. > > > > Would you like to make the corrections in the manual as well? > > Pushed to master together with the corrections in the manual. > > Charles, please update your patch from master, you have many > good improvements in your previous patch. Thanks for adding this feature. Here's the change that implements a toggling command. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 8e2fdf1..eee6329 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -435,13 +435,16 @@ Grep Searching by various version control systems. @vindex grep-find-hide +@findex grep-find-toggle-abbreviation By default, the shell commands constructed for @code{lgrep}, @code{rgrep}, and @code{zgrep} are abbreviated for display by concealing the part that contains a long list of files and directories to ignore. You can reveal the concealed part by clicking on the -button with ellipsis, which represents them. To disable this -abbreviation of the shell commands, customize the option -@code{grep-find-hide} to a @code{nil} value. +button with ellipsis, which represents them. You can also +interactively toggle viewing the concealed part by typing @kbd{M-x +grep-find-toggle-abbreviation}. To disable this abbreviation of the +shell commands, customize the option @code{grep-find-hide} to a +@code{nil} value. @node Flymake @section Finding Syntax Errors On The Fly diff --git a/etc/NEWS b/etc/NEWS index 596adf8..166b419 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -203,6 +203,8 @@ by default. that contains a list of ignored directories and files. Clicking on the button with ellipsis unhides the truncated part. This truncation can be disabled by the new option 'grep-find-hide'. +The new command 'grep-find-toggle-abbreviation' toggles the hiding +interactively. ** ERT diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 9b2c6f1..67139b4 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -437,7 +437,9 @@ grep-find-hide "If non-nil, hide part of rgrep/lgrep/zrgrep command line. The hidden part contains a list of ignored directories and files. Clicking on the button-like ellipsis unhides the abbreviated part -and reveals the entire command line." +and reveals the entire command line. The visibility of the +abbreviated part can also be toggled with +`grep-find-toggle-abbreviation'." :type 'boolean :version "27.1" :group 'grep) @@ -446,11 +448,11 @@ grep-find-hide-properties (let ((ellipsis (if (char-displayable-p ?…) "[…]" "[...]")) (map (make-sparse-keymap))) (define-key map [down-mouse-2] 'mouse-set-point) - (define-key map [mouse-2] 'grep-find-show) - (define-key map "\C-m" 'grep-find-show) + (define-key map [mouse-2] 'grep-find-toggle-abbreviation) + (define-key map "\C-m" 'grep-find-toggle-abbreviation) `(face nil display ,ellipsis mouse-face highlight help-echo "RET, mouse-2: show unabbreviated command" - keymap ,map)) + keymap ,map abbreviated-command t)) "Properties of button-like ellipsis on part of rgrep command line.") (defvar grep-mode-font-lock-keywords @@ -476,10 +478,12 @@ grep-mode-font-lock-keywords `(face nil display ,(match-string 2))))) ;; Hide excessive part of rgrep command ("^find \\(\\. -type d .*\\\\)\\)" - (1 (when grep-find-hide grep-find-hide-properties))) + (1 (if grep-find-hide grep-find-hide-properties + '(face nil abbreviated-command t)))) ;; Hide excessive part of lgrep command ("^grep \\( *--exclude.*--exclude[^ ]+\\)" - (1 (when grep-find-hide grep-find-hide-properties)))) + (1 (if grep-find-hide grep-find-hide-properties + '(face nil abbreviated-command t))))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -1195,23 +1199,19 @@ rgrep-default-command (shell-quote-argument ")") " -prune -o "))))) -(defun grep-find-show () - "Show the hidden part of rgrep/lgrep/zrgrep command line." +(defun grep-find-toggle-abbreviation () + "Toggle showing the hidden part of rgrep/lgrep/zrgrep command line." (interactive) - (when (get-text-property (point) 'display) - (let ((beg (or (previous-single-property-change - (min (point-max) (1+ (point))) 'display) - (point))) - (end (or (next-single-property-change - (point) 'display) - (point))) - (inhibit-modification-hooks t) - (inhibit-read-only t) - (buffer-undo-list t) - (modified (buffer-modified-p))) - (remove-list-of-text-properties - beg end '(display help-echo mouse-face help-echo keymap)) - (set-buffer-modified-p modified)))) + (with-silent-modifications + (let* ((beg (next-single-property-change (point-min) 'abbreviated-command)) + (end (when beg + (next-single-property-change beg 'abbreviated-command)))) + (if end + (if (get-text-property beg 'display) + (remove-list-of-text-properties + beg end '(display help-echo mouse-face help-echo keymap)) + (add-text-properties beg end grep-find-hide-properties)) + (user-error "No abbreviated part to hide/show"))))) ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 27 16:39:33 2018 Received: (at 30503) by debbugs.gnu.org; 27 Feb 2018 21:39:34 +0000 Received: from localhost ([127.0.0.1]:36048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqmyD-0001Fr-MO for submit@debbugs.gnu.org; Tue, 27 Feb 2018 16:39:33 -0500 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:36489 helo=homiemail-a20.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eqmyB-0001Fj-RG for 30503@debbugs.gnu.org; Tue, 27 Feb 2018 16:39:32 -0500 Received: from homiemail-a20.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTP id 49FE37EC07B; Tue, 27 Feb 2018 13:39:31 -0800 (PST) Received: from localhost.linkov.net (m91-129-98-215.cust.tele2.ee [91.129.98.215]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPSA id 220CF7EC076; Tue, 27 Feb 2018 13:39:29 -0800 (PST) From: Juri Linkov To: charles@aurox.ch (Charles A. Roelli) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line Organization: LINKOV.NET References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> <87vaeo7w7k.fsf@mail.linkov.net> Date: Tue, 27 Feb 2018 23:06:35 +0200 In-Reply-To: (Charles A. Roelli's message of "Sun, 25 Feb 2018 20:50:47 +0100") Message-ID: <877eqyr6h8.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30503 Cc: eliz@gnu.org, 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) > Thanks for adding this feature. Here's the change that implements a > toggling command. Thanks. I have only one comment about the naming: since we will now have grep-find-toggle-abbreviation, how about renaming for symmetry grep-find-hide to e.g. grep-find-hide-abbreviation, and grep-find-hide-properties to e.g. grep-find-hide-abbreviation-props? Or maybe better to have the same prefix for all functions/variables of this feature? grep-find-abbreviation-toggle grep-find-abbreviation-hide grep-find-abbreviation-hide-props From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 04 11:00:26 2018 Received: (at 30503) by debbugs.gnu.org; 4 Mar 2018 16:00:27 +0000 Received: from localhost ([127.0.0.1]:44580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1esW3m-0004LH-IW for submit@debbugs.gnu.org; Sun, 04 Mar 2018 11:00:26 -0500 Received: from sinyavsky.aurox.ch ([37.35.109.145]:53000) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1esW3k-0004L3-56 for 30503@debbugs.gnu.org; Sun, 04 Mar 2018 11:00:24 -0500 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 51D94226B7 for <30503@debbugs.gnu.org>; Sun, 4 Mar 2018 16:00:51 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:mime-version :references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1520179248; x=1521043249; bh=L6zIAkh0UX2rC 8WGuSXpBAInRx4QDBImzZwjayTQvXc=; b=h1qTh7VveUqaCOU1Axe8M9E/iMmzJ muNQt8q120Gd2N7AZvYjRF/2XMDy3xkjbAQzGScXu76TLQHfHo7N+yH15N2FTNSQ 7E/qUK9b/gHTNxfYQebC/V3531cVDxlQlQmIek5FGS5zNVUpskCW8wshZCbE1FVa cV4amWGNiZI6W4= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tiLj51Wp2rdk for <30503@debbugs.gnu.org>; Sun, 4 Mar 2018 16:00:48 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 09E4F22688; Sun, 4 Mar 2018 16:00:47 +0000 (UTC) Date: Sun, 04 Mar 2018 17:11:07 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: Juri Linkov In-reply-to: <877eqyr6h8.fsf@mail.linkov.net> (message from Juri Linkov on Tue, 27 Feb 2018 23:06:35 +0200) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> <87vaeo7w7k.fsf@mail.linkov.net> <877eqyr6h8.fsf@mail.linkov.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30503 Cc: eliz@gnu.org, 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > From: Juri Linkov > Cc: eliz@gnu.org, 30503@debbugs.gnu.org > Date: Tue, 27 Feb 2018 23:06:35 +0200 > > > Thanks for adding this feature. Here's the change that implements a > > toggling command. > > Thanks. I have only one comment about the naming: since we will now have > grep-find-toggle-abbreviation, how about renaming for symmetry > grep-find-hide to e.g. grep-find-hide-abbreviation, and > grep-find-hide-properties to e.g. grep-find-hide-abbreviation-props? > > Or maybe better to have the same prefix for all functions/variables > of this feature? > > grep-find-abbreviation-toggle > grep-find-abbreviation-hide > grep-find-abbreviation-hide-props I've gone for: grep-find-abbreviate (defcustom) grep-find-abbreviate-properties (defvar) grep-find-toggle-abbreviation (command) (Most "toggle" commands seem not to end with that word, so I've followed this convention.) The patch follows: diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 0697e1b..e1c3cea 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -434,14 +434,17 @@ Grep Searching @kbd{M-x rgrep}. The default value includes the data directories used by various version control systems. -@vindex grep-find-hide +@vindex grep-find-abbreviate +@findex grep-find-toggle-abbreviation By default, the shell commands constructed for @code{lgrep}, @code{rgrep}, and @code{zgrep} are abbreviated for display by concealing the part that contains a long list of files and directories to ignore. You can reveal the concealed part by clicking on the -button with ellipsis, which represents them. To disable this -abbreviation of the shell commands, customize the option -@code{grep-find-hide} to a @code{nil} value. +button with ellipsis, which represents them. You can also +interactively toggle viewing the concealed part by typing @kbd{M-x +grep-find-toggle-abbreviation}. To disable this abbreviation of the +shell commands, customize the option @code{grep-find-abbreviate} to a +@code{nil} value. @node Flymake @section Finding Syntax Errors On The Fly diff --git a/etc/NEWS b/etc/NEWS index 08c7e7e..24064f8 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -209,8 +209,10 @@ by default. *** rgrep, lgrep and zrgrep now hide part of the command line that contains a list of ignored directories and files. -Clicking on the button with ellipsis unhides the truncated part. -This truncation can be disabled by the new option 'grep-find-hide'. +Clicking on the button with ellipsis unhides it. +The abbreviation can be disabled by the new option +'grep-find-abbreviate'. The new command +'grep-find-toggle-abbreviation' toggles it interactively. ** ERT diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 9b2c6f1..f7c90ba 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -433,24 +433,26 @@ grep-mode-line-matches help-echo "Number of matches so far") "]")) -(defcustom grep-find-hide t +(defcustom grep-find-abbreviate t "If non-nil, hide part of rgrep/lgrep/zrgrep command line. The hidden part contains a list of ignored directories and files. Clicking on the button-like ellipsis unhides the abbreviated part -and reveals the entire command line." +and reveals the entire command line. The visibility of the +abbreviated part can also be toggled with +`grep-find-toggle-abbreviation'." :type 'boolean :version "27.1" :group 'grep) -(defvar grep-find-hide-properties +(defvar grep-find-abbreviate-properties (let ((ellipsis (if (char-displayable-p ?…) "[…]" "[...]")) (map (make-sparse-keymap))) (define-key map [down-mouse-2] 'mouse-set-point) - (define-key map [mouse-2] 'grep-find-show) - (define-key map "\C-m" 'grep-find-show) + (define-key map [mouse-2] 'grep-find-toggle-abbreviation) + (define-key map "\C-m" 'grep-find-toggle-abbreviation) `(face nil display ,ellipsis mouse-face highlight help-echo "RET, mouse-2: show unabbreviated command" - keymap ,map)) + keymap ,map abbreviated-command t)) "Properties of button-like ellipsis on part of rgrep command line.") (defvar grep-mode-font-lock-keywords @@ -476,10 +478,12 @@ grep-mode-font-lock-keywords `(face nil display ,(match-string 2))))) ;; Hide excessive part of rgrep command ("^find \\(\\. -type d .*\\\\)\\)" - (1 (when grep-find-hide grep-find-hide-properties))) + (1 (if grep-find-abbreviate grep-find-abbreviate-properties + '(face nil abbreviated-command t)))) ;; Hide excessive part of lgrep command ("^grep \\( *--exclude.*--exclude[^ ]+\\)" - (1 (when grep-find-hide grep-find-hide-properties)))) + (1 (if grep-find-abbreviate grep-find-abbreviate-properties + '(face nil abbreviated-command t))))) "Additional things to highlight in grep output. This gets tacked on the end of the generated expressions.") @@ -1195,23 +1199,19 @@ rgrep-default-command (shell-quote-argument ")") " -prune -o "))))) -(defun grep-find-show () - "Show the hidden part of rgrep/lgrep/zrgrep command line." +(defun grep-find-toggle-abbreviation () + "Toggle showing the hidden part of rgrep/lgrep/zrgrep command line." (interactive) - (when (get-text-property (point) 'display) - (let ((beg (or (previous-single-property-change - (min (point-max) (1+ (point))) 'display) - (point))) - (end (or (next-single-property-change - (point) 'display) - (point))) - (inhibit-modification-hooks t) - (inhibit-read-only t) - (buffer-undo-list t) - (modified (buffer-modified-p))) - (remove-list-of-text-properties - beg end '(display help-echo mouse-face help-echo keymap)) - (set-buffer-modified-p modified)))) + (with-silent-modifications + (let* ((beg (next-single-property-change (point-min) 'abbreviated-command)) + (end (when beg + (next-single-property-change beg 'abbreviated-command)))) + (if end + (if (get-text-property beg 'display) + (remove-list-of-text-properties + beg end '(display help-echo mouse-face help-echo keymap)) + (add-text-properties beg end grep-find-abbreviate-properties)) + (user-error "No abbreviated part to hide/show"))))) ;;;###autoload (defun zrgrep (regexp &optional files dir confirm template) From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 11 09:48:53 2018 Received: (at 30503) by debbugs.gnu.org; 11 Mar 2018 13:48:53 +0000 Received: from localhost ([127.0.0.1]:54773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ev1LI-0007Z5-OM for submit@debbugs.gnu.org; Sun, 11 Mar 2018 09:48:53 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:56484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ev1LG-0007Yn-8o for 30503@debbugs.gnu.org; Sun, 11 Mar 2018 09:48:50 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 84ABE226BC for <30503@debbugs.gnu.org>; Sun, 11 Mar 2018 13:49:24 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:mime-version :references:subject:subject:in-reply-to:to:from:from:message-id :date:date; s=dkim; t=1520776162; x=1521640163; bh=AWjKA4AKtfxgj DzWdyI9kpqWL9nh9iDN4pTfJAnzO4Y=; b=nm8dzjIx5kjILPpOI1sqvm07pgDnw sMU+S3zpH8E8J//F40KHQT+nAtN48VzmIWRNOmmZddLK7dUgY/NR8FyryncT+xgv y4Y+T91YogmQR3VUGlC1OD2aol2ymDaT3XwZsdnGuMMpIPIMIy+lEMYLDM2oZQ0I /ttLTsgjcOZ0jE= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id VrwVIqDlmHXK for <30503@debbugs.gnu.org>; Sun, 11 Mar 2018 13:49:22 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 05ECE226B0; Sun, 11 Mar 2018 13:49:21 +0000 (UTC) Date: Sun, 11 Mar 2018 15:00:13 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: juri@linkov.net In-reply-to: (charles@aurox.ch) Subject: Re: bug#30503: 27.0.50; allow hiding M-x grep command line References: <87sh9vs7p1.fsf@mail.linkov.net> <83k1v76m6r.fsf@gnu.org> <87vaeq3yfc.fsf@mail.linkov.net> <83fu5t5v1p.fsf@gnu.org> <87vaeo7w7k.fsf@mail.linkov.net> <877eqyr6h8.fsf@mail.linkov.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 30503 Cc: eliz@gnu.org, 30503@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > Date: Sun, 04 Mar 2018 17:11:07 +0100 > From: charles@aurox.ch (Charles A. Roelli) > > > > Thanks for adding this feature. Here's the change that implements a > > > toggling command. > > > > Thanks. I have only one comment about the naming: since we will now have > > grep-find-toggle-abbreviation, how about renaming for symmetry > > grep-find-hide to e.g. grep-find-hide-abbreviation, and > > grep-find-hide-properties to e.g. grep-find-hide-abbreviation-props? > > > > Or maybe better to have the same prefix for all functions/variables > > of this feature? > > > > grep-find-abbreviation-toggle > > grep-find-abbreviation-hide > > grep-find-abbreviation-hide-props > > I've gone for: > > grep-find-abbreviate (defcustom) > grep-find-abbreviate-properties (defvar) > grep-find-toggle-abbreviation (command) > > (Most "toggle" commands seem not to end with that word, so I've > followed this convention.) > > The patch follows: > > diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi > index 0697e1b..e1c3cea 100644 > --- a/doc/emacs/building.texi > +++ b/doc/emacs/building.texi > @@ -434,14 +434,17 @@ Grep Searching > @kbd{M-x rgrep}. The default value includes the data directories used > by various version control systems. > > -@vindex grep-find-hide > +@vindex grep-find-abbreviate > +@findex grep-find-toggle-abbreviation > By default, the shell commands constructed for @code{lgrep}, > @code{rgrep}, and @code{zgrep} are abbreviated for display by > concealing the part that contains a long list of files and directories > to ignore. You can reveal the concealed part by clicking on the > -button with ellipsis, which represents them. To disable this > -abbreviation of the shell commands, customize the option > -@code{grep-find-hide} to a @code{nil} value. > +button with ellipsis, which represents them. You can also > +interactively toggle viewing the concealed part by typing @kbd{M-x > +grep-find-toggle-abbreviation}. To disable this abbreviation of the > +shell commands, customize the option @code{grep-find-abbreviate} to a > +@code{nil} value. > > @node Flymake > @section Finding Syntax Errors On The Fly > diff --git a/etc/NEWS b/etc/NEWS > index 08c7e7e..24064f8 100644 > --- a/etc/NEWS > +++ b/etc/NEWS > @@ -209,8 +209,10 @@ by default. > > *** rgrep, lgrep and zrgrep now hide part of the command line > that contains a list of ignored directories and files. > -Clicking on the button with ellipsis unhides the truncated part. > -This truncation can be disabled by the new option 'grep-find-hide'. > +Clicking on the button with ellipsis unhides it. > +The abbreviation can be disabled by the new option > +'grep-find-abbreviate'. The new command > +'grep-find-toggle-abbreviation' toggles it interactively. > > ** ERT > > diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el > index 9b2c6f1..f7c90ba 100644 > --- a/lisp/progmodes/grep.el > +++ b/lisp/progmodes/grep.el > @@ -433,24 +433,26 @@ grep-mode-line-matches > help-echo "Number of matches so far") > "]")) > > -(defcustom grep-find-hide t > +(defcustom grep-find-abbreviate t > "If non-nil, hide part of rgrep/lgrep/zrgrep command line. > The hidden part contains a list of ignored directories and files. > Clicking on the button-like ellipsis unhides the abbreviated part > -and reveals the entire command line." > +and reveals the entire command line. The visibility of the > +abbreviated part can also be toggled with > +`grep-find-toggle-abbreviation'." > :type 'boolean > :version "27.1" > :group 'grep) > > -(defvar grep-find-hide-properties > +(defvar grep-find-abbreviate-properties > (let ((ellipsis (if (char-displayable-p ?…) "[…]" "[...]")) > (map (make-sparse-keymap))) > (define-key map [down-mouse-2] 'mouse-set-point) > - (define-key map [mouse-2] 'grep-find-show) > - (define-key map "\C-m" 'grep-find-show) > + (define-key map [mouse-2] 'grep-find-toggle-abbreviation) > + (define-key map "\C-m" 'grep-find-toggle-abbreviation) > `(face nil display ,ellipsis mouse-face highlight > help-echo "RET, mouse-2: show unabbreviated command" > - keymap ,map)) > + keymap ,map abbreviated-command t)) > "Properties of button-like ellipsis on part of rgrep command line.") > > (defvar grep-mode-font-lock-keywords > @@ -476,10 +478,12 @@ grep-mode-font-lock-keywords > `(face nil display ,(match-string 2))))) > ;; Hide excessive part of rgrep command > ("^find \\(\\. -type d .*\\\\)\\)" > - (1 (when grep-find-hide grep-find-hide-properties))) > + (1 (if grep-find-abbreviate grep-find-abbreviate-properties > + '(face nil abbreviated-command t)))) > ;; Hide excessive part of lgrep command > ("^grep \\( *--exclude.*--exclude[^ ]+\\)" > - (1 (when grep-find-hide grep-find-hide-properties)))) > + (1 (if grep-find-abbreviate grep-find-abbreviate-properties > + '(face nil abbreviated-command t))))) > "Additional things to highlight in grep output. > This gets tacked on the end of the generated expressions.") > > @@ -1195,23 +1199,19 @@ rgrep-default-command > (shell-quote-argument ")") > " -prune -o "))))) > > -(defun grep-find-show () > - "Show the hidden part of rgrep/lgrep/zrgrep command line." > +(defun grep-find-toggle-abbreviation () > + "Toggle showing the hidden part of rgrep/lgrep/zrgrep command line." > (interactive) > - (when (get-text-property (point) 'display) > - (let ((beg (or (previous-single-property-change > - (min (point-max) (1+ (point))) 'display) > - (point))) > - (end (or (next-single-property-change > - (point) 'display) > - (point))) > - (inhibit-modification-hooks t) > - (inhibit-read-only t) > - (buffer-undo-list t) > - (modified (buffer-modified-p))) > - (remove-list-of-text-properties > - beg end '(display help-echo mouse-face help-echo keymap)) > - (set-buffer-modified-p modified)))) > + (with-silent-modifications > + (let* ((beg (next-single-property-change (point-min) 'abbreviated-command)) > + (end (when beg > + (next-single-property-change beg 'abbreviated-command)))) > + (if end > + (if (get-text-property beg 'display) > + (remove-list-of-text-properties > + beg end '(display help-echo mouse-face help-echo keymap)) > + (add-text-properties beg end grep-find-abbreviate-properties)) > + (user-error "No abbreviated part to hide/show"))))) > > ;;;###autoload > (defun zrgrep (regexp &optional files dir confirm template) I've pushed this change, along with a modification to add a menu-bar item, and am closing the bug. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 11 09:50:50 2018 Received: (at control) by debbugs.gnu.org; 11 Mar 2018 13:50:50 +0000 Received: from localhost ([127.0.0.1]:54777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ev1NC-0007cb-9f for submit@debbugs.gnu.org; Sun, 11 Mar 2018 09:50:50 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:56506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ev1NB-0007cN-8a for control@debbugs.gnu.org; Sun, 11 Mar 2018 09:50:49 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 20BA3226BC for ; Sun, 11 Mar 2018 13:51:24 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= subject:subject:to:from:from:message-id:date:date; s=dkim; t= 1520776283; x=1521640284; bh=OF9eUyF3VkKyrgSyZq7Q2Q+ai+Sym/1qsLr kqfv/oVo=; b=R128qzw+MZ85IQCzpdC5HZE+Pi7KcFtF2vWnJFXY9PyWrvzA9zB 1t1G+35LEDvzp/hTNyhLaFLl+B7CyCDuRjwSrKNFKa5ijcBxazImpDAeX/blXKfg MksSUAdzxT/JuqTfmJmKIXWiGtrsxxd8rF8+kN/1bJI2z3sTKW+wb8Yo= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id szckaRTmDa1i for ; Sun, 11 Mar 2018 13:51:23 +0000 (UTC) Received: from gray (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id A9E69226B0 for ; Sun, 11 Mar 2018 13:51:23 +0000 (UTC) Date: Sun, 11 Mar 2018 15:02:27 +0100 Message-Id: From: charles@aurox.ch (Charles A. Roelli) To: control@debbugs.gnu.org Subject: close 30503 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) close 30503 quit From unknown Thu Jun 19 14:17:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 09 Apr 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator