From 7eebb222adee907d20f64f8dde1b3acfd3474468 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 8 Jun 2024 17:10:58 -0700 Subject: Fix Dashboard 1. Open files in new window 2. Fix project buttons --- elchemy-personal.el | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'elchemy-personal.el') diff --git a/elchemy-personal.el b/elchemy-personal.el index b609a8d..408d35e 100644 --- a/elchemy-personal.el +++ b/elchemy-personal.el @@ -76,6 +76,22 @@ (push pair result)))) (forward-line 1))) (reverse result))) + +(defun elchemy/find-file (FILENAME) + "Find File to new split" + (let ((buffer (find-file-noselect FILENAME))) + (when (one-window-p) + (split-window-right)) + (other-window 1) + (switch-to-buffer buffer))) + +(defun elchemy/term (TERM) + "Terminal to new split" + (when (one-window-p) + (split-window-right)) + (other-window 1) + (term TERM)) + (defun elchemy/create-dashboard () "Create the user dashboard" (interactive) @@ -91,22 +107,22 @@ '(face (:height 4.0)))) (insert "\n\n") (insert - (buttonize "Open Local TODO" (lambda (x) (find-file "~/org/todo.org")))) + (buttonize "Open Local TODO" (lambda (x) (elchemy/find-file "~/org/todo.org")))) (insert " ") (insert - (buttonize "Open Remote TODO" (lambda (x) (find-file "/ssh:onid:todo.org")))) + (buttonize "Open Remote TODO" (lambda (x) (elchemy/find-file "/ssh:onid:todo.org")))) (insert "\n") (insert - (buttonize "Open Local Notes" (lambda (x) (find-file "~/org/notes.org")))) + (buttonize "Open Local Notes" (lambda (x) (elchemy/find-file "~/org/notes.org")))) (insert " ") (insert - (buttonize "Open Remote Notes" (lambda (x) (find-file "/ssh:onid:knowledge.org")))) + (buttonize "Open Remote Notes" (lambda (x) (elchemy/find-file "/ssh:onid:knowledge.org")))) (insert "\n\n") (insert - (buttonize "Open Terminal (zsh)" (lambda (x) (term "/bin/zsh")))) + (buttonize "Open Terminal (zsh)" (lambda (x) (elchemy/term "/bin/zsh")))) (insert "\n\n") (insert - (buttonize "Open Personal Configuration" (lambda (x) (find-file "~/.elchemy/elchemy-personal.el")))) + (buttonize "Open Personal Configuration" (lambda (x) (elchemy/find-file "~/.elchemy/elchemy-personal.el")))) (insert "\n\n") (when (file-exists-p "~/.elchemy/projects") (let ((start (point))) @@ -114,7 +130,10 @@ (add-text-properties start (point) '(face (:height 1.5)))) (insert "\n") - (mapcar #'(lambda (x) (insert (buttonize (car x) (lambda (y) (find-file (cdr x)))) "\n")) (elchemy/read-alist-file "~/.elchemy/projects")) + (mapcar #'(lambda (x) (let ((name (car x)) + (path (cdr x))) + (insert (eval (read (concat "(buttonize \"" name "\" (lambda (y) (elchemy/find-file \"" path "\")))"))) "\n"))) + (elchemy/read-alist-file "~/.elchemy/projects")) (insert "\n")) (let ((start (point))) (insert "Command Reference") -- cgit v1.2.1