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:
parent
f08a6dda04
commit
c4654e31bf
|
@ -1,6 +1,6 @@
|
||||||
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
;;; 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:
|
;;; Commentary:
|
||||||
;; * treemacs
|
;; * treemacs
|
||||||
|
@ -30,14 +30,20 @@
|
||||||
:extend t))
|
:extend t))
|
||||||
(defun my/treemacs-set-hl-line ()
|
(defun my/treemacs-set-hl-line ()
|
||||||
(set (make-local-variable 'hl-line-face)
|
(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.
|
:bind (("<f9>" . treemacs-select-window) ; Focus treemacs.
|
||||||
("C-<f9>" . treemacs) ; Toggle treemacs.
|
("C-<f9>" . treemacs) ; Toggle treemacs.
|
||||||
("M-<f9>" . treemacs-add-and-display-current-project)
|
("M-<f9>" . treemacs-add-and-display-current-project)
|
||||||
(:map treemacs-mode-map
|
(:map treemacs-mode-map
|
||||||
("<mouse-1>" . treemacs-single-click-expand-action)))
|
("<mouse-1>" . treemacs-single-click-expand-action)))
|
||||||
:hook ((treemacs-mode . my/disable-line-numbers)
|
: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
|
(use-package treemacs-projectile
|
||||||
:demand t
|
:demand t
|
||||||
|
|
Loading…
Reference in New Issue
Block a user