yatex
changeset 432:79dc66c450df dev
[prefix] a renamed to yahtml-char-entity-ref, which completes more syms
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 07 Oct 2015 09:46:39 +0859 |
parents | 5cce749f9bbb |
children | 5b49aea3810d |
files | yahtml.el |
diffstat | 1 files changed, 11 insertions(+), 10 deletions(-) [+] |
line diff
1.1 --- a/yahtml.el Thu Oct 01 15:53:02 2015 +0859 1.2 +++ b/yahtml.el Wed Oct 07 09:46:39 2015 +0859 1.3 @@ -1,6 +1,6 @@ 1.4 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- 1.5 ;;; (c) 1994-2015 by HIROSE Yuuji [yuuji(@)yatex.org] 1.6 -;;; Last modified Fri Sep 25 14:39:19 2015 on firestorm 1.7 +;;; Last modified Wed Oct 7 09:45:01 2015 on firestorm 1.8 ;;; $Id$ 1.9 1.10 (defconst yahtml-revision-number "1.78.1" 1.11 @@ -383,7 +383,7 @@ 1.12 (YaTeX-define-key "k" 'yahtml-kill-* map) 1.13 (YaTeX-define-key "c" 'yahtml-change-* map) 1.14 (YaTeX-define-key "t" 'yahtml-browse-menu map) 1.15 - (YaTeX-define-key "a" 'yahtml-complete-mark map) 1.16 + (YaTeX-define-key "a" 'yahtml-char-entity-ref map) 1.17 (YaTeX-define-key "'" 'yahtml-prev-error map) 1.18 (YaTeX-define-key ";" 'yahtml-translate-region map) 1.19 (YaTeX-define-key ":" 'yahtml-translate-reverse-region map) 1.20 @@ -2977,18 +2977,19 @@ 1.21 (if (eolp) (forward-char 1))) 1.22 1.23 ;;; ---------- complete marks ---------- 1.24 -(defun yahtml-complete-mark () 1.25 - "Complete >, <, &ersand, and "e." 1.26 +(defun yahtml-char-entity-ref () 1.27 + "Complete >, <, &, and "." 1.28 (interactive) 1.29 (message "1:< 2:> 3:& 4:\" 5:' 6:nbsp") 1.30 - (let ((c (read-char))) 1.31 - (setq c (if (or (< c ?0) (> c ?7)) 1.32 - (string-match (regexp-quote (char-to-string c)) "<>&\"") 1.33 + (let ((c (read-char)) d) 1.34 + (setq d (if (or (< c ?0) (> c ?7)) 1.35 + (string-match (regexp-quote (char-to-string c)) "<>&\"' ") 1.36 (- c ?1))) 1.37 - (if (or (< c 0) (> c 6)) 1.38 - nil 1.39 + (cond 1.40 + ((null d) (insert (format "&#x%x;" c))) 1.41 + ((and (>= d 0) (<= d 6)) 1.42 (insert (format "&%s;" 1.43 - (nth c '("lt" "gt" "amp" "quot" "apos" "nbsp"))))))) 1.44 + (nth d '("lt" "gt" "amp" "quot" "apos" "nbsp")))))))) 1.45 1.46 1.47 ;;; ---------- jump to error line ----------