You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question: do you know if it's possible to make diff-hl-margin-mode frame-local? I.e. so that TTY frames have it on, but graphical frames have it off.
Use case: I access my Emacs server locally (graphically) and remotely (over SSH / TTY). Every time I switch, I have to nudge diff-hl to update margin mode (off locally, on remotely). I think ideally it would just be on for TTY frames, if that's possible.
I noticed that there is diff-hl-margin-local-mode, but I don't think that's quite it since that makes it buffer-local, but the same buffer can be open in both a graphical and TTY frame.
Thanks!
The text was updated successfully, but these errors were encountered:
diff --git a/diff-hl-margin.el b/diff-hl-margin.el
index c3fffde..a754a43 100644
--- a/diff-hl-margin.el+++ b/diff-hl-margin.el@@ -78,6 +78,10 @@
(set-default symbol value)
(setq diff-hl-margin-spec-cache nil)))
+(defcustom diff-hl-margin-nongraphic-only nil+ "Only use the margin when a text-only terminal is used."+ :type 'boolean)+
;;;###autoload
(define-minor-mode diff-hl-margin-mode
"Toggle displaying `diff-hl-mode' highlights on the margin."
@@ -147,10 +151,13 @@ You probably shouldn't use this function directly."
,(propertize char 'face
(intern (format "diff-hl-margin-%s" type)))))))))
-(defun diff-hl-highlight-on-margin (ovl type _shape)- (let ((spec (cdr (assoc (cons type diff-hl-side)- (diff-hl-margin-spec-cache)))))- (overlay-put ovl 'before-string spec)))+(defun diff-hl-highlight-on-margin (ovl type shape)+ (if (and diff-hl-margin-nongraphic-only+ (display-graphic-p))+ (funcall diff-hl-margin-old-highlight-function ovl type shape)+ (let ((spec (cdr (assoc (cons type diff-hl-side)+ (diff-hl-margin-spec-cache)))))+ (overlay-put ovl 'before-string spec))))
(provide 'diff-hl-margin)
Apply the patch, change the variable to t and see the difference.
The only roadbump, I guess, is that the mode also changes the corresponding margin width (from 0 to 1, usually). But if you wanted to use the margin for something else, that shouldn't be a problem.
How make it frame-local isn't obvious, though I suppose the value could be changed on every update. Not sure if there will be any performance implications.
Thank you for this essential package!
I have a question: do you know if it's possible to make
diff-hl-margin-mode
frame-local? I.e. so that TTY frames have it on, but graphical frames have it off.Use case: I access my Emacs server locally (graphically) and remotely (over SSH / TTY). Every time I switch, I have to nudge diff-hl to update margin mode (off locally, on remotely). I think ideally it would just be on for TTY frames, if that's possible.
I noticed that there is
diff-hl-margin-local-mode
, but I don't think that's quite it since that makes it buffer-local, but the same buffer can be open in both a graphical and TTY frame.Thanks!
The text was updated successfully, but these errors were encountered: