all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]
@ 2021-10-15 14:17 Liu Hui
  2021-10-15 17:46 ` Bhavin Gandhi
  0 siblings, 1 reply; 4+ messages in thread
From: Liu Hui @ 2021-10-15 14:17 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Org mode cannot display inline images because of an error caused by
org-display-inline-image--width. It seems display-line-numbers-width
is regarded as a number unconditionally.

Recipe:

1. emacs -Q

2. Make the following settings:

   (setq org-image-actual-width nil)
   (setq org-startup-with-inline-images t)

3. Open some org-mode file containing image links, e.g.

   #+attr_org: :width 50%
   [[file:~/test.jpg]]


Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  -(80 nil)
  (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width))
  (/ (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width)) (float (window-total-width)))
  (* width (window-pixel-width) (/ (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width)) (float (window-total-width))))
  (round (* width (window-pixel-width) (/ (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width)) (float (window-total-width)))))
  (if (and (floatp width) (<= 0.0 width 2.0)) (round (* width (window-pixel-width) (/ (or (and (and (boundp ...) visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width)) (float (window-total-width))))) width)
  (let* ((case-fold-search t) (par (org-element-lineage link '(paragraph))) (attr-re "^[ \11]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") (par-end (org-element-property :post-affiliated par)) (attr-width (if (and par (let ((--mpom ...)) (save-excursion (if ... ...) (save-excursion ...)))) (progn (match-string 1)))) (attr-width-val (cond ((null attr-width) nil) ((string-match-p "\\`[0-9.]+%" attr-width) (/ (string-to-number attr-width) 100.0)) (t (string-to-number attr-width)))) (width (or attr-width-val (car org-image-actual-width)))) (if (and (floatp width) (<= 0.0 width 2.0)) (round (* width (window-pixel-width) (/ (or (and (and ... visual-fill-column-mode) (or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn fill-column)) (- (window-text-width) display-line-numbers-width)) (float (window-total-width))))) width))
  (cond ((eq org-image-actual-width t) nil) ((listp org-image-actual-width) (let* ((case-fold-search t) (par (org-element-lineage link '(paragraph))) (attr-re "^[ \11]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") (par-end (org-element-property :post-affiliated par)) (attr-width (if (and par (let ... ...)) (progn (match-string 1)))) (attr-width-val (cond ((null attr-width) nil) ((string-match-p "\\`[0-9.]+%" attr-width) (/ ... 100.0)) (t (string-to-number attr-width)))) (width (or attr-width-val (car org-image-actual-width)))) (if (and (floatp width) (<= 0.0 width 2.0)) (round (* width (window-pixel-width) (/ (or ... ... ...) (float ...)))) width))) ((numberp org-image-actual-width) org-image-actual-width) (t nil))
  org-display-inline-image--width((link (:type "file" :path "~/test.jpg" :format bracket :raw-link "file:~/test.jpg" :application nil :search-option nil :begin 25 :end 51 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 2 :end 52 :contents-begin 25 :contents-end 52 :post-blank 0 :post-affiliated 25 :attr_org (":width 50%") :parent nil)))))


Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2021-09-22
Package: Org mode version 9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]
  2021-10-15 14:17 [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)] Liu Hui
@ 2021-10-15 17:46 ` Bhavin Gandhi
  2021-10-16 19:40   ` Timothy
  2022-10-08  3:30   ` Ihor Radchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Bhavin Gandhi @ 2021-10-15 17:46 UTC (permalink / raw)
  To: Liu Hui; +Cc: emacs-orgmode, tecosaur

Hello Liu,

On Fri, 15 Oct 2021 at 19:49, Liu Hui <liuhui1610@gmail.com> wrote:
>
> Org mode cannot display inline images because of an error caused by
> org-display-inline-image--width. It seems display-line-numbers-width
> is regarded as a number unconditionally.
>
> Recipe:
>
> 1. emacs -Q
>
> 2. Make the following settings:
>
>    (setq org-image-actual-width nil)
>    (setq org-startup-with-inline-images t)
>
> 3. Open some org-mode file containing image links, e.g.
>
>    #+attr_org: :width 50%
>    [[file:~/test.jpg]]

Confirmed

I was able to reproduce this with the latest main branch. It works fine with
attributes like this:

#+attr_org: :width 500px

And the 9.5 tag does not have this bug, so I think this might be related to
recent changes to image width. Adding Timothy to CC who worked on those
changes.

-- 
Regards,
Bhavin Gandhi (bhavin192) | https://geeksocket.in


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]
  2021-10-15 17:46 ` Bhavin Gandhi
@ 2021-10-16 19:40   ` Timothy
  2022-10-08  3:30   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Timothy @ 2021-10-16 19:40 UTC (permalink / raw)
  To: Bhavin Gandhi; +Cc: Liu Hui, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

Hi Bhavin,

> Confirmed
>
> I was able to reproduce this with the latest main branch. It works fine with
> attributes like this:
>
> #+attr_org: :width 500px
>
> And the 9.5 tag does not have this bug, so I think this might be related to
> recent changes to image width. Adding Timothy to CC who worked on those
> changes.

Thanks for confirming and the CC, hopefully it’s not what I did 😅, but that’s
what the bugfix branch is for. I’ll try to have a look within the next week or so,
but I’m unfortunately busy over the next ~month so I can’t make any grantees.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]
  2021-10-15 17:46 ` Bhavin Gandhi
  2021-10-16 19:40   ` Timothy
@ 2022-10-08  3:30   ` Ihor Radchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-10-08  3:30 UTC (permalink / raw)
  To: Bhavin Gandhi; +Cc: Liu Hui, emacs-orgmode, tecosaur

Bhavin Gandhi <bhavin7392@gmail.com> writes:

>> Recipe:
>>
>> 1. emacs -Q
>>
>> 2. Make the following settings:
>>
>>    (setq org-image-actual-width nil)
>>    (setq org-startup-with-inline-images t)
>>
>> 3. Open some org-mode file containing image links, e.g.
>>
>>    #+attr_org: :width 50%
>>    [[file:~/test.jpg]]
>
> Confirmed

I cannot reproduce this on the latest main.
Closing.

Please let me know if the bug still persists on your side. 

-- 
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>

Fixed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-08  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-15 14:17 [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)] Liu Hui
2021-10-15 17:46 ` Bhavin Gandhi
2021-10-16 19:40   ` Timothy
2022-10-08  3:30   ` 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.