From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#69098: [PATCH] Add new command 'browse-url-here' Date: Tue, 13 Feb 2024 10:09:50 +0000 Message-ID: <87ttmc7k0h.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4446"; mail-complaints-to="usenet@ciao.gmane.io" To: 69098@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 13 11:11:11 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 1rZpkt-0000xr-Qm for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 13 Feb 2024 11:11:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZpkV-00048C-1D; Tue, 13 Feb 2024 05:10:47 -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 1rZpkT-00047k-Ka for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 05:10:45 -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 1rZpkT-0005jF-CI for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 05:10:45 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rZpkk-0004gu-FK for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 05:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Feb 2024 10:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 69098 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170781901717942 (code B ref -1); Tue, 13 Feb 2024 10:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Feb 2024 10:10:17 +0000 Original-Received: from localhost ([127.0.0.1]:41744 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZpk0-0004fJ-RH for submit@debbugs.gnu.org; Tue, 13 Feb 2024 05:10:17 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:36558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rZpjy-0004f7-HY for submit@debbugs.gnu.org; Tue, 13 Feb 2024 05:10:15 -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 1rZpjg-00040O-JY for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 05:09:56 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZpje-0005MP-TO for bug-gnu-emacs@gnu.org; Tue, 13 Feb 2024 05:09:56 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 185FD240027 for ; Tue, 13 Feb 2024 11:09:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707818992; bh=Y14+DKCis+wQm6S+v7VBRuWDxbRP7Nf2Xsr714mVOHk=; h=From:To:Subject:OpenPGP:Date:Message-ID:MIME-Version:Content-Type: From; b=o0Gq0xBZ5LS3+EK0eg4UylFSDCQAyzrLDYCsPSG1LxaGW5fr8cRyrBCXmtb+wf7Z9 HkQJl9NjA6knxPZPiwx1HCwatxwu5Xa6XqDGY3GifE7SZLuGISaSYvL/rvZKqHT2gV qFvvJRFGE3SX2hGuluRdEUpKfschCVevZXiiwXsGCylgJAqNrNiP9LoW9PMT31rO23 EcnHtLKxi/9aeiOratJS7lCLkUHoN0Rup3/bLmYtEjkNq9ARzF8uZIt71YvKrmfv8S hEKmNsqpaMQJHBpbrJghSvsUDvfu2UwX6O6NAL2oKwaNGpykFmhaLfIZaERaEKK5+t 0H+G1G6GJvb+g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TYxrv3bwDz6tvq for ; Tue, 13 Feb 2024 11:09:51 +0100 (CET) OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:279951 Archived-At: --=-=-= Content-Type: text/plain The idea is to have a command that can be used to open a file or directory using something outside Emacs. I find this useful, but it might be that there are edge-cases that I am not considering that don't pop up on my system. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-new-command-'browse-url-here'.patch Content-Description: [PATCH] Add new command 'browse-url-here' >From 1f25f653ba35cb2c63a481522ffbf727bc2f5dd3 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Tue, 13 Feb 2024 11:08:09 +0100 Subject: [PATCH] Add new command 'browse-url-here' * lisp/net/browse-url.el (browse-url-here): Add it. * etc/NEWS: Document it. --- etc/NEWS | 4 ++++ lisp/net/browse-url.el | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index e7e516d61a1..ea7cd1fc517 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -317,6 +317,10 @@ Previously, it was set to t but this broke remote file name detection. ** Multi-character key echo now ends with a suggestion to use Help. Customize 'echo-keystrokes-help' to nil to prevent that. +** New command 'browse-url-here'. +This command opens the current file or directory using an external tool, +as defined by 'browse-url-of-file'. + * Editing Changes in Emacs 30.1 diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index bc2a7db9a8b..abc1e9e5829 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -943,6 +943,19 @@ browse-url-at-point browse-url-new-window-flag)) (error "No URL found")))) +(defun browse-url-here (arg) + "Open current file or directory with external tools. +With prefix argument ARG, open the current `default-directory' instead +of the buffer of the current file." + (interactive "P") + (let ((browse-url-default-handlers '())) + (browse-url-of-file + (expand-file-name + (or (and arg ".") + (and (derived-mode-p 'dired-mode) + (dired-get-filename)) + buffer-file-name "."))))) + ;;;###autoload (defun browse-url-with-browser-kind (kind url &optional arg) "Browse URL with a browser of the given browser KIND. -- 2.43.0 --=-=-=--