From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: dabbrev-select-buffers-function project aware. Date: Mon, 17 Jan 2022 19:55:46 +0100 Message-ID: <20220117185546.jvoqxmttxzyooiwc@Ergus> References: <87czkq5jli.fsf.ref@Ergus.mail-host-address-is-not-set> <87czkq5jli.fsf@Ergus.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39893"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 17 19:58:32 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9XD6-000AEF-5r for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Jan 2022 19:58:32 +0100 Original-Received: from localhost ([::1]:54380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9XD5-00010F-9u for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Jan 2022 13:58:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9XBH-00008I-3b for emacs-devel@gnu.org; Mon, 17 Jan 2022 13:56:39 -0500 Original-Received: from sonic304-9.consmr.mail.bf2.yahoo.com ([74.6.128.32]:35590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n9XBE-00079C-EG for emacs-devel@gnu.org; Mon, 17 Jan 2022 13:56:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1642445793; bh=B+/EozewV2PTKgS7vXd8nCd2GqPUZATnELsGjPvQG8s=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject:Reply-To; b=R5jnU77zKvx7xLDgKOpCyAN87NYZ3wZT8b/xfOZ0y093/3P9ncszi6qruePJC9PygyHzc7C5vb2qd1OmIH0W7j/lrV5eZ46Xm0fVWYyWAsM5nTVETxNnnz9J5qI6cKjQHbcdDBAa0gziNuYvv3kKWA9m0nCE01WNugY+OWOoArvwWc3GAYlLJwMWCCQdm5w4Gn2RNy/D6imOD2sILASul+MjBbJ5pegPqGHgUCrfcqR2FDlomd1hTPJTet7iNeOGELY0G/K9aXrGmbCbTyofvUJw3ssznwWw1SLe40LDliHnxmuYwauWyc2imK27iUYH335TTlkSCGhN818hCuB15g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1642445793; bh=27eXiMFZIgCK0bvIo0tLmbsrrnRfjDSADoOTqnmzgML=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=aqLupCSXRb+kZEbcVIyFqXXm/V0rgMW539ibfJVMP4V5gyQYk05H3wLvr4cvMBW+Z6F5EgOeXnxNstx4HQlogjzEaJsapiQQhwsb36vMfeyL6etYDhoZHFgKMFmC830UgCXi74RuLbr4flykX8zqxIGARzKdzyZZkYcOnzRABG097xuBVNebSFUrtXscP4gotbcOF0SDvtFJ7P26LpQ1iIru1T1+pCX1+hPN8sy37FseCsUYo6GRxg0JhJmKlE9giYVFoDi7OM1UIqaTYDZScXcaSSh1zTDwqhfIdKWcy/dspGx+kMEm+STj0OLQcPh84mTPVx11Yf3cOS4WO3Zn7w== X-YMail-OSG: RxnDM_YVM1mdskksdiVgTApSSkoeP2mRY6riA2BV.6gtoiewBdfIGFUxJ0b45LN qMfkoVUJSS9pfF7K2q9STypItiuVtr.Zj7VxtKzchXHkOCmdKt5T6bywzsQlI1Yse4AjvT71ZUXb rpt3WstF3LUwdLMBvV0gfkry.PTaD2e8.63zQArvh2.4wp8mj7zDIiKNZ4piS_NyMSZsnST6NAhm EMtzma9R9yVMy9KSJtJfI2tfsTC0AQXJv7HOzHXTyV4sw0qpYavwAqpwLF8J3I3DC3sBHNF8XMFI Dh3mIkNafyR8ieULfxYRJ9mRSxKkfW2FAjkEQ6UwZ2sch3qHlS8VvDLBOk_O5EK2nFPUge3GRwS8 30hSTMo0YWAB9Pc8cDaN_q2xgznZqe8zf198vsxblm2UhMmnwp80vijYHtBd_PruYc.o1kvIfykV WKP5JVpUqyOXNs4IAiB_EWP6I4tcUDP_jhzaTBDIZcWTteZyPb_pF0SZRQ1ezafodzPZ38KMrRmR l6jwgqfCMzAjzRd14K2.zjMJxGrEH_Mk_pK4ZPGi0qVkIkY1JZqPSQd1w6IVo.vNkGk6Wy4iZQj_ yiumnnRuNcHVUjk97vhVGtCAS16Nq9os2q7cA.3UdzDa25x0ZIUACDj5_c0aow_gHjeAHBviOxYl t1nuwThHziRQFWt5n0IFBfIgOM2qWwfONZnRl9Lbe6b5MAENTaABOqnGrzWKOo8lcOh2e1u2Barv YDmMGKc4PyiDyNsGzBrerRrrXfjgOhwRu0Qj.WW4amWR62qX.OgqHabVbXbH6gzQtngq00zyx3DO Ob1NnjS2gTRsBzsbjb108BdxI4PI9zsTlZMZK1Itbo X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Mon, 17 Jan 2022 18:56:33 +0000 Original-Received: by kubenode510.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID ac7465fa1f0b8fe8a361935ce96c4abe; Mon, 17 Jan 2022 18:56:27 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87czkq5jli.fsf@Ergus.mail-host-address-is-not-set> X-Mailer: WebService/1.1.19594 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.128.32; envelope-from=spacibba@aol.com; helo=sonic304-9.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:284896 Archived-At: On Mon, Jan 17, 2022 at 06:59:46PM +0100, Ergus wrote: >Hi: > >I am trying to limit dabbrev to know about current project context qhen >there is project-root. > > I am trying to implement a function to substitute >`dabbrev--same-major-mode-p`, to add an extra condition to check if both >buffers are in the same project. But some time in the past I reported >some performance issue that was fixed, but I am wondering if this >addition may worst instead of improve performance for dabbrev >completion. > >Do we recommend anything special? > >Best, >Ergus > Somehow in reply to myself, this is what I did, maybe someone could suggest an improvement. ``` (defun my/dabbrev--select-project-buffers () "Dabbrev list of buffers in the same project and apply the filters." (dabbrev-filter-elements buffer (project-buffers (project-current t)) (and (not (eq (current-buffer) buffer)) (not (dabbrev--ignore-buffer-p buffer)) (boundp 'dabbrev-friend-buffer-function) (funcall dabbrev-friend-buffer-function buffer)))) (setq-default dabbrev-check-all-buffers nil dabbrev-ignored-buffer-regexps "^[ *]" dabbrev-select-buffers-function #'my/dabbrev--select-project-buffers) ``` If we want to add such functionality to dabbrev itself maybe we could consider adding a variable like dabbrev-list-buffers that we can set to #'list-buffers, (project-buffers (project-current t)) or anything like that. I am wondering because setting dabbrev-friend-buffer-function impacted performance negatively when using tramp like used to happen project.el some months ago. BTW: I am wondering that `project-buffers` does not filter the buffers list, so the user gets all the ^[ *].+* buffers as "project's" buffers. I understand this is less restrictive, but I don't know if it is conceptually correct to get *Packages* or *Help* as project's buffers for example.