Subject: bug#54100: closed (Re: bug#54100: 29.0.50; Allow project-buffers to ignore some buffers)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 27 Feb 2022 03:28:01 +0000

Your bug report

#54100: 29.0.50; Allow project-buffers to ignore some buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
54100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54100
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#54100: 29.0.50; Allow project-buffers to ignore some buffers
From: Dmitry Gutov <[email-masked]>
To: Manuel Uberti <[email-masked]>, [email-masked]
Date: Sun, 27 Feb 2022 05:27:51 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On 26.02.2022 08:32, Manuel Uberti wrote:
> I like the idea. I attached a new version of the patch.

Thanks! Pushed.

BTW, do you have copyright assignment for Emacs?

I see an assignment on file for a person with the same name, but with a 
different email. Anyway, it's only important for any future patches.

Subject: 29.0.50; Allow project-buffers to ignore some buffers
From: Manuel Uberti <[email-masked]>
To: [email-masked]
Date: Tue, 22 Feb 2022 09:27:12 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

currently I am redifining `project-buffers' to ensure 'C-x p b'
(`project-switch-to-buffer') ignores some buffers I never want to switch to with 
that command:

(defvar mu-ignored-buffers
   '("\\` " "^\\*Async" "^\\*Completions" "^\\*Flymake" "^\\*Help"
     "^\\*Messages" "^\\*eldoc" "^\\*envrc" "\\*tramp" "^\\*vc" "^\\*xref")
   "A list of predicates for buffers to ignore.")

(cl-defmethod project-buffers ((project (head vc)))
   (let* ((root (expand-file-name (file-name-as-directory (project-root project))))
          (modules (unless (or (project--vc-merge-submodules-p root)
                               (project--submodule-p root))
                     (mapcar
                      (lambda (m) (format "%s%s/" root m))
                      (project--git-submodules))))
          dd
          bufs)
     (dolist (buf (buffer-list))
       (setq dd (expand-file-name (buffer-local-value 'default-directory buf)))
       (when (and (string-prefix-p root dd)
                  (not (cl-find-if (lambda (module) (string-prefix-p module dd))
                                   modules))
                  (not (seq-contains-p
                        mu-ignored-buffers (buffer-name buf) #'string-match-p)))
         (push buf bufs)))
     (nreverse bufs)))

I am not sure this is the best approach, though.

Would it be possible to add a defcustom to specify a predicate for the project 
buffers to be shown in `project-switch-to-buffer'?

In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.18, cairo 
version 1.16.0)
  of 2022-02-22 built on hathaway
Repository revision: 8d02624c0ec029ee99e0b1e410429c440bcc4499
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04 LTS

Configured using:
  'configure --with-harfbuzz --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
   value of $LC_MONETARY: it_IT.UTF-8
   value of $LC_NUMERIC: it_IT.UTF-8
   value of $LC_TIME: it_IT.UTF-8
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
   electric-pair-mode: t
   flymake-mode: t
   windmove-mode: t
   savehist-mode: t
   global-so-long-mode: t
   global-subword-mode: t
   subword-mode: t
   winner-mode: t
   envrc-global-mode: t
   envrc-mode: t
   mct-region-mode: t
   mct-minibuffer-mode: t
   pixel-scroll-precision-mode: t
   minibuffer-electric-default-mode: t
   minibuffer-depth-indicate-mode: t
   delete-selection-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   window-divider-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny dired-x
dired dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils help-fns radix-tree misearch multi-isearch
time-date noutline outline checkdoc lisp-mnt elec-pair flymake-proc
flymake thingatpt compile text-property-search comint vc-dir ewoc vc-git
diff-mode easy-mmode vc vc-dispatcher cursor-sensor project server
modus-operandi-theme modus-themes pcase windmove delight comp comp-cstr
warnings cl-extra help-mode savehist so-long cap-words superword subword
winner envrc inheritenv ansi-color mct pixel-scroll ring minibuf-eldef
mb-depth ibuf-macs rx delsel info tex-site package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
seq gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget keymap hashtable-print-readable backquote threads
dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 241664 84480)
  (symbols 48 15348 1)
  (strings 32 46778 3597)
  (string-bytes 1 1497114)
  (vectors 16 28407)
  (vector-slots 8 833744 120150)
  (floats 8 139 444)
  (intervals 56 1087 217)
  (buffers 992 18))

-- 
Manuel Uberti
www.manueluberti.eu