update packages

This commit is contained in:
2022-01-04 21:35:17 +01:00
parent 1d5275c946
commit 8de00e5202
700 changed files with 42441 additions and 85378 deletions

View File

@@ -16,14 +16,14 @@
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; General purpose macros, and those used in, but defined outside of
;;; treemacs-core-utils.el are put here, to prevent using them before their
;;; definition, hopefully preventing issues like #97.
;; General purpose macros, and those used in, but defined outside of
;; treemacs-core-utils.el are put here, to prevent using them before
;; their definition, hopefully preventing issues like #97.
;;; Code:
(require 'dash)
(require 'f)
(require 's)
(require 'pcase)
@@ -161,12 +161,12 @@ executed."
(&key no-match-explanation
window
split-function
save-window
ensure-window-split
dir-action
file-action
tag-section-action
tag-action)
tag-action
window-arg)
"Infrastructure macro for setting up actions on different button states.
Fetches the currently selected button and verifies it's in the correct state
@@ -175,16 +175,16 @@ based on the given state actions.
If it isn't it will log NO-MATCH-EXPLANATION, if it is it selects WINDOW (or
`next-window' if none is given) and splits it with SPLIT-FUNCTION if given.
If SAVE-WINDOW is non-nil the selected window will remain selected after the
actions have been executed.
If ENSURE-WINDOW-SPLIT is non-nil treemacs will vertically split the window if
treemacs is the only window to make sure a buffer is opened next to it, not
under or below it.
DIR-ACTION, FILE-ACTION, TAG-SECTION-ACTION and TAG-ACTION are inserted into a
`pcase' statement matching the buttons state. Project root nodes are treated
the same common directory nodes."
the same common directory nodes.
WINDOW-ARG determines whether the treemacs windows should remain selected,
\(single prefix arg), or deleted (double prefix arg)."
(declare (debug (&rest [sexp form])))
(let ((valid-states (list)))
(when dir-action
@@ -235,9 +235,11 @@ the same common directory nodes."
(funcall visit-action btn)
(error "No match achieved even though button's state %s was part of the set of valid states %s"
state ',valid-states))))
(when ,save-window
(select-window current-window))))))))))
(pcase ,window-arg
('(4) (select-window current-window))
('(16) (delete-window current-window)))))))))))
;; TODO(2021/08/28): RM
(defmacro treemacs--without-filewatch (&rest body)
"Run BODY without triggering the filewatch callback.
Required for manual interactions with the file system (like deletion), otherwise
@@ -278,7 +280,7 @@ not work keep it on the same line."
(treemacs-goto-file-node curr-file))
((or 'dir-node-open 'dir-node-closed 'file-node-open 'file-node-closed)
;; stay on the same file
(if (and (file-exists-p curr-file)
(if (and (treemacs-is-path-visible? curr-file)
(or treemacs-show-hidden-files
(not (s-matches? treemacs-dotfiles-regex (treemacs--filename curr-file)))))
(treemacs-goto-file-node curr-file)
@@ -286,7 +288,7 @@ not work keep it on the same line."
;; try dodging to our immediate neighbours, if they are no longer visible either
;; keep going up
(cl-labels
((can-move-to (it) (and (file-exists-p it)
((can-move-to (it) (and (treemacs-is-path-visible? it)
(or treemacs-show-hidden-files
(not (s-matches? treemacs-dotfiles-regex (treemacs--filename it)))))))
(cond
@@ -316,7 +318,8 @@ not work keep it on the same line."
(-let [buffer-point (point)]
(with-selected-window curr-window
;; recenter starts counting at 0
(recenter (1- curr-win-line))
(-let [scroll-margin 0]
(recenter (1- curr-win-line)))
(set-window-point (selected-window) buffer-point))))
,@final-form)))
@@ -372,16 +375,16 @@ Entry variables will bound based on NAMES which is a list of two elements."
,table)))
(defmacro treemacs-error-return (error-msg &rest msg-args)
"Early return failure from `treemacs-block'.
Will pass ERROR-MSG and MSG-ARGS to `treemacs-pulse-on-failure'."
"Interactive early return failure from `treemacs-block'.
Will also pass ERROR-MSG and MSG-ARGS to `treemacs-pulse-on-failure'."
(declare (indent 1) (debug (form body)))
`(cl-return-from __body__
(treemacs-pulse-on-failure ,error-msg ,@msg-args)))
(defmacro treemacs-error-return-if (predicate error-msg &rest msg-args)
"Early return from `treemacs-block'.
When PREDICATE returns non-nil value will pass ERROR-MSG and MSG-ARGS to
`treemacs-pulse-on-failure'."
"Interactive early return from `treemacs-block'.
Checks if PREDICATE returns a non-nil value, and will pass also ERROR-MSG and
MSG-ARGS to `treemacs-pulse-on-failure'."
(declare (indent 1) (debug (form sexp body)))
`(when ,predicate
(cl-return-from __body__
@@ -392,7 +395,7 @@ When PREDICATE returns non-nil value will pass ERROR-MSG and MSG-ARGS to
(declare (debug t))
`(cl-return-from __body__ ,ret))
(defmacro treemacs-return-if (predicate ret)
(defmacro treemacs-return-if (predicate &optional ret)
"Early return from `treemacs-block'.
When PREDICATE returns non-nil RET will be returned."
(declare (indent 1) (debug (form sexp)))
@@ -528,8 +531,18 @@ Based on a timer GUARD variable run function with the given DELAY and BODY."
(run-with-idle-timer
,delay nil
(lambda ()
,@body
(setf ,guard nil))))))
(unwind-protect
(progn ,@body)
(setf ,guard nil)))))))
(defmacro treemacs-without-recenter (&rest body)
"Run BODY without the usual recentering for expanded nodes.
Specifically `treemacs--no-recenter' will be set to 't' so that
`treemacs--maybe-recenter' will have no effect during non-interactive updates
triggered by e.g. filewatch-mode."
(declare (debug t))
`(let ((treemacs--no-recenter t))
,@body))
(provide 'treemacs-macros)