* display line and column numbers together with ruler and whitespace highlighting
@ 2021-01-30 21:15 michael-franzese
2021-01-31 0:24 ` michael-franzese
0 siblings, 1 reply; 2+ messages in thread
From: michael-franzese @ 2021-01-30 21:15 UTC (permalink / raw)
To: Help Gnu Emacs
I have a problem on the correct way to display line and column numbers
together with a ruler and whitespace highlighting, with the ability to
cycle through the different options.
(defvar dfv-highlight-spaces-state nil)
(defun cycle-highlight-spaces ()
"Cycle though character highlighting (tabs and trailing spaces)."
(interactive)
(pcase dfv-highlight-spaces-state
(2 (display-line-numbers-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(ruler-mode 1)
(whitespace-mode 0)
(message "%s" "Enable: Ruler only")
(setq dfv-highlight-spaces-state 3))
(3 (ruler-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(display-line-numbers-mode 0)
(whitespace-mode 0)
(message "%s" "Disable: Show spaces & cursor position")
(setq dfv-highlight-spaces-state 1))
(_ (ruler-mode 1)
(setq line-number-mode t)
(setq column-number-mode t)
(display-line-numbers-mode 1)
(whitespace-mode 1)
(message "%s" "Enable: Show spaces & cursor position")
(setq dfv-highlight-spaces-state 2)) ))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: display line and column numbers together with ruler and whitespace highlighting
2021-01-30 21:15 display line and column numbers together with ruler and whitespace highlighting michael-franzese
@ 2021-01-31 0:24 ` michael-franzese
0 siblings, 0 replies; 2+ messages in thread
From: michael-franzese @ 2021-01-31 0:24 UTC (permalink / raw)
To: michael-franzese; +Cc: Help Gnu Emacs
I have re-coded my function cycle-posn-cursor-spaces
The funny thing is that calling posn-cursor-spaces does not enable
ruler-mode, yet (setq line-number-mode t) and (setq column-number-mode t)
are executed correctly.
(require 'whitespace)
(setq whitespace-style '(face tab-mark tabs trailing))
(defvar dfv-posn-cursor-spaces-state nil)
(defun cycle-posn-cursor-spaces ()
"Cycle though character highlighting (tabs and trailing spaces)."
(interactive)
;;
(pcase dfv-posn-cursor-spaces-state
;;
(1 (ruler-mode 1)
(setq line-number-mode t)
(setq column-number-mode t)
(whitespace-mode 1)
(message "%s" "Enable: Show position of cursor and spaces")
(setq dfv-posn-cursor-spaces-state 2))
;;
(2 (setq line-number-mode nil)
(setq column-number-mode nil)
(whitespace-mode 0)
(message "%s" "Enable: Show position of cursor")
(setq dfv-posn-cursor-spaces-state 0))
;;
(_ (ruler-mode 0)
(setq line-number-mode nil)
(setq column-number-mode nil)
(whitespace-mode 0)
(message "%s" "Disable: Show position of cursor and spaces")
(setq dfv-posn-cursor-spaces-state 1)) ))
(defun posn-cursor-spaces ()
"Shows position of cursor and spaces."
(interactive)
(setq dfv-posn-cursor-spaces-state 1)
(cycle-posn-cursor-spaces))
> Sent: Sunday, January 31, 2021 at 9:15 AM
> From: michael-franzese@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: display line and column numbers together with ruler and whitespace highlighting
>
> I have a problem on the correct way to display line and column numbers
> together with a ruler and whitespace highlighting, with the ability to
> cycle through the different options.
>
>
> (defvar dfv-highlight-spaces-state nil)
>
> (defun cycle-highlight-spaces ()
> "Cycle though character highlighting (tabs and trailing spaces)."
> (interactive)
>
> (pcase dfv-highlight-spaces-state
> (2 (display-line-numbers-mode 0)
> (setq line-number-mode nil)
> (setq column-number-mode nil)
> (ruler-mode 1)
> (whitespace-mode 0)
> (message "%s" "Enable: Ruler only")
> (setq dfv-highlight-spaces-state 3))
>
> (3 (ruler-mode 0)
> (setq line-number-mode nil)
> (setq column-number-mode nil)
> (display-line-numbers-mode 0)
> (whitespace-mode 0)
> (message "%s" "Disable: Show spaces & cursor position")
> (setq dfv-highlight-spaces-state 1))
>
> (_ (ruler-mode 1)
> (setq line-number-mode t)
> (setq column-number-mode t)
> (display-line-numbers-mode 1)
> (whitespace-mode 1)
> (message "%s" "Enable: Show spaces & cursor position")
> (setq dfv-highlight-spaces-state 2)) ))
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-31 0:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-30 21:15 display line and column numbers together with ruler and whitespace highlighting michael-franzese
2021-01-31 0:24 ` michael-franzese
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).