]> git.eshelyaron.com Git - dotfiles.git/commitdiff
Update esy.org
authorEshel Yaron <me@eshelyaron.com>
Tue, 7 Feb 2023 08:43:20 +0000 (10:43 +0200)
committerEshel Yaron <me@eshelyaron.com>
Tue, 7 Feb 2023 08:43:20 +0000 (10:43 +0200)
.emacs.d/esy.org

index 1dc0f9bfc1cc71798fe879133b020f7052e6d967..6d63b8dc03d7c79a0282d86dbd1a7aaa4b52d499 100644 (file)
@@ -480,26 +480,12 @@ refiling directly into deeper headings as well.
 :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)))))
@@ -511,7 +497,6 @@ refiling directly into deeper headings as well.
 
   (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:"
@@ -537,6 +522,17 @@ refiling directly into deeper headings as well.
   :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
@@ -552,18 +548,6 @@ refiling directly into deeper headings as well.
   :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
@@ -573,44 +557,6 @@ refiling directly into deeper headings as well.
   :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
@@ -996,11 +942,11 @@ over ssh for remote connections.
             "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"
@@ -1471,6 +1417,15 @@ include =emacs-lisp-mode= and =lisp-interaction-mode=.
     (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
@@ -1483,6 +1438,15 @@ include =emacs-lisp-mode= and =lisp-interaction-mode=.
           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
@@ -1622,7 +1586,8 @@ terminates, e.g. when pressing =C-d=.
 #+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
@@ -1723,6 +1688,19 @@ Add the timezones of places of interest to the list of clocks shown by
 #+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
@@ -1739,12 +1717,13 @@ Add the timezones of places of interest to the list of clocks shown by
                                                      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))
@@ -1772,7 +1751,14 @@ Add the timezones of places of interest to the list of clocks shown by
                (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