unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Automatically set eww-download-directory according xdg dir
@ 2018-10-29 19:54 Garreau, Alexandre
  2018-10-29 20:08 ` `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir] Garreau, Alexandre
  2018-10-30  2:25 ` Automatically set eww-download-directory according xdg dir Basil L. Contovounesios
  0 siblings, 2 replies; 22+ messages in thread
From: Garreau, Alexandre @ 2018-10-29 19:54 UTC (permalink / raw)
  To: emacs-devel

I guess this is the right place to ask about Eww.

Currently `eww-download-directory' is unconditionally set to
“~/Downloads”, which, I guess, is the default download directory most
desktop and file-managers will create and read when the installation is
set up in english.  But XDG (and most systems nowadays, except Mac OS X
if I’m right, which translate directory names in applications display
iirc) tends to localize directories in the user language set up at
installation.  So, after installation, by default, my directory was
“~/Téléchargements/”, except then, I tweaked “~/.config/user-dirs.dirs”,
so now I have short dir names in my home, like “~/dl/”.  Instead of
reading (or rather, sourcing it from bashrc then using the env var… but
on my system by default this isn’t done so it won’t work in most configs
I guess) that last config file, I guess the canonical way to get the
appropriate XDG directories is first to call the “xdg-user-dir” command,
like this:

#+BEGIN_SRC emacs-lisp
  (defcustom eww-download-directory
    (substring
     (with-temp-buffer
       (call-process "xdg-user-dir" nil t nil "DOWNLOAD")
       (buffer-string))
     0 -1)
    "Directory where files will downloaded."
    :version "24.4"
    :group 'eww
    :type 'string)
#+END_SRC

I am not sure this is the simplest way to call a process and get its
output as string, without using the shell (there seem to be a
shell-command-to-string, but no call-process-to-string, writing another
mail about this).

May I suggest to change Eww so it acts according XDG?

Or should, instead, a xdg.el file be created where to put variables (or
functions) referring to correct (and up-to-date) names of XDG variables:
desktop, download, templates, publicshare, documents, music, pictures,
and videos, and maybe “xdg-settings get default-url-scheme-handler”.
Maybe among other xdg stuff, such as localization language, or… dunno
yet, but there must be things to get.



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

end of thread, other threads:[~2018-11-01 18:54 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-29 19:54 Automatically set eww-download-directory according xdg dir Garreau, Alexandre
2018-10-29 20:08 ` `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir] Garreau, Alexandre
2018-10-29 20:37   ` `with-temp-buffer', `with-output-to-string': `with-temp-buffer-to-string' / `with-current-buffer-to-string' [Was: Re: `call-process', to a string] Garreau, Alexandre
2018-10-30  2:26     ` Basil L. Contovounesios
2018-10-30  2:25   ` `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir] Basil L. Contovounesios
2018-10-30  3:59     ` `call-process', to a string Garreau, Alexandre
2018-10-30  7:19     ` `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir] Eli Zaretskii
2018-10-30 10:21       ` `call-process', to a string Garreau, Alexandre
2018-10-30 11:10         ` Eli Zaretskii
2018-10-30 11:32           ` Garreau, Alexandre
2018-10-30 12:32             ` Eli Zaretskii
2018-10-30 13:46               ` Garreau, Alexandre
2018-10-31 12:44       ` `call-process', to a string [Was: Re: Automatically set eww-download-directory according xdg dir] Basil L. Contovounesios
2018-10-30  6:57   ` Eli Zaretskii
2018-10-30  2:25 ` Automatically set eww-download-directory according xdg dir Basil L. Contovounesios
2018-10-30  3:57   ` xdg.el and eww custom load [Was: Re: Automatically set eww-download-directory according xdg dir] Garreau, Alexandre
2018-10-31 12:41     ` Basil L. Contovounesios
2018-10-31 22:52       ` Garreau, Alexandre
2018-11-01 14:29         ` Basil L. Contovounesios
2018-11-01 14:56           ` xdg.el and eww custom load Garreau, Alexandre
2018-11-01 18:54             ` Basil L. Contovounesios
2018-10-30  7:16   ` Automatically set eww-download-directory according xdg dir Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).