Mercurial > hg > xemacs-beta
comparison lisp/psgml/psgml.el @ 2:ac2d302a0011 r19-15b2
Import from CVS: tag r19-15b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:46:35 +0200 |
parents | 376386a54a3c |
children | bcdc7deadc19 |
comparison
equal
deleted
inserted
replaced
1:c0c6a60d29db | 2:ac2d302a0011 |
---|---|
1 ;;; psgml.el --- SGML-editing mode with parsing support | 1 ;;; psgml.el --- SGML-editing mode with parsing support |
2 ;; $Id: psgml.el,v 1.1.1.1 1996/12/18 03:35:23 steve Exp $ | 2 ;; $Id: psgml.el,v 1.1.1.2 1996/12/18 03:47:15 steve Exp $ |
3 | 3 |
4 ;; Copyright (C) 1993, 1994, 1995 Lennart Staflin | 4 ;; Copyright (C) 1993, 1994, 1995, 1996 Lennart Staflin |
5 ;; Copyright (C) 1992 Free Software Foundation, Inc. | 5 ;; Copyright (C) 1992 Free Software Foundation, Inc. |
6 | 6 |
7 ;; Author: Lennart Staflin <lenst@lysator.liu.se> | 7 ;; Author: Lennart Staflin <lenst@lysator.liu.se> |
8 ;; James Clark <jjc@clark.com> | 8 ;; James Clark <jjc@clark.com> |
9 | 9 |
48 ;; unlimited lengths on names | 48 ;; unlimited lengths on names |
49 | 49 |
50 | 50 |
51 ;;; Code: | 51 ;;; Code: |
52 | 52 |
53 (defconst psgml-version "1.0a9" | 53 (defconst psgml-version "1.0a12" |
54 "Version of psgml package.") | 54 "Version of psgml package.") |
55 | 55 |
56 (defconst psgml-maintainer-address "lenst@lysator.liu.se") | 56 (defconst psgml-maintainer-address "lenst@lysator.liu.se") |
57 | 57 |
58 (require 'cl) | 58 (require 'cl) |
59 (require 'easymenu) | |
59 | 60 |
60 (defvar sgml-debug nil) | 61 (defvar sgml-debug nil) |
61 | 62 |
62 (defmacro sgml-debug (&rest x) | 63 (defmacro sgml-debug (&rest x) |
63 (list 'if 'sgml-debug (cons 'sgml-log-message x))) | 64 (list 'if 'sgml-debug (cons 'sgml-log-message x))) |
67 | 68 |
68 (defvar sgml-mode-abbrev-table nil | 69 (defvar sgml-mode-abbrev-table nil |
69 "Abbrev table in use in sgml-mode.") | 70 "Abbrev table in use in sgml-mode.") |
70 (define-abbrev-table 'sgml-mode-abbrev-table ()) | 71 (define-abbrev-table 'sgml-mode-abbrev-table ()) |
71 | 72 |
73 ;;; Wing addition | |
72 (defvar sgml-mode-syntax-table nil | 74 (defvar sgml-mode-syntax-table nil |
73 "Syntax table used in sgml mode.") | 75 "Syntax table used in sgml mode.") |
74 | 76 |
75 (if sgml-mode-syntax-table | 77 (if sgml-mode-syntax-table |
76 () | 78 () |
243 of an inserted element.") | 245 of an inserted element.") |
244 | 246 |
245 (defvar sgml-balanced-tag-edit t | 247 (defvar sgml-balanced-tag-edit t |
246 "*If non-nil, always insert start-end tag pairs.") | 248 "*If non-nil, always insert start-end tag pairs.") |
247 | 249 |
248 (defvar sgml-omittag-transparent (not sgml-balanced-tag-edit) | 250 (defvar sgml-omittag-transparent (not sgml-balanced-tag-edit) ;; wing change |
249 "*If non-nil, will show legal tags inside elements with omittable start tags | 251 "*If non-nil, will show legal tags inside elements with omittable start tags |
250 and legal tags beyond omittable end tags.") | 252 and legal tags beyond omittable end tags.") |
251 | 253 |
252 (defvar sgml-leave-point-after-insert nil | 254 (defvar sgml-leave-point-after-insert nil |
253 "*If non-nil, the point will remain after inserted tag(s). | 255 "*If non-nil, the point will remain after inserted tag(s). |
273 `nil'.") | 275 `nil'.") |
274 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil) | 276 (put 'sgml-recompile-out-of-date-cdtd 'sgml-type '(("No" . nil) |
275 ("Yes" . t) | 277 ("Yes" . t) |
276 ("Ask" . ask))) | 278 ("Ask" . ask))) |
277 | 279 |
280 (defvar sgml-trace-entity-lookup nil | |
281 "*If non-nil, log messages about catalog files used to look for | |
282 external entities.") | |
283 | |
278 (defvar sgml-indent-step 2 | 284 (defvar sgml-indent-step 2 |
279 "*How much to increment indent for every element level. | 285 "*How much to increment indent for every element level. |
280 If nil, no indentation. | 286 If nil, no indentation. |
281 Setting this variable automatically makes it local to the current buffer.") | 287 Setting this variable automatically makes it local to the current buffer.") |
282 (make-variable-buffer-local 'sgml-indent-step) | 288 (make-variable-buffer-local 'sgml-indent-step) |
285 (defvar sgml-indent-data nil | 291 (defvar sgml-indent-data nil |
286 "*If non-nil, indent in data/mixed context also. | 292 "*If non-nil, indent in data/mixed context also. |
287 Setting this variable automatically makes it local to the current buffer.") | 293 Setting this variable automatically makes it local to the current buffer.") |
288 (make-variable-buffer-local 'sgml-indent-data) | 294 (make-variable-buffer-local 'sgml-indent-data) |
289 | 295 |
296 ;;; Wing addition | |
290 (defvar sgml-inhibit-indent-tags nil | 297 (defvar sgml-inhibit-indent-tags nil |
291 "*List of tags within which indentation is inhibited. | 298 "*List of tags within which indentation is inhibited. |
292 The tags should be given as strings.") | 299 The tags should be given as strings.") |
293 | 300 |
294 (defvar sgml-data-directory (expand-file-name "sgml" data-directory) | 301 (defvar sgml-data-directory (expand-file-name "sgml" data-directory) |
295 "*Directory for pre-supplied data files (DTD's and such). | 302 "*Directory for pre-supplied data files (DTD's and such). |
296 Set this before loading psgml.") | 303 Set this before loading psgml.") |
297 | 304 |
298 (defvar sgml-system-path nil | 305 (defvar sgml-system-path nil |
306 ;; wing addition | |
299 "*List of directories used to look for system identifiers. | 307 "*List of directories used to look for system identifiers. |
300 The directory listed in `sgml-data-directory' is always searched in | 308 The directory listed in `sgml-data-directory' is always searched in |
301 addition to the directories listed here.") | 309 addition to the directories listed here.") |
302 (put 'sgml-system-path 'sgml-type 'list) | 310 (put 'sgml-system-path 'sgml-type 'list) |
303 | 311 |
304 (defun sgml-parse-colon-path (cd-path) | 312 (defun sgml-parse-colon-path (cd-path) |
305 "Explode a colon-separated list of paths into a string list." | 313 "Explode a colon-separated list of paths into a string list." |
306 (let (cd-prefix cd-list (cd-start 0) cd-colon) | 314 (let (cd-list (cd-start 0) cd-colon) |
307 (setq cd-path (concat cd-path ":")) | 315 (setq cd-path (concat cd-path ":")) |
308 (while (setq cd-colon (string-match ":" cd-path cd-start)) | 316 (while (setq cd-colon (string-match ":" cd-path cd-start)) |
309 (setq cd-list | 317 (setq cd-list |
310 (nconc cd-list | 318 (nconc cd-list |
311 (list (if (= cd-start cd-colon) | 319 (list (if (= cd-start cd-colon) |
315 (setq cd-start (+ cd-colon 1))) | 323 (setq cd-start (+ cd-colon 1))) |
316 cd-list)) | 324 cd-list)) |
317 | 325 |
318 (defvar sgml-public-map (sgml-parse-colon-path | 326 (defvar sgml-public-map (sgml-parse-colon-path |
319 (or (getenv "SGML_PATH") | 327 (or (getenv "SGML_PATH") |
328 ;; Wing change | |
320 (concat "%S:" (directory-file-name | 329 (concat "%S:" (directory-file-name |
321 sgml-data-directory) | 330 sgml-data-directory) |
322 "%o/%c/%d"))) | 331 "%o/%c/%d"))) |
323 | 332 |
324 "*Mapping from public identifiers to file names. | 333 "*Mapping from public identifiers to file names. |
343 (make-variable-buffer-local 'sgml-local-catalogs) | 352 (make-variable-buffer-local 'sgml-local-catalogs) |
344 (put 'sgml-local-catalogs 'sgml-type 'list) | 353 (put 'sgml-local-catalogs 'sgml-type 'list) |
345 | 354 |
346 (defvar sgml-catalog-files (sgml-parse-colon-path | 355 (defvar sgml-catalog-files (sgml-parse-colon-path |
347 (or (getenv "SGML_CATALOG_FILES") | 356 (or (getenv "SGML_CATALOG_FILES") |
357 ;; Wing addition | |
348 (concat "CATALOG:" | 358 (concat "CATALOG:" |
349 (expand-file-name | 359 (expand-file-name |
350 "CATALOG" | 360 "CATALOG" |
351 sgml-data-directory)))) | 361 sgml-data-directory)))) |
352 "*List of catalog entry files. | 362 "*List of catalog entry files. |
353 The files are in the format defined in the SGML Open Draft Technical | 363 The files are in the format defined in the SGML Open Draft Technical |
354 Resolution on Entity Management.") | 364 Resolution on Entity Management.") |
355 (put 'sgml-catalog-files 'sgml-type 'list) | 365 (put 'sgml-catalog-files 'sgml-type 'list) |
356 | 366 |
367 ;;; Wing addition | |
357 (defvar sgml-ecat-files (list | 368 (defvar sgml-ecat-files (list |
358 "ECAT" | 369 "ECAT" |
359 "~/sgml/ECAT" | 370 "~/sgml/ECAT" |
360 (expand-file-name "ECAT" sgml-data-directory)) | 371 (expand-file-name "ECAT" sgml-data-directory)) |
361 "*List of catalog files for PSGML.") | 372 "*List of catalog files for PSGML.") |
440 ;;; sgmls is a free SGML parser available from | 451 ;;; sgmls is a free SGML parser available from |
441 ;;; ftp.uu.net:pub/text-processing/sgml | 452 ;;; ftp.uu.net:pub/text-processing/sgml |
442 ;;; Its error messages can be parsed by next-error. | 453 ;;; Its error messages can be parsed by next-error. |
443 ;;; The -s option suppresses output. | 454 ;;; The -s option suppresses output. |
444 | 455 |
445 (defvar sgml-validate-command "sgmls -s %s %s" | 456 (defvar sgml-validate-command "nsgmls -s %s %s" |
446 "*The shell command to validate an SGML document. | 457 "*The shell command to validate an SGML document. |
447 | 458 |
448 This is a `format' control string that by default should contain two | 459 This is a `format' control string that by default should contain two |
449 `%s' conversion specifications: the first will be replaced by the | 460 `%s' conversion specifications: the first will be replaced by the |
450 value of `sgml-declaration' \(or the empty string, if nil\); the | 461 value of `sgml-declaration' \(or the empty string, if nil\); the |
468 "If non-nil, a function of no arguments that returns a list of file names. | 479 "If non-nil, a function of no arguments that returns a list of file names. |
469 These file names will serve as the arguments to the `sgml-validate-command' | 480 These file names will serve as the arguments to the `sgml-validate-command' |
470 format control string instead of the defaults.") | 481 format control string instead of the defaults.") |
471 | 482 |
472 (defvar sgml-validate-error-regexps | 483 (defvar sgml-validate-error-regexps |
473 '(("\\(error\\|warning\\) at \\([^,]+\\), line \\([0-9]+\\)" 2 3) | 484 '((":\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):[EX]: " 1 2 3) |
474 ("^\\(.+\\):\\([0-9]+\\):\\([0-9]+\\):E: " 1 2 3)) | 485 ("\\(error\\|warning\\) at \\([^,]+\\), line \\([0-9]+\\)" 2 3) |
486 ("\n[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\ | |
487 \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4)) | |
475 "Alist of regexps to recognize error messages from `sgml-validate'. | 488 "Alist of regexps to recognize error messages from `sgml-validate'. |
476 See `compilation-error-regexp-alist'.") | 489 See `compilation-error-regexp-alist'.") |
477 | 490 |
478 (defvar sgml-declaration nil | 491 (defvar sgml-declaration nil |
479 "*If non-nil, this is the name of the SGML declaration file.") | 492 "*If non-nil, this is the name of the SGML declaration file.") |
510 sgml-normalize-trims | 523 sgml-normalize-trims |
511 sgml-auto-insert-required-elements | 524 sgml-auto-insert-required-elements |
512 sgml-balanced-tag-edit | 525 sgml-balanced-tag-edit |
513 sgml-omittag-transparent | 526 sgml-omittag-transparent |
514 sgml-leave-point-after-insert | 527 sgml-leave-point-after-insert |
528 sgml-insert-missing-element-comment | |
529 sgml-insert-end-tag-on-new-line | |
515 sgml-warn-about-undefined-elements | 530 sgml-warn-about-undefined-elements |
516 sgml-warn-about-undefined-entities | 531 sgml-warn-about-undefined-entities |
517 sgml-ignore-undefined-elements | 532 sgml-ignore-undefined-elements |
518 sgml-recompile-out-of-date-cdtd | 533 sgml-recompile-out-of-date-cdtd |
519 sgml-default-doctype-name | 534 sgml-default-doctype-name |
520 sgml-declaration | 535 sgml-declaration |
521 sgml-validate-command | 536 sgml-validate-command |
522 sgml-markup-faces | 537 sgml-markup-faces |
523 sgml-system-identifiers-are-preferred | 538 sgml-system-identifiers-are-preferred |
539 sgml-trace-entity-lookup | |
524 sgml-system-path | 540 sgml-system-path |
525 sgml-public-map | 541 sgml-public-map |
526 sgml-catalog-files | 542 sgml-catalog-files |
527 sgml-ecat-files | 543 sgml-ecat-files |
528 ) | 544 ) |
608 t)))) | 624 t)))) |
609 | 625 |
610 (defun sgml-save-options () | 626 (defun sgml-save-options () |
611 "Save user options for sgml-mode that have buffer local values." | 627 "Save user options for sgml-mode that have buffer local values." |
612 (interactive) | 628 (interactive) |
613 (let ((l sgml-file-options)) | 629 (loop for var in sgml-file-options do |
614 (loop for var in sgml-file-options do | 630 (when (sgml-valid-option var) |
615 (when (sgml-valid-option var) | 631 (sgml-set-local-variable var (symbol-value var))))) |
616 (sgml-set-local-variable var (symbol-value var)))))) | |
617 | 632 |
618 | 633 |
619 ;;;; Run hook with args | 634 ;;;; Run hook with args |
620 | 635 |
621 (unless (fboundp 'run-hook-with-args) | 636 (unless (fboundp 'run-hook-with-args) |
793 ;;(define-key sgml-mode-map [?\M-\C-\ ] 'sgml-mark-element) | 808 ;;(define-key sgml-mode-map [?\M-\C-\ ] 'sgml-mark-element) |
794 (define-key sgml-mode-map "\e\C-h" 'sgml-mark-current-element) | 809 (define-key sgml-mode-map "\e\C-h" 'sgml-mark-current-element) |
795 (define-key sgml-mode-map "\e\C-t" 'sgml-transpose-element) | 810 (define-key sgml-mode-map "\e\C-t" 'sgml-transpose-element) |
796 (define-key sgml-mode-map "\M-\t" 'sgml-complete) | 811 (define-key sgml-mode-map "\M-\t" 'sgml-complete) |
797 | 812 |
798 ;;; Menu bar | 813 ;;;; Menu bar |
799 | 814 |
800 (eval-when-compile | 815 (easy-menu-define |
801 (autoload 'sgml-build-custom-menus "psgml-other")) ; Avoid compiler warnings | 816 sgml-dtd-menu sgml-mode-map "DTD menu" |
802 | 817 '("DTD")) |
803 ;; load menu file at the end | 818 |
819 (defconst sgml-dtd-root-menu | |
820 '("DTD" | |
821 ["Parse DTD" sgml-parse-prolog t] | |
822 ("Info" | |
823 ["General DTD info" sgml-general-dtd-info t] | |
824 ["Describe element type" sgml-describe-element-type t] | |
825 ["Describe entity" sgml-describe-entity t] | |
826 ["List elements" sgml-list-elements t] | |
827 ["List attributes" sgml-list-attributes t] | |
828 ["List terminals" sgml-list-terminals t] | |
829 ["List content elements" sgml-list-content-elements t] | |
830 ["List occur in elements" sgml-list-occur-in-elements t] | |
831 ) | |
832 "--" | |
833 ["Load Parsed DTD" sgml-load-dtd t] | |
834 ["Save Parsed DTD" sgml-save-dtd t] | |
835 )) | |
836 | |
837 (easy-menu-define | |
838 sgml-view-menu sgml-mode-map "View menu" | |
839 '("View" | |
840 ["Fold Element" sgml-fold-element t] | |
841 ["Fold Subelement" sgml-fold-subelement t] | |
842 ["Unfold Line" sgml-unfold-line t] | |
843 ["Unfold Element" sgml-unfold-element t] | |
844 ["Expand" sgml-expand-element t] | |
845 ["Fold Region" sgml-fold-region t] | |
846 ["Unfold All" sgml-unfold-all t] | |
847 ["Hide Tags" sgml-hide-tags t] | |
848 ["Hide Attributes" sgml-hide-attributes t] | |
849 ["Show All Tags" sgml-show-tags t] | |
850 ) | |
851 ) | |
852 | |
853 | |
854 (defconst sgml-markup-root-menu | |
855 '("Markup" | |
856 ["Insert Element" sgml-element-menu t] | |
857 ["Insert Start-Tag" sgml-start-tag-menu t] | |
858 ["Insert End-Tag" sgml-end-tag-menu t] | |
859 ["Tag Region" sgml-tag-region-menu t] | |
860 ["Insert Attribute" sgml-attrib-menu t] | |
861 ["Insert Entity" sgml-entities-menu t] | |
862 )) | |
863 | |
864 (easy-menu-define | |
865 sgml-markup-menu sgml-mode-map "Markup menu" | |
866 sgml-markup-root-menu) | |
867 | |
868 (easy-menu-define | |
869 sgml-move-menu sgml-mode-map "Menu of move commands" | |
870 '("Move" | |
871 ["Next trouble spot" sgml-next-trouble-spot t] | |
872 ["Next data field" sgml-next-data-field t] | |
873 ["Forward element" sgml-forward-element t] | |
874 ["Backward element" sgml-backward-element t] | |
875 ["Up element" sgml-up-element t] | |
876 ["Down element" sgml-down-element t] | |
877 ["Backward up element" sgml-backward-up-element t] | |
878 ["Beginning of element" sgml-beginning-of-element t] | |
879 ["End of element" sgml-end-of-element t] | |
880 )) | |
881 | |
882 (easy-menu-define | |
883 sgml-modify-menu sgml-mode-map "Menu of modification commands" | |
884 '("Modify" | |
885 ["Normalize" sgml-normalize t] | |
886 ["Expand All Short References" sgml-expand-all-shortrefs t] | |
887 ["Expand Entity Reference" sgml-expand-entity-reference t] | |
888 ["Normalize Element" sgml-normalize-element t] | |
889 ["Make Character Reference" sgml-make-character-reference t] | |
890 ["Unmake Character Reference" (sgml-make-character-reference t) t] | |
891 ["Fill Element" sgml-fill-element t] | |
892 ["Change Element Name..." sgml-change-element-name t] | |
893 ["Edit Attributes..." sgml-edit-attributes t] | |
894 ["Kill Markup" sgml-kill-markup t] | |
895 ["Kill Element" sgml-kill-element t] | |
896 ["Untag Element" sgml-untag-element t] | |
897 ["Trim and leave element" sgml-trim-and-leave-element t] | |
898 ["Decode Character Entities" sgml-charent-to-display-char t] | |
899 ["Encode Characters" sgml-display-char-to-charent t] | |
900 ) | |
901 ) | |
902 | |
903 (easy-menu-define | |
904 sgml-main-menu sgml-mode-map "Main menu" | |
905 '("SGML" | |
906 ["Reset Buffer" normal-mode t] | |
907 ["End Element" sgml-insert-end-tag t] | |
908 ["Show Context" sgml-show-context t] | |
909 ["What Element" sgml-what-element t] | |
910 ["List Valid Tags" sgml-list-valid-tags t] | |
911 ["Show/Hide Warning Log" sgml-show-or-clear-log t] | |
912 ["Validate" sgml-validate t] | |
913 ["File Options >" sgml-file-options-menu t] | |
914 ["User Options >" sgml-user-options-menu t] | |
915 ["Save File Options" sgml-save-options t] | |
916 ["Submit Bug Report" sgml-submit-bug-report t] | |
917 ) | |
918 ) | |
919 | |
920 | |
921 (defun sgml-build-custom-menus () | |
922 "Build custom parts of Markup and DTD menus." | |
923 (let ((button3 (lookup-key (current-local-map) [button3]))) | |
924 (easy-menu-define | |
925 sgml-markup-menu sgml-mode-map "Markup menu" | |
926 (append sgml-markup-root-menu | |
927 (list "----") | |
928 (loop for e in sgml-custom-markup collect | |
929 (vector (first e) | |
930 (` (sgml-insert-markup (, (cadr e)))) | |
931 t)))) | |
932 (easy-menu-define | |
933 sgml-dtd-menu sgml-mode-map "DTD menu" | |
934 (append sgml-dtd-root-menu | |
935 (list "----") | |
936 (loop for e in sgml-custom-dtd collect | |
937 (vector (first e) | |
938 (` (sgml-doctype-insert (, (cadr e)) | |
939 '(, (cddr e)))) | |
940 t)))) | |
941 (unless (or (null button3) | |
942 (numberp button3)) | |
943 (local-set-key [button3] button3)))) | |
944 | |
804 | 945 |
805 ;;;; Post command hook | 946 ;;;; Post command hook |
806 | 947 |
807 (defvar sgml-auto-activate-dtd-tried nil) | 948 (defvar sgml-auto-activate-dtd-tried nil) |
808 (make-variable-buffer-local 'sgml-auto-activate-dtd-tried) | 949 (make-variable-buffer-local 'sgml-auto-activate-dtd-tried) |
813 the information about the DTD and the parse tree. This parse state is | 954 the information about the DTD and the parse tree. This parse state is |
814 actually only the state that persists between commands.") | 955 actually only the state that persists between commands.") |
815 (make-variable-buffer-local 'sgml-buffer-parse-state) | 956 (make-variable-buffer-local 'sgml-buffer-parse-state) |
816 | 957 |
817 (eval-and-compile ; Interface to psgml-parse | 958 (eval-and-compile ; Interface to psgml-parse |
818 (loop for fun in '(sgml-need-dtd sgml-update-display sgml-subst-expand | 959 (loop for fun in '(sgml-need-dtd sgml-update-display |
960 sgml-fontify-buffer | |
961 sgml-subst-expand | |
819 sgml-declaration) | 962 sgml-declaration) |
820 do (autoload fun "psgml-parse"))) | 963 do (autoload fun "psgml-parse"))) |
821 | 964 |
822 | 965 |
823 (defun sgml-command-post () | 966 (defun sgml-command-post () |
826 sgml-auto-activate-dtd | 969 sgml-auto-activate-dtd |
827 (null sgml-auto-activate-dtd-tried) | 970 (null sgml-auto-activate-dtd-tried) |
828 (not (zerop (buffer-size))) | 971 (not (zerop (buffer-size))) |
829 (looking-at ".*<")) | 972 (looking-at ".*<")) |
830 (setq sgml-auto-activate-dtd-tried t) | 973 (setq sgml-auto-activate-dtd-tried t) |
831 (sgml-need-dtd)) | 974 (sgml-need-dtd) |
975 (sgml-fontify-buffer 0)) | |
832 (when sgml-buffer-parse-state | 976 (when sgml-buffer-parse-state |
833 (sgml-update-display)))) | 977 (sgml-update-display)))) |
834 | 978 |
835 | 979 |
836 ;;;; SGML mode: major mode definition | 980 ;;;; SGML mode: major mode definition |
951 (when (setq sgml-default-dtd-file (sgml-default-dtd-file)) | 1095 (when (setq sgml-default-dtd-file (sgml-default-dtd-file)) |
952 (unless (file-exists-p sgml-default-dtd-file) | 1096 (unless (file-exists-p sgml-default-dtd-file) |
953 (setq sgml-default-dtd-file nil))) | 1097 (setq sgml-default-dtd-file nil))) |
954 (add-hook 'post-command-hook 'sgml-command-post 'append) | 1098 (add-hook 'post-command-hook 'sgml-command-post 'append) |
955 (run-hooks 'text-mode-hook 'sgml-mode-hook) | 1099 (run-hooks 'text-mode-hook 'sgml-mode-hook) |
956 (sgml-build-custom-menus)) | 1100 (sgml-build-custom-menus) |
1101 (easy-menu-add sgml-main-menu) | |
1102 (easy-menu-add sgml-modify-menu) | |
1103 (easy-menu-add sgml-move-menu) | |
1104 (easy-menu-add sgml-markup-menu) | |
1105 (easy-menu-add sgml-view-menu) | |
1106 (easy-menu-add sgml-dtd-menu)) | |
957 | 1107 |
958 (defun sgml-default-dtd-file () | 1108 (defun sgml-default-dtd-file () |
959 (and (buffer-file-name) | 1109 (and (buffer-file-name) |
960 (let ((base (file-name-nondirectory (buffer-file-name)))) | 1110 (let ((base (file-name-nondirectory (buffer-file-name)))) |
961 (concat | 1111 (concat |
1160 | 1310 |
1161 (autoload 'sgml-doctype-insert "psgml-edit" | 1311 (autoload 'sgml-doctype-insert "psgml-edit" |
1162 nil | 1312 nil |
1163 nil nil) | 1313 nil nil) |
1164 (autoload 'sgml-indent-line "psgml-edit" nil) | 1314 (autoload 'sgml-indent-line "psgml-edit" nil) |
1315 (autoload 'sgml-element-endable-p "psgml-edit" nil) | |
1165 | 1316 |
1166 ;;; Generated by sgml-build-autoloads | 1317 ;;; Generated by sgml-build-autoloads |
1167 | 1318 |
1168 (autoload 'sgml-load-dtd "psgml-parse" "Load a saved DTD from FILE." t) | 1319 (autoload 'sgml-load-dtd "psgml-parse" "Load a saved DTD from FILE." t) |
1169 (autoload 'sgml-show-or-clear-log "psgml-parse" "Show the *SGML LOG* buffer if it is not showing, or clear and | 1320 (autoload 'sgml-show-or-clear-log "psgml-parse" "Show the *SGML LOG* buffer if it is not showing, or clear and |
1292 (provide 'psgml) | 1443 (provide 'psgml) |
1293 (provide 'sgml-mode) | 1444 (provide 'sgml-mode) |
1294 | 1445 |
1295 (cond | 1446 (cond |
1296 (sgml-running-xemacs | 1447 (sgml-running-xemacs |
1297 (require 'psgml-xemacs) | 1448 (require 'psgml-xemacs)) |
1298 (add-hook 'sgml-mode-hook 'sgml-install-xemacs-menus)) | |
1299 (t | 1449 (t |
1300 (require 'psgml-other))) | 1450 (require 'psgml-other))) |
1301 | 1451 |
1302 ;;; psgml.el ends HERE | 1452 ;;; psgml.el ends HERE |