diff options
author | jao <jao@gnu.org> | 2022-01-24 01:02:46 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-01-24 01:02:46 +0000 |
commit | 3f1ea614b89fd763d0f8cba2f23c3eb12ba49534 (patch) | |
tree | 52517701680fe03736b4bdc838e8049280e19690 | |
parent | 993c3ace44b4dd5753133bd0571eef3327e55e58 (diff) | |
download | elibs-3f1ea614b89fd763d0f8cba2f23c3eb12ba49534.tar.gz elibs-3f1ea614b89fd763d0f8cba2f23c3eb12ba49534.tar.bz2 |
attic
-rw-r--r-- | attic/misc.org | 49 | ||||
-rw-r--r-- | email.org | 2 | ||||
-rw-r--r-- | init.org | 52 |
3 files changed, 57 insertions, 46 deletions
diff --git a/attic/misc.org b/attic/misc.org index a5bc802..b9fdbfb 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -965,3 +965,52 @@ (add-hook 'notmuch-show-hook #'jao-notmuch--show-hidden-html)) #+end_src +* snippets + #+begin_src emacs-lisp + (defun jao-minibuffer--text-with-padding (text) + "Return TEXT with padding on the left." + (let* ((len (+ (string-pixel-width text) + (string-pixel-width jao-minibuffer-right-margin) + 10)) + (padding (propertize + "-" 'display + `(space :align-to (- (+ right right-margin) (,len)))))) + (concat padding text jao-minibuffer-right-margin))) + #+end_src + + #+begin_src emacs-lisp + ;; this is an ugly hack: when jao-minibuffer is active, + ;; somehow docview scrolling is not triggering a refresh, + ;; specially for scroll down movements, so we advice the + ;; scrolling functions to force a redisplay by going to + ;; another window. + (defun jao--refresh (&rest _rest) + (let ((jao-minibuffer-mode nil)) + (other-window 1) (other-window -1))) + + (dolist (f '(image-forward-hscroll + image-backward-hscroll + image-scroll-down + image-scroll-up + image-eol + image-bol)) + (advice-add f :after #'jao--refresh)) + + ;; (dolist (f '(doc-view-scroll-up-or-next-page + ;; doc-view-scroll-down-or-previous-page + ;; doc-view-previous-line-or-previous-page + ;; doc-view-next-line-or-next-page + ;; image-forward-hscroll + ;; image-backward-hscroll + ;; image-scroll-down + ;; image-scroll-up + ;; image-eol + ;; image-bol)) + ;; (advice-add f :after #'jao--refresh)) + + ;; (dolist (f '(pdf-view-scroll-up-or-next-page + ;; pdf-view-scroll-down-or-previous-page + ;; pdf-view-previous-line-or-previous-page + ;; pdf-view-next-line-or-next-page)) + ;; (advice-add f :after #'jao--refresh)) + #+end_src @@ -83,7 +83,7 @@ (defun jao-message-insert-bcc () (let ((f (or (message-fetch-field "From") ""))) (when (or (string-blank-p f) (string-match-p jao-message--bcc-rx f)) - (insert "Bcc: trove@jao.io\n")))) + (insert "Bcc: proton@jao.io\n")))) (add-hook 'message-header-setup-hook #'jao-message-insert-bcc) @@ -1640,15 +1640,6 @@ * PDFs *** doc-view and pdf-tools #+begin_src emacs-lisp - ;; this is an ugly hack: when jao-minibuffer is active, - ;; somehow docview scrolling is not triggering a refresh, - ;; specially for scroll down movements, so we advice the - ;; scrolling functions to force a redisplay by going to - ;; another window. - (defun jao--refresh (&rest _rest) - (let ((jao-minibuffer-mode nil)) - (other-window 1) (other-window -1))) - (use-package doc-view :init (setq doc-view-cache-directory "~/.emacs.d/cache/docview" @@ -1656,42 +1647,12 @@ doc-view-continuous t doc-view-conversion-refresh-interval 1) - :config - - (dolist (f '(doc-view-scroll-up-or-next-page - doc-view-scroll-down-or-previous-page - doc-view-previous-line-or-previous-page - doc-view-next-line-or-next-page - image-forward-hscroll - image-backward-hscroll - image-scroll-down - image-scroll-up - image-eol - image-bol)) - (advice-add f :after #'jao--refresh)) - :bind (:map doc-view-mode-map ("j" . doc-view-next-line-or-next-page) ("J" . doc-view-scroll-up-or-next-page) ("k" . doc-view-previous-line-or-previous-page) ("K" . doc-view-scroll-down-or-previous-page))) - (use-package jao-doc-view - :config - (dolist (f '(image-forward-hscroll - image-backward-hscroll - image-scroll-down - image-scroll-up - image-eol - image-bol)) - (advice-add f :after #'jao--refresh)) - - :bind (:map doc-view-mode-map - ("b" . jao-doc-view-back) - ("B" . jao-doc-view-forward) - ("S" . jao-doc-view-save-session) - ("u" . jao-doc-view-visit-url))) - (use-package pdf-tools :ensure t :demand t @@ -1704,12 +1665,6 @@ :config (pdf-tools-install) - (dolist (f '(pdf-view-scroll-up-or-next-page - pdf-view-scroll-down-or-previous-page - pdf-view-previous-line-or-previous-page - pdf-view-next-line-or-next-page)) - (advice-add f :after #'jao--refresh)) - :diminish ((pdf-view-midnight-minor-mode . "")) :bind (:map pdf-view-mode-map @@ -1723,6 +1678,13 @@ :ensure t :demand t :after doc-view) + + (use-package jao-doc-view + :bind (:map doc-view-mode-map + ("b" . jao-doc-view-back) + ("B" . jao-doc-view-forward) + ("S" . jao-doc-view-save-session) + ("u" . jao-doc-view-visit-url))) #+end_src *** open pdfs #+begin_src emacs-lisp |