On 28 Nov 2014, at 13:59, Stephen Leake <[email protected]> wrote:

> Simon Wright <[email protected]> writes:
> 
>> My recollection of partial case exceptions in 4.01 is that when you
>> created one it selected the underscore-delimited text around point.
>> So, if you had point in the LED of BSP_LED_Init then you’d get *LED in
>> the case exceptions file. Instead, 5.1.7 inserts *BSP_LED_Init.
> 
> That depends on whether you modified the syntax class of '_' in 4.01.
> 
> The standard code in 4.01 uses word syntax for '_' while defining a case
> exception, which would select BSB_LED_Init.

Actually the code in 4.01’s ada-create-case-exception-substring uses a 
temporary modified syntax table (I think; this code smells a bit to my 
less-than-expert nose):

    ;;  Find the substring to define as an exception. Order is: the parameter,
    ;;  if any, or the selected region, or the word under the cursor
    (cond
     (word   nil)

     ((ada-region-selected)
      (setq word (buffer-substring-no-properties
                  (region-beginning) (region-end))))

     (t
      (let ((underscore-syntax (char-syntax ?_)))
        (unwind-protect
            (progn
              (modify-syntax-entry ?_ "." (syntax-table))
              (save-excursion
                (skip-syntax-backward "w")
                (set 'word (buffer-substring-no-properties
                            (point)
                            (save-excursion (forward-word 1) (point))))))
          (modify-syntax-entry ?_ (make-string 1 underscore-syntax)
                               (syntax-table))))))

> It is simple to drop _ from the search syntax when defining a partial
> case exception, which gives the behavior you describe:
> 
> ada-mode.el:1024
> 
>  (unless word
>    (if (use-region-p)
>       (setq word (buffer-substring-no-properties (region-beginning) 
> (region-end)))
>      (save-excursion
>       (let ((syntax (if partial "w" "w_")))
>         (skip-syntax-backward syntax)
>         (setq word
>               (buffer-substring-no-properties
>                (point)
>                (progn (skip-syntax-forward syntax) (point))
>                ))))))

This behaviour seems more natural to me.


_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to