From: Yuri Khan <yuri.v.khan@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
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 19:17:27 +0700 [thread overview]
Message-ID: <CAP_d_8V2bC1r4fu-9tPp7SW_7-s83ueuMGMkqxkQYWJ7CXh3Fw@mail.gmail.com> (raw)
In-Reply-To: <865xxuwej7.fsf@gnu.org>
On Sun, 10 Mar 2024 at 17:46, Eli Zaretskii <eliz@gnu.org> wrote:
> > > > there is no way for either a
> > > > doctype definition or an XML Schema to say “elements named X
> > > > definitely contain file names”. The closest is XML Schema’s anyURI
> > > > datatype, but it might refer not necessarily to a local file but
> > > > possibly to any other URI-addressed resource.
> 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.
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).
> 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.
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).
next prev parent reply other threads:[~2024-03-10 12:17 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 [this message]
2024-03-10 12:43 ` Eli Zaretskii
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=CAP_d_8V2bC1r4fu-9tPp7SW_7-s83ueuMGMkqxkQYWJ7CXh3Fw@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=look@strawberrytea.xyz \
/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.