* Highlight tabulated and trailing whitespace
@ 2020-12-28 4:11 steve-humphreys
2020-12-28 4:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 4:11 UTC (permalink / raw)
To: Help Gnu Emacs
I would like to highlight tabulated and trailing whitespace, using the following
code on a dark background. The highlighting is not working. I might also be
changing tabs with spaced but do not what command I had used.
(defun whitesp-highlight ()
"Highlights whitespace."
(require 'whitespace)
(setq-local show-trailing-whitespace t)
(whitespace-mode)
(setq whitespace-style '(face tabs))
(modify-face whitespace-tab nil "#000000")
;; Highlights tabulator regions
(setq whitespace-style '(tabs tab-mark))
(global-whitespace-mode 1) )
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 4:11 Highlight tabulated and trailing whitespace steve-humphreys
@ 2020-12-28 4:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 4:56 ` steve-humphreys
2020-12-28 5:12 ` steve-humphreys
0 siblings, 2 replies; 14+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-28 4:50 UTC (permalink / raw)
To: help-gnu-emacs
steve-humphreys wrote:
> I would like to highlight tabulated and trailing whitespace, using the following
> code on a dark background. The highlighting is not working. I might also be
> changing tabs with spaced but do not what command I had used.
>
> (defun whitesp-highlight ()
> "Highlights whitespace."
>
> (require 'whitespace)
> (setq-local show-trailing-whitespace t)
>
> (whitespace-mode)
> (setq whitespace-style '(face tabs))
> (modify-face whitespace-tab nil "#000000")
>
> ;; Highlights tabulator regions
> (setq whitespace-style '(tabs tab-mark))
> (global-whitespace-mode 1) )
(setq show-trailing-whitespace t)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 4:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-28 4:56 ` steve-humphreys
2020-12-28 5:07 ` 2QdxY4RzWzUUiLuE
2020-12-28 5:12 ` steve-humphreys
1 sibling, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 4:56 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
> Sent: Monday, December 28, 2020 at 10:20 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Highlight tabulated and trailing whitespace
>
> steve-humphreys wrote:
>
> > I would like to highlight tabulated and trailing whitespace, using the following
> > code on a dark background. The highlighting is not working. I might also be
> > changing tabs with spaced but do not what command I had used.
> >
> > (defun whitesp-highlight ()
> > "Highlights whitespace."
> >
> > (require 'whitespace)
> > (setq-local show-trailing-whitespace t)
> >
> > (whitespace-mode)
> > (setq whitespace-style '(face tabs))
> > (modify-face whitespace-tab nil "#000000")
> >
> > ;; Highlights tabulator regions
> > (setq whitespace-style '(tabs tab-mark))
> > (global-whitespace-mode 1) )
>
> (setq show-trailing-whitespace t)
>
Is "show-trailing-whitespace" buffer local?
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 4:56 ` steve-humphreys
@ 2020-12-28 5:07 ` 2QdxY4RzWzUUiLuE
0 siblings, 0 replies; 14+ messages in thread
From: 2QdxY4RzWzUUiLuE @ 2020-12-28 5:07 UTC (permalink / raw)
To: help-gnu-emacs
On 2020-12-28 at 05:56:43 +0100,
steve-humphreys@gmx.com wrote:
> Is "show-trailing-whitespace" buffer local?
According to it's documentation, it is. And even if it weren't, you
could change it. See make-variable-buffer-local.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 4:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 4:56 ` steve-humphreys
@ 2020-12-28 5:12 ` steve-humphreys
2020-12-28 6:08 ` steve-humphreys
1 sibling, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 5:12 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
What can I do to show tabs like I am doing with show-trailing-whitespace?
> Sent: Monday, December 28, 2020 at 10:20 AM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Highlight tabulated and trailing whitespace
>
> steve-humphreys wrote:
>
> > I would like to highlight tabulated and trailing whitespace, using the following
> > code on a dark background. The highlighting is not working. I might also be
> > changing tabs with spaced but do not what command I had used.
> >
> > (defun whitesp-highlight ()
> > "Highlights whitespace."
> >
> > (require 'whitespace)
> > (setq-local show-trailing-whitespace t)
> >
> > (whitespace-mode)
> > (setq whitespace-style '(face tabs))
> > (modify-face whitespace-tab nil "#000000")
> >
> > ;; Highlights tabulator regions
> > (setq whitespace-style '(tabs tab-mark))
> > (global-whitespace-mode 1) )
>
> (setq show-trailing-whitespace t)
>
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 5:12 ` steve-humphreys
@ 2020-12-28 6:08 ` steve-humphreys
2020-12-28 7:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 6:08 UTC (permalink / raw)
To: steve-humphreys; +Cc: help-gnu-emacs, moasenwood
I have tried to show tab marks, but the following commands are confusing me. One can
use a backgrouund colour and introduce a tab mark. But I have no idea how to achieve
them.
(setq whitespace-style '(face tabs))
(setq whitespace-style '(tabs tab-mark))
> Sent: Monday, December 28, 2020 at 10:42 AM
> From: steve-humphreys@gmx.com
> To: moasenwood@zoho.eu
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Highlight tabulated and trailing whitespace
>
> What can I do to show tabs like I am doing with show-trailing-whitespace?
>
> > Sent: Monday, December 28, 2020 at 10:20 AM
> > From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Highlight tabulated and trailing whitespace
> >
> > steve-humphreys wrote:
> >
> > > I would like to highlight tabulated and trailing whitespace, using the following
> > > code on a dark background. The highlighting is not working. I might also be
> > > changing tabs with spaced but do not what command I had used.
> > >
> > > (defun whitesp-highlight ()
> > > "Highlights whitespace."
> > >
> > > (require 'whitespace)
> > > (setq-local show-trailing-whitespace t)
> > >
> > > (whitespace-mode)
> > > (setq whitespace-style '(face tabs))
> > > (modify-face whitespace-tab nil "#000000")
> > >
> > > ;; Highlights tabulator regions
> > > (setq whitespace-style '(tabs tab-mark))
> > > (global-whitespace-mode 1) )
> >
> > (setq show-trailing-whitespace t)
> >
> >
> > --
> > underground experts united
> > http://user.it.uu.se/~embe8573
> > https://dataswamp.org/~incal
> >
> >
> >
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 6:08 ` steve-humphreys
@ 2020-12-28 7:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 8:40 ` steve-humphreys
0 siblings, 1 reply; 14+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-12-28 7:41 UTC (permalink / raw)
To: help-gnu-emacs
steve-humphreys wrote:
> I have tried to show tab marks, but the following commands
> are confusing me. One can use a backgrouund colour and
> introduce a tab mark. But I have no idea how to
> achieve them.
>
> (setq whitespace-style '(face tabs))
Then just set the `whitespace-tab' face, to some face other
than what the default face has,
(insert "\t <-- this is a tab")
and enable the mode.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 7:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-12-28 8:40 ` steve-humphreys
2020-12-28 10:59 ` Michael Heerdegen
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 8:40 UTC (permalink / raw)
To: moasenwood; +Cc: help-gnu-emacs
Have tried the following two lines to no effect
(require 'whitespace)
(whitespace-mode)
But then if I use "H-k" to toggle, the command works. What is happening???
(global-set-key (kbd "H-k") 'whitespace-mode)
> Sent: Monday, December 28, 2020 at 1:11 PM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Highlight tabulated and trailing whitespace
>
> steve-humphreys wrote:
>
> > I have tried to show tab marks, but the following commands
> > are confusing me. One can use a backgrouund colour and
> > introduce a tab mark. But I have no idea how to
> > achieve them.
> >
> > (setq whitespace-style '(face tabs))
>
> Then just set the `whitespace-tab' face, to some face other
> than what the default face has,
>
> (insert "\t <-- this is a tab")
>
> and enable the mode.
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 8:40 ` steve-humphreys
@ 2020-12-28 10:59 ` Michael Heerdegen
2020-12-28 12:42 ` Óscar Fuentes
2020-12-28 13:09 ` steve-humphreys
2 siblings, 0 replies; 14+ messages in thread
From: Michael Heerdegen @ 2020-12-28 10:59 UTC (permalink / raw)
To: help-gnu-emacs
steve-humphreys@gmx.com writes:
> Have tried the following two lines to no effect
>
> (require 'whitespace)
> (whitespace-mode)
What does "have tried" mean?
Michael.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 8:40 ` steve-humphreys
2020-12-28 10:59 ` Michael Heerdegen
@ 2020-12-28 12:42 ` Óscar Fuentes
2020-12-28 13:09 ` steve-humphreys
2 siblings, 0 replies; 14+ messages in thread
From: Óscar Fuentes @ 2020-12-28 12:42 UTC (permalink / raw)
To: help-gnu-emacs
steve-humphreys@gmx.com writes:
> Have tried the following two lines to no effect
>
> (require 'whitespace)
> (whitespace-mode)
In a buffer, just:
M-x whitespace-mode
For enabling it automatically when you open certain type of files, use a
major mode hook. For instance:
(add-hook 'prog-mode-hook #'whitespace-mode)
Will activate whitespace-mode in all programming language modes.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 8:40 ` steve-humphreys
2020-12-28 10:59 ` Michael Heerdegen
2020-12-28 12:42 ` Óscar Fuentes
@ 2020-12-28 13:09 ` steve-humphreys
2020-12-28 16:08 ` steve-humphreys
2 siblings, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 13:09 UTC (permalink / raw)
To: steve-humphreys; +Cc: help-gnu-emacs, moasenwood
I cannot understand why the following code is giving me a lisp error.
(defun display-cycle ()
"Toggle Display-Line-Numbers mode in all buffers."
(interactive)
(let ((n display-cycle-state))
(pcase n
(1 (whitespace-mode)
(setq-local display-cycle-state 2))
(2 (ruler-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(global-display-line-numbers-mode)
(setq-local display-cycle-state 3))
(_ (ruler-mode 1)
(setq line-number-mode t)
(setq column-number-mode t)
(global-display-line-numbers-mode)
(setq-local display-cycle-state 1))) ))
> Sent: Monday, December 28, 2020 at 2:10 PM
> From: steve-humphreys@gmx.com
> To: moasenwood@zoho.eu
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Highlight tabulated and trailing whitespace
>
> Have tried the following two lines to no effect
>
> (require 'whitespace)
> (whitespace-mode)
>
> But then if I use "H-k" to toggle, the command works. What is happening???
>
> (global-set-key (kbd "H-k") 'whitespace-mode)
>
>
>
>
> > Sent: Monday, December 28, 2020 at 1:11 PM
> > From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Highlight tabulated and trailing whitespace
> >
> > steve-humphreys wrote:
> >
> > > I have tried to show tab marks, but the following commands
> > > are confusing me. One can use a backgrouund colour and
> > > introduce a tab mark. But I have no idea how to
> > > achieve them.
> > >
> > > (setq whitespace-style '(face tabs))
> >
> > Then just set the `whitespace-tab' face, to some face other
> > than what the default face has,
> >
> > (insert "\t <-- this is a tab")
> >
> > and enable the mode.
> >
> > --
> > underground experts united
> > http://user.it.uu.se/~embe8573
> > https://dataswamp.org/~incal
> >
> >
> >
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Highlight tabulated and trailing whitespace
2020-12-28 13:09 ` steve-humphreys
@ 2020-12-28 16:08 ` steve-humphreys
2020-12-28 16:55 ` Drew Adams
0 siblings, 1 reply; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 16:08 UTC (permalink / raw)
To: steve-humphreys; +Cc: help-gnu-emacs, moasenwood
The error is
Debugger entered--Lisp error: (void-variable display-cycle-state)
(let ((n display-cycle-state))
> I cannot understand why the following code is giving me a lisp error.
>
> (defun display-cycle ()
> "Toggle Display-Line-Numbers mode in all buffers."
> (interactive)
>
> (let ((n display-cycle-state))
>
> (pcase n
> (1 (whitespace-mode)
> (setq-local display-cycle-state 2))
>
> (2 (ruler-mode 0)
> (setq line-number-mode nil)
> (setq column-number-mode nil)
> (global-display-line-numbers-mode)
> (setq-local display-cycle-state 3))
>
> (_ (ruler-mode 1)
> (setq line-number-mode t)
> (setq column-number-mode t)
> (global-display-line-numbers-mode)
> (setq-local display-cycle-state 1))) ))
>
>
>
>
>
> > Sent: Monday, December 28, 2020 at 2:10 PM
> > From: steve-humphreys@gmx.com
> > To: moasenwood@zoho.eu
> > Cc: help-gnu-emacs@gnu.org
> > Subject: Re: Highlight tabulated and trailing whitespace
> >
> > Have tried the following two lines to no effect
> >
> > (require 'whitespace)
> > (whitespace-mode)
> >
> > But then if I use "H-k" to toggle, the command works. What is happening???
> >
> > (global-set-key (kbd "H-k") 'whitespace-mode)
> >
> >
> >
> >
> > > Sent: Monday, December 28, 2020 at 1:11 PM
> > > From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-gnu-emacs@gnu.org>
> > > To: help-gnu-emacs@gnu.org
> > > Subject: Re: Highlight tabulated and trailing whitespace
> > >
> > > steve-humphreys wrote:
> > >
> > > > I have tried to show tab marks, but the following commands
> > > > are confusing me. One can use a backgrouund colour and
> > > > introduce a tab mark. But I have no idea how to
> > > > achieve them.
> > > >
> > > > (setq whitespace-style '(face tabs))
> > >
> > > Then just set the `whitespace-tab' face, to some face other
> > > than what the default face has,
> > >
> > > (insert "\t <-- this is a tab")
> > >
> > > and enable the mode.
> > >
> > > --
> > > underground experts united
> > > http://user.it.uu.se/~embe8573
> > > https://dataswamp.org/~incal
> > >
> > >
> > >
> >
> >
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: Highlight tabulated and trailing whitespace
2020-12-28 16:08 ` steve-humphreys
@ 2020-12-28 16:55 ` Drew Adams
2020-12-28 17:06 ` steve-humphreys
0 siblings, 1 reply; 14+ messages in thread
From: Drew Adams @ 2020-12-28 16:55 UTC (permalink / raw)
To: steve-humphreys; +Cc: help-gnu-emacs, moasenwood
Where is that variable supposed to come from?
I don't see it with vanilla Emacs 26 (`emacs -Q').
Perhaps you need to load some library first, so
it becomes defined.
And perhaps it's actually a function? If not,
why do you bother to bind it to `n', which isn't
modified anywhere? Is it only to have a shorter
variable name when you refer to the value (i.e.,
instead of referring to `display-cycle-stae')?
Not clear to me what you're trying to do.
> Debugger entered--Lisp error: (void-variable display-cycle-state)
> (let ((n display-cycle-state))
>
> > (let ((n display-cycle-state))
> > (pcase n ...
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: RE: Highlight tabulated and trailing whitespace
2020-12-28 16:55 ` Drew Adams
@ 2020-12-28 17:06 ` steve-humphreys
0 siblings, 0 replies; 14+ messages in thread
From: steve-humphreys @ 2020-12-28 17:06 UTC (permalink / raw)
To: Drew Adams; +Cc: help-gnu-emacs, moasenwood
I thought that if it was not defined, it would go to the any expval match _
when the variable is then set up as buffer-local.
When I use
(defvar display-cycle-state 0) things do work.
> Sent: Monday, December 28, 2020 at 10:25 PM
> From: "Drew Adams" <drew.adams@oracle.com>
> To: steve-humphreys@gmx.com
> Cc: help-gnu-emacs@gnu.org, moasenwood@zoho.eu
> Subject: RE: Highlight tabulated and trailing whitespace
>
> Where is that variable supposed to come from?
> I don't see it with vanilla Emacs 26 (`emacs -Q').
>
> Perhaps you need to load some library first, so
> it becomes defined.
>
> And perhaps it's actually a function? If not,
> why do you bother to bind it to `n', which isn't
> modified anywhere? Is it only to have a shorter
> variable name when you refer to the value (i.e.,
> instead of referring to `display-cycle-stae')?
> Not clear to me what you're trying to do.
>
> > Debugger entered--Lisp error: (void-variable display-cycle-state)
> > (let ((n display-cycle-state))
> >
> > > (let ((n display-cycle-state))
> > > (pcase n ...
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-12-28 17:06 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-28 4:11 Highlight tabulated and trailing whitespace steve-humphreys
2020-12-28 4:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 4:56 ` steve-humphreys
2020-12-28 5:07 ` 2QdxY4RzWzUUiLuE
2020-12-28 5:12 ` steve-humphreys
2020-12-28 6:08 ` steve-humphreys
2020-12-28 7:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-28 8:40 ` steve-humphreys
2020-12-28 10:59 ` Michael Heerdegen
2020-12-28 12:42 ` Óscar Fuentes
2020-12-28 13:09 ` steve-humphreys
2020-12-28 16:08 ` steve-humphreys
2020-12-28 16:55 ` Drew Adams
2020-12-28 17:06 ` steve-humphreys
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.