* Colourising fill-column-indicator
@ 2024-12-02 16:24 Heime via Users list for the GNU Emacs text editor
2024-12-04 3:39 ` Joel Reicher
2024-12-04 5:12 ` Michael Heerdegen
0 siblings, 2 replies; 6+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-02 16:24 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Colourising fill-column-indicator
2024-12-02 16:24 Colourising fill-column-indicator Heime via Users list for the GNU Emacs text editor
@ 2024-12-04 3:39 ` Joel Reicher
2024-12-04 5:12 ` Michael Heerdegen
1 sibling, 0 replies; 6+ messages in thread
From: Joel Reicher @ 2024-12-04 3:39 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime
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?
I would recommend using customize instead of the code above.
Regards,
- Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Colourising fill-column-indicator
2024-12-02 16:24 Colourising fill-column-indicator Heime via Users list for the GNU Emacs text editor
2024-12-04 3:39 ` Joel Reicher
@ 2024-12-04 5:12 ` Michael Heerdegen
2024-12-04 10:49 ` Heime via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2024-12-04 5:12 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor; +Cc: Heime
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Colourising fill-column-indicator
2024-12-04 5:12 ` Michael Heerdegen
@ 2024-12-04 10:49 ` Heime via Users list for the GNU Emacs text editor
2024-12-04 11:15 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-04 11:24 ` Jean Louis
0 siblings, 2 replies; 6+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2024-12-04 10:49 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Heime via Users list for the GNU Emacs text editor
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))) ))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Colourising fill-column-indicator
2024-12-04 10:49 ` Heime via Users list for the GNU Emacs text editor
@ 2024-12-04 11:15 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-04 11:24 ` Jean Louis
1 sibling, 0 replies; 6+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-12-04 11:15 UTC (permalink / raw)
To: help-gnu-emacs
Heime via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> 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.
Then you don't need to change buffer local bindings. However ensure to
change the default value to your like before enabling the mode in any
buffer. I would set the (default binding of the) variable when
starting Emacs, not when you invoke some function.
To your first question: just `setq' or `setq-local' with the buffer in
question current. Setting via a hook is a typical scenario.
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Colourising fill-column-indicator
2024-12-04 10:49 ` Heime via Users list for the GNU Emacs text editor
2024-12-04 11:15 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-12-04 11:24 ` Jean Louis
1 sibling, 0 replies; 6+ messages in thread
From: Jean Louis @ 2024-12-04 11:24 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen, help-gnu-emacs
* Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2024-12-04 13:51]:
> Because setq-default have no effect on the binding of the local variable,
> how does one set the local value? With a mode hook?
This is how I often use it:
;; First variable is defined:
(defvar-local rcd-tabulated-refresh-function nil
"The function to refresh the tabulated list.")
;; Second:
(put 'rcd-tabulated-refresh-function 'permanent-local t)
--
Jean Louis
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-04 11:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 16:24 Colourising fill-column-indicator Heime via Users list for the GNU Emacs text editor
2024-12-04 3:39 ` Joel Reicher
2024-12-04 5:12 ` Michael Heerdegen
2024-12-04 10:49 ` Heime via Users list for the GNU Emacs text editor
2024-12-04 11:15 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-04 11:24 ` Jean Louis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).