3

When I use olivetti-mode I'd like to have grey margins and the fringe indicators close to the window text, like in this picture:

enter image description here The problem is that when the fringes are wide the indicators end up being far from the text

enter image description here Is there a way to move them close to the window text?

Another approach would be to keep the fringes's width to the usual narrow size and paint the margins the same grey as the fringes background, but as far as I understand that can't be done, because the margins take their background colour from the default face, so it's bound to be the same as the text's background.

6
  • What's the value of fringes-outside-margins? If it is nil which is the default, the fringe is supposed to appear between the margin and the text according to the doc string of the variable.
    – NickD
    Jan 24, 2022 at 22:09
  • @NickD It is nil, but if I use wide margins instead of wide fringes (i.e., if I set olivetti-style to nil) I get these wide white bands on the outside and the grey narrow fringes around the text area. I’d like to have a uniform grey margin à la pdf reader. Jan 24, 2022 at 22:20
  • Try (set-face-attribute 'fringe nil :background nil). That's what I use.
    – jagrg
    Jan 25, 2022 at 2:10
  • @jagrg I use (set-face-attribute 'olivetti-fringe nil :foreground "grey80" :background (face-attribute 'default :background)) (called from olivetti-mode-hook so it adjusts to theme changes), which makes the fringes background "trasparent" like your setting but only while olivetti-mode is on. I'd like to see the borders of the text area though, while both these solutions blend it with the fringes and the margins. Jan 25, 2022 at 6:45
  • 1
    @jagrg Nope, I want either wide grey fringes or thin grey fringes and grey margins. Like in the first image in the question. Jan 26, 2022 at 14:41

1 Answer 1

0

I ran into the same issue and found the following solution to one specific case of your problem. (I am posting it here in case it is useful to someone.) Try including this snippet in your olivetti-mode configuration:

(setq olivetti-style 'fancy
      olivetti-margin-width 3)

(defun custom-olivetti-mode-on-hook ()
  (setq-local flycheck-indication-mode 'left-margin))

(defun custom-olivetti-mode-off-hook ()
  (kill-local-variable 'flycheck-indication-mode))

(add-hook 'olivetti-mode-on-hook 'custom-olivetti-mode-on-hook)
(add-hook 'olivetti-mode-off-hook 'custom-olivetti-mode-off-hook)

This solves the problem for Flycheck indicators but not for the line continuation indicators in your question.

The bottom buffer below shows the result after enabling olivetti-mode (using the above configuration): enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.