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/)
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
[-- 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
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.