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
@@ -45,11 +45,18 @@
treemacs-refresh
treemacs-version
treemacs-edit-workspaces)
(treemacs-import-functions-from "treemacs-bookmarks"
treemacs-add-bookmark
treemacs--make-bookmark-record)
(declare-function treemacs--helpful-hydra/body "treemacs-mode")
(treemacs-import-functions-from "treemacs-hydras"
treemacs-helpful-hydra
treemacs-common-helpful-hydra
treemacs-advanced-helpful-hydra)
(treemacs-import-functions-from "treemacs-tags"
treemacs--create-imenu-index-functione)
(defvar bookmark-make-record-function)
@@ -76,183 +83,6 @@ Will be set by `treemacs--post-command'.")
ob)
"Treemacs' own eldoc obarray.")
(cl-defun treemacs--find-keybind (func &optional (pad 8))
"Find the keybind for FUNC in treemacs.
Return of cons of the key formatted for inclusion in the hydra string, including
a minimum width for alignment, and the key itself for the hydra heads.
Prefer evil keybinds, otherwise pick the first result."
(-if-let (keys (where-is-internal func))
(let ((key
(key-description
(-if-let (evil-keys (--first (eq 'treemacs-state (aref it 0)) keys))
(--map (aref evil-keys it) (number-sequence 1 (- (length evil-keys) 1)))
(--map (aref (car keys) it) (number-sequence 0 (- (length (car keys)) 1)))))))
(setf key
(s-replace-all
'(("<return>" . "RET")
("<left>" . "LEFT")
("<right>" . "RIGHT")
("<up>" . "UP")
("<down>" . "DOWN")
("^" . "C-")
("⇢⌥" . ">O-")
("" . "O-")
("⇢⌘" . ">#-")
("" . "#-")
("" . "S-"))
key))
(cons (s-pad-right pad " " (format "_%s_:" key)) key))
(cons (s-pad-right pad " " (format "_%s_:" " ")) " ")))
(defun treemacs-helpful-hydra ()
"Summon the helpful hydra to show you the treemacs keymap.
If the hydra, for whatever reason, is unable the find the key a command is bound
to it will instead show a blank."
(interactive)
(-if-let (b (treemacs-get-local-buffer))
(with-current-buffer b
(let*
((title (format (propertize "Treemacs %s Helpful Hydra" 'face 'treemacs-help-title-face) (treemacs-version)))
(column-nav (propertize "Navigation" 'face 'treemacs-help-column-face))
(column-nodes (propertize "Opening Nodes" 'face 'treemacs-help-column-face))
(column-files (propertize "File Management" 'face 'treemacs-help-column-face))
(column-toggles (propertize "Toggles " 'face 'treemacs-help-column-face))
(column-projects (propertize "Projects" 'face 'treemacs-help-column-face))
(column-ws (propertize "Workspaces" 'face 'treemacs-help-column-face))
(column-misc (propertize "Misc." 'face 'treemacs-help-column-face))
(key-root-up (treemacs--find-keybind #'treemacs-root-up))
(key-root-down (treemacs--find-keybind #'treemacs-root-down))
(key-next-line (treemacs--find-keybind #'treemacs-next-line))
(key-prev-line (treemacs--find-keybind #'treemacs-previous-line))
(key-next-neighbour (treemacs--find-keybind #'treemacs-next-neighbour))
(key-prev-neighbour (treemacs--find-keybind #'treemacs-previous-neighbour))
(key-goto-parent (treemacs--find-keybind #'treemacs-goto-parent-node))
(key-ret (treemacs--find-keybind #'treemacs-RET-action))
(key-tab (treemacs--find-keybind #'treemacs-TAB-action))
(key-open (treemacs--find-keybind #'treemacs-visit-node-no-split))
(key-open-horiz (treemacs--find-keybind #'treemacs-visit-node-horizontal-split))
(key-open-vert (treemacs--find-keybind #'treemacs-visit-node-vertical-split))
(key-open-ace (treemacs--find-keybind #'treemacs-visit-node-ace))
(key-open-ace-h (treemacs--find-keybind #'treemacs-visit-node-ace-horizontal-split))
(key-open-ace-v (treemacs--find-keybind #'treemacs-visit-node-ace-vertical-split))
(key-open-ext (treemacs--find-keybind #'treemacs-visit-node-in-external-application))
(key-open-mru (treemacs--find-keybind #'treemacs-visit-node-in-most-recently-used-window))
(key-create-file (treemacs--find-keybind #'treemacs-create-file))
(key-create-dir (treemacs--find-keybind #'treemacs-create-dir))
(key-rename (treemacs--find-keybind #'treemacs-rename))
(key-delete (treemacs--find-keybind #'treemacs-delete))
(key-follow-mode (treemacs--find-keybind #'treemacs-follow-mode))
(key-fringe-mode (treemacs--find-keybind #'treemacs-fringe-indicator-mode))
(key-fwatch-mode (treemacs--find-keybind #'treemacs-filewatch-mode))
(key-git-mode (treemacs--find-keybind #'treemacs-git-mode))
(key-show-dotfiles (treemacs--find-keybind #'treemacs-toggle-show-dotfiles))
(key-toggle-width (treemacs--find-keybind #'treemacs-toggle-fixed-width))
(key-refresh (treemacs--find-keybind #'treemacs-refresh))
(key-set-width (treemacs--find-keybind #'treemacs-set-width))
(key-copy-path (treemacs--find-keybind #'treemacs-copy-path-at-point))
(key-copy-root (treemacs--find-keybind #'treemacs-copy-project-root))
(key-copy-file (treemacs--find-keybind #'treemacs-copy-file))
(key-move-file (treemacs--find-keybind #'treemacs-move-file))
(key-resort (treemacs--find-keybind #'treemacs-resort))
(key-bookmark (treemacs--find-keybind #'treemacs-add-bookmark))
(key-down-next-w (treemacs--find-keybind #'treemacs-next-line-other-window))
(key-up-next-w (treemacs--find-keybind #'treemacs-previous-line-other-window))
(key-add-project (treemacs--find-keybind #'treemacs-add-project-to-workspace 12))
(key-remove-project (treemacs--find-keybind #'treemacs-remove-project-from-workspace 12))
(key-rename-project (treemacs--find-keybind #'treemacs-rename-project 12))
(key-close-above (treemacs--find-keybind #'treemacs-collapse-parent-node))
(key-edit-ws (treemacs--find-keybind #'treemacs-edit-workspaces 12))
(key-create-ws (treemacs--find-keybind #'treemacs-create-workspace 12))
(key-remove-ws (treemacs--find-keybind #'treemacs-remove-workspace 12))
(key-rename-ws (treemacs--find-keybind #'treemacs-rename-workspace 12))
(key-switch-ws (treemacs--find-keybind #'treemacs-switch-workspace 12))
(key-fallback-ws (treemacs--find-keybind #'treemacs-set-fallback-workspace 12))
(hydra-str
(format
"
%s
%s │ %s │ %s │ %s │ %s │ %s │ %s
―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
%s next Line │ %s dwim TAB │ %s create file │ %s follow mode │ %s add project │ %s Edit Workspaces │ %s refresh
%s prev line │ %s dwim RET │ %s create dir │ %s filewatch mode │ %s remove project │ %s Create Workspace │ %s (re)set width
%s next neighbour │ %s open no split │ %s rename │ %s git mode │ %s rename project │ %s Remove Workspace │ %s copy path
%s prev neighbour │ %s open horizontal │ %s delete │ %s show dotfiles │ │ %s Rename Workspace │ %s copy root
%s goto parent │ %s open vertical │ %s copy │ %s resizability │ │ %s Switch Workspace │ %s re-sort
%s down next window │ %s open ace │ %s move │ %s fringe indicator │ │ %s Set Fallback │ %s bookmark
%s up next window │ %s open ace horizontal │ │ │ │ │
%s root up │ %s open ace vertical │ │ │ │ │
%s root down │ %s open mru window │ │ │ │ │
│ %s open externally │ │ │ │ │
│ %s close parent │ │ │ │ │
"
title
column-nav column-nodes column-files column-toggles column-projects column-ws column-misc
(car key-next-line) (car key-tab) (car key-create-file) (car key-follow-mode) (car key-add-project) (car key-edit-ws) (car key-refresh)
(car key-prev-line) (car key-ret) (car key-create-dir) (car key-fwatch-mode) (car key-remove-project) (car key-create-ws) (car key-set-width)
(car key-next-neighbour) (car key-open) (car key-rename) (car key-git-mode) (car key-rename-project) (car key-remove-ws) (car key-copy-path)
(car key-prev-neighbour) (car key-open-horiz) (car key-delete) (car key-show-dotfiles) (car key-rename-ws) (car key-copy-root)
(car key-goto-parent) (car key-open-vert) (car key-copy-file) (car key-toggle-width) (car key-switch-ws) (car key-resort)
(car key-down-next-w) (car key-open-ace) (car key-move-file) (car key-fringe-mode) (car key-fallback-ws) (car key-bookmark)
(car key-up-next-w) (car key-open-ace-h)
(car key-root-up) (car key-open-ace-v)
(car key-root-down) (car key-open-mru)
(car key-open-ext)
(car key-close-above)
)))
(eval
`(defhydra treemacs--helpful-hydra (:exit nil :hint nil :columns 5)
,hydra-str
(,(cdr key-next-line) #'treemacs-next-line)
(,(cdr key-prev-line) #'treemacs-previous-line)
(,(cdr key-root-up) #'treemacs-root-up)
(,(cdr key-root-down) #'treemacs-root-down)
(,(cdr key-down-next-w) #'treemacs-next-line-other-window)
(,(cdr key-up-next-w) #'treemacs-previous-line-other-window)
(,(cdr key-next-neighbour) #'treemacs-next-neighbour)
(,(cdr key-prev-neighbour) #'treemacs-previous-neighbour)
(,(cdr key-goto-parent) #'treemacs-goto-parent-node)
(,(cdr key-ret) #'treemacs-RET-action)
(,(cdr key-tab) #'treemacs-TAB-action)
(,(cdr key-open) #'treemacs-visit-node-no-split)
(,(cdr key-open-horiz) #'treemacs-visit-node-horizontal-split)
(,(cdr key-open-vert) #'treemacs-visit-node-vertical-split)
(,(cdr key-open-ace) #'treemacs-visit-node-ace)
(,(cdr key-open-ace-h) #'treemacs-visit-node-ace-horizontal-split)
(,(cdr key-open-ace-v) #'treemacs-visit-node-ace-vertical-split)
(,(cdr key-open-mru) #'treemacs-visit-node-in-most-recently-used-window)
(,(cdr key-open-ext) #'treemacs-visit-node-in-external-application)
(,(cdr key-create-file) #'treemacs-create-file)
(,(cdr key-create-dir) #'treemacs-create-dir)
(,(cdr key-rename) #'treemacs-rename)
(,(cdr key-delete) #'treemacs-delete)
(,(cdr key-follow-mode) #'treemacs-follow-mode)
(,(cdr key-show-dotfiles) #'treemacs-toggle-show-dotfiles)
(,(cdr key-toggle-width) #'treemacs-toggle-fixed-width)
(,(cdr key-fringe-mode) #'treemacs-fringe-indicator-mode)
(,(cdr key-refresh) #'treemacs-refresh)
(,(cdr key-set-width) #'treemacs-set-width)
(,(cdr key-copy-path) #'treemacs-copy-path-at-point)
(,(cdr key-copy-root) #'treemacs-copy-project-root)
(,(cdr key-copy-file) #'treemacs-copy-file)
(,(cdr key-move-file) #'treemacs-move-file)
(,(cdr key-git-mode) #'treemacs-git-mode)
(,(cdr key-fwatch-mode) #'treemacs-filewatch-mode)
(,(cdr key-resort) #'treemacs-resort)
(,(cdr key-bookmark) #'treemacs-add-bookmark)
(,(cdr key-add-project) #'treemacs-add-project-to-workspace)
(,(cdr key-remove-project) #'treemacs-remove-project-from-workspace)
(,(cdr key-rename-project) #'treemacs-rename-project)
(,(cdr key-close-above) #'treemacs-collapse-parent-node)
(,(cdr key-edit-ws) #'treemacs-edit-workspaces)
(,(cdr key-create-ws) #'treemacs-create-workspace)
(,(cdr key-remove-ws) #'treemacs-remove-workspace)
(,(cdr key-rename-ws) #'treemacs-rename-workspace)
(,(cdr key-switch-ws) #'treemacs-switch-workspace)
(,(cdr key-fallback-ws) #'treemacs-set-fallback-workspace)
("?" nil "Exit"))))
(treemacs--helpful-hydra/body))
(treemacs-log-failure "The helpful hydra cannot be summoned without an existing treemacs buffer.")))
;; no warning - we cannot require treemacs.el where all the autoloaded functions
;; are defined or we get a recursive require, so it's either this or an equally
;; large block of `declare-function'
@@ -301,14 +131,16 @@ to it will instead show a blank."
"Keymap for commands that toggle state in `treemacs-mode'.")
(defvar treemacs-copy-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "y") #'treemacs-copy-path-at-point)
(define-key map (kbd "r") #'treemacs-copy-project-root)
(define-key map (kbd "a") #'treemacs-copy-absolute-path-at-point)
(define-key map (kbd "r") #'treemacs-copy-relative-path-at-point)
(define-key map (kbd "p") #'treemacs-copy-project-path-at-point)
(define-key map (kbd "f") #'treemacs-copy-file)
map)
"Keymap for copy commands in `treemacs-mode'.")
(defvar treemacs-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "?") #'treemacs-helpful-hydra)
(define-key map (kbd "?") #'treemacs-common-helpful-hydra)
(define-key map (kbd "C-?") #'treemacs-advanced-helpful-hydra)
(define-key map [down-mouse-1] #'treemacs-leftclick-action)
(define-key map [drag-mouse-1] #'treemacs-dragleftclick-action)
(define-key map [double-mouse-1] #'treemacs-doubleclick-action)
@@ -361,7 +193,9 @@ to it will instead show a blank."
"Create either a simple modeline, or integrate into spaceline."
(setq mode-line-format
(cond (treemacs-user-mode-line-format
treemacs-user-mode-line-format)
(if (eq 'none treemacs-user-mode-line-format)
nil
treemacs-user-mode-line-format))
((fboundp 'spaceline-install)
(spaceline-install
"treemacs" '((workspace-number
@@ -429,8 +263,10 @@ Will simply return `treemacs--eldoc-msg'."
;; and make a switch to visual state
(setq-local double-click-fuzz 15)
(setq-local show-paren-mode nil)
(setq-local tab-width 1)
(setq-local eldoc-documentation-function #'treemacs--eldoc-function)
(setq-local eldoc-message-commands treemacs--eldoc-obarray)
(setq-local imenu-create-index-function #'treemacs--create-imenu-index-function)
;; integrate with bookmark.el
(setq-local bookmark-make-record-function #'treemacs--make-bookmark-record)
(electric-indent-local-mode -1)
@@ -452,6 +288,14 @@ Will simply return `treemacs--eldoc-msg'."
;; the window config was changed to show treemacs
(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)
(when treemacs-window-background-color
(face-remap-add-relative 'default :background (car treemacs-window-background-color))
(face-remap-add-relative 'fringe :background (car treemacs-window-background-color))
(face-remap-add-relative 'hl-line :background (cdr treemacs-window-background-color)))
(add-hook 'window-configuration-change-hook #'treemacs--on-window-config-change)
(add-hook 'kill-buffer-hook #'treemacs--on-buffer-kill nil t)