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: Re: Cycle that highlights whitespace and displays line-column numbers Date: Fri, 29 Jan 2021 20:59:31 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17333"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: pietru@caramail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 29 20:59:55 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 1l5Zvv-0004R3-SL for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 29 Jan 2021 20:59:55 +0100 Original-Received: from localhost ([::1]:49996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Zvu-0007lU-UY for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 29 Jan 2021 14:59:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5Zvc-0007lM-7b for help-gnu-emacs@gnu.org; Fri, 29 Jan 2021 14:59:36 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:34789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5Zva-0003Du-84 for help-gnu-emacs@gnu.org; Fri, 29 Jan 2021 14:59:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1611950372; bh=3RoZemgFFqrqTcf+PVQv0E9kUG9MYtw49tKnh0Aph1k=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=LDmWM48dI1K62Ai2xd+eUTYIZ9grjXiSDXZDN1rKV1yISI6FZzv4lL7HcoEA6SlAw 9t4FPHCVxfjG5lfOExs3mrXDPmIJLNP9Jhy6n9QBWc3c8o6V8nATw40E14jKOoDf5x b6Fl3o6NBx5rmylQJVu4Hac3QhpgtiS6aN/XIyd4= 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-bs16.server.lan [172.19.170.184]) (via HTTP); Fri, 29 Jan 2021 20:59:31 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:KcXNVCwEAE3iLn2Dr4n+2cEPDk3OUo+LzNr3rS+DEGOvi1TuKJJI/IbbRFHsz49fXwfkr y9nIzxlolIj1YN5uAxsxajlfnt1fBjT8WGa6PAi1rpPZmCo2wtQzkDQrtnMbt4QGP2qWRp+cn+Il DKJkOf4KWOwMBy5/1VwZVaxtm/0198u7crPKWyYm1Jp0CN2+zcTjjXrruqfFJQClfDsYaGr8o1yL iPzeGR5bKkq7s3EYfeNoEKmCM8Mc/YDmaaaecWiZmVjA41FsHgAJJC4dihabcDk4IaePUaMCIOjO U8= X-UI-Out-Filterresults: notjunk:1;V03:K0:GD2B1ybVnY0=:CVW45UiHli0Rh0tOhlgeLM 8y3RWi4d34l2rFUDNCME5kcmHXcK9l90yYWoAUqh+hir0ZxNkF2xBxkrU6zp7UKzxirge5ZVe Y2ufGBmTsqtNefHgGmgCG5dAVPpwUPMiMKwL1TcM31lYYCqJmEDHxpkqIy0REtlDsZcE3rGAf 9aibzstKfyLmBqQaFB1p3sCjpYqKuA/lIsXvLWe0oXCN+vbKjuO9Cled5GoDLap/L61Kpa7xc nxRkOUNmEbBixluXgWVNH8lvGF887slDsy0QMDAw8/h/of/1cADaTOxQwdtQhaGI8xHlHj98z U/d5hmnxsXsrYbYOrBNpBpZRs1aqkLJq4f6pvExjdmA6FrRi1MIWVrIhSihfflfSV21/kCalO ajMMAcmIph8e/iC5rfW5uL2B1TdjVkYgf4BIbsiR9piaGCwDWvcfUYLn3WBmaX6h1WfIX0gmw sUI8kEsulV8+uyH9dZtdxWC0jcGVmGOThQY42wZY9x6t1b3EC8xtu8J6B/k+Y9UKhrVyQoS5F Mu1AKkktaTPDg/Q5ZVZ00ZvHZ/3Mui5zi6I/FSxC9j2JeW95UghiKw+0v5ermqYZGxap7qNNM Y5ekjo1mkKPwE= Received-SPF: pass client-ip=212.227.15.15; 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:127428 Archived-At: Am quite unsure how to use the commands for displaying column and line numbers: line-number-mode, column-number-mode, display-line-numbers-m= ode. > Sent: Saturday, January 30, 2021 at 4:56 AM > From: pietru@caramail.com > To: "Help Gnu Emacs" > Subject: Cycle that highlights whitespace and displays line-column numbe= rs > > 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)) )) > > > > >