From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#35517: 27.0.50; Small improvements to HTML mode Date: Sun, 05 May 2019 11:38:49 -0700 Message-ID: <875zqoeog6.fsf@ericabrahamsen.net> References: <87wojb5aiu.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="268093"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: 35517@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 05 20:40:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1hNM3a-0017f1-71 for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 20:40:14 +0200 Original-Received: from localhost ([127.0.0.1]:44536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNM3Z-00055j-3o for geb-bug-gnu-emacs@m.gmane.org; Sun, 05 May 2019 14:40:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNM3R-00055E-V4 for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 14:40:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNM3Q-0002oO-Ny for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 14:40:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41280) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNM3O-0002li-Iq for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 14:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hNM3O-0007sI-7a for bug-gnu-emacs@gnu.org; Sun, 05 May 2019 14:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 May 2019 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35517 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35517-submit@debbugs.gnu.org id=B35517.155708154230190 (code B ref 35517); Sun, 05 May 2019 18:40:02 +0000 Original-Received: (at 35517) by debbugs.gnu.org; 5 May 2019 18:39:02 +0000 Original-Received: from localhost ([127.0.0.1]:54824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNM2P-0007qb-2s for submit@debbugs.gnu.org; Sun, 05 May 2019 14:39:02 -0400 Original-Received: from ericabrahamsen.net ([52.70.2.18]:56234 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNM2M-0007qN-Gg for 35517@debbugs.gnu.org; Sun, 05 May 2019 14:38:59 -0400 Original-Received: from localhost (75-172-97-110.tukw.qwest.net [75.172.97.110]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 9DF29FA026 for <35517@debbugs.gnu.org>; Sun, 5 May 2019 18:38:51 +0000 (UTC) In-Reply-To: <87wojb5aiu.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 30 Apr 2019 16:38:33 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158802 Archived-At: --=-=-= Content-Type: text/plain Eric Abrahamsen writes: > The attached patch provides some small improvements to HTML mode. It > adds `html-div' and `html-span' skeleton commands, and changes the > newline/indent behavior of `html-ordered-list', `html-unordered-list', > `html-list-item', and `html-paragraph'. It also offers "class" and "id" > attributes to most HTML tags in `sgml-attributes'. > > Comments welcome! Here's an updated patch -- "div" elements should always have "span" and "id" offered as attributes. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Tweaks-to-html-mode.patch >From 3928b1a04deaf74812bffa221d0883da9a52bab3 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 30 Apr 2019 16:00:46 -0700 Subject: [PATCH] Tweaks to html mode * lisp/textmodes/sgml-mode.el (sgml-attributes): Add the "class" and "id" attributes when needed. (html-mode-map): Add the `html-div' and `html-span' commands to the `html-quick-keys' map. (html-ordered-list, html-unordered-list, html-paragraph): Use the "\n" element properly. (html-div, html-span): New HTML skeletons. --- lisp/textmodes/sgml-mode.el | 39 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 9e3be99af1..28ca40b733 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -773,8 +773,16 @@ sgml-attributes (symbolp (car (car alist)))) (setq car (car alist) alist (cdr alist))) - (or quiet - (message "No attributes configured.")) + (unless (or alist quiet) + (message "No attributes configured.")) + (when alist + ;; Add class and id attributes if a) the element has any + ;; other attributes configured, and b) they're not already + ;; present. + (unless (assoc-string "class" alist) + (setq alist (cons '("class") alist))) + (unless (assoc-string "id" alist) + (setq alist (cons '("id") alist)))) (if (stringp (car alist)) (progn (insert (if (eq (preceding-char) ?\s) "" ?\s) @@ -1752,6 +1760,7 @@ html-mode-map (define-key map "\C-c\C-ci" 'html-image) (when html-quick-keys (define-key map "\C-c-" 'html-horizontal-rule) + (define-key map "\C-cd" 'html-div) (define-key map "\C-co" 'html-ordered-list) (define-key map "\C-cu" 'html-unordered-list) (define-key map "\C-cr" 'html-radio-buttons) @@ -1759,7 +1768,8 @@ html-mode-map (define-key map "\C-cl" 'html-list-item) (define-key map "\C-ch" 'html-href-anchor) (define-key map "\C-cn" 'html-name-anchor) - (define-key map "\C-ci" 'html-image)) + (define-key map "\C-ci" 'html-image) + (define-key map "\C-cs" 'html-span)) (define-key map "\C-c\C-s" 'html-autoview-mode) (define-key map "\C-c\C-v" 'browse-url-of-buffer) (define-key map [menu-bar html] (cons "HTML" menu-map)) @@ -1960,7 +1970,7 @@ html-tag-alist ("dd" ,(not sgml-xml-mode)) ("del" nil ("cite") ("datetime")) ("dfn") - ("div") + ("div" \n ("id") ("class")) ("dl" (nil \n ( "Term: " "
" str (if sgml-xml-mode "
") @@ -2446,16 +2456,16 @@ html-line (define-skeleton html-ordered-list "HTML ordered list tags." nil - "
    " \n + \n "
      " \n "
    1. " _ (if sgml-xml-mode "
    2. ") \n - "
    ") + "
" > \n) (define-skeleton html-unordered-list "HTML unordered list tags." nil - "
    " \n + \n "
      " \n "
    • " _ (if sgml-xml-mode "
    • ") \n - "
    ") + "
" > \n) (define-skeleton html-list-item "HTML list item tag." @@ -2466,8 +2476,17 @@ html-list-item (define-skeleton html-paragraph "HTML paragraph tag." nil - (if (bolp) nil ?\n) - "

" _ (if sgml-xml-mode "

")) + \n "

" _ (if sgml-xml-mode "

")) + +(define-skeleton html-div + "HTML div tag." + nil + "
" > \n _ \n "
" >) + +(define-skeleton html-span + "HTML span tag." + nil + "" > _ "") (define-skeleton html-checkboxes "Group of connected checkbox inputs." -- 2.21.0 --=-=-=--