Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support diff mode #71

Closed
andreineculau opened this issue Sep 8, 2020 · 4 comments
Closed

Support diff mode #71

andreineculau opened this issue Sep 8, 2020 · 4 comments
Labels

Comments

@andreineculau
Copy link

I don't know if it's only me, but this is how opening a .patch file (a diff) shows up with the dracula-theme in Emacs 26.3 (in iTerm2 with dracula-theme as well but that doesn't matter).

Screenshot 2020-09-08 at 15 00 02

Is it only me?
For the time being, I resorted to overloading some settings but I'm sure there's a better way.

      (set-face-background 'diff-added "green" (selected-frame))
      (set-face-background 'diff-changed "yellow" (selected-frame))
      (set-face-background 'diff-removed "red" (selected-frame))

      (set-face-foreground 'diff-added "black" (selected-frame))
      (set-face-foreground 'diff-changed "black" (selected-frame))
      (set-face-foreground 'diff-file-header "black" (selected-frame))
      (set-face-foreground 'diff-header "black" (selected-frame))
      (set-face-foreground 'diff-removed "black" (selected-frame))

Example file:

--- Formula/patch-src/awscli.original.rb
+++ Formula/patch-src/awscli.rb
@@ -44,7 +44,9 @@
       }
     EOS
 
-    system libexec/"bin/python3", "scripts/gen-ac-index", "--include-builtin-index"
+    unless ENV.CI?
+      system libexec/"bin/python3", "scripts/gen-ac-index", "--include-builtin-index"
+    end
   end
 
   def caveats
@milouse
Copy link
Member

milouse commented Sep 14, 2020

Hi, sorry for the delay, I was in holiday.

I don’t have the same display (I use simpleterm on linux, with dracula color in term too).

Capture du 2020-09-14 16-39-59

As you can see, the used colors are not very good too, but at least they are readable.

Any way, I know the diff part has not been heavily tested/integrated. For the most part of it, as it’s not integrated, it use the default emacs color (you can see it by yourself in your test file, by entering M-x describe-face on any colored line).

In your case, the color in your screenshot seem really really bright. I wonder if there isn’t another clash with another mode, custom color parameter or terminal colors?

@milouse milouse changed the title diff mode Support diff mode Sep 14, 2020
@andreineculau
Copy link
Author

Hi, sorry for the delay, I was in holiday.

Don't be sorry. Hope you enjoyed it 🏖️

For starters, I actually checked the st colors, which are a bit different in simpleterm, but not enough to make a change. I actually tried other colors in iTerm, and the only thing that can change in the emacs-diff view is the foreground and background color. The rest are fixed.

FWIW, this is how my emacs faces look like for "removed" content. Basically vanilla colors. Are yours the same?

Face: diff-indicator-removed (sample) (customize this face)

Documentation:
‘diff-mode’ face used to highlight indicator of removed lines (-, <).

Defined in ‘diff-mode.el’.


           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: unspecified
            Slant: unspecified
       Foreground: #aa2222
DistantForeground: unspecified
       Background: unspecified
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: unspecified
          Inherit: diff-removed

This face was introduced, or its default value was changed, in
version 22.1 of Emacs.
Face: diff-removed (sample) (customize this face)

Documentation:
‘diff-mode’ face used to highlight removed lines.

Defined in ‘diff-mode.el’.


           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: unspecified
            Slant: unspecified
       Foreground: unspecified
DistantForeground: unspecified
       Background: #ffdddd
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: t
          Inherit: diff-changed

[back]
Face: diff-changed (sample) (customize this face)

Documentation:
‘diff-mode’ face used to highlight changed lines.

Defined in ‘diff-mode.el’.


           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: unspecified
            Slant: unspecified
       Foreground: unspecified
DistantForeground: unspecified
       Background: unspecified
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: unspecified
          Inherit: unspecified

This face was introduced, or its default value was changed, in
version 25.1 of Emacs.

[back]

@abouvier
Copy link

abouvier commented Sep 5, 2021

You can use 24-bit direct color mode with TERM=iterm2-direct.
Here is Konsole with TERM=konsole-direct and emacs version 27.2:

Screenshot_20210905_054149

@milouse
Copy link
Member

milouse commented Oct 13, 2023

Should have been fixed with 54c2640

@milouse milouse closed this as completed Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants