dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 5b55738519293abc06a6e47c52fa8768893a00d9
parent d26da5aa61f0064cb28ac0943dd2fc62d8836ab6
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Sat, 27 Aug 2022 13:15:57 +0200

emacs: size inline org images based on window width

Diffstat:
Memacs/config.org | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/emacs/config.org b/emacs/config.org @@ -1269,6 +1269,19 @@ Install Org and require additional components that I use. ;; Realign tags (org-set-tags-command '(4))) + (defcustom za/org-inline-images-desired-screen-proportion (/ (float 3) 4) + "Percentage of the window (as a float) that Org inline images should take up." + :type 'float) + + (defun za/org-display-inline-images-set-width (&rest _) + "Set `org-image-actual-width` dynamically before displaying images." + (if (window-system) + (let* ((total-width (window-pixel-width)) + (image-width (round (* total-width za/org-inline-images-desired-screen-proportion)))) + (setq-local org-image-actual-width image-width)))) + + (advice-add 'org-display-inline-images :before #'za/org-display-inline-images-set-width) + (require 'org-tempo) (require 'org-habit) (require 'org-id)