summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-07-05 00:35:06 +0100
committerjao <jao@gnu.org>2021-07-05 00:35:06 +0100
commit5bfb044219160f0ac6520d2c88d9f0949d4e3aa8 (patch)
treef5366983195a733fd7ca631b76b2aaaba119deae
parent666d7d94655a3b9151504b9550411feb845c7b96 (diff)
downloadelibs-5bfb044219160f0ac6520d2c88d9f0949d4e3aa8.tar.gz
elibs-5bfb044219160f0ac6520d2c88d9f0949d4e3aa8.tar.bz2
navigating zathura and pdf buffers together
-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