comparison lisp/psgml/psgml-html.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 56c54cf7c5b6
children ac0620f6398e
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details. 17 ;; General Public License for more details.
18 18
19 ;; You should have received a copy of the GNU General Public License 19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the 20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 ;; Boston, MA 02111-1307, USA.
23 22
24 ;;; Synched up with: FSF 19.30. 23 ;;; Synched up with: FSF 19.30.
25 24
26 ;;; Author: Ben Wing. 25 ;;; Author: Ben Wing.
27 26
28 ;;; Commentary: 27 ;;; Commentary:
29 28
30 ; Parts were taken from html-helper-mode and from code by Alastair Burt. 29 ; Parts were taken from html-helper-mode and from code by Alastair Burt.
31 30
32 ; If you'd like to use the hm--html-minor-mode together with this
33 ; mode, you have to put the following line to your ~/.emacs:
34 ; (add-hook 'html-mode-hook 'hm--html-minor-mode)
35
36 ;;; Code: 31 ;;; Code:
37
38 (defvar html-auto-sgml-entity-conversion nil
39 "*Control automatic sgml entity to ISO-8859-1 conversion")
40 32
41 (require 'psgml) 33 (require 'psgml)
42 (require 'derived) 34 (require 'derived)
43 (when html-auto-sgml-entity-conversion 35 (require 'iso-sgml)
44 (require 'iso-sgml))
45 (require 'tempo) ;essential part of html-helper-mode 36 (require 'tempo) ;essential part of html-helper-mode
46 37
47 ;;{{{ user variables 38 ;;{{{ user variables
48 39
49 ;; Set this to be whatever signature you want on the bottom of your pages. 40 ;; Set this to be whatever signature you want on the bottom of your pages.
73 " <head>\n" 64 " <head>\n"
74 " <title>" (p "Document Title: " title) "</title>\n" 65 " <title>" (p "Document Title: " title) "</title>\n"
75 " </head>\n" 66 " </head>\n"
76 "\n" 67 "\n"
77 " <body>\n" 68 " <body>\n"
78 " <h1>" (s title) "</h1>\n\n" 69 " <h1>" (s title) "</h1>\n\n"
79 p 70 p
80 "\n\n <hr>\n" 71 "\n\n <hr>\n"
81 " <address>" html-helper-address-string "</address>\n" 72 " <address>" html-helper-address-string "</address>\n"
82 (html-helper-return-created-string) 73 (html-helper-return-created-string)
83 html-helper-timestamp-start 74 html-helper-timestamp-start
84 html-helper-timestamp-end 75 html-helper-timestamp-end
85 "\n </body>\n</html>\n") 76 "\n </body>\n</html>\n")
86 "*Template for new buffers. 77 "*Template for new buffers.
151 142
152 (define-derived-mode html-mode sgml-mode "HTML" 143 (define-derived-mode html-mode sgml-mode "HTML"
153 "Major mode for editing HTML documents. 144 "Major mode for editing HTML documents.
154 This is based on PSGML mode, and has a sophisticated SGML parser in it. 145 This is based on PSGML mode, and has a sophisticated SGML parser in it.
155 It knows how to properly indent HTML/SGML documents, and it can do 146 It knows how to properly indent HTML/SGML documents, and it can do
156 a form of document validation (use \\[sgml-next-trouble-spot] to find 147 a form of document validation (use \\[sgml-next-trouble-spot\\] to find
157 the next error in your document). 148 the next error in your document).
158 Commands beginning with C-z insert various types of HTML tags 149 Commands beginning with C-z insert various types of HTML tags
159 (prompting for the required information); to iconify or suspend, 150 (prompting for the required information); to iconify or suspend,
160 use C-z C-z. 151 use C-z C-z.
161 To literally insert special characters such as < and &, use C-c followed 152 To literally insert special characters such as < and &, use C-c followed
205 (if (and html-helper-build-new-buffer (zerop (buffer-size))) 196 (if (and html-helper-build-new-buffer (zerop (buffer-size)))
206 (html-helper-insert-new-buffer-strings)) 197 (html-helper-insert-new-buffer-strings))
207 198
208 (set (make-local-variable 'sgml-custom-markup) 199 (set (make-local-variable 'sgml-custom-markup)
209 '(("<A>" "<A HREF=\"\">\r</a>"))) 200 '(("<A>" "<A HREF=\"\">\r</a>")))
210
211 ;; Set up the syntax table.
212 (modify-syntax-entry ?< "(>" html-mode-syntax-table)
213 (modify-syntax-entry ?> ")<" html-mode-syntax-table)
214 (modify-syntax-entry ?\" ". " html-mode-syntax-table)
215 (modify-syntax-entry ?\\ ". " html-mode-syntax-table)
216 (modify-syntax-entry ?' "w " html-mode-syntax-table)
217
218 ; sigh ... need to call this now to get things working. 201 ; sigh ... need to call this now to get things working.
219 (sgml-build-custom-menus) 202 (sgml-build-custom-menus)
220 (add-submenu nil sgml-html-menu "SGML") 203 (add-submenu nil sgml-html-menu "SGML")
221 (delete-menu-item '("SGML"))) 204 (delete-menu-item '("SGML")))
222 205