From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pietru@caramail.com Newsgroups: gmane.emacs.help Subject: Cycle that highlights whitespace and displays line-column numbers Date: Fri, 29 Jan 2021 17:56:37 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5725"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 29 18:35:17 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5Xfw-0001LV-Ay for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 29 Jan 2021 18:35:16 +0100 Original-Received: from localhost ([::1]:46336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Xfv-0008Nh-AR for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 29 Jan 2021 12:35:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5X4c-0005G4-Pm for help-gnu-emacs@gnu.org; Fri, 29 Jan 2021 11:56:42 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:41887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5X4b-0000po-36 for help-gnu-emacs@gnu.org; Fri, 29 Jan 2021 11:56:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1611939397; bh=LZ41Jv7Aps4ycgcC0eGsWKZK8+gME8p7+ZDuXE3wbwk=; h=X-UI-Sender-Class:From:To:Subject:Date; b=bq7HF4+qiatFwZgpBg6+6g6SPIWjks8UvPilaHLIOkyHz26rl++QI2smIFS4aTFxE r7zQbdCEDiCBQo74euAulvnlH0iZYgKo5++/oPRx1Kn6yAfCkgY6q6yUCJI1m8WEjv ZPOPXCrytifZ/AyRTE8/NRMqqYGYXcpDZcs+TtX0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs02.server.lan [172.19.170.129]) (via HTTP); Fri, 29 Jan 2021 17:56:37 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:+Br6wdCPyMkdw7B5bP88Q5xmrlCbMjfF8T8Kqz1DsYPgRaxzuT8Y8/pSr8D8QFT8jUe20 IGdbJh0rfZ8ii76YSf58QIEW0kqmVNPdXXpRoeGfNOngaiNloBLAk2zVKksIFY7HKVIxPTUFq/B+ 6iU+U6Xsi0lmxLtYc+ZlVEBQKDYrU+9yANJ86gQNsHWs5OTiaT8HApU24fawjWksHcMNpGSpFPbY 7jyUOsl+iYWojfQ0iuVKHgGRvohN6qUrwr/nT4NI993ESl/Zv2zi4OlcTnXCFXVoYsHbyXRD2WFk cw= X-UI-Out-Filterresults: notjunk:1;V03:K0:vUmsOaOgOz8=:Hv8lpsnpZvyFGdgEo8Ham/ 5G3LqK8PDvVfzkG6pVtdC/30sAPDb6CXRzsowePoZks4Jv5r8ebpuWwz6Sj6cA5jrbc6SvtvU FH+CIxWheytscxboc3jim+3qRB/L5xTVVnawZJMCFd49xlGBXIPXyhLALwSGWYLGbDFpua+kO C3xlCQtiF1OwvFyqgqS+nnV3uUdsfnoC5J8zJqWpxpQHCPt7TydDovpiJmPDHy89bV8xnYgye WOdm6Gg5vt3qH0lJqFPmATEYFMoLpIsY/clJRZpuAy4mQ1qbb2hCGj6pd2VFROv529N11SzPR dmXjnKFHjS3yGKYMPQvn2aphBBzl5OUBXdPlI4r0Q53XYwWLCk1Gb+6LVnGCNRuIH/5McGXOU Cne7NKebGPEVsSFbjyZHEYGyTnFpjf80+iwsUJ3I0D4eSAYHj+DH20Pm3oiEa/3USwm7EUipk OlAGEoNSWbVN/LjttnazVEDzab8VpprBNZy9Fifu1x+B8A8axWM6bOCy9bCrV7JmfCIWycagy MIYwYbm/i4JZkc3XjjL9pcfYYVEEpu1pvvOAWDu4xUgtXFg4z7zvLD0S6EvOByqUDQ5E3wnTH 5WvHpCzHXItpc= Received-SPF: pass client-ip=212.227.17.22; envelope-from=pietru@caramail.com; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127427 Archived-At: 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)) ))