Mercurial > emacs
comparison lisp/textmodes/sgml-mode.el @ 37252:5db39c2eba1e
Add unknown maintainer.
(sgml-tag): Pass `str' explicitly through skeleton-transformation.
(html-mode-map): Use set-keymap-parent.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Fri, 06 Apr 2001 16:24:42 +0000 |
parents | 8e1755c3dd2b |
children | e3bd229672c1 |
comparison
equal
deleted
inserted
replaced
37251:640cc3a90118 | 37252:5db39c2eba1e |
---|---|
3 ;; Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992, 1995, 1996, 1998 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: James Clark <jjc@jclark.com> | 5 ;; Author: James Clark <jjc@jclark.com> |
6 ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>, | 6 ;; Adapted-By: ESR, Daniel Pfeiffer <occitan@esperanto.org>, |
7 ;; F.Potorti@cnuce.cnr.it | 7 ;; F.Potorti@cnuce.cnr.it |
8 ;; Maintainer: ??? | |
8 ;; Keywords: wp, hypermedia, comm, languages | 9 ;; Keywords: wp, hypermedia, comm, languages |
9 | 10 |
10 ;; This file is part of GNU Emacs. | 11 ;; This file is part of GNU Emacs. |
11 | 12 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
79 | 80 |
80 | 81 |
81 (defvar sgml-mode-map | 82 (defvar sgml-mode-map |
82 (let ((map (list 'keymap (make-vector 256 nil))) | 83 (let ((map (list 'keymap (make-vector 256 nil))) |
83 (menu-map (make-sparse-keymap "SGML"))) | 84 (menu-map (make-sparse-keymap "SGML"))) |
84 (define-key map "\t" 'indent-relative-maybe) | |
85 (define-key map "\C-c\C-i" 'sgml-tags-invisible) | 85 (define-key map "\C-c\C-i" 'sgml-tags-invisible) |
86 (define-key map "/" 'sgml-slash) | 86 (define-key map "/" 'sgml-slash) |
87 (define-key map "\C-c\C-n" 'sgml-name-char) | 87 (define-key map "\C-c\C-n" 'sgml-name-char) |
88 (define-key map "\C-c\C-t" 'sgml-tag) | 88 (define-key map "\C-c\C-t" 'sgml-tag) |
89 (define-key map "\C-c\C-a" 'sgml-attributes) | 89 (define-key map "\C-c\C-a" 'sgml-attributes) |
499 "Prompt for a tag and insert it, optionally with attributes. | 499 "Prompt for a tag and insert it, optionally with attributes. |
500 Completion and configuration are done according to `sgml-tag-alist'. | 500 Completion and configuration are done according to `sgml-tag-alist'. |
501 If you like tags and attributes in uppercase do \\[set-variable] | 501 If you like tags and attributes in uppercase do \\[set-variable] |
502 skeleton-transformation RET upcase RET, or put this in your `.emacs': | 502 skeleton-transformation RET upcase RET, or put this in your `.emacs': |
503 (setq sgml-transformation 'upcase)" | 503 (setq sgml-transformation 'upcase)" |
504 (completing-read "Tag: " sgml-tag-alist) | 504 (funcall skeleton-transformation |
505 (completing-read "Tag: " sgml-tag-alist)) | |
505 ?< str | | 506 ?< str | |
506 (("") -1 '(undo-boundary) (identity "<")) | ; see comment above | 507 (("") -1 '(undo-boundary) (identity "<")) | ; see comment above |
507 `(("") '(setq v2 (sgml-attributes ,str t)) ?> | 508 `(("") '(setq v2 (sgml-attributes ,str t)) ?> |
508 (if (string= "![" ,str) | 509 (if (string= "![" ,str) |
509 (prog1 '(("") " [ " _ " ]]") | 510 (prog1 '(("") " [ " _ " ]]") |
510 (backward-char)) | 511 (backward-char)) |
511 (if (or (eq v2 t) | 512 (if (or (eq v2 t) |
512 (string-match "^[/!?]" ,str)) | 513 (string-match "^[/!?]" ,str)) |
513 () | 514 () |
514 (if (symbolp v2) | 515 (if (symbolp v2) |
515 '(("") v2 _ v2 "</" ,str ?>) | 516 ;; We go use `identity' to prevent skeleton from passing |
517 ;; `str' through skeleton-transformation a second time. | |
518 '(("") v2 _ v2 "</" (identity ',str) ?>) | |
516 (if (eq (car v2) t) | 519 (if (eq (car v2) t) |
517 (cons '("") (cdr v2)) | 520 (cons '("") (cdr v2)) |
518 (append '(("") (car v2)) | 521 (append '(("") (car v2)) |
519 (cdr v2) | 522 (cdr v2) |
520 '(resume: (car v2) _ "</" ,str ?>)))))))) | 523 '(resume: (car v2) _ "</" (identity ',str) ?>)))))))) |
521 | 524 |
522 (autoload 'skeleton-read "skeleton") | 525 (autoload 'skeleton-read "skeleton") |
523 | 526 |
524 (defun sgml-attributes (tag &optional quiet) | 527 (defun sgml-attributes (tag &optional quiet) |
525 "When at top level of a tag, interactively insert attributes. | 528 "When at top level of a tag, interactively insert attributes. |
832 "Use C-c X combinations for quick insertion of frequent tags when non-nil. | 835 "Use C-c X combinations for quick insertion of frequent tags when non-nil. |
833 This defaults to `sgml-quick-keys'. | 836 This defaults to `sgml-quick-keys'. |
834 This takes effect when first loading the library.") | 837 This takes effect when first loading the library.") |
835 | 838 |
836 (defvar html-mode-map | 839 (defvar html-mode-map |
837 (let ((map (nconc (make-sparse-keymap) sgml-mode-map)) | 840 (let ((map (make-sparse-keymap)) |
838 (menu-map (make-sparse-keymap "HTML"))) | 841 (menu-map (make-sparse-keymap "HTML"))) |
842 (set-keymap-parent map sgml-mode-map) | |
839 (define-key map "\C-c6" 'html-headline-6) | 843 (define-key map "\C-c6" 'html-headline-6) |
840 (define-key map "\C-c5" 'html-headline-5) | 844 (define-key map "\C-c5" 'html-headline-5) |
841 (define-key map "\C-c4" 'html-headline-4) | 845 (define-key map "\C-c4" 'html-headline-4) |
842 (define-key map "\C-c3" 'html-headline-3) | 846 (define-key map "\C-c3" 'html-headline-3) |
843 (define-key map "\C-c2" 'html-headline-2) | 847 (define-key map "\C-c2" 'html-headline-2) |