update of packages
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2022 Alexander Miller
|
||||
;; Copyright (C) 2023 Alexander Miller
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
@@ -84,12 +84,12 @@
|
||||
|
||||
(treemacs-import-functions-from "treemacs-visuals"
|
||||
treemacs-pulse-on-success
|
||||
treemacs--tear-down-icon-highlight
|
||||
treemacs--forget-previously-follow-tag-btn
|
||||
treemacs--forget-last-highlight)
|
||||
treemacs--forget-previously-follow-tag-btn)
|
||||
|
||||
(treemacs-import-functions-from "treemacs-async"
|
||||
treemacs--git-status-process
|
||||
treemacs--non-simple-git-mode-enabled
|
||||
treemacs-update-single-file-git-state
|
||||
treemacs--collapsed-dirs-process)
|
||||
|
||||
(treemacs-import-functions-from "treemacs-dom"
|
||||
@@ -154,6 +154,16 @@ Used in `treemacs-is-node-expanded?'")
|
||||
(substring ,path 0 -1)
|
||||
,path))))
|
||||
|
||||
(define-inline treemacs-string-trim-right (string)
|
||||
"Trim STRING of trailing string matching REGEXP.
|
||||
|
||||
Same as the builtin `string-trim-right', but re-implemented here for Emacs 27."
|
||||
(declare (side-effect-free t))
|
||||
(inline-letevals (string)
|
||||
(inline-quote
|
||||
(let ((i (string-match-p "\\(?:[ \t\n\r]+\\)\\'" ,string)))
|
||||
(if i (substring ,string 0 i) ,string)))))
|
||||
|
||||
(define-inline treemacs--prefix-arg-to-recurse-depth (arg)
|
||||
"Translates prefix ARG into a number.
|
||||
Used for depth-based expansion of nodes - a numeric prefix will translate to
|
||||
@@ -398,18 +408,16 @@ FILE here is a list consisting of an absolute path and file attributes."
|
||||
(and (not (s-matches? treemacs-dotfiles-regex filename))
|
||||
(--none? (funcall it filename ,file) treemacs-ignored-file-predicates))))))
|
||||
|
||||
(define-inline treemacs--file-extension (filename)
|
||||
(defun treemacs--file-extension (filename)
|
||||
"Same as `file-name-extension', but also works with leading periods.
|
||||
|
||||
This is something a of workaround to easily allow assigning icons to a FILENAME
|
||||
with a name like '.gitignore' without always having to check for both filename
|
||||
extensions and special names like this."
|
||||
(declare (side-effect-free t))
|
||||
(inline-letevals (filename)
|
||||
(inline-quote
|
||||
(if (string-match treemacs-file-extension-regex ,filename)
|
||||
(substring ,filename (1+ (match-beginning 0)))
|
||||
,filename))))
|
||||
(if (string-match treemacs-file-extension-regex filename)
|
||||
(substring filename (1+ (match-beginning 0)))
|
||||
filename))
|
||||
|
||||
(define-inline treemacs-is-treemacs-window? (window)
|
||||
"Return t when WINDOW is showing a treemacs buffer."
|
||||
@@ -465,7 +473,10 @@ being edited to trigger."
|
||||
;; filewatch mode needs the node's information to be in the dom
|
||||
(unless (with-no-warnings treemacs-filewatch-mode)
|
||||
(treemacs-run-in-every-buffer
|
||||
(treemacs-on-collapse ,path t)))))))
|
||||
(treemacs-on-collapse ,path t)))
|
||||
(when (treemacs--non-simple-git-mode-enabled)
|
||||
(treemacs-run-in-every-buffer
|
||||
(treemacs-update-single-file-git-state (treemacs--parent-dir ,path))))))))
|
||||
|
||||
(define-inline treemacs--refresh-dir (path &optional project)
|
||||
"Local refresh for button at PATH and PROJECT.
|
||||
@@ -1039,16 +1050,21 @@ Will be added to `treemacs-ignored-file-predicates' on Macs."
|
||||
|
||||
(defun treemacs--popup-window ()
|
||||
"Pop up a side window and buffer for treemacs."
|
||||
(if treemacs-display-in-side-window
|
||||
(-> (treemacs-get-local-buffer-create)
|
||||
(display-buffer-in-side-window `((side . ,treemacs-position)))
|
||||
(select-window))
|
||||
(-> (selected-window)
|
||||
(frame-root-window)
|
||||
(split-window nil treemacs-position)
|
||||
(select-window))
|
||||
(-let [buf (treemacs-get-local-buffer-create)]
|
||||
(switch-to-buffer buf))))
|
||||
(let ((buf (treemacs-get-local-buffer-create)))
|
||||
(display-buffer buf
|
||||
`(,(if treemacs-display-in-side-window
|
||||
'display-buffer-in-side-window
|
||||
'display-buffer-in-direction)
|
||||
. (;; for buffer in direction
|
||||
(direction . ,treemacs-position)
|
||||
(window . root)
|
||||
;; for side windows
|
||||
(slot . -1)
|
||||
(side . ,treemacs-position)
|
||||
;; general-purpose settings
|
||||
(window-width . ,treemacs-width)
|
||||
(dedicated . t))))
|
||||
(select-window (get-buffer-window buf))))
|
||||
|
||||
(defun treemacs--setup-buffer ()
|
||||
"Create and setup a buffer for treemacs in the right position and size."
|
||||
@@ -1064,11 +1080,7 @@ Will be added to `treemacs-ignored-file-predicates' on Macs."
|
||||
(treemacs--popup-window)
|
||||
(with-current-buffer lv-buffer (setf window-size-fixed t)))
|
||||
(treemacs--popup-window))
|
||||
(treemacs--forget-last-highlight)
|
||||
(set-window-dedicated-p (selected-window) t)
|
||||
(setq-local treemacs--in-this-buffer t)
|
||||
(let ((window-size-fixed))
|
||||
(treemacs--set-width treemacs-width)))
|
||||
(setq-local treemacs--in-this-buffer t))
|
||||
|
||||
(define-inline treemacs--parent (path)
|
||||
"Parent of PATH, or PATH itself if PATH is the root directory.
|
||||
@@ -1106,8 +1118,12 @@ Returns a cons cell of a descriptive string name and the sorting symbol."
|
||||
(declare (side-effect-free t))
|
||||
(let* ((sort-names '(("Sort Alphabetically Ascending" . alphabetic-asc)
|
||||
("Sort Alphabetically Descending" . alphabetic-desc)
|
||||
("Sort Alphabetically and Numerically Ascending" . alphabetic-numeric-asc)
|
||||
("Sort Alphabetically and Numerically Descending" . alphabetic-numeric-desc)
|
||||
("Sort Case Insensitive Alphabetically Ascending" . alphabetic-case-insensitive-asc)
|
||||
("Sort Case Insensitive Alphabetically Descending" . alphabetic-case-insensitive-desc)
|
||||
("Sort Case Insensitive Alphabetically and Numerically Ascending" . alphabetic-numeric-case-insensitive-asc)
|
||||
("Sort Case Insensitive Alphabetically and Numerically Descending" . alphabetic-numeric-case-insensitive-desc)
|
||||
("Sort by Size Ascending" . size-asc)
|
||||
("Sort by Size Descending" . size-desc)
|
||||
("Sort by Modification Date Ascending" . mod-time-asc)
|
||||
|
||||
Reference in New Issue
Block a user