emacs-orgmode@gnu.org archives
 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

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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).