On 18/07/15 11:38, Yuri D'Elia wrote:
> On 18/07/15 05:20, Kyle Meyer wrote:
>> Yuri D'Elia <[email protected]> wrote:
>>> I like to manually expand tabs in magit-diff (on whenever I'm looking
>>> at diff output).
>> [...]
>>> I don't think there would be any side-effect, since there's no point
>>> in editing the diff itself, except when you're searching in the diff
>>> for literal tabs.
>>
>> magit-apply and magit-reverse use the diff's content.
> 
> Humm, maybe I could use an overlay to fix just the display then.

(defun fixed-tab-spacing ()
  (save-excursion
    (goto-char (point-min))
    (while (search-forward "\t" nil t)
      (let* ((ovr (make-overlay (match-beginning 0) (match-end 0)))
             (tabs (- (match-end 0) (match-beginning 0))))
        (overlay-put ovr 'display (make-string (* 8 tabs) ?\s))))))

(add-hook 'magit-refresh-buffer-hook
          (lambda ()
            (when (eq major-mode 'magit-diff-mode)
              (fixed-tab-spacing))))

One minor inconvenience is that it still breaks x-stretch-cursor, but overall 
still better than before.

Do you still think that this could break magit-apply?


-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to