GNU bug report logs - #62543
[PATCH] bs support for project.el

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Philip Kaludercic <philipk@HIDDEN>; Keywords: patch; dated Thu, 30 Mar 2023 12:28:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Mar 2023 12:27:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 30 08:27:44 2023
Received: from localhost ([127.0.0.1]:55980 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1phrNY-0002kZ-4D
	for submit <at> debbugs.gnu.org; Thu, 30 Mar 2023 08:27:44 -0400
Received: from lists.gnu.org ([209.51.188.17]:45320)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1phrNW-0002kR-Ki
 for submit <at> debbugs.gnu.org; Thu, 30 Mar 2023 08:27:43 -0400
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 <philipk@HIDDEN>)
 id 1phrNW-00082V-C9
 for bug-gnu-emacs@HIDDEN; Thu, 30 Mar 2023 08:27:42 -0400
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 <philipk@HIDDEN>)
 id 1phrNT-0000hh-QB
 for bug-gnu-emacs@HIDDEN; Thu, 30 Mar 2023 08:27:41 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 6835B240028
 for <bug-gnu-emacs@HIDDEN>; 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==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PnN3T6tSKz9rxH
 for <bug-gnu-emacs@HIDDEN>; Thu, 30 Mar 2023 14:27:33 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] bs support for project.el
X-Debbugs-CC: Dmitry Gutov <dgutov@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
Date: Thu, 30 Mar 2023 12:27:33 +0000
Message-ID: <87355mh1ai.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@HIDDEN;
 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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
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 <philipk@HIDDEN>
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

--=-=-=--




Acknowledgement sent to Philip Kaludercic <philipk@HIDDEN>:
New bug report received and forwarded. Copy sent to dgutov@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to dgutov@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#62543; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 4 Sep 2023 08:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.