emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New library wallpaper.el pushed to master


From: Stefan Kangas
Subject: Re: New library wallpaper.el pushed to master
Date: Tue, 13 Sep 2022 13:09:48 -0400

Eli Zaretskii <eliz@gnu.org> writes:

> From casual reading, the code seems to be heavily biased towards the
> assumption that setting a wallpaper requires invoking an external
> program.  What about systems where this can be done by calling an API
> (i.e., via a special-purpose Emacs primitive)?  Would you please amend
> the code to make the feature more easily extended to use such methods?

I'm assuming you mean something like this

    (w32-wallpaper-set file)

?

If so, besides documentation changes, I imagine that all we would need
is something like:

diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el
index 4c90559183..acc2f11420 100644
--- a/lisp/image/wallpaper.el
+++ b/lisp/image/wallpaper.el
@@ -115,7 +115,9 @@ wallpaper-set
     (error "No such file: %s" file))
   (unless (file-readable-p file)
     (error "File is not readable: %s" file))
-  (when (display-graphic-p)
+  (cond
+   (w32-use-native-image-API (w32-wallpaper-set file))
+   ((display-graphic-p)
     (let* ((command (wallpaper--find-command))
            (fmt-spec `((?f . ,(expand-file-name file))
                        (?h . ,(display-pixel-height))
@@ -141,7 +143,7 @@ wallpaper-set
                                (string-clean-whitespace (buffer-string)))))
                 (ignore-errors
                   (kill-buffer (process-buffer process))))))
-      process)))
+      process))))

 (provide 'wallpaper)

> In addition, are you sure it is a good idea to have a defcustom whose
> value is list of lists of strings?  Users who wish to customize this
> will have hard time, unless they are very proficient ion Emacs Lisp.
> Can we come up with a defcustom that is easier to customize?

I was actually going back and forth on this.

Could we change it into a list of strings, thereby assuming that you
won't need to specify any command line arguments containing spaces?
If so, I think that would be more user friendly.

Thanks for reviewing!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]