diff options
| -rw-r--r-- | custom/jao-custom-completion.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-email.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-eww.el | 6 | ||||
| -rw-r--r-- | custom/jao-custom-exwm.el | 16 | ||||
| -rw-r--r-- | custom/jao-custom-org.el | 2 | ||||
| -rw-r--r-- | custom/jao-custom-w3m.el | 4 | ||||
| -rw-r--r-- | init.el | 18 | ||||
| -rw-r--r-- | lib/doc/jao-pdf.el | 2 | ||||
| -rw-r--r-- | lib/eos/jao-afio.el | 72 | 
9 files changed, 64 insertions, 60 deletions
| diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 0682b44..3977167 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -427,7 +427,7 @@  (defun jao-embark-targets--play-video (player url)    (interactive "sURL: ")    (let ((cmd (format "%s %s" player (shell-quote-argument url)))) -    (jao-afio--goto-www) +    (jao-afio-goto-www)      (start-process-shell-command player nil cmd)))  (defun jao-embark-targets-mpv (&optional url) diff --git a/custom/jao-custom-email.el b/custom/jao-custom-email.el index f35925b..83707ee 100644 --- a/custom/jao-custom-email.el +++ b/custom/jao-custom-email.el @@ -293,7 +293,7 @@          :history 'jao-mail-consult-buffer-history          :action (lambda (b)                    (when (not (string-blank-p (or b ""))) -                    (jao-afio--goto-mail) +                    (jao-afio-goto-mail)                      (if (get-buffer-window b)                          (pop-to-buffer b)                        (pop-to-buffer-same-window b)))) diff --git a/custom/jao-custom-eww.el b/custom/jao-custom-eww.el index dbe147f..ae486fb 100644 --- a/custom/jao-custom-eww.el +++ b/custom/jao-custom-eww.el @@ -5,7 +5,7 @@    "Browse URL using eww."    (if (derived-mode-p 'eww-mode)        (eww url) -    (jao-afio--goto-www) +    (jao-afio-goto-www)      (select-window (frame-first-window))      (let* ((url (url-encode-url url))             (bf (seq-find `(lambda (b) @@ -66,7 +66,7 @@            :annotate (lambda (c) (get-text-property 0 'url c))            :history 'jao-eww-consult-history            :action (lambda (b) -                    (jao-afio--goto-www) +                    (jao-afio-goto-www)                      (switch-to-buffer (get-text-property 0 'buffer b)))            :items            (lambda () @@ -100,7 +100,7 @@    (interactive "P")    (if (> (length jao-eww--closed-urls) 0)        (let ((url (completing-read "URL: " jao-eww--closed-urls))) -        (jao-afio--goto-www) +        (jao-afio-goto-www)          (setq jao-eww--closed-urls (remove url jao-eww--closed-urls))          (eww url (when arg 4)))      (message "No previously closed URLs."))) diff --git a/custom/jao-custom-exwm.el b/custom/jao-custom-exwm.el index 842fd1a..d40b297 100644 --- a/custom/jao-custom-exwm.el +++ b/custom/jao-custom-exwm.el @@ -238,7 +238,7 @@              (defun ,toggler (,arg)                (interactive "P")                (if (and (not ,arg) (equal exwm-class-name ,class)) -                  (jao-afio--goto-main) +                  (jao-afio-goto-main)                  (,name))))))  (defun jao-exwm--send-str (str) @@ -309,7 +309,7 @@                                           (car (jao-zathura--file-info b))))                             (jao-zathura--buffers)))           (page-no (or page-no (jao-doc-view-current-page)))) -    (if jao-exwm--use-afio (jao-afio--goto-docs) (jao-exwm--goto-docs)) +    (if jao-exwm--use-afio (jao-afio-goto-docs) (jao-exwm--goto-docs))      (if (not buffer)          (jao-exwm-run (if page-no                            (format "zathura -P %s '%s'" page-no file-name) @@ -395,7 +395,7 @@                              (or (jao-zathura--buffer-p b)                                  (member (buffer-local-value 'major-mode b)                                          '(pdf-view-mode doc-view-mode)))))))) -    (jao-afio--goto-docs) +    (jao-afio-goto-docs)      (pop-to-buffer b))) @@ -482,11 +482,11 @@  (setq   exwm-input-global-keys - '(([?\s-0] . jao-afio--goto-scratch) -   ([?\s-1] . jao-afio--goto-main) -   ([?\s-2] . jao-afio--goto-mail) -   ([?\s-3] . jao-afio--goto-www) -   ([?\s-4] . jao-afio--goto-docs) + '(([?\s-0] . jao-afio-goto-scratch) +   ([?\s-1] . jao-afio-goto-main) +   ([?\s-2] . jao-afio-goto-mail) +   ([?\s-3] . jao-afio-goto-www) +   ([?\s-4] . jao-afio-goto-docs)     ([?\s-A] . org-agenda-list)     ([?\s-a] . jao-first-window)     ([?\s-b] . jao-transient-org-blog) diff --git a/custom/jao-custom-org.el b/custom/jao-custom-org.el index f46b9ee..b98f665 100644 --- a/custom/jao-custom-org.el +++ b/custom/jao-custom-org.el @@ -5,7 +5,7 @@    :ensure t    :custom ((org-export-backends '(ascii html latex texinfo)))    :init -  (defalias 'jao-open-gnus-frame 'jao-afio--goto-mail) +  (defalias 'jao-open-gnus-frame 'jao-afio-goto-mail)    (setq org-adapt-indentation t          org-catch-invisible-edits 'smart diff --git a/custom/jao-custom-w3m.el b/custom/jao-custom-w3m.el index 0ccd37c..0edac5e 100644 --- a/custom/jao-custom-w3m.el +++ b/custom/jao-custom-w3m.el @@ -10,7 +10,7 @@        (pop-to-buffer b))))  (defun jao-w3m-browse-url (url &rest r) -  (jao-afio--goto-www) +  (jao-afio-goto-www)    (select-window (frame-first-window))    (unless (jao-w3m-find-url url)      (w3m-goto-url-new-session url))) @@ -122,7 +122,7 @@                       (seq-map #'jao-www--item                                (seq-filter #'jao-www--buffer-p (buffer-list))))              :action (lambda (b) -                      (jao-afio--goto-www) +                      (jao-afio-goto-www)                        (switch-to-buffer (get-text-property 0 'buffer b)))))      (jao-consult-add-buffer-source 'jao-consult-w3m-source "Web" ?w))) @@ -916,7 +916,7 @@        (message "%s"                 (jao-shell-string "curl -s"                                   "https://wttr.in/?format=%l++%m++%C+%c+%t+%w++%p")) -    (jao-afio--goto-scratch) +    (jao-afio-goto-scratch)      (if-let ((b (get-buffer "*wttr*")))          (progn (pop-to-buffer b)                 (term-send-string "clear;curl wttr.in\n")) @@ -1068,7 +1068,7 @@  (defun jao-recoll-open-html (file &optional page)    (if (string-match-p "\.epub\\'" file)        (find-file file) -    (jao-afio--goto-www) +    (jao-afio-goto-www)      (if jao-afio-use-w3m (w3m-find-file file) (eww-open-file file))))  (defun jao-recoll-open-pdf (file &optional page) @@ -1886,7 +1886,7 @@                         (when (string-equal (buffer-file-name (car buffs)) file)                           (throw 'done (car buffs)))                         (setq buffs (cdr buffs)))))) -           (jao-afio--goto-docs) +           (jao-afio-goto-docs)             (if b (pop-to-buffer b) (find-file file))             (when page (jao-doc-view-goto-page page height))))          (jao-river-enabled (jao-river-open-with-zathura file page)) @@ -1903,7 +1903,7 @@  (defun jao-select-pdf ()    (interactive)    (jao-buffer-same-mode '(pdf-view-mode doc-view-mode) -                        #'jao-afio--goto-docs)) +                        #'jao-afio-goto-docs))  ;; doc:// links for browse-url  (defun jao-open-doc-url (url &rest _) @@ -3001,7 +3001,7 @@  (defun jao-telega ()    (interactive) -  (when jao-tracking-use-scratch (jao-afio--goto-scratch)) +  (when jao-tracking-use-scratch (jao-afio-goto-scratch))    (if (get-buffer telega-root-buffer-name)        (pop-to-buffer telega-root-buffer-name)      (telega))) @@ -3020,7 +3020,7 @@  (defun jao-all-chats ()    (interactive)    (when jao-tracking-use-scratch -    (jao-afio--goto-scratch) +    (jao-afio-goto-scratch)      (delete-other-windows))    (jao-chats t)) @@ -3260,8 +3260,8 @@  (use-package jao-random-album :demand t) -(jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) -(jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) +(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-streaming ()    [:description @@ -3334,7 +3334,7 @@  ;;; Global transients  (defun jao-list-packages ()    (interactive) -  (jao-afio--goto-scratch) +  (jao-afio-goto-scratch)    (package-list-packages))  (defun jao-window-system-p () diff --git a/lib/doc/jao-pdf.el b/lib/doc/jao-pdf.el index 6274cbb..184bb95 100644 --- a/lib/doc/jao-pdf.el +++ b/lib/doc/jao-pdf.el @@ -105,7 +105,7 @@ The result is cached as a local buffer variable."                (file (jao-org-pdf-to-org-file pdf-file))                (page (cadr info))                (pageno (or (car (last info)) page))) -    (ignore-errors (jao-afio--goto-docs)) +    (ignore-errors (jao-afio-goto-docs))      (let ((exists (file-exists-p file)))        (find-file file)        (unless exists (jao-org-insert-doc-skeleton)) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 4000eca..7bb85a0 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -30,14 +30,12 @@  (defvar jao-afio-switch-hook nil)  (defvar jao-afio--configs '(?c ?w ?g ?p ?s)) +(defvar jao-afio--previous-config (car jao-afio--configs))  (defun jao-afio--current-config (&optional c f)    (when c (modify-frame-parameters f `((afio . ,c))))    (frame-parameter f 'afio)) -(defun jao-afio--check-frame-p () -  (assoc 'afio (frame-parameters))) -  (defun jao-afio--init (&optional f)    (interactive)    (jao-afio--current-config ?c) @@ -170,60 +168,66 @@  (defun jao-afio--goto-frame (next &optional reset)    (jao-afio--check-frame) -  (when (or reset (not (eq next (jao-afio--current-config)))) -    (if jao-afio-use-frames -        (let ((f (jao-afio--find-frame next))) -          (select-frame-set-input-focus (or f (make-frame))) -          (when (setq reset (or reset (not f))) -            (set-frame-name (format "W%s" (or (jao-afio-frame-no next) next))))) -      (window-configuration-to-register (jao-afio--current-config)) -      (when (and (not reset) (get-register next)) (jump-to-register next))) -    (jao-afio--current-config next) -    (when reset (jao-afio-reset)) -    (run-hooks 'jao-afio-switch-hook))) - -(defun jao-afio--goto-main (&optional reset) +  (let ((current (jao-afio--current-config))) +    (if (and (eq next current) +             (not reset) +             (not (eq current jao-afio--previous-config))) +        (jao-afio--goto-frame jao-afio--previous-config) +      (when (or reset (not (eq next current))) +        (if jao-afio-use-frames +            (let ((f (jao-afio--find-frame next))) +              (select-frame-set-input-focus (or f (make-frame))) +              (when (setq reset (or reset (not f))) +                (set-frame-name (format "W%s" (or (jao-afio-frame-no next) next))))) +          (window-configuration-to-register (jao-afio--current-config)) +          (when (and (not reset) (get-register next)) (jump-to-register next))) +        (jao-afio--current-config next) +        (unless (eq current next) (setq jao-afio--previous-config current)) +        (when reset (jao-afio-reset)) +        (run-hooks 'jao-afio-switch-hook))))) + +(defun jao-afio-goto-main (&optional reset)    (interactive "P")    (jao-afio--goto-frame ?c reset)) -(defun jao-afio--goto-scratch (&optional reset) -  (interactive "P") -  (jao-afio--goto-frame ?s reset)) - -(defun jao-afio--goto-mail (&optional reset) +(defun jao-afio-goto-mail (&optional reset)    (interactive "P")    (jao-afio--goto-frame ?g reset)) -(defun jao-afio--goto-docs (&optional reset) +(defun jao-afio-goto-docs (&optional reset)    (interactive "P")    (jao-afio--goto-frame ?p reset)) -(defun jao-afio--goto-www (&optional reset) +(defun jao-afio-goto-www (&optional reset)    (interactive "P")    (jao-afio--goto-frame ?w reset)) +(defun jao-afio-toggle () +  (interactive) +  (jao-afio--goto-frame jao-afio--previous-config)) +  (defun jao-afio-goto-scratch (&optional one-win)    (interactive "P") -  (jao-afio--goto-scratch) +  (jao-afio--goto-frame ?s nil)    (when one-win (delete-other-windows)))  ;;;###autoload  (defun jao-afio-goto-nth (n)    (cl-case n -    ((1) (jao-afio--goto-main)) -    ((2) (jao-afio--goto-mail)) -    ((3) (jao-afio--goto-www)) -    ((4) (jao-afio--goto-docs)) -    ((5) (jao-afio--goto-scratch t)) -    ((0) (jao-afio--goto-scratch)))) +    ((1) (jao-afio-goto-main)) +    ((2) (jao-afio-goto-mail)) +    ((3) (jao-afio-goto-www)) +    ((4) (jao-afio-goto-docs)) +    ((5) (jao-afio-goto-scratch t)) +    ((0) (jao-afio-goto-scratch))))  ;;; setup  ;;;###autoload  (defun jao-afio-setup (&optional use-frames) -  (global-set-key "\C-cf" 'jao-afio--goto-main) -  (global-set-key "\C-cg" 'jao-afio--goto-mail) -  (global-set-key "\C-cw" 'jao-afio--goto-www) -  (global-set-key "\C-cz" 'jao-afio--goto-docs) +  (global-set-key "\C-cf" 'jao-afio-goto-main) +  (global-set-key "\C-cg" 'jao-afio-goto-mail) +  (global-set-key "\C-cw" 'jao-afio-goto-www) +  (global-set-key "\C-cz" 'jao-afio-goto-docs)    (setq jao-afio-use-frames use-frames)    (jao-afio--init)) | 
