:END:
#+begin_src emacs-lisp
-
- (defvar esy/org-capture-to-project-heading-history-list nil
- "History list for `esy/org-capture-to-project-heading'.")
-
- (with-eval-after-load 'savehist
- (add-to-list 'savehist-additional-variables
- 'esy/org-capture-to-project-heading-history-list))
-
(defun esy/org-capture-to-project-heading ()
"Prompt for a projects and capture a related task."
- (require 'project)
(let* ((projects
(org-map-entries `(lambda () (nth 4 (org-heading-components)))
"+project+LEVEL=2" `(,esy/inbox-path)))
- (choice (completing-read "Project: "
- projects
- nil
- t
- nil
- 'esy/org-capture-to-project-heading-history-list))
+ (choice (completing-read "Project: " projects nil t nil))
(m (org-find-olp (cons
(org-capture-expand-file esy/inbox-path)
(list "Projects" choice)))))
(defun esy/org-capture-to-current-project ()
"Prompt for a projects and capture a related task."
- (require 'project)
(let* ((projects
(org-map-entries (lambda () (nth 4 (org-heading-components)))
(concat "+project+LEVEL=2+SCM=\"file:"
:CreatedAt: %t
:CapturedAt: %a
:CapturedAs: Inbox Task
+ :END:"
+ :prepend t
+ :empty-lines 1
+ :immediate-finish t)
+ ("w" "Work [inbox]" entry
+ (file+headline esy/inbox-path "Tasks")
+ "** TODO %^{Task} :work:
+ :PROPERTIES:
+ :CreatedAt: %t
+ :CapturedAt: %a
+ :CapturedAs: Work Task
:END:"
:prepend t
:empty-lines 1
:CapturedAs: Emacs configuration fragment
:END:\n\n#+begin_src emacs-lisp\n %i\n#+end_src"
:empty-lines 1)
- ("n" "New Project" entry
- (file+headline esy/inbox-path "Projects")
- "** %^{Name} %^g
- :PROPERTIES:
- :CreatedAt: %t
- :CapturedAt: %a
- :CapturedAs: New Project
- :SCM: file:%(project-prompt-project-dir)
- :END:"
- :prepend t
- :empty-lines 1
- :immediate-finish t)
("c" "New Calendar Event" entry
(file+headline esy/inbox-path "Calendar")
"** %^{Title} %^g
:CapturedAs: Calendar Event
:END:
%(format-time-string \"<%Y-%m-%d %H:%M\" (org-read-date t t))-%(format-time-string \"%H:%M>\" (org-read-date t t))
- %i"
- :prepend t
- :empty-lines 1
- :immediate-finish t)
- ("p" "New Project Task" entry
- (file+function esy/inbox-path
- esy/org-capture-to-project-heading)
- "*** TODO %?
- :PROPERTIES:
- :CreatedAt: %t
- :CapturedAt: %a
- :CapturedAs: Project Task
- :END:
- %i"
- :prepend t
- :empty-lines 1)
- ("Q" "Quick Project Task" entry
- (file+function esy/inbox-path
- esy/org-capture-to-project-heading)
- "*** TODO %^{Task}
- :PROPERTIES:
- :CreatedAt: %t
- :CapturedAt: %a
- :CaptuerdAs: Quick Project Task
- :END:
- %i"
- :prepend t
- :empty-lines 1
- :immediate-finish t)
- ("P" "Current Project Task" entry
- (file+function esy/inbox-path
- esy/org-capture-to-current-project)
- "*** TODO %^{Task}
- :PROPERTIES:
- :CreatedAt: %t
- :CapturedAt: %a
- :CaptuerdAs: Current Project Task
- :END:
%i"
:prepend t
:empty-lines 1
"https://www.fsf.org/static/fsforg/rss/news.xml"
"https://amodernist.com/all.atom"
"https://arcology.garden/updates.xml"
+ "https://takeonrules.com/index.atom"
"https://atthis.link/rss.xml"
"https://archive.casouri.cc/note/atom.xml"
"https://cestlaz.github.io/rss.xml"
"https://drewdevault.com/blog/index.xml"
- "https://github.com/organizations/SWI-Prolog/eshelyaron.private.atom?token=AT2QBCF34JAI3XGP4JJKYKWBZPZI2"
"https://herman.bearblog.dev/feed/"
"https://lwn.net/headlines/rss"
"https://maggieappleton.com/rss.xml"
(add-to-list 'rg-custom-type-aliases '("Prolog" . "*.pl *.plt *.pro *.prolog")))
#+end_src
+** Rust
+:PROPERTIES:
+:CUSTOM_ID: rust
+:END:
+
+#+begin_src emacs-lisp
+ (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode))
+#+end_src
+
** Terraform
:PROPERTIES:
:CUSTOM_ID: terraform
terraform--resource-type-face font-lock-type-face))
#+end_src
+** Dockerfile
+:PROPERTIES:
+:CUSTOM_ID: dockerfile
+:END:
+
+#+begin_src emacs-lisp
+ (add-to-list 'auto-mode-alist '("Dockerfile" . dockerfile-ts-mode))
+#+end_src
+
* =vc= customizations
:PROPERTIES:
:CUSTOM_ID: vc-follow-symlinks-t
#+begin_src emacs-lisp
(setq global-auto-revert-non-file-buffers t
auto-revert-verbose nil
- query-about-changed-file t)
+ query-about-changed-file t
+ kill-do-not-save-duplicates t)
(global-auto-revert-mode)
(global-whitespace-cleanup-mode 1)
#+end_src
#+begin_src emacs-lisp
(setq find-sibling-rules '(("\\([^/]+\\)\\.c\\'" "\\1.h")))
#+end_src
+
+** Small command for converting Unix timestamps to date strings
+
+#+begin_src emacs-lisp
+ (defun esy/seconds-to-date-string (seconds)
+ (interactive (list (if (use-region-p)
+ (string-to-number (buffer-substring (region-beginning)
+ (region-end)))
+ (read-number "Unix timestamp: " (round (float-time))))))
+ (message (format-time-string "%FT%T%z" (seconds-to-time seconds))))
+#+end_src
+
+
** Predefined SQL connections
:PROPERTIES:
:CUSTOM_ID: predefined-sql-connections
no-littering-var-directory))
(setq sql-connection-alist
(let* ((a (auth-source-search :port 5432
- :max 4
+ :max 5
:require '(:user :port :secret :host)))
- (d (car a))
- (p (cadr a))
- (c (caddr a))
- (e (car (cdddr a))))
+ (d (nth 0 a))
+ (p (nth 1 a))
+ (c (nth 2 a))
+ (e (nth 3 a))
+ (f (nth 4 a)))
`((dev
(sql-product 'postgres)
(sql-user ,(plist-get d :user))
(sql-port 5432)
(sql-password ,(funcall (plist-get e :secret)))
(sql-server ,(cadr (split-string (plist-get e :host) (rx "^"))))
- (sql-database ,(car (split-string (plist-get e :host) (rx "^"))))))))
+ (sql-database ,(car (split-string (plist-get e :host) (rx "^")))))
+ (ac
+ (sql-product 'postgres)
+ (sql-user ,(plist-get f :user))
+ (sql-port 5432)
+ (sql-password ,(funcall (plist-get f :secret)))
+ (sql-server ,(cadr (split-string (plist-get f :host) (rx "^"))))
+ (sql-database ,(car (split-string (plist-get f :host) (rx "^"))))))))
(define-advice sql-comint-postgres (:around (fun &rest args) use-sql-password)
(let ((process-environment