update packages
This commit is contained in:
@@ -6,9 +6,15 @@
|
||||
- Deprecated ~treemacs-window-background-color~ in favour of ~treemacs-window-background-face~ and
|
||||
~treemacs-hl-line-face~
|
||||
- Added ~treemacs-copy-absolute-path-at-point~
|
||||
- Made it possible to disbale workspace with a ~COMMENT~ directive
|
||||
- Added ~treemacs-start-on-boot~
|
||||
- Made it possible to disable workspace with a ~COMMENT~ directive
|
||||
- Added option to sort alphabetic-numerically (as with ~string-version-lessp~)
|
||||
- Added ~:on-expand~ and ~:on-collapse~ options to treelib nodes
|
||||
- Added options to define visit-actions in extensions api.
|
||||
- Added ~treemacs-after-visit-functions~.
|
||||
- Added option to disable moving files by dragging with your mouse.
|
||||
- Better performance when ~treemacs-collapse-dirs~ is used for many sub-directories.
|
||||
- Added ~treemacs-git-executable~.
|
||||
** v3.1
|
||||
- Added ~treemacs-create-workspace-from-project~ command
|
||||
- Added ~treemacs-project-follow-into-home~ option
|
||||
|
||||
BIN
lisp/treemacs/icons/default/svgrepo/inbox.png
Normal file
BIN
lisp/treemacs/icons/default/svgrepo/inbox.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 4.4 KiB |
BIN
lisp/treemacs/icons/default/vsc/terraform.png
Normal file
BIN
lisp/treemacs/icons/default/vsc/terraform.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
@@ -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
|
||||
@@ -258,8 +258,18 @@ GIT-FACE is taken from the latest git cache, or nil if it's not known."
|
||||
(ann (treemacs-get-annotation path))
|
||||
(btn-start (treemacs-button-start ,btn))
|
||||
(btn-end (treemacs-button-end ,btn)))
|
||||
(if (null ann)
|
||||
|
||||
;; delete current suffix if present
|
||||
(goto-char ,btn)
|
||||
(goto-char (or (next-single-property-change
|
||||
,btn
|
||||
'treemacs-suffix-annotation
|
||||
(current-buffer)
|
||||
(line-end-position))
|
||||
btn-end))
|
||||
(delete-region (point) (line-end-position))
|
||||
|
||||
(if (null ann)
|
||||
;; No annotation - just put git face
|
||||
(when ,git-face
|
||||
(put-text-property btn-start btn-end 'face ,git-face)
|
||||
@@ -271,6 +281,7 @@ GIT-FACE is taken from the latest git cache, or nil if it's not known."
|
||||
:git-face ,git-face
|
||||
:face-value ,git-face)))
|
||||
|
||||
;; annotation present, apply everything
|
||||
(let ((face-value (treemacs-annotation->face-value ann))
|
||||
(suffix-value (treemacs-annotation->suffix-value ann))
|
||||
(faces (treemacs-annotation->face ann))
|
||||
@@ -298,14 +309,6 @@ GIT-FACE is taken from the latest git cache, or nil if it's not known."
|
||||
new-face-value))
|
||||
|
||||
;; Suffix
|
||||
(goto-char ,btn)
|
||||
(goto-char (or (next-single-property-change
|
||||
,btn
|
||||
'treemacs-suffix-annotation
|
||||
(current-buffer)
|
||||
(line-end-position))
|
||||
btn-end))
|
||||
(delete-region (point) (line-end-position))
|
||||
(when suffix-value (insert suffix-value))))))))
|
||||
|
||||
(defun treemacs-apply-single-annotation (path)
|
||||
|
||||
@@ -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
|
||||
@@ -155,6 +155,7 @@ Real implementation will be `fset' based on `treemacs-git-mode' value."
|
||||
(command `(,treemacs-python-executable
|
||||
"-O"
|
||||
,treemacs--git-status.py
|
||||
,treemacs-git-executable
|
||||
,git-root
|
||||
,(number-to-string treemacs-max-git-entries)
|
||||
,treemacs-git-command-pipe
|
||||
@@ -197,7 +198,7 @@ GIT-FUTURE: Pfuture"
|
||||
"Start a simple git status process for files under PATH."
|
||||
(let* ((default-directory (file-truename path))
|
||||
(process-environment (cons "GIT_OPTIONAL_LOCKS=0" process-environment))
|
||||
(future (pfuture-new "git" "status" "--porcelain" "--ignored=matching" "-z" ".")))
|
||||
(future (pfuture-new treemacs-git-executable "status" "--porcelain" "--ignored=matching" "-z" ".")))
|
||||
(process-put future 'default-directory default-directory)
|
||||
future))
|
||||
|
||||
@@ -285,7 +286,8 @@ OVERRIDE-STATUS: Boolean"
|
||||
"NONE")))
|
||||
(cmd `(,treemacs-python-executable
|
||||
"-O"
|
||||
,treemacs--single-file-git-status.py ,file ,current-face ,@parents)))
|
||||
,treemacs--single-file-git-status.py
|
||||
,treemacs-git-executable ,file ,current-face ,@parents)))
|
||||
(pfuture-callback cmd
|
||||
:directory parent
|
||||
:name "Treemacs Update Single File Process"
|
||||
@@ -330,7 +332,7 @@ Used when asynchronous processes report back git changes."
|
||||
(when btn
|
||||
(treemacs--do-apply-annotation btn ,git-face))))))
|
||||
|
||||
(defun treemacs--collapsed-dirs-process (path project)
|
||||
(defun treemacs--flattened-dirs-process (path project)
|
||||
"Start a new process to determine directories to collapse under PATH.
|
||||
Only starts the process if PROJECT is locally accessible (i.e. exists, and
|
||||
is not remote.)
|
||||
@@ -349,24 +351,34 @@ Every string list consists of the following elements:
|
||||
(when (and (> treemacs-collapse-dirs 0)
|
||||
treemacs-python-executable
|
||||
(treemacs-project->is-local-and-readable? project))
|
||||
;; needs to be set or we'll run into trouble when deleting
|
||||
;; haven't taken the time to figure out why, so let's just leave it at that
|
||||
(-let [default-directory path]
|
||||
(pfuture-new treemacs-python-executable
|
||||
"-O"
|
||||
treemacs--dirs-to-collapse.py
|
||||
path
|
||||
(number-to-string treemacs-collapse-dirs)
|
||||
(if treemacs-show-hidden-files "t" "x")))))
|
||||
(let (;; needs to be set or we'll run into trouble when deleting
|
||||
;; haven't taken the time to figure out why, so let's just leave it at that
|
||||
(default-directory path)
|
||||
(search-paths nil))
|
||||
(treemacs-walk-reentry-dom (treemacs-find-in-dom path)
|
||||
(lambda (node)
|
||||
(-let [key (treemacs-dom-node->key node)]
|
||||
(when (stringp key) (push key search-paths)))))
|
||||
(-let [command
|
||||
`(,treemacs-python-executable
|
||||
"-O"
|
||||
,treemacs--dirs-to-collapse.py
|
||||
,(number-to-string treemacs-collapse-dirs)
|
||||
,(if treemacs-show-hidden-files "t" "x")
|
||||
,@search-paths)]
|
||||
(apply #'pfuture-new command)))))
|
||||
|
||||
(defun treemacs--parse-collapsed-dirs (future)
|
||||
"Parse the output of collapsed dirs FUTURE.
|
||||
Splits the output on newlines, splits every line on // and swallows the first
|
||||
newline."
|
||||
(defun treemacs--parse-flattened-dirs (path future)
|
||||
"Parse the output of flattened dirs in PATH with FUTURE."
|
||||
(when future
|
||||
(-let [output (pfuture-await-to-finish future)]
|
||||
(when (= 0 (process-exit-status future))
|
||||
(read output)))))
|
||||
(-if-let (output (process-get future 'output))
|
||||
(ht-get output path)
|
||||
(let* ((stdout (pfuture-await-to-finish future))
|
||||
(output (if (= 0 (process-exit-status future))
|
||||
(read stdout)
|
||||
(ht))))
|
||||
(process-put future 'output output)
|
||||
(ht-get output path)))))
|
||||
|
||||
(defun treemacs--prefetch-gitignore-cache (path)
|
||||
"Pre-load all the git-ignored files in the given PATH.
|
||||
@@ -385,6 +397,7 @@ run because the git cache has yet to be filled."
|
||||
(pfuture-callback `(,treemacs-python-executable
|
||||
"-O"
|
||||
,treemacs--find-ignored-files.py
|
||||
,treemacs-git-executable
|
||||
,@path)
|
||||
:on-error (ignore)
|
||||
:on-success
|
||||
@@ -397,7 +410,7 @@ run because the git cache has yet to be filled."
|
||||
(unless cache
|
||||
(setf cache (make-hash-table :size 20 :test 'equal))
|
||||
(ht-set! treemacs--git-cache root cache))
|
||||
(ht-set! cache file "!")
|
||||
(ht-set! cache file 'treemacs-git-ignored-face)
|
||||
(push file ignored-files)))
|
||||
(treemacs-run-in-every-buffer
|
||||
(treemacs-save-position
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs-bookmarks.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
|
||||
|
||||
@@ -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
|
||||
@@ -28,6 +28,7 @@
|
||||
(require 'treemacs-scope)
|
||||
(require 'treemacs-core-utils)
|
||||
(require 'treemacs-interface)
|
||||
(require 'treemacs-persistence)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'treemacs-macros))
|
||||
@@ -38,10 +39,13 @@
|
||||
(push '(treemacs-workspace . :never) frameset-filter-alist))
|
||||
|
||||
(with-eval-after-load 'tramp
|
||||
(setf treemacs--file-name-handler-alist
|
||||
(with-no-warnings
|
||||
(list
|
||||
(cons tramp-file-name-regexp #'tramp-file-name-handler)))))
|
||||
(setf
|
||||
treemacs--no-abbr-on-persist-prefixes
|
||||
(--map (format "/%s:" (car it)) (with-no-warnings tramp-methods))
|
||||
treemacs--file-name-handler-alist
|
||||
(with-no-warnings
|
||||
(list
|
||||
(cons tramp-file-name-regexp #'tramp-file-name-handler)))))
|
||||
|
||||
(with-eval-after-load 'recentf
|
||||
(with-no-warnings
|
||||
@@ -61,6 +65,22 @@
|
||||
|
||||
(add-hook 'eyebrowse-post-window-switch-hook #'treemacs--follow-after-eyebrowse-switch))
|
||||
|
||||
(with-eval-after-load 'windmove
|
||||
(defun treemacs--windmove-swap-state-advice (original-fn &rest args)
|
||||
"Advice for windmove-swap-state-* functions to ignore treemacs.
|
||||
These commands do not seem to be compatible with side windows (and thus treemacs
|
||||
in its default configuration), so this advice changes them to do nothing when
|
||||
the `selected-window' is treemacs.
|
||||
|
||||
For all other cases ORIGINAL-FN is called with original ARGS."
|
||||
(unless (and treemacs-display-in-side-window
|
||||
(treemacs-is-treemacs-window-selected?))
|
||||
(apply original-fn args)))
|
||||
|
||||
(with-no-warnings
|
||||
(advice-add 'windmove-swap-states-in-direction
|
||||
:around #'treemacs--windmove-swap-state-advice)))
|
||||
|
||||
(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)))))
|
||||
@@ -142,11 +162,6 @@ width of the new window when the treemacs window is visible."
|
||||
(org-link-set-parameters "treemacs" :store #'treemacs-store-org-link)
|
||||
(add-hook 'org-store-link-functions #'treemacs-store-org-link))))
|
||||
|
||||
(with-eval-after-load 'evil-escape
|
||||
;; Disable old versions of evil-escape but keep newer versions active
|
||||
(when (and (boundp 'evil-escape-excluded-major-modes) (not (boundp 'evil-escape-version)))
|
||||
(add-to-list 'evil-escape-excluded-major-modes 'treemacs-mode)))
|
||||
|
||||
(when (fboundp 'context-menu-mode)
|
||||
(defun treemacs--disable-context-menu-mode ()
|
||||
(treemacs-run-in-all-derived-buffers
|
||||
|
||||
@@ -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
|
||||
@@ -90,7 +90,7 @@
|
||||
treemacs--git-status-process
|
||||
treemacs--non-simple-git-mode-enabled
|
||||
treemacs-update-single-file-git-state
|
||||
treemacs--collapsed-dirs-process)
|
||||
treemacs--flattened-dirs-process)
|
||||
|
||||
(treemacs-import-functions-from "treemacs-dom"
|
||||
treemacs-on-collapse
|
||||
@@ -1258,6 +1258,14 @@ treemacs window."
|
||||
(unless (eq next-window current-window)
|
||||
(select-window next-window))))))
|
||||
|
||||
(defun treemacs--pre-sorted-list (items)
|
||||
"Return a lambda that includes sorting metadata for `completing-read'.
|
||||
Ensures that the order of ITEMS is not changed during completion."
|
||||
(lambda (string pred action)
|
||||
(pcase action
|
||||
('metadata `(metadata (display-sort-function . ,#'identity)))
|
||||
(_ (complete-with-action action items string pred)))))
|
||||
|
||||
(provide 'treemacs-core-utils)
|
||||
|
||||
;;; treemacs-core-utils.el ends here
|
||||
|
||||
@@ -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
|
||||
@@ -104,6 +104,12 @@
|
||||
:prefix "treemacs-"
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
|
||||
(defgroup treemacs-mouse nil
|
||||
"Customisations for treemacs' mouse integration."
|
||||
:group 'treemacs
|
||||
:prefix "treemacs-"
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
|
||||
(defgroup treemacs-window nil
|
||||
"Customisations for the behaviour of the treemacs window."
|
||||
:group 'treemacs
|
||||
@@ -234,8 +240,7 @@ of how this config works and how to modify it."
|
||||
:type '(alist :key-type symbol :value-type treemacs-mouse-action)
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-default-visit-action
|
||||
'treemacs-visit-node-no-split
|
||||
(defcustom treemacs-default-visit-action 'treemacs-visit-node-no-split
|
||||
"Defines the behaviour of `treemacs-visit-node-default'."
|
||||
:type 'treemacs-default-action
|
||||
:group 'treemacs)
|
||||
@@ -608,7 +613,12 @@ Can be set to nil to disable workspace persistence."
|
||||
"Action to perform when a persisted project is not found on the disk.
|
||||
If the project is not found, the project can either be kept in the project list,
|
||||
or removed from it. If the project is removed, when projects are persisted, the
|
||||
missing project will not appear in the project list next time Emacs is started."
|
||||
missing project will not appear in the project list next time Emacs is started.
|
||||
|
||||
Possible values are:
|
||||
- `ask'
|
||||
- `remove'
|
||||
- `keep'"
|
||||
:type '(choice (const :tag "Ask whether to remove" ask)
|
||||
(const :tag "Remove without asking" remove)
|
||||
(const :tag "Keep without asking" keep))
|
||||
@@ -736,6 +746,11 @@ fallback."
|
||||
:type 'boolean
|
||||
: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
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom treemacs-deferred-git-apply-delay 0.5
|
||||
"Delay in seconds of idle time before git fontification is applied.
|
||||
This is only relevant when using the deferred variant of git-mode."
|
||||
@@ -762,6 +777,11 @@ the python3 binary."
|
||||
:type 'string
|
||||
:group 'treemacs-git)
|
||||
|
||||
(defcustom treemacs-git-executable "git"
|
||||
"The git executable used by treemacs."
|
||||
:type 'string
|
||||
:group 'treemacs-git)
|
||||
|
||||
(defcustom treemacs-git-command-pipe ""
|
||||
"Text to be appended to treemacs' git command.
|
||||
With `treemacs-git-mode' the command
|
||||
@@ -1096,6 +1116,13 @@ current scope (frame or perspective) it was found for."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-after-visit-functions nil
|
||||
"Hooks that run after treemacs executes a `treemacs-visit-node-***' command.
|
||||
Does not apply to `treemacs-visit-node-in-external-application'. Hooks are
|
||||
expected to take 1 argument, which is the buffer where the node is visited in."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defconst treemacs-last-period-regex-value "\\.[^.]*\\'")
|
||||
(defconst treemacs-first-period-regex-value "\\.")
|
||||
(defcustom treemacs-file-extension-regex treemacs-last-period-regex-value
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs-diagnostics.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
|
||||
|
||||
@@ -4,9 +4,10 @@ from posixpath import join
|
||||
import sys
|
||||
import os
|
||||
|
||||
ROOT = sys.argv[1]
|
||||
LIMIT = int(sys.argv[2])
|
||||
SHOW_ALL = sys.argv[3] == 't'
|
||||
LIMIT = int(sys.argv[1])
|
||||
SHOW_ALL = sys.argv[2] == 't'
|
||||
ROOTS = sys.argv[3:]
|
||||
STDOUT = sys.stdout
|
||||
|
||||
# special workaround for windows platforms
|
||||
# the default `join' implementation cannot quite deal with windows
|
||||
@@ -53,29 +54,37 @@ def dir_content(path):
|
||||
return ret
|
||||
|
||||
def main():
|
||||
out = sys.stdout
|
||||
dirs = [d for d in dir_content(ROOT) if isdir(d)]
|
||||
out.write("(")
|
||||
for current_dir in dirs:
|
||||
content = dir_content(current_dir)
|
||||
collapsed = current_dir
|
||||
steps = []
|
||||
depth = 0
|
||||
while True:
|
||||
if len(content) == 1 and isdir(content[0]):
|
||||
single_path = content[0]
|
||||
collapsed = join_dirs(collapsed, single_path, True)
|
||||
content = dir_content(collapsed)
|
||||
depth += 1
|
||||
steps.append(single_path)
|
||||
if depth >= LIMIT:
|
||||
STDOUT.write("#s(hash-table size 10 test equal rehash-size 1.5 rehash-threshold 0.8125 data (")
|
||||
|
||||
for root in ROOTS:
|
||||
STDOUT.write(f'"{root}"')
|
||||
|
||||
dirs = [d for d in dir_content(root) if isdir(d)]
|
||||
STDOUT.write("(")
|
||||
for current_dir in dirs:
|
||||
content = dir_content(current_dir)
|
||||
collapsed = current_dir
|
||||
steps = []
|
||||
depth = 0
|
||||
while True:
|
||||
if len(content) == 1 and isdir(content[0]):
|
||||
single_path = content[0]
|
||||
collapsed = join_dirs(collapsed, single_path, True)
|
||||
content = dir_content(collapsed)
|
||||
depth += 1
|
||||
steps.append(single_path)
|
||||
if depth >= LIMIT:
|
||||
break
|
||||
else:
|
||||
break
|
||||
else:
|
||||
break
|
||||
if depth > 0 and not ('"' in collapsed or '\\' in collapsed):
|
||||
final_dir = steps[-1]
|
||||
display_suffix = final_dir[len(current_dir):]
|
||||
out.write("(" + '"' + display_suffix + '" ' + '"' + current_dir + '" ' + '"' + '" "'.join(steps) + '")')
|
||||
out.write(")")
|
||||
if depth > 0 and not ('"' in collapsed or '\\' in collapsed):
|
||||
final_dir = steps[-1]
|
||||
display_suffix = final_dir[len(current_dir):]
|
||||
STDOUT.write("(" + '"' + display_suffix + '" ' + '"' + current_dir + '" ' + '"' + '" "'.join(steps) + '")')
|
||||
nothing_to_flatten = False
|
||||
STDOUT.write(")")
|
||||
|
||||
# close hash table again
|
||||
STDOUT.write("))")
|
||||
|
||||
main()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -208,7 +208,7 @@ node for quick retrieval later."
|
||||
,icon
|
||||
(propertize ,label-form
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
,@(when face `((quote face) ,face))
|
||||
:custom t
|
||||
:state ,state
|
||||
@@ -445,7 +445,7 @@ additional keys."
|
||||
,(if icon-closed closed-icon-name icon-closed-form)
|
||||
(propertize ,root-label
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'face ,root-face
|
||||
:custom t
|
||||
:key ,root-key-form
|
||||
@@ -480,7 +480,7 @@ additional keys."
|
||||
(treemacs-dom-node->insert-into-dom! dom-node)
|
||||
(insert (propertize "Hidden Node\n"
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'invisible t
|
||||
'skip t
|
||||
:custom t
|
||||
@@ -503,7 +503,7 @@ additional keys."
|
||||
(insert ,(if icon-closed closed-icon-name icon-closed-form))
|
||||
(insert (propertize ,root-label
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'face ,root-face
|
||||
:custom t
|
||||
:key ,root-key-form
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,8 @@ from subprocess import Popen, PIPE
|
||||
from os.path import exists
|
||||
import sys
|
||||
|
||||
GIT_CMD = "git clean -ndX"
|
||||
GIT_BIN = sys.argv[1]
|
||||
GIT_CMD = "{} clean -ndX".format(GIT_BIN)
|
||||
STDOUT = sys.stdout.buffer
|
||||
|
||||
def quote(string):
|
||||
@@ -31,7 +32,7 @@ def process_git_output(root, proc):
|
||||
break
|
||||
|
||||
def main():
|
||||
roots = sys.argv[1:]
|
||||
roots = sys.argv[2:]
|
||||
procs = []
|
||||
|
||||
for root in roots:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -75,6 +75,8 @@ WINDOW is the treemacs window that has just been focused or unfocused."
|
||||
|
||||
(defun treemacs--tear-down-fringe-indicator-mode ()
|
||||
"Tear down `treemacs-fringe-indicator-mode'."
|
||||
(remove-hook 'treemacs-mode-hook
|
||||
#'treemacs--enable-fringe-indicator-in-current-buffer)
|
||||
(treemacs-run-in-all-derived-buffers
|
||||
(treemacs--disable-fringe-indicator)
|
||||
(advice-remove #'hl-line-highlight #'treemacs--move-fringe-indicator-to-point)
|
||||
@@ -118,13 +120,20 @@ fringe indicator when the treemacs window is selected."
|
||||
(s-join "-")
|
||||
(intern))))
|
||||
(setf treemacs-fringe-indicator-mode arg)
|
||||
(add-hook 'treemacs-mode-hook
|
||||
#'treemacs--enable-fringe-indicator-in-current-buffer)
|
||||
(treemacs-run-in-all-derived-buffers
|
||||
(treemacs--enable-fringe-indicator)
|
||||
(advice-add #'hl-line-highlight :after #'treemacs--move-fringe-indicator-to-point)
|
||||
(when (memq arg '(t only-when-focused))
|
||||
(add-hook 'window-selection-change-functions
|
||||
#'treemacs--show-fringe-indicator-only-when-focused
|
||||
nil :local))))
|
||||
(treemacs--enable-fringe-indicator-in-current-buffer)))
|
||||
|
||||
(defun treemacs--enable-fringe-indicator-in-current-buffer ()
|
||||
"Set up fringe-indicator-mode for the current buffer."
|
||||
(treemacs--enable-fringe-indicator)
|
||||
(advice-add #'hl-line-highlight
|
||||
:after #'treemacs--move-fringe-indicator-to-point)
|
||||
(when (memq treemacs-fringe-indicator-mode '(t only-when-focused))
|
||||
(add-hook 'window-selection-change-functions
|
||||
#'treemacs--show-fringe-indicator-only-when-focused
|
||||
nil :local)))
|
||||
|
||||
(treemacs-only-during-init (treemacs-fringe-indicator-mode))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs-git-commit-diff-mode.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
|
||||
@@ -51,7 +51,11 @@ Look for the PROJECT either in BUFFER or the local treemacs buffer."
|
||||
:no-match-action
|
||||
(ignore)
|
||||
:file-action
|
||||
(pfuture-callback `(,treemacs-python-executable "-O" ,treemacs--git-commit-diff.py ,path)
|
||||
(pfuture-callback `(,treemacs-python-executable
|
||||
"-O"
|
||||
,treemacs--git-commit-diff.py
|
||||
,treemacs-git-executable
|
||||
,path)
|
||||
:directory path
|
||||
:on-success
|
||||
(when (buffer-live-p buffer)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
STATUS_CMD = "git status -sb"
|
||||
GIT_BIN = sys.argv[1]
|
||||
STATUS_CMD = "{} status -sb".format(GIT_BIN)
|
||||
|
||||
def main():
|
||||
proc = Popen(STATUS_CMD, shell=True, stdout=PIPE, bufsize=100)
|
||||
|
||||
@@ -14,11 +14,12 @@ import sys
|
||||
# this list is turned into a set since it is possible that it contains duplicates
|
||||
# when called for magit, see also `treemacs-magit--extended-git-mode-update`
|
||||
|
||||
GIT_ROOT = str.encode(sys.argv[1])
|
||||
LIMIT = int(sys.argv[2])
|
||||
GIT_CMD = "git status --porcelain --ignored=matching . " + sys.argv[3]
|
||||
GIT_BIN = sys.argv[1]
|
||||
GIT_ROOT = str.encode(sys.argv[2])
|
||||
LIMIT = int(sys.argv[3])
|
||||
GIT_CMD = "{} status --porcelain --ignored=matching . ".format(GIT_BIN) + sys.argv[4]
|
||||
STDOUT = sys.stdout.buffer
|
||||
RECURSE_DIRS = set([str.encode(it[(len(GIT_ROOT)):]) + b"/" for it in sys.argv[4:]]) if len(sys.argv) > 4 else []
|
||||
RECURSE_DIRS = set([str.encode(it[(len(GIT_ROOT)):]) + b"/" for it in sys.argv[5:]]) if len(sys.argv) > 5 else []
|
||||
QUOTE = b'"'
|
||||
output = []
|
||||
ht_size = 0
|
||||
@@ -69,6 +70,7 @@ def main():
|
||||
# reduce the state to a single-letter-string
|
||||
state = state[0:1]
|
||||
|
||||
filename = filename.strip()
|
||||
# sometimes git outputs quoted filesnames
|
||||
if filename.startswith(b'"'):
|
||||
filename = filename[1:-1]
|
||||
|
||||
@@ -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
|
||||
@@ -26,6 +26,7 @@
|
||||
(require 'treemacs-interface)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'treemacs-macros)
|
||||
(require 'cl-lib))
|
||||
|
||||
(cl-macrolet
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -244,6 +244,7 @@ Necessary since root icons are not rectangular."
|
||||
(treemacs-create-icon :file "svgrepo/briefcase.png" :extensions (briefcase) :fallback " ")
|
||||
(treemacs-create-icon :file "svgrepo/mail.png" :extensions (mail) :fallback " ")
|
||||
(treemacs-create-icon :file "svgrepo/mail-plus.png" :extensions (mail-plus) :fallback " ")
|
||||
(treemacs-create-icon :file "svgrepo/inbox.png" :extensions (inbox) :fallback " ")
|
||||
|
||||
;; custom dir icons
|
||||
(treemacs-create-icon :file "svgrepo/dir-src-closed.png" :extensions ("src-closed") :fallback (propertize "+ " 'face 'treemacs-term-node-face))
|
||||
@@ -281,6 +282,22 @@ Necessary since root icons are not rectangular."
|
||||
:file "vsc/dir-images-open.png" :extensions ("screenshots-open" "icons-open")
|
||||
:fallback (propertize "- " 'face 'treemacs-term-node-face))
|
||||
|
||||
;; mode icons
|
||||
(treemacs-create-icon :file "emacs.png" :extensions (emacs-lisp-mode))
|
||||
(treemacs-create-icon :file "git.png" :extensions (gitignore-mode))
|
||||
(treemacs-create-icon :file "python.png" :extensions (python-mode))
|
||||
(treemacs-create-icon :file "vsc/make.png" :extensions (makefile-gmake-mode))
|
||||
(treemacs-create-icon :file "vsc/dir-closed.png" :extensions (dired-mode))
|
||||
(treemacs-create-icon :file "ledger.png" :extensions (ledger-mode))
|
||||
(treemacs-create-icon :file "vsc/org.png" :extensions (org-mode org-agenda-mode))
|
||||
(treemacs-create-icon :file "vsc/vim.png" :extensions (tridactylrc-mode))
|
||||
(treemacs-create-icon :file "conf.png" :extensions (conf-mode i3wm-config-mode))
|
||||
(treemacs-create-icon :file "conf.png" :extensions (conf-mode i3wm-config-mode))
|
||||
(treemacs-create-icon :file "shell.png" :extensions (fish-mode))
|
||||
(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))
|
||||
|
||||
;; file icons
|
||||
(treemacs-create-icon :file "txt.png" :extensions (fallback))
|
||||
(treemacs-create-icon :file "emacs.png" :extensions ("el" "elc" "eln"))
|
||||
@@ -300,10 +317,10 @@ Necessary since root icons are not rectangular."
|
||||
(treemacs-create-icon :file "asciidoc.png" :extensions ("adoc" "asciidoc"))
|
||||
(treemacs-create-icon :file "rust.png" :extensions ("rs"))
|
||||
(treemacs-create-icon :file "image.png" :extensions ("jpg" "jpeg" "bmp" "svg" "png" "xpm" "gif"))
|
||||
(treemacs-create-icon :file "clojure.png" :extensions ("clj" "cljs" "cljc" "edn"))
|
||||
(treemacs-create-icon :file "clojure.png" :extensions ("clj" "cljs" "cljc" "cljd" "edn"))
|
||||
(treemacs-create-icon :file "ts.png" :extensions ("ts" "tsx"))
|
||||
(treemacs-create-icon :file "vue.png" :extensions ("vue"))
|
||||
(treemacs-create-icon :file "css.png" :extensions ("css"))
|
||||
(treemacs-create-icon :file "css.png" :extensions ("css" "rasi"))
|
||||
(treemacs-create-icon :file "conf.png" :extensions ("properties" "conf" "config" "cfg" "ini" "xdefaults" "xresources" "terminalrc" "ledgerrc"))
|
||||
(treemacs-create-icon :file "html.png" :extensions ("html" "htm"))
|
||||
(treemacs-create-icon :file "git.png" :extensions ("git" "gitignore" "gitconfig" "gitmodules" "gitattributes"))
|
||||
@@ -311,7 +328,7 @@ Necessary since root icons are not rectangular."
|
||||
(treemacs-create-icon :file "jar.png" :extensions ("jar"))
|
||||
(treemacs-create-icon :file "kotlin.png" :extensions ("kt"))
|
||||
(treemacs-create-icon :file "scala.png" :extensions ("scala"))
|
||||
(treemacs-create-icon :file "gradle.png" :extensions ("gradle"))
|
||||
(treemacs-create-icon :file "gradle.png" :extensions ("gradle" "kts" "build.gradle.kts" "settings.gradle.kts"))
|
||||
(treemacs-create-icon :file "sbt.png" :extensions ("sbt"))
|
||||
(treemacs-create-icon :file "go.png" :extensions ("go"))
|
||||
(treemacs-create-icon :file "systemd.png" :extensions ("service" "timer"))
|
||||
@@ -359,8 +376,8 @@ Necessary since root icons are not rectangular."
|
||||
(treemacs-create-icon :file "vsc/asm.png" :extensions ("asm" "arm"))
|
||||
(treemacs-create-icon :file "vsc/autohk.png" :extensions ("ahk"))
|
||||
(treemacs-create-icon :file "vsc/babel.png" :extensions ("babelrc" "babelignore" "babelrc.js" "babelrc.json" "babel.config.js"))
|
||||
(treemacs-create-icon :file "vsc/bat.png" :extensions ("bat"))
|
||||
(treemacs-create-icon :file "vsc/binary.png" :extensions ("exe" "dll" "obj" "so" "o"))
|
||||
(treemacs-create-icon :file "vsc/bat.png" :extensions ("bat" "exe" "gradlew"))
|
||||
(treemacs-create-icon :file "vsc/binary.png" :extensions ("dll" "obj" "so" "o"))
|
||||
(treemacs-create-icon :file "vsc/bazel.png" :extensions ("bazelrc" "bazel"))
|
||||
(treemacs-create-icon :file "vsc/bower.png" :extensions ("bowerrc" "bower.json"))
|
||||
(treemacs-create-icon :file "vsc/bundler.png" :extensions ("gemfile" "gemfile.lock"))
|
||||
@@ -430,6 +447,7 @@ Necessary since root icons are not rectangular."
|
||||
(treemacs-create-icon :file "vsc/vim.png" :extensions ("vimrc" "tridactylrc" "vimperatorrc" "ideavimrc" "vrapperrc"))
|
||||
(treemacs-create-icon :file "vsc/deps.png" :extensions ("cask"))
|
||||
(treemacs-create-icon :file "vsc/r.png" :extensions ("r"))
|
||||
(treemacs-create-icon :file "vsc/terraform.png" :extensions ("tf" "terraform"))
|
||||
(treemacs-create-icon :file "vsc/reason.png" :extensions ("re" "rei"))))
|
||||
|
||||
(define-inline treemacs-icon-for-file (file)
|
||||
@@ -445,6 +463,14 @@ Uses `treemacs-icon-fallback' as fallback."
|
||||
(treemacs--file-extension file-downcased)
|
||||
(with-no-warnings treemacs-icon-fallback)))))))
|
||||
|
||||
(define-inline treemacs-icon-for-mode (mode)
|
||||
"Retrieve an icon for major MODE from `treemacs-icons'.
|
||||
Uses `treemacs-icon-fallback' as fallback."
|
||||
(declare (side-effect-free t))
|
||||
(inline-letevals (mode)
|
||||
(inline-quote
|
||||
(ht-get treemacs-icons ,mode (with-no-warnings treemacs-icon-fallback)))))
|
||||
|
||||
(define-inline treemacs-icon-for-dir (dir state)
|
||||
"Retrieve an icon for DIR from `treemacs-icons' in given STATE.
|
||||
STATE must be either `open' or `closed'.
|
||||
@@ -573,7 +599,7 @@ be assigned which treemacs icon, for example
|
||||
icon))))
|
||||
|
||||
(treemacs-only-during-init
|
||||
(treemacs-load-theme "Default"))
|
||||
(treemacs-load-theme "Default"))
|
||||
|
||||
(provide 'treemacs-icons)
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -140,17 +140,19 @@ conditions:
|
||||
|
||||
The prefix argument ARG is treated the same way as with `treemacs-toggle-node'."
|
||||
(interactive)
|
||||
(treemacs-do-for-button-state
|
||||
:on-root-node-open (treemacs--collapse-root-node btn arg)
|
||||
:on-root-node-closed (treemacs--expand-root-node btn)
|
||||
:on-dir-node-open (treemacs--collapse-dir-node btn arg)
|
||||
:on-dir-node-closed (treemacs--expand-dir-node btn :recursive arg)
|
||||
:on-file-node-open (treemacs--collapse-file-node btn arg)
|
||||
:on-file-node-closed (treemacs--expand-file-node btn arg)
|
||||
:on-tag-node-open (treemacs--visit-or-expand/collapse-tag-node btn arg t)
|
||||
:on-tag-node-closed (treemacs--visit-or-expand/collapse-tag-node btn arg t)
|
||||
:on-tag-node-leaf (progn (other-window 1) (treemacs--goto-tag btn))
|
||||
:on-nil (treemacs-pulse-on-failure "There is nothing to do here.")))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs-do-for-button-state
|
||||
:on-root-node-open (treemacs--collapse-root-node btn arg)
|
||||
:on-root-node-closed (treemacs--expand-root-node btn)
|
||||
:on-dir-node-open (treemacs--collapse-dir-node btn arg)
|
||||
:on-dir-node-closed (treemacs--expand-dir-node btn :recursive arg)
|
||||
:on-file-node-open (treemacs--collapse-file-node btn arg)
|
||||
:on-file-node-closed (treemacs--expand-file-node btn arg)
|
||||
:on-tag-node-open (treemacs--visit-or-expand/collapse-tag-node btn arg t)
|
||||
:on-tag-node-closed (treemacs--visit-or-expand/collapse-tag-node btn arg t)
|
||||
:on-tag-node-leaf (progn (other-window 1) (treemacs--goto-tag btn))
|
||||
:on-nil (treemacs-pulse-on-failure "There is nothing to do here."))))
|
||||
|
||||
(defun treemacs-TAB-action (&optional arg)
|
||||
"Run the appropriate TAB action for the current node.
|
||||
@@ -199,28 +201,32 @@ ARG is optional and only available so this function can be used as an action."
|
||||
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
|
||||
:split-function #'split-window-vertically
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
:split-function #'split-window-vertically
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-horizontal-split (&optional arg)
|
||||
"Open current file or tag by horizontally splitting `next-window'.
|
||||
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
|
||||
:split-function #'split-window-horizontally
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
:split-function #'split-window-horizontally
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-close-treemacs (&optional _)
|
||||
"Open current node without and close treemacs.
|
||||
@@ -237,75 +243,85 @@ window then that window will be selected instead.
|
||||
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
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:window (-some-> btn (treemacs--nearest-path) (get-file-buffer) (get-buffer-window))
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:window (-some-> btn (treemacs--nearest-path) (get-file-buffer) (get-buffer-window))
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-ace (&optional arg)
|
||||
"Open current file or tag in window selected by `ace-window'.
|
||||
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 (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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-in-most-recently-used-window (&optional arg)
|
||||
"Open current file or tag in window selected by `get-mru-window'.
|
||||
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 (get-mru-window (selected-frame) nil :not-selected)
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
:window (get-mru-window (selected-frame) nil :not-selected)
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:ensure-window-split t
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-ace-horizontal-split (&optional arg)
|
||||
"Open current file by horizontally splitting window selected by `ace-window'.
|
||||
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
|
||||
:split-function #'split-window-horizontally
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
:split-function #'split-window-horizontally
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-ace-vertical-split (&optional arg)
|
||||
"Open current file by vertically splitting window selected by `ace-window'.
|
||||
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
|
||||
:split-function #'split-window-vertically
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here."))
|
||||
(run-hook-with-args
|
||||
'treemacs-after-visit-functions
|
||||
(treemacs--execute-button-action
|
||||
:split-function #'split-window-vertically
|
||||
: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)
|
||||
:tag-action (treemacs--goto-tag btn)
|
||||
:window-arg arg
|
||||
:no-match-explanation "Node is neither a file, a directory or a tag - nothing to do here.")))
|
||||
|
||||
(defun treemacs-visit-node-default (&optional arg)
|
||||
"Run `treemacs-default-visit-action' for the current button.
|
||||
@@ -528,6 +544,19 @@ 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-copy-filename-at-point ()
|
||||
"Copy the filename of the node at point."
|
||||
(interactive)
|
||||
(treemacs-block
|
||||
(-let [path (treemacs--prop-at-point :path)]
|
||||
(treemacs-error-return-if (null path)
|
||||
"There is nothing to copy here")
|
||||
(treemacs-error-return-if (not (stringp path))
|
||||
"Path at point is not a file.")
|
||||
(let ((filename (file-name-nondirectory path)))
|
||||
(kill-new filename)
|
||||
(treemacs-pulse-on-success "Copied filename: %s" (propertize filename '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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -324,7 +324,9 @@ not work keep it on the same line."
|
||||
(error (ignore)))))
|
||||
(treemacs--evade-image)
|
||||
(when (get-text-property (point) 'invisible)
|
||||
(goto-char (next-single-property-change (point) 'invisible)))
|
||||
(goto-char (or
|
||||
(next-single-property-change (point) 'invisible)
|
||||
(point-min))))
|
||||
(when curr-win-line
|
||||
(-let [buffer-point (point)]
|
||||
(with-selected-window curr-window
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs-mode.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
|
||||
@@ -140,6 +140,7 @@ Will be set by `treemacs--post-command'.")
|
||||
(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 "n") 'treemacs-copy-filename-at-point)
|
||||
(define-key map (kbd "f") 'treemacs-copy-file)
|
||||
(define-key map (kbd "v") 'treemacs-paste-dir-at-point-to-minibuffer)
|
||||
map)
|
||||
@@ -223,8 +224,9 @@ Will be set by `treemacs--post-command'.")
|
||||
major-mode)
|
||||
nil)
|
||||
'("%e" (:eval (spaceline-ml-treemacs))))
|
||||
((memq 'moody-mode-line-buffer-identification
|
||||
(default-value 'mode-line-format))
|
||||
((and (listp (default-value 'mode-line-format))
|
||||
(member 'moody-mode-line-buffer-identification
|
||||
(default-value 'mode-line-format)))
|
||||
'(:eval (moody-tab " Treemacs " 10 'down)))
|
||||
((featurep 'doom-modeline)
|
||||
(with-no-warnings
|
||||
@@ -249,7 +251,7 @@ Also skip hidden buttons (as employed by variadic extensions).
|
||||
Used as a post command hook."
|
||||
(let ((newline-char 10)
|
||||
(point-max (point-max)))
|
||||
(unless (= newline-char (char-before point-max))
|
||||
(unless (equal newline-char (char-before point-max))
|
||||
(treemacs-with-writable-buffer
|
||||
(save-excursion
|
||||
(goto-char point-max)
|
||||
@@ -336,7 +338,7 @@ Will simply return `treemacs--eldoc-msg'."
|
||||
(setq evil-treemacs-state-cursor
|
||||
(if treemacs-show-cursor
|
||||
evil-motion-state-cursor
|
||||
'(bar . 0)))))
|
||||
(lambda () (setq cursor-type nil))))))
|
||||
|
||||
;; higher fuzz value makes it less likely to start a mouse drag
|
||||
;; and make a switch to visual state
|
||||
|
||||
@@ -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
|
||||
@@ -178,7 +178,8 @@ TARGET-POS: End position of the mouse drag."
|
||||
(treemacs--parent-dir target-key))))
|
||||
(target-file (and source-key target-key
|
||||
(treemacs-join-path target-dir (treemacs--filename source-key)))))
|
||||
(when (and source-key target-key
|
||||
(when (and treemacs-move-files-by-mouse-dragging
|
||||
source-key target-key
|
||||
(not (string= source-key target-key))
|
||||
(not (treemacs-is-path source-key :directly-in target-dir)))
|
||||
(treemacs-do-delete-single-node source-key)
|
||||
@@ -326,7 +327,8 @@ and ignore any prefix argument."
|
||||
["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)])
|
||||
["Copy Project Path" treemacs-copy-project-path-at-point :visible ,(check node)]
|
||||
["Copy Filename" treemacs-copy-filename-at-point :visible ,(check node)])
|
||||
|
||||
["--" #'ignore t]
|
||||
("Projects"
|
||||
|
||||
@@ -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
|
||||
@@ -82,6 +82,10 @@ purged."
|
||||
(delete current-buffer treemacs--peeked-buffers))
|
||||
(treemacs-peek-mode -1))))
|
||||
|
||||
(defun treemacs--disable-peek-mode ()
|
||||
"Hook function for `treemacs-quit-hook'."
|
||||
(treemacs-peek-mode -1))
|
||||
|
||||
(defun treemacs--setup-peek-mode ()
|
||||
"Set up faces, timers, and hooks etc."
|
||||
(when treemacs--fringe-indicator-overlay
|
||||
@@ -92,7 +96,8 @@ purged."
|
||||
(run-with-idle-timer 0.5 :repeat #'treemacs--do-peek))
|
||||
(add-hook
|
||||
'window-selection-change-functions #'treemacs--finish-peek-on-window-leave
|
||||
nil :local))
|
||||
nil :local)
|
||||
(add-hook 'treemacs-quit-hook #'treemacs--disable-peek-mode))
|
||||
|
||||
(defun treemacs--tear-down-peek-mode (&optional restore-window)
|
||||
"Tear down faces, timers.
|
||||
@@ -114,7 +119,8 @@ kept."
|
||||
(-let [(window buffer) treemacs--pre-peek-state]
|
||||
(with-selected-window window
|
||||
(switch-to-buffer buffer))))
|
||||
(setf treemacs--pre-peek-state nil)))
|
||||
(setf treemacs--pre-peek-state nil))
|
||||
(remove-hook 'treemacs-quit-hook #'treemacs--disable-peek-mode))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode treemacs-peek-mode
|
||||
|
||||
@@ -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
|
||||
@@ -62,6 +62,10 @@
|
||||
(:constructor treemacs-iter->create!))
|
||||
list)
|
||||
|
||||
(defvar treemacs--no-abbr-on-persist-prefixes nil
|
||||
"Prefixes for paths to be saved as is, without using `abbreviate-file-name'.
|
||||
Will be set to all the `tramp-methods', after tramp has been loaded.")
|
||||
|
||||
(define-inline treemacs-iter->next! (self)
|
||||
"Get the next element of iterator SELF.
|
||||
|
||||
@@ -144,7 +148,8 @@ ITER: Treemacs-Iter Struct"
|
||||
(treemacs--get-path-status)))
|
||||
(setq action
|
||||
(cond
|
||||
((not (treemacs-project->is-unreadable? project))
|
||||
((or (treemacs-project->is-disabled? project)
|
||||
(not (treemacs-project->is-unreadable? project)))
|
||||
'keep)
|
||||
((eq treemacs-missing-project-action 'ask)
|
||||
(let ((completions
|
||||
@@ -200,7 +205,7 @@ ITER: Treemacs-Iter Struct"
|
||||
(push (format
|
||||
" - path :: %s\n"
|
||||
(-let [path (treemacs-project->path pr)]
|
||||
(if (string-prefix-p "/ssh:" path)
|
||||
(if (--any? (string-prefix-p it path) treemacs--no-abbr-on-persist-prefixes)
|
||||
path
|
||||
(abbreviate-file-name path))))
|
||||
txt)))
|
||||
@@ -300,6 +305,7 @@ PROJ-COUNT: Int"
|
||||
;; `treemacs-missing-project-action'. Remote files are skipped to avoid opening
|
||||
;; Tramp connections.
|
||||
(treemacs-return-if (and (string= treemacs--org-edit-buffer-name (buffer-name))
|
||||
(not (s-starts-with? "** COMMENT" prev))
|
||||
(not (file-remote-p path))
|
||||
(not (file-exists-p path)))
|
||||
`(error ,line ,(format (as-warning "File '%s' does not exist") (propertize path 'face 'font-lock-string-face))))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(define-package "treemacs" "20231101.1150" "A tree style file explorer package"
|
||||
(define-package "treemacs" "20250105.1321" "A tree style file explorer package"
|
||||
'((emacs "26.1")
|
||||
(cl-lib "0.5")
|
||||
(dash "2.11.0")
|
||||
@@ -8,7 +8,7 @@
|
||||
(hydra "0.13.2")
|
||||
(ht "2.2")
|
||||
(cfrs "1.3.2"))
|
||||
:commit "92e173b3daac5e3f03fa7a63475f1d692e0c1958" :authors
|
||||
:commit "32bb3dd02ddfca85661614b3b227e770fab821e2" :authors
|
||||
'(("Alexander Miller" . "alexanderm@web.de"))
|
||||
:maintainers
|
||||
'(("Alexander Miller" . "alexanderm@web.de"))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,14 +7,15 @@ import os
|
||||
# 2) the file's previous state, to check if things changed at all
|
||||
# 3) the file's parents that need to be updated as well
|
||||
|
||||
FILE = sys.argv[1]
|
||||
OLD_FACE = sys.argv[2]
|
||||
PARENTS = [p for p in sys.argv[3:]]
|
||||
GIT_BIN = sys.argv[1]
|
||||
FILE = sys.argv[2]
|
||||
OLD_FACE = sys.argv[3]
|
||||
PARENTS = [p for p in sys.argv[4:]]
|
||||
|
||||
FILE_STATE_CMD = "git status --porcelain --ignored=matching "
|
||||
IS_IGNORED_CMD = "git check-ignore "
|
||||
IS_TRACKED_CMD = "git ls-files --error-unmatch "
|
||||
IS_CHANGED_CMD = "git ls-files --modified --others --exclude-standard "
|
||||
FILE_STATE_CMD = "{} status --porcelain --ignored=matching ".format(GIT_BIN)
|
||||
IS_IGNORED_CMD = "{} check-ignore ".format(GIT_BIN)
|
||||
IS_TRACKED_CMD = "{} ls-files --error-unmatch ".format(GIT_BIN)
|
||||
IS_CHANGED_CMD = "{} ls-files --modified --others --exclude-standard ".format(GIT_BIN)
|
||||
|
||||
def face_for_status(path, status):
|
||||
if status == "M":
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -145,7 +145,7 @@ DEPTH: Int"
|
||||
,prefix
|
||||
(propertize (car ,item)
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'face 'treemacs-tags-face
|
||||
'help-echo nil
|
||||
:path ,path
|
||||
@@ -171,7 +171,7 @@ DEPTH: Int"
|
||||
,prefix
|
||||
(propertize (car ,node)
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'face 'treemacs-tags-face
|
||||
'help-echo nil
|
||||
:path ,path
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2020 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
|
||||
@@ -252,8 +252,9 @@ Also pass additional DATA to predicate function.")
|
||||
open-icon
|
||||
closed-icon
|
||||
child-type
|
||||
;; visit-action
|
||||
ret-action
|
||||
visit-action
|
||||
double-click-action
|
||||
no-tab?
|
||||
variadic?
|
||||
async?
|
||||
@@ -308,9 +309,21 @@ determines the behaviours (LABEL etc.) used to create the children of the node
|
||||
type being defined here.
|
||||
|
||||
RET-ACTION is the function that is called when RET is pressed on a node of this
|
||||
be able to handle both a closed and open state. If no explicit RET-ACTION type.
|
||||
The function is called with a single argument - the prefix arg - and must
|
||||
argument is given RET will do the same as TAB.
|
||||
be able to handle both a closed and open state. If no explicit RET-ACTION type
|
||||
argument is given RET will do the same as TAB. The function is called with a
|
||||
single argument - the prefix arg - and must be able to handle both a closed and
|
||||
and expanded node state.
|
||||
|
||||
VISIT-ACTION is a function that is called when a node is to be opened with a
|
||||
command like `treemacs-visit-node-ace'. It is called with the current `btn' and
|
||||
must be able to handle both an open and a closed state. It will most likely be
|
||||
called in a window that is not the one where the button resides, so if you need
|
||||
to extract text properties from the button you to must use
|
||||
`treemacs-safe-button-get', e.g. \(treemacs-safe-button-get btn :path\).
|
||||
|
||||
DOUBLE-CLICK-ACTION is similar to RET-ACTION, but will be called without any
|
||||
arguments. There is no default click behaviour, if no DOUBLE-CLICK-ACTION is
|
||||
given then treemacs will do nothing for double-clicks.
|
||||
|
||||
NO-TAB indicates that pressing TAB on this node type should do nothing. It will
|
||||
be set by `treemacs-define-leaf-node'.
|
||||
@@ -364,6 +377,10 @@ argument."
|
||||
:on-expand (lambda (&optional btn ) "" (ignore btn) ,on-expand)
|
||||
:on-collapse (lambda (&optional btn ) "" (ignore btn) ,on-collapse)))
|
||||
|
||||
(with-eval-after-load 'treemacs-mouse-interface
|
||||
(treemacs-define-doubleclick-action ',closed-state ,(or double-click-action '#'ignore))
|
||||
(treemacs-define-doubleclick-action ',open-state ,(or double-click-action '#'ignore)))
|
||||
|
||||
(treemacs-define-TAB-action
|
||||
',closed-state
|
||||
,(cond
|
||||
@@ -374,6 +391,10 @@ argument."
|
||||
(treemacs-define-RET-action ',closed-state ,(or ret-action (if no-tab? '#'ignore '#'treemacs-expand-extension-node)))
|
||||
(treemacs-define-RET-action ',open-state ,(or ret-action (if no-tab? '#'ignore '#'treemacs-collapse-extension-node)))
|
||||
|
||||
(when ,visit-action
|
||||
(put ',open-state :treemacs-visit-action ,visit-action)
|
||||
(put ',closed-state :treemacs-visit-action ,visit-action))
|
||||
|
||||
(add-to-list 'treemacs--extension-registry (cons ',closed-state ,struct-name))
|
||||
(add-to-list 'treemacs--extension-registry (cons ',open-state ,struct-name))
|
||||
|
||||
@@ -390,12 +411,14 @@ argument."
|
||||
label
|
||||
key
|
||||
more-properties
|
||||
ret-action)
|
||||
ret-action
|
||||
visit-action
|
||||
double-click-action)
|
||||
|
||||
"Define a type of node that is a leaf and cannot be further expanded.
|
||||
The NAME, ICON, LABEL and KEY arguments are mandatory.
|
||||
|
||||
MORE-PROPERTIES and RET-ACTION are optional.
|
||||
MORE-PROPERTIES, RET-ACTION, VISIT-ACTION and DOUBLE-CLICK-ACTION are optional.
|
||||
|
||||
For a detailed description of all arguments see
|
||||
`treemacs-do-define-extension-type'."
|
||||
@@ -409,9 +432,11 @@ For a detailed description of all arguments see
|
||||
`(treemacs-do-define-extension-type ,name
|
||||
:key ,key
|
||||
:label ,label
|
||||
:more-properties (nconc '(:leaf t) ,more-properties)
|
||||
:more-properties (append '(:leaf t) ,more-properties)
|
||||
:closed-icon ,icon
|
||||
:ret-action ,ret-action
|
||||
:visit-action ,visit-action
|
||||
:double-click-action ,double-click-action
|
||||
:no-tab? t
|
||||
:children (lambda () (error "Called :children of leaf node"))
|
||||
:child-type (lambda () (error "Called :child-type of leaf node"))))
|
||||
@@ -426,6 +451,7 @@ For a detailed description of all arguments see
|
||||
child-type
|
||||
more-properties
|
||||
ret-action
|
||||
double-click-action
|
||||
on-expand
|
||||
on-collapse
|
||||
async?)
|
||||
@@ -434,7 +460,8 @@ For a detailed description of all arguments see
|
||||
The NAME, CLOSED-ICON, OPEN-ICON LABEL, KEY, CHILDREN and CHILD-TYPE arguments
|
||||
are mandatory.
|
||||
|
||||
MORE-PROPERTIES, RET-ACTION, ON-EXPAND, ON-COLLAPSE and ASYNC are optional.
|
||||
MORE-PROPERTIES, RET-ACTION, DOUBLE-CLICK-ACTION, ON-EXPAND, ON-COLLAPSE and
|
||||
ASYNC are optional.
|
||||
|
||||
For a detailed description of all arguments see
|
||||
`treemacs-do-define-extension-type'."
|
||||
@@ -457,6 +484,7 @@ For a detailed description of all arguments see
|
||||
:child-type ,child-type
|
||||
:more-properties ,more-properties
|
||||
:ret-action ,ret-action
|
||||
:double-click-action ,double-click-action
|
||||
:async? ,async?
|
||||
:on-expand ,on-expand
|
||||
:on-collapse ,on-collapse))
|
||||
@@ -471,6 +499,7 @@ For a detailed description of all arguments see
|
||||
child-type
|
||||
more-properties
|
||||
ret-action
|
||||
double-click-action
|
||||
on-expand
|
||||
on-collapse
|
||||
async?)
|
||||
@@ -480,7 +509,8 @@ For a detailed description of all arguments see
|
||||
The KEY, LABEL, OPEN-ICON CLOSED-ICON, CHILDREN and CHILD-TYPE arguments are
|
||||
mandatory.
|
||||
|
||||
MORE-PROPERTIES, RET-ACTION, ON-EXPAND, ON-COLLAPSE and ASYNC are optional.
|
||||
MORE-PROPERTIES, RET-ACTION, DOUBLE-CLICK-ACTION, ON-EXPAND, ON-COLLAPSE and
|
||||
ASYNC are optional.
|
||||
|
||||
For a detailed description of all arguments see
|
||||
`treemacs-do-define-extension-type'."
|
||||
@@ -504,6 +534,7 @@ For a detailed description of all arguments see
|
||||
:more-properties ,more-properties
|
||||
:async? ,async?
|
||||
:ret-action ,ret-action
|
||||
:double-click-action ,double-click-action
|
||||
:on-expand ,on-expand
|
||||
:on-collapse ,on-collapse
|
||||
:entry-point? t))
|
||||
@@ -579,7 +610,7 @@ EXT: `treemacs-extension' instance"
|
||||
(insert (propertize
|
||||
label
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
:custom t
|
||||
:key key
|
||||
:path key
|
||||
@@ -614,7 +645,7 @@ EXPAND-DEPTH: Int"
|
||||
(treemacs-dom-node->insert-into-dom! dom-node)
|
||||
(insert (propertize "Hidden node"
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
'invisible t
|
||||
'skip t
|
||||
:custom t
|
||||
@@ -665,8 +696,7 @@ LABEL: String"
|
||||
(apply
|
||||
#'propertize ,label
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'help-echo nil
|
||||
'category 'treemacs-button
|
||||
:custom t
|
||||
:state ,state
|
||||
:parent ,parent
|
||||
@@ -699,7 +729,7 @@ PARENT: Button"
|
||||
(treemacs-extension->get ext :closed-icon)
|
||||
(propertize (treemacs-extension->get ext :label)
|
||||
'button '(t)
|
||||
'category 'default-button
|
||||
'category 'treemacs-button
|
||||
:custom t
|
||||
:key key
|
||||
:path path
|
||||
@@ -883,7 +913,7 @@ ITEMS: List<Any>"
|
||||
:parent btn
|
||||
:parent-path parent-path
|
||||
:parent-dom-node parent-dom-node
|
||||
:more-properties (nconc `(:item ,item) (funcall properties-fn btn item))
|
||||
:more-properties (append `(:item ,item) (funcall properties-fn btn item))
|
||||
:icon (funcall closed-icon-fn btn item)
|
||||
:state child-state
|
||||
:key (funcall key-fn btn item)
|
||||
@@ -949,7 +979,7 @@ EXPAND-DEPTH: Int"
|
||||
:parent-path parent-path
|
||||
:parent-dom-node parent-dom-node
|
||||
:more-properties
|
||||
(nconc `(:item ,item)
|
||||
(append `(:item ,item)
|
||||
`(:project ,(treemacs-project->create!
|
||||
:name (funcall label-fn btn item)
|
||||
:path path
|
||||
|
||||
@@ -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
|
||||
@@ -53,8 +53,7 @@ Used to save the values of `treemacs-indentation' and
|
||||
|
||||
(defun treemacs--do-pulse (face)
|
||||
"Visually pulse current line using FACE."
|
||||
(pulse-momentary-highlight-one-line (point) face)
|
||||
(advice-add 'pulse-momentary-unhighlight :after #'hl-line-highlight))
|
||||
(pulse-momentary-highlight-one-line (point) face))
|
||||
|
||||
(defsubst treemacs-pulse-on-success (&rest log-args)
|
||||
"Pulse current line with `treemacs-on-success-pulse-face'.
|
||||
|
||||
@@ -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
|
||||
@@ -648,7 +648,10 @@ Return values may be as follows:
|
||||
(let* ((workspaces (->> treemacs--workspaces
|
||||
(--reject (eq it (treemacs-current-workspace)))
|
||||
(--map (cons (treemacs-workspace->name it) it))))
|
||||
(name (completing-read "Switch to: " workspaces nil :require-match)))
|
||||
(name (completing-read
|
||||
"Switch to: "
|
||||
(treemacs--pre-sorted-list workspaces)
|
||||
nil :require-match)))
|
||||
(setf new-workspace (cdr (--first (string= (car it) name) workspaces))))))
|
||||
(setf (treemacs-current-workspace) new-workspace)
|
||||
(treemacs--invalidate-buffer-project-cache)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; treemacs.el --- A tree style file explorer package -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2023 Alexander Miller
|
||||
;; Copyright (C) 2024 Alexander Miller
|
||||
|
||||
;; 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"))
|
||||
@@ -115,13 +115,13 @@ To *add* a project to the current workspace use
|
||||
;;;###autoload
|
||||
(defun treemacs-find-file (&optional arg)
|
||||
"Find and focus the current file in the treemacs window.
|
||||
If the current buffer has visits no file or with a prefix ARG ask for the
|
||||
If the current buffer visits no file or with a prefix ARG ask for the
|
||||
file instead.
|
||||
Will show/create a treemacs buffers if it is not visible/does not exist.
|
||||
For the most part only useful when `treemacs-follow-mode' is not active."
|
||||
(interactive "P")
|
||||
(-let ((path (unless arg (buffer-file-name (current-buffer))))
|
||||
(manually-entered nil))
|
||||
(let ((path (unless arg (buffer-file-name (current-buffer))))
|
||||
(manually-entered nil))
|
||||
(unless path
|
||||
(setq manually-entered t
|
||||
path (->> (--if-let (treemacs-current-button) (treemacs--nearest-path it))
|
||||
@@ -171,6 +171,20 @@ visiting a file or Emacs cannot find any tags for the current file."
|
||||
(setq treemacs-window (selected-window)))
|
||||
(treemacs--do-follow-tag index treemacs-window buffer-file project))))
|
||||
|
||||
;;;###autoload
|
||||
(defun treemacs-start-on-boot (&optional focus-treemacs)
|
||||
"Initialiser specifically to start treemacs as part of your init file.
|
||||
|
||||
Ensures that all visual elements are present which might otherwise be missing
|
||||
because their setup requires an interactive command or a post-command hook.
|
||||
|
||||
FOCUS-TREEMACS indicates whether the treemacs window should be selected."
|
||||
(-let [initial-window (selected-window)]
|
||||
(treemacs)
|
||||
(hl-line-highlight)
|
||||
(redisplay)
|
||||
(unless focus-treemacs (select-window initial-window))))
|
||||
|
||||
;;;###autoload
|
||||
(defun treemacs-select-window (&optional arg)
|
||||
"Select the treemacs window if it is visible.
|
||||
@@ -193,20 +207,21 @@ A non-nil prefix ARG will also force a workspace switch."
|
||||
(if (not (eq treemacs--in-this-buffer t))
|
||||
(treemacs--select-visible-window)
|
||||
(pcase-exhaustive treemacs-select-when-already-in-treemacs
|
||||
('stay
|
||||
(ignore))
|
||||
('close
|
||||
(treemacs-quit))
|
||||
('goto-next
|
||||
(treemacs--jump-to-next-treemacs-window))
|
||||
('next-or-back
|
||||
(or
|
||||
(treemacs--jump-to-next-treemacs-window)
|
||||
(select-window (get-mru-window (selected-frame) nil :not-selected))))
|
||||
('move-back
|
||||
(select-window (get-mru-window (selected-frame) nil :not-selected))))))))
|
||||
('stay
|
||||
(ignore))
|
||||
('close
|
||||
(treemacs-quit))
|
||||
('goto-next
|
||||
(treemacs--jump-to-next-treemacs-window))
|
||||
('next-or-back
|
||||
(or
|
||||
(treemacs--jump-to-next-treemacs-window)
|
||||
(-if-let (mru-window (get-mru-window (selected-frame) nil :not-selected))
|
||||
(select-window mru-window)
|
||||
(treemacs-log-failure "get-mru-window could not find the last used window."))))
|
||||
('move-back
|
||||
(select-window (get-mru-window (selected-frame) nil :not-selected))))))))
|
||||
|
||||
(setf treemacs-select-when-already-in-treemacs 'next-or-back)
|
||||
;;;###autoload
|
||||
(defun treemacs-show-changelog ()
|
||||
"Show the changelog of treemacs."
|
||||
|
||||
Reference in New Issue
Block a user