summaryrefslogtreecommitdiffhomepage
path: root/attic
diff options
context:
space:
mode:
Diffstat (limited to 'attic')
-rw-r--r--attic/misc.org49
1 files changed, 49 insertions, 0 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