summaryrefslogtreecommitdiff
path: root/elchemy-dashboard.el
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-06-12 23:17:41 -0700
committerChristian Cunningham <cc@localhost>2024-06-12 23:17:41 -0700
commitb0c87544fe0c8b103354904370445757e05b9bab (patch)
treef92092e6a684501ba115631cecd87054e8c29d4a /elchemy-dashboard.el
parentdafe93397ae082eff584fd27762fbc0556067af6 (diff)
Restructuring
- Break functions out to their own files - Move user settings to its own file - Move dashboard to its own file - Remove old splash - Don't hardcode executables
Diffstat (limited to 'elchemy-dashboard.el')
-rw-r--r--elchemy-dashboard.el63
1 files changed, 63 insertions, 0 deletions
diff --git a/elchemy-dashboard.el b/elchemy-dashboard.el
new file mode 100644
index 0000000..5116807
--- /dev/null
+++ b/elchemy-dashboard.el
@@ -0,0 +1,63 @@
+(defun elchemy/create-dashboard ()
+ "Create the user dashboard"
+ (interactive)
+ (let ((buffer (get-buffer-create "*Dashboard*")))
+ (switch-to-buffer buffer)
+ (unless buffer-read-only
+ (when (file-exists-p (concat elchemy/elchemy-root elchemy/dashboard-splash))
+ (insert-image (create-image (concat elchemy/elchemy-root elchemy/dashboard-splash) nil nil :scale 0.25))
+ (insert "\n"))
+ (let ((start (point)))
+ (insert "Elchemy Dashboard")
+ (add-text-properties start (point)
+ '(face (:height 4.0))))
+ (insert "\n\n")
+ (dotimes (i (length elchemy/dashboard/heading-buttons))
+ (let* ((button (nth i elchemy/dashboard/heading-buttons))
+ (title (car button))
+ (callback (cdr button)))
+ (insert (buttonize title callback))
+ (if (eq (% (+ i 1) elchemy/dashboard/heading-columns) 0)
+ (insert "\n")
+ (insert (format (concat "%-" (format "%d" (+ (- elchemy/dashboard/heading-max-length (length title)) elchemy/dashboard/heading-padding)) "s") " ")))))
+ (unless (eq (% (length elchemy/dashboard/heading-buttons) elchemy/dashboard/heading-columns) 0)
+ (insert "\n"))
+ (insert "\n\n")
+ (when (file-exists-p (concat elchemy/elchemy-root elchemy/elchemy-projects-file))
+ (let ((start (point)))
+ (insert "Projects")
+ (add-text-properties start (point)
+ '(face (:height 1.5))))
+ (insert "\n")
+ (mapcar #'(lambda (x) (let ((name (car x))
+ (path (cdr x)))
+ (insert (buttonize name (lambda (y) (elchemy/find-file y)) path) "\n")))
+ (elchemy/read-alist-file (concat elchemy/elchemy-root elchemy/elchemy-projects-file)))
+ (insert "\n"))
+ (let ((start (point)))
+ (insert "Command Reference")
+ (add-text-properties start (point)
+ '(face (:height 1.5))))
+ (insert "\n")
+ (insert "C-/ ~ Undo\n")
+ (insert "C-x n n ~ Narrow\n")
+ (insert "C-x n w ~ Widen\n")
+ (insert "M-% ~ Query Replace\n")
+ (insert "C-M-s ~ Regex Search\n")
+ (insert "F3 ~ Record Macro\n")
+ (insert "F4 ~ Play Macro\n")
+ (insert "M-0 F4 ~ Play Macro until failure\n")
+ (insert "M-l ~ Lowercase following word\n")
+ (insert "M-u ~ Uppercase following word\n")
+ (insert "M-c ~ Capitalize following word\n")
+ (insert "M-g w ~ Jump to word\n")
+ (insert "M-g l ~ Jump to line\n")
+ (insert "C-x C-l ~ Lowercase Region\n")
+ (insert "C-x C-u ~ Uppercase Region\n")
+ (insert "C-M-n ~ Move forward one balanced expression\n")
+ (insert "C-M-p ~ Move forward one balanced expression\n")
+ (setq header-line-format nil)
+ (button-mode +1)
+ (read-only-mode +1))))
+
+(provide 'elchemy-dashboard)