update of packages

This commit is contained in:
2023-11-04 19:26:41 +01:00
parent e162a12b58
commit 3b54a3236d
726 changed files with 297673 additions and 34585 deletions

View File

@@ -1,6 +1,6 @@
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
;; Copyright (C) 2022 Alexander Miller
;; Copyright (C) 2023 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
@@ -40,7 +40,9 @@
(require 'treemacs-macros))
(autoload 'ansi-color-apply-on-region "ansi-color")
(autoload 'aw-select "ace-window")
(treemacs-import-functions-from "ace-window"
ace-select-window)
(treemacs-import-functions-from "cfrs"
cfrs-read)
@@ -251,7 +253,7 @@ Stay in the current window with a single prefix argument ARG, or close the
treemacs window with a double prefix argument."
(interactive "P")
(treemacs--execute-button-action
:window (aw-select "Select window")
:window (ace-select-window)
:file-action (find-file (treemacs-safe-button-get btn :path))
:dir-action (dired (treemacs-safe-button-get btn :path))
:tag-section-action (treemacs--visit-or-expand/collapse-tag-node btn arg nil)
@@ -282,7 +284,7 @@ treemacs window with a double prefix argument."
(interactive "P")
(treemacs--execute-button-action
:split-function #'split-window-horizontally
:window (aw-select "Select window")
:window (ace-select-window)
:file-action (find-file (treemacs-safe-button-get btn :path))
:dir-action (dired (treemacs-safe-button-get btn :path))
:tag-section-action (treemacs--visit-or-expand/collapse-tag-node btn arg nil)
@@ -297,7 +299,7 @@ treemacs window with a double prefix argument."
(interactive "P")
(treemacs--execute-button-action
:split-function #'split-window-vertically
:window (aw-select "Select window")
:window (ace-select-window)
:file-action (find-file (treemacs-safe-button-get btn :path))
:dir-action (dired (treemacs-safe-button-get btn :path))
:tag-section-action (treemacs--visit-or-expand/collapse-tag-node btn arg nil)
@@ -526,6 +528,24 @@ With a prefix ARG substract the increment value multiple times."
(kill-new copied)
(treemacs-pulse-on-success "Copied project path: %s" (propertize copied 'face 'font-lock-string-face))))))
(defun treemacs-paste-dir-at-point-to-minibuffer ()
"Paste the directory at point into the minibuffer.
This is used by the \"Paste here\" mouse menu button, which assumes that we are
running `treemacs--copy-or-move', so that pasting this path into the minibuffer
allows us to copy/move the previously-selected file into the path at point."
(interactive)
(treemacs-block
(treemacs-error-return-if (not (active-minibuffer-window))
"Minibuffer is not active")
(let* ((path-at-point (treemacs--prop-at-point :path))
(dir (if (file-directory-p path-at-point)
path-at-point
(file-name-directory path-at-point))))
(select-window (active-minibuffer-window))
(delete-region (minibuffer-prompt-end) (point-max))
(insert dir))
(message "Copied from treemacs")))
(defun treemacs-delete-other-windows ()
"Same as `delete-other-windows', but will not delete the treemacs window.
If this command is run when the treemacs window is selected `next-window' will
@@ -540,7 +560,7 @@ also not be deleted."
;; that we shouldn't prevent from running, so we just restore treemacs instead of preventing
;; it from being deleted
;; 'no-delete-other-windows could be used instead, but it's only available for emacs 26
(when w
(when (and w (not (equal 'visible (treemacs-current-visibility))))
(treemacs--select-not-visible-window)))))
(defun treemacs-temp-resort-root (&optional sort-method)
@@ -707,7 +727,6 @@ For slower scrolling see `treemacs-previous-line-other-window'"
(treemacs-return-if (string-equal old-name new-name)
(treemacs-pulse-on-failure "The new name is the same as the old name."))
(setf (treemacs-project->name project) new-name)
(treemacs--forget-last-highlight)
;; after renaming, delete and redisplay the project
(goto-char (treemacs-button-end project-btn))
(delete-region (line-beginning-position) (line-end-position))
@@ -887,7 +906,6 @@ With a prefix ARG also forget about all the nodes opened in the project."
(treemacs-pulse-on-failure "There is nothing to close here.")
(-let [btn (treemacs-project->position project)]
(when (treemacs-is-node-expanded? btn)
(treemacs--forget-last-highlight)
(goto-char btn)
(treemacs--collapse-root-node btn arg)
(treemacs--maybe-recenter 'on-distance)))
@@ -900,7 +918,6 @@ With a prefix ARG remember which nodes were expanded."
(-when-let (buffer (treemacs-get-local-buffer))
(with-current-buffer buffer
(save-excursion
(treemacs--forget-last-highlight)
(dolist (project (treemacs-workspace->projects (treemacs-current-workspace)))
(-when-let (pos (treemacs-project->position project))
(when (eq 'root-node-open (treemacs-button-get pos :state))
@@ -1103,7 +1120,6 @@ Prefix ARG will be passed on to the closing function
(-if-let* ((btn (treemacs-current-button))
(parent (button-get btn :parent)))
(progn
(treemacs--forget-last-highlight)
(goto-char parent)
(treemacs-toggle-node arg)
(treemacs--evade-image))
@@ -1308,10 +1324,40 @@ With a prefix ARG switch to the previous workspace instead."
(new-idx (% (+ ws-count (if arg (1- idx) (1+ idx))) ws-count))
(new-ws (nth new-idx treemacs--workspaces)))
(treemacs-do-switch-workspace new-ws)
(treemacs-pulse-on-success "Switched to workdpace '%s'"
(treemacs-pulse-on-success "Switched to workspace '%s'"
(propertize (treemacs-workspace->name new-ws)
'face 'font-lock-string-face)))))
(defun treemacs-create-workspace-from-project (&optional arg)
"Create (and switch to) a workspace containing only the current project.
By default uses the project at point in the treemacs buffer. If there is no
treemacs buffer, then the project of the current file is used instead. With a
prefix ARG it is also possible to interactively select the project."
(interactive "P")
(treemacs-block
(-let [project nil]
(if (eq t treemacs--in-this-buffer)
(setf project (treemacs-project-of-node (treemacs-current-button)))
(setf project (treemacs--find-project-for-buffer (buffer-file-name (current-buffer))))
(treemacs-select-window))
(when (or arg (null project))
(setf project (treemacs--select-project-by-name))
(treemacs-return-if (null project)))
(let* ((ws-name (treemacs-project->name project))
(new-ws (treemacs--find-workspace-by-name ws-name)))
(if new-ws
(setf (treemacs-workspace->projects new-ws) (list project))
(-let [ws-create-result (treemacs-do-create-workspace ws-name)]
(treemacs-error-return-if (not (equal 'success (car ws-create-result)))
"Something went wrong when creating a new workspace: %s" ws-create-result)
(setf new-ws (cdr ws-create-result))
(setf (treemacs-workspace->projects new-ws) (list project))
(treemacs--persist)))
(treemacs-do-switch-workspace new-ws)
(treemacs-pulse-on-success "Switched to project workspace '%s'"
(propertize ws-name 'face 'font-lock-type-face))))))
(defun treemacs-icon-catalogue ()
"Showcase a catalogue of all treemacs themes and their icons."
(interactive)