fiix: remote-server

This commit is contained in:
Pavel Korytov 2022-02-15 21:56:26 +03:00
parent a02a8c1466
commit 78447d4749
2 changed files with 94 additions and 79 deletions

View file

@ -20,12 +20,14 @@
(or
(string= (getenv "IS_TRAMP") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")))
(string= (system-name) "violet")
(string= (system-name) "viridian")))
(setq my/remote-server
(or (string= (getenv "IS_REMOTE") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")))
(string= (system-name) "violet")
(string= (system-name) "viridian")))
(setq my/is-termux (string-match-p (rx (* nonl) "com.termux" (* nonl)) (getenv "HOME")))
@ -373,7 +375,8 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(global-set-key (kbd "C-+") 'my/zoom-in)
(global-set-key (kbd "C-=") 'my/zoom-out)
(add-hook 'after-init-hook #'server-start)
(unless my/remote-server
(add-hook 'after-init-hook #'server-start))
(defmacro i3-msg (&rest args)
`(start-process "emacs-i3-windmove" nil "i3-msg" ,@args))
@ -2386,10 +2389,48 @@ Returns (<buffer> . <workspace-index>) or nil."
(add-to-list 'org-global-properties
'("Effort_ALL" . "0 0:05 0:10 0:15 0:30 0:45 1:00 2:00 4:00"))
(setq org-log-done 'time)
(use-package org-ql
:straight (:fetcher github
:repo "alphapapa/org-ql"
:files (:defaults (:exclude "helm-org-ql.el")))))
(unless (file-exists-p (concat org-directory "/trello"))
(mkdir (concat org-directory "/trello") t))
(setq org-trello-files
(thread-last (concat org-directory "/trello")
(directory-files)
(seq-filter
(lambda (f) (string-match-p (rx ".org" eos) f)))
(mapcar
(lambda (f) (concat org-directory "/trello/" f)))))
(defun my/org-scheduled-get-time ()
(let ((scheduled (org-get-scheduled-time (point))))
(if scheduled
(format-time-string "%Y-%m-%d" scheduled)
"")))
(setq org-agenda-hide-tags-regexp (rx (or "org" "log" "log_here")))
(setq org-agenda-custom-commands
`(("p" "My outline"
((agenda "")
(todo "NEXT"
((org-agenda-prefix-format " %i %-12:c [%e] ")
(org-agenda-overriding-header "Next tasks")))
(org-ql-block
`(and
(regexp ,(rx ":orgtrello_users:" (* nonl) "sqrtminusone"))
(todo)
(deadline))
((org-agenda-files ',org-trello-files)
(org-ql-block-header "Trello assigned")))
(tags-todo "inbox"
((org-agenda-overriding-header "Inbox")
(org-agenda-prefix-format " %i %-12:c")
(org-agenda-hide-tags-regexp ".")))
(tags-todo "+waitlist+SCHEDULED<=\"<+14d>\""
((org-agenda-overriding-header "Waitlist")
(org-agenda-hide-tags-regexp "waitlist")
(org-agenda-prefix-format " %i %-12:c %-12(my/org-scheduled-get-time)")))))
("tp" "Personal tasks"
((tags-todo "personal"
((org-agenda-prefix-format " %i %-12:c [%e] "))))))))
(require 'org-crypt)
(org-crypt-use-before-save-magic)
@ -2696,20 +2737,10 @@ Returns (<buffer> . <workspace-index>) or nil."
,(concat "* %?\n"
"/Entered on/ %U"))))
(unless (file-exists-p (concat org-directory "/trello"))
(mkdir (concat org-directory "/trello") t))
(setq org-trello-files
(thread-last (concat org-directory "/trello")
(directory-files)
(seq-filter
(lambda (f) (string-match-p (rx ".org" eos) f)))
(mapcar
(lambda (f) (concat org-directory "/trello/" f)))))
(use-package org-trello
:straight (:build (:not native-compile))
:commands (org-trello-mode)
:if (not my/remote-server)
:init
(setq org-trello-current-prefix-keybinding "C-c o")
(setq org-trello-add-tags nil)
@ -2728,42 +2759,22 @@ Returns (<buffer> . <workspace-index>) or nil."
(lambda (b) (list (nth 1 b) (macroexp-quote (nth 0 b))))
org-trello-interactive-command-binding-couples))))
(defun my/org-scheduled-get-time ()
(let ((scheduled (org-get-scheduled-time (point))))
(if scheduled
(format-time-string "%Y-%m-%d" scheduled)
"")))
(setq org-agenda-hide-tags-regexp (rx (or "org" "log" "log_here")))
(setq org-agenda-custom-commands
`(("p" "My outline"
((agenda "")
(todo "NEXT"
((org-agenda-prefix-format " %i %-12:c [%e] ")
(org-agenda-overriding-header "Next tasks")))
(org-ql-block
`(and
(regexp ,(rx ":orgtrello_users:" (* nonl) "sqrtminusone"))
(todo)
(deadline))
((org-agenda-files ',org-trello-files)
(org-ql-block-header "Trello assigned")))
(tags-todo "inbox"
((org-agenda-overriding-header "Inbox")
(org-agenda-prefix-format " %i %-12:c")
(org-agenda-hide-tags-regexp ".")))
(tags-todo "+waitlist+SCHEDULED<=\"<+14d>\""
((org-agenda-overriding-header "Waitlist")
(org-agenda-hide-tags-regexp "waitlist")
(org-agenda-prefix-format " %i %-12:c %-12(my/org-scheduled-get-time)")))))
("tp" "Personal tasks"
((tags-todo "personal"
((org-agenda-prefix-format " %i %-12:c [%e] ")))))))
(use-package org-ql
:if (not my/remote-server)
:straight (:fetcher github
:repo "alphapapa/org-ql"
:files (:defaults (:exclude "helm-org-ql.el"))))
(use-package org-journal
:straight t
:if (not my/remote-server)
:init
(my-leader-def
:infix "oj"
"" '(:which-key "org-journal")
"j" 'org-journal-new-entry
"o" 'org-journal-open-current-journal-file
"s" 'org-journal-tags-status)
:after org
:config
(setq org-journal-dir (concat org-directory "/journal"))
@ -2772,16 +2783,10 @@ Returns (<buffer> . <workspace-index>) or nil."
(setq org-journal-date-format "%A, %Y-%m-%d")
(setq org-journal-enable-encryption t))
(my-leader-def
:infix "oj"
"" '(:which-key "org-journal")
"j" 'org-journal-new-entry
"o" 'org-journal-open-current-journal-file
"s" 'org-journal-tags-status)
(use-package org-journal-tags
:straight (:fetcher git :repo "https://sqrtminusone.xyz/git/SqrtMinusOne/org-journal-tags.git")
:straight (:host github :repo "SqrtMinusOne/org-journal-tags")
:after (org-journal)
:if (not my/remote-server)
:config
(org-journal-tags-autosync-mode)
(general-define-key
@ -2818,6 +2823,7 @@ Returns (<buffer> . <workspace-index>) or nil."
(use-package emacsql-sqlite
:defer t
:if (not my/remote-server)
:straight (:type built-in))
(use-package org-roam
@ -2963,6 +2969,7 @@ Returns (<buffer> . <workspace-index>) or nil."
(use-package org-roam-ui
:straight (:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
:if (not my/remote-server)
:after org-roam
;; :hook (org-roam . org-roam-ui-mode)
:init

View file

@ -334,19 +334,21 @@ The following variable is true when my machine is not powerful enough for some r
The following is true if Emacs is meant to be used with TRAMP over slow ssh. Take a look at the [[*TRAMP][TRAMP]] section for more details.
#+begin_src emacs-lisp
(setq my/slow-ssh
(or
(string= (getenv "IS_TRAMP") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")))
(setq my/slow-ssh
(or
(string= (getenv "IS_TRAMP") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")
(string= (system-name) "viridian")))
#+end_src
The following is true is Emacs is run on a remote server where I don't need stuff like my org workflow
#+begin_src emacs-lisp
(setq my/remote-server
(or (string= (getenv "IS_REMOTE") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")))
(setq my/remote-server
(or (string= (getenv "IS_REMOTE") "true")
(string= (system-name) "dev-digital")
(string= (system-name) "violet")
(string= (system-name) "viridian")))
#+end_src
And the following is true if Emacs is run from termux on Android.
@ -908,7 +910,8 @@ This script is being run from the [[file:Desktop.org::*i3wm][i3 configuration]].
For this to work, we need to make sure that Emacs starts a server, so here is an expression to do just that:
#+BEGIN_SRC emacs-lisp
(add-hook 'after-init-hook #'server-start)
(unless my/remote-server
(add-hook 'after-init-hook #'server-start))
#+END_SRC
And here is a simple macro to do the Emacs -> i3 part:
@ -3918,7 +3921,7 @@ Some of the projects I'm participating in are managed via Trello, so I use [[htt
Also, trello files are huge and have a lot of information and tasks which do not concern me, so I don't add them to =org-agenda-files=.
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no :noweb-ref org-productivity-setup
(unless (file-exists-p (concat org-directory "/trello"))
(mkdir (concat org-directory "/trello") t))
@ -3935,6 +3938,7 @@ Also, trello files are huge and have a lot of information and tasks which do not
(use-package org-trello
:straight (:build (:not native-compile))
:commands (org-trello-mode)
:if (not my/remote-server)
:init
(setq org-trello-current-prefix-keybinding "C-c o")
(setq org-trello-add-tags nil)
@ -3956,8 +3960,9 @@ Also, trello files are huge and have a lot of information and tasks which do not
*** org-ql
[[https://github.com/alphapapa/org-ql][org-ql]] is a package to query the org files. I'm using it in my review workflow and for custom agenda views.
#+begin_src emacs-lisp :tangle no :noweb-ref org-productivity-setup
#+begin_src emacs-lisp
(use-package org-ql
:if (not my/remote-server)
:straight (:fetcher github
:repo "alphapapa/org-ql"
:files (:defaults (:exclude "helm-org-ql.el"))))
@ -3967,7 +3972,7 @@ Some custom agendas to fit my workflow.
Despite the fact that I don't add =org-trello-files= to =org-agenda-files= I still want to see them in agenda, so I use =org-ql-block= from =org-ql=.
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no :noweb-ref org-productivity-setup
(defun my/org-scheduled-get-time ()
(let ((scheduled (org-get-scheduled-time (point))))
(if scheduled
@ -4010,6 +4015,13 @@ I've tried switching to Org Roam Dailies, but in the end decided that org-journa
(use-package org-journal
:straight t
:if (not my/remote-server)
:init
(my-leader-def
:infix "oj"
"" '(:which-key "org-journal")
"j" 'org-journal-new-entry
"o" 'org-journal-open-current-journal-file
"s" 'org-journal-tags-status)
:after org
:config
(setq org-journal-dir (concat org-directory "/journal"))
@ -4017,20 +4029,14 @@ I've tried switching to Org Roam Dailies, but in the end decided that org-journa
(setq org-journal-file-format "%Y-%m-%d.org")
(setq org-journal-date-format "%A, %Y-%m-%d")
(setq org-journal-enable-encryption t))
(my-leader-def
:infix "oj"
"" '(:which-key "org-journal")
"j" 'org-journal-new-entry
"o" 'org-journal-open-current-journal-file
"s" 'org-journal-tags-status)
#+end_src
[[https://github.com/SqrtMinusOne/org-journal-tags][org-journal-tags]] is my package that implements a tagging system for org-journal.
#+begin_src emacs-lisp
(use-package org-journal-tags
:straight (:fetcher git :repo "https://sqrtminusone.xyz/git/SqrtMinusOne/org-journal-tags.git")
:straight (:host github :repo "SqrtMinusOne/org-journal-tags")
:after (org-journal)
:if (not my/remote-server)
:config
(org-journal-tags-autosync-mode)
(general-define-key
@ -4085,6 +4091,7 @@ References:
#+begin_src emacs-lisp
(use-package emacsql-sqlite
:defer t
:if (not my/remote-server)
:straight (:type built-in))
(use-package org-roam
@ -4273,6 +4280,7 @@ A browser frontend to visualize a Roam directory in a form of a graph.
#+begin_src emacs-lisp
(use-package org-roam-ui
:straight (:host github :repo "org-roam/org-roam-ui" :branch "main" :files ("*.el" "out"))
:if (not my/remote-server)
:after org-roam
;; :hook (org-roam . org-roam-ui-mode)
:init