summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-06-08 17:10:58 -0700
committerChristian Cunningham <cc@localhost>2024-06-08 17:10:58 -0700
commit7eebb222adee907d20f64f8dde1b3acfd3474468 (patch)
tree6df0bed5510e91d62522f012b11805614c900370
parent12ea68ab72a34daf0f554a73867207f51cdbd1e6 (diff)
Fix Dashboard
1. Open files in new window 2. Fix project buttons
-rw-r--r--elchemy-personal.el33
1 files changed, 26 insertions, 7 deletions
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")