unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Colourising fill-column-indicator
Date: Wed, 04 Dec 2024 10:49:17 +0000	[thread overview]
Message-ID: <1C1u6MWb1qfh0NfL3EM0fiGNiKV7cH9u0YmIlc3S-VAX0lGYjkTYzEjQYJj-aQIB0EPcp6Tw4rc-ipY8so7lwQY_hJZRnPmuiEQPqqWwgIU=@protonmail.com> (raw)
In-Reply-To: <87wmggowut.fsf@web.de>






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))) ))




  reply	other threads:[~2024-12-04 10:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-12-04 11:15     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-12-04 11:24     ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1C1u6MWb1qfh0NfL3EM0fiGNiKV7cH9u0YmIlc3S-VAX0lGYjkTYzEjQYJj-aQIB0EPcp6Tw4rc-ipY8so7lwQY_hJZRnPmuiEQPqqWwgIU=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=heimeborgia@protonmail.com \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).