From 56ffdf3721349a1eb63b992be2e1a0505ee82e51 Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 7 Dec 2024 19:37:16 +0200 Subject: emacs: Remove vertico & corfu --- .config/emacs/init.el | 286 ++++++++++++++++++++------------------------------ 1 file changed, 115 insertions(+), 171 deletions(-) (limited to '.config') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 35d15c9..d78f4f9 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -45,7 +45,8 @@ (custom-set-faces (if is-hermes '(default ((t (:inherit nil :height 130 :family "Fira Mono")))) '(default ((t (:inherit nil :height 150 :family "Fira Mono"))))) - '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile"))))) + '(org-modern-symbol ((t (:inherit t :family "Iosevka Aile")))) + '(variable-pitch ((t (:inherit t :family "Fira Mono" :height 130))))) ;; Autoinsert (auto-insert-mode 1) @@ -71,7 +72,7 @@ ;; Enable use-package support for imenu (setf use-package-enable-imenu-support t) -(setf browse-url-browser-function 'eww ;; 'browse-url-generic +(setf browse-url-browser-function 'browse-url-generic browse-url-generic-program "icecat" backup-directory-alist '((".*" . "~/.Trash")) sentence-end-double-space t @@ -145,7 +146,7 @@ ("\\subsection{%s}" . "\\subsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}"))) - :hook ((org-mode . (lambda () (display-line-numbers-mode -1) (flyspell-mode)))) + :hook ((org-mode . (lambda () (display-line-numbers-mode -1) (flyspell-mode) (corfu-mode -1)))) :bind (:map org-mode-map (("C-c l" . org-store-link) ("C-c M-t" . org-todo) ("C-c RET" . org-table-hline-and-move)))) @@ -304,92 +305,50 @@ (setf org-modern-table nil org-modern-todo nil org-modern-tag nil + org-modern-timestamp nil org-modern-star 'replace org-modern-list '((?+ . "•") - (?- . "•"))) + (?- . "•")) + org-modern-replace-stars "☧") :hook ((org-mode . org-modern-mode))) ;; Create notes directory for org-roam (unless (file-exists-p "~/Notes") (make-directory "~/Notes")) -(use-package org-roam +(use-package org-gnosis :vc t - :load-path "~/Dev/emacs-lisp/org-roam" - :defer t + :load-path "~/Dev/emacs-lisp/org-gnosis" :init (define-prefix-command 'thanos/notes-map) + (define-prefix-command 'thanos/journal-map) :config - (setf org-roam-directory "~/Notes" - org-roam-dailies-directory "daily/") - - (org-roam-db-autosync-enable) - - (setf org-roam-node-display-template - (concat "${title:50} "(propertize "${tags:50}" 'face 'org-tag))) - - (setf org-roam-db-node-include-function - (lambda () - (not (or (member "journal" (org-get-tags)) - (member "dailies" (org-get-tags)))))) - ;; Templates - (setf org-roam-capture-templates - '(("d" "default" plain - "%?" - :if-new - (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+startup: overview\n") - :unnarrowed t) - ("p" "MUS" plain "* Goals\n\n%?\n\n* Tasks\n\n** TODO Add initial tasks\n\n* Dates\n\n" - :if-new - (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: MUS") - :unnarrowed t)) - org-roam-dailies-capture-templates - '(("d" "default" entry - "* %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:dailies:\n")) - ("j" "journal" plain - "* %?" - :target (file+head "%<%Y-%m-%d>.org" - "#+title: %<%Y-%m-%d>\n#+filetags: :journal:dailies:\n -* Daily Notes\n\n* Goals\n+ [] Πρωινὴ Προσευχή\n+ [] Ἑσπερινή Προσευχή\n\n* Extras")))) - - (defun org-roam-ref-add-book () - "Insert org-link from Library." - (interactive) - (let ((book - (format - "file:%s" - (read-file-name "Book: " (if is-zeus "/hdd/Library/" "~/Library/"))))) - book)) - - (defun org-roam-sync-notes () - "Sync org-oram notes" + (setf org-gnosis-dir "~/Notes" + org-gnosis-journal-template + "* Daily Notes\n\n* Goals\n+ [] Πρωινὴ Προσευχή\n+ [] Ἑσπερινή Προσευχή\n\n* Extras" + org-gnosis-show-tags t) + + (defun thanos/org-open-at-point () + "Open Org link at point in the same window, if possible." (interactive) - (let ((git (executable-find "git")) - (default-directory org-roam-directory)) - (message "Synching org-roam notes %s" org-roam-directory) - (unless git - (error "Git not found, please install `git'")) - (unless (file-exists-p (expand-file-name ".git" gnosis-dir)) - (message "Creating git repository") - (vc-create-repo 'Git)) - (shell-command "git pull") - (shell-command (format "%s %s" git "add .")) - (shell-command (format "%s %s %s" git "commit -m" - (shell-quote-argument "Update org-roam notes"))) - (vc-git-push nil)) - (funcall 'org-roam-db-sync)) + (let ((org-link-frame-setup '((file . find-file)))) + (org-open-at-point))) :bind (("C-c n" . thanos/notes-map) + ("C-c j" . thanos/journal-map) :map thanos/notes-map - ("t" . org-roam-buffer-toggle) - ("f" . org-roam-node-find) - ("i" . org-roam-node-insert) - ("d" . org-roam-dailies-goto-today) - ("D" . org-roam-dailies-goto-date) + ("f" . org-gnosis-find) + ("i" . org-gnosis-insert) + :map thanos/journal-map + ("j" . org-gnosis-journal) + ("f" . org-gnosis-journal-find) + ("i" . org-gnosis-journal-insert) :map org-mode-map - ("C-c C-." . org-roam-tag-add) - ("C-c i" . org-id-get-create))) + ("C-c C-." . org-gnosis-insert-tag) + ("C-c i" . org-id-get-create) + ("C-c C-o" . thanos/org-open-at-point))) + +;; (use-package org-roam +;; :vc (:url "https://github.com/org-roam/org-roam")) (use-package org-roam-ui :vc (:url "https://github.com/org-roam/org-roam-ui") @@ -469,15 +428,7 @@ ;; Load modus (load-theme 'modus-vivendi t))) -(use-package vertico - :ensure t - :config - (vertico-mode)) - -(use-package marginalia - :ensure t - :config - (marginalia-mode)) +(fido-vertical-mode) (use-package consult :ensure t @@ -513,7 +464,7 @@ :defer t :vc (:url "https://github.com/skeeto/elfeed") :config - (setf elfeed-search-filter "@1-week-ago +unread -hackernoon" + (setf elfeed-search-filter "@1-week-ago +unread" browse-url-browser-function #'browse-url-default-browser elfeed-db-directory "~/.config/elfeed") ;; Feeds @@ -539,6 +490,7 @@ ("http://localhost/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.reuters.com%2Ftechnology%2Fcybersecurity%2F&url_selector=a.media-story-card__headline__tFMEu%2C+a.media-story-card__heading__eqhp9&url_pattern=&content_selector=article.article__container__2MUeZ&content_cleanup=div.info-content__toolbar__3AkHm%2C+svg.link__new-tab-symbol__3T19s%2C+div.article-body__row__dFOPA%2C+div.read-next-tablet-up__container__3MpHN%2C+div.author-bio__multiple-authors__5YGrG%2C+div.article__read-next__Kjxdw&title_cleanup=&limit=&format=Atom" reuters cybersec news) ("https://annas-blog.org/ rss.xml" anna piracy) + ("http://localhost/?action=display&bridge=CssSelectorBridge&home_page=https%3A%2F%2Fwww.ethnos.gr%2Ftag%2F842%2Fellhnotoyrkika&url_selector=a.single-title&url_pattern=&content_selector=div.content-section&content_cleanup=div.article-related-posts%2C+div.ReadMore%2C+script&title_cleanup=&limit=&format=Atom" greek ethnos ellinotourkika) ("https://planet.emacslife.com/atom.xml" emacs emacslife) ("https://localmonero.co/static/rss/the-monero-standard/feed.xml" monero) ("https://devonzuegel.com/feed" devon) @@ -581,7 +533,6 @@ rss.xml" anna piracy) ("v" . 'elfeed-mpv) ("U" . 'elfeed-update)) :hook ((elfeed-searchacw-mode . (lambda () (display-line-numbers-mode 0))))) - ;; Python (add-to-list 'auto-mode-alist '("\\.py\\'" . python-ts-mode)) @@ -650,36 +601,26 @@ rss.xml" anna piracy) (vc-checkin nil 'git nil nil nil "") (vc-git-log-edit-toggle-amend))) -(use-package corfu - :ensure t - :config - (global-corfu-mode) - (corfu-popupinfo-mode) - (setf corfu-auto t - corfu-auto-delay 0.1 - corfu-auto-prefix 2 - corfu-cycle t - corfu-popupinfo-delay 0.3 - corfu-quit-at-boundary 'separator - corfu-quit-no-match t - corfu-preselect 'first - corfu-preview-current t - corfu-echo-mode t) - (setf indent-tabs-mode nil)) +;; (use-package corfu +;; :ensure t +;; :config +;; (global-corfu-mode) +;; (corfu-popupinfo-mode) +;; (setf corfu-auto t +;; corfu-auto-delay 0.1 +;; corfu-auto-prefix 2 +;; corfu-cycle t +;; corfu-popupinfo-delay 0.3 +;; corfu-quit-at-boundary 'separator +;; corfu-quit-no-match t +;; corfu-preselect 'first +;; corfu-preview-current t +;; corfu-echo-mode t) +;; (setf indent-tabs-mode nil)) (when (or is-phone is-uranus) (use-package corfu-terminal)) -(use-package cape - ;; Press C-c p ? to for help. - :bind ("M-p" . cape-prefix-map) ;; Alternative keys: M-p, M-+, ... - :config - ;; (add-hook 'completion-at-point-functions #'cape-dabbrev) - (add-hook 'completion-at-point-functions #'cape-file) - ;; (add-hook 'completion-at-point-functions #'cape-elisp-block) - ;; (add-hook 'completion-at-point-functions #'cape-dict) - ) - (defun insert-brackets (&optional arg) "Insert ARG brackets." (interactive "P") @@ -724,19 +665,14 @@ rss.xml" anna piracy) :hook (erc-mode . emojify-mode) :commands emojify-mode) -(use-package flycheck-package - :vc (:url "https://github.com/purcell/flycheck-package") - :ensure nil - :after flycheck) - (use-package flycheck :ensure t :config (setf flycheck-emacs-lisp-load-path 'inherit) - (global-flycheck-mode) - :hook ((emacs-lisp-mode . (lambda () (flycheck-mode) (flycheck-package-setup))))) + (global-flycheck-mode)) (use-package eat + :ensure t :config (setf eshell-visual-commands nil eat-term-name "xterm-256color") @@ -941,7 +877,6 @@ rss.xml" anna piracy) ("k" . 'yeetube-remove-saved-video))) (use-package gnosis - :vc t :load-path "~/Dev/emacs-lisp/gnosis" :ensure t :init (define-prefix-command 'thanos/gnosis-map) @@ -977,7 +912,7 @@ rss.xml" anna piracy) (setf gptel-api-key (password-store-get-field "openai/openai@thanosapollo.org" "api") gptel-default-mode 'org-mode gptel-directives '((default . "You are a large language model living in Emacs and a helpful assistant. Respond concisely.") - (programming . "You are a large language model and a careful programmer. Provide code and only code as output without any additional text, prompt or note.") + (programming . "You are a large language model and an expert emacs lisp hacker. Provide code and only code as output without any additional text, prompt or note.") (epictetus . "You are Epictetus, the stoic philosopher from Nicopolis. Respond concisely as Epictetus.") (med . "You are a medical professor. Respond concisely to your student in bullet points.") (code-review . "You are an expert programmer within Emacs reviewing code. Respond concisely") @@ -989,6 +924,11 @@ rss.xml" anna piracy) :host (if is-zeus "localhost:11434" "zeus:11434") :stream t :models '("llama3.2:latest" "dolphin-phi" "dolphin-llama3:latest"))) + + (gptel-make-anthropic "Claude" + :stream t + :key (password-store-get "claude/api1")) + :bind (("C-c g" . 'gptel-send) :map gptel-mode-map ("C-c h" . 'gptel-menu))) @@ -1035,45 +975,47 @@ rss.xml" anna piracy) :map notmuch-search-mode-map ("u" . notmuch-refresh-all-buffers)) :hook ((notmuch-hello-mode . (lambda () (display-line-numbers-mode 0))) - (notmuch-search-mode . (lambda () (display-line-numbers-mode 0) (emojify-mode))))) - -(setf notmuch-archive-tags '("-inbox" "-unread" "+archived") - notmuch-show-all-tags-list t - notmuch-hello-sections - '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches - notmuch-hello-insert-alltags)) - -(setq notmuch-search-oldest-first nil) - -(setf notmuch-tag-formats - '(("unread" (propertize tag 'face 'notmuch-tag-unread)) - ("emacs-pm" (propertize tag 'face '((t :foreground "#ff9580")))))) - -(setf notmuch-identities '("public@thanosapollo.org" "public@thanosapollo.com" - "104111@students.mu-sofia.bg")) - -(setf notmuch-saved-searches - `((:name "Inbox" :query "tag:inbox" :sort-order newest-first :key ,(kbd "i")) - (:name "Unread" :query "tag:unread" :sort-order newest-first :key ,(kbd "u")) - (:name "Today's message" :query "tag:inbox date:today" :sort-order newest-first - :key ,(kbd "t")) - (:name "sent" :query "tag:sent" :sort-order newest-first :key ,(kbd "s")) - (:name "drafts" :query "tag:draft" :sort-order newest-first :key ,(kbd "d")) - (:name "all mail" :query "*" :sort-order newest-first :key ,(kbd "a")))) - -;; Update notmuch on startup -;; (thanos/notmuch-update) - -;; smtpmail settings -(setf smtpmail-smtp-user (password-store-get-field "mailbox/thanosapollo" "user") - smtpmail-smtp-server "smtp.mailbox.org" - smtpmail-smtp-service 465 - smtpmail-stream-type 'ssl - message-send-mail-function 'smtpmail-send-it - message-signature "Thanos Apollo\nhttps://thanosapollo.org") - -;; autosign messages -(add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime) + (notmuch-search-mode . (lambda () (display-line-numbers-mode 0) (emojify-mode))) + (message-mode . (lambda () (corfu-mode -1)))) + :custom + (setf notmuch-archive-tags '("-inbox" "-unread" "+archived") + notmuch-show-all-tags-list t + notmuch-hello-sections + '(notmuch-hello-insert-header notmuch-hello-insert-saved-searches + notmuch-hello-insert-alltags)) + + (setq notmuch-search-oldest-first nil) + + (setf notmuch-tag-formats + '(("unread" (propertize tag 'face 'notmuch-tag-unread)) + ("emacs-pm" (propertize tag 'face '((t :foreground "#ff9580")))))) + + (setf notmuch-identities '("public@thanosapollo.org" "public@thanosapollo.com" + "104111@students.mu-sofia.bg")) + + (setf notmuch-saved-searches + `((:name "Inbox" :query "tag:inbox" :sort-order newest-first :key ,(kbd "i")) + (:name "Unread" :query "tag:unread" :sort-order newest-first :key ,(kbd "u")) + (:name "Today's message" :query "tag:inbox date:today" :sort-order newest-first + :key ,(kbd "t")) + (:name "sent" :query "tag:sent" :sort-order newest-first :key ,(kbd "s")) + (:name "drafts" :query "tag:draft" :sort-order newest-first :key ,(kbd "d")) + (:name "all mail" :query "*" :sort-order newest-first :key ,(kbd "a")))) + + ;; Update notmuch on startup + ;; (thanos/notmuch-update) + + ;; smtpmail settings + (setf smtpmail-smtp-user (password-store-get-field "mailbox/thanosapollo" "user") + smtpmail-smtp-server "smtp.mailbox.org" + smtpmail-smtp-service 465 + smtpmail-stream-type 'ssl + message-send-mail-function 'smtpmail-send-it + message-signature "Thanos Apollo ☧\nhttps://thanosapollo.org") + + ;; autosign messages + (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)) + ;; (use-package yasnippet ;; :ensure nil @@ -1081,16 +1023,15 @@ rss.xml" anna piracy) ;; (when is-zeus (add-to-list 'yas-snippet-dirs "~/Dev/guile/guix/etc/snippets/yas"))) (use-package emms - :defer t + :ensure t :init (define-prefix-command 'thanos/emms) :config (with-eval-after-load 'emms (emms-all) - (setq emms-source-file-default-directory "/hdd/Music" + (setf emms-source-file-default-directory "/hdd/Music" emms-info-asynchronously t emms-show-format "♪ %s" - emms-info-functions) - (emms-info-exiftool) + emms-player-list '(emms-player-mpv)) (add-to-list 'emms-info-functions 'emms-info-native)) (setf emms-player-mpv-parameters '("--quiet" "--really-quiet" "--no-audio-display" "--no-video")) @@ -1118,7 +1059,7 @@ rss.xml" anna piracy) (add-hook 'gnus-article-mode-hook #'bug-reference-mode) ;; Change the default when run as 'M-x debbugs-gnu'. - (setq debbugs-gnu-default-packages '("emacs")) + (setq debbugs-gnu-default-packages '("emacs" "guix")) ;; Show feature requests. (setq debbugs-gnu-default-severities @@ -1141,17 +1082,20 @@ rss.xml" anna piracy) (defun vm-run () - "Spawn Virtual Machine." + "Spawn Virtual Machine with UEFI support." (interactive) (let ((memory (format "%sG" (read-string "Memory(G): "))) - (cores (read-string "Cores: ")) - (image (read-file-name "Image: " vm-directory)) - (iso (if (y-or-n-p "Load iso? ") - (read-file-name "ISO: ") - nil))) + (cores (read-string "Cores: ")) + (image (read-file-name "Image: " vm-directory)) + (iso (if (y-or-n-p "Load iso? ") + (read-file-name "ISO: ") + nil)) + (ovmf-path (string-trim + (shell-command-to-string + "echo $(guix build ovmf-x86-64)/share/firmware/ovmf_x64.bin")))) (async-shell-command - (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" - memory cores image (if iso (concat "-cdrom " iso) ""))))) + (format "qemu-system-x86_64 -enable-kvm -m %s -smp %s -hda %s -bios %s -vga virtio -device virtio-serial-pci -netdev user,id=vmnic,hostfwd=tcp::2222-:22 -device e1000,netdev=vmnic %s" + memory cores image ovmf-path (if iso (concat "-cdrom " iso) ""))))) (use-package 0x0 :ensure nil) -- cgit v1.2.3