all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: michael-franzese@gmx.com
To: michael-franzese@gmx.com
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: display line and column numbers together with ruler and whitespace highlighting
Date: Sun, 31 Jan 2021 01:24:11 +0100	[thread overview]
Message-ID: <trinity-ee2d8df3-5ac7-4f6d-a622-6e2a39a68d6b-1612052651410@3c-app-mailcom-bs16> (raw)
In-Reply-To: <trinity-106fcedc-04e8-4781-b073-f371dfa65074-1612041339570@3c-app-mailcom-bs16>

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



      reply	other threads:[~2021-01-31  0:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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

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

  git send-email \
    --in-reply-to=trinity-ee2d8df3-5ac7-4f6d-a622-6e2a39a68d6b-1612052651410@3c-app-mailcom-bs16 \
    --to=michael-franzese@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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.