all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#37467: 26.3; whitespace-mode doesn't update BOB/EOB highlights
@ 2019-09-20  5:30 Dale Sedivec
  2019-10-09 13:42 ` bug#37467: info from whitespace mode author to help fix bug Christian Seberino
  2022-06-29 21:28 ` bug#37467: [PATCH] whitespace: Redo BoB/EoB empty line highlighting Richard Hansen
  0 siblings, 2 replies; 9+ messages in thread
From: Dale Sedivec @ 2019-09-20  5:30 UTC (permalink / raw)
  To: 37467

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 <backspace> to delete the x.

Expected results: The bottom lines 3–5 are now highlighted with whitespace-empty.

Observed results: Only the bottom two blank lines 4–5 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=/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=-pipe -Os
-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
-arch x86_64' 'CPPFLAGS=-I/opt/local/include
-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk'
'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-no_pie
-Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.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))





^ permalink raw reply	[flat|nested] 9+ messages in thread
* bug#42110: Whitespace Newline Face Doesn't Disappear
@ 2020-06-28 15:37 Robin via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2020-06-28 16:28 ` Basil L. Contovounesios
  0 siblings, 1 reply; 9+ messages in thread
From: Robin via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2020-06-28 15:37 UTC (permalink / raw)
  To: 42110

[-- Attachment #1: Type: text/plain, Size: 7145 bytes --]

From: Robin Choudhury <robin_choudhury1@protonmail.com>
To: bug-gnu-emacs@gnu.org
Subject: 26.3; Whitespace Newline Face Doesn't Disappear
-----

When typing at the bottom of a document, a newline is inserted. An
additional newline is then inserted. Upon insertion, a face higlights
the first newline's emptiness. Typing in the second newline should make
this face disappear. However, it remains.

The whitespace configuration (13.2.2):
(use-package whitespace
:ensure t
:init
(setq prelude-whitespace nil)
(setq whitespace-line-column 80)
;; Highlight trailing whitespace
(setq whitespace-style
;; There's a bug in empty where the face doesn't go away after
;; typing below the newline.
'(face trailing lines-tail indentation::space tab-mark empty))
:config
(global-whitespace-mode t))

-----

In GNU Emacs 26.3 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101))
of 2020-06-27 built on jupiter.local
Windowing system distributor 'Apple', version 10.3.1894
Recent messages:
Checking for load-path shadows...done
Auto-saving...done
Saving file /Users/robin/*message*-20200628-083045...
Wrote /Users/robin/*message*-20200628-083045
Auto-saving...done
Quit [2 times]
Mark saved where search started [2 times]
Saving file /Users/robin/*message*-20200628-083045...
Wrote /Users/robin/*message*-20200628-083045
Mark saved where search started [2 times]

Configured using:
'configure --disable-dependency-tracking --disable-silent-rules
--enable-locallisppath=/usr/local/share/emacs/site-lisp
--infodir=/usr/local/Cellar/emacs-plus@26/26.3/share/info/emacs
--prefix=/usr/local/Cellar/emacs-plus@26/26.3 --with-xml2 --with-gnutls
--with-imagemagick --with-modules --with-rsvg --with-ns
--disable-ns-self-contained'

Configured features:
JPEG RSVG IMAGEMAGICK GLIB NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS NS MODULES THREADS LCMS2

Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
projectile-mode: t
doom-modeline-mode: t
helm-mode: t
helm--remap-mouse-mode: t
evil-leader-mode: t
global-magit-file-mode: t
diff-auto-refine-mode: t
magit-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
shell-dirtrack-mode: t
evil-mode: t
evil-local-mode: t
global-whitespace-mode: t
show-paren-mode: t
mode-icons-mode: t
global-hl-line-mode: t
global-hl-todo-mode: t
display-time-mode: t
global-linum-mode: t
linum-mode: t
override-global-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t

Load-path shadows:
None found.

Features:
(misearch multi-isearch pp shadow sort mail-extr emacsbug sendmail
winner helm-command helm-elisp helm-eval edebug helm-info face-remap
org-rmail org-mhe org-irc org-info org-gnus nnir gnus-sum gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls
utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range gnus-win gnus
nnheader wid-edit org-docview doc-view jka-compr image-mode org-bibtex
bibtex org-bbdb org-w3m vc-git vc-bzr vc-src vc-sccs vc-svn vc-cvs
vc-rcs vc vc-dispatcher project ido projectile grep compile ibuf-ext
ibuffer ibuffer-loaddefs rainbow-delimiters elec-pair doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path
rx f s all-the-icons all-the-icons-faces data-material data-weathericons
data-octicons data-fileicons data-faicons data-alltheicons memoize
exec-path-from-shell diminish helm-mode helm-files helm-buffers
helm-occur helm-tags helm-locate helm-grep helm-regexp helm-utils
helm-help helm-types helm helm-source eieio-compat helm-multi-match
helm-lib org-bullets org-element avl-tree generator org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob
ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs find-func cal-menu calendar cal-loaddefs evil-leader
evil-magit magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff-mode magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process magit-mode git-commit transient magit-git magit-section
magit-utils crm log-edit message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec epa derived epg gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047
rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils
mailheader pcvs-util add-log with-editor async-bytecomp async server
subr-x dash evil evil-keybindings evil-integration undo-tree diff
evil-maps evil-commands reveal flyspell ispell evil-jumps
evil-command-window evil-types evil-search evil-ex shell pcomplete
comint ansi-color evil-macros evil-repeat evil-states evil-core
evil-common windmove thingatpt rect evil-digraphs evil-vars ring edmacro
kmacro doom-oceanic-next-theme doom-themes doom-themes-base disp-table
whitespace paren time-date warnings mode-icons advice color hl-line
hl-todo cl-extra help-mode time linum use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core finder-inf info package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib 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 738153 45480)
(symbols 48 51716 2)
(miscs 40 668 440)
(strings 32 190321 8761)
(string-bytes 1 5406976)
(vectors 16 84206)
(vector-slots 8 1287169 41462)
(floats 8 980 400)
(intervals 56 2014 1003)
(buffers 992 20))

[-- Attachment #2: Type: text/html, Size: 10208 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-09-11 11:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-20  5:30 bug#37467: 26.3; whitespace-mode doesn't update BOB/EOB highlights Dale Sedivec
2019-10-09 13:42 ` bug#37467: info from whitespace mode author to help fix bug Christian Seberino
2022-06-29 21:28 ` bug#37467: [PATCH] whitespace: Redo BoB/EoB empty line highlighting Richard Hansen
2022-07-17  4:49   ` bug#37467: Patches to fix Emacs whitespace-mode " Richard Hansen
2022-09-11 11:46   ` bug#42110: Whitespace Newline Face Doesn't Disappear Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2020-06-28 15:37 Robin via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-28 16:28 ` Basil L. Contovounesios
     [not found]   ` <6DSVEaDOI_Q9I_GH8R12lTvRDtbDQ2-4su3haR_jnJeCf6nQ_xCHD0aXRdfwezFBOxGGpwpnfIUdXT-J8_5K_3T9ntDxRQKjFuRfxn9Lkso=@protonmail.com>
2020-06-28 17:21     ` Basil L. Contovounesios
2020-06-28 18:08   ` Reuben Thomas via Bug reports for GNU Emacs, the Swiss army knife of text editors

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.