[7086] in www-talk@info.cern.ch

home help back first fref pref prev next nref lref last post

a few small improvements to emacs for editing HTM

daemon@ATHENA.MIT.EDU (Jim Davis)
Sat Dec 31 19:39:40 1994

Date: Sun, 1 Jan 1995 01:32:34 +0100
Errors-To: listmaster@www0.cern.ch
Reply-To: davis@DRI.cornell.edu
From: Jim Davis <davis@DRI.cornell.edu>
To: Multiple recipients of list <www-talk@www0.cern.ch>

If you use Emacs to edit HTML (yes, I know, that's old fashioned but
hey I'm old) then here are a few of changes that might make life
easier for you.

1) (setq paragraph-start "^$\\|^^L\\|^ *<P>\\|^<BLOCKQUOTE>\\|^<DD>")
so that when you fill paragraphs it won't rearrange across
structural boundaries.  I know this list should include more
tags than this but these are the ones that I notice the most.

2) Modify ispell.el (you do spell check your documents don't you?)
to ignore HTML tags.  attached below is a diff for ispell 2.30

3) use html-mode.el.  I have also modified this to provide a small
amount of font hackery, not really WYSIWYG but still helpful.

See ftp://dri.cornell.edu/pub/davis for
  ispell.el 2.31
  ispell.diffs context diffs from 2.30 to 2.31, also attached below
  html-mode.el 2.3

Best wishes.  ps today is John von Neumann's birthday.

----------------------------------------------
*** /usr/local/gnu/src/emacs-19.25/lisp/ispell.el	Sat May 28 03:22:11 1994
--- bin/emacs/ispell.el	Wed Dec 28 12:30:56 1994
***************
*** 6,14 ****
  ;;;
  ;;;
  ;;; Authors         : Ken Stevens et. al.
! ;;; Last Modified By: Ken Stevens <k.stevens@ieee.org>
! ;;; Last Modified On: Fri May 20 15:58:52 MDT 1994
! ;;; Update Revision : 2.30
  ;;; Syntax          : emacs-lisp
  ;;; Status	    : Release with 3.1.05 ispell.
  ;;; Version	    : International Ispell Version 3.1 by Geoff Kuenning.
--- 6,14 ----
  ;;;
  ;;;
  ;;; Authors         : Ken Stevens et. al.
! ;;; Last Modified By: Jim Davis
! ;;; Last Modified On: Wed Dec 28 1994
! ;;; Update Revision : 2.31
  ;;; Syntax          : emacs-lisp
  ;;; Status	    : Release with 3.1.05 ispell.
  ;;; Version	    : International Ispell Version 3.1 by Geoff Kuenning.
***************
*** 130,135 ****
--- 130,138 ----
  ;;;
  ;;; HISTORY
  ;;;
+ ;;; Revision 2.31  1994/12/28 12:28:00 Jim Davis (davis@dri.cornell.edu)
+ ;;; add ispell-skip-sgml-tags (to not check spelling inside SGML tags)
+ ;;;
  ;;; Revision 2.30  1994/5/20 15:58:52  stevens
  ;;; Continue ispell from ispell-word, C-z functionality fixed.
  ;;;
***************
*** 320,325 ****
--- 323,331 ----
  (defvar ispell-tib-ref-end "\\.[]>]"
    "Regexp matching the end of a Tib reference.")
  
+ (defvar ispell-skip-sgml-tags nil
+   "Does not spell check anything enclosed within angle brackets")
+ 
  (defvar ispell-keep-choices-win t
    "*When not nil, the `*Choices*' window remains for spelling session.
  This minimizes redisplay thrashing.")
***************
*** 1513,1518 ****
--- 1519,1525 ----
  
  ;;; Spelling of comments are checked when ispell-check-comments is non-nil.
  
+ 
  ;;;###autoload
  (defun ispell-region (reg-start reg-end)
    "Interactively check a region for spelling errors."
***************
*** 1603,1608 ****
--- 1610,1640 ----
  				(concat "^" (buffer-substring start limit)
  					"\n")))
  		      (goto-char limit))))
+ 
+ 		 ((and ispell-skip-sgml-tags
+ 		       (search-forward "<" end t))
+ 		  (if (= (- (point) 1) start) 
+ 		      ;; Skip to end of tag, not necessarily on this line.
+ 		      ;; Return an error if tib ref not found
+ 		      (if (not (search-forward ">" reg-end t))
+ 			  (progn
+ 			    (ispell-pdict-save ispell-silently-savep)
+ 			    (ding)
+ 			    (message
+ 			     (concat
+ 			      "unbalanced SGML tag.  Fix it or set "
+ 			      "`ispell-skip-sgml-tags' to nil"))
+ 			    ;; keep cursor at error location
+ 			    (setq ispell-quit (- (point) 1))))
+ 		    (let ((limit (- (point) 1)))
+ 		      (goto-char start)
+ 		      (if (or (re-search-forward ispell-casechars limit t)
+ 			      (re-search-forward "[][()$]" limit t))
+ 			  (setq string
+ 				(concat "^" (buffer-substring start limit)
+ 					"\n")))
+ 		      (goto-char limit))))
+ 
  		 ((looking-at "[---#@*+!%~^]") ; SKIP SPECIAL ISPELL CHARACTERS
  		  (forward-char 1))
  		 ((or (re-search-forward ispell-casechars end t) ; TEXT EXISTS

home help back first fref pref prev next nref lref last post