# HG changeset patch # User HIROSE Yuuji # Date 1444178825 -32374 # Node ID 79dc66c450df6b2b9694bea6756b3a4583529f46 # Parent 5cce749f9bbbe1799a08d9edaf1a484cce912fe6 [prefix] a renamed to yahtml-char-entity-ref, which completes more syms diff -r 5cce749f9bbb -r 79dc66c450df yahtml.el --- a/yahtml.el Thu Oct 01 15:53:02 2015 +0859 +++ b/yahtml.el Wed Oct 07 09:46:39 2015 +0859 @@ -1,6 +1,6 @@ ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- ;;; (c) 1994-2015 by HIROSE Yuuji [yuuji(@)yatex.org] -;;; Last modified Fri Sep 25 14:39:19 2015 on firestorm +;;; Last modified Wed Oct 7 09:45:01 2015 on firestorm ;;; $Id$ (defconst yahtml-revision-number "1.78.1" @@ -383,7 +383,7 @@ (YaTeX-define-key "k" 'yahtml-kill-* map) (YaTeX-define-key "c" 'yahtml-change-* map) (YaTeX-define-key "t" 'yahtml-browse-menu map) - (YaTeX-define-key "a" 'yahtml-complete-mark map) + (YaTeX-define-key "a" 'yahtml-char-entity-ref map) (YaTeX-define-key "'" 'yahtml-prev-error map) (YaTeX-define-key ";" 'yahtml-translate-region map) (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) @@ -2977,18 +2977,19 @@ (if (eolp) (forward-char 1))) ;;; ---------- complete marks ---------- -(defun yahtml-complete-mark () - "Complete >, <, &ersand, and "e." +(defun yahtml-char-entity-ref () + "Complete >, <, &, and "." (interactive) (message "1:< 2:> 3:& 4:\" 5:' 6:nbsp") - (let ((c (read-char))) - (setq c (if (or (< c ?0) (> c ?7)) - (string-match (regexp-quote (char-to-string c)) "<>&\"") + (let ((c (read-char)) d) + (setq d (if (or (< c ?0) (> c ?7)) + (string-match (regexp-quote (char-to-string c)) "<>&\"' ") (- c ?1))) - (if (or (< c 0) (> c 6)) - nil + (cond + ((null d) (insert (format "&#x%x;" c))) + ((and (>= d 0) (<= d 6)) (insert (format "&%s;" - (nth c '("lt" "gt" "amp" "quot" "apos" "nbsp"))))))) + (nth d '("lt" "gt" "amp" "quot" "apos" "nbsp")))))))) ;;; ---------- jump to error line ----------