summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2026-11-27 22:59:47 +0000
committerjao <jao@gnu.org>2026-11-27 22:59:47 +0000
commitbca51e1655d5a305745b7826cf5134f37f6a960a (patch)
tree47fa78d6fa69e004f412087722583b2efac1e95d /lib
parent307f2adf232ab89325549346aadab69ed1702b8d (diff)
downloadelibs-bca51e1655d5a305745b7826cf5134f37f6a960a.tar.gz
elibs-bca51e1655d5a305745b7826cf5134f37f6a960a.tar.bz2
afio refactorings
Diffstat (limited to 'lib')
-rw-r--r--lib/doc/jao-pdf.el10
-rw-r--r--lib/eos/jao-afio.el92
2 files changed, 28 insertions, 74 deletions
diff --git a/lib/doc/jao-pdf.el b/lib/doc/jao-pdf.el
index 01334b1..0347dc8 100644
--- a/lib/doc/jao-pdf.el
+++ b/lib/doc/jao-pdf.el
@@ -124,6 +124,16 @@
(add-to-list 'browse-url-handlers (cons "^doc://.+" 'jao-open-doc-url))
+;;; afio
+;;;###autoload
+(defun jao-pdf-open-session (&optional docs)
+ (interactive)
+ (dolist (doc (or docs (jao-doc-session)))
+ (when (and (stringp doc) (file-exists-p doc))
+ (if (jao-pdf-is-pdf-file doc) (funcall jao-open-doc-fun doc) (find-file doc))
+ (other-window 1)))
+ (other-window 1))
(provide 'jao-pdf)
+
;;; jao-pdf.el ends here
diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el
index b23e6af..b4a4478 100644
--- a/lib/eos/jao-afio.el
+++ b/lib/eos/jao-afio.el
@@ -29,7 +29,6 @@
(defvar jao-afio-persist-configurations nil)
(defvar jao-open-doc-fun 'find-file)
-(defvar jao-afio-mail-function 'gnus)
(defvar jao-afio-use-w3m nil)
(defvar jao-afio-auto-toggle nil)
(defvar jao-afio-switch-hook nil)
@@ -111,38 +110,13 @@
(switch-to-buffer (other-buffer))))))
;;; session openers
-;;;###autoload
-(defun jao-afio-open-pdf-session (&optional docs)
- (interactive)
- (dolist (doc (or docs (jao-doc-session)))
- (when (and (stringp doc) (file-exists-p doc))
- (if (jao-pdf-is-pdf-file doc) (funcall jao-open-doc-fun doc) (find-file doc))
- (other-window 1)))
- (other-window 1))
-
-(defvar jao-afio-left-width nil)
-
-(defun jao-afio-open-doc ()
- (interactive)
- (delete-other-windows)
- (split-window-right jao-afio-left-width)
- (let ((docs (cl-remove-if-not 'jao-doc-session-is-doc (buffer-list))))
- (if (car docs)
- (progn (switch-to-buffer (car docs))
- (switch-to-buffer-other-window (or (cadr docs) (car docs))))
- (when-let* ((docs (jao-doc-session)))
- (when (y-or-n-p (format "Load saved session? (%d docs)" (length docs)))
- (jao-afio-open-pdf-session docs))))))
-
-(declare-function w3m "w3m")
-(declare-function notmuch "notmuch")
-(declare-function jao-eww-session-eww-buffers "jao-eww-session")
-(declare-function jao-eww-session-load "jao-eww-session")
-
-(defun jao-afio--open-eww-session ()
- (if-let* ((b (jao-eww-session-eww-buffers)))
- (switch-to-buffer (car b))
- (jao-eww-session-load)))
+(defvar jao-afio-open-doc nil)
+(defvar jao-afio-open-www nil)
+(defvar jao-afio-open-chats nil)
+(defvar jao-afio-mail-function nil)
+(defvar jao-afio-open-mail #'jao-afio-open-mail)
+(defvar jao-afio-mail-sidebar-width 60)
+(defvar jao-afio-mail-sidebar-right nil)
;;;###autoload
(defun jao-afio-org-agenda ()
@@ -154,36 +128,6 @@
(setq-local cursor-in-non-selected-windows nil
line-spacing 0.2))))
-;;;###autoload
-(defun jao-afio-open-www ()
- (interactive)
- (require 'jao-eww-session)
- (if (< (frame-width) 160)
- (if jao-afio-use-w3m (w3m) (jao-afio--open-eww-session))
- (if jao-afio-use-w3m
- (progn (delete-other-windows)
- (split-window-right)
- (w3m))
- (jao-afio-trisect)
- (jao-afio--open-eww-session)
- (let ((b (current-buffer)))
- (other-window 1)
- (switch-to-buffer (car (jao-eww-session-eww-buffers b)))
- (other-window 1)
- (switch-to-buffer (car (jao-eww-session-eww-buffers b)))
- (other-window 1)))))
-
-;;;###autoload
-(defun jao-afio-open-gnus ()
- (interactive)
- (jao-afio-org-agenda)
- (calendar)
- (find-file (expand-file-name "inbox.org" org-directory))
- (delete-other-windows)
- (gnus)
- ;; (jao-gnus--set-summary-line)
- )
-
(defun jao-afio--mail-sidebar ()
(other-window 1)
(delete-other-windows-vertically)
@@ -199,9 +143,6 @@
(set-window-dedicated-p nil t)
(other-window 1))
-(defvar jao-afio-mail-sidebar-width 60)
-(defvar jao-afio-mail-sidebar-right nil)
-
(defun jao-afio--open-mail (fun)
(unless (get-buffer "*Calendar*") (calendar))
(delete-other-windows)
@@ -219,9 +160,9 @@
;;;###autoload
(defun jao-afio-open-mail ()
(interactive)
- (cond ((eq 'gnus jao-afio-mail-function) (jao-afio-open-gnus))
- ((eq 'notmuch jao-afio-mail-function) (jao-afio--open-mail 'notmuch))
- (t (jao-afio-trisect))))
+ (if (functionp jao-afio-mail-function)
+ (jao-afio--open-mail jao-afio-mail-function)
+ (jao-afio-trisect)))
;;;###autoload
(defun jao-afio-toggle-mail-sidebar ()
@@ -235,11 +176,14 @@
(let ((c (jao-afio--current-config)))
(unless (jao-afio-restore-configuration c)
(delete-other-windows)
- (cl-case c
- (?w (jao-afio-open-www))
- (?g (jao-afio-open-mail))
- (?p (jao-afio-open-doc))
- (t (jao-afio-trisect)))
+ (let ((f (cl-case c
+ (?w jao-afio-open-www)
+ (?g jao-afio-open-mail)
+ (?p jao-afio-open-doc)
+ (?t jao-afio-open-chats))))
+ (if (functionp f)
+ (funcall f)
+ (jao-afio-trisect)))
(when jao-afio-persist-configurations (jao-afio-save-configuration)))))
;;; go to frame