help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

display line and column numbers together with ruler and whitespace highl


From: michael-franzese
Subject: display line and column numbers together with ruler and whitespace highlighting
Date: Sat, 30 Jan 2021 22:15:39 +0100

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]