From 76a27e47507cbe3c5c4cb9a85636ad214ef21685 Mon Sep 17 00:00:00 2001 From: fz0x1 Date: Wed, 27 Nov 2024 19:25:56 +0100 Subject: [PATCH] 20241127 --- global/.emacs.d/init.el | 146 +++++++++++++++++++++++----------- linux/.config/i3/autostart.sh | 3 + 2 files changed, 103 insertions(+), 46 deletions(-) diff --git a/global/.emacs.d/init.el b/global/.emacs.d/init.el index 0cf08b1..d82d814 100644 --- a/global/.emacs.d/init.el +++ b/global/.emacs.d/init.el @@ -1,17 +1,17 @@ (menu-bar-mode -1) (tool-bar-mode -1) -(setq make-backup-files nil) ;; Отключить резервные копии -(setq auto-save-default nil) ;; Отключить автосохранение +(setq make-backup-files nil) +(setq auto-save-default nil) (require 'package) +(require 'org-tempo) (setq package-archives '(("melpa" . "https://melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/") ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) -;; Установить, если `use-package` отсутствует (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) @@ -27,12 +27,25 @@ :config (load-theme 'gruvbox-dark-medium t)) +(use-package org-contrib + :ensure t + :init + (require 'org-depend) + (require 'org-protocol)) + (use-package ace-window :bind ("M-o" . ace-window)) (use-package org-bullets :hook (org-mode . org-bullets-mode)) +(use-package evil + :ensure t + :init + (setq evil-undo-system 'undo-redo) + :config + (evil-mode 1)) + (setq aw-dispatch-always t) (setq use-package-always-ensure t) @@ -42,6 +55,8 @@ ;; When a TODO is set to a done state, record a timestamp (setq org-log-done 'time) +(setq org-log-redeadline 'time) +(setq org-log-reschedule 'time) ;; Follow the links ;; (setq org-return-follows-link t) @@ -60,6 +75,9 @@ (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) (define-key global-map "\C-cc" 'org-capture) +(define-key global-map "\C-ci" 'org-id-get-create) +;; (define-key global-map "\C-ci" 'org-id-copy) +(define-key global-map "\C-cp" 'org-set-property) (global-set-key (kbd "C-c n") (lambda () (interactive) (find-file "~/org/notes.org"))) (global-set-key (kbd "C-c w") (lambda () (interactive) (find-file "~/org/work-log.org"))) @@ -73,31 +91,51 @@ ;; Wrap the lines in org mode so that things are easier to read (add-hook 'org-mode-hook 'visual-line-mode) -(setq initial-buffer-choice - (lambda () - (let ((agenda-buffer (org-agenda nil "a"))) - (get-buffer "*Org Agenda*")))) -(setq org-agenda-window-setup 'only-window) +;; (setq initial-buffer-choice +;; (lambda () +;; (let ((agenda-buffer (org-agenda nil "a"))) +;; (get-buffer "*Org Agenda*")))) +;; (setq org-agenda-window-setup 'only-window) -(setq org-agenda-include-diary t) +;; (setq org-agenda-include-diary t) -(let* ((variable-tuple - (cond ((x-list-fonts "JetBrainsMono Nerd Font") '(:font "JetBrainsMono Nerd Font")) - (nil (warn "Cannot find JetBrainsMono Nerd Font. Please install it.")))) - (base-font-color (face-foreground 'default nil 'default)) - (headline `(:inherit default :weight bold :foreground ,base-font-color))) +;; show :LOGBOOK: +(setq org-log-into-drawer t) +(setq org-log-done 'time) - (custom-theme-set-faces - 'user - `(org-level-8 ((t (,@headline ,@variable-tuple)))) - `(org-level-7 ((t (,@headline ,@variable-tuple)))) - `(org-level-6 ((t (,@headline ,@variable-tuple)))) - `(org-level-5 ((t (,@headline ,@variable-tuple)))) - `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.0)))) - `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.1)))) - `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.2)))) - `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.3)))) - `(org-document-title ((t (,@headline ,@variable-tuple :height 1.4 :underline nil)))))) +;; evil +(define-key evil-normal-state-map (kbd "TAB") 'org-cycle) ;; return the standard functionality for TAB + +(add-hook 'org-mode-hook (lambda () (org-load-modules-maybe t))) +(setq org-id-link-to-org-use-id t) + +;; autosave org-mode buffers +(setq auto-save-timeout 20) +(add-hook 'auto-save-hook 'org-save-all-org-buffers) + +(defun transform-square-brackets-to-round-ones(string-to-transform) + "Transforms [ into ( and ] into ), other chars left unchanged." + (concat + (mapcar #'(lambda (c) (if (equal c ?\[) ?\( (if (equal c ?\]) ?\) c))) string-to-transform))) + +(when (display-graphic-p) + (let* ((variable-tuple + (cond ((x-list-fonts "JetBrainsMono Nerd Font") '(:font "JetBrainsMono Nerd Font")) + (nil (warn "Cannot find JetBrainsMono Nerd Font. Please install it.")))) + (base-font-color (face-foreground 'default nil 'default)) + (headline `(:inherit default :weight bold :foreground ,base-font-color))) + + (custom-theme-set-faces + 'user + `(org-level-8 ((t (,@headline ,@variable-tuple)))) + `(org-level-7 ((t (,@headline ,@variable-tuple)))) + `(org-level-6 ((t (,@headline ,@variable-tuple)))) + `(org-level-5 ((t (,@headline ,@variable-tuple)))) + `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.0)))) + `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.1)))) + `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.2)))) + `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.3)))) + `(org-document-title ((t (,@headline ,@variable-tuple :height 1.4 :underline nil))))))) (setq org-capture-templates '( @@ -106,14 +144,19 @@ "* %?" :empty-lines 0) + ("l" "Link" + entry (file+headline "~/org/inbox.org" "Inbox") + "* %U %?\n %:annotation\n %:link" + :empty-lines 0) + ("n" "Note" entry (file+headline "~/org/notes.org" "Random Notes") "** %?" :empty-lines 0) - ("n" "Grocery list" + ("r" "Grocery list" entry (file+headline "~/org/grocery.org" "Grocery list") - "** %?" + "* NEED2BUY [#B] %?\n:Created: %T\n " :empty-lines 0) ("g" "General To-Do" @@ -121,23 +164,32 @@ "* TODO [#B] %?\n:Created: %T\n " :empty-lines 0) - ;; ("m" "Meeting" - ;; entry (file+datetree "~/org/meetings.org") - ;; "* %? :meeting:%^g \n:Created: %T\n** Attendees\n*** \n** Notes\n** Action Items\n*** TODO [#A] " - ;; :tree-type week - ;; :clock-in t - ;; :clock-resume t - ;; :empty-lines 0) + ("m" "Meeting" + entry (file+datetree "~/org/meetings.org") + "* %? :meeting:%^g \n:Created: %T\n** Notes\n** Action Items\n*** TODO [#A] " + :tree-type week + :clock-in t + :clock-resume t + :empty-lines 0) ("c" "Code To-Do" entry (file+headline "~/org/todos.org" "Code Related Tasks") - "* TODO [#B] %?\n:Created: %T\n%i\n%a\nProposed Solution: " + "* TODO [#B] %?\n:Created: %T\n%i\nProposed Solution:\n" :empty-lines 0) - )) + + ("w" "Selected web capture" + entry (file+headline "~/org/web-selection.org" "Selected web capture") + "* %^{Title}\nSource: %u, %:link\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?" + :empty-lines 1) + + ("L" "Unselected web capture" + entry (file "~/org/web-links.org") + "* %? [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n" + :empty-lines 1))) (setq org-todo-keywords - '((sequence "TODO(t)" "PLANNING(p)" "IN-PROGRESS(i@/!)" "VERIFYING(v!)" "BLOCKED(b@)" "|" "DONE(d!)" ) + '((sequence "TODO(t)" "NEED2BUY(n)" "PLANNING(p)" "IN-PROGRESS(i@/!)" "VERIFYING(v!)" "BLOCKED(b@)" "|" "DONE(d!)" "CANCELED(c@/!)" ) )) (setq org-todo-keyword-faces @@ -281,6 +333,8 @@ ( (org-agenda-remove-tags t) (org-agenda-span 7) + (org-agenda-skip-function + '(org-agenda-skip-entry-if 'todo 'done)) ) ) @@ -366,12 +420,12 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(org-document-title ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif" :height 1.6 :underline nil)))) - '(org-level-1 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif" :height 1.5)))) - '(org-level-2 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif" :height 1.3)))) - '(org-level-3 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif" :height 1.2)))) - '(org-level-4 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif" :height 1.1)))) - '(org-level-5 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif")))) - '(org-level-6 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif")))) - '(org-level-7 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif")))) - '(org-level-8 ((t (:inherit default :weight bold :foreground "#ebdbb2" :family "Sans Serif"))))) + '(org-document-title ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font" :height 1.4 :underline nil)))) + '(org-level-1 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font" :height 1.3)))) + '(org-level-2 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font" :height 1.2)))) + '(org-level-3 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font" :height 1.1)))) + '(org-level-4 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font" :height 1.0)))) + '(org-level-5 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font")))) + '(org-level-6 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font")))) + '(org-level-7 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font")))) + '(org-level-8 ((t (:inherit default :weight bold :foreground "#ebdbb2" :font "JetBrainsMono Nerd Font"))))) diff --git a/linux/.config/i3/autostart.sh b/linux/.config/i3/autostart.sh index a3daaa2..245bb2c 100755 --- a/linux/.config/i3/autostart.sh +++ b/linux/.config/i3/autostart.sh @@ -56,6 +56,9 @@ bauh-tray & # keyboard layout switcher setxkbmap -layout us,ru -option 'grp:alt_space_toggle' & +# emacs +emacs --daemon & + # lockscreen # xss-lock --transfer-sleep-lock -- ~/scripts/bin/lock.sh