branch: elpa/aidermacs
commit 66d0471a6a17b662bb5d30f40a9d4b945cb9b557
Author: Troy Hinckley <t.mac...@gmail.com>
Commit: Matthew Zeng <matthew...@posteo.net>

    Don't update diff headers in font lock
    
    Closes #50
    
    The issue here is that diff-mode by default will try and update the line 
numbers in the headers on
    the fly. But this leads to the font lock buffer and the actual buffer 
getting out of sync. For
    example if it changes from
    
    ```diff
    @@ -1,36 +1,3 @@
    ```
    
    to
    
    ```diff
    @@ -1,9 +1,0 @@
    ```
    
    The two positions will now be off by 1 (because 36 was changed to 9). To 
fix we disable this behavior.
---
 aidermacs-backend-comint.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/aidermacs-backend-comint.el b/aidermacs-backend-comint.el
index 77856c7043..ec7cd6bea1 100644
--- a/aidermacs-backend-comint.el
+++ b/aidermacs-backend-comint.el
@@ -39,6 +39,7 @@
 (declare-function aidermacs--detect-edited-files "aidermacs-output")
 
 (defvar aidermacs--last-command)
+(defvar diff-update-on-the-fly)
 
 (defgroup aidermacs-backend-comint nil
   "Comint backend for Aidermacs."
@@ -193,7 +194,8 @@ _OUTPUT is the text to be processed."
             (with-current-buffer aidermacs--syntax-work-buffer
               (unless (eq mode major-mode)
                 (condition-case e
-                    (let ((inhibit-message t))
+                    (let ((inhibit-message t)
+                          (diff-update-on-the-fly nil))
                       (funcall mode))
                   (error "aidermacs: Failed to init major-mode `%s' for 
font-locking: %s" mode e))))))
 

Reply via email to