From 536bfb591b5302c624f65fc524591a5625d33623 Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 20 May 2022 23:16:49 +0100 Subject: wee refactoring --- exwm.org | 2 +- init.org | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/exwm.org b/exwm.org index e6e5c94..b74fce8 100644 --- a/exwm.org +++ b/exwm.org @@ -403,7 +403,7 @@ (interactive) (define-key org-mode-map (kbd "C-c o") #'jao-org-org-goto-pdf) (remove-hook 'kill-emacs-query-functions #'jao-exwm-pdf-zathura-close-all) - (setq jao-org-open-pdf-fun #'jao-afio-open-pdf) + (setq jao-org-open-pdf-fun #'jao-find-or-open) (setq jao-org-links-pdf-store-fun nil) (setq jao-open-doc-fun #'jao-find-or-open)) diff --git a/init.org b/init.org index 84df426..e3119d7 100644 --- a/init.org +++ b/init.org @@ -1796,7 +1796,7 @@ (defun jao-rss--feeds-dirs () (mapcar (lambda (d) (cadr (split-string d "\\."))) - (directory-files (jao-gnus-dir "Mail/") nil "^feeds"))) + (directory-files "~/.emacs.d/gnus/Mail/" nil "^feeds"))) (defun jao-rss-subscribe (url) "Subscribe to a given RSS URL. If URL not given, look for it." @@ -1883,8 +1883,11 @@ (string-to-number (match-string 4 title)) (match-string 2 title)))) - (defun jao-zathura-goto-org (title) - (when-let* ((info (jao-zathura-file-info title)) + (defun jao-zathura-goto-org (&optional title) + (when-let* ((title (or title (jao-shell-string "xdotool" + "getactivewindow" + "getwindowname"))) + (info (jao-zathura-file-info title)) (file (jao-org-pdf-to-org-file (car info))) (page (cadr info)) (pageno (or (car (last info)) page))) @@ -1917,6 +1920,7 @@ :after doc-view) (setq jao-open-doc-fun 'jao-find-or-open) + (setq jao-org-open-pdf-fun 'jao-find-or-open) (defun jao-find-or-open (file &optional page height) (if (and jao-browse-doc-use-emacs-p window-system) @@ -1927,7 +1931,8 @@ (throw 'done (car buffs))) (setq buffs (cdr buffs)))))) (jao-afio--goto-docs) - (if b (pop-to-buffer b) (find-file file))) + (if b (pop-to-buffer b) (find-file file)) + (when page (jao-doc-view-goto-page page height))) (jao-zathura-open file page))) (defun jao-open-doc (&optional file page height) @@ -1937,12 +1942,6 @@ (concat jao-org-dir "/doc/")))) (funcall jao-open-doc-fun file page height))) - (defun jao-afio-open-pdf (file page &optional height) - (jao-open-doc file page height) - (when page (jao-doc-view-goto-page page height))) - - (setq jao-org-open-pdf-fun #'jao-afio-open-pdf) - (defun jao-select-pdf () (interactive) (jao-buffer-same-mode '(pdf-view-mode doc-view-mode) -- cgit v1.2.3