Index: etc/NEWS =================================================================== RCS file: /cvsroot/emacs/emacs/etc/NEWS,v retrieving revision 1.719 diff -b -c -r1.719 NEWS *** etc/NEWS 25 Jul 2002 11:10:38 -0000 1.719 --- etc/NEWS 26 Jul 2002 16:06:58 -0000 *************** *** 58,63 **** --- 58,69 ---- * Changes in Emacs 21.4 +++ + ** New user option `abbrev-case-fold'. This option can be disabled to + avoid expanding abbrevs if their case differs from how they were + defined. This is handy when the case preserving feature of abbrevs + doesn't make sense (e.g. in most programming modes). + + +++ ** You can now customize the use of window fringes. To control this for all frames, use M-x fringe-mode or the Show/Hide submenu of the top-level Options menu, or customize the `fringe-mode' variable. To Index: man/abbrevs.texi =================================================================== RCS file: /cvsroot/emacs/emacs/man/abbrevs.texi,v retrieving revision 1.16 diff -b -c -r1.16 abbrevs.texi *** man/abbrevs.texi 3 Jan 2002 05:19:26 -0000 1.16 --- man/abbrevs.texi 26 Jul 2002 16:06:58 -0000 *************** *** 155,166 **** can be part of an abbrev. The most common way to use an abbrev is to insert it and then insert a punctuation character to expand it. @vindex abbrev-all-caps ! Abbrev expansion preserves case; thus, @samp{foo} expands into @samp{find ! outer otter}; @samp{Foo} into @samp{Find outer otter}, and @samp{FOO} into ! @samp{FIND OUTER OTTER} or @samp{Find Outer Otter} according to the ! variable @code{abbrev-all-caps} (a address@hidden value chooses the first ! of the two expansions). These commands are used to control abbrev expansion: --- 155,172 ---- can be part of an abbrev. The most common way to use an abbrev is to insert it and then insert a punctuation character to expand it. + @vindex abbrev-case-fold + Usually, abbrev expansion is case-insensitive; thus, @samp{foo}, + @samp{Foo}, and @samp{FOO} are all expanded. If you set the variable + @code{abbrev-case-fold} to @code{nil}, then all letters in the abbrev + must match exactly, including case. + @vindex abbrev-all-caps ! Case-insensitive abbrev expansion preserves case; thus, @samp{foo} ! expands into @samp{find outer otter}; @samp{Foo} into @samp{Find outer ! otter}, and @samp{FOO} into @samp{FIND OUTER OTTER} or @samp{Find ! Outer Otter} according to the variable @code{abbrev-all-caps} (a ! address@hidden value chooses the first of the two expansions). These commands are used to control abbrev expansion: Index: src/abbrev.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/abbrev.c,v retrieving revision 1.55 diff -b -c -r1.55 abbrev.c *** src/abbrev.c 15 Jul 2002 00:00:35 -0000 1.55 --- src/abbrev.c 26 Jul 2002 16:06:58 -0000 *************** *** 83,88 **** --- 83,91 ---- Lisp_Object Vpre_abbrev_expand_hook, Qpre_abbrev_expand_hook; + /* Control whether ignore case when expanding abbreviations. */ + Lisp_Object Vabbrev_case_fold; + Lisp_Object Qsystem_type, Qcount; DEFUN ("make-abbrev-table", Fmake_abbrev_table, Smake_abbrev_table, 0, 0, 0, *************** *** 166,172 **** (abbrev, expansion) Lisp_Object abbrev, expansion; { ! Fdefine_abbrev (Vglobal_abbrev_table, Fdowncase (abbrev), expansion, Qnil, make_number (0), Qnil); return abbrev; } --- 169,175 ---- (abbrev, expansion) Lisp_Object abbrev, expansion; { ! Fdefine_abbrev (Vglobal_abbrev_table, abbrev, expansion, Qnil, make_number (0), Qnil); return abbrev; } *************** *** 180,186 **** if (NILP (current_buffer->abbrev_table)) error ("Major mode has no abbrev table"); ! Fdefine_abbrev (current_buffer->abbrev_table, Fdowncase (abbrev), expansion, Qnil, make_number (0), Qnil); return abbrev; } --- 183,189 ---- if (NILP (current_buffer->abbrev_table)) error ("Major mode has no abbrev table"); ! Fdefine_abbrev (current_buffer->abbrev_table, abbrev, expansion, Qnil, make_number (0), Qnil); return abbrev; } *************** *** 294,300 **** /* ??? This loop needs to go by characters! */ register int c = FETCH_BYTE (idx); if (UPPERCASEP (c)) ! c = DOWNCASE (c), uccount++; else if (! NOCASEP (c)) lccount++; *p++ = c; --- 297,307 ---- /* ??? This loop needs to go by characters! */ register int c = FETCH_BYTE (idx); if (UPPERCASEP (c)) ! { ! if (!NILP (Vabbrev_case_fold)) ! c = DOWNCASE (c); ! uccount++; ! } else if (! NOCASEP (c)) lccount++; *p++ = c; *************** *** 348,356 **** SBYTES (expansion), 1); SET_PT (PT + whitecnt); ! if (uccount && !lccount) { ! /* Abbrev was all caps */ /* If expansion is multiple words, normally capitalize each word */ /* This used to be if (!... && ... >= ...) Fcapitalize; else Fupcase but Megatest 68000 compiler can't handle that */ --- 355,363 ---- SBYTES (expansion), 1); SET_PT (PT + whitecnt); ! if (!NILP (Vabbrev_case_fold) && uccount && !lccount) { ! /* Abbrev was all caps with case insensitive expansion */ /* If expansion is multiple words, normally capitalize each word */ /* This used to be if (!... && ... >= ...) Fcapitalize; else Fupcase but Megatest 68000 compiler can't handle that */ *************** *** 365,371 **** Fupcase_region (make_number (wordstart), make_number (PT)); caped: ; } ! else if (uccount) { /* Abbrev included some caps. Cap first initial of expansion */ int pos = wordstart_byte; --- 372,378 ---- Fupcase_region (make_number (wordstart), make_number (PT)); caped: ; } ! else if (!NILP (Vabbrev_case_fold) && uccount) { /* Abbrev included some caps. Cap first initial of expansion */ int pos = wordstart_byte; *************** *** 647,652 **** --- 654,670 ---- DEFVAR_PER_BUFFER ("local-abbrev-table", ¤t_buffer->abbrev_table, Qnil, doc: /* Local (mode-specific) abbrev table of current buffer. */); + DEFVAR_LISP ("abbrev-case-fold", &Vabbrev_case_fold, + doc: /* *Non-nil means ignore case when expanding abbreviations. + A value of nil means case is significant, and abbrevs must + be typed exactly the same as they were defined in order to + be recognized. + + Note that if you define abbrevs containing uppercase + characters, then they will not be available if the + expansion is case-insensitive. */); + Vabbrev_case_fold = Qt; + DEFVAR_BOOL ("abbrevs-changed", &abbrevs_changed, doc: /* Set non-nil by defining or altering any word abbrevs. This causes `save-some-buffers' to offer to save the abbrevs. */); Index: lisp/cus-start.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/cus-start.el,v retrieving revision 1.51 diff -b -c -r1.51 cus-start.el *** lisp/cus-start.el 22 Jul 2002 15:22:49 -0000 1.51 --- lisp/cus-start.el 26 Jul 2002 16:06:58 -0000 *************** *** 37,42 **** --- 37,43 ---- (let ((all '(;; abbrev.c (abbrev-all-caps abbrev-mode boolean) (pre-abbrev-expand-hook abbrev-mode hook) + (abbrev-case-fold abbrev-mode boolean "21.4") ;; alloc.c (gc-cons-threshold alloc integer) (undo-limit undo integer)