From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dale Sedivec Newsgroups: gmane.emacs.bugs Subject: bug#37467: 26.3; whitespace-mode doesn't update BOB/EOB highlights Date: Fri, 20 Sep 2019 00:30:07 -0500 Message-ID: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="21274"; mail-complaints-to="usenet@blaine.gmane.org" To: 37467@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 20 07:31:22 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iBBVq-0005Me-4w for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Sep 2019 07:31:22 +0200 Original-Received: from localhost ([::1]:51438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBBVo-00007p-1E for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Sep 2019 01:31:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40425) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBBVf-00006b-G0 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:31:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBBVb-0003Yx-9s for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:31:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBBVW-0003WT-C1 for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iBBVW-0005Jd-7U for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dale Sedivec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Sep 2019 05:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37467 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156895741820129 (code B ref -1); Fri, 20 Sep 2019 05:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Sep 2019 05:30:18 +0000 Original-Received: from localhost ([127.0.0.1]:56630 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBBUn-0005Ea-TJ for submit@debbugs.gnu.org; Fri, 20 Sep 2019 01:30:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:47133) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iBBUl-0005ES-NW for submit@debbugs.gnu.org; Fri, 20 Sep 2019 01:30:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40373) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBBUj-0008MJ-Go for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:30:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBBUh-00039p-GY for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:30:13 -0400 Original-Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:46827) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iBBUh-00039M-2E for bug-gnu-emacs@gnu.org; Fri, 20 Sep 2019 01:30:11 -0400 Original-Received: by mail-io1-xd31.google.com with SMTP id c6so211705ioo.13 for ; Thu, 19 Sep 2019 22:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codefu-org.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=cZIAgbcJnO62DRZBkQ6Rh+GSLICKYngsuwVxqrA/5tI=; b=PB7iv8VSY5vuFKLyIciKUz/sXLdHRQgS9d5YyTQSFccPSgBPW0SagyElPP4toxpgdv XgWvzRqDGxxf4YohZjm/eMfEyKNFU1JmOJol/BAM8Y9lK3ARSXr/Yf12crycYiiiIEbu GnT0pMThD2IyJD2+EjTXfyV66a91ZsL+e4Dr2ftPaFbDBrT89gZUmobfTdtm2QeVY1Fs 8QJBMLd8KJTtE2LTKophpMzf3SavyuursTRvDzQq2tKPL3v/mBEiOx5BLdcM9lGfcFAA 0TQ717vOmsZbkDPEjgLT355QmZjHmB9i6X/dq1fNEbuWIX4SVFQ6ep7gVxxYtBfO+NFo pJag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=cZIAgbcJnO62DRZBkQ6Rh+GSLICKYngsuwVxqrA/5tI=; b=cVgpG5qLgT4YrDYdA+cVXlfzFMmaeeZCbEl0JGAxHztZyzl/eDv+KXgzQMlGXyuOH/ PdbFqXAZ4vFGclqlLMyMKdAfaqLpByj2U+mtoyGLoiyOfTaaMjwDj2ngZgjuCEA8c/jF mgC4kOuYoA20zssNyWUYaxPbGA943BTYbltC30uSAE0R06x0LgpvS1LV87L6s/iOfsGi Wk5OEy/OzQ4Vs0OFRHY6vZnp5uQ5ViB3b9UTHgxH79QKg+6pkZm+fdH6KmK9YwC0g1XG 0nd/VP1RTGA6IQUAd5h0TqIWmBeZNUIBFA7hk9+VWvBirvO5TLszeVdO6K4NGoswzph1 CHyw== X-Gm-Message-State: APjAAAWbr/CJnp5yNqQAJU96gsAaElJ/66ZmKR0k9znJE9AcvAaMLdbu yp2cLqthVTeKblrgnxlbg0QkYfvkBOM0uQ== X-Google-Smtp-Source: APXvYqylO7aotl1bVIz8eZnaS/waI0nHzQw6SkCXiV1phGXaht6nVDL05FRXVKR/3zoCV8PsjkcJAQ== X-Received: by 2002:a6b:6110:: with SMTP id v16mr462206iob.199.1568957408930; Thu, 19 Sep 2019 22:30:08 -0700 (PDT) Original-Received: from dale.caliginous.net (152.160.30.136.in-addr.arpa. [136.30.160.152]) by smtp.gmail.com with ESMTPSA id l19sm725132iok.14.2019.09.19.22.30.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Sep 2019 22:30:08 -0700 (PDT) X-Mailer: Apple Mail (2.3445.104.11) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:166742 Archived-At: whitespace-mode doesn't seem to un-highlight empty lines at BOB/EOB if = you insert non-white-space characters in the middle of a run of blank = lines. Steps to reproduce: 1. emacs -Q 2. M-x whitespace-mode RET in the *scratch* buffer you start in. 3. Type C-2 RET C-2 C-p. The bottom three lines of the buffer are now = blank lines, point is on the penultimate line, and whitespace-mode has = thus correctly highlighted the three blank lines at EOB with face = whitespace-empty. 4. Type x. To be clear, the buffer contents are now as follows, with point at "|": ~~~~~~ ;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. x| ~~~~~~ Expected results: The bottom line is highlighted by whitespace-mode, no = other lines are highlighted. Observed results: The bottom line is correctly highlighted, and the = highlighting is cleared from line 4 with the "x", but line 3 remains = highlighted with face whitespace-empty. There is a second bug too: 5. Type to delete the x. Expected results: The bottom lines 3=E2=80=935 are now highlighted with = whitespace-empty. Observed results: Only the bottom two blank lines 4=E2=80=935 are = highlighted with whitespace-empty. The adjacent blank line 3 is not = highlighted. Note that you can get line 3 correctly re-highlighted by moving to EOB = then up one line (M-> C-p). I believe you can reproduce this same behavior at the beginning of the = buffer as well, using similar steps. These bugs may seem obscure, but I hit them surprisingly often at EOB = when programming: I enter a few blank lines at EOB as I prepare to = append code to the buffer, but then stop and move upwards to make some = changes, before returning to near-EOB and trying to enter some lines, at = which point I am left with some incorrect whitespace-mode highlights. My first guess at fixing this (only at EOB so far, not BOB) was to use = font lock multiline: * I set the font-lock-multiline property non-nil in = whitespace-font-lock-keywords for whitespace-empty-at-eob-regexp. * I make whitespace-mode install a new buffer-local function to = font-lock-extend-region-functions to correctly identify the region for = fontification at EOB. (Note that (whitespace-looking-back = whitespace-empty-at-eob-regexp nil) was handy here.) However, this only solved the first problem, removing highlighting as = desired at the end of step 4, above. I have not yet been able to solve = the problem of re-highlighting line 3 at the end of my step 5. = whitespace-post-command-hook is doing some work to determine what to = refontify, and understanding of that function has thus far eluded me. I = suspect a solution for one or both of these bugs lies in there, however. Thanks for your consideration! Dale In GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 = Version 10.14.6 (Build 18G87)) of 2019-08-29 built on mojave.internal.macports.net Windowing system distributor 'Apple', version 10.3.1671 Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Configured using: 'configure --prefix=3D/opt/local --without-dbus --without-gconf --without-libotf --without-m17n-flt --without-gpm --with-gnutls --with-xml2 --with-modules --infodir /opt/local/share/info/emacs --with-ns --with-lcms2 'CFLAGS=3D-pipe -Os = -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf= orm/Developer/SDKs/MacOSX10.14.sdk -arch x86_64' 'CPPFLAGS=3D-I/opt/local/include = -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platf= orm/Developer/SDKs/MacOSX10.14.sdk' 'LDFLAGS=3D-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie = -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOS= X.platform/Developer/SDKs/MacOSX10.14.sdk -arch x86_64'' Configured features: JPEG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2 Important settings: value of $LC_COLLATE: C value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 203911 12801) (symbols 48 20094 2) (miscs 40 70 181) (strings 32 28190 1477) (string-bytes 1 764094) (vectors 16 35016) (vector-slots 8 723944 9708) (floats 8 48 69) (intervals 56 236 0) (buffers 992 12))