From: Liu Hui <liuhui1610@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]
Date: Fri, 15 Oct 2021 22:17:10 +0800 [thread overview]
Message-ID: <87h7djf2c8.fsf@gmail.com> (raw)
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/)
next reply other threads:[~2021-10-15 14:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 14:17 Liu Hui [this message]
2021-10-15 17:46 ` [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)] Bhavin Gandhi
2021-10-16 19:40 ` Timothy
2022-10-08 3:30 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7djf2c8.fsf@gmail.com \
--to=liuhui1610@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).