From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Björn Bidar" <bjorn.bidar@thaodan.de>
Cc: 74781@debbugs.gnu.org, rpluim@gmail.com
Subject: bug#74781: [PATCH] Add `browse-url-qutebrowser'
Date: Wed, 11 Dec 2024 15:38:13 +0100 [thread overview]
Message-ID: <877c86wai2.fsf@daniel-mendler.de> (raw)
In-Reply-To: <87r06etigv.fsf@thaodan.de> ("Björn Bidar"'s message of "Wed, 11 Dec 2024 16:14:24 +0200")
Björn Bidar <bjorn.bidar@thaodan.de> writes:
> Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Robert Pluim <rpluim@gmail.com> writes:
>>
>>>>>>>> On Wed, 11 Dec 2024 10:07:08 +0100, Daniel Mendler <mail@daniel-mendler.de> said:
>>> The emacs help system applies heuristics which are not always
>>> accurate, and donʼt always return an answer, hence the version tags.
>>
>> Thanks, I added the version tags. See the updated patch.
>>
>>> >> We have `xdg-runtime-dir' in xdg.el
>>>
>>> Daniel> The goal was to avoid loading `xdg.el' unnecessarily for this trivial
>>> Daniel> function, which is just a wrapper around `getenv'. Do you suggest to use
>>> Daniel> `declare-function' and require xdg inside `browse-url-qutebrowser-send'?
>>>
>>> That would work.
>>
>> I would be pragmatic and keep the (getenv "XDG_RUNTIME_DIR"), instead
>> of replacing it by this:
>>
>> (declare-function xdg-runtime-dir "xdg")
>> (require 'xdg)
>
> These are only required because you load a new dependency.
> Further these functions can take care of later eventualities if needed,
> e.g. such as handling when a xdg variable isn't set.
> Also using these functions makes the code easier to read as you can
> follow the code down further to the documentation.
The entire function looks like this:
(defun xdg-runtime-dir ()
(getenv "XDG_RUNTIME_DIR"))
No eventualities are handled there right now, so it does not seem
justified to load xdg.el only for this small wrapper. Note that
`browse-url' contains other platform-specific code, including
xdg-related code, without loading xdg.el - all the code around
`browse-url-xdg-open'.
See also the files files.el, server.el, startup.el and mpc.el, which all
access XDG_* environment variables via `getenv' without requiring
xdg.el. The `getenv' function calls are certainly not less readable than
`xdg-runtime-dir'.
That being said, I would not mind if there was a (require 'xdg) at the
top of the browse-url.el file, if that's considered acceptable, even on
systems which do not conform to xdg. For example xdg.el is also required
unconditionally by eww.el and xdg is a fairly small library. Then using
`xdg-runtime-dir' would be the better solution of course.
Daniel
next prev parent reply other threads:[~2024-12-11 14:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 7:04 bug#74781: [PATCH] Add `browse-url-qutebrowser' Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 8:27 ` Robert Pluim
2024-12-11 9:07 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 9:58 ` Robert Pluim
2024-12-11 10:45 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 14:14 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 14:38 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-11 16:16 ` Eli Zaretskii
2024-12-11 15:32 ` Eli Zaretskii
2024-12-11 15:36 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 14:40 ` Eli Zaretskii
2024-12-11 15:12 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 15:44 ` Robert Pluim
2024-12-11 15:54 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 16:54 ` Eli Zaretskii
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877c86wai2.fsf@daniel-mendler.de \
--to=bug-gnu-emacs@gnu.org \
--cc=74781@debbugs.gnu.org \
--cc=bjorn.bidar@thaodan.de \
--cc=mail@daniel-mendler.de \
--cc=rpluim@gmail.com \
/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.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).