Ihor Radchenko writes: > "Christopher M. Miles" writes: > >> Ihor Radchenko writes: >> >>> "Christopher M. Miles" writes: >>> >>>>> When I put it on beginning of org document, then preview inline images, but those global attributes >>>>> not affected. The inline images still display in actual image size. I want to specify image size >>>>> under headline properties. Is it possible to do this? >>>> >>>> I implemented this feature by written a hook. Hope this can be helpful >>>> for someone who also has this needs. Here is the code: >>> >>> This looks useful. >>> Would you be interested to write a patch? >> >> The is the new patch which updated the defcustom variable docstring has correct description. > > Thanks for the patch! > Before extending org-cycle functionality, let's first try to sort out > subtree-level setting of the image size. This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. I submitted two separated patches. > > In the patch, you are suggesting to use INLINE-IMAGE-WIDTH property. > However, if we apply the patch as is, this property will only be useful > when calling a single function - > `org-display-subtree-with-inline-images'. > It is not ideal. The patch's purpose is auto display inline images when [TAB] (~org-cycle~) expanding heading or subtrees. Not for global ~org-toggle-inline-images~. Also, introduce a new extra argument "~state~" for ~org-display-inline-images~ like bellowing is not ideal. I think should separate the ~org-cycle~ logic instead of put in ~org-display-inline-images~. In global scope, ~org-toggle-inline-images~ already respect the updated function ~org-display-inline-image--width~, it should respect the subtree property width. #+begin_src emacs-lisp ;; V ;; ----- (defun org-display-inline-images (&optional state include-linked refresh beg end) ...) #+end_src *NOTE*: Because ~org-cycle-hook~ will pass a ~state~ variable to hook function. > > If we introduce subtree-level setting for inline image size, it should > also work when displaying inline images by other existing means > (org-toggle-inline-images). This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. > > Instead of working around the existing code of > `org-display-inline-images' and setting a custom > `org-image-actual-width' variable in buffer, it is much better to change > `org-display-inline-images' directly. At the end, the patch is not bound > to your personal config - feel free to alter the existing Org functions. This is implemented by retrieve subtree-level property value in function ~~org-display-inline-image--width~~. > > Similarly, you do not need to do > (add-to-list 'org-default-properties "INLINE-IMAGE-WIDTH") > Simply change the default value of `org-default-properties'. Updated > > Finally, it will be more consistent to name the property closer to the > variable name: ORG-IMAGE-ACTUAL-WIDTH. Updated