diff options
author | jao <jao@gnu.org> | 2022-09-05 15:27:10 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-09-05 15:27:10 +0100 |
commit | ffb5fb51f9dd63d87c17a05ff43188869a50c6b3 (patch) | |
tree | 13d56104ef7ccc7864d0dc66be11d893dc9158eb | |
parent | 7024463ca8513ec56dc6e7bbe70d96b4eb601cb9 (diff) | |
download | elibs-ffb5fb51f9dd63d87c17a05ff43188869a50c6b3.tar.gz elibs-ffb5fb51f9dd63d87c17a05ff43188869a50c6b3.tar.bz2 |
linting
-rw-r--r-- | init.el | 93 |
1 files changed, 48 insertions, 45 deletions
@@ -281,7 +281,8 @@ :bind (("C-c p" . jao-transient-password))) (transient-define-prefix jao-transient-password () - [[("c" "copy secret" password-store-copy) + ["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) @@ -301,7 +302,7 @@ ;;;; fontsets (defun jao--set-fontsets (_f) - (when (display-graphic-p) + (when (and (display-graphic-p) (fboundp 'set-fontset-font)) (set-fontset-font t 64257 "Quivira" nil) (set-fontset-font t 'egyptian "Noto Sans Egyptian Hieroglyphs" nil) (set-fontset-font t 'hangul "NanumGothicCoding" nil) @@ -383,7 +384,7 @@ ;; bookmarks (setq bookmark-default-file "~/.emacs.d/emacs.bmk" - bookmark-set-fringe-mark nil) + bookmark-fringe-mark nil) ;;;; man pages (setq Man-notify-method 'pushy) ;; pushy - same window @@ -541,10 +542,13 @@ (add-hook 'after-init-hook #'jao-river-enable)) ;;;; sway +(defun jao-sway-msg (msg) + (shell-command (format "swaymsg '%s' >/dev/null" msg))) + (defmacro jao-def-swaymsg (name msg) `(defun ,(intern (format "jao-sway-%s" name)) () (interactive) - (jao-swaymsg ,msg))) + (jao-sway-msg ,msg))) (jao-def-swaymsg firefox "[app_id=Firefox] focus") @@ -562,18 +566,18 @@ (defun jao-sway-open-with-zathura (file page) (let ((n (file-name-nondirectory file))) - (jao-swaymsg "workspace number 3") - (unless (= 0 (jao-swaymsg (format "[title=\"%s\"] focus" n))) + (jao-sway-msg "workspace number 3") + (unless (= 0 (jao-sway-msg (format "[title=\"%s\"] focus" n))) (jao-shell-exec (jao-pdf-zathura-open-cmd file page))) (when page (sit-for 0.2) (jao-wayland-type (format "%dg" page))))) (defun jao-sway-set-wallpaper (f) - (jao-swaymsg (format "output * bg %s fill" f))) + (jao-sway-msg (format "output * bg %s fill" f))) (defun jao-sway-run-or-focus (cmd &optional ws) (if (jao-shell-running-p "firefox") - (jao-swaymsg (format "[app_id=%s] focus" cmd)) - (jao-swaymsg (format "workspace %s" (or ws 2))) + (jao-sway-msg (format "[app_id=%s] focus" cmd)) + (jao-sway-msg (format "workspace %s" (or ws 2))) (start-process-shell-command cmd nil cmd))) (defun jao-sway-run-or-focus-firefox () @@ -724,8 +728,8 @@ (setq enable-recursive-minibuffers t) (require 'mb-depth) (minibuffer-depth-indicate-mode 1) -(require 'minibuf-eldef) -(setq minibuffer-eldef-shorten-default t) + +(setq minibuffer-default-prompt-format " (default %s)") (minibuffer-electric-default-mode 1) (jao-minibuffer-mode 1) @@ -771,7 +775,7 @@ :init (when (and window-system (not jao-modeline-in-minibuffer)) (add-to-list 'after-make-frame-functions #'jao-mode-line-hide-inactive) - (add-hook 'after-init-hook #'jao-toggle-inactive-mode-line)) + (add-hook 'after-init-hook #'jao-mode-line-toggle-inactive)) :demand t :bind (("<home>" . jao-mode-line-toggle-inactive) ("<end>" . jao-mode-line-toggle) @@ -829,8 +833,8 @@ (use-package tmr :ensure t :init - (setq tmr-sound-file "/usr/share/sounds/freedesktop/stereo/message.oga" - tmr-descriptions-list '("tea is ready"))) + (setq tmr-sound-file "/usr/share/sounds/freedesktop/stereo/message.oga")) + ;;;; pulsar (when window-system (use-package pulsar @@ -933,7 +937,7 @@ (jao-afio-goto-scratch) (if-let ((b (get-buffer "*wttr*"))) (progn (pop-to-buffer b) - (term-send-string "clear;curl wttr.in\n")) + (term-send-string (get-buffer-process nil) "clear;curl wttr.in\n")) (jao-exec-in-term "curl wttr.in" "*wttr*")))) (global-set-key (kbd "<f5>") #'jao-weather) @@ -1052,7 +1056,7 @@ auto-insert t auto-insert-query t) (setf (alist-get 'html-mode auto-insert-alist nil t) nil)) -(add-hook 'find-file-hooks #'auto-insert) +(add-hook 'find-file-hook #'auto-insert) (use-package jao-skel :demand t @@ -1069,17 +1073,18 @@ ;;;; recoll (jao-load-path "consult-recoll") -(defun jao-recoll-format (title url mtype) +(defun jao-recoll-format (title url _mtype) (let* ((u (replace-regexp-in-string "file://" "" url)) (u (replace-regexp-in-string "/home/jao/" "" u)) (u (replace-regexp-in-string "\\(doc\\|org/doc\\|.emacs.d/gnus/Mail\\|var/mail\\)/" "" u))) (format "%s (%s)" ;; "%s (%s, %s)" title - (propertize u 'face 'jao-themes-f00) - (propertize mtype 'face 'jao-themes-f01)))) + (propertize u 'face 'jao-themes-f01) + ;; (propertize mtype 'face 'jao-themes-f01) + ))) -(defun jao-recoll-open-html (file &optional page) +(defun jao-recoll-open-html (file &optional _page) (if (string-match-p "\.epub\\'" file) (find-file file) (jao-afio-goto-www) @@ -1180,7 +1185,7 @@ ;;;; same mode (defun jao-buffer-same-mode (&optional mode pre-fn switch-fn) - (interactive) + (interactive "P") (let* ((mode (or mode major-mode)) (modes (if (symbolp mode) (list mode) mode)) (pred `(lambda (b) @@ -1375,7 +1380,7 @@ (defun jao-bisect () (interactive) (jao-trisect t) - (next-window) + (other-window 1) (delete-window)) ;;;; afio @@ -1391,7 +1396,8 @@ (defun jao-current--frame-id () (propertize (cond ((and (jao-exwm-enabled-p) - (not (bound-and-true-p jao-exwm--use-afio))) + (not (bound-and-true-p jao-exwm--use-afio)) + (boundp 'exwm-workspace-current-index)) (format "F%s" exwm-workspace-current-index)) (jao-afio-use-frames (or (jao-afio-frame-name) "")) (t (format "%s" (or (jao-afio-frame-no) "")))) @@ -1532,8 +1538,7 @@ (setq LaTeX-biblatex-use-Biber t) (setq bibtex-dialect 'biblatex) :config - (add-hook 'TeX-after-compilation-finished-functions - #'TeX-revert-document-buffer) + (add-hook 'TeX-after-compilation-finished-functions 'TeX-revert-document-buffer) (add-hook 'LaTeX-mode-hook 'turn-on-reftex)) ;;; Browsing @@ -1616,8 +1621,8 @@ (let ((args (format "%s %s" prg (shell-quote-argument url)))) (start-process-shell-command prg nil args))) -(defun jao--mpv (url &rest args) (jao--remote-run url "mpv")) -(defun jao--vlc (url &rest args) (jao--remote-run url "vlc")) +(defun jao--mpv (url &rest _args) (jao--remote-run url "mpv")) +(defun jao--vlc (url &rest _args) (jao--remote-run url "vlc")) (defvar jao--video-player 'jao--mpv) @@ -1666,7 +1671,7 @@ (match-string-no-properties 1 url) url))) -(defun jao--browse-doc (url search &optional no-add) +(defun jao--browse-doc (url &rest _ignored) (let* ((url (substring-no-properties url)) (file (jao--fln url))) (when file @@ -1900,7 +1905,7 @@ (when (string-match "doc://\\([^?]+\\)\\(\\?.*\\)?" url) (let ((file (match-string 1 url)) (page (when-let* ((qs (match-string 2 url)) - (_ (> (length qs) 1)) + (long (> (length qs) 1)) (ps (url-parse-query-string (substring qs 1))) (pn (cadr (assoc "page" ps)))) (string-to-number pn)))) @@ -1979,8 +1984,13 @@ :init (setq vterm-kill-buffer-on-exit t vterm-copy-exclude-prompt t jao-use-vterm t) - :config (jao-define-attached-buffer "\\*vterm\\*" 0.5) - :bind (:map vterm-mode-map ("C-c C-c" . vterm-send-C-c))) + :config + + (defun jao-vterm-send-C-c () (vterm-send-key "c" nil nil t)) + + (jao-define-attached-buffer "\\*vterm\\*" 0.5) + + :bind (:map vterm-mode-map ("C-c C-c" . jao-vterm-send-C-c))) (defun jao-exec-in-vterm (cmd bname) (if (string-blank-p (or cmd "")) @@ -2397,7 +2407,7 @@ :bind (:map flymake-mode-map (("s-f n" . flymake-goto-next-error) ("s-f p" . flymake-goto-prev-error) ("s-f i" . flymake-show-diagnostic) - ("s-f f" . flymake-show-diagnostics-buffer) + ("s-f f" . flymake-show-buffer-diagnostics) ("s-f l" . consult-flymake)))) ;;;; workarounds @@ -2414,7 +2424,7 @@ (defun jao-outline-minor-mode-hide-all (&optional arg) (interactive "P") - (hide-sublevels (if arg 5 4))) + (outline-hide-sublevels (if arg 5 4))) (defun jao-outline-minor-expand-all () (when jao-outline-minor-mode (outline-show-all))) @@ -2512,7 +2522,7 @@ (save-buffer)) (let ((filename (expand-file-name buffer-file-name))) (with-temp-buffer - (byte-compile-file filename t)))) + (byte-compile-file filename)))) (use-package elisp-mode :bind (:map emacs-lisp-mode-map @@ -2850,10 +2860,6 @@ circe-completion-suffix ", " circe-reduce-lurker-spam t - circe-nick-next-function - (lambda (old) - (replace-regexp-in-string "-" "`" (circe-nick-next old))) - circe-lagmon-mode-line-format-string "" ;; "%.0f " circe-lagmon-mode-line-unknown-lag-string "" ;; "? " circe-lagmon-timer-tick 120 @@ -2882,7 +2888,7 @@ (add-hook 'circe-channel-mode-hook #'jao-circe-channel-hook) - (defun circe-command-RECOVER (&rest ignore) + (defun circe-command-RECOVER (&rest _ignore) "Recover nick" (let* ((fn (jao--get-user/password "freenode")) (u (car fn)) @@ -2940,7 +2946,7 @@ slack-prefer-current-team t slack-message-tracking-faces '(warning) slack-log-level 'warn - slack-message-custom-notifier (lambda (msg room team) room)) + slack-message-custom-notifier (lambda (_msg room _team) room)) :bind (:map slack-mode-map (("@" . slack-message-embed-mention) ("#" . slack-message-embed-channel)) :map slack-message-buffer-mode-map @@ -3202,6 +3208,7 @@ "spotify") nil nil nil nil jao-mpris-player))) (setq jao-mpris-player player) + (require 'jao-mpris) (jao-mpris-setup-aliases)) (jao-spt-setup-aliases) (setq jao-mpris-player "spt")) @@ -3242,8 +3249,6 @@ (interactive) (jao-mpc-show-playlist jao-mopidy-port)) -(defun jao-player-level-cap () (interactive) (jao-mixer-level "Capture")) - (use-package jao-random-album :demand t) (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio-goto-scratch)) @@ -3303,9 +3308,7 @@ [:description (lambda () (format "Capture %s%%" (jao-mixer-get-level "Capture" t))) ("D" "down" jao-mixer-capture-down :transient t) - ("U" "up" jao-mixer-capture-up :transient t) - ;; ("V" "show" jao-player-level-cap) - ] + ("U" "up" jao-mixer-capture-up :transient t)] ["Utilities" ("c" "reconnect to mpd" jao-player-connect) ("N" "next random album" jao-random-album-next) |