Emacs: Show treemacs on start under certain conditions.

If the frame width is at least 120 chars and treemacs-persist-file
exists.
This commit is contained in:
tastytea 2020-11-14 22:10:34 +01:00
parent f08a6dda04
commit c4654e31bf
1 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,6 @@
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-11-14T22:07:12+0100>
;; Time-stamp: <2020-11-14T22:10:17+0100>
;;; Commentary:
;; * treemacs
@ -30,14 +30,20 @@
:extend t))
(defun my/treemacs-set-hl-line ()
(set (make-local-variable 'hl-line-face)
'hl-line-treemacs-face)))
'hl-line-treemacs-face))
(defun my/treemacs-show-maybe ()
(when (and (>= (frame-width) 120)
(file-exists-p treemacs-persist-file))
(treemacs)
(other-window 1))))
:bind (("<f9>" . treemacs-select-window) ; Focus treemacs.
("C-<f9>" . treemacs) ; Toggle treemacs.
("M-<f9>" . treemacs-add-and-display-current-project)
(:map treemacs-mode-map
("<mouse-1>" . treemacs-single-click-expand-action)))
:hook ((treemacs-mode . my/disable-line-numbers)
(treemacs-mode . my/treemacs-set-hl-line)))
(treemacs-mode . my/treemacs-set-hl-line)
(after-init . my/treemacs-show-maybe)))
(use-package treemacs-projectile
:demand t