[emacs] Speed up startup

This commit is contained in:
Correl Roush 2022-04-13 18:51:34 -04:00
parent ba4c3befd0
commit 19cfdb4412

View file

@ -1263,6 +1263,7 @@ Prefer sending HTML-formatted messages with plain text as a fallback option
#+begin_src emacs-lisp
(use-package! org-msg
:after mu4e
:config
(setq org-msg-default-alternatives '(text html)
org-msg-options "html-postamble:nil toc:nil author:nil email:nil ^:nil"))
@ -1372,6 +1373,7 @@ Manage a Kubernetes cluster and set up remote shell/file access via TRAMP.
(set-popup-rule! "^\\*kubernetes" :ignore t)
(use-package! kubernetes-tramp
:commands (eshell find-file)
:config
(setq tramp-remote-shell-executable "sh"))
#+end_src
@ -1413,78 +1415,79 @@ Pre-load Projectile with projects in my usual code directories.
Add some commands for interacting with Jira within org documents.
#+begin_src emacs-lisp
(use-package jira-api
:config (setq jira-api-host "jira.aweber.io"
jira-api-user "correlr"))
(after! org
(use-package jira-api
:config (setq jira-api-host "jira.aweber.io"
jira-api-user "correlr"))
(defun my/org-clock-last-time-in-seconds ()
(save-excursion
(let ((end (save-excursion (org-end-of-subtree))))
(when (re-search-forward (concat org-clock-string
".*\\(\\[[^]]+\\]\\)--\\(\\[[^]]+\\]\\)")
end t)
(let* ((start (match-string 1))
(end (match-string 2)))
(floor (- (org-time-string-to-seconds end)
(org-time-string-to-seconds start))))))))
(defun my/org-clock-last-time-in-seconds ()
(save-excursion
(let ((end (save-excursion (org-end-of-subtree))))
(when (re-search-forward (concat org-clock-string
".*\\(\\[[^]]+\\]\\)--\\(\\[[^]]+\\]\\)")
end t)
(let* ((start (match-string 1))
(end (match-string 2)))
(floor (- (org-time-string-to-seconds end)
(org-time-string-to-seconds start))))))))
(defun my/org-jira-add-worklog-latest ()
(interactive)
(let ((jira-id (org-entry-get (point) "JIRA_ID"))
(seconds (my/org-clock-last-time-in-seconds)))
(when (and jira-id seconds)
(jira-api-log-work jira-id seconds)
(message
(format "Logged %d minutes to %s on JIRA"
(/ seconds 60)
jira-id)))))
(defun my/org-jira-add-worklog-latest ()
(interactive)
(let ((jira-id (org-entry-get (point) "JIRA_ID"))
(seconds (my/org-clock-last-time-in-seconds)))
(when (and jira-id seconds)
(jira-api-log-work jira-id seconds)
(message
(format "Logged %d minutes to %s on JIRA"
(/ seconds 60)
jira-id)))))
(defun my/org-jira-add-worklog-total ()
(interactive)
(let ((jira-id (org-entry-get (point) "JIRA_ID"))
(seconds (* 60 (org-clock-sum-current-item))))
(when (and jira-id seconds)
(jira-api-log-work jira-id seconds)
(message
(format "Logged %d minutes to %s on JIRA"
(/ seconds 60)
jira-id)))))
(defun my/org-jira-add-worklog-total ()
(interactive)
(let ((jira-id (org-entry-get (point) "JIRA_ID"))
(seconds (* 60 (org-clock-sum-current-item))))
(when (and jira-id seconds)
(jira-api-log-work jira-id seconds)
(message
(format "Logged %d minutes to %s on JIRA"
(/ seconds 60)
jira-id)))))
(defun my/org-clock-add-jira-worklog-last ()
"Add a work log entry to a JIRA.
(defun my/org-clock-add-jira-worklog-last ()
"Add a work log entry to a JIRA.
To log work to JIRA, set a property named JIRA_ID on the entry to be
logged to a JIRA issue ID."
(interactive)
(save-excursion
(save-window-excursion
(org-clock-goto)
(my/org-jira-add-worklog-latest))))
(interactive)
(save-excursion
(save-window-excursion
(org-clock-goto)
(my/org-jira-add-worklog-latest))))
(defun my/org-jira-browse ()
(interactive)
(-if-let (jira-id (org-entry-get (point) "JIRA_ID"))
(let ((protocol (if jira-api-use-ssl "https" "http")))
(browse-url
(concat
protocol "://" jira-api-host "/browse/" jira-id)))))
(defun my/org-jira-browse ()
(interactive)
(-if-let (jira-id (org-entry-get (point) "JIRA_ID"))
(let ((protocol (if jira-api-use-ssl "https" "http")))
(browse-url
(concat
protocol "://" jira-api-host "/browse/" jira-id)))))
(defun my/org-jira-list ()
(interactive)
(let ((buffer (generate-new-buffer "*org-jira*")))
(switch-to-buffer buffer)
(org-mode)
(insert "ohai")
(setq-local buffer-read-only t)
(display-buffer buffer)))
(defun my/org-jira-list ()
(interactive)
(let ((buffer (generate-new-buffer "*org-jira*")))
(switch-to-buffer buffer)
(org-mode)
(insert "ohai")
(setq-local buffer-read-only t)
(display-buffer buffer)))
;; (add-hook 'org-clock-out-hook 'my/org-clock-add-jira-worklog-last)
;; (add-hook 'org-clock-out-hook 'my/org-clock-add-jira-worklog-last)
(map! :map org-mode-map
"C-c j t" #'my/org-jira-add-worklog-total
"C-c j l" #'my/org-jira-add-worklog-latest
"C-c j b" #'my/org-jira-browse
"C-c j c" #'jira-api-create-issue-from-heading
"C-c j u" #'jira-api-update-issue-from-heading)
(map! :map org-mode-map
"C-c j t" #'my/org-jira-add-worklog-total
"C-c j l" #'my/org-jira-add-worklog-latest
"C-c j b" #'my/org-jira-browse
"C-c j c" #'jira-api-create-issue-from-heading
"C-c j u" #'jira-api-update-issue-from-heading))
#+end_src
** Source Control
#+begin_src emacs-lisp