Subject: bug#29057: 26.0.60; sgml-mode should define completion-at-point-functions

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 18 May 2022 00:07:34 +0200

Tom Tromey <[email-masked]> writes:

> sgml-mode has a lot of data about tags and attributes, but it doesn't
> provide a convenient way to do completion of them; only things like
> sgml-tag and sgml-attributes.
>
> I think sgml-mode should set completion-at-point-functions to a function
> that can complete attributes without querying the user in the minibuffer.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

I think that's a good idea.  There's

(defvar html-tag-alist
[...]
    `(("a" ,name ,@link)
      ("area" t ,@shape ("coords") ("href") ("nohref" "nohref") ("alt")
       ("tabindex") ("accesskey") ("onfocus") ("onblur"))
      ("base" t ,@href)
      ("col" t ,@cellhalign ,@cellvalign ("span") ("width"))
      ("colgroup" \n ,@cellhalign ,@cellvalign ("span") ("width"))
      ("dir" ,@list)
      ("figcaption")

for instance, so it would make sense to offer completion or

<colg

to

<colgroup

and also offer completion of hitting TAB inside a tag to complete to
attributes (which are also in that alist).

But I wonder -- does this already exist?  It seems strange that nobody
has added something like this already.  Anybody know?  I can't see
anything in sgml-mode.el, but...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no