pkg update and first config fix
org-brain not working, add org-roam
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
;;; treemacs-magit.el --- Magit integration for treemacs -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2021 Alexander Miller
|
||||
;; Copyright (C) 2022 Alexander Miller
|
||||
|
||||
;; Author: Alexander Miller <alexanderm@web.de>
|
||||
;; Package-Requires: ((emacs "26.1") (treemacs "0.0") (pfuture "1.3" ) (magit "2.90.0"))
|
||||
;; Package-Version: 20211010.1005
|
||||
;; Package-Commit: deb7f2cd9eb06960798edd7393df2602902ed071
|
||||
;; Package-Version: 20220917.1026
|
||||
;; Package-Commit: 13a8a060b784021f3d6bd7c27f2a0bcf6ea0d087
|
||||
;; Version: 0
|
||||
;; Homepage: https://github.com/Alexander-Miller/treemacs
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
(defalias 'if-let* #'if-let)
|
||||
(defalias 'when-let* #'when-let)))
|
||||
|
||||
;;;; Filewatch
|
||||
|
||||
(defvar treemacs-magit--timers nil
|
||||
"Cached list of roots an update is scheduled for.")
|
||||
|
||||
@@ -92,7 +94,8 @@ current git status and just go through the lines as they are right now."
|
||||
(treemacs-find-in-dom)
|
||||
(treemacs-dom-node->children)
|
||||
(-map #'treemacs-dom-node->key)))
|
||||
(push dir visible-dirs)))
|
||||
(when (stringp dir)
|
||||
(push dir visible-dirs))))
|
||||
(pfuture-callback `(,treemacs-python-executable
|
||||
"-O" "-S"
|
||||
,treemacs--git-status.py
|
||||
@@ -130,16 +133,22 @@ Will update nodes under MAGIT-ROOT with output in PFUTURE-BUFFER."
|
||||
(path (-some-> node (treemacs-button-get :key))))
|
||||
(treemacs-with-writable-buffer
|
||||
(while (and node
|
||||
(or (not (stringp path))
|
||||
(file-exists-p path))
|
||||
(>= curr-depth start-depth))
|
||||
(put-text-property (treemacs-button-start node) (treemacs-button-end node) 'face
|
||||
(treemacs--get-node-face
|
||||
path ht
|
||||
(if (memq (treemacs-button-get node :state)
|
||||
'(file-node-open file-node-closed))
|
||||
'treemacs-git-unmodified-face
|
||||
'treemacs-directory-face)))
|
||||
(when (and (stringp path)
|
||||
(file-exists-p path))
|
||||
(treemacs--git-face-quick-change
|
||||
(treemacs-button-get node :key)
|
||||
(or (ht-get ht path)
|
||||
(if (memq (treemacs-button-get node :state)
|
||||
'(file-node-open file-node-closed))
|
||||
'treemacs-git-unmodified-face
|
||||
'treemacs-directory-face)))
|
||||
(put-text-property (treemacs-button-start node) (treemacs-button-end node) 'face
|
||||
(or (ht-get ht path)
|
||||
(if (memq (treemacs-button-get node :state)
|
||||
'(file-node-open file-node-closed))
|
||||
'treemacs-git-unmodified-face
|
||||
'treemacs-directory-face))))
|
||||
(forward-line 1)
|
||||
(if (eobp)
|
||||
(setf node nil)
|
||||
@@ -153,6 +162,49 @@ Will update nodes under MAGIT-ROOT with output in PFUTURE-BUFFER."
|
||||
(add-hook 'magit-post-stage-hook #'treemacs-magit--schedule-update)
|
||||
(add-hook 'magit-post-unstage-hook #'treemacs-magit--schedule-update))
|
||||
|
||||
;;;; Git Commit Diff
|
||||
|
||||
(defvar treemacs--git-commit-diff.py)
|
||||
(defvar treemacs--commit-diff-ann-source)
|
||||
|
||||
(defconst treemacs--commit-diff-update-commands
|
||||
(list "pull" "push" "commit" "merge" "rebase" "cherry-pick" "fetch" "checkout")
|
||||
"List of git commands that change local/remote commit status info.
|
||||
Relevant for integrating with `treemacs-git-commit-diff-mode'.")
|
||||
|
||||
(defun treemacs--update-commit-diff-after-magit-process (process &rest _)
|
||||
"Update commit diffs after completion of a magit git PROCESS."
|
||||
(when (memq (process-status process) '(exit signal))
|
||||
(let* ((args (process-command process))
|
||||
(command (car (nthcdr (1+ (length magit-git-global-arguments)) args))))
|
||||
(when (member command treemacs--commit-diff-update-commands)
|
||||
(-let [path (process-get process 'default-dir)]
|
||||
(pfuture-callback `(,treemacs-python-executable "-O" ,treemacs--git-commit-diff.py ,path)
|
||||
:directory path
|
||||
:on-success
|
||||
(-let [out (-> (pfuture-callback-output)
|
||||
(string-trim-right)
|
||||
(read))]
|
||||
(treemacs-run-in-every-buffer
|
||||
(-when-let* ((project (treemacs--find-project-for-path path))
|
||||
(project-path (treemacs-project->path project)))
|
||||
(if out
|
||||
(treemacs-set-annotation-suffix
|
||||
project-path out treemacs--commit-diff-ann-source)
|
||||
(treemacs-remove-annotation-suffix project-path treemacs--commit-diff-ann-source))
|
||||
(treemacs-apply-single-annotation project-path))))))))))
|
||||
|
||||
(defun treemacs--magit-commit-diff-setup ()
|
||||
"Enable or disable magit advice for `treemacs-git-commit-diff-mode'."
|
||||
(if (bound-and-true-p treemacs-git-commit-diff-mode)
|
||||
(advice-add #'magit-process-sentinel :after #'treemacs--update-commit-diff-after-magit-process)
|
||||
(advice-remove #'magit-process-sentinel #'treemacs--update-commit-diff-after-magit-process)))
|
||||
|
||||
(unless (featurep 'treemacs-magit)
|
||||
(add-hook 'treemacs-git-commit-diff-mode-hook #'treemacs--magit-commit-diff-setup)
|
||||
(when (bound-and-true-p treemacs-git-commit-diff-mode)
|
||||
(advice-add #'magit-process-sentinel :after #'treemacs--update-commit-diff-after-magit-process)))
|
||||
|
||||
(provide 'treemacs-magit)
|
||||
|
||||
;;; treemacs-magit.el ends here
|
||||
|
||||
Reference in New Issue
Block a user