pkg update and first config fix

org-brain not working, add org-roam
This commit is contained in:
2022-12-19 23:02:34 +01:00
parent 02b3e07185
commit 82f05baffe
885 changed files with 356098 additions and 36993 deletions

View File

@@ -1,6 +1,6 @@
;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*-
;; Copyright (C) 2021 Alexander Miller
;; Copyright (C) 2022 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,9 +26,8 @@
(require 'treemacs-scope)
(require 'treemacs-follow-mode)
(require 'treemacs-core-utils)
(treemacs-import-functions-from "treemacs"
treemacs-display-current-project-exclusively)
(eval-when-compile
(require 'treemacs-macros))
(defvar treemacs--project-follow-timer nil
"Idle timer for `treemacs-project-follow-mode'.")
@@ -40,44 +39,54 @@
"Debounced display of the current project for `treemacs-project-follow-mode'.
Used as a hook for `window-buffer-change-functions', thus the ignored parameter."
(treemacs-debounce treemacs--project-follow-timer treemacs--project-follow-delay
(-when-let (window (treemacs-get-local-window))
(treemacs-block
(let* ((ws (treemacs-current-workspace))
(new-project-path (treemacs--find-current-user-project))
(old-project-path (-some-> ws
(treemacs-workspace->projects)
(car)
(treemacs-project->path))))
(treemacs-return-if
(or treemacs--in-this-buffer
(null new-project-path)
(bound-and-true-p edebug-mode)
(frame-parent)
(and (= 1 (length (treemacs-workspace->projects ws)))
(string= new-project-path old-project-path))))
(-let [new-project-name (treemacs--filename new-project-path)]
(setf (treemacs-workspace->projects ws) nil)
(-let [add-result (treemacs-do-add-project-to-workspace
new-project-path new-project-name)]
(treemacs-return-if (not (eq 'success (car add-result)))
(treemacs-log-err "Something went wrong when adding project at '%s': %s"
(propertize new-project-path 'face 'font-lock-string-face)
add-result)))
(with-selected-window window
(treemacs--consolidate-projects))
(treemacs--follow)))))))
(treemacs--do-follow-project)))
(defun treemacs--do-follow-project()
"Actual, un-debounced, implementation of project following."
(-when-let (window (treemacs-get-local-window))
(treemacs-block
(let* ((ws (treemacs-current-workspace))
(new-project-path (treemacs--find-current-user-project))
(old-project-path (-some-> ws
(treemacs-workspace->projects)
(car)
(treemacs-project->path))))
(treemacs-return-if
(or treemacs--in-this-buffer
(null new-project-path)
(string= (expand-file-name "~")
new-project-path)
(bound-and-true-p edebug-mode)
(frame-parent)
(and (= 1 (length (treemacs-workspace->projects ws)))
(string= new-project-path old-project-path))))
(save-selected-window
(treemacs--show-single-project
new-project-path (treemacs--filename new-project-path))
(treemacs--follow)
(hl-line-highlight))))))
(defun treemacs--follow-project-after-buffer-init ()
"Hook to follow the current project when a treemacs buffer is created.
Used for `treemacs-post-buffer-init-hook', so it will run inside the treemacs
window."
(with-selected-window (next-window (selected-window))
(treemacs--do-follow-project)))
(defun treemacs--setup-project-follow-mode ()
"Setup all the hooks needed for `treemacs-project-follow-mode'."
(when treemacs--project-follow-timer (cancel-timer treemacs--project-follow-timer))
(setf treemacs--project-follow-timer nil)
(add-hook 'window-buffer-change-functions #'treemacs--follow-project)
(add-hook 'window-selection-change-functions #'treemacs--follow-project)
(treemacs--follow-project nil))
(add-hook 'treemacs-post-buffer-init-hook #'treemacs--follow-project-after-buffer-init))
(defun treemacs--tear-down-project-follow-mode ()
"Remove the hooks added by `treemacs--setup-project-follow-mode'."
(cancel-timer treemacs--project-follow-timer)
(remove-hook 'window-buffer-change-functions #'treemacs--follow-project)
(remove-hook 'window-selection-change-functions #'treemacs--follow-project))
(remove-hook 'window-selection-change-functions #'treemacs--follow-project)
(remove-hook 'treemacs-post-buffer-init-hook #'treemacs--follow-project-after-buffer-init))
;;;###autoload
(define-minor-mode treemacs-project-follow-mode