emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: "Björn Bidar" <bjorn.bidar@thaodan.de>, emacs-orgmode@gnu.org
Subject: Re: [BUG] org-link-preview-file emits image not supported in daemon [9.8-pre (release_9.7.10-127-g07dd3b @ /home/bidar/.local/etc/emacs/lib/org/lisp/)]
Date: Fri, 27 Dec 2024 19:50:51 -0800	[thread overview]
Message-ID: <87jzbkmpno.fsf@gmail.com> (raw)
In-Reply-To: <878qs159hr.fsf@localhost>

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

>>> 1. As a minimum, we can remove that message and do nothing on
>>>    non-graphical displays. It will be consistent with earlier behavior.
>>
>> I will remove that message from org-link-preview-file.
>
> +1

Patch attached.

Karthik

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ol-No-message-when-previewing-images-in-non-graphica.patch --]
[-- Type: text/x-patch, Size: 1143 bytes --]

From 621396f4b5c46f109aaec5afcb0a983153d8a60a Mon Sep 17 00:00:00 2001
From: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Date: Fri, 27 Dec 2024 19:45:01 -0800
Subject: [PATCH] ol: No message when previewing images in non-graphical
 context

* lisp/ol.el (org-link-preview-file): Don't message the user when
attempting to preview links as images in an environment that
doesn't support graphics.  This includes the case when
`org-link-preview' runs in the Emacs daemon with no frames open.
---
 lisp/ol.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/ol.el b/lisp/ol.el
index 9e2459cde..c21869fbc 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -2178,9 +2178,7 @@ (defun org-link-preview-file (ov path link)
 
 This is intended to be used as the `:preview' link property of
 file links, see `org-link-parameters'."
-  (if (not (display-graphic-p))
-      (prog1 nil
-        (message "Your Emacs does not support displaying images!"))
+  (when (display-graphic-p)
     (require 'image)
     (when-let* ((file-full (expand-file-name path))
                 (file (substitute-in-file-name file-full))
-- 
2.47.0


  reply	other threads:[~2024-12-28  3:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-02  9:02 [BUG] org-link-preview-file emits image not supported in daemon [9.8-pre (release_9.7.10-127-g07dd3b @ /home/bidar/.local/etc/emacs/lib/org/lisp/)] Björn Bidar
2024-12-03 23:42 ` Karthik Chikmagalur
2024-12-08 19:05   ` Björn Bidar
     [not found]   ` <6755ee4b.050a0220.72360.6df4SMTPIN_ADDED_BROKEN@mx.google.com>
2024-12-13  6:22     ` Karthik Chikmagalur
2024-12-13 19:36       ` Ihor Radchenko
2024-12-26 18:55         ` Karthik Chikmagalur
2024-12-27 17:19           ` Ihor Radchenko
2024-12-28  3:50             ` Karthik Chikmagalur [this message]
2024-12-28 15:06               ` 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=87jzbkmpno.fsf@gmail.com \
    --to=karthikchikmagalur@gmail.com \
    --cc=bjorn.bidar@thaodan.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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).