From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [patch] Run occur command restricted to a region Date: Sat, 21 Jan 2017 01:17:17 +0200 Organization: LINKOV.NET Message-ID: <8760l9wcci.fsf@mail.linkov.net> References: <87vau3jl6f.fsf@gmail.com> <87shp6uwvj.fsf@mail.linkov.net> <83h95lua2f.fsf@gnu.org> <878tqxm1wh.fsf@mail.linkov.net> <87r34ozq20.fsf@gmail.com> <87inq0xhiw.fsf@mail.linkov.net> <87d1g55h8d.fsf@mail.linkov.net> <87r33ywquz.fsf@mail.linkov.net> <87ziilc05e.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1484954372 1480 195.159.176.226 (20 Jan 2017 23:19:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 20 Jan 2017 23:19:32 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) Cc: Emacs developers To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 21 00:19:27 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUiSb-0006iN-Kz for ged-emacs-devel@m.gmane.org; Sat, 21 Jan 2017 00:19:09 +0100 Original-Received: from localhost ([::1]:57749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUiSe-0004WF-O7 for ged-emacs-devel@m.gmane.org; Fri, 20 Jan 2017 18:19:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cUiS0-0004W9-Q1 for emacs-devel@gnu.org; Fri, 20 Jan 2017 18:18:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cUiRv-0005yK-PW for emacs-devel@gnu.org; Fri, 20 Jan 2017 18:18:32 -0500 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:38528 helo=homiemail-a100.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cUiRv-0005wc-Jg for emacs-devel@gnu.org; Fri, 20 Jan 2017 18:18:27 -0500 Original-Received: from homiemail-a100.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a100.g.dreamhost.com (Postfix) with ESMTP id 99EC431A073; Fri, 20 Jan 2017 15:18:25 -0800 (PST) Original-Received: from localhost.linkov.net (m83-191-204-220.cust.tele2.ee [83.191.204.220]) (Authenticated sender: jurta@jurta.org) by homiemail-a100.g.dreamhost.com (Postfix) with ESMTPA id B898331A070; Fri, 20 Jan 2017 15:18:24 -0800 (PST) In-Reply-To: <87ziilc05e.fsf@gmail.com> (Tino Calancha's message of "Fri, 20 Jan 2017 22:48:45 +0900") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 69.163.253.7 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211448 Archived-At: > OK. Updated the patch. > *) First patch allow `occur' handle the region with the new convention= , > i.e., region argument instead of BEG, END. Thanks. As a prerequisite I'm going to install this patch: diff --git a/lisp/simple.el b/lisp/simple.el index 3d25ec1..610846b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1015,6 +1015,9 @@ (defvar region-extract-function If anything else, delete the region and return its content as a string, after filtering it with `filter-buffer-substring'.") =20 +(defun region-bounds () + "Return the boundaries of the region as a list of (START . END) positi= ons." + (funcall region-extract-function 'bounds)) + (defvar region-insert-function (lambda (lines) (let ((first t)) > **) The second patch add your suggestion on showing highlighted the > current line. When there are matches after the current line, the > point in *Occur* is set right after such line. > > I am fine with just adding *). In case we also want **), > an option to enable/disable that behaviour might be desirable. Keeping traditional behaviour means not jumping to the middle of the *Occur* output by default. Then maybe we could use the same option to highlight the current line and to jump to it? Like the existing =E2=80=98list-matching-lines-buffer-name-face=E2=80=99, adding a nil/face= choice for =E2=80=98list-matching-lines-current-line-face=E2=80=99, so when it's nil= then don't highlight/jump?