update packages
This commit is contained in:
@@ -16,13 +16,14 @@
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
;;; Customize interface definitions.
|
||||
|
||||
;; Customize interface definitions.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 's)
|
||||
(require 'widget)
|
||||
(require 'dash)
|
||||
(require 'f)
|
||||
|
||||
(eval-when-compile
|
||||
(require 'cl-lib))
|
||||
@@ -38,12 +39,14 @@
|
||||
(s-lines)
|
||||
(--first
|
||||
(when (file-exists-p it)
|
||||
(->> (concat (shell-quote-argument it) " --version")
|
||||
(shell-command-to-string)
|
||||
(s-trim)
|
||||
(s-replace "Python " "")
|
||||
(s-left 1)
|
||||
(version<= "3")))))
|
||||
(condition-case _
|
||||
(->> (concat (shell-quote-argument it) " --version")
|
||||
(shell-command-to-string)
|
||||
(s-trim)
|
||||
(s-replace "Python " "")
|
||||
(s-left 1)
|
||||
(version<= "3"))
|
||||
(error nil)))))
|
||||
(error nil)))))
|
||||
|
||||
(cl-macrolet
|
||||
@@ -84,7 +87,7 @@
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
|
||||
(defgroup treemacs-git nil
|
||||
"Customizations for treemacs' git integration"
|
||||
"Customisations for treemacs' git integration."
|
||||
:group 'treemacs
|
||||
:prefix "treemacs-"
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
@@ -96,13 +99,13 @@
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
|
||||
(defgroup treemacs-follow nil
|
||||
"Customizations for the behaviour of the treemacs' file and tag following."
|
||||
"Customisations for the behaviour of the treemacs' file and tag following."
|
||||
:group 'treemacs
|
||||
:prefix "treemacs-"
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
|
||||
(defgroup treemacs-window nil
|
||||
"Customizations for the behaviour of the treemacs window."
|
||||
"Customisations for the behaviour of the treemacs window."
|
||||
:group 'treemacs
|
||||
:prefix "treemacs-"
|
||||
:link '(url-link :tag "Repository" "https://github.com/Alexander-Miller/treemacs"))
|
||||
@@ -118,6 +121,16 @@ indentation will be a space INTEGER pixels wide."
|
||||
(const :tag "" px)))
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
|
||||
"List of directories affected by `treemacs-cleanup-litter'.
|
||||
Every item in the list is a regular expression, to be recognised a directory
|
||||
must be matched with `string-match-p'.
|
||||
|
||||
Regexp-quoting the items in this list is *not* necessary, the quoting will
|
||||
happen automatically when needed."
|
||||
:type 'list
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-read-string-input 'from-child-frame
|
||||
"The function treemacs uses to read user input.
|
||||
Only applies to plaintext input, like when renaming a project, file or
|
||||
@@ -138,10 +151,27 @@ There are 2 options:
|
||||
:type 'boolean
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-eldoc-display t
|
||||
(defcustom treemacs-eldoc-display 'simple
|
||||
"Enables eldoc display of the file path at point.
|
||||
|
||||
There are 2 options:
|
||||
- `simple': shows the absolute path of the file at point
|
||||
- `detailed': shows the absolute path, size, last modification time and
|
||||
permissions of the file at point
|
||||
|
||||
Requires eldoc mode to be enabled."
|
||||
:type 'boolean
|
||||
:type '(choice (const :tag "Simple" 'simple)
|
||||
(const :tag "Detailed" 'detailed))
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-indent-guide-style 'line
|
||||
"Determines the appearance of `treemacs-indent-guide-mode'.
|
||||
The choices are
|
||||
- `line' for indent guides to use the ' ┃ ' character for every indentation
|
||||
level
|
||||
- `block' to use a thick '██' block interspersed at every second indentation
|
||||
level"
|
||||
:type '(choice (const :tag "Line" 'line) (const :tag "Block" 'block))
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-indentation-string " "
|
||||
@@ -153,7 +183,9 @@ used when there is no windowing system available."
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-show-hidden-files t
|
||||
"Dotfiles will be shown if this is set to t and be hidden otherwise."
|
||||
"Dotfiles will be shown if this is set to t and be hidden otherwise.
|
||||
|
||||
Can be toggled by `treemacs-toggle-show-dotfiles'."
|
||||
:type 'boolean
|
||||
:group 'treemacs)
|
||||
|
||||
@@ -185,11 +217,11 @@ of how this config works and how to modify it."
|
||||
(root-node-closed . treemacs-toggle-node)
|
||||
(dir-node-open . treemacs-toggle-node)
|
||||
(dir-node-closed . treemacs-toggle-node)
|
||||
(file-node-open . treemacs-visit-node-default)
|
||||
(file-node-closed . treemacs-visit-node-default)
|
||||
(file-node-open . treemacs-visit-node-in-most-recently-used-window)
|
||||
(file-node-closed . treemacs-visit-node-in-most-recently-used-window)
|
||||
(tag-node-open . treemacs-toggle-node)
|
||||
(tag-node-closed . treemacs-toggle-node)
|
||||
(tag-node . treemacs-visit-node-default))
|
||||
(tag-node . treemacs-visit-node-in-most-recently-used-window))
|
||||
"Defines the behaviour of `treemacs-doubleclick-action'.
|
||||
|
||||
See the doc string of `treemacs-RET-actions-config' for a detailed description
|
||||
@@ -228,6 +260,23 @@ To keep the alist clean changes should not be made directly, but with
|
||||
:type '(alist :key-type symbol :value-type treemacs-ret-action)
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-COLLAPSE-actions-config
|
||||
'((root-node-open . treemacs-toggle-node)
|
||||
(root-node-closed . treemacs-goto-parent-node)
|
||||
(dir-node-open . treemacs-toggle-node)
|
||||
(dir-node-closed . treemacs-goto-parent-node)
|
||||
(file-node-open . treemacs-toggle-node)
|
||||
(file-node-closed . treemacs-goto-parent-node)
|
||||
(tag-node-open . treemacs-toggle-node)
|
||||
(tag-node-closed . treemacs-goto-parent-node)
|
||||
(tag-node . treemacs-goto-parent-node))
|
||||
"Defines the behaviour of `treemacs-COLLAPSE-action'.
|
||||
|
||||
See the doc string of `treemacs-RET-actions-config' for a detailed description
|
||||
of how this config works and how to modify it."
|
||||
:type '(alist :key-type symbol :value-type treemacs-collapse-action)
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-dotfiles-regex (rx bol "." (1+ any))
|
||||
"Files matching this regular expression count as dotfiles."
|
||||
:type 'regexp
|
||||
@@ -261,10 +310,10 @@ In plaintext: some sort settings are much slower than others. Alphabetic
|
||||
sorting \(the default) is fastest and causes no additional overhead (even when
|
||||
compared against foregoing sorting altogether).
|
||||
|
||||
Modification time sorting takes the middle, being ca. 4x slower than alphabetic.
|
||||
Sorting by size is slowest, being ca. 5-6x slower than alphabetic. It also
|
||||
produces the most garbage, making it more like for you to run into a garbage
|
||||
collection pause.
|
||||
Modification time sorting takes the middle, being ca. 4x slower than
|
||||
alphabetic. Sorting by size is slowest, being ca. 5-6x slower than alphabetic.
|
||||
It also produces the most garbage, making it more like for you to run into a
|
||||
garbage collection pause.
|
||||
|
||||
Lest these numbers scare you off keep in mind that they will likely have little
|
||||
to no effect on your usage of treemacs until you begin frequently refreshing
|
||||
@@ -283,9 +332,9 @@ treemacs views containing hundreds or even thousands of nodes."
|
||||
(pcase system-type
|
||||
('darwin '(treemacs--std-ignore-file-predicate treemacs--mac-ignore-file-predicate))
|
||||
(_ '(treemacs--std-ignore-file-predicate)))
|
||||
"List of predicates to test for files and directories ignored by Emacs.
|
||||
"List of predicates to test for files and directories ignored by treemacs.
|
||||
|
||||
Ignored files will *never* be shown in the treemacs buffer (unlike dotfiles)
|
||||
Ignored files will *never* be shown in the treemacs buffer (unlike dotfiles
|
||||
whose presence is controlled by `treemacs-show-hidden-files').
|
||||
|
||||
Each predicate is a function that takes 2 arguments: a file's name and its
|
||||
@@ -293,9 +342,10 @@ absolute path and returns t if the file should be ignored and nil otherwise. A
|
||||
file which returns t for *any* function in this list counts as ignored.
|
||||
|
||||
By default this list contains `treemacs--std-ignore-file-predicate' which
|
||||
filters out '.', '..', Emacs' lock files as well temp files created by flycheck,
|
||||
and therefore should not be directly overwritten, but added to and removed from
|
||||
instead.
|
||||
filters out '.', '..', Emacs' lock files as well temp files created by flycheck.
|
||||
This means that this variable should *not* be set directly, but instead modified
|
||||
with functions like `add-to-list'.
|
||||
|
||||
Additionally `treemacs--mac-ignore-file-predicate' is also included on
|
||||
Mac-derived operating systems (when `system-type' is `darwin')."
|
||||
:type 'list
|
||||
@@ -306,12 +356,14 @@ Mac-derived operating systems (when `system-type' is `darwin')."
|
||||
The difference between this and `treemacs-ignored-file-predicates' is that the
|
||||
functions in this list will be called on files just before they would be
|
||||
rendered, when the files' git status information is now available. This for
|
||||
example allows to make files ignored by git invisible.
|
||||
example allows to make files ignored by git invisible (however this particular
|
||||
use-case is already covered by `treemacs-hide-gitignored-files-mode').
|
||||
|
||||
The functions in this list are therefore expected to have a different signature:
|
||||
They must take two arguments - a file's absolute path and a hash table that maps
|
||||
files to their git status. The files' paths are the table's keys, its values are
|
||||
characters (and not strings) indicating the file's git condition. The chars map
|
||||
map as follows: (the pattern is derived from 'git status --porcelain')
|
||||
files to their git status. The files' paths are the table's keys, its values
|
||||
are characters (and not strings) indicating the file's git condition. The chars
|
||||
map map as follows: (the pattern is derived from 'git status --porcelain')
|
||||
|
||||
* M - file is modified
|
||||
* U - file is in conflict
|
||||
@@ -322,10 +374,7 @@ map as follows: (the pattern is derived from 'git status --porcelain')
|
||||
|
||||
Otherwise the behaviour is the same as `treemacs-ignored-file-predicates', in
|
||||
that any one function returning t for a file means that this file will not
|
||||
be rendered.
|
||||
|
||||
Since removing files ignored by git is the most likely use-case treemacs offers
|
||||
`treemacs-is-file-git-ignored?' to quickly make this possible."
|
||||
be rendered."
|
||||
:type 'list
|
||||
:group 'treemacs)
|
||||
|
||||
@@ -368,7 +417,11 @@ performance cap and to prevent too long directory names in the treemacs view.
|
||||
|
||||
To minimise this option's impact on display performance the search for
|
||||
directories to collapse is done asynchronously in a python script and will thus
|
||||
only work when python installed. The script should work both on python 2 and 3."
|
||||
only work when python installed. The script should work both on python 2 and 3.
|
||||
|
||||
If you experience incorrect display of CJK characters while using this feature
|
||||
you have to inform Emacs about your language environment using
|
||||
`set-language-environment'."
|
||||
:type 'integer
|
||||
:group 'treemacs)
|
||||
|
||||
@@ -393,6 +446,12 @@ The change will apply the next time a treemacs buffer is created."
|
||||
:type 'boolean
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-expand-after-init t
|
||||
"When non-nil expand the first project after treemacs is first initialised.
|
||||
Might be superseded by `treemacs-follow-after-init'."
|
||||
:type 'boolean
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-expand-added-projects t
|
||||
"When non-nil newly added projects will be expanded."
|
||||
:type 'boolean
|
||||
@@ -512,13 +571,13 @@ Can be set to nil to use the default value."
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-persist-file
|
||||
(f-join user-emacs-directory ".cache" "treemacs-persist")
|
||||
(expand-file-name ".cache/treemacs-persist" user-emacs-directory)
|
||||
"Path to the file treemacs uses to persist its state."
|
||||
:group 'treemacs
|
||||
:type 'string)
|
||||
|
||||
(defcustom treemacs-last-error-persist-file
|
||||
(f-join user-emacs-directory ".cache" "treemacs-persist-at-last-error")
|
||||
(expand-file-name ".cache/treemacs-persist-at-last-error" user-emacs-directory)
|
||||
"File that stores the treemacs state as it was during the last load error."
|
||||
:group 'treemacs
|
||||
:type 'string)
|
||||
@@ -564,12 +623,12 @@ missing project will not appear in the project list next time Emacs is started."
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-directory-name-transformer #'identity
|
||||
"Transformer function that is applied to directory names before rendering for any sort of cosmetic effect."
|
||||
"Transformer to apply to directory names before rendering for cosmetic effect."
|
||||
:type 'function
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-file-name-transformer #'identity
|
||||
"Transformer function that is applied to file names before rendering for any sort of cosmetic effect."
|
||||
"Transformer to apply to file names before rendering for cosmetic effect."
|
||||
:type 'function
|
||||
:group 'treemacs)
|
||||
|
||||
@@ -591,10 +650,8 @@ Note that this does *not* take `scroll-margin' into account."
|
||||
:group 'treemacs-follow)
|
||||
|
||||
(defcustom treemacs-follow-after-init nil
|
||||
"When t always find and focus the current file when treemacs is built.
|
||||
|
||||
A treemacs buffer is built when after calling `treemacs-init' or
|
||||
`treemacs-projectle-init'. This will ignore `treemacs-follow-mode'."
|
||||
"When non-nil find the current file in treemacs after it is first initialised.
|
||||
Might supersede `treemacs-expand-after-init'."
|
||||
:type 'boolean
|
||||
:group 'treemacs-follow)
|
||||
|
||||
@@ -642,8 +699,9 @@ Possible values are:
|
||||
This means that treemacs will make sure that only the currently followed project
|
||||
is expanded while all others will remain collapsed.
|
||||
|
||||
Setting this to t might lead to noticeable slowdowns, at least when `treemacs-git-mode'
|
||||
is enabled, since constantly expanding an entire project is fairly expensive."
|
||||
Setting this to t might lead to noticeable slowdowns, at least when
|
||||
`treemacs-git-mode' is enabled, since constantly expanding an entire project is
|
||||
fairly expensive."
|
||||
:type 'boolean
|
||||
:group 'treemacs-follow)
|
||||
|
||||
@@ -688,11 +746,18 @@ used to reduce the size of the output to a manageable volume for treemacs."
|
||||
(defcustom treemacs-is-never-other-window nil
|
||||
"When non-nil treemacs will use the `no-other-window' parameter.
|
||||
|
||||
In practice means that treemacs will become invisible to commands like
|
||||
In practice it means that treemacs will become invisible to commands like
|
||||
`other-window' or `evil-window-left'."
|
||||
:type 'boolean
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-width-is-initially-locked t
|
||||
"Indicates whether the width of the treemacs window is initially locked.
|
||||
A locked width means that changes it is only possible with the commands
|
||||
`treemacs-set-width' or `treemacs-toggle-fixed-width'."
|
||||
:type 'boolean
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-window-background-color nil
|
||||
"Custom background colours for the treemacs window.
|
||||
Value must be a cons cell consisting of two colours: first the background of the
|
||||
@@ -706,6 +771,16 @@ marking the selected line."
|
||||
:type 'integer
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-wide-toggle-width 70
|
||||
"When resizing, this value is added or subtracted from the window width."
|
||||
:type 'integer
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-width-increment 1
|
||||
"When resizing, this value is added or subtracted from the window width."
|
||||
:type 'integer
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-display-in-side-window t
|
||||
"When non-nil treemacs will use a dedicated side-window.
|
||||
On the one hand this will alleviate issues of unequally sized window splits when
|
||||
@@ -735,6 +810,26 @@ constituent parts, or any other value acceptable for `header-line-format'."
|
||||
:type 'string
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-text-scale nil
|
||||
"Optional scale for the text (not the icons) in the treemacs window.
|
||||
If set the value will be passed to `text-scale-increase'. Both positive and
|
||||
negative values are possible."
|
||||
:type 'integer
|
||||
:group 'treemacs-window)
|
||||
|
||||
(defcustom treemacs-select-when-already-in-treemacs 'move-back
|
||||
"How `treemacs-select-window' behaves when treemacs is already selected.
|
||||
|
||||
Possible values are:
|
||||
- `stay' - remain in the treemacs windows, effectively doing nothing
|
||||
- `close' - close the treemacs window
|
||||
- `move-back' - move point back to the most recently used window (as selected
|
||||
by `get-mru-window')"
|
||||
:type '(choice (const stay)
|
||||
(const close)
|
||||
(const move-back))
|
||||
:group 'treemacs)
|
||||
|
||||
(defcustom treemacs-position 'left
|
||||
"Position of treemacs buffer.
|
||||
|
||||
@@ -758,6 +853,37 @@ Will be called with the created file's or dir's path as the sole argument."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-delete-file-functions nil
|
||||
"Hooks to run whenever a file or directory is deleted.
|
||||
Applies only when using `treemacs-delete'. Will be called with the created
|
||||
file's or dir's path as the sole argument."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-rename-file-functions nil
|
||||
"Hooks to run whenever a file or directory is renamed.
|
||||
|
||||
Applies only when using `treemacs-rename'. Will be called with 2 arguments: the
|
||||
file's old name, and the file's new name, both as absolute paths."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-move-file-functions nil
|
||||
"Hooks to run whenever a file or directory is moved.
|
||||
|
||||
Applies only when using `treemacs-move-file'. Will be called with 2 arguments:
|
||||
the file's old location, and the file's new location, both as absolute paths."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-copy-file-functions nil
|
||||
"Hooks to run whenever a file or directory is copied.
|
||||
|
||||
Applies only when using `treemacs-copy-file'. Will be called with 2 arguments:
|
||||
the original file's location, and the copy's location, both as absolute paths."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-delete-project-functions nil
|
||||
"Hooks to run whenever a project is deleted.
|
||||
Will be called with the deleted project as the sole argument *after* it has been
|
||||
@@ -765,6 +891,28 @@ deleted."
|
||||
:type 'hook
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-find-workspace-method 'find-for-file-or-pick-first
|
||||
"The method by which treemacs selects a workspace when first starting.
|
||||
There are 3 options:
|
||||
- `find-for-file-or-pick-first' means treemacs will select the first workspace
|
||||
with a project that contains the current buffer's file. If no such workspace
|
||||
exists, or if the current buffer is not visiting a file, the first workspace
|
||||
in the list (as seen in `treemacs-edit-workspaces' or picked with
|
||||
`treemacs-set-fallback-workspace') is selected
|
||||
- `find-for-file-or-manually-select' works the same, but an interactive
|
||||
selection is used as fallback instead
|
||||
- `always-ask' means the workspace *always* has to be manually selected
|
||||
|
||||
Note that the selection process will be skipped if there is only one workspace."
|
||||
:type '(choice (const
|
||||
:tag "Find workspace for current file, pick the first workspace as falback"
|
||||
find-for-file-or-pick-first)
|
||||
(const
|
||||
:tag "Find workspace for current file, interactively select workspace as falback"
|
||||
find-for-file-or-manually-select)
|
||||
(const :tag "Always ask" always-ask))
|
||||
:group 'treemacs-hooks)
|
||||
|
||||
(defcustom treemacs-rename-project-functions nil
|
||||
"Hooks to run whenever a project is renamed.
|
||||
Will be called with the renamed project and the old name as its arguments."
|
||||
@@ -912,7 +1060,8 @@ available \"Treemacs\" text will be displayed.
|
||||
|
||||
Setting this to `none' will disable the modeline.
|
||||
|
||||
For more specific information about formatting mode line check `mode-line-format'."
|
||||
For more specific information about formatting mode line check
|
||||
`mode-line-format'."
|
||||
:type 'sexp
|
||||
:group 'treemacs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user