From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: some proposed tweaks to HTML mode Date: Fri, 22 Mar 2019 13:58:37 -0400 Message-ID: References: <875zsbri7u.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="174879"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 22 19:02:48 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h7OVC-000jJX-L6 for ged-emacs-devel@m.gmane.org; Fri, 22 Mar 2019 19:02:46 +0100 Original-Received: from localhost ([127.0.0.1]:60984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7OVB-0002cq-GA for ged-emacs-devel@m.gmane.org; Fri, 22 Mar 2019 14:02:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h7OV3-0002cH-BC for emacs-devel@gnu.org; Fri, 22 Mar 2019 14:02:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h7ORK-0002FW-Ry for emacs-devel@gnu.org; Fri, 22 Mar 2019 13:58:48 -0400 Original-Received: from [195.159.176.226] (port=45950 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h7ORK-00027f-Ct for emacs-devel@gnu.org; Fri, 22 Mar 2019 13:58:46 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1h7ORI-000egl-4D for emacs-devel@gnu.org; Fri, 22 Mar 2019 18:58:44 +0100 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:ZAB1Rc7fIOFj/iteck0HlOeU4hk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234614 Archived-At: > I've always found vanilla HTML mode kind of annoying to use, and finally > tried to figure out why. (I assume everyone is using some fancier HTML > authoring mode, but that's no reason not to fix this one.) I use nxml-mode, but I'd like to make it use more of sgml/html-mode (e.g. for indentation), so this is very welcome in any case. > @@ -1962,7 +1965,7 @@ html-tag-alist > ("dd" ,(not sgml-xml-mode)) > ("del" nil ("cite") ("datetime")) > ("dfn") > - ("div") > + ("div" nil ("class") ("id")) > > The
and elements have literally no use except for a place > to hang the "class" and/or "id" attribute, so I don't see why we don't > accept those here. In fact, I'd rather just automatically add "class" > and "id" as potential attributes on all the tags. Indeed, `class` and `id` should be automatically added to all elements (i.e. not in the above list but directly in the sgml-attributes code). But for many elements it makes sense to not query any attributes at all since they almost never have any attributes (not even "class" nor "id"). > @@ -2451,26 +2455,38 @@ html-ordered-list > nil > "
    " \n > "
  1. " _ (if sgml-xml-mode "
  2. ") \n > - "
") > + "" >) Since the skeleton uses several lines in all cases, I think it makes sense to use \n rather than > at the very end, to make sure that any text that follows is placed on another line. Same for the
    element, of course. [ I like to put consecutive close tags all on the same line, but I'd still prefer the skeleton to use \n here, even if it occasionally forces me to then remove the line break. ] > (define-skeleton html-list-item > "HTML list item tag." > nil > - (if (bolp) nil '\n) > + (if (re-search-backward "^[[:blank:]]+") nil '\n) > "
  • " _ (if sgml-xml-mode "
  • ")) I see you already fixed it to use save-excursion, but it's worth mentioning that there's `sgml-at-indentation-p` for that. Also, I wonder what this whole (if (bolp) nil '\n) is about. I suspect that it's a remnant from many years when skeleton's \n was more naive: originally, \n in skeletons always inserted a newline, but I changed at many years ago such that a \n as first element behaves differently (basically it behaves like (if (sgml-at-indentation-p) nil '\n). Similarly, a \n at the very end of the skeleton only inserts a newline if we're not already followed by a newline. IOW, I think you can replace (if (sgml-at-indentation-p) nil '\n) with just \n > The above changes (in addition to adding skeletons for div and span > tags) assume that what we want is a nicely indented HTML buffer. Nested > divs should be indented, etc. This is what I want when writing HTML, but > it's an assumption that might not be welcomed by everyone. I for one welcome it. Stefan