From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 07 13:51:27 2021 Received: (at submit) by debbugs.gnu.org; 7 Mar 2021 18:51:27 +0000 Received: from localhost ([127.0.0.1]:41496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIyUx-0005bI-Ai for submit@debbugs.gnu.org; Sun, 07 Mar 2021 13:51:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:44360) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIyUt-0005b9-FH for submit@debbugs.gnu.org; Sun, 07 Mar 2021 13:51:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIyUt-0006Fv-6L for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 13:51:23 -0500 Received: from relay12.mail.gandi.net ([217.70.178.232]:43427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIyUp-0005ir-Ky for bug-gnu-emacs@gnu.org; Sun, 07 Mar 2021 13:51:22 -0500 Received: from mail.gandi.net (m91-129-108-46.cust.tele2.ee [91.129.108.46]) (Authenticated sender: juri@linkov.net) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 51EEE20000C for ; Sun, 7 Mar 2021 18:51:14 +0000 (UTC) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: xref-after-update-hook Organization: LINKOV.NET Date: Sun, 07 Mar 2021 20:50:25 +0200 Message-ID: <87r1kqhkzu.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.178.232; envelope-from=juri@linkov.net; helo=relay12.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.7 (-) 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: -2.7 (--) --=-=-= Content-Type: text/plain Version: 28.0.50 Severity: wishlist Tags: patch As suggested in https://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00161.html here is a patch that adds such hook: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=xref-after-update-hook.patch diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 18fdd963fb..ba4e48faf8 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -415,6 +415,10 @@ xref-after-return-hook "Functions called after returning to a pre-jump location." :type 'hook) +(defcustom xref-after-update-hook nil + "Functions called after the xref buffer is updated." + :type 'hook) + (defvar xref--marker-ring (make-ring xref-marker-ring-length) "Ring of markers to implement the marker stack.") @@ -919,7 +933,8 @@ xref--insert-xrefs "RET or mouse-1: follow reference")) prefix new-summary) (setq prev-line-key line-key))) - (insert "\n")))) + (insert "\n"))) + (run-hooks 'xref-after-update-hook)) (defun xref--analyze (xrefs) "Find common filenames in XREFS. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 07 14:30:12 2021 Received: (at 46992) by debbugs.gnu.org; 7 Mar 2021 19:30:12 +0000 Received: from localhost ([127.0.0.1]:41544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIz6S-0006Yz-8G for submit@debbugs.gnu.org; Sun, 07 Mar 2021 14:30:12 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:50910) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lIz6O-0006XS-GA for 46992@debbugs.gnu.org; Sun, 07 Mar 2021 14:30:10 -0500 Received: by mail-wm1-f52.google.com with SMTP id i9so4728901wml.0 for <46992@debbugs.gnu.org>; Sun, 07 Mar 2021 11:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=2y7Bi+lQ4bp66yF/T/HWzX8HdAG8j5tecvXyGAavHCQ=; b=G3bYuS2JpT6mKvD0N3x7nxgTE6O+yC5Q4bWXlWqWuCRFGQuQQswwnLqy1kBdryP3ut Wt378Yk6C2VQ40IW9pPtNjFCXTTRjmO9DTmeKhbWbOBq/yvHpnhyZubB4EKnvNBRDEWS nRNK9d73Vj0LfiYny5LP6C3q5AUe6q9QAe1saoWAa2eDl/u9rHDWl+0REGpoGENxSoiM 7pJm3pW/1kOuzkluRuweGvjkoUSxbvf4tTPSNEioQlhIvWaHCddvFIkNgJuk/pfNzXMN 4vWjHioOgvgACwZBjqdmKL9OlO6+e+/Y+Xgm0+EhA9vvtuUJPNYKP8QKdUfkmPJCXhb1 UPYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2y7Bi+lQ4bp66yF/T/HWzX8HdAG8j5tecvXyGAavHCQ=; b=YCr9TUCttp/LyTTbEBpeUf2LNQsrpnZ7vhI+DYM60z5AzyC2Jl0JICnVQjCHjeCEje LY7Kxm3AS39tghmtVLBGNLq8WtbPCJeDv/pHJEtHBo8DjH+Rc146Fh0lPevHTLH2zH9M flkYvuKgUH05YtOJJPz2x1pztUMsq9uY5GZ7niqsU4ZvzDCw8EFnKlflZU3VPSHOrwvt wsfbmU7gVFwEIig6lHPHgpY+g3eCTQ6bO32Pf0rlhtwrmiZD/ABOGP2kIFFfNE/nnC30 eWRmLhJEtIw4n/wiUfyii2SXhhx4mLbGbL2rBTpkc5h50Vz+LZOHiFzs3bMY2FEFmfWz OlCw== X-Gm-Message-State: AOAM531oHdOGM2vYf72YQi+bauQ5vzlD2bO4gQsdwAHEHxVkRo/XrgOk FqnVgdxJQfe9ZwSVUHN4AOk7zsaK78A= X-Google-Smtp-Source: ABdhPJygnLLz9Nd7Pq7hk1yGjhJrEAkblOjtUavdalh9qVtrD2FlqGHPh5HgaomCT0aaS6wRxyeEeQ== X-Received: by 2002:a7b:c755:: with SMTP id w21mr19401355wmk.89.1615145402396; Sun, 07 Mar 2021 11:30:02 -0800 (PST) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id s23sm14322599wmc.35.2021.03.07.11.30.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Mar 2021 11:30:01 -0800 (PST) Subject: Re: bug#46992: xref-after-update-hook To: Juri Linkov , 46992@debbugs.gnu.org References: <87r1kqhkzu.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: Date: Sun, 7 Mar 2021 21:29:58 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87r1kqhkzu.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 46992 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.5 (/) Hi! On 07.03.2021 20:50, Juri Linkov wrote: > As suggested inhttps://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00161.html > here is a patch that adds such hook: The patch LGTM, but have you tried using xref--xref-buffer-mode-hook? From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 07 15:45:03 2021 Received: (at 46992) by debbugs.gnu.org; 7 Mar 2021 20:45:03 +0000 Received: from localhost ([127.0.0.1]:41617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ0Gt-0008Lg-G7 for submit@debbugs.gnu.org; Sun, 07 Mar 2021 15:45:03 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:52713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ0Gq-0008Km-Oo for 46992@debbugs.gnu.org; Sun, 07 Mar 2021 15:45:01 -0500 X-Originating-IP: 91.129.108.46 Received: from mail.gandi.net (m91-129-108-46.cust.tele2.ee [91.129.108.46]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 8D43B20005; Sun, 7 Mar 2021 20:44:53 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#46992: xref-after-update-hook Organization: LINKOV.NET References: <87r1kqhkzu.fsf@mail.linkov.net> Date: Sun, 07 Mar 2021 22:43:40 +0200 In-Reply-To: (Dmitry Gutov's message of "Sun, 7 Mar 2021 21:29:58 +0200") Message-ID: <87eegqk83n.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 46992 Cc: 46992@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: -1.7 (-) >> As suggested inhttps://lists.gnu.org/archive/html/emacs-devel/2021-03/msg00161.html >> here is a patch that adds such hook: > > The patch LGTM, but have you tried using xref--xref-buffer-mode-hook? This is the first thing that I tried, but the problem is that it's called before the xref buffer is filled with results where I need to put overlays on output lines. Also the hook needs to be called after reverting xref buffer. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 07 19:09:39 2021 Received: (at 46992) by debbugs.gnu.org; 8 Mar 2021 00:09:39 +0000 Received: from localhost ([127.0.0.1]:41763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ3Ss-0004vW-Tn for submit@debbugs.gnu.org; Sun, 07 Mar 2021 19:09:39 -0500 Received: from mail-wm1-f41.google.com ([209.85.128.41]:42534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJ3Sq-0004vK-PE for 46992@debbugs.gnu.org; Sun, 07 Mar 2021 19:09:37 -0500 Received: by mail-wm1-f41.google.com with SMTP id b2-20020a7bc2420000b029010be1081172so2701689wmj.1 for <46992@debbugs.gnu.org>; Sun, 07 Mar 2021 16:09:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dTYnYTBhEMpQ939Cr+U9qOaBLui2mJdD1QY0EgKvOSU=; b=N+D6ZtkbZOuLcCffmagV60OyYEd2AUL3DH3w7YOR5vuQHJopos0/EVOKO+FDWTFmmI LWOsIVsjDY6rapqsd5PVWxMPfFacdF3iUhlN5JmLQ8stWl1kNuQHxUTXtZgieM8v/NYu 2/iWw8sD3kDRTnb6RyLysTZeA7ZgGEF9XvUt6YfrgQ5s6joVn1jiVytEGuF8aIwMfZk3 iwF9un0Pa+D+/J4VcP5KbZaGZ5A9GFvxJPC1YY0Z5jw6lK0fehteHbgNwHmu9ZwDphfK 052KXYxxRDerFeudcajyska66ujo27AvzT4RZfBXEBPHo/1u0kzEOy8LwYJrEDLEXgST UZBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dTYnYTBhEMpQ939Cr+U9qOaBLui2mJdD1QY0EgKvOSU=; b=fa60rlM0pegmgOqiPtVnGwVboBINVvIEE6D7EFOqIQZkCqpNWtIx6jDv4AZKlIanFy 9CCTExANZOVlRfMc44zwlbGyibIFA591w7BQJwUts/NMTGBefNTfGVwKqyG4t44ZrgsC 2aHi8JUFgz+MiU8qZ8MOliqeZkWR0LZbON6d1K7JmsfwQj7tr5PtKfjRW/Afn8kOxzu5 cyhhFg7rTRmYWJ7zXP2rVY20uZhKobqo7HZ/WruJsOKRSzLNjFrK6gI10F0OZUe2vTmX EQEzz0LfTUBSIxaYax0Q8pKtPJQUN6i6fqZa09vm3UxH66bzl2WuVrZdFRXM4ixpu1mE fsxQ== X-Gm-Message-State: AOAM531qtQW3d00CaeJ2W5RqE9y/5eou9PC3MyO7X9h157Kp9xzNJO0Y K7nagsjZq6JXxzj9gd/v2hRGDl2GekA= X-Google-Smtp-Source: ABdhPJxVjOEsFfMdcj5cOrqfBEh46jPFZnrdL0443pESl1NfzhMvA+q0Njc2NofRPVp/rKWu4rK68w== X-Received: by 2002:a1c:dd89:: with SMTP id u131mr5501436wmg.54.1615162171041; Sun, 07 Mar 2021 16:09:31 -0800 (PST) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id 1sm15623556wmj.2.2021.03.07.16.09.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Mar 2021 16:09:30 -0800 (PST) Subject: Re: bug#46992: xref-after-update-hook To: Juri Linkov References: <87r1kqhkzu.fsf@mail.linkov.net> <87eegqk83n.fsf@mail.linkov.net> From: Dmitry Gutov Message-ID: <7ace7ff1-98e6-e5f0-5bf9-3cd28f4a7154@yandex.ru> Date: Mon, 8 Mar 2021 02:09:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <87eegqk83n.fsf@mail.linkov.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 46992 Cc: 46992@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.5 (/) On 07.03.2021 22:43, Juri Linkov wrote: > This is the first thing that I tried, but the problem is that > it's called before the xref buffer is filled with results > where I need to put overlays on output lines. > > Also the hook needs to be called after reverting xref buffer. I figured if all you are doing is some setup and turning on a minor mode, it should be enough to only do once. A minor mode would generally track all subsequent modifications to the buffer with after-change-functions or the like (we don't bind (inhibit-modification-hooks t) while rendering the output, although it looks like we might, for a small extra speed boost). But if that doesn't work for some reason, or doesn't cover all your goals, please feel free to install the patch. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 08 12:49:28 2021 Received: (at 46992) by debbugs.gnu.org; 8 Mar 2021 17:49:28 +0000 Received: from localhost ([127.0.0.1]:44722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJK0W-0002PN-Hy for submit@debbugs.gnu.org; Mon, 08 Mar 2021 12:49:28 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:51171) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJK0T-0002P4-Rw; Mon, 08 Mar 2021 12:49:26 -0500 Received: from mail.gandi.net (m91-129-108-46.cust.tele2.ee [91.129.108.46]) (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 8A3DD24000D; Mon, 8 Mar 2021 17:49:18 +0000 (UTC) From: Juri Linkov To: Dmitry Gutov Subject: Re: bug#46992: xref-after-update-hook Organization: LINKOV.NET References: <87r1kqhkzu.fsf@mail.linkov.net> <87eegqk83n.fsf@mail.linkov.net> <7ace7ff1-98e6-e5f0-5bf9-3cd28f4a7154@yandex.ru> Date: Mon, 08 Mar 2021 19:48:48 +0200 Message-ID: <875z21wn7j.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 46992 Cc: 46992@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: -1.7 (-) tags 46992 fixed close 46992 28.0.50 thanks >> This is the first thing that I tried, but the problem is that >> it's called before the xref buffer is filled with results >> where I need to put overlays on output lines. >> Also the hook needs to be called after reverting xref buffer. > > I figured if all you are doing is some setup and turning on a minor mode, > it should be enough to only do once. A minor mode would generally track all > subsequent modifications to the buffer with after-change-functions or the > like (we don't bind (inhibit-modification-hooks t) while rendering the > output, although it looks like we might, for a small extra speed boost). We can't overburden minor modes with such complexity that is not used most of the time. > But if that doesn't work for some reason, or doesn't cover all your goals, > please feel free to install the patch. Ok, pushed to master, and closed. From unknown Sun Aug 17 22:08:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 06 Apr 2021 11:24:08 +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