update packages

This commit is contained in:
2021-01-08 19:32:30 +01:00
parent ce8f24d28a
commit f5649dceab
467 changed files with 26642 additions and 22487 deletions

View File

@@ -1,6 +1,6 @@
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
;; Copyright (C) 2020 Alexander Miller
;; Copyright (C) 2021 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
@@ -17,6 +17,7 @@
;;; Commentary:
;;; Functions relating to using the mouse in treemacs.
;;; NOTE: This module is lazy-loaded.
;;; Code:
@@ -34,6 +35,26 @@
(require 'cl-lib)
(require 'treemacs-macros))
(treemacs-import-functions-from "treemacs-interface"
treemacs-add-project-to-workspace)
(defvar treemacs--mouse-project-list-functions
'(("Add Project.el project" . treemacs--builtin-project-mouse-selection-menu)))
(defun treemacs--builtin-project-mouse-selection-menu ()
"Build a mouse selection menu for project.el projects."
(if (eq project--list 'unset)
(list (vector "Project.el list is empty" #'ignore))
(-let [projects
(->> project--list
(--map (treemacs-canonical-path (car it)))
(--reject (treemacs-is-path it :in-workspace))
(-sort #'string<))]
(if (null projects)
(list (vector "All Project.el projects are alread in the workspace" #'ignore))
(--map (vector it (lambda () (interactive) (treemacs-add-project-to-workspace it))) projects)))))
;;;###autoload
(defun treemacs-leftclick-action (event)
"Move focus to the clicked line.
Must be bound to a mouse click, or EVENT will not be supplied."
@@ -53,8 +74,9 @@ Must be bound to a mouse click, or EVENT will not be supplied."
:no-error t))
(treemacs--evade-image)))
;;;###autoload
(defun treemacs-doubleclick-action (event)
"Run the appropriate doubeclick action for the current node.
"Run the appropriate double-click action for the current node.
In the default configuration this means to do the same as `treemacs-RET-action'.
This function's exact configuration is stored in
@@ -74,6 +96,7 @@ Must be bound to a mouse click, or EVENT will not be supplied."
(treemacs-pulse-on-failure "No double click action defined for node of type %s."
(propertize (format "%s" state) 'face 'font-lock-type-face))))))
;;;###autoload
(defun treemacs-single-click-expand-action (event)
"A modified single-leftclick action that expands the clicked nodes.
Can be bound to <mouse1> if you prefer to expand nodes with a single click
@@ -100,6 +123,7 @@ Clicking on icons will expand a file's tags, just like
(funcall (cdr (assoc state treemacs-doubleclick-actions-config)))))
(treemacs--evade-image)))
;;;###autoload
(defun treemacs-dragleftclick-action (event)
"Drag a file/dir node to be opened in a window.
Must be bound to a mouse click, or EVENT will not be supplied."
@@ -113,6 +137,7 @@ Must be bound to a mouse click, or EVENT will not be supplied."
(find-file path))
:no-match-action (ignore))))))
;;;###autoload
(defun treemacs-define-doubleclick-action (state action)
"Define the behaviour of `treemacs-doubleclick-action'.
Determines that a button with a given STATE should lead to the execution of
@@ -196,6 +221,7 @@ and ignore any prefix argument."
(propertize (treemacs-with-button-buffer btn (treemacs--get-label-of btn)) 'face 'treemacs-tags-face)))
(_ (error "[Treemacs] '%s' is an invalid value for treemacs-goto-tag-strategy" treemacs-goto-tag-strategy)))))))
;;;###autoload
(defun treemacs-rightclick-menu (event)
"Show a contextual right click menu based on click EVENT."
(interactive "e")
@@ -232,22 +258,27 @@ and ignore any prefix argument."
["--" #'ignore :visible ,(check node)]
["Rename" treemacs-rename :visible ,(check node)]
["Delete" treemacs-delete :visible ,(check node)]
["Copy" treemacs-copy-file :visible ,(check node)]
["Move" treemacs-move-file :visible ,(check node)]
("Copy"
["Copy File" treemacs-copy-file :visible ,(check node)]
["Copy Absolute Path" treemacs-copy-absolute-path-at-point :visible ,(check node)]
["Copy Relative Path" treemacs-copy-relative-path-at-point :visible ,(check node)]
["Copy Project Path" treemacs-copy-project-path-at-point :visible ,(check node)])
["--" #'ignore t]
("Projects"
["Add Project" treemacs-add-project]
["Add Projectile Project" treemacs-projectile :visible (featurep 'treemacs-projectile)]
["Remove Project" treemacs-remove-project-from-workspace :visible ,(check project)]
["Rename Project" treemacs-rename-project :visible ,(check project)])
["Add Project" treemacs-add-project]
,@(--map `(,(car it) ,@(funcall (cdr it)))
treemacs--mouse-project-list-functions)
["Remove Project" treemacs-remove-project-from-workspace :visible ,(check project)]
["Rename Project" treemacs-rename-project :visible ,(check project)])
("Workspaces"
["Edit Workspaces" treemacs-edit-workspaces]
["Create Workspace" treemacs-create-workspace]
["Remove Worspace" treemacs-remove-workspace]
["Rename Workspace" treemacs-rename-workspace]
["Switch Worspaces" treemacs-switch-workspace]
["Set Fallback Worspace" treemacs-set-fallback-workspace])
["Edit Workspaces" treemacs-edit-workspaces]
["Create Workspace" treemacs-create-workspace]
["Remove Workspace" treemacs-remove-workspace]
["Rename Workspace" treemacs-rename-workspace]
["Switch Workspace" treemacs-switch-workspace]
["Set Fallback Workspace" treemacs-set-fallback-workspace])
("Toggles"
[,(format "Dotfile Visibility (Currently %s)"
(if treemacs-show-hidden-files "Enabled" "Disabled"))
@@ -265,8 +296,16 @@ and ignore any prefix argument."
["Show Helpful Hydra" treemacs-helpful-hydra]
["Show Active Extensions" treemacs-show-extensions]
["Show Changelog" treemacs-show-changelog]))))
(choice (x-popup-menu event menu)))
(when choice (call-interactively (lookup-key menu (apply 'vector choice))))
(choice (x-popup-menu event menu))
(cmd (lookup-key menu (apply 'vector choice))))
;; In the terminal clicking on a nested menu item does not expand it, but actually
;; selects it as the chosen use option. So as a workaround we need to manually go
;; thtough the menus until we land on an executable command.
(while (not (commandp cmd))
(setf menu choice
choice (x-popup-menu event cmd)
cmd (lookup-key cmd (apply 'vector choice))))
(when cmd (call-interactively cmd))
(hl-line-highlight)))))
(provide 'treemacs-mouse-interface)