Mercurial > hgrepos > hgweb.cgi > yatex
comparison yahtml.el @ 359:dbef6cf84f98 dev
Two or more consecutive [Tab] in column of table jump to the next column.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 22 Dec 2014 22:33:02 +0900 |
parents | 2a72779d9c50 |
children | d69fd7b1ac4d |
comparison
equal
deleted
inserted
replaced
358:2c2b70f41fb3 | 359:dbef6cf84f98 |
---|---|
1 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- | 1 ;;; yahtml.el --- Yet Another HTML mode -*- coding: sjis -*- |
2 ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] | 2 ;;; (c) 1994-2013 by HIROSE Yuuji [yuuji(@)yatex.org] |
3 ;;; Last modified Sun Dec 21 14:02:00 2014 on firestorm | 3 ;;; Last modified Mon Dec 22 22:17:24 2014 on firestorm |
4 ;;; $Id$ | 4 ;;; $Id$ |
5 | 5 |
6 (defconst yahtml-revision-number "1.77" | 6 (defconst yahtml-revision-number "1.77" |
7 "Revision number of running yahtml.el") | 7 "Revision number of running yahtml.el") |
8 | 8 |
2498 ; (progn | 2498 ; (progn |
2499 ; (fset 'move-to-column 'yahtml-move-to-column) | 2499 ; (fset 'move-to-column 'yahtml-move-to-column) |
2500 ; (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))) | 2500 ; (apply 'YaTeX-saved-indent-new-comment-line (if soft (list soft)))) |
2501 ; (fset 'move-to-column yahtml-saved-move-to-column))) | 2501 ; (fset 'move-to-column yahtml-saved-move-to-column))) |
2502 | 2502 |
2503 ;;; | |
2504 ;;; ---------- move forward/backward field ---------- | |
2505 ;;; | |
2506 (defun yahtml-element-path () | |
2507 "Return the element path from <body> at point as a list" | |
2508 (let (path elm) | |
2509 (save-excursion | |
2510 (while (and (YaTeX-beginning-of-environment) | |
2511 (looking-at (concat "<\\(" yahtml-command-regexp "\\)\\>")) | |
2512 (not (string= (setq elm (downcase (YaTeX-match-string 1))) | |
2513 "body"))) | |
2514 (setq path (cons elm path) | |
2515 elm nil)) | |
2516 (and elm (setq path (cons elm path)))))) | |
2517 | |
2518 (defun yahtml-forward-field (arg) | |
2519 "Move ARGth forward cell to table element. | |
2520 ENVINFO is a cons of target element name and its beginning point." | |
2521 (interactive "p") | |
2522 (let (inenv elm path sibs) | |
2523 (cond | |
2524 ((< arg 0) (yahtml-backward-field (- arg))) | |
2525 ((= arg 0) nil) | |
2526 ((and (setq path (nreverse (yahtml-element-path))) | |
2527 (catch 'sibling | |
2528 (while path | |
2529 (if (setq elm (car-safe | |
2530 (member (car path) '("td" "th" "li" "dt" "dd")))) | |
2531 (throw 'sibling elm)) | |
2532 (setq path (cdr path))))) | |
2533 (setq inenv (YaTeX-in-environment-p elm) | |
2534 sibs (cdr (assoc elm '(("td" . "td\\|th") | |
2535 ("th" . "td\\|th") | |
2536 ("li" . "li") | |
2537 ("dt" . "dt\\|dd") | |
2538 ("dd" . "dt\\|dd"))))) | |
2539 (goto-char (cdr inenv)) | |
2540 (while (>= (setq arg (1- arg)) 0) | |
2541 (yahtml-goto-corresponding-begend) | |
2542 (if (looking-at "<") (forward-list 1)) | |
2543 (skip-chars-forward "^<")) | |
2544 (while (looking-at "\\s \\|\\(</\\)") | |
2545 (if (match-beginning 1) (forward-list 1) | |
2546 (skip-chars-forward "\n\t "))) | |
2547 (forward-list 1) ;; step into environment | |
2548 (skip-chars-forward " \t\n") | |
2549 (if (looking-at (concat "<\\(" sibs "\\)\\>")) | |
2550 (forward-list 1)) | |
2551 )))) | |
2552 | |
2553 | |
2503 ;;; | 2554 ;;; |
2504 ;;; ---------- indentation ---------- | 2555 ;;; ---------- indentation ---------- |
2505 ;;; | 2556 ;;; |
2506 (defun yahtml-indent-line () | 2557 (defun yahtml-indent-line-1 () |
2507 "Indent a line (faster wrapper)" | 2558 "Indent a line (faster wrapper)" |
2508 (interactive) | 2559 (interactive) |
2509 (let (indent) | 2560 (let (indent) |
2510 (if (and (save-excursion | 2561 (if (and (save-excursion |
2511 (beginning-of-line) (skip-chars-forward "\t ") | 2562 (beginning-of-line) (skip-chars-forward "\t ") |
2523 (skip-chars-forward " \t") | 2574 (skip-chars-forward " \t") |
2524 (or (= (current-column) indent) | 2575 (or (= (current-column) indent) |
2525 (YaTeX-reindent indent))) | 2576 (YaTeX-reindent indent))) |
2526 (and (bolp) (skip-chars-forward " \t"))) | 2577 (and (bolp) (skip-chars-forward " \t"))) |
2527 (yahtml-indent-line-real)))) | 2578 (yahtml-indent-line-real)))) |
2579 | |
2580 (defun yahtml-indent-line () | |
2581 "Indent a line (Second level wrapper). | |
2582 See also yahtml-indent-line-1 and yahtml-indent-line-real." | |
2583 (interactive) | |
2584 (let ((cc (current-column)) (p (point))) | |
2585 (yahtml-indent-line-1) | |
2586 (and (= cc (current-column)) | |
2587 (= p (point)) | |
2588 (equal last-command 'yahtml-indent-line) | |
2589 (yahtml-forward-field 1)))) | |
2590 | |
2528 | 2591 |
2529 (defun yahtml-this-indent () | 2592 (defun yahtml-this-indent () |
2530 (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li") | 2593 (let ((envs "[uod]l\\|table\\|[ht][rhd0-6]\\|select\\|blockquote\\|center\\|menu\\|dir\\|d[td]\\|li") |
2531 (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$") | 2594 (itemizing-envs "^\\([uod]l\\|menu\\|dir\\|li\\|d[td]\\)$") |
2532 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") | 2595 (itms "<\\(dt\\|dd\\|li\\|t[rdh]\\|option\\)\\b") |