update packages

This commit is contained in:
2025-03-11 21:14:26 +01:00
parent 45d49daef0
commit 14dcaaddde
440 changed files with 13229 additions and 8718 deletions

View File

@@ -1,6 +1,6 @@
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
;; Copyright (C) 2023 Alexander Miller
;; Copyright (C) 2024 Alexander Miller
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -58,6 +58,9 @@
treemacs--expand-file-node
treemacs--expand-tag-node)
;; Ensure mouse cursor turns into a hand over treemacs' buttons
(put 'treemacs-button 'mouse-face 'highlight)
(defvar-local treemacs--projects-end nil
"Marker pointing to position at the end of the last project.
@@ -238,7 +241,7 @@ DEPTH indicates how deep in the filetree the current button is."
(treemacs-icon-for-dir dir-name 'closed)
(propertize (->> dir-name (funcall treemacs-directory-name-transformer))
'button '(t)
'category 'default-button
'category 'treemacs-button
'help-echo nil
'keymap nil
:default-face 'treemacs-directory-face
@@ -261,7 +264,7 @@ DEPTH indicates how deep in the filetree the current button is."
(treemacs-icon-for-file ,path)
(propertize (->> ,path file-name-nondirectory (funcall treemacs-file-name-transformer))
'button '(t)
'category 'default-button
'category 'treemacs-button
'help-echo nil
'keymap nil
:default-face 'treemacs-git-unmodified-face
@@ -406,13 +409,13 @@ Maps ITEMS at given index INTERVAL using MAPPER function."
(pop ,l)))
,items)))
(define-inline treemacs--create-branch (root depth git-future collapse-process &optional parent)
(define-inline treemacs--create-branch (root depth git-future flatten-future &optional parent)
"Create a new treemacs branch under ROOT.
The branch is indented at DEPTH and uses the eventual outputs of
GIT-FUTURE to decide on file buttons' faces and COLLAPSE-PROCESS to determine
GIT-FUTURE to decide on file buttons' faces and FLATTEN-FUTURE to determine
which directories should be displayed as one. The buttons' parent property is
set to PARENT."
(inline-letevals (root depth git-future collapse-process parent)
(inline-letevals (root depth git-future flatten-future parent)
(inline-quote
(save-excursion
(let* ((dirs-and-files (treemacs--get-dir-content ,root))
@@ -548,8 +551,9 @@ set to PARENT."
(insert (apply #'concat file-strings))
(save-excursion
(treemacs--flatten-dirs (treemacs--parse-collapsed-dirs ,collapse-process))
(treemacs--reentry ,root ,git-future))
(treemacs--flatten-dirs
(treemacs--parse-flattened-dirs ,root ,flatten-future))
(treemacs--reentry ,root ,git-future ,flatten-future))
(with-no-warnings
(line-end-position)))))))
@@ -595,7 +599,7 @@ RECURSIVE: Bool"
(let* ((path (treemacs-button-get btn :path))
(git-path (if (treemacs-button-get btn :symlink) (file-truename path) path))
(git-future (treemacs--git-status-process git-path project))
(collapse-future (treemacs--collapsed-dirs-process path project))
(flatten-future (treemacs--flattened-dirs-process path project))
(recursive (treemacs--prefix-arg-to-recurse-depth recursive)) )
(treemacs--maybe-recenter treemacs-recenter-after-project-expand
(treemacs--button-open
@@ -613,7 +617,12 @@ RECURSIVE: Bool"
(when (fboundp 'treemacs--apply-project-bottom-extensions)
(save-excursion
(treemacs--apply-project-bottom-extensions btn project)))
(treemacs--create-branch path (1+ (treemacs-button-get btn :depth)) git-future collapse-future btn)
(treemacs--create-branch
path
(1+ (treemacs-button-get btn :depth))
git-future
flatten-future
btn)
(treemacs--start-watching path)
;; Performing FS ops on a disconnected Tramp project
;; might have changed the state to connected.
@@ -638,35 +647,45 @@ Remove all open entries below BTN when RECURSIVE is non-nil."
(treemacs--stop-watching path)
(treemacs-on-collapse path recursive))))
(cl-defun treemacs--expand-dir-node (btn &key git-future recursive)
(cl-defun treemacs--expand-dir-node
(btn
&key
git-future
flatten-future
recursive)
"Open the node given by BTN.
BTN: Button
GIT-FUTURE: Pfuture|HashMap
FLATTEN-FUTURE: Pfuture|HashMap
RECURSIVE: Bool"
(-let [path (treemacs-button-get btn :path)]
(if (not (file-readable-p path))
(treemacs-pulse-on-failure
"Directory %s is not readable." (propertize path 'face 'font-lock-string-face))
(treemacs-pulse-on-failure "Directory %s is not readable."
(propertize path 'face 'font-lock-string-face))
(let* ((project (treemacs-project-of-node btn))
(git-future (if (treemacs-button-get btn :symlink)
(treemacs--git-status-process (file-truename path) project)
(or git-future (treemacs--git-status-process path project))))
(collapse-future (treemacs--collapsed-dirs-process path project))
(flatten-future (or flatten-future
(treemacs--flattened-dirs-process path project)))
(recursive (treemacs--prefix-arg-to-recurse-depth recursive))
(dir-name (treemacs--filename path)))
(base-dir-name (treemacs--filename (treemacs-button-get btn :key))))
(treemacs--button-open
:immediate-insert nil
:button btn
:new-state 'dir-node-open
:new-icon (treemacs-icon-for-dir dir-name 'open)
:new-icon (treemacs-icon-for-dir base-dir-name 'open)
:open-action
(progn
;; do on-expand first so buttons that need collapsing can quickly find their parent
(treemacs-on-expand path btn)
(when (fboundp 'treemacs--apply-directory-top-extensions)
(treemacs--apply-directory-top-extensions btn path))
(goto-char (treemacs--create-branch path (1+ (treemacs-button-get btn :depth)) git-future collapse-future btn))
(goto-char
(treemacs--create-branch
path (1+ (treemacs-button-get btn :depth))
git-future flatten-future btn))
(when (fboundp 'treemacs--apply-directory-bottom-extensions)
(treemacs--apply-directory-bottom-extensions btn path))
(treemacs--start-watching path)
@@ -680,11 +699,12 @@ RECURSIVE: Bool"
(defun treemacs--collapse-dir-node (btn &optional recursive)
"Close node given by BTN.
Remove all open dir and tag entries under BTN when RECURSIVE."
(-let [path (treemacs-button-get btn :path)]
(let ((path (treemacs-button-get btn :path))
(base-dir-name (treemacs--filename (treemacs-button-get btn :key))))
(treemacs--button-close
:button btn
:new-state 'dir-node-closed
:new-icon (treemacs-icon-for-dir (treemacs--filename path) 'closed)
:new-icon (treemacs-icon-for-dir base-dir-name 'closed)
:post-close-action
(progn
(treemacs--stop-watching path)
@@ -711,7 +731,7 @@ PROJECT: Project Struct"
(insert
(propertize (treemacs-project->name project)
'button '(t)
'category 'default-button
'category 'treemacs-button
'face (treemacs--root-face project)
:project project
:default-face 'treemacs-root-face
@@ -1176,9 +1196,9 @@ PATH: Node Path"
(treemacs--filename path))))
t)))))
(defun treemacs--reentry (path &optional git-info)
(defun treemacs--reentry (path &optional git-future flatten-future)
"Reopen dirs below PATH.
GIT-INFO is passed through from the previous branch build.
GIT-FUTURE and FLATTEN-FUTURE are passed through from the previous branch build.
PATH: Node Path
GIT-INFO: Pfuture | Map<String, String>"
@@ -1198,13 +1218,19 @@ GIT-INFO: Pfuture | Map<String, String>"
;; so the process can continue
(setf (treemacs-dom-node->reentry-nodes actual-dom-node)
(treemacs-dom-node->reentry-nodes to-reopen-dom-node))
(treemacs--reopen-node (treemacs-goto-node reopen-path) git-info))))))
(treemacs--reopen-node
(treemacs-goto-node reopen-path)
git-future
flatten-future))))))
(defun treemacs--reopen-node (btn &optional git-info)
(defun treemacs--reopen-node (btn &optional git-future flatten-future)
"Reopen file BTN.
GIT-INFO is passed through from the previous branch build."
GIT-FUTURE and FLATTEN-FUTURE are passed through from the previous branch build."
(pcase (treemacs-button-get btn :state)
('dir-node-closed (treemacs--expand-dir-node btn :git-future git-info))
('dir-node-closed (treemacs--expand-dir-node
btn
:git-future git-future
:flatten-future flatten-future))
('file-node-closed (treemacs--expand-file-node btn))
('tag-node-closed (treemacs--expand-tag-node btn))
('root-node-closed (treemacs--expand-root-node btn))