From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#62543: [PATCH] bs support for project.el Date: Thu, 30 Mar 2023 12:27:33 +0000 Message-ID: <87355mh1ai.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9103"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov To: 62543@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 30 14:28:39 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1phrOQ-0002AC-6P for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Mar 2023 14:28:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phrNs-00083l-UC; Thu, 30 Mar 2023 08:28:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phrNr-00083F-1r for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 08:28:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phrNq-0000jL-Qf for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 08:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1phrNq-0002lK-Ge; Thu, 30 Mar 2023 08:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: dgutov@yandex.ru, bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Mar 2023 12:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62543 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Dmitry Gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.168017926410579 (code B ref -1); Thu, 30 Mar 2023 12:28:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Mar 2023 12:27:44 +0000 Original-Received: from localhost ([127.0.0.1]:55980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phrNY-0002kZ-4D for submit@debbugs.gnu.org; Thu, 30 Mar 2023 08:27:44 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1phrNW-0002kR-Ki for submit@debbugs.gnu.org; Thu, 30 Mar 2023 08:27:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phrNW-00082V-C9 for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 08:27:42 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phrNT-0000hh-QB for bug-gnu-emacs@gnu.org; Thu, 30 Mar 2023 08:27:41 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 6835B240028 for ; Thu, 30 Mar 2023 14:27:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1680179254; bh=H8W40IXwumOnUBEir46OHWL0bo5O49dztGoKBSwYN0k=; h=From:To:Subject:Autocrypt:Date:From; b=M/1GK6kH/qo/fvmT1gHmHlQd98blbRJFo6Y8KjmtnRb7zNIpG+fhPGrVZX2AngCu6 lbgYnmrqfZ0OOXZ5FpNBFgCjgJqleaNaK4iLv4+Waz/fBMrH8hHvLg7ADZj5xnwgZz 3UtNiwYHaUJGF/G1NxDmB06FEJGgwGBAjcuxZ2cvVY7rxsvIri3yqkIhBqlGrcHb1/ ENJWZt9hl3ByBv0bpiaI0d6gTt2opC7mG1dUUxgSqiWjumqcH8hP09iLnojmQt+uj1 5iyKz8kUSAyadFjmwNa+mGPMNRo2fUFoJjhAyp7nCVmAE6lh5EilM/YtjsY7l9Sj7f gnvnK2rWNZRCg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PnN3T6tSKz9rxH for ; Thu, 30 Mar 2023 14:27:33 +0200 (CEST) Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, 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: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258922 Archived-At: --=-=-= Content-Type: text/plain This is a quick attempt at adding support for project.el to bs.el. It works well when bs-show is invoked in a project directory, but if you open it outside of a project all you get is the current file/directory -- this doesn't make that much sense to me, but I don't know what would be better? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-a-bs-configuration-for-projects.patch Content-Description: [PATCH] Add a bs configuration for projects >From 5a47093cd41598db016007f1c35894a770b68017 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 30 Mar 2023 14:24:10 +0200 Subject: [PATCH] Add a bs configuration for projects * lisp/bs.el (bs-configurations): Add "project" configuration. (bs-visits-current-project): Add a predicate function for 'bs-configurations'. --- lisp/bs.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/bs.el b/lisp/bs.el index 70868591196..65dd4d10431 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -126,6 +126,8 @@ ;; Globals for customization ;; ---------------------------------------------------------------------- +(require 'project) + (defgroup bs nil "Buffer Selection: Maintaining buffers by buffer menu." :version "21.1" @@ -255,6 +257,7 @@ bs-header-lines-length (defcustom bs-configurations '(("all" nil nil nil nil nil) ("files" nil nil nil bs-visits-non-file bs-sort-buffer-interns-are-last) + ("project" nil nil nil bs-visits-current-project bs-sort-buffer-interns-are-last) ("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file bs-sort-buffer-interns-are-last) ("all-intern-last" nil nil nil nil bs-sort-buffer-interns-are-last)) @@ -1039,6 +1042,12 @@ bs-visits-non-file A value of nil means BUFFER belongs to a file." (not (buffer-file-name buffer))) +(defun bs-visits-current-project (buffer) + "Return whether BUFFER is in the current project." + (not (and-let* ((project (project-current)) + (file (buffer-file-name buffer))) + (file-in-directory-p file (project-root project))))) + (defun bs-sort-buffer-interns-are-last (_b1 b2) "Function for sorting internal buffers at the end of all buffers." (string-match-p "^\\*" (buffer-name b2))) -- 2.30.2 --=-=-= Content-Type: text/plain -- Philip Kaludercic --=-=-=--