all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: look@strawberrytea.xyz, emacs-devel@gnu.org
Subject: Re: [PATCH] ffap.el: Exclude angle brackets from file names in XML
Date: Sun, 10 Mar 2024 14:43:04 +0200	[thread overview]
Message-ID: <861q8iw947.fsf@gnu.org> (raw)
In-Reply-To: <CAP_d_8V2bC1r4fu-9tPp7SW_7-s83ueuMGMkqxkQYWJ7CXh3Fw@mail.gmail.com> (message from Yuri Khan on Sun, 10 Mar 2024 19:17:27 +0700)

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Sun, 10 Mar 2024 19:17:27 +0700
> Cc: look@strawberrytea.xyz, emacs-devel@gnu.org
> 
> On Sun, 10 Mar 2024 at 17:46, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> > I was surprised that you didn't (and AFAIU still
> > don't) suggest that we interpret the tags according to the schema.
> 
> I think I explained that: because there is nothing in the XML Schema
> meta-schema that talks specifically of files and file names.

Then how do programs that process such XML know where are file names?

> It might be possible to consider element content or attributes typed
> as ‘anyURI’ to contain file names. It will incur false positives (when
> an anyURI attribute actually contains a non-file URI) and false
> negatives (when the schema of a document is not known to Emacs, or
> when it does not specifically designate an element or attribute as
> ‘anyURI’ even though it contains file names in practice).

Is that what programs which process XML do?

> > AFAIR, we do have an XML mode which can parse the schema, so it seems
> > reasonable to expect that we could recognize file names using the
> > information in the schema without any guesswork.  If this is
> > impossible, please explain why not, but please be specific: refer to
> > what Emacs can know about an XML document using the existing XML
> > mode(s), and how that affects our ability to know which tags specify
> > file names.
> 
> I assume you’re referring to ‘rnc-validate-mode’ minor mode and the
> few schemas it knows about out of the box?
> 
> The OP is working with an unspecified, possibly proprietary, XML-based
> format. Likely, its schema is not included in Emacs, and possibly not
> even readily available to the OP. If available, it might not be in the
> RELAX NG Compact format, requiring conversion. If not available, the
> OP would have to derive a schema from observed document instances.

So how does rnc-validate-mode somehow always knows to indicate whether
a given XML file is valid or not?

> Meanwhile, the generic approach “the longest sequence of characters
> allowed in file names, subject to restrictions of your buffer’s
> syntax, starting from the point where you type M-RET and extending
> both ways, is potentially a file name”, is easy to implement and
> usable without any preliminary setup, although probably biased towards
> false positives (attempting to produce a file name when the element or
> attribute is not intended as such).

If that's the best (not necessarily the easiest) we can do, I'm okay
with doing that.  But in general, IMO ffap.el is full of problematic
heuristics that is known to fail from time to time, so whenever we can
avoid the guesswork, we should, even if it is not the easiest
solution.

Thanks.



  reply	other threads:[~2024-03-10 12:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 21:37 [PATCH] ffap.el: Exclude angle brackets from file names in XML StrawberryTea
2024-03-10  5:48 ` Eli Zaretskii
2024-03-10  6:04   ` LemonBreezes
2024-03-10  6:40     ` Eli Zaretskii
2024-03-10  7:20       ` Yuri Khan
2024-03-10  7:51         ` Eli Zaretskii
2024-03-10 10:30           ` Yuri Khan
2024-03-10 10:46             ` Eli Zaretskii
2024-03-10 12:17               ` Yuri Khan
2024-03-10 12:43                 ` Eli Zaretskii [this message]
2024-03-10 13:15                   ` Yuri Khan
2024-03-10 13:53                     ` Lynn Winebarger
2024-03-14  9:49 ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861q8iw947.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=look@strawberrytea.xyz \
    --cc=yuri.v.khan@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.