emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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/)]
@ 2024-12-02  9:02 Björn Bidar
  2024-12-03 23:42 ` Karthik Chikmagalur
  0 siblings, 1 reply; 8+ messages in thread
From: Björn Bidar @ 2024-12-02  9:02 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

org-link-preview-file emits "Your Emacs does not support displaying images! "
when restoring buffers with desktop when Emacs was started as daemon.

Steps to reproduce.
1. Start Emacs with --daemon or --fg-daemon
2. Enable desktop
3. Have org-mode buffers containing image previews
4. Restart Emacs
5. Error.

The message false or at least confusing.


Emacs  : GNU Emacs 31.0.50 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2)
Package: Org mode version 9.8-pre (release_9.7.10-127-g07dd3b @ /home/bidar/.local/etc/emacs/lib/org/lisp/)


Regards,

Björn


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

* 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/)]
  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>
  0 siblings, 2 replies; 8+ messages in thread
From: Karthik Chikmagalur @ 2024-12-03 23:42 UTC (permalink / raw)
  To: Björn Bidar, emacs-orgmode

Thanks for the bug report.

> org-link-preview-file emits "Your Emacs does not support displaying images! "
> when restoring buffers with desktop when Emacs was started as daemon.

Just checking, do you have

#+startup: imagepreviews

or

#+startup: linkpreviews

in these files?  Or do you call `org-link-preview' or
`org-toggle-inline-images' manually?

Karthik


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

* 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/)]
  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>
  1 sibling, 0 replies; 8+ messages in thread
From: Björn Bidar @ 2024-12-08 19:05 UTC (permalink / raw)
  To: Karthik Chikmagalur; +Cc: emacs-orgmode

Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:

> Thanks for the bug report.
>
>> org-link-preview-file emits "Your Emacs does not support displaying images! "
>> when restoring buffers with desktop when Emacs was started as daemon.
>
> Just checking, do you have
>
> #+startup: imagepreviews
>
> or
>
> in these files?  Or do you call `org-link-preview' or
> `org-toggle-inline-images' manually?

I have this in my init.el:
;; Show inline images by default
(setopt org-startup-with-inline-images t)


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

* 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/)]
       [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
  0 siblings, 1 reply; 8+ messages in thread
From: Karthik Chikmagalur @ 2024-12-13  6:22 UTC (permalink / raw)
  To: Björn Bidar; +Cc: emacs-orgmode

>>> org-link-preview-file emits "Your Emacs does not support displaying images! "
>>> when restoring buffers with desktop when Emacs was started as daemon.
>>
>> Just checking, do you have
>>
>> #+startup: imagepreviews
>
> I have this in my init.el:
> ;; Show inline images by default
> (setopt org-startup-with-inline-images t)

Ihor, what would be the best way of handling this?  We can add a
`display-graphic-p' test when running the inline-images part of
org-startup, but then link previews that are not images won't be applied
either.

Karthik


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

* 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/)]
  2024-12-13  6:22     ` Karthik Chikmagalur
@ 2024-12-13 19:36       ` Ihor Radchenko
  2024-12-26 18:55         ` Karthik Chikmagalur
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-12-13 19:36 UTC (permalink / raw)
  To: Karthik Chikmagalur; +Cc: Björn Bidar, emacs-orgmode

Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:

> Ihor, what would be the best way of handling this?  We can add a
> `display-graphic-p' test when running the inline-images part of
> org-startup, but then link previews that are not images won't be applied
> either.

1. As a minimum, we can remove that message and do nothing on
   non-graphical displays. It will be consistent with earlier behavior.

2. Maybe we can move the check about graphics to the specific preview
   functions.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


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

* 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/)]
  2024-12-13 19:36       ` Ihor Radchenko
@ 2024-12-26 18:55         ` Karthik Chikmagalur
  2024-12-27 17:19           ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Karthik Chikmagalur @ 2024-12-26 18:55 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Björn Bidar, emacs-orgmode

>> Ihor, what would be the best way of handling this?  We can add a
>> `display-graphic-p' test when running the inline-images part of
>> org-startup, but then link previews that are not images won't be applied
>> either.
>
> 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.

> 2. Maybe we can move the check about graphics to the specific preview
>    functions.

What do you mean by 2?  The check about graphics is already a part of
org-link-preview-file, which is a specific preview function.

Karthik


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

* 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/)]
  2024-12-26 18:55         ` Karthik Chikmagalur
@ 2024-12-27 17:19           ` Ihor Radchenko
  2024-12-28  3:50             ` Karthik Chikmagalur
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2024-12-27 17:19 UTC (permalink / raw)
  To: Karthik Chikmagalur; +Cc: Björn Bidar, emacs-orgmode

Karthik Chikmagalur <karthikchikmagalur@gmail.com> writes:

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

>> 2. Maybe we can move the check about graphics to the specific preview
>>    functions.
>
> What do you mean by 2?  The check about graphics is already a part of
> org-link-preview-file, which is a specific preview function.

Right. No idea why I wrote that.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>


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

* 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/)]
  2024-12-27 17:19           ` Ihor Radchenko
@ 2024-12-28  3:50             ` Karthik Chikmagalur
  0 siblings, 0 replies; 8+ messages in thread
From: Karthik Chikmagalur @ 2024-12-28  3:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Björn Bidar, emacs-orgmode

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


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

end of thread, other threads:[~2024-12-28  3:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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