From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#67688: 30.0.50; ffap prepends buffers default-directory to guessed file name in case of tramp's file name syntax Date: Tue, 12 Dec 2023 20:23:51 +0530 Message-ID: <871qbrtqtc.fsf@gmail.com> References: <87r0jy3z41.fsf@no.lan> <87fs0cg3rr.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7237"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: grfz@gmx.de, 67688@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 12 15:55:08 2023 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 1rD4A8-0001fR-3v for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Dec 2023 15:55:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD49o-0004O6-L2; Tue, 12 Dec 2023 09:54:48 -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 1rD49n-0004Ng-0x for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:54:47 -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 1rD49m-0007HN-P7 for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:54:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rD4A2-00071d-46 for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Dec 2023 14:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67688 X-GNU-PR-Package: emacs Original-Received: via spool by 67688-submit@debbugs.gnu.org id=B67688.170239285926939 (code B ref 67688); Tue, 12 Dec 2023 14:55:02 +0000 Original-Received: (at 67688) by debbugs.gnu.org; 12 Dec 2023 14:54:19 +0000 Original-Received: from localhost ([127.0.0.1]:55626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD49L-00070R-Fa for submit@debbugs.gnu.org; Tue, 12 Dec 2023 09:54:19 -0500 Original-Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:43148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD49H-00070D-Uz for 67688@debbugs.gnu.org; Tue, 12 Dec 2023 09:54:17 -0500 Original-Received: by mail-pg1-x541.google.com with SMTP id 41be03b00d2f7-5c66b093b86so5076864a12.0 for <67688@debbugs.gnu.org>; Tue, 12 Dec 2023 06:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702392834; x=1702997634; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=hzaWSo1yGGEkKB0XJrzac6iHw78ZqxwK6nS7Yw+3Z4M=; b=RzQkoPMZChpy1C7LaNaxwpZVh13ewzE4nv2Poc3EAztfKbMIbMiXbvcvCLsVRrH4sS 3ZkBDLUpvLSxdF4vz7liAH54L5lmc/W0eVpKkfnvZOcspMPWpeRerUhSzR4JFNK5PMA6 Vct43VTH5upQL454VPQFuatAie0RQvxzX0HUeh1sy8PoWn/JZBttrttLt/kuDl5kI5nd ZCx5bAYITI00iLW00CsNKMFFMd/27R2LB4gOZ4ZJzrlbEKcRpWdMgNMu9TcSAAPWJtdF JyBEfu36ZxDbIobtJZDGLd2tOSN/JvE1uy9RYzF07YGy9ResRpBQfP34wMYlxOUdzyqH iWYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702392834; x=1702997634; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hzaWSo1yGGEkKB0XJrzac6iHw78ZqxwK6nS7Yw+3Z4M=; b=siYl/EHTo9olLMvgkKxSaTjKjH5KiizimWw0BclmM577yNxYgZ086IjL/z0Onuw/oF X20PY/XvqKIbtIcD63uAf8mbwQSs0dkDLhX3VFbvseIVJg0+whuGcG7x5MZhv518Hmj+ tEL+N47ZaMZ8G9PR0/fgg61Kae70mb8cmTmn8q+RCGTTE9S84jCDOUOXxiDPysYfH/1a id9nKNklhS7rkkInUy6D4pHue0XyD63RZ+wJZCVjyr+6v30MLv/5mQ6V5KxMpMW8y1Tl Bvk+H74zy/rYO437I/WyLHdGCn0HqHW0qH+LNBFhC4iCjyYW3aixebo9DmOhOcz02DJ7 uZ7Q== X-Gm-Message-State: AOJu0YzgnsZYyXyzw91YT6Gveb6lcPEElB6EAPjO2OsJTjkyrf+YkH/9 F7zbrQESx0E3G+LvlE+5wyk= X-Google-Smtp-Source: AGHT+IHkXh4k/T+t14zS/DouzFma0mXswzWCDIs00Xn/F5hsZFMmJd+Po9RtA1XDAwSlI3JEaE5mOQ== X-Received: by 2002:a17:90b:23c4:b0:286:6cc0:62b2 with SMTP id md4-20020a17090b23c400b002866cc062b2mr6658062pjb.49.1702392834349; Tue, 12 Dec 2023 06:53:54 -0800 (PST) Original-Received: from localhost ([49.204.128.180]) by smtp.gmail.com with ESMTPSA id pf6-20020a17090b1d8600b0028658c6209dsm10627338pjb.2.2023.12.12.06.53.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 06:53:53 -0800 (PST) In-Reply-To: <87fs0cg3rr.fsf@gmx.de> (Michael Albinus's message of "Fri, 08 Dec 2023 15:36:24 +0100") 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:276051 Archived-At: [Friday December 08, 2023] Michael Albinus wrote: > Gregor Zattler via "Bug reports for GNU Emacs, the Swiss army knife of > text editors" writes: > >> Dear Emacs developers, > > Hi Gregor, > >> following this recipe (in >> some Gnu/Linux shell): >> >> $ cd /tmp >> tmp$ emacs -Q -nw >> # type /ssh:user@server:/home/test >> # type M-x ffap RET >> >> the proposed file name in minibuffer then is: >> /tmp/ssh:user@server:/home/test >> instead of >> /ssh:user@server:/home/test >> >> Therefore it's not possible to just hit RET in order >> to open that file. But that would be nice. > > I can reproduce the behavior for all Emacsen down to Emacs 25 (the > oldest I have a running copy of), so I guess it didn't work ever. You were quite close. That was when ffap-lax-url was set to t, previous versions would have done the right thing I think. > The problem is, that `ffap-guesser' returns "ssh:user@server:/home/test", > which looks like a relative file name. Therefore, it is expanded to the > default directory "/tmp/". > > I have no idea about ffap.el and thingatpt.el, so I fear I cannot do too > much. Somebody else who knows these libraries might fix it. With the default value of ffap-lax-url=t, thing-at-point-bounds-url-at-point does not check the scheme of the url so it ends up matching ssh:user@server alone. With the nil value, ffap correctly suggests /ssh:user@server:/home/test because the correct scheme is ssh:// not ssh:. But with ffap-lax-url=nil, you lose the ability to insert mailto:user@host when the point is on user@host because it is not a "well-formed" url [1] and thusly does not get picked up by thing-at-point-url-at-point. I hope my explanation is understandable. I'm not sure what to do here frankly. Hmm... looking at the region history for the defcustom, it was changed to t by Eli for bug#25264: the user wanted the email address like user@host to be matched by ffap. I suppose we can try to see if the point is on an email address in ffap-guesser after URL and filename guesses, then we can turn ffap-lax-url back to nil and everyone will be happy. 1. See thing-at-point--bounds-of-well-formed-url.