summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-06-12 21:36:46 -0700
committerChristian Cunningham <cc@localhost>2024-06-12 21:36:46 -0700
commitdafe93397ae082eff584fd27762fbc0556067af6 (patch)
tree6bd5704bc8065bdae87a314fe9b7183f66e48f2a
parent6719d2c5678a9756eaf093aec3ac4223c35b8a72 (diff)
Generate Heading Table
-rw-r--r--elchemy-personal.el64
1 files changed, 39 insertions, 25 deletions
diff --git a/elchemy-personal.el b/elchemy-personal.el
index 8d13bdd..ac99314 100644
--- a/elchemy-personal.el
+++ b/elchemy-personal.el
@@ -92,6 +92,23 @@
(other-window 1)
(term TERM))
+(setq elchemy/dashboard/heading-columns 3
+ elchemy/dashboard/heading-buttons '(
+ ("Open Local TODO" . (lambda (x) (elchemy/find-file "~/org/todo.org")))
+ ("Open Remote TODO" . (lambda (x) (elchemy/find-file "/ssh:onid:todo.org")))
+ ("Open Local Notes" . (lambda (x) (elchemy/find-file "~/org/notes.org")))
+ ("Open Remote Notes" . (lambda (x) (elchemy/find-file "/ssh:onid:knowledge.org")))
+ ("Open Terminal" . (lambda (x) (elchemy/term "/bin/zsh")))
+ ("Open Scratch" . (lambda (x)
+ (when (one-window-p)
+ (split-window-right))
+ (other-window 1)
+ (scratch-buffer)))
+ ("Testing" . (lambda (x) (elchemy/find-file "/ssh:onid:test.el")))
+ )
+ elchemy/dashboard/heading-max-length (apply #'max (mapcar #'(lambda (x) (length (car x))) elchemy/dashboard/heading-buttons))
+ elchemy/dashboard/heading-padding 4)
+
(defun elchemy/create-dashboard ()
"Create the user dashboard"
(interactive)
@@ -106,22 +123,18 @@
(add-text-properties start (point)
'(face (:height 4.0))))
(insert "\n\n")
- (insert
- (buttonize "Open Local TODO" (lambda (x) (elchemy/find-file "~/org/todo.org"))))
- (insert " ")
- (insert
- (buttonize "Open Remote TODO" (lambda (x) (elchemy/find-file "/ssh:onid:todo.org"))))
+ (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")
(insert
- (buttonize "Open Local Notes" (lambda (x) (elchemy/find-file "~/org/notes.org"))))
- (insert " ")
- (insert
- (buttonize "Open Remote Notes" (lambda (x) (elchemy/find-file "/ssh:onid:knowledge.org"))))
- (insert "\n\n")
- (insert
- (buttonize "Open Terminal (zsh)" (lambda (x) (elchemy/term "/bin/zsh"))))
- (insert "\n\n")
- (insert
(buttonize "Open Personal Configuration" (lambda (x) (elchemy/find-file "~/.elchemy/elchemy-personal.el"))))
(insert "\n\n")
(when (file-exists-p "~/.elchemy/projects")
@@ -148,7 +161,7 @@
(insert "F3 ~ Record Macro\n")
(insert "F4 ~ Play Macro\n")
(insert "M-0 F4 ~ Play Macro until failure\n")
- (insert "M-l ~ Locwercase following word\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")
@@ -158,6 +171,7 @@
(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))))
(elchemy/create-dashboard)
@@ -173,16 +187,16 @@
(add-to-list 'face-remapping-alist '(default (:background "gray90")))))
(setq-default header-line-format '(
- (:propertize "♥︎" face (:foreground "red"))
- " "
- (:propertize "ELCHEMY" face (:weight bold))
- " "
- (:propertize "♦︎" face (:foreground "red"))
- " "
- (:propertize "%b" face (:slant italic))
- " ♣︎ "
- (:eval mode-name)
- " ♠︎"))
+ (:propertize "♥︎" face (:foreground "red"))
+ " "
+ (:propertize "ELCHEMY" face (:weight bold))
+ " "
+ (:propertize "♦︎" face (:foreground "red"))
+ " "
+ (:propertize "%b" face (:slant italic))
+ " ♣︎ "
+ (:eval mode-name)
+ " ♠︎"))
(load "extras/guile-interaction.el")
(require 'guile-interaction)