diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 301 |
1 files changed, 217 insertions, 84 deletions
@@ -94,7 +94,7 @@ (jao-load-site-el "pre") ;;; System Utilities -;;; persist +;;;; persist (require 'persist) ;;;; (no) backups @@ -143,7 +143,7 @@ (put 'list-timers 'disabled nil) ;;;; tramp -(setq tramp-mode nil) +(inhibit-remote-files) ;;;; sleep/awake (use-package jao-sleep) @@ -279,7 +279,9 @@ (setq auth-sources '("~/.emacs.d/authinfo.gpg" "~/.netrc")) (use-package epa-file - :init (setq epa-file-cache-passphrase-for-symmetric-encryption t) + :init (setq epa-file-cache-passphrase-for-symmetric-encryption t + epa-file-encrypt-to "A247C4780736A6156BC8DA748C081D34D321D881" + plstore-encrypt-to epa-file-encrypt-to) :config (epa-file-enable)) (require 'epa-file) @@ -299,19 +301,10 @@ `(jao-call-with-auth ,host (lambda (,usr ,pwd) ,@body))) ;;;; pass -(use-package password-store +(use-package password-store-menu :ensure t - :bind (("C-c p" . jao-transient-password))) - -(transient-define-prefix jao-transient-password () - ["Password store" - [("c" "copy secret" password-store-copy) - ("C" "copy field" password-store-copy-field)] - [("i" "insert entry" password-store-insert) - ("e" "edit entry" password-store-edit) - ("g" "generate password" password-store-generate)] - [("d" "delete entry" password-store-remove) - ("r" "rename entry" password-store-rename)]]) + :config (password-store-menu-enable) + :custom (password-store-menu-key "C-c p")) ;;; Fonts and color themes ;;;; widgets @@ -476,12 +469,11 @@ ;;;; time display (setq world-clock-list - '(("Europe/Paris" "Barcelona") - ("America/Los_Angeles" "Los Angeles") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Asia/Calcutta" "Bangalore") - ("Asia/Tokyo" "Tokyo"))) + '(("Europe/London" "Edinburgh") + ("Europe/Paris" "Barcelona") + ("Asia/Tokyo" "Tokyo") + ("America/Los_Angeles" "Corvallis") + ("America/New_York" "New York"))) (setq display-time-day-and-date nil display-time-24hr-format nil @@ -535,17 +527,11 @@ battery-mode-line-format " 🔋%b%p% ")) (with-eval-after-load "jao-minibuffer" - (unless jao-mode-line-in-minibuffer + (if jao-mode-line-in-minibuffer + (display-battery-mode 1) (jao-minibuffer-add-variable 'battery-mode-line-string 80))) ;;; Notifications -;;;; alert -(use-package alert - :ensure t - :init - (setq alert-default-style 'message ;; 'libnotify - alert-hide-all-notifications nil)) - ;;;; jao-notify (use-package jao-notify :demand t @@ -572,7 +558,7 @@ (use-package ednc :ensure t - :diminish) + :diminish nil) (use-package jao-ednc :demand t @@ -740,7 +726,7 @@ empty missing-newline-at-eof) whitespace-line-column 80) :hook (prog-mode . whitespace-mode) - :diminish) + :diminish nil) (use-package display-fill-column-indicator :init (setq-default display-fill-column-indicator-column 80) @@ -926,6 +912,7 @@ ;;;; projects (use-package project :demand t) (global-set-key "\C-xp" 'jao-prev-window) +(use-package list-projects :ensure t) ;;;; buffer quit function (the triple ESC) (setq buffer-quit-function (lambda () t)) @@ -946,6 +933,42 @@ scroll-step 1 redisplay-skip-fontification-on-input nil)) +(use-package ultra-scroll + ;:load-path "~/code/emacs/ultra-scroll" ; if you git clone'd instead of using vc + :vc (:url "https://github.com/jdtsmith/ultra-scroll") ; For Emacs>=30 + :init + (setq scroll-conservatively 3 ; or whatever value you prefer, since v0.4 + scroll-margin 0) ; important: scroll-margin>0 not yet supported + :config + (ultra-scroll-mode 1)) + +;;;; show diffs when running C-x s +(add-to-list 'save-some-buffers-action-alist + `("d" + ,(lambda (buffer) + (diff-buffer-with-file (buffer-file-name buffer))) + "show diff between the buffer and its file")) + +;;;; copy buffer file name +;; https://stackoverflow.com/questions/18812938/copy-full-file-path-into-copy-paste-clipboard +(defun copy-buffer-file-name-as-kill (choice) + "Copy the buffer-file-name to the kill-ring" + (interactive "cCopy Buffer Name (F) Full, (D) Directory, (N) Name") + (let ((new-kill-string) + (name (if (eq major-mode 'dired-mode) + (dired-get-filename) + (or (buffer-file-name) "")))) + (cond ((eq choice ?f) + (setq new-kill-string name)) + ((eq choice ?d) + (setq new-kill-string (file-name-directory name))) + ((eq choice ?n) + (setq new-kill-string (file-name-nondirectory name))) + (t (message "Quit"))) + (when new-kill-string + (message "%s copied" new-kill-string) + (kill-new new-kill-string)))) + ;;; Windows ;;;; splitting and switch (setq split-height-threshold 80 @@ -1134,8 +1157,9 @@ global-dictionary-tooltip-mode) :bind (("C-c d" . dictionary-search))) -(setq ispell-personal-dictionary - (expand-file-name "~/.emacs.d/ispell.dict")) +(use-package ispell + :custom ((ispell-personal-dictionary + (expand-file-name "~/.emacs.d/ispell.dict")))) (use-package reverso :ensure t @@ -1301,9 +1325,10 @@ (defun jao-maybe-view-video (url &rest _ignored) (interactive) - (if (y-or-n-p "View video (y) or web page (n)? ") - (jao-view-video url) - (funcall jao-browse-url-function url))) + (let ((w (read-char "View video (v) or web page (w)? "))) + (cond ((eq w ?v) (jao-view-video url)) + ((eq w ?w) (funcall jao-browse-url-function url)) + (t (message "Aborted"))))) ;;;; web browsers (defun jao-www--buffer-p (b) @@ -1359,8 +1384,9 @@ '("ps" "pdf" "dvi" "djvu" "zip" "gz" "tgz")) (defvar jao-browse-external-domains - '("github.com" "gitlab.com" "slack.com" "meet.google.com" "docs.google.com" - "x.com" "twitter.com" "t.com" "linkedin.com" "bigml.com" "slack.com")) + '("github.com" "gitlab.com" "slack.com" "spotify.com" "drive.google.com" + "meet.google.com" "docs.google.com" "x.com" "twitter.com" + "t.com" "linkedin.com" "bigml.com" "slack.com" "zoom.us")) (defvar jao-browse--external-regexp (format "https?://.*%s\\(/.*\\)?" @@ -1543,9 +1569,9 @@ :hook ((doc-view-mode . jao-doc-session-mark)) :bind (:map doc-view-mode-map ("j" . doc-view-next-line-or-next-page) - ("J" . doc-view-scroll-up-or-next-page) + ("J" . doc-view-search-next-match) ("k" . doc-view-previous-line-or-previous-page) - ("K" . doc-view-scroll-down-or-previous-page) + ("K" . doc-view-search-previous-match) ("z" . jao-open-with-zathura))) (use-package jao-doc-session :demand t) @@ -1869,8 +1895,6 @@ (setq forge-topic-list-limit (cons 100 -1) forge-pull-notifications nil) :config - (add-hook 'magit-status-sections-hook #'forge-insert-assigned-pullreqs t) - (add-hook 'magit-status-sections-hook #'forge-insert-assigned-issues t) (use-package embark-vc :ensure t) :bind ((:map forge-topic-mode-map ("M-w" . copy-region-as-kill)))) @@ -1886,10 +1910,10 @@ ;;;; other git packages (use-package git-timemachine :ensure t) -(use-package consult-git-log-grep - :ensure t - :custom (consult-git-log-grep-open-function #'magit-show-commit) - :bind (("C-c K" . consult-git-grep))) +;; (use-package consult-git-log-grep +;; :ensure t +;; :custom (consult-git-log-grep-open-function #'magit-show-commit) +;; :bind (("C-c K" . consult-git-grep))) ;; git config --local git-link.remote / git-link.branch (use-package git-link :ensure t) @@ -2094,7 +2118,7 @@ (add-hook 'emacs-lisp-mode-hook #'jao-outline-minor-mode) (use-package edit-list :ensure t) -(use-package package-lint :ensure t) +;; (use-package package-lint :ensure t) ;; (use-package tree-inspector :ensure t) (defun elisp-disassemble (function) @@ -2213,7 +2237,9 @@ (add-hook 'org-mode-hook #'jao-org--set-geiser-impl) (jao-load-path "geiser") +;; (package-vc-install-from-checkout ...) (use-package geiser + :demand t :init (setq geiser-repl-history-filename "~/.emacs.d/cache/geiser-history" geiser-repl-startup-time 20000 @@ -2402,6 +2428,11 @@ :config (venv-initialize-eshell) (jao-compilation-env "VIRTUAL_ENV")) +;;;; Javascript + +(use-package typescript-mode + :ensure t + :custom ((typescript-indent-level 2))) ;;; Text/data formats ;;;; json @@ -2445,10 +2476,10 @@ (tramp-get-completion-function "ssh")) #'string=)) -(defun jao-ssh () - (interactive) +(defun jao-ssh (&optional scratch) + (interactive "P") (let ((h (completing-read "Host: " (jao-tramp-hosts)))) - (jao-afio-goto-scratch) + (when scratch (jao-afio-goto-scratch)) (jao-exec-in-term (format "ssh %s" h) (format "*ssh %s*" h)))) ;;; Chats @@ -2495,17 +2526,27 @@ lui-track-behavior 'before-tracking-next-buffer) :config - (defsubst jao-circe-nick-no () (length (circe-channel-nicks))) + (defsubst jao-circe-nick-no () + (if (derived-mode-p 'circe-query-mode) + 2 + (length (circe-channel-nicks)))) + + (defsubst jao-circe-netowrk () + (or (plist-get lui-logging-format-arguments :network) "")) (define-minor-mode jao-circe-user-number-mode "" :lighter (:eval (format " [%s]" (jao-circe-nick-no)))) (defun jao-circe-channel-hook () - ;; (setq header-line-format - ;; '(" %b" (:eval (format " - %s nicks" (jao-circe-nick-no))))) + (when jao-mode-line-in-minibuffer + (setq header-line-format + '(" %b" (:eval (format "@%s - %s nicks" + (jao-circe-netowrk) + (jao-circe-nick-no)))))) (jao-circe-user-number-mode 1)) (add-hook 'circe-channel-mode-hook #'jao-circe-channel-hook) + (add-hook 'circe-query-mode-hook #'jao-circe-channel-hook) (defun circe-command-RECOVER (&rest _ignore) "Recover nick" @@ -2538,9 +2579,13 @@ (list "Bitlbee" :host "127.0.0.1" :nick u :channels jao-bitlbee-channels :lagmon-disabled t :nickserv-password u :user p)) - (list "localslack" :host "127.0.0.1" :nick "jao" + (list "bigml" :host "127.0.0.1" :nick "jao" :channels jao-slack-channels :port 9007 - :lagmon-disabled t))) + :lagmon-disabled t) + (list "recoveryou" :host "127.0.0.1" :nick "jao" + :port 9008 :lagmon-disabled t) + (list "grio" :host "127.0.0.1" :nick "jao" + :port 9009 :lagmon-disabled t))) (jao-shorten-modes 'circe-channel-mode 'circe-server-mode @@ -2557,18 +2602,18 @@ (telega-use-tracking-for '(unmuted) ;; '(or unmuted mention) telega-rainbow-color-custom-for nil telega-msg-rainbow-title nil - telega-sticker-set-download t) + telega-sticker-set-download t + telega-symbol-checkmark "·" + telega-symbol-heavy-checkmark "×" + telega-symbol-verified "*") :config (define-key global-map (kbd "C-c C-t") telega-prefix-map) (setq telega-chat-show-avatars nil - telega-chat-prompt-format ">> " + telega-chat-prompt-insexp '(telega-ins "> ") telega-completing-read-function #'completing-read telega-root-show-avatars nil telega-emoji-use-images nil telega-temp-dir "/tmp/telega" - telega-symbol-checkmark "·" - telega-symbol-heavy-checkmark "×" - telega-symbol-verified "*" telega-symbol-horizontal-bar (propertize "-" 'face 'jao-themes-f00) telega-symbol-vertical-bar @@ -2621,10 +2666,13 @@ (use-package mastodon :ensure t :init - (setq mastodon-instance-url "https://emacs.ch" - mastodon-active-user "mail@jao.io" + (setq mastodon-instance-url "https://fosstodon.org" + mastodon-active-user "jao@gnu.org" + mastodon-group-notifications t + mastodon-images-in-notifs t mastodon-tl-position-after-update nil - mastodon-toot-display-orig-in-reply-buffer t) + mastodon-toot-display-orig-in-reply-buffer t + mastodon-media--hide-sensitive-media nil) :config ;; (defun jao-mastodon--setup () ;; (setq-local scroll-margin 12)) @@ -2644,6 +2692,78 @@ (jao-afio-goto-chats) (mastodon)) +;; https://0x0.st/XJ14.txt +(jao-transient-major-mode mastodon + ["Timelines" + ("H" "home" mastodon-tl--get-home-timeline) + ("L" "local" mastodon-tl--get-local-timeline) + ("F" "federated" mastodon-tl--get-federated-timeline) + ("K" "bookmarks" mastodon-profile--view-bookmarks) + ("V" "favorites" mastodon-profile--view-favourites) + ("'" "followed tags" mastodon-tl--followed-tags-timeline) + ("@" "mentions" mastodon-notifications--get-mentions) + ("N" "notifications" mastodon-notifications-get) + ("\\" "of remote host" mastodon-tl--get-remote-local-timeline)] + + ;; u mastodon-tl--update + + ["Search" + ("s" "search" mastodon-search--query) + ("#" "tagged" mastodon-tl--get-tag-timeline) + ("\"" "followed tags" mastodon-tl--list-followed-tags) + ("I" "filter" mastodon-views--view-filters) + ("X" "lists" mastodon-views--view-lists)] + + ["Toots" + ("n" "next" mastodon-tl--goto-next-item :transient t) + ("p" "prev" mastodon-tl--goto-prev-item :transient t) + ("c" "spoiler" mastodon-tl--toggle-spoiler-text-in-toot :transient t) + ("T" "thread" mastodon-tl--thread) + ("b" "(un)boost" mastodon-toot--toggle-boost :transient t) + ("f" "(un)fav" mastodon-toot--toggle-favourite :transient t) + ("i" "(un)pin" mastodon-toot--pin-toot-toggle :transient t) + ("k" "(un)bookmark" mastodon-toot--toggle-bookmark :transient t) + ("v" "vote" mastodon-tl--poll-vote)] + + ;; Z mastodon-tl--report-to-mods + ;; o mastodon-toot--open-toot-url + + ["Own Toots" + ("r" "replay" mastodon-toot--reply) + ("t" "write" mastodon-toot) + ("e" "edit" mastodon-toot--edit-toot-at-point) + ("d" "delete" mastodon-toot--delete-toot) + ("D" "del & redraft" mastodon-toot--delete-and-redraft-toot) + ("E" "show edits" mastodon-toot--view-toot-edits)] + + ;; S mastodon-views--view-scheduled-toots + + ["Users" + ("W" "follow" mastodon-tl--follow-user) + ("R" "follow req" mastodon-views--view-follow-requests) + ("G" "suggestions" mastodon-views--view-follow-suggestions) + ("M" "mute user" mastodon-tl--mute-user) + ("B" "block user" mastodon-tl--block-user) + ("m" "message user" mastodon-tl--dm-user) + ;; "" + ;; ("," "favouriters" mastodon-toot--list-toot-favouriters) + ;; ("." "boosters" mastodon-toot--list-toot-boosters) + ] + + ;; S-RET mastodon-tl--unmute-user + ;; C-S-b mastodon-tl--unblock-user + + ["Profiles" + ("A" "author" mastodon-profile--get-toot-author) + ("P" "any user" mastodon-profile--show-user) + ("O" "own" mastodon-profile--my-profile) + ("U" "update own" mastodon-profile--update-user-profile-note)] + + ["Misc" + ("C" "copy URL" mastodon-toot--copy-toot-url) + ("?" "help" describe-mode) + ("q" "quit" transient-quit-one)]) + ;;;; startup (defun jao-chats (&optional p) (interactive "P") @@ -2654,12 +2774,13 @@ (jao-with-auth "matrix.org" u p (ement-connect :user-id u :password p)))) (when (and (fboundp 'mastodon) (or p (y-or-n-p "Connect to mastodon? "))) (mastodon)) - (when (or p (y-or-n-p "Connect to libera? ")) - (unless (get-buffer "irc.libera.chat:6697") - (circe "Libera Chat"))) - (when (or p (y-or-n-p "Connect to localslack? ")) - (unless (get-buffer "127.0.0.1:9007") - (circe "localslack")))) + (dolist (c '(("Libera Chat" . "irc.libera.chat:6697") + ("bigml" . "127.0.0.1:9007") + ("recoveryou" . "127.0.0.1:9008") + ("grio" . "127.0.0.1:9009"))) + (unless (get-buffer (cdr c)) + (when (or p (y-or-n-p (format "Connect to %s? " (car c)))) + (circe (car c)))))) (defun jao-all-chats () (interactive) @@ -2700,6 +2821,9 @@ (with-eval-after-load "consult" (jao-consult-add-buffer-source 'jao-chat-buffer-source)) ;;; Multimedia +;;;; video +(use-package ready-player :ensure t) +(ready-player-mode 1) ;;;; mixer (defun jao-mixer-get-level (&optional dev nomsg) (interactive) @@ -2763,6 +2887,8 @@ (interactive "P") (jao-show-lyrics force #'jao-mpris-artist-title)) +(defun jao-mpris-mopidy-p () (string= "mopidy "jao-mpris-player)) + (defun jao-mpc-mopidy-playlist () (interactive) (jao-mpc-show-playlist jao-mopidy-port)) @@ -2783,8 +2909,7 @@ (defalias 'jao-streaming-volume #'jao-mpris-vol) (defalias 'jao-streaming-volume-down #'jao-mpris-vol-down)) -;; (jao-mpris-register "playerctld" -;; :session (if jao-mode-line-in-minibuffer -10 70)) +(jao-mpris-register "playerctld" :session 70) ;; (jao-mpris-register "mopidy" :session 70) ;;;; mpc @@ -2902,9 +3027,14 @@ (interactive) (jao-mpc-show-playlist jao-mopidy-port)) -(use-package jao-random-album :demand t) - -(jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch)) +(use-package jao-random-album + :demand t + :config + (defun jao--notify-album (album) + (unless jao-minibuffer-mode + (jao-notify album "Next album" jao-notify-audio-icon)) + (jao-minibuffer-refresh)) + (setq jao-random-album-notify #'jao--notify-album)) (defun jao-toggle-pasystray-applet () (interactive) @@ -2913,7 +3043,7 @@ (transient-define-prefix jao-transient-streaming () [:description (lambda () (format "Streaming using %s" jao-mpris-player)) - ["Search" + ["Search" :if jao-mpris-mopidy-p ("a" "album" jao-streaming-album) ("A" "artist" jao-streaming-artist) ("t" "track" jao-streaming-track) @@ -2921,21 +3051,21 @@ ["Play" ("s" "toggle" jao-streaming-toggle) ("n" "next" jao-streaming-next) - ("p" "previous" jao-streaming-prev)] + ("p" "previous" jao-streaming-prev) + ("T" "toggle player" jao-streaming-toggle-player)] ["Seek & shout" ("f" "seek fwd" jao-streaming-seek :transient t) ("F" "seek bwd" jao-streaming-seek-back :transient t) ("u" "up" jao-streaming-volume :transient t) ("d" "down" jao-streaming-volume-down :transient t)] ["Browse" - ("l" "playing list" jao-streaming-list) + ("l" "playing list" jao-streaming-list :if jao-mpris-mopidy-p) ("L" "lyrics" jao-streaming-lyrics) ("w" "currently playing" jao-streaming-current)] - ["Act" + ["Act" :if jao-mpris-mopidy-p ("k" "like" jao-streaming-like) ("K" "dislike" jao-streaming-dislike) - ("S" "toggle shuffle" jao-streaming-toggle-shuffle) - ("T" "toggle player" jao-streaming-toggle-player)]]) + ("S" "toggle shuffle" jao-streaming-toggle-shuffle)]]) (transient-define-prefix jao-transient-media () [["Play" @@ -3192,6 +3322,7 @@ (outline-show-entry)) ((derived-mode-p 'org-mode) (org-reveal)))) +(jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch)) (jao-def-exec-in-term "htop" "htop" (jao-afio-goto-scratch)) (transient-define-prefix jao-transient-utils () @@ -3206,20 +3337,20 @@ ("do" "open doc" jao-open-doc) ("dr" "search docs with recoll" jao-recoll-consult-docs)] ["Monitors" - ("p" "htop" jao-term-htop) + ("p" "list projects" list-projects) + ;; ("p" "htop" jao-term-htop) ("P" "pasytray" jao-toggle-pasystray-applet) ("x" "restart i3bar" jao-river-restart-i3bar :if jao-river-enabled-p) ("x" "restart xmobar" jao-xmobar-restart :if jao-exwm-enabled-p) ("x" "kill xmobar" jao-xmobar-kill :if jao-xmonad-enabled-p)] ["Network" - ("S" "ssh" jao-ssh) + ("s" "ssh" jao-ssh) ("b" "bluetooth" bluetooth-list-devices) ("c" "connect chats" jao-all-chats) ("m" "proton bridge" run-proton-bridge) ("v" "view video" jao-view-video)] ["Chats" ("t" "telegram" jao-chats-telega) - ("s" "slack" jao-chats-slack) ("i" "irc" jao-chats-irc) ("M" "mastodon" jao-mastodon) ("T" "telegram rooster" jao-telega)] @@ -3235,7 +3366,9 @@ ["Helpers" ("a" "aptitude" jao-term-aptitude) ("l" "packages" jao-list-packages) - ("r" "reveal" jao-reveal) + ;; ("r" "reveal" jao-reveal) + ("r" "translate" reverso) + ("f" "copy buffer file name" copy-buffer-file-name-as-kill) ("k" (lambda () (concat "keyboard" (when (jao-kb-toggled-p) "*"))) jao-kb-toggle :if jao-x11-p)]]) |