From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74781: [PATCH] Add `browse-url-qutebrowser' Date: Wed, 11 Dec 2024 15:38:13 +0100 Message-ID: <877c86wai2.fsf@daniel-mendler.de> References: <87msh21z0i.fsf@daniel-mendler.de> <87ed2e8vzv.fsf@gmail.com> <87jzc61tc3.fsf@daniel-mendler.de> <87a5d28rsp.fsf@gmail.com> <87a5d2wl9p.fsf@daniel-mendler.de> <87r06etigv.fsf@thaodan.de> Reply-To: Daniel Mendler Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3771"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74781@debbugs.gnu.org, rpluim@gmail.com To: =?UTF-8?Q?Bj=C3=B6rn?= Bidar Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 11 15:39:27 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tLNs5-0000np-Bp for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 11 Dec 2024 15:39:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLNrk-0004m7-Ia; Wed, 11 Dec 2024 09:39:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLNri-0004lw-Tv for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 09:39:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLNri-0002xC-Lw for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 09:39:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=biZQNHwqZnsMdzzsHq3nWrOI2sZ2Eue76vpOjqmSsu0=; b=OJcq29HiuQk/8Wuo/Tv11QE1OuUmLutOw4gySltj3jOiX1XRpS0OB14GrT12QbgdCCF7cfMSrMujYw2L0jm3R+jos8fzcEka4jPMUvIoIDUM+m9sFsUgUlc+2ulERtuAYyEYduCz/hMPIjTC0I95Nz2QGHjJCMeqLZMWfpILXPv7ApipqXO1Hl2LWPg7/6RyaecdB2/Ex2seYzG/vOUnNTUvmFVvue6Z/XwNtXzJSCVne3vmKyAYDIEm3CCZmzEBpYmRGFyYjU+X089mSRiQn1lH+eJgFnUD1EQNEf+HrAeZIiJ3ziM4QgYL0DDUKTteBiZrgFzUPW3kTrtzUvj86w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tLNri-0003dE-Do for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 09:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 11 Dec 2024 14:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74781 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-Cc: 74781@debbugs.gnu.org, "Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors" , Robert Pluim Original-Received: via spool by 74781-submit@debbugs.gnu.org id=B74781.173392790913850 (code B ref 74781); Wed, 11 Dec 2024 14:39:02 +0000 Original-Received: (at 74781) by debbugs.gnu.org; 11 Dec 2024 14:38:29 +0000 Original-Received: from localhost ([127.0.0.1]:33689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLNrA-0003bD-7K for submit@debbugs.gnu.org; Wed, 11 Dec 2024 09:38:29 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:39823 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLNr7-0003aq-Hq for 74781@debbugs.gnu.org; Wed, 11 Dec 2024 09:38:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=biZQNHwqZnsMdzzsHq3nWrOI2sZ2Eue76vpOjqmSsu0=; b=jwuee+plN2dwzPaAJylH9KVBYu 1L7Fbuj+avU2kH+35TxcOXURVgGX2CorONkxFbbCfPIk8qZm+VyGbeCFYknqczRePHEW5IVXXdygl NU1bRoNOSWPYwx7vwd6Yy9RAfHqlKOK1kHQsddFq5LDTNIGCNcZDTGs1arHVc3jhQ1rM=; In-Reply-To: <87r06etigv.fsf@thaodan.de> ("=?UTF-8?Q?Bj=C3=B6rn?= Bidar"'s message of "Wed, 11 Dec 2024 16:14:24 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296830 Archived-At: Bj=C3=B6rn Bidar writes: > Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > >> Robert Pluim writes: >> >>>>>>>> On Wed, 11 Dec 2024 10:07:08 +0100, Daniel Mendler said: >>> The emacs help system applies heuristics which are not always >>> accurate, and don=CA=BCt always return an answer, hence the version tag= s. >> >> 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 th= is trivial >>> Daniel> function, which is just a wrapper around `getenv'. Do you s= uggest to use >>> Daniel> `declare-function' and require xdg inside `browse-url-quteb= rowser-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