home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / alt / lucidem / help / 703 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.8 KB  |  52 lines

  1. Newsgroups: alt.lucid-emacs.help
  2. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!malgudi.oar.net!chemabs!zfs60
  3. From: zfs60@cas.org (Zhiyong John Shen)
  4. Subject: ispell dies when line is too long
  5. In-Reply-To: zfs60@cas.org's message of Tue, 17 Nov 1992 23:32:53 GMT
  6. Message-ID: <ZFS60.92Nov18085025@zfs60mws.cas.org>
  7. Sender: usenet@cas.org
  8. Organization: Chemical Abstracts Service, Columbus, Ohio
  9. References: <1992Nov17.222650.22439@ntmtv> <ZFS60.92Nov17183253@zfs60mws.cas.org>
  10. Date: Wed, 18 Nov 1992 13:50:25 GMT
  11. Lines: 39
  12.  
  13. since several other readers of the group asked me to post things if i
  14. find a cure, i will put my temporary and partial workaround here, in
  15. the hope that a better solution will be found by a better elisper.
  16.  
  17. here it is, it simply splits the line (and insert a backslash to mark
  18. it), i did not bother to reconnect the split lines after ispell-buffer
  19. because my application does not need reconnection, but it should be
  20. fairly easy to do so.
  21.  
  22. it seems to work for me, but any criticism and/or improvement would be
  23. greatly appreciate, as i am not very good at making lisp codes tight
  24. or efficient.
  25.  
  26. ;;;
  27. ;;; written by zhiyong "john" shen, but all gnu claims apply
  28. ;;;
  29. (defun text-split-line ()
  30. "Split long text lines to make ispell happy."
  31. (goto-char (point-min))
  32. (while (not (eobp)) 
  33.   (beginning-of-line)
  34.   (if (eolp) (forward-line 1))
  35.   (setq counter 0)
  36.   (while (not (eolp))
  37.     (forward-char 1) 
  38.     (if (eolp) (progn (forward-line 1) (setq counter 0)))
  39.     (setq counter (1+ counter))
  40.     (if (> counter 250)
  41.       (progn (backward-word 1)
  42.         (insert-string "\\\012")
  43.         (forward-line 1) (beginning-of-line)
  44.         (setq counter 0))))
  45.   (end-of-line)))
  46.  
  47. (defun text-ispell-buffer ()
  48. "ispell the text buffer."
  49. (interactive)
  50. (text-split-line)
  51. (ispell-buffer))
  52.