diff --git a/emacs/init.org b/emacs/init.org index 0330bf7..0ae308f 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -162,12 +162,12 @@ Use the spacebar as a leader key in evil-mode's normal state and in various othe ** Additional keybindings #+BEGIN_SRC emacs-lisp - (general-def 'normal "zM" #'hs-hide-level) - (general-def 'normal "z=" #'text-scale-increase) - (general-def 'normal "z-" #'text-scale-decrease) - (general-def 'normal "z0" #'text-scale-adjust) - (general-def 'normal view-mode-map "0" nil) - (general-def 'normal messages-buffer-mode-map "SPC" leader-map) + (general-def 'normal "zM" #'hs-hide-level :keymaps 'override) + (general-def 'normal "z=" #'text-scale-increase :keymaps 'override) + (general-def 'normal "z-" #'text-scale-decrease :keymaps 'override) + (general-def 'normal "z0" #'text-scale-adjust :keymaps 'override) + (general-def 'normal view-mode-map "0" nil :keymaps 'override) + (general-def 'normal messages-buffer-mode-map "SPC" leader-map :keymaps 'override) #+END_SRC * Magit @@ -251,9 +251,41 @@ Requires: (eval-when-compile (require 'subr-x)) #+END_SRC +** Packages +#+BEGIN_SRC emacs-lisp + (use-package deferred + :commands (deferred:next + deferred:nextc + deferred:error + deferred:cancel + deferred:watch + deferred:wait + deferred:$ + deferred:loop + deferred:parallel + deferred:earlier + deferred:call + deferred:apply + deferred:process + deferred:process-buffer + deferred:wait-idle + deferred:url-retrieve + deferred:url-get + deferred:url-post + deferred:new + deferred:succeed + deferred:fail + deferred:callback + deferred:callback-post + deferred:errorback + deferred:errorback-post + deferred:try + deferred:timeout + deferred:process)) +#+END_SRC ** Editing Elisp #+BEGIN_SRC emacs-lisp - (general-def 'motion emacs-lisp-mode "C-c C-c" #'eval-defun) + (general-def 'motion emacs-lisp-mode "C-c C-c" #'eval-defun :keymaps 'override) #+END_SRC ** Load path For machine or user specific libraries: @@ -1201,13 +1233,17 @@ Integrate Google calendar with org-mode: org-gcal-client-secret (password-store-get "lola-org-gcal-client-secret") org-gcal-file-alist `(("jeremydormitzer@lola.com" . ,(get-calendar-file "lola-gcal.org")) ("jeremy.dormitzer@gmail.com" . ,(get-calendar-file "personal-gcal.org")) - ("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . ,(get-calendar-file "j-n-gcal.org")))) - (add-hook 'org-agenda-mode-hook #'org-gcal-fetch) - (defun org-agenda-redo-and-fetch-gcal (&optional all) - (interactive "P") - (let ((cb (if all #'org-agenda-redo-all #'org-agenda-redo))) - (deferred:nextc (org-gcal-fetch) cb))) - (general-def 'motion org-agenda-mode-map "gr" #'org-agenda-redo-and-fetch-gcal)) + ("lut2o2moohg6qkdsto1qfq7th4@group.calendar.google.com" . ,(get-calendar-file "j-n-gcal.org"))) + org-gcal-notify-p nil)) + + (add-hook 'org-agenda-mode-hook #'org-gcal-fetch) + + (defun org-agenda-redo-and-fetch-gcal (&optional all) + (interactive "P") + (let ((cb (if all #'org-agenda-redo-all #'org-agenda-redo))) + (deferred:nextc (org-gcal-fetch) cb))) + + (general-def '(normal motion) org-agenda-mode-map "gr" #'org-agenda-redo-and-fetch-gcal) #+END_SRC * Projectile #+BEGIN_SRC emacs-lisp @@ -3269,10 +3305,18 @@ Some functions to make my day job easier. (substitute-in-file-name (format "$WORKON_HOME/%s/bin/activate" venv)) callback)) - (defun get-latest-log () - (car (last (directory-files default-directory - nil - "[[:digit:]-]+T[[:digit:]:]+\\.log")))) + (defun get-latest-lola-log (prefix) + (lambda () + (concat + "~/lola/logs/" + (car (last (directory-files "~/lola/logs" + nil + (concat prefix "[[:digit:]-]+T[[:digit:]:]+\\.log"))))))) + + (defun lola-log-file (prefix) + (format "~/lola/logs/%s%s.log" + prefix + (format-time-string "%Y-%m-%dT%H:%M:%S"))) (defun python-service-setup (venv &optional env-file) (lambda (done) @@ -3296,9 +3340,9 @@ Some functions to make my day job easier. (format "gunicorn -c server/web/gunicorn.conf.py \ -b 127.0.0.1:7200 bin.start_web:init_and_create_flask_app\\(\\) \ - &> %s.log" - (format-time-string "%Y-%m-%dT%H:%M:%S")))) - :file #'get-latest-log + &> %s" + (lola-log-file "lola-server-")))) + :file (get-latest-lola-log "lola-server-") :inhibit-process-filter t :cwd "~/lola/lola-server" :stop-signal 'int @@ -3324,10 +3368,10 @@ Some functions to make my day job easier. :args (lambda () (list "-c" - (format "python bin/start_web.py &> %s.log" - (format-time-string "%Y-%m-%dT%H:%M:%S")))) + (format "python bin/start_web.py &> %s" + (lola-log-file "travel-svc-")))) :cwd "~/lola/lola-travel-service" - :file #'get-latest-log + :file (get-latest-lola-log "travel-svc-") :inhibit-process-filter t :stop-signal 'int :truncate-output t @@ -3337,10 +3381,17 @@ Some functions to make my day job easier. (prodigy-define-service :name "travel-service celery worker" :tags '(lola) - :command "python" - :args '("bin/start_celery_workers.py" - "-Q" - "default,io_pool,cpu_pool,priority_io_pool,priority_cpu_pool") + :command "bash" + :args (lambda () + (list + "-c" + (concat "python " + "bin/start_celery_workers.py " + "-Q " + "default,io_pool,cpu_pool,priority_io_pool,priority_cpu_pool " + (format "&> %s" (lola-log-file "travel-svc-celery-"))))) + :file (get-latest-lola-log "travel-svc-celery-") + :inhibit-process-filter t :cwd "~/lola/lola-travel-service" :stop-signal 'int :truncate-output t