diff options
| author | Sam Steingold | 2001-10-26 17:40:59 +0000 |
|---|---|---|
| committer | Sam Steingold | 2001-10-26 17:40:59 +0000 |
| commit | 5950e02941c8e992bfdf4d7f72c74ce1d052b2c8 (patch) | |
| tree | 2746d93dfe94e3b0d85f4337e9752edd5561eac7 | |
| parent | 5719bb6ff715348cad5a82dc50d397713116ea44 (diff) | |
| download | emacs-5950e02941c8e992bfdf4d7f72c74ce1d052b2c8.tar.gz emacs-5950e02941c8e992bfdf4d7f72c74ce1d052b2c8.zip | |
some code simplifications: when instead of if+progn;
line-beginning-position instead of progn+bol+point
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 3642aa5c5b3..5b7baa5ffaa 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -440,16 +440,13 @@ start tag, and the second `/' is the corresponding null end tag." | |||
| 440 | (setq blinkpos (point)) | 440 | (setq blinkpos (point)) |
| 441 | (setq level (1- level))) | 441 | (setq level (1- level))) |
| 442 | (setq level (1+ level))))))) | 442 | (setq level (1+ level))))))) |
| 443 | (if blinkpos | 443 | (when blinkpos |
| 444 | (progn | 444 | (goto-char blinkpos) |
| 445 | (goto-char blinkpos) | 445 | (if (pos-visible-in-window-p) |
| 446 | (if (pos-visible-in-window-p) | 446 | (sit-for 1) |
| 447 | (sit-for 1) | 447 | (message "Matches %s" |
| 448 | (message "Matches %s" | 448 | (buffer-substring (line-beginning-position) |
| 449 | (buffer-substring (progn | 449 | (1+ blinkpos))))))))) |
| 450 | (beginning-of-line) | ||
| 451 | (point)) | ||
| 452 | (1+ blinkpos)))))))))) | ||
| 453 | 450 | ||
| 454 | 451 | ||
| 455 | (defun sgml-name-char (&optional char) | 452 | (defun sgml-name-char (&optional char) |
| @@ -827,22 +824,20 @@ If this can't be done, return t." | |||
| 827 | 824 | ||
| 828 | (defun sgml-value (alist) | 825 | (defun sgml-value (alist) |
| 829 | "Interactively insert value taken from attributerule ALIST. | 826 | "Interactively insert value taken from attributerule ALIST. |
| 830 | See `sgml-tag-alist' for info about attributerules.." | 827 | See `sgml-tag-alist' for info about attribute rules." |
| 831 | (setq alist (cdr alist)) | 828 | (setq alist (cdr alist)) |
| 832 | (if (stringp (car alist)) | 829 | (if (stringp (car alist)) |
| 833 | (insert "=\"" (car alist) ?\") | 830 | (insert "=\"" (car alist) ?\") |
| 834 | (if (sgml-skip-close-p (car alist)) ; (eq (car alist) t) | 831 | (if (sgml-skip-close-p (car alist)) ; (eq (car alist) t) |
| 835 | (if (cdr alist) | 832 | (when (cdr alist) |
| 836 | (progn | 833 | (insert "=\"") |
| 837 | (insert "=\"") | 834 | (setq alist (skeleton-read '(completing-read "Value: " (cdr alist)))) |
| 838 | (setq alist (skeleton-read '(completing-read | 835 | (if (string< "" alist) |
| 839 | "Value: " (cdr alist)))) | 836 | (insert alist ?\") |
| 840 | (if (string< "" alist) | 837 | (delete-backward-char 2))) |
| 841 | (insert alist ?\") | ||
| 842 | (delete-backward-char 2)))) | ||
| 843 | (insert "=\"") | 838 | (insert "=\"") |
| 844 | (if alist | 839 | (when alist |
| 845 | (insert (skeleton-read '(completing-read "Value: " alist)))) | 840 | (insert (skeleton-read '(completing-read "Value: " alist)))) |
| 846 | (insert ?\")))) | 841 | (insert ?\")))) |
| 847 | 842 | ||
| 848 | (defun sgml-quote (start end &optional unquotep) | 843 | (defun sgml-quote (start end &optional unquotep) |
| @@ -897,17 +892,16 @@ This takes effect when first loading the library.") | |||
| 897 | (define-key map "\C-c\C-ch" 'html-href-anchor) | 892 | (define-key map "\C-c\C-ch" 'html-href-anchor) |
| 898 | (define-key map "\C-c\C-cn" 'html-name-anchor) | 893 | (define-key map "\C-c\C-cn" 'html-name-anchor) |
| 899 | (define-key map "\C-c\C-ci" 'html-image) | 894 | (define-key map "\C-c\C-ci" 'html-image) |
| 900 | (if html-quick-keys | 895 | (when html-quick-keys |
| 901 | (progn | 896 | (define-key map "\C-c-" 'html-horizontal-rule) |
| 902 | (define-key map "\C-c-" 'html-horizontal-rule) | 897 | (define-key map "\C-co" 'html-ordered-list) |
| 903 | (define-key map "\C-co" 'html-ordered-list) | 898 | (define-key map "\C-cu" 'html-unordered-list) |
| 904 | (define-key map "\C-cu" 'html-unordered-list) | 899 | (define-key map "\C-cr" 'html-radio-buttons) |
| 905 | (define-key map "\C-cr" 'html-radio-buttons) | 900 | (define-key map "\C-cc" 'html-checkboxes) |
| 906 | (define-key map "\C-cc" 'html-checkboxes) | 901 | (define-key map "\C-cl" 'html-list-item) |
| 907 | (define-key map "\C-cl" 'html-list-item) | 902 | (define-key map "\C-ch" 'html-href-anchor) |
| 908 | (define-key map "\C-ch" 'html-href-anchor) | 903 | (define-key map "\C-cn" 'html-name-anchor) |
| 909 | (define-key map "\C-cn" 'html-name-anchor) | 904 | (define-key map "\C-ci" 'html-image)) |
| 910 | (define-key map "\C-ci" 'html-image))) | ||
| 911 | (define-key map "\C-c\C-s" 'html-autoview-mode) | 905 | (define-key map "\C-c\C-s" 'html-autoview-mode) |
| 912 | (define-key map "\C-c\C-v" 'browse-url-of-buffer) | 906 | (define-key map "\C-c\C-v" 'browse-url-of-buffer) |
| 913 | (define-key map [menu-bar html] (cons "HTML" menu-map)) | 907 | (define-key map [menu-bar html] (cons "HTML" menu-map)) |
| @@ -1298,7 +1292,7 @@ The third `match-string' will be the used in the menu.") | |||
| 1298 | (* 2 (1- (string-to-number (match-string 1)))) | 1292 | (* 2 (1- (string-to-number (match-string 1)))) |
| 1299 | ?\ ) | 1293 | ?\ ) |
| 1300 | (match-string 3)) | 1294 | (match-string 3)) |
| 1301 | (save-excursion (beginning-of-line) (point))) | 1295 | (line-beginning-position)) |
| 1302 | toc-index)))) | 1296 | toc-index)))) |
| 1303 | (nreverse toc-index))) | 1297 | (nreverse toc-index))) |
| 1304 | 1298 | ||