update packages

This commit is contained in:
2025-06-22 17:08:08 +02:00
parent 54e5633369
commit 16a0a6db93
558 changed files with 68349 additions and 26568 deletions

View File

@@ -3,6 +3,9 @@
* Changelog
** current master
*** Added ~treemacs-buffer-name-function~
*** Added ~treemacs-file-follow-ignore-functions~
** v3.1
- Deprecated ~treemacs-window-background-color~ in favour of ~treemacs-window-background-face~ and
~treemacs-hl-line-face~
- Added ~treemacs-copy-absolute-path-at-point~

View File

@@ -83,7 +83,7 @@ For all other cases ORIGINAL-FN is called with original ARGS."
(with-eval-after-load 'winum
(when (boundp 'winum-ignored-buffers-regexp)
(add-to-list 'winum-ignored-buffers-regexp (regexp-quote (format "%sScoped-Buffer-" treemacs--buffer-name-prefix)))))
(add-to-list 'winum-ignored-buffers-regexp (regexp-quote treemacs--buffer-name-prefix))))
(with-eval-after-load 'ace-window
(when (boundp 'aw-ignored-buffers)

View File

@@ -100,6 +100,7 @@
treemacs-dom-node->position)
(treemacs-import-functions-from "treemacs-workspaces"
treemacs--next-project-pos
treemacs--find-workspace
treemacs-current-workspace
treemacs-workspace->projects
@@ -204,7 +205,7 @@ PATH: File Path"
(file-name-directory)
(treemacs--unslash)))))
(defconst treemacs--buffer-name-prefix " *Treemacs-")
(defconst treemacs--buffer-name-prefix " *Treemacs-Buffer-")
(defconst treemacs-dir
;; locally we're in src/elisp, installed from melpa we're at the package root
@@ -376,6 +377,16 @@ EXCLUDE-PREFIX: File Path"
project (treemacs-button-get node :project)))
project))
(defun treemacs-last-node-of-project (project)
"Find the last node in given PROJECT.
Returns nil if the project is not expanded."
(declare (side-effect-free t))
(let ((node (treemacs-project->position project)))
(when (treemacs-is-node-expanded? node)
(save-excursion
(goto-char node)
(previous-button (treemacs--next-project-pos))))))
(define-inline treemacs--prop-at-point (prop)
"Grab property PROP of the button at point.
Returns nil when there is no button at point."

View File

@@ -24,6 +24,10 @@
(require 's)
(require 'widget)
(require 'dash)
(require 'treemacs-macros)
(treemacs-import-functions-from "treemacs-scope"
treemacs-default-buffer-name)
(eval-when-compile
(require 'cl-lib))
@@ -127,6 +131,20 @@ indentation will be a space INTEGER pixels wide."
(const :tag "" px)))
:group 'treemacs)
(defcustom treemacs-buffer-name-function #'treemacs-default-buffer-name
"The function used to create the name of a treemacs buffer.
Value must be a function which takes a single argument - the current scope - and
returns the buffer name as a string. By default the scope is going to be the
current frame, however with packages like `treemacs-persp' it is also possible
for it to be the current perspective.
In addition, the buffer name will *always* be prefixed with
`treemacs--buffer-name-prefix', which is necessary to properly recognise
treemacs buffers and maintain compatibility with some packages like winum."
:type 'function
:group 'treemacs)
(defcustom treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
"List of directories affected by `treemacs-cleanup-litter'.
Every item in the list is a regular expression, to be recognised a directory
@@ -746,6 +764,15 @@ fallback."
:type 'boolean
:group 'treemacs-follow)
(defcustom treemacs-file-follow-ignore-functions nil
"Functions which determine if a file should not be followed.
Content should be a list of functions which take one argument - the path of the
file that might be followed - and return non-nil if the file should *not* be
followed."
:type '(list function)
:group 'treemacs-follow)
(defcustom treemacs-move-files-by-mouse-dragging t
"When non-nil treemacs will move files by dragging with the mouse."
:group 'treemacs-mouse

View File

@@ -1,102 +0,0 @@
;;; treemacs-diagnostics.el --- A tree style file viewer package -*- lexical-binding: t -*-
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; WIP implementation of diagnostics display.
;;; Code:
(require 'ht)
(require 'thunk)
(require 'dash)
(require 'overlay)
(require 'treemacs-dom)
(require 'treemacs-scope)
(require 'treemacs-workspaces)
(require 'treemacs-core-utils)
(eval-when-compile
(require 'treemacs-macros))
(defconst treemacs--diag-store (make-hash-table :size 50 :test 'equal))
(defvar treemacs--diagnostic-timer nil
"Debounce guard for the application of diagnostics.")
(defconst treemacs--apply-diagnostics-delay 3
"Debounce delay for the application of diagnostics.")
(defface treemacs-diagnostic-error-face
'((t :underline "red"))
"TODO."
:group 'treemacs-faces)
(defface treemacs-diagnostic-warning-face
'((t :underline "yellow"))
"TODO."
:group 'treemacs-faces)
(defun treemacs--reset-and-save-diagnosics (path diagnostics)
"TODO PATH DIAGNOSTICS."
(-let [ht (ht-get treemacs--diag-store path)]
(if ht
(ht-clear! ht)
(setf ht (make-hash-table :size 100 :test 'equal))
(ht-set! treemacs--diag-store path ht))
(while diagnostics
(ht-set! ht (pop diagnostics) (pop diagnostics)))))
(defun treemacs-apply-diagnostics (provider)
"Display diagnostics based on the given arguments PROVIDER.
PROVIDER should be a `thunk' (see thunk.el) that, when evaluated, returns a flat
list of consecutive path and face items.
File paths should use treemacs' canonical format - they should be absolute,
expanded and *not* have a trailing slash.
The diagnostic faces could be any face symbols or raw face literals. Treemacs
features several pre-made faces named `treemacs-diagnostic-*-face'.
This method is debounced, it will never run more often than once every 3
seconds. In addition the use of a lazy thunk ensures that potentially expensive
transformations happen only once and only when required. Performance is thus
not expected to be a major issue.
A basic example use would look like this:
\(treemacs-apply-diagnostics
(thunk-delay \\='(\"/path/to/file/x\" \\='treemacs-diagnostic-warning-face
\"/path/to/file/y\" \\='treemacs-diagnostic-error-face
\"/path/to/file/z\" \\='((:underline \"green\")))))"
(treemacs-debounce treemacs--diagnostic-timer treemacs--apply-diagnostics-delay
(treemacs-run-in-every-buffer
(save-excursion
(-each (overlays-in (point-min) (point-max)) #'delete-overlay)
(-let [diagnostics (thunk-force provider)]
(while diagnostics
(let ((path (pop diagnostics))
(state (pop diagnostics)))
(when (treemacs-is-path-visible? path)
(-let [btn (treemacs-find-file-node path)]
(-doto (make-overlay (treemacs-button-start btn) (treemacs-button-end btn))
(overlay-put 'face state))))))))
(hl-line-highlight))))
(provide 'treemacs-diagnostics)
;;; treemacs-diagnostics.el ends here

View File

@@ -65,7 +65,10 @@ not visible."
current-file
(not (s-starts-with? treemacs--buffer-name-prefix buffer-name))
(file-exists-p current-file)
(not (string= buffer-name "COMMIT_EDITMSG")))
(not (string= buffer-name "COMMIT_EDITMSG"))
(--none?
(funcall it current-file)
treemacs-file-follow-ignore-functions))
(-when-let (project-for-file (treemacs--find-project-for-buffer current-file))
(with-selected-window treemacs-window
(-let [selected-file (--if-let (treemacs-current-button)

View File

@@ -297,6 +297,8 @@ Necessary since root icons are not rectangular."
(treemacs-create-icon :file "svgrepo/list.png" :extensions (elfeed-search-mode))
(treemacs-create-icon :file "vsc/deps.png" :extensions (cask-mode))
(treemacs-create-icon :file "yaml.png" :extensions (yaml-mode))
(treemacs-create-icon :file "css.png" :extensions (css-mode))
(treemacs-create-icon :file "markdown.png" :extensions (markdown-mode))
;; file icons
(treemacs-create-icon :file "txt.png" :extensions (fallback))

View File

@@ -308,7 +308,7 @@ not work keep it on the same line."
((and prev-path (can-move-to prev-path))
(treemacs-goto-file-node prev-path))
(t
(-let [detour (treemacs--parent curr-file)]
(-when-let (detour (treemacs--parent curr-file))
(while (not (can-move-to detour))
(setf detour (treemacs--parent detour)))
(treemacs-goto-file-node detour)))))))
@@ -318,10 +318,18 @@ not work keep it on the same line."
(goto-char curr-point))
(_
;; point is on a custom node
;; TODO(2018/10/30): custom node exists predicate?
(condition-case _
(treemacs-goto-node curr-node-path)
(error (ignore)))))
(cond
((treemacs-is-path-visible? curr-node-path)
(treemacs-goto-extension-node curr-node-path))
((and next-path (treemacs-is-path-visible? next-path))
(treemacs-goto-extension-node next-path))
((and prev-path (treemacs-is-path-visible? prev-path))
(treemacs-goto-extension-node prev-path))
(t
(-when-let (detour (treemacs--parent curr-file))
(while (not (treemacs-is-path-visible? detour))
(setf detour (treemacs--parent detour)))
(treemacs-goto-extension-node detour))))))
(treemacs--evade-image)
(when (get-text-property (point) 'invisible)
(goto-char (or

View File

@@ -373,8 +373,11 @@ Will simply return `treemacs--eldoc-msg'."
(unless (member #'treemacs--on-window-config-change (default-value 'window-configuration-change-hook))
(treemacs--on-window-config-change))
;; set the parameter immediately so it can take effect when `treemacs' is called programatically
;; alongside other window layout chaning commands that might delete it again
(set-window-parameter (selected-window) 'no-delete-other-windows treemacs-no-delete-other-windows)
;; alongside other window layout chaning commands that might delete it again.
;; also check that the buffer has a window as other packages might call `treemacs-mode' on buffers
;; that have no window yet
(when (get-buffer-window (current-buffer))
(set-window-parameter (selected-window) 'no-delete-other-windows treemacs-no-delete-other-windows))
(face-remap-add-relative 'default 'treemacs-window-background-face)
(face-remap-add-relative 'fringe 'treemacs-window-background-face)

View File

@@ -1,20 +1,17 @@
(define-package "treemacs" "20250105.1321" "A tree style file explorer package"
'((emacs "26.1")
(cl-lib "0.5")
(dash "2.11.0")
(s "1.12.0")
;; -*- no-byte-compile: t; lexical-binding: nil -*-
(define-package "treemacs" "20250617.1934"
"A tree style file explorer package."
'((emacs "26.1")
(cl-lib "0.5")
(dash "2.11.0")
(s "1.12.0")
(ace-window "0.9.0")
(pfuture "1.7")
(hydra "0.13.2")
(ht "2.2")
(cfrs "1.3.2"))
:commit "32bb3dd02ddfca85661614b3b227e770fab821e2" :authors
'(("Alexander Miller" . "alexanderm@web.de"))
:maintainers
'(("Alexander Miller" . "alexanderm@web.de"))
:maintainer
'("Alexander Miller" . "alexanderm@web.de")
:url "https://github.com/Alexander-Miller/treemacs")
;; Local Variables:
;; no-byte-compile: t
;; End:
(pfuture "1.7")
(hydra "0.13.2")
(ht "2.2")
(cfrs "1.3.2"))
:url "https://github.com/Alexander-Miller/treemacs"
:commit "7109ce99853b18435a77267a15c5dd06715b54e4"
:revdesc "7109ce99853b"
:authors '(("Alexander Miller" . "alexanderm@web.de"))
:maintainers '(("Alexander Miller" . "alexanderm@web.de")))

View File

@@ -32,6 +32,7 @@
(require 'dash)
(require 'eieio)
(require 'treemacs-core-utils)
(require 'treemacs-customization)
(require 's)
(require 'inline)
@@ -199,13 +200,21 @@ NEW-SCOPE-TYPE: T: treemacs-scope"
(push (cons scope shelf) treemacs--scope-storage)
(treemacs--find-workspace (buffer-file-name)))
(treemacs-scope-shelf->kill-buffer shelf)
(let* ((name-suffix (or (treemacs-scope->current-scope-name treemacs--current-scope-type scope)
(prin1-to-string scope)))
(name (format "%sScoped-Buffer-%s*" treemacs--buffer-name-prefix name-suffix))
(let* ((name (format "%s%s"
treemacs--buffer-name-prefix
(or (funcall treemacs-buffer-name-function scope)
(treemacs-default-buffer-name scope))))
(buffer (get-buffer-create name)))
(setf (treemacs-scope-shelf->buffer shelf) buffer)
buffer)))
(defun treemacs-default-buffer-name (scope)
"Default buffer name implementation for a given SCOPE.
Appends the name of the given scope to the mandatory
`treemacs--buffer-name-prefix'."
(or (treemacs-scope->current-scope-name treemacs--current-scope-type scope)
(prin1-to-string scope)))
(defun treemacs--change-buffer-on-scope-change (&rest _)
"Switch the treemacs buffer after the current scope was changed."
(--when-let (treemacs-get-local-window)

View File

@@ -40,10 +40,9 @@ def main():
sys.exit(2)
new_state = determine_file_git_state()
old_state = face_for_status(FILE, OLD_FACE)
# nothing to do
if old_state == new_state:
if OLD_FACE == face_for_status(FILE, new_state):
sys.exit(2)
proc_list = []
@@ -74,7 +73,7 @@ def main():
propagate_state = "?"
result_list.append((path, propagate_state))
break
elif changed_proc.communicate() != b'' and changed_proc.returncode == 0:
elif changed_proc.communicate()[0] != b'' and changed_proc.returncode == 0:
result_list.append((path, "M"))
else:
result_list.append((path, "0"))
@@ -98,8 +97,8 @@ def add_git_processes(status_listings, path):
status_listings.append((path, ignored_proc, tracked_proc, changed_proc))
def determine_file_git_state():
proc = Popen(FILE_STATE_CMD + FILE, shell=True, stdout=PIPE, stderr=DEVNULL)
line = proc.stdout.readline()
proc = Popen(FILE_STATE_CMD + FILE, shell=True, stdout=PIPE, stderr=DEVNULL)
line = proc.stdout.readline()
if line:
state = line.lstrip().split(b" ")[0]
return state.decode('utf-8').strip()[0]

View File

@@ -5,7 +5,8 @@
;; Author: Alexander Miller <alexanderm@web.de>
;; Package-Requires: ((emacs "26.1") (cl-lib "0.5") (dash "2.11.0") (s "1.12.0") (ace-window "0.9.0") (pfuture "1.7") (hydra "0.13.2") (ht "2.2") (cfrs "1.3.2"))
;; Homepage: https://github.com/Alexander-Miller/treemacs
;; Version: 3.1
;; Package-Version: 20250617.1934
;; Package-Revision: 7109ce99853b
;; 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
@@ -51,7 +52,7 @@
(defconst treemacs-version
(eval-when-compile
(format "v3.1 (installed %s) @ Emacs %s"
(format "v3.2 (installed %s) @ Emacs %s"
(format-time-string "%Y.%m.%d" (current-time))
emacs-version)))