[gnu.emacs] ispell questions -- syntax tables, my words file, et al

chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) (10/19/89)

I'm a recent convert to ispell, and now couldn't live without it. A few
questions, though -- the easy ones (?) first:


1. Capitalization in prompt

The offending word is capitalized in the mode-line prompt. Given ispell's
ability to distinguish case, this seems counter-productive/intuitive.


2. Second invocation of ispell doesn't seem to look at my words file

Works fine the first time (except for below), but the second time through
it doesn't seem to know my words. For example, it doesn't find my name.


3. Can't find <word> in original text -- Any key to continue

I sometimes get the above message, even though a simple search locates it.
This, however, may be a symptom of my messing around with the following
problem. 


4. Syntax table modifications 

Trying to use apostrophe (') and dash (-) as word chars for hyphenations, etc.
At best, it doesn't seem to acknowledge -- apostrophies, for example -- as word
chars (sees "didn" but not "didn't"); at worst, it seems to get lost,
complaining "Can't find <word> in orinal text -- Any key to continue"

I autoload ispell in my .emacs file, so when I modify the syntax table there,
is it trashed by the (defvar ispell-syntax-table) when the autoload is
activated? If not, then do I have to put the entire table initialization (0, 1,
..., 9, etc) in my .emacs?  I guess what I'd like/expect is an ispell-hook,
where I could just put
	(modify-syntax-entry ?' "w   " ispell-syntax-table)
	(modify-syntax-entry ?- "w " ispell-syntax-table) as per the
documentation in ispell.el. The alternative seems to be normal (*not* auto)
loading ispell initially, or duplication of effort in .emacs. And I'd prefer
not to modify ispell.el itself...

Below is the relevant portion of my .emacs, ripped off from ispell.el:

    (defvar ispell-syntax-table nil
      "*Syntax table used by ispell to find word boundaries.  You may change syntax
    entries to, say, allow ' and - to be part of words, or not, as you prefer.")

    (if (null ispell-syntax-table)
	(progn
	  (setq ispell-syntax-table (make-syntax-table))
	  (modify-syntax-entry ?' "w   " ispell-syntax-table)
	  (modify-syntax-entry ?- "w   " ispell-syntax-table)))

If ispell does not overwrite the table I just created, I assume that the other
table modifications are not applied either because of the test at the top of
the expression; from ispell.el:

    (if (null ispell-syntax-table)
	;; The following assumes that the standard-syntax-table
	;; is static.  If you add words with funky characters
	;; to your dictionary, the following may have to change.
	(progn
	  (setq ispell-syntax-table (make-syntax-table))
	  ;; Make certain characters word constituents
	  ;; (modify-syntax-entry ?' "w   " ispell-syntax-table)
	  ;; (modify-syntax-entry ?- "w   " ispell-syntax-table)
	  ;; Get rid on existing word syntax on certain characters 
	  (modify-syntax-entry ?0 ".   " ispell-syntax-table)
	  ...
	  (modify-syntax-entry ?9 ".   " ispell-syntax-table)
	  (modify-syntax-entry ?$ ".   " ispell-syntax-table)
	  (modify-syntax-entry ?% ".   " ispell-syntax-table)))

chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) (10/19/89)

[Retransmitted due to problem with EDDIE's mailer -- excuse any duplication.]


I'm a recent convert to ispell, and now couldn't live without it. A few
questions, though -- the easy ones (?) first:


1. Capitalization in prompt

The offending word is capitalized in the mode-line prompt. Given ispell's
ability to distinguish case, this seems counter-productive/intuitive.


2. Second invocation of ispell doesn't seem to look at my words file

Works fine the first time (except for below), but the second time through
it doesn't seem to know my words. For example, it doesn't find my name.


3. Can't find <word> in original text -- Any key to continue

I sometimes get the above message, even though a simple search locates it.
This, however, may be a symptom of my messing around with the following
problem. 


4. Syntax table modifications 

Trying to use apostrophe (') and dash (-) as word chars for hyphenations, etc.
At best, it doesn't seem to acknowledge -- apostrophies, for example -- as word
chars (sees "didn" but not "didn't"); at worst, it seems to get lost,
complaining "Can't find <word> in original text -- Any key to continue"

I autoload ispell in my .emacs file, so when I modify the syntax table there,
is it trashed by the (defvar ispell-syntax-table) when the autoload is
activated? If not, then do I have to put the entire table initialization (0, 1,
..., 9, etc) in my .emacs?  I guess what I'd like/expect is an ispell-hook,
where I could just put
	(modify-syntax-entry ?' "w   " ispell-syntax-table)
	(modify-syntax-entry ?- "w " ispell-syntax-table) as per the
documentation in ispell.el. The alternative seems to be normal (*not* auto)
loading ispell initially, or duplication of effort in .emacs. And I'd prefer
not to modify ispell.el itself...

Below is the relevant portion of my .emacs, ripped off from ispell.el:

    (defvar ispell-syntax-table nil
      "*Syntax table used by ispell to find word boundaries.  You may change syntax
    entries to, say, allow ' and - to be part of words, or not, as you prefer.")

    (if (null ispell-syntax-table)
	(progn
	  (setq ispell-syntax-table (make-syntax-table))
	  (modify-syntax-entry ?' "w   " ispell-syntax-table)
	  (modify-syntax-entry ?- "w   " ispell-syntax-table)))

If ispell does not overwrite the table I just created, I assume that the other
table modifications are not applied either because of the test at the top of
the expression; from ispell.el:

    (if (null ispell-syntax-table)
	;; The following assumes that the standard-syntax-table
	;; is static.  If you add words with funky characters
	;; to your dictionary, the following may have to change.
	(progn
	  (setq ispell-syntax-table (make-syntax-table))
	  ;; Make certain characters word constituents
	  ;; (modify-syntax-entry ?' "w   " ispell-syntax-table)
	  ;; (modify-syntax-entry ?- "w   " ispell-syntax-table)
	  ;; Get rid on existing word syntax on certain characters 
	  (modify-syntax-entry ?0 ".   " ispell-syntax-table)
	  ...
	  (modify-syntax-entry ?9 ".   " ispell-syntax-table)
	  (modify-syntax-entry ?$ ".   " ispell-syntax-table)
	  (modify-syntax-entry ?% ".   " ispell-syntax-table)))


Please send replies direct, unless this is a common question.
Thanks for your time.

-------------------------------------------------------------------------------
Internet: chris@asylum.gsfc.nasa.gov (128.183.10.155)       NASA/GSFC: Code 735
UUCP:     uunet!asylum.gsfc.nasa.gov!chris                  Greenbelt, MD 20771
SPAN:     PITCH::CHRIS (DECNET)                                    301-286-6093
===============================================================================

barry@joshua.math.ucla.edu (Barry Merriman) (10/19/89)

In article <8910182009.AA04246@asylum.gsfc.nasa.gov> chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) writes:
>3. Can't find <word> in original text -- Any key to continue
>
>I sometimes get the above message, even though a simple search locates it.

I too have this problem---and I'd like to get rid of it. It usually
happens very near the end of a buffer or region that I run ispell
on. It hangs up and keeps repeating this message til I C-g it.

Frequently, the message is a bit garbled. It says

Can't find Checking matching... in original text -- Any key to continue

and after hitting the space bar a number of times I get


Can't find Checking matching done  in original text -- Any key to continue

and a few more space bars gives

Args out of range: " ",0,1

At which point it will let me out if I hit a key.

It goes into this Can't find... mode even when there are misspelled
words sitting there right in front of it, waiting to be corrected.

Whats going on, and how can I fix it?

Thanks,
Barry Merrimans

tale@pawl.rpi.edu (David C Lawrence) (10/21/89)

(Note that the ispell.el package is not in the current GNU Emacs distribution.)

In <8910181956.AA04222@asylum.gsfc.nasa.gov> chris@ASYLUM.GSFC.NASA.GOV
(Chris Shenton) writes:
Chris> The offending word is capitalized in the mode-line prompt.
Chris> Given ispell's ability to distinguish case, this seems
Chris> counter-productive/intuitive.

Yes, it does.  "(upcase word)" is done in several places, but always
for echo-area messages.  Process communication is not using all capitals.
I agree that it should echo the word as it appears.

Chris> Works fine the first time (except for below), but the second
Chris> time through it doesn't seem to know my words. For example, it
Chris> doesn't find my name.

This is a bug in ispell, not ispell.el.  I recall recent discussion
about it somewhere on USENET, but I don't remember where or whether
mention was made of an existing patch for it.  It is very annoying.
I will look into modifying ispell.el to accomodate for that.  If there
is a patch to ispell for it, I would appreciate it if someone could
point me to it.

Chris> Trying to use apostrophe (') and dash (-) as word chars for
Chris> hyphenations, etc.  At best, it doesn't seem to acknowledge --
Chris> apostrophies, for example -- as word chars (sees "didn" but not
Chris> "didn't"); at worst, it seems to get lost, complaining "Can't
Chris> find <word> in orinal text -- Any key to continue"

The two lines which do this in ispell.el are commented out.  You can
just uncomment them and byte-combile ispell.el again to have it enabled.

Chris> I autoload ispell in my .emacs file, so when I modify the
Chris> syntax table there, is it trashed by the (defvar
Chris> ispell-syntax-table) when the autoload is activated?

No.  defvar does not change extant values for variables.

Chris> If not, then do I have to put the entire table initialization
Chris> (0, 1, ..., 9, etc) in my .emacs?

Yes, unless you just modify ispell.el as mentioned above.

Chris> The alternative seems to be ... duplication of effort
Chris> in .emacs. And I'd prefer not to modify ispell.el itself...

The way it stands now, you need to either just uncomment those two
lines or put this in .emacs:

      (setq ispell-syntax-table (make-syntax-table))
      ;; Make certain characters word constituents
      (modify-syntax-entry ?' "w   " ispell-syntax-table)
      (modify-syntax-entry ?- "w   " ispell-syntax-table)
      ;; Get rid on existing word syntax on certain characters 
      (modify-syntax-entry ?0 ".   " ispell-syntax-table)
      (modify-syntax-entry ?1 ".   " ispell-syntax-table)
      (modify-syntax-entry ?2 ".   " ispell-syntax-table)
      (modify-syntax-entry ?3 ".   " ispell-syntax-table)
      (modify-syntax-entry ?4 ".   " ispell-syntax-table)
      (modify-syntax-entry ?5 ".   " ispell-syntax-table)
      (modify-syntax-entry ?6 ".   " ispell-syntax-table)
      (modify-syntax-entry ?7 ".   " ispell-syntax-table)
      (modify-syntax-entry ?8 ".   " ispell-syntax-table)
      (modify-syntax-entry ?9 ".   " ispell-syntax-table)
      (modify-syntax-entry ?$ ".   " ispell-syntax-table)
      (modify-syntax-entry ?% ".   " ispell-syntax-table)

You could even condense the removal of word syntax to this:

(let ((not-words (?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?$ ?%)))
  (while not-words
    (modify-syntax-entry (car not-words) "." ispell-syntax-table)
    (setq not-words (cdr not-words))))

Dave
-- 
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))