summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--exwm.org23
1 files changed, 12 insertions, 11 deletions
diff --git a/exwm.org b/exwm.org
index 287cde4..d8cd0f4 100644
--- a/exwm.org
+++ b/exwm.org
@@ -290,11 +290,11 @@
#+END_SRC
* Zathura support
#+begin_src emacs-lisp
+ (defun jao-zathura--buffer-p (b)
+ (string= "Zathura" (or (buffer-local-value 'exwm-class-name b) "")))
+
(defun jao-zathura--buffers ()
- (seq-filter (lambda (b)
- (string= "Zathura"
- (or (buffer-local-value 'exwm-class-name b) "")))
- (buffer-list)))
+ (seq-filter #'jao-zathura--buffer-p (buffer-list)))
(defun jao-zathura--file-info (b)
(with-current-buffer b
@@ -396,13 +396,14 @@
(defun jao-exwm-select-pdf ()
(interactive)
- (if jao-browse-doc-use-emacs-p
- (jao-buffer-same-mode '(pdf-view-mode doc-view-mode)
- #'jao-afio--goto-docs)
- (when-let (bs (jao-zathura--buffers))
- (let ((infos (mapcar #'jao-zathura--file-info bs)))
- (when-let (f (completing-read "Document: " (mapcar #'car infos)))
- (jao-zathura-open-doc f))))))
+ (let ((b (read-buffer "Document: " nil t
+ (lambda (b)
+ (let ((b (cdr b)))
+ (or (jao-zathura--buffer-p b)
+ (member (buffer-local-value 'major-mode b)
+ '(pdf-view-mode doc-view-mode))))))))
+ (jao-afio--goto-docs)
+ (pop-to-buffer b)))
#+end_src
* Hydras