From 3f1ea614b89fd763d0f8cba2f23c3eb12ba49534 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 24 Jan 2022 01:02:46 +0000 Subject: attic --- attic/misc.org | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'attic/misc.org') 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 -- cgit v1.2.3