* Cycle that highlights whitespace and displays line-column numbers
@ 2021-01-29 16:56 pietru
2021-01-29 19:59 ` pietru
0 siblings, 1 reply; 2+ messages in thread
From: pietru @ 2021-01-29 16:56 UTC (permalink / raw)
To: Help Gnu Emacs
I want to cycle through whitespace highlighting functionality, but I am
not getting very good behavior while looping. I would be grateful if
people could help me improve the code.
(defvar-local dfvl-highlight-chars-state nil)
(defun cycle-highlight-chars ()
"Cycle though character highlighting (tabs and trailing spaces)."
(interactive)
(when (eq dfvl-highlight-chars-state nil)
(require 'whitespace)
(setq whitespace-style '(face tab-mark tabs trailing)) )
(pcase dfvl-highlight-chars-state
(2 (whitespace-mode 0) ; [#A] Disable emacs modes
(display-line-numbers-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(ruler-mode 1) ; [#B] Enable emacs modes
(message "%s" "Enable: Ruler only")
(setq-local dfvl-highlight-chars-state 3))
(3 (ruler-mode 0) ; [#C]
(whitespace-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(display-line-numbers-mode 0)
(message "%s" "Disable: Space highlight & frame measure")
(setq-local dfvl-highlight-chars-state 1))
(_ (whitespace-mode 1) ; [#D]
(ruler-mode 1)
(setq line-number-mode 1)
(setq column-number-mode 1)
(display-line-numbers-mode 1)
(message "%s" "Enable: Space highlight & frame measure")
(setq-local dfvl-highlight-chars-state 2)) ))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Cycle that highlights whitespace and displays line-column numbers
2021-01-29 16:56 Cycle that highlights whitespace and displays line-column numbers pietru
@ 2021-01-29 19:59 ` pietru
0 siblings, 0 replies; 2+ messages in thread
From: pietru @ 2021-01-29 19:59 UTC (permalink / raw)
To: pietru; +Cc: Help Gnu Emacs
Am quite unsure how to use the commands for displaying column and
line numbers: line-number-mode, column-number-mode, display-line-numbers-mode.
> Sent: Saturday, January 30, 2021 at 4:56 AM
> From: pietru@caramail.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Cycle that highlights whitespace and displays line-column numbers
>
> I want to cycle through whitespace highlighting functionality, but I am
> not getting very good behavior while looping. I would be grateful if
> people could help me improve the code.
>
> (defvar-local dfvl-highlight-chars-state nil)
>
> (defun cycle-highlight-chars ()
> "Cycle though character highlighting (tabs and trailing spaces)."
> (interactive)
>
> (when (eq dfvl-highlight-chars-state nil)
> (require 'whitespace)
> (setq whitespace-style '(face tab-mark tabs trailing)) )
>
> (pcase dfvl-highlight-chars-state
> (2 (whitespace-mode 0) ; [#A] Disable emacs modes
> (display-line-numbers-mode 0)
> (setq line-number-mode nil)
> (setq column-number-mode nil)
>
> (ruler-mode 1) ; [#B] Enable emacs modes
> (message "%s" "Enable: Ruler only")
> (setq-local dfvl-highlight-chars-state 3))
>
> (3 (ruler-mode 0) ; [#C]
> (whitespace-mode 0)
> (setq line-number-mode nil)
> (setq column-number-mode nil)
> (display-line-numbers-mode 0)
> (message "%s" "Disable: Space highlight & frame measure")
> (setq-local dfvl-highlight-chars-state 1))
>
> (_ (whitespace-mode 1) ; [#D]
> (ruler-mode 1)
> (setq line-number-mode 1)
> (setq column-number-mode 1)
> (display-line-numbers-mode 1)
> (message "%s" "Enable: Space highlight & frame measure")
> (setq-local dfvl-highlight-chars-state 2)) ))
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-29 19:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-29 16:56 Cycle that highlights whitespace and displays line-column numbers pietru
2021-01-29 19:59 ` pietru
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.