Stephen Leake <[email protected]> writes:

> Georg Bauhaus <[email protected]> writes:
>
>> This is my test case. I query-replace “Milli" with “High”.
>> Trying this a few times, only 4 or 5 of the 7 occurrences
>> are replaced in ada-mode. 
>
> I can reproduce this.
>
> I'll work on disabling each line in ada-mode, to see if I can isolate it.

Found the problem; missing 'save-match-data' in ada-syntax-propertize,
which is called from wisi-before-change and wisi-after-change via
syntax-ppss.

patch below.

I'm enforcing a minimum of one month between releases, so 5.1.3 will be
next weekend.

-- 
-- Stephe

#
# old_revision [2f2fd0e3fb04998eca25c6b35569740256ab31e8]
#
# patch "ada-mode.el"
#  from [3473e0d3b35ef8a8cd566ad9e87743db042f7b21]
#    to [073d4e900d91312a8f7deafe4d1c2e1cead759c8]
#
============================================================
--- ada-mode.el 3473e0d3b35ef8a8cd566ad9e87743db042f7b21
+++ ada-mode.el 073d4e900d91312a8f7deafe4d1c2e1cead759c8
@@ -1628,41 +1628,40 @@ In particular, character constants are s
   "Assign `syntax-table' properties in accessible part of buffer.
 In particular, character constants are set to have string syntax."
   ;; (info "(elisp)Syntax Properties")
-  (let ((modified (buffer-modified-p))
-       (buffer-undo-list t)
-       (inhibit-read-only t)
-       (inhibit-point-motion-hooks t)
-       (inhibit-modification-hooks t))
+  ;;
+  ;; called from `syntax-propertize', inside save-excursion 
with-silent-modifications
+  (let ((inhibit-read-only t)
+       (inhibit-point-motion-hooks t))
     (goto-char start)
-    (while (re-search-forward
-           (concat
-            "[^a-zA-Z0-9)]\\('\\)[^'\n]\\('\\)"; 1, 2: character literal, not 
attribute
-            "\\|[^a-zA-Z0-9)]\\('''\\)"; 3: character literal '''
-            "\\|\\(--\\)"; 4: comment start
-            )
-           end t)
-      ;; The help for syntax-propertize-extend-region-functions
-      ;; implies that 'start end' will always include whole lines, in
-      ;; which case we don't need
-      ;; syntax-propertize-extend-region-functions
-      (cond
-       ((match-beginning 1)
-       (put-text-property
-        (match-beginning 1) (match-end 1) 'syntax-table '(7 . ?'))
-       (put-text-property
-        (match-beginning 2) (match-end 2) 'syntax-table '(7 . ?')))
-       ((match-beginning 3)
-       (put-text-property
-        (match-beginning 3) (1+ (match-beginning 3)) 'syntax-table '(7 . ?'))
-       (put-text-property
-        (1- (match-end 3)) (match-end 3) 'syntax-table '(7 . ?')))
-       ((match-beginning 4)
-       (put-text-property
-        (match-beginning 4) (match-end 4) 'syntax-table '(11 . nil)))
-       ))
-    (run-hook-with-args 'ada-syntax-propertize-hook start end)
-    (unless modified
-      (restore-buffer-modified-p nil))))
+    (save-match-data
+      (while (re-search-forward
+             (concat
+              "[^a-zA-Z0-9)]\\('\\)[^'\n]\\('\\)"; 1, 2: character literal, 
not attribute
+              "\\|[^a-zA-Z0-9)]\\('''\\)"; 3: character literal '''
+              "\\|\\(--\\)"; 4: comment start
+              )
+             end t)
+       ;; The help for syntax-propertize-extend-region-functions
+       ;; implies that 'start end' will always include whole lines, in
+       ;; which case we don't need
+       ;; syntax-propertize-extend-region-functions
+       (cond
+        ((match-beginning 1)
+         (put-text-property
+          (match-beginning 1) (match-end 1) 'syntax-table '(7 . ?'))
+         (put-text-property
+          (match-beginning 2) (match-end 2) 'syntax-table '(7 . ?')))
+        ((match-beginning 3)
+         (put-text-property
+          (match-beginning 3) (1+ (match-beginning 3)) 'syntax-table '(7 . ?'))
+         (put-text-property
+          (1- (match-end 3)) (match-end 3) 'syntax-table '(7 . ?')))
+        ((match-beginning 4)
+         (put-text-property
+          (match-beginning 4) (match-end 4) 'syntax-table '(11 . nil)))
+        )))
+    (run-hook-with-args 'ada-syntax-propertize-hook start end))
+  )

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

Reply via email to