* [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)]
@ 2024-07-26 17:52 Sean Devlin
2024-07-29 19:41 ` Sean Devlin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sean Devlin @ 2024-07-26 17:52 UTC (permalink / raw)
To: emacs-orgmode
Hi folks,
I've found a case where an inline image's maximum width is computed
incorrectly in Org 9.7.8. Here's a recipe:
1. Find an image wider than a default Emacs frame
2. Create an Org file with these contents (between the lines):
==================================================
[[file:/path/to/wide/image.png]]
* heading 1
[[file:/path/to/wide/image.png]]
** heading 2
[[file:/path/to/wide/image.png]]
*** heading 3
[[file:/path/to/wide/image.png]]
==================================================
3. emacs -Q
4. Evaluate these forms:
(add-to-list 'load-path "/path/to/org-9.7.8/")
(require 'org)
(setq org-image-max-width 'window)
(setq org-startup-indented t)
5. Open the file from step 2
6. C-c C-x C-v to toggle inline image display
Observe that the images are cropped on the right in the amount of the
leading indentation added by org-indent-mode. If you scroll down, you
should see each successive image has a bit more cut off. (The first
image is displayed correctly, since it is not under a heading and has no
indentation.)
Thanks!
Emacs : GNU Emacs 29.4 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6.6 (Build 21G646))
of 2024-07-24
Package: Org mode version 9.7.8 (9.7.8-7f2ce8 @ /path/to/org-9.7.8/)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)]
2024-07-26 17:52 [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)] Sean Devlin
@ 2024-07-29 19:41 ` Sean Devlin
2024-08-01 18:47 ` Martin Edström
2024-08-04 18:40 ` Ihor Radchenko
2 siblings, 0 replies; 4+ messages in thread
From: Sean Devlin @ 2024-07-29 19:41 UTC (permalink / raw)
To: emacs-orgmode
Hi folks,
I've found a case where an inline image's maximum width is computed
incorrectly in Org 9.7.8. Here's a recipe:
1. Find an image wider than a default Emacs frame
2. Create an Org file with these contents (between the lines):
==================================================
[[file:/path/to/wide/image.png]]
* heading 1
[[file:/path/to/wide/image.png]]
** heading 2
[[file:/path/to/wide/image.png]]
*** heading 3
[[file:/path/to/wide/image.png]]
==================================================
3. emacs -Q
4. Evaluate these forms:
(add-to-list 'load-path "/path/to/org-9.7.8/")
(require 'org)
(setq org-image-max-width 'window)
(setq org-startup-indented t)
5. Open the file from step 2
6. C-c C-x C-v to toggle inline image display
Observe that the images are cropped on the right in the amount of the
leading indentation added by org-indent-mode. If you scroll down, you
should see each successive image has a bit more cut off. (The first
image is displayed correctly, since it is not under a heading and has no
indentation.)
Thanks!
Emacs : GNU Emacs 29.4 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6.6 (Build 21G646))
of 2024-07-24
Package: Org mode version 9.7.8 (9.7.8-7f2ce8 @ /path/to/org-9.7.8/)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)]
2024-07-26 17:52 [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)] Sean Devlin
2024-07-29 19:41 ` Sean Devlin
@ 2024-08-01 18:47 ` Martin Edström
2024-08-04 18:40 ` Ihor Radchenko
2 siblings, 0 replies; 4+ messages in thread
From: Martin Edström @ 2024-08-01 18:47 UTC (permalink / raw)
To: Sean Devlin; +Cc: emacs-orgmode
To my untrained eye, this bug seems like it must have the same cause as this other bug: https://lists.gnu.org/archive/html/emacs-orgmode/2024-07/msg00365.html
What I find surprising is how it hasn't been dealt with in 16 years. Perhaps it used to work correctly and only recently broke?
I'm reading the org-indent source code, and it seems to use the Emacs built-in text properties "line-prefix" and "wrap-prefix". So these could be considered Emacs bugs rather than Org bugs, possibly.
Martin Edstrom
On Fri, 26 Jul 2024 13:52:50 -0400, Sean Devlin <spd@toadstyle.org> wrote:
> Hi folks,
>
> I've found a case where an inline image's maximum width is computed
> incorrectly in Org 9.7.8. Here's a recipe:
>
> 1. Find an image wider than a default Emacs frame
> 2. Create an Org file with these contents (between the lines):
>
> ==================================================
> [[file:/path/to/wide/image.png]]
>
> * heading 1
>
> [[file:/path/to/wide/image.png]]
>
> ** heading 2
>
> [[file:/path/to/wide/image.png]]
>
> *** heading 3
>
> [[file:/path/to/wide/image.png]]
> ==================================================
>
> 3. emacs -Q
> 4. Evaluate these forms:
>
> (add-to-list 'load-path "/path/to/org-9.7.8/")
> (require 'org)
> (setq org-image-max-width 'window)
> (setq org-startup-indented t)
>
> 5. Open the file from step 2
> 6. C-c C-x C-v to toggle inline image display
>
> Observe that the images are cropped on the right in the amount of the
> leading indentation added by org-indent-mode. If you scroll down, you
> should see each successive image has a bit more cut off. (The first
> image is displayed correctly, since it is not under a heading and has no
> indentation.)
>
> Thanks!
>
> Emacs : GNU Emacs 29.4 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.60 Version 12.6.6 (Build 21G646))
> of 2024-07-24
> Package: Org mode version 9.7.8 (9.7.8-7f2ce8 @ /path/to/org-9.7.8/)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)]
2024-07-26 17:52 [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)] Sean Devlin
2024-07-29 19:41 ` Sean Devlin
2024-08-01 18:47 ` Martin Edström
@ 2024-08-04 18:40 ` Ihor Radchenko
2 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-08-04 18:40 UTC (permalink / raw)
To: Sean Devlin; +Cc: emacs-orgmode
Sean Devlin <spd@toadstyle.org> writes:
> I've found a case where an inline image's maximum width is computed
> incorrectly in Org 9.7.8. Here's a recipe:
>
> 1. Find an image wider than a default Emacs frame
> 2. Create an Org file with these contents (between the lines):
> ...
> (add-to-list 'load-path "/path/to/org-9.7.8/")
> (require 'org)
> (setq org-image-max-width 'window)
> (setq org-startup-indented t)
>
> 5. Open the file from step 2
> 6. C-c C-x C-v to toggle inline image display
>
> Observe that the images are cropped on the right in the amount of the
> leading indentation added by org-indent-mode. If you scroll down, you
> should see each successive image has a bit more cut off. (The first
> image is displayed correctly, since it is not under a heading and has no
> indentation.)
Well. This is not a bug - the image width is still equal to window
width. It is just that the image is shifted right.
I assume that you expect the image width to be adjusted to indentation
(dynamically?). However, I am not sure if it is such a good idea - what
if indentation is too deep inside? Also, this width is not dynamically
adjusted - it is computed once when you trigger image display, even for
images outside the screen. Considering that org-indent is applying
indentation lazily, only for the visible parts of the buffer,
indentation for some images may simply be not known at the point when
you ask Org to display them.
So, what you probably want is some kind of new feature to compute image
widths dynamically - I will not oppose such a feature, but it does not
yet exist. Patches welcome!
Not a bug.
Canceled. (but we can continue discussion of the feature request)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-04 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 17:52 [BUG] Org-image-max-width doesn't account for org-indent-mode [9.7.8 (9.7.8-7f2ce8 @ /tmp/bug/elpa/org-9.7.8/)] Sean Devlin
2024-07-29 19:41 ` Sean Devlin
2024-08-01 18:47 ` Martin Edström
2024-08-04 18:40 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.