[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colourising fill-column-indicator
From: |
Heime |
Subject: |
Re: Colourising fill-column-indicator |
Date: |
Wed, 04 Dec 2024 10:49:17 +0000 |
Sent with Proton Mail secure email.
On Wednesday, December 4th, 2024 at 5:11 PM, Michael Heerdegen
<michael_heerdegen@web.de> wrote:
> Heime via Users list for the GNU Emacs text editor
> help-gnu-emacs@gnu.org writes:
>
> > Where should the following commands be called?
> >
> > (setq-default display-fill-column-indicator-character ?\u2503)
> >
> > (set-face-attribute
> > 'fill-column-indicator nil :background "green" :height 1.0)
> >
> > Are they to be called before display-fill-column-indicator-mode?
>
>
> In a buffer with display-fill-column-indicator-mode enabled the
> `setq-default' will of course have no effect on the binding of the local
> variable` display-fill-column-indicator-character'.
>
> I'm totally guessing what you are asking for since you seldom tell what
> you are doing, what you are seeing, and what you want to achieve.
>
> Michael.
Because setq-default have no effect on the binding of the local variable,
how does one set the local value? With a mode hook?
I want to have the same character indicator whenever one enables the mode.
Consider the following function
(defun linwrap (actm)
"Toggle display of fill-column indicator."
(interactive
(list
(let ( (cseq '("local" "toggle" "global" "disable")) )
(completing-read "Context: " cseq nil t "toggle"))))
(setq-default display-fill-column-indicator-character ?\u2503)
(set-face-attribute
'fill-column-indicator nil :background "green" :height 1.0)
(cond
((equal actm "local") (display-fill-column-indicator-mode))
((equal actm "global") (global-display-fill-column-indicator-mode))
((equal actm "mode-hook")
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode))
((equal actm "toggle") (display-fill-column-indicator-mode 'toggle))
(t
;; Use mode variable to test whether mode was activated
(if global-display-fill-column-indicator-mode
(global-display-fill-column-indicator-mode -1)
(display-fill-column-indicator-mode -1))) ))