all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
@ 2016-10-20 12:32 Reuben Thomas
  2016-10-20 22:43 ` Dmitry Gutov
       [not found] ` <handler.24745.B.14769667565022.ack@debbugs.gnu.org>
  0 siblings, 2 replies; 15+ messages in thread
From: Reuben Thomas @ 2016-10-20 12:32 UTC (permalink / raw)
  To: 24745

Tags: patch


whitespace-report-region currently (Emacs 25.1, and identically in
master) fails correctly to detect whitespace at the start and end of the
buffer. This is because the relevant regexps,
whitespace-empty-at-{bob,eob}-regexp, are not anchored to the start and
end of the buffer. Hence, whitespace-report-region finds spurious
matches (for example, diagnosing blank lines at the end of the buffer
whenever there is space at the start of any line).

This behavior is intentional: for highlighting and cleanup purposes,
these regexps are applied explicitly to the start and end of the buffer,
and so both highlighting and cleanup work correctly.

However, I suggest that the intention is wrong: the variables’ names and
documentation refer to the start and end of the buffer, not of the
current region; and further, whitespace at the start or end of a region
is not usually considered a problem.

The fix, therefore, is simple: anchor the default value of the patterns
to the start and end of the buffer respectively. This fixes the bug in
whitespace-report-region when used on the whole buffer, while also
making the behavior for non-whole-buffer regions be what one might
expect: empty lines are only diagnosed if the region includes the start
or end of the buffer.

I attach a patch with this fix.

If the maintainers disagree with my analysis; specifically, if you think
that the empty checks should work at the start and end of the region,
then the fix will be a little more complex, as whitespace-report-region
will have to treat those checks specially, as other parts of the code
do.



In GNU Emacs 25.1.50.9 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-10-15 built on skwd
Repository revision: 4eb4463abf1db904f9e8cdc35156a66f8a10125c
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.1 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_MONETARY: en_GB.utf8
  value of $LC_NUMERIC: en_GB.utf8
  value of $LC_TIME: en_GB.utf8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix

Major mode: Text

Minor modes in effect:
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  buffer-face-mode: t
  flyspell-mode: t
  goto-address-mode: t
  smart-quotes-mode: t
  show-paren-mode: t
  savehist-mode: t
  recentf-mode: t
  minibuffer-electric-default-mode: t
  global-auto-revert-mode: t
  electric-pair-mode: t
  desktop-save-mode: t
  global-whitespace-mode: t
  diff-auto-refine-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  helm-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  async-bytecomp-package-mode: t
  dtrt-indent-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Type C-c C-c to finish, or C-c C-k to cancel
Quit [5 times]
Mark set [2 times]
previous-line: Beginning of buffer [5 times]
Mark activated
Auto-saving...done
Saving file /home/rrt/.local/var/repo/emacs/.git/COMMIT_EDITMSG...
Wrote /home/rrt/.emacs.d/undo-tree/.!home!rrt!.local!var!repo!emacs!.git!COMMIT_EDITMSG.~undo-tree~
Wrote /home/rrt/.local/var/repo/emacs/.git/COMMIT_EDITMSG
Git finished [2 times]

Load-path shadows:
/home/rrt/.emacs.d/elpa/sws-mode-20150317.1245/sws-mode hides /home/rrt/.emacs.d/el-get/jade-mode/sws-mode
/home/rrt/.emacs.d/el-get/emacs-async/async-pkg hides /home/rrt/.emacs.d/el-get/async/async-pkg
/home/rrt/.emacs.d/el-get/emacs-async/dired-async hides /home/rrt/.emacs.d/el-get/async/dired-async
/home/rrt/.emacs.d/el-get/emacs-async/smtpmail-async hides /home/rrt/.emacs.d/el-get/async/smtpmail-async
/home/rrt/.emacs.d/el-get/emacs-async/async-bytecomp hides /home/rrt/.emacs.d/el-get/async/async-bytecomp
/home/rrt/.emacs.d/el-get/emacs-async/async hides /home/rrt/.emacs.d/el-get/async/async
/home/rrt/.emacs.d/elpa/cmake-mode-3.6.2/cmake-mode hides /usr/local/share/emacs/25.1.50/site-lisp/cmake-data/cmake-mode
/home/rrt/.local/share/emacs/site-lisp/whitespace hides /usr/local/share/emacs/25.1.50/lisp/whitespace
/home/rrt/.emacs.d/el-get/cperl-mode/cperl-mode hides /usr/local/share/emacs/25.1.50/lisp/progmodes/cperl-mode
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org hides /usr/local/share/emacs/25.1.50/lisp/org/org
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-mouse hides /usr/local/share/emacs/25.1.50/lisp/org/org-mouse
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-ruby hides /usr/local/share/emacs/25.1.50/lisp/org/ob-ruby
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-asymptote hides /usr/local/share/emacs/25.1.50/lisp/org/ob-asymptote
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-man hides /usr/local/share/emacs/25.1.50/lisp/org/ox-man
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-eval hides /usr/local/share/emacs/25.1.50/lisp/org/ob-eval
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-footnote hides /usr/local/share/emacs/25.1.50/lisp/org/org-footnote
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-shen hides /usr/local/share/emacs/25.1.50/lisp/org/ob-shen
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-lisp hides /usr/local/share/emacs/25.1.50/lisp/org/ob-lisp
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-C hides /usr/local/share/emacs/25.1.50/lisp/org/ob-C
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-sass hides /usr/local/share/emacs/25.1.50/lisp/org/ob-sass
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-css hides /usr/local/share/emacs/25.1.50/lisp/org/ob-css
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-sqlite hides /usr/local/share/emacs/25.1.50/lisp/org/ob-sqlite
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-loaddefs hides /usr/local/share/emacs/25.1.50/lisp/org/org-loaddefs
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-org hides /usr/local/share/emacs/25.1.50/lisp/org/ob-org
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-org hides /usr/local/share/emacs/25.1.50/lisp/org/ox-org
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-ditaa hides /usr/local/share/emacs/25.1.50/lisp/org/ob-ditaa
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-screen hides /usr/local/share/emacs/25.1.50/lisp/org/ob-screen
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-io hides /usr/local/share/emacs/25.1.50/lisp/org/ob-io
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-fortran hides /usr/local/share/emacs/25.1.50/lisp/org/ob-fortran
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-list hides /usr/local/share/emacs/25.1.50/lisp/org/org-list
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-macro hides /usr/local/share/emacs/25.1.50/lisp/org/org-macro
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-latex hides /usr/local/share/emacs/25.1.50/lisp/org/ob-latex
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-ascii hides /usr/local/share/emacs/25.1.50/lisp/org/ox-ascii
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-install hides /usr/local/share/emacs/25.1.50/lisp/org/org-install
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-picolisp hides /usr/local/share/emacs/25.1.50/lisp/org/ob-picolisp
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-R hides /usr/local/share/emacs/25.1.50/lisp/org/ob-R
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-latex hides /usr/local/share/emacs/25.1.50/lisp/org/ox-latex
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-eshell hides /usr/local/share/emacs/25.1.50/lisp/org/org-eshell
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-odt hides /usr/local/share/emacs/25.1.50/lisp/org/ox-odt
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-keys hides /usr/local/share/emacs/25.1.50/lisp/org/ob-keys
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-ref hides /usr/local/share/emacs/25.1.50/lisp/org/ob-ref
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-datetree hides /usr/local/share/emacs/25.1.50/lisp/org/org-datetree
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-exp hides /usr/local/share/emacs/25.1.50/lisp/org/ob-exp
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-beamer hides /usr/local/share/emacs/25.1.50/lisp/org/ox-beamer
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-emacs-lisp hides /usr/local/share/emacs/25.1.50/lisp/org/ob-emacs-lisp
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-matlab hides /usr/local/share/emacs/25.1.50/lisp/org/ob-matlab
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob hides /usr/local/share/emacs/25.1.50/lisp/org/ob
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-indent hides /usr/local/share/emacs/25.1.50/lisp/org/org-indent
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-perl hides /usr/local/share/emacs/25.1.50/lisp/org/ob-perl
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-habit hides /usr/local/share/emacs/25.1.50/lisp/org/org-habit
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-entities hides /usr/local/share/emacs/25.1.50/lisp/org/org-entities
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-rmail hides /usr/local/share/emacs/25.1.50/lisp/org/org-rmail
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-md hides /usr/local/share/emacs/25.1.50/lisp/org/ox-md
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-clojure hides /usr/local/share/emacs/25.1.50/lisp/org/ob-clojure
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-makefile hides /usr/local/share/emacs/25.1.50/lisp/org/ob-makefile
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-plantuml hides /usr/local/share/emacs/25.1.50/lisp/org/ob-plantuml
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-table hides /usr/local/share/emacs/25.1.50/lisp/org/org-table
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-mobile hides /usr/local/share/emacs/25.1.50/lisp/org/org-mobile
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-mhe hides /usr/local/share/emacs/25.1.50/lisp/org/org-mhe
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-lob hides /usr/local/share/emacs/25.1.50/lisp/org/ob-lob
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-capture hides /usr/local/share/emacs/25.1.50/lisp/org/org-capture
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-version hides /usr/local/share/emacs/25.1.50/lisp/org/org-version
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-core hides /usr/local/share/emacs/25.1.50/lisp/org/ob-core
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-table hides /usr/local/share/emacs/25.1.50/lisp/org/ob-table
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-faces hides /usr/local/share/emacs/25.1.50/lisp/org/org-faces
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-compat hides /usr/local/share/emacs/25.1.50/lisp/org/org-compat
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-publish hides /usr/local/share/emacs/25.1.50/lisp/org/ox-publish
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-agenda hides /usr/local/share/emacs/25.1.50/lisp/org/org-agenda
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-maxima hides /usr/local/share/emacs/25.1.50/lisp/org/ob-maxima
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-dot hides /usr/local/share/emacs/25.1.50/lisp/org/ob-dot
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-python hides /usr/local/share/emacs/25.1.50/lisp/org/ob-python
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-crypt hides /usr/local/share/emacs/25.1.50/lisp/org/org-crypt
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-protocol hides /usr/local/share/emacs/25.1.50/lisp/org/org-protocol
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-scheme hides /usr/local/share/emacs/25.1.50/lisp/org/ob-scheme
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-awk hides /usr/local/share/emacs/25.1.50/lisp/org/ob-awk
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-w3m hides /usr/local/share/emacs/25.1.50/lisp/org/org-w3m
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-bbdb hides /usr/local/share/emacs/25.1.50/lisp/org/org-bbdb
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-html hides /usr/local/share/emacs/25.1.50/lisp/org/ox-html
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-gnus hides /usr/local/share/emacs/25.1.50/lisp/org/org-gnus
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-js hides /usr/local/share/emacs/25.1.50/lisp/org/ob-js
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-mscgen hides /usr/local/share/emacs/25.1.50/lisp/org/ob-mscgen
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-ocaml hides /usr/local/share/emacs/25.1.50/lisp/org/ob-ocaml
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-icalendar hides /usr/local/share/emacs/25.1.50/lisp/org/ox-icalendar
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-gnuplot hides /usr/local/share/emacs/25.1.50/lisp/org/ob-gnuplot
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-irc hides /usr/local/share/emacs/25.1.50/lisp/org/org-irc
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-haskell hides /usr/local/share/emacs/25.1.50/lisp/org/ob-haskell
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-docview hides /usr/local/share/emacs/25.1.50/lisp/org/org-docview
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-clock hides /usr/local/share/emacs/25.1.50/lisp/org/org-clock
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-lilypond hides /usr/local/share/emacs/25.1.50/lisp/org/ob-lilypond
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-ctags hides /usr/local/share/emacs/25.1.50/lisp/org/org-ctags
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox hides /usr/local/share/emacs/25.1.50/lisp/org/ox
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-bibtex hides /usr/local/share/emacs/25.1.50/lisp/org/org-bibtex
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-element hides /usr/local/share/emacs/25.1.50/lisp/org/org-element
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-id hides /usr/local/share/emacs/25.1.50/lisp/org/org-id
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-archive hides /usr/local/share/emacs/25.1.50/lisp/org/org-archive
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-octave hides /usr/local/share/emacs/25.1.50/lisp/org/ob-octave
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-calc hides /usr/local/share/emacs/25.1.50/lisp/org/ob-calc
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-attach hides /usr/local/share/emacs/25.1.50/lisp/org/org-attach
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-src hides /usr/local/share/emacs/25.1.50/lisp/org/org-src
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-comint hides /usr/local/share/emacs/25.1.50/lisp/org/ob-comint
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-ledger hides /usr/local/share/emacs/25.1.50/lisp/org/ob-ledger
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-plot hides /usr/local/share/emacs/25.1.50/lisp/org/org-plot
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-tangle hides /usr/local/share/emacs/25.1.50/lisp/org/ob-tangle
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-info hides /usr/local/share/emacs/25.1.50/lisp/org/org-info
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-macs hides /usr/local/share/emacs/25.1.50/lisp/org/org-macs
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-pcomplete hides /usr/local/share/emacs/25.1.50/lisp/org/org-pcomplete
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-scala hides /usr/local/share/emacs/25.1.50/lisp/org/ob-scala
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-sql hides /usr/local/share/emacs/25.1.50/lisp/org/ob-sql
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-timer hides /usr/local/share/emacs/25.1.50/lisp/org/org-timer
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-inlinetask hides /usr/local/share/emacs/25.1.50/lisp/org/org-inlinetask
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ob-java hides /usr/local/share/emacs/25.1.50/lisp/org/ob-java
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-feed hides /usr/local/share/emacs/25.1.50/lisp/org/org-feed
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/org-colview hides /usr/local/share/emacs/25.1.50/lisp/org/org-colview
/usr/local/share/emacs/25.1.50/site-lisp/org-mode/ox-texinfo hides /usr/local/share/emacs/25.1.50/lisp/org/ox-texinfo

Features:
(shadow sort mail-extr emacsbug rect linum magit-blame magit-stash
magit-bisect magit-remote magit-commit magit-sequence magit magit-apply
magit-wip magit-log magit-diff smerge-mode magit-core magit-autorevert
magit-process magit-popup magit-mode magit-git crm magit-section
magit-utils git-commit log-edit message sendmail rfc822 mml mml-sec epg
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
with-editor dash image-file vc vc-dispatcher helm-command eieio-opt
helm-elisp helm-eval edebug misearch multi-isearch winner cperl-mode
css-mode smie face-remap flyspell ispell goto-addr smart-quotes
sgml-mode jka-compr flymake paredit server ox-odt rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html ox-ascii
ox-publish ox org-element avl-tree tramp-cache tramp-sh yasnippet paren
savehist recentf tree-widget wid-edit minibuf-eldef autorevert
filenotify elec-pair desktop frameset cus-start cus-load iimage org
org-macro org-footnote org-pcomplete org-list org-faces org-entities
noutline outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs go-mode
find-file forth-mode etags xref project info-look speedbar sb-image
ezimage dframe whitespace bug-reference-github bug-reference vc-git
diff-mode undo-tree diff helm-mode helm-files rx image-dired tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
format-spec dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen
helm-tags helm-bookmark helm-adaptive helm-info bookmark helm-locate
helm-grep helm-regexp helm-external helm-net browse-url xml url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse auth-source gnus-util mm-util help-fns
mail-prsvr password-cache url-vars mailcap helm-utils compile comint
ansi-color ring helm-help helm-types helm derived helm-source
eieio-compat helm-multi-match easy-mmode helm-lib helm-config
helm-easymenu async-bytecomp async locate finder-inf tex-site
go-mode-autoloads info edmacro kmacro windows revive init-paredit
dtrt-indent csv init-eldoc eldoc-extension advice .loaddefs eieio
eieio-core cl-macs el-get el-get-autoloading el-get-list-packages
el-get-dependencies el-get-build el-get-status pp el-get-methods
el-get-fossil el-get-svn el-get-pacman el-get-github-zip
el-get-github-tar el-get-http-zip el-get-http-tar el-get-hg el-get-go
el-get-git-svn el-get-fink el-get-emacswiki el-get-http el-get-notify
el-get-emacsmirror el-get-github el-get-git el-get-elpa package
epg-config seq byte-opt el-get-darcs el-get-cvs el-get-bzr el-get-brew
el-get-builtin el-get-apt-get el-get-recipes el-get-byte-compile
el-get-custom cl-seq el-get-core autoload lisp-mnt bytecomp byte-compile
cl-extra help-mode easymenu cconv cl gv cl-loaddefs pcase cl-lib dired
debian-el debian-el-loaddefs org-install dpkg-dev-el
dpkg-dev-el-loaddefs devhelp user-site-loaddefs time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core 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 charscript case-table epa-hook
jka-cmpr-hook help simple abbrev 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 dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 900071 66624)
 (symbols 48 50698 0)
 (miscs 40 944 1231)
 (strings 32 197868 33051)
 (string-bytes 1 6425863)
 (vectors 16 76424)
 (vector-slots 8 1943239 128378)
 (floats 8 617 583)
 (intervals 56 19804 193)
 (buffers 976 55)
 (heap 1024 75902 7551))

-- 
http://rrt.sc3d.org/

===File /home/rrt/.local/var/repo/emacs/0001-whitespace-fix-bob-eob-checks.patch===
From 0f0219bff7f1e365e8575e2e61983c0926cf787d Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Thu, 20 Oct 2016 13:17:58 +0100
Subject: [PATCH] whitespace: fix bob/eob checks

* whitespace.el: make `empty' checks work at beginning & end of buffer
in whitespace-report-region, and only there (i.e. they will never match
in regions that don't include the start or end of the buffer).
---
 lisp/whitespace.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0f6b8df..f790ac5 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -828,7 +828,7 @@ whitespace-indentation-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)"
+(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
   "Specify regexp for empty lines at beginning of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -836,7 +836,7 @@ whitespace-empty-at-bob-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)"
+(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)\\'"
   "Specify regexp for empty lines at end of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -1515,7 +1515,7 @@ whitespace-cleanup
 	    (when (looking-at whitespace-empty-at-bob-regexp)
 	      (delete-region (match-beginning 1) (match-end 1)))
 	    (when (re-search-forward
-		   (concat whitespace-empty-at-eob-regexp "\\'") nil t)
+                   whitespace-empty-at-eob-regexp nil t)
 	      (delete-region (match-beginning 1) (match-end 1)))))))
     ;; PROBLEM 3: 8 or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
-- 
2.7.4

============================================================





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-20 12:32 bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks Reuben Thomas
@ 2016-10-20 22:43 ` Dmitry Gutov
  2016-10-21 14:42   ` Reuben Thomas
       [not found] ` <handler.24745.B.14769667565022.ack@debbugs.gnu.org>
  1 sibling, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-10-20 22:43 UTC (permalink / raw)
  To: Reuben Thomas, 24745

On 20.10.2016 15:32, Reuben Thomas wrote:
> whitespace-report-region currently (Emacs 25.1, and identically in
> master) fails correctly to detect whitespace at the start and end of the
> buffer.

Could you please describe the problematic behavior exactly?

The patch seems sound, though.





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

* bug#24745: Acknowledgement (25.1.50; whitespace.el: fix beginning/end of buffer checks)
       [not found] ` <handler.24745.B.14769667565022.ack@debbugs.gnu.org>
@ 2016-10-21 14:38   ` Reuben Thomas
  0 siblings, 0 replies; 15+ messages in thread
From: Reuben Thomas @ 2016-10-21 14:38 UTC (permalink / raw)
  To: 24745


[-- Attachment #1.1: Type: text/plain, Size: 992 bytes --]

I have expanded my work on whitespace.el to address other problems.

First, I revised my previous patch, which had an error in the new version
of whitespace-empty-at-eob-regexp.

Next, I removed some duplicate documentation from the Commentary section:
it was already out of date in one or two places, and it duplicated
information readily available in docstrings.

Next, I fixed some problems with whitespace-space-after-tab-regexp.

Finally, I fixed whitespace-report-region to respect user settings: it no
longer returns true when the region has a problem not covered by
whitespace-style; however, it still diagnoses and reports all possible
problems.

There's one more problem with whitespace-report-region I would like to fix,
which is that currently the force parameter changes whitespace-style
globally; it should, I believe, only change it for the duration of the
function.

I'd appreciate some review of these patches (all against current git
master).

TIA!

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 2090 bytes --]

[-- Attachment #2: 0001-whitespace-fix-bob-eob-checks.patch --]
[-- Type: text/x-patch, Size: 1736 bytes --]

From 343ecf32200da2b1d8e93b7d3cc16da288ec851e Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Thu, 20 Oct 2016 13:17:58 +0100
Subject: [PATCH 1/4] whitespace: fix bob/eob checks

* whitespace.el: make `empty' checks work at beginning & end of buffer
in whitespace-report-region, and only there (i.e. they will never match
in regions that don't include the start or end of the buffer).
---
 lisp/whitespace.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0f6b8df..6164585 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -828,7 +828,7 @@ whitespace-indentation-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)"
+(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
   "Specify regexp for empty lines at beginning of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -836,7 +836,7 @@ whitespace-empty-at-bob-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)"
+(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]*\\(\n\\{2,\\}\\|[ \t]+\\)\\)\\'"
   "Specify regexp for empty lines at end of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -1515,7 +1515,7 @@ whitespace-cleanup
 	    (when (looking-at whitespace-empty-at-bob-regexp)
 	      (delete-region (match-beginning 1) (match-end 1)))
 	    (when (re-search-forward
-		   (concat whitespace-empty-at-eob-regexp "\\'") nil t)
+                   whitespace-empty-at-eob-regexp nil t)
 	      (delete-region (match-beginning 1) (match-end 1)))))))
     ;; PROBLEM 3: 8 or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
-- 
2.7.4


[-- Attachment #3: 0002-whitespace.el-remove-duplicate-documentation.patch --]
[-- Type: text/x-patch, Size: 5036 bytes --]

From 23658bf1cf606408f1aea2385c2e64ae150a268a Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:20:07 +0100
Subject: [PATCH 2/4] whitespace.el: remove duplicate documentation

* whitespace.el: remove duplicate documentation from the Commentary
  section which duplicate and in some places contradict (due to being
  out of date) the docstrings.
---
 lisp/whitespace.el | 116 -----------------------------------------------------
 1 file changed, 116 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 6164585..eeb1730 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -182,45 +182,6 @@
 ;; `whitespace-cleanup-region'
 ;;    Cleanup some blank problems at region.
 ;;
-;; The problems, which are cleaned up, are:
-;;
-;; 1. empty lines at beginning of buffer.
-;; 2. empty lines at end of buffer.
-;;    If `whitespace-style' includes the value `empty', remove all
-;;    empty lines at beginning and/or end of buffer.
-;;
-;; 3. 8 or more SPACEs at beginning of line.
-;;    If `whitespace-style' includes the value `indentation':
-;;    replace 8 or more SPACEs at beginning of line by TABs, if
-;;    `indent-tabs-mode' is non-nil; otherwise, replace TABs by
-;;    SPACEs.
-;;    If `whitespace-style' includes the value `indentation::tab',
-;;    replace 8 or more SPACEs at beginning of line by TABs.
-;;    If `whitespace-style' includes the value `indentation::space',
-;;    replace TABs by SPACEs.
-;;
-;; 4. SPACEs before TAB.
-;;    If `whitespace-style' includes the value `space-before-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::tab', replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::space', replace TABs by SPACEs.
-;;
-;; 5. SPACEs or TABs at end of line.
-;;    If `whitespace-style' includes the value `trailing', remove all
-;;    SPACEs or TABs at end of line.
-;;
-;; 6. 8 or more SPACEs after TAB.
-;;    If `whitespace-style' includes the value `space-after-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value `space-after-tab::tab',
-;;    replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-after-tab::space', replace TABs by SPACEs.
-;;
 ;;
 ;; Hooks
 ;; -----
@@ -237,83 +198,6 @@
 ;;    It is evaluated after whitespace package is loaded.
 ;;
 ;;
-;; Options
-;; -------
-;;
-;; Below it's shown a brief description of whitespace options, please,
-;; see the options declaration in the code for a long documentation.
-;;
-;; `whitespace-style'		Specify which kind of blank is
-;;				visualized.
-;;
-;; `whitespace-space'		Face used to visualize SPACE.
-;;
-;; `whitespace-hspace'		Face used to visualize HARD SPACE.
-;;
-;; `whitespace-tab'		Face used to visualize TAB.
-;;
-;; `whitespace-newline'		Face used to visualize NEWLINE char
-;;				mapping.
-;;
-;; `whitespace-trailing'	Face used to visualize trailing
-;;				blanks.
-;;
-;; `whitespace-line'		Face used to visualize "long" lines.
-;;
-;; `whitespace-space-before-tab'	Face used to visualize SPACEs
-;;					before TAB.
-;;
-;; `whitespace-indentation'	Face used to visualize 8 or more
-;;				SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent'	Face used to visualize big indentation.
-;;
-;; `whitespace-empty'		Face used to visualize empty lines at
-;;				beginning and/or end of buffer.
-;;
-;; `whitespace-space-after-tab'	Face used to visualize 8 or more
-;;				SPACEs after TAB.
-;;
-;; `whitespace-space-regexp'	Specify SPACE characters regexp.
-;;
-;; `whitespace-hspace-regexp'	Specify HARD SPACE characters regexp.
-;;
-;; `whitespace-tab-regexp'	Specify TAB characters regexp.
-;;
-;; `whitespace-trailing-regexp'	Specify trailing characters regexp.
-;;
-;; `whitespace-space-before-tab-regexp'	Specify SPACEs before TAB
-;;					regexp.
-;;
-;; `whitespace-indentation-regexp'	Specify regexp for 8 or more
-;;					SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent-regexp'	Specify big indentation at beginning of line
-;;					regexp.
-;;
-;; `whitespace-empty-at-bob-regexp'	Specify regexp for empty lines
-;;					at beginning of buffer.
-;;
-;; `whitespace-empty-at-eob-regexp'	Specify regexp for empty lines
-;;					at end of buffer.
-;;
-;; `whitespace-space-after-tab-regexp'	Specify regexp for 8 or more
-;;					SPACEs after TAB.
-;;
-;; `whitespace-line-column'	Specify column beyond which the line
-;;				is highlighted.
-;;
-;; `whitespace-display-mappings'	Specify an alist of mappings
-;;					for displaying characters.
-;;
-;; `whitespace-global-modes'	Modes for which global
-;;				`whitespace-mode' is automagically
-;;				turned on.
-;;
-;; `whitespace-action'		Specify which action is taken when a
-;;				buffer is visited or written.
-;;
-;;
 ;; Acknowledgments
 ;; ---------------
 ;;
-- 
2.7.4


[-- Attachment #4: 0003-whitespace.el-fix-whitespace-space-after-tab-regexp.patch --]
[-- Type: text/x-patch, Size: 1655 bytes --]

From 41f057a224fec3d672f936b09031e7d595d69cef Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:23:08 +0100
Subject: [PATCH 3/4] whitespace.el: fix whitespace-space-after-tab-regexp

* whitespace.el: match all the spaces after tabs for highlighting, not
  just the first tab-width. Fix whitespace-space-after-tab::space
  version so that it requires at least tab-width spaces, not just 1.
---
 lisp/whitespace.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index eeb1730..b798e7e 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -729,8 +729,8 @@ whitespace-empty-at-eob-regexp
 
 
 (defcustom whitespace-space-after-tab-regexp
-  '("\t+\\(\\( \\{%d\\}\\)+\\)"
-    . "\\(\t+\\) +")
+  '("\t+\\(\\( \\{%d,\\}\\)+\\)"
+    . "\\(\t+\\) \\{%d,\\}")
   "Specify regexp for 8 or more SPACEs after TAB.
 
 It is a cons where the cons car is used for SPACEs visualization
@@ -1558,13 +1558,15 @@ whitespace-replace-action
 
 (defun whitespace-regexp (regexp &optional kind)
   "Return REGEXP depending on `whitespace-indent-tabs-mode'."
-  (cond
-   ((or (eq kind 'tab)
-	whitespace-indent-tabs-mode)
-    (format (car regexp) whitespace-tab-width))
-   ((or (eq kind 'space)
-	(not whitespace-indent-tabs-mode))
-    (cdr regexp))))
+  (format
+   (cond
+    ((or (eq kind 'tab)
+         whitespace-indent-tabs-mode)
+     (car regexp))
+    ((or (eq kind 'space)
+         (not whitespace-indent-tabs-mode))
+     (cdr regexp)))
+   whitespace-tab-width))
 
 
 (defun whitespace-indentation-regexp (&optional kind)
-- 
2.7.4


[-- Attachment #5: 0004-whitespace.el-make-whitespace-report-region-respect-.patch --]
[-- Type: text/x-patch, Size: 1284 bytes --]

From 2a996815dc9bb8922eb9c31014e6526ed6daacb7 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:25:12 +0100
Subject: [PATCH 4/4] whitespace.el: make whitespace-report-region respect
 current settings

* whitespace.el: make whitespace-report-region respect whitespace-style,
  including any additions made by the force parameter. This means that
  the function does not return t unless a whitespace problem that the
  user cares about is reported.
---
 lisp/whitespace.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index b798e7e..5300faf 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1732,8 +1732,10 @@ whitespace-report-region
 			    (whitespace-space-after-tab-regexp 'space))
 			   (t
 			    (cdr option)))))
-		     (and (re-search-forward regexp rend t)
-			  (setq has-bogus t))))
+		     (when (re-search-forward regexp rend t)
+                       (unless has-bogus
+                         (setq has-bogus (memq (car option) whitespace-style)))
+                       t)))
 	       whitespace-report-list)))
 	(when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
 	  (whitespace-kill-buffer whitespace-report-buffer-name)
-- 
2.7.4


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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-20 22:43 ` Dmitry Gutov
@ 2016-10-21 14:42   ` Reuben Thomas
  2016-10-21 14:45     ` Dmitry Gutov
  0 siblings, 1 reply; 15+ messages in thread
From: Reuben Thomas @ 2016-10-21 14:42 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745

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

[Apologies for not responding earlier; I had to dig this out of my spam
trap.]

On 20 October 2016 at 23:43, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 20.10.2016 15:32, Reuben Thomas wrote:
>
>> whitespace-report-region currently (Emacs 25.1, and identically in
>> master) fails correctly to detect whitespace at the start and end of the
>> buffer.
>>
>
> Could you please describe the problematic behavior exactly?
>

​The problem is that whitespace-report-region does not apply the tests
whitespace-empty-at-{bob,eob}-regexp specifically to the start and end of
the buffer. Since the tests were (intentionally) not previously anchored to
the start/end of the buffer, this meant they could pass at other,
arbitrary, places in the buffer, and incorrect report that there were blank
lines at the start/end of the buffer when there weren't.

The new tests are specifically anchored, and I made a minor change
elsewhere to avoid appending a now-unnecessary anchor.

-- 
http://rrt.sc3d.org

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

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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-21 14:42   ` Reuben Thomas
@ 2016-10-21 14:45     ` Dmitry Gutov
  2016-10-21 14:52       ` Reuben Thomas
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-10-21 14:45 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 24745

On 21.10.2016 17:42, Reuben Thomas wrote:

> ​The problem is that whitespace-report-region does not apply the tests
> whitespace-empty-at-{bob,eob}-regexp specifically to the start and end
> of the buffer.

I get that from the patch, but how do I reproduce this, step by step? I 
tried earlier, and failed.





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-21 14:45     ` Dmitry Gutov
@ 2016-10-21 14:52       ` Reuben Thomas
  2016-10-24 23:36         ` Dmitry Gutov
  0 siblings, 1 reply; 15+ messages in thread
From: Reuben Thomas @ 2016-10-21 14:52 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745

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

On 21 October 2016 at 15:45, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 21.10.2016 17:42, Reuben Thomas wrote:
>
> ​The problem is that whitespace-report-region does not apply the tests
>> whitespace-empty-at-{bob,eob}-regexp specifically to the start and end
>> of the buffer.
>>
>
> I get that from the patch, but how do I reproduce this, step by step? I
> tried earlier, and failed.
>

emacs -Q

Open a new buffer

Type: SPC foo

Then, whitespace-report will show an X in the second column (problems
detected) for "Empty lines at end of buffer".

-- 
http://rrt.sc3d.org

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

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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-21 14:52       ` Reuben Thomas
@ 2016-10-24 23:36         ` Dmitry Gutov
  2016-10-25 18:44           ` Reuben Thomas
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-10-24 23:36 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 24745

On 21.10.2016 17:52, Reuben Thomas wrote:

> emacs -Q
>
> Open a new buffer
>
> Type: SPC foo
>
> Then, whitespace-report will show an X in the second column (problems
> detected) for "Empty lines at end of buffer".

Thanks. I get it now.

A few comments on the patches themselves:

- "remove duplicate documentation from the Commentary" sounds fine to 
me, but maybe we should leave something in its stead. The first part can 
be replaced with a reference to the `whitespace-style' docstring. The 
second one... is it really that out of date? The list of variables seems 
like it can be useful.

- The commit messages don't follow the ChangeLog format, see 
https://www.gnu.org/prep/standards/html_node/Change-Logs.html, or simply 
the existing commit messages.





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-24 23:36         ` Dmitry Gutov
@ 2016-10-25 18:44           ` Reuben Thomas
  2016-10-25 22:45             ` Dmitry Gutov
  0 siblings, 1 reply; 15+ messages in thread
From: Reuben Thomas @ 2016-10-25 18:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745


[-- Attachment #1.1: Type: text/plain, Size: 1708 bytes --]

On 25 October 2016 at 00:36, Dmitry Gutov <dgutov@yandex.ru> wrote:

> ​​
>
> A few comments on the patches themselves:
>

​Thanks very much for the review.​

- "remove duplicate documentation from the Commentary" sounds fine to me,
> but maybe we should leave something in its stead. The first part can be
> replaced with a reference to the `whitespace-style' docstring. The second
> one... is it really that out of date? The list of variables seems like it
> can be useful.
>

I should check some context: my understanding is that inline documentation
in .el files is mainly useful for high-level documentation for standalone
packages. Packages that form part of Emacs should be documented in the
manual (as whitespace.el is); details of functions and variables should be
in docstrings (as is the case for whitespace.el). The docstrings of
customizable options are readable in the customize interface.

I have updated my patch to provide a cross-reference to the documentation
for whitespace-style, as you suggest. The other section of documentation
that I removed is for customizable options, which are fully documented in
the defcustom docstrings. (I have now checked this exhaustively.)


> - The commit messages don't follow the ChangeLog format, see
> https://www.gnu.org/prep/standards/html_node/Change-Logs.html, or simply
> the existing commit messages.
>

​Apologies. As far as I could see, the main things that were wrong were the
summary lines and the lack of function names (or equivalent) in the
detailed log. I have rewritten all of them.

I have rebased the patch series against master and attach the new version.

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 3051 bytes --]

[-- Attachment #2: 0001-Fix-bob-eob-checks.patch --]
[-- Type: text/x-patch, Size: 1814 bytes --]

From 72c12c6574305285219bff94aab79cf45e37ac13 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Thu, 20 Oct 2016 13:17:58 +0100
Subject: [PATCH 1/4] Fix bob/eob checks

* lisp/whitespace.el (whitespace-empty-at-bob-regexp,
whitespace-empty-at-eob-regexp, whitespace-cleanup): make `empty' checks
work at beginning & end of buffer in whitespace-report-region, and only
there (i.e. they will never match in regions that don't include the
start or end of the buffer).
---
 lisp/whitespace.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0f6b8df..6164585 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -828,7 +828,7 @@ whitespace-indentation-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)"
+(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
   "Specify regexp for empty lines at beginning of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -836,7 +836,7 @@ whitespace-empty-at-bob-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)"
+(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]*\\(\n\\{2,\\}\\|[ \t]+\\)\\)\\'"
   "Specify regexp for empty lines at end of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -1515,7 +1515,7 @@ whitespace-cleanup
 	    (when (looking-at whitespace-empty-at-bob-regexp)
 	      (delete-region (match-beginning 1) (match-end 1)))
 	    (when (re-search-forward
-		   (concat whitespace-empty-at-eob-regexp "\\'") nil t)
+                   whitespace-empty-at-eob-regexp nil t)
 	      (delete-region (match-beginning 1) (match-end 1)))))))
     ;; PROBLEM 3: 8 or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
-- 
2.7.4


[-- Attachment #3: 0002-Remove-duplicate-documentation.patch --]
[-- Type: text/x-patch, Size: 5192 bytes --]

From d01c97745bad85999b304a96c4fc1372a1c2cce8 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:20:07 +0100
Subject: [PATCH 2/4] Remove duplicate documentation

* whitespace.el: remove duplicate documentation from the Commentary
  section which duplicate and in some places contradict (due to being
  out of date) the docstrings.
---
 lisp/whitespace.el | 117 +----------------------------------------------------
 1 file changed, 1 insertion(+), 116 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 6164585..affddc3 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -178,49 +178,11 @@
 ;;
 ;; `whitespace-cleanup'
 ;;    Cleanup some blank problems in all buffer or at region.
+;;    See the function's docstring for more information.
 ;;
 ;; `whitespace-cleanup-region'
 ;;    Cleanup some blank problems at region.
 ;;
-;; The problems, which are cleaned up, are:
-;;
-;; 1. empty lines at beginning of buffer.
-;; 2. empty lines at end of buffer.
-;;    If `whitespace-style' includes the value `empty', remove all
-;;    empty lines at beginning and/or end of buffer.
-;;
-;; 3. 8 or more SPACEs at beginning of line.
-;;    If `whitespace-style' includes the value `indentation':
-;;    replace 8 or more SPACEs at beginning of line by TABs, if
-;;    `indent-tabs-mode' is non-nil; otherwise, replace TABs by
-;;    SPACEs.
-;;    If `whitespace-style' includes the value `indentation::tab',
-;;    replace 8 or more SPACEs at beginning of line by TABs.
-;;    If `whitespace-style' includes the value `indentation::space',
-;;    replace TABs by SPACEs.
-;;
-;; 4. SPACEs before TAB.
-;;    If `whitespace-style' includes the value `space-before-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::tab', replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::space', replace TABs by SPACEs.
-;;
-;; 5. SPACEs or TABs at end of line.
-;;    If `whitespace-style' includes the value `trailing', remove all
-;;    SPACEs or TABs at end of line.
-;;
-;; 6. 8 or more SPACEs after TAB.
-;;    If `whitespace-style' includes the value `space-after-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value `space-after-tab::tab',
-;;    replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-after-tab::space', replace TABs by SPACEs.
-;;
 ;;
 ;; Hooks
 ;; -----
@@ -237,83 +199,6 @@
 ;;    It is evaluated after whitespace package is loaded.
 ;;
 ;;
-;; Options
-;; -------
-;;
-;; Below it's shown a brief description of whitespace options, please,
-;; see the options declaration in the code for a long documentation.
-;;
-;; `whitespace-style'		Specify which kind of blank is
-;;				visualized.
-;;
-;; `whitespace-space'		Face used to visualize SPACE.
-;;
-;; `whitespace-hspace'		Face used to visualize HARD SPACE.
-;;
-;; `whitespace-tab'		Face used to visualize TAB.
-;;
-;; `whitespace-newline'		Face used to visualize NEWLINE char
-;;				mapping.
-;;
-;; `whitespace-trailing'	Face used to visualize trailing
-;;				blanks.
-;;
-;; `whitespace-line'		Face used to visualize "long" lines.
-;;
-;; `whitespace-space-before-tab'	Face used to visualize SPACEs
-;;					before TAB.
-;;
-;; `whitespace-indentation'	Face used to visualize 8 or more
-;;				SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent'	Face used to visualize big indentation.
-;;
-;; `whitespace-empty'		Face used to visualize empty lines at
-;;				beginning and/or end of buffer.
-;;
-;; `whitespace-space-after-tab'	Face used to visualize 8 or more
-;;				SPACEs after TAB.
-;;
-;; `whitespace-space-regexp'	Specify SPACE characters regexp.
-;;
-;; `whitespace-hspace-regexp'	Specify HARD SPACE characters regexp.
-;;
-;; `whitespace-tab-regexp'	Specify TAB characters regexp.
-;;
-;; `whitespace-trailing-regexp'	Specify trailing characters regexp.
-;;
-;; `whitespace-space-before-tab-regexp'	Specify SPACEs before TAB
-;;					regexp.
-;;
-;; `whitespace-indentation-regexp'	Specify regexp for 8 or more
-;;					SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent-regexp'	Specify big indentation at beginning of line
-;;					regexp.
-;;
-;; `whitespace-empty-at-bob-regexp'	Specify regexp for empty lines
-;;					at beginning of buffer.
-;;
-;; `whitespace-empty-at-eob-regexp'	Specify regexp for empty lines
-;;					at end of buffer.
-;;
-;; `whitespace-space-after-tab-regexp'	Specify regexp for 8 or more
-;;					SPACEs after TAB.
-;;
-;; `whitespace-line-column'	Specify column beyond which the line
-;;				is highlighted.
-;;
-;; `whitespace-display-mappings'	Specify an alist of mappings
-;;					for displaying characters.
-;;
-;; `whitespace-global-modes'	Modes for which global
-;;				`whitespace-mode' is automagically
-;;				turned on.
-;;
-;; `whitespace-action'		Specify which action is taken when a
-;;				buffer is visited or written.
-;;
-;;
 ;; Acknowledgments
 ;; ---------------
 ;;
-- 
2.7.4


[-- Attachment #4: 0003-Fix-whitespace-space-after-tab-regexp.patch --]
[-- Type: text/x-patch, Size: 1702 bytes --]

From b03f66acced06fda5ecc694e37b25bbf32ce4da2 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:23:08 +0100
Subject: [PATCH 3/4] Fix whitespace-space-after-tab-regexp

* lisp/whitespace.el (whitespace-space-after-tab-regexp,
  whitespace-regexp): match all the spaces after tabs for highlighting,
  not just the first tab-width. Fix whitespace-space-after-tab::space
  version so that it requires at least tab-width spaces, not just 1.
---
 lisp/whitespace.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index affddc3..f8dc950 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -730,8 +730,8 @@ whitespace-empty-at-eob-regexp
 
 
 (defcustom whitespace-space-after-tab-regexp
-  '("\t+\\(\\( \\{%d\\}\\)+\\)"
-    . "\\(\t+\\) +")
+  '("\t+\\(\\( \\{%d,\\}\\)+\\)"
+    . "\\(\t+\\) \\{%d,\\}")
   "Specify regexp for 8 or more SPACEs after TAB.
 
 It is a cons where the cons car is used for SPACEs visualization
@@ -1559,13 +1559,15 @@ whitespace-replace-action
 
 (defun whitespace-regexp (regexp &optional kind)
   "Return REGEXP depending on `whitespace-indent-tabs-mode'."
-  (cond
-   ((or (eq kind 'tab)
-	whitespace-indent-tabs-mode)
-    (format (car regexp) whitespace-tab-width))
-   ((or (eq kind 'space)
-	(not whitespace-indent-tabs-mode))
-    (cdr regexp))))
+  (format
+   (cond
+    ((or (eq kind 'tab)
+         whitespace-indent-tabs-mode)
+     (car regexp))
+    ((or (eq kind 'space)
+         (not whitespace-indent-tabs-mode))
+     (cdr regexp)))
+   whitespace-tab-width))
 
 
 (defun whitespace-indentation-regexp (&optional kind)
-- 
2.7.4


[-- Attachment #5: 0004-Make-whitespace-report-region-respect-current-settin.patch --]
[-- Type: text/x-patch, Size: 1273 bytes --]

From ec93eca67bda549886709ff8c13d563560c88c99 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:25:12 +0100
Subject: [PATCH 4/4] Make whitespace-report-region respect current settings

* whitespace.el (whitespace-report-region): make it respect
  whitespace-style, including any additions made by the force parameter.
  This means that the function does not return t unless a whitespace
  problem that the user cares about is reported.
---
 lisp/whitespace.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index f8dc950..bbec06e 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1733,8 +1733,10 @@ whitespace-report-region
 			    (whitespace-space-after-tab-regexp 'space))
 			   (t
 			    (cdr option)))))
-		     (and (re-search-forward regexp rend t)
-			  (setq has-bogus t))))
+		     (when (re-search-forward regexp rend t)
+                       (unless has-bogus
+                         (setq has-bogus (memq (car option) whitespace-style)))
+                       t)))
 	       whitespace-report-list)))
 	(when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
 	  (whitespace-kill-buffer whitespace-report-buffer-name)
-- 
2.7.4


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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-25 18:44           ` Reuben Thomas
@ 2016-10-25 22:45             ` Dmitry Gutov
  2016-10-25 23:26               ` Reuben Thomas
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-10-25 22:45 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 24745

On 25.10.2016 21:44, Reuben Thomas wrote:

> I should check some context: my understanding is that inline
> documentation in .el files is mainly useful for high-level documentation
> for standalone packages. Packages that form part of Emacs should be
> documented in the manual (as whitespace.el is); details of functions and
> variables should be in docstrings (as is the case for whitespace.el).
> The docstrings of customizable options are readable in the customize
> interface.

Maybe you're right. I'd leave at least "to change behavior, do M-x 
customize-group whitespace", though. Maybe someone else would like to 
weigh in.

> ​Apologies. As far as I could see, the main things that were wrong were
> the summary lines and the lack of function names (or equivalent) in the
> detailed log. I have rewritten all of them.

You're close, but:

- Sentences should start with a capital letter.
- The function names are usually reflowed in a different way (you can 
put several of them in parentheses, but each such groups only spans one 
line). Try copying the message from the first patch to a ChangeLog file, 
and press M-q to see that in action.
- The messages should references this bug report.
- The file should be consistently referred to as lisp/whitespace.el.

You can automate the adherence to most of these rules by first entering 
the messages in a local-only ChangeLog file, using 'C-x 4 a'. Also see 
"Generating ChangeLog entries" in CONTRIBUTE.

> I have rebased the patch series against master and attach the new version.

Thanks. Do you have commit access?





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-25 22:45             ` Dmitry Gutov
@ 2016-10-25 23:26               ` Reuben Thomas
  2016-11-01 15:32                 ` Reuben Thomas
  2016-11-03  1:06                 ` Dmitry Gutov
  0 siblings, 2 replies; 15+ messages in thread
From: Reuben Thomas @ 2016-10-25 23:26 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745


[-- Attachment #1.1: Type: text/plain, Size: 1855 bytes --]

On 25 October 2016 at 23:45, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 25.10.2016 21:44, Reuben Thomas wrote:
>
> I should check some context: my understanding is that inline
>> documentation in .el files is mainly useful for high-level documentation
>> for standalone packages. Packages that form part of Emacs should be
>> documented in the manual (as whitespace.el is); details of functions and
>> variables should be in docstrings (as is the case for whitespace.el).
>> The docstrings of customizable options are readable in the customize
>> interface.
>>
>
> Maybe you're right. I'd leave at least "to change behavior, do M-x
> customize-group whitespace", though.


​I've re-added that.​

​
> You can automate the adherence to most of these rules by first entering
> the messages in a local-only ChangeLog file, using 'C-x 4 a'. Also see
> "Generating ChangeLog entries" in CONTRIBUTE.


​Thanks, I was confused by the fact that since I last submitted patches, we
no longer update ChangeLog files directly when committing.

Thanks. Do you have commit access?
>

​I have.​

I attach the patch series again with the documentation fix above, and two
more patches which complete my intended work. The last two are:

1. Fix documentation to mention `tab-width', not `8'.

2. Fix whitespace-report-region to a) use the currently active
whitespace-style, that is, whitespace-style-active, and b) take a copy of
it, so that use of the `force' parameter does not cause the style to be
updated outside the function. It falls back to `whitespace-style' if
`whitespace-active-style' is not set, so that whitespace-report can be used
when the mode is not already active (I use it thus to turn the mode on only
in whitespace-clean buffers in my whitespace-enable-predicate).

-- 
http://rrt.sc3d.org

[-- Attachment #1.2: Type: text/html, Size: 3448 bytes --]

[-- Attachment #2: 0001-Fix-bob-eob-checks.patch --]
[-- Type: text/x-patch, Size: 1832 bytes --]

From fe36f176566d13fcaa2f805737328191adf6dd4f Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Thu, 20 Oct 2016 13:17:58 +0100
Subject: [PATCH 1/6] Fix bob/eob checks

* lisp/whitespace.el (whitespace-empty-at-bob-regexp)
(whitespace-empty-at-eob-regexp, whitespace-cleanup): Make `empty' checks
work at beginning & end of buffer in whitespace-report-region, and only
there (i.e. they will never match in regions that don't include the
start or end of the buffer).  See bug #24745.
---
 lisp/whitespace.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 0f6b8df..6164585 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -828,7 +828,7 @@ whitespace-indentation-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-bob-regexp "^\\(\\([ \t]*\n\\)+\\)"
+(defcustom whitespace-empty-at-bob-regexp "\\`\\(\\([ \t]*\n\\)+\\)"
   "Specify regexp for empty lines at beginning of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -836,7 +836,7 @@ whitespace-empty-at-bob-regexp
   :group 'whitespace)
 
 
-(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]+\\)"
+(defcustom whitespace-empty-at-eob-regexp "^\\([ \t\n]*\\(\n\\{2,\\}\\|[ \t]+\\)\\)\\'"
   "Specify regexp for empty lines at end of buffer.
 
 Used when `whitespace-style' includes `empty'."
@@ -1515,7 +1515,7 @@ whitespace-cleanup
 	    (when (looking-at whitespace-empty-at-bob-regexp)
 	      (delete-region (match-beginning 1) (match-end 1)))
 	    (when (re-search-forward
-		   (concat whitespace-empty-at-eob-regexp "\\'") nil t)
+                   whitespace-empty-at-eob-regexp nil t)
 	      (delete-region (match-beginning 1) (match-end 1)))))))
     ;; PROBLEM 3: 8 or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
-- 
2.7.4


[-- Attachment #3: 0002-Remove-duplicate-documentation.patch --]
[-- Type: text/x-patch, Size: 5357 bytes --]

From dc87bc3ef6b732da89e993c8d510d882be75a82a Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:20:07 +0100
Subject: [PATCH 2/6] Remove duplicate documentation

* lisp/whitespace.el: Remove duplicate documentation from the Commentary
  section which duplicate and in some places contradict (due to being
  out of date) the docstrings.  See bug #24745.
---
 lisp/whitespace.el | 122 +++--------------------------------------------------
 1 file changed, 7 insertions(+), 115 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 6164585..f5c2f2f 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -178,48 +178,17 @@
 ;;
 ;; `whitespace-cleanup'
 ;;    Cleanup some blank problems in all buffer or at region.
+;;    See the function's docstring for more information.
 ;;
 ;; `whitespace-cleanup-region'
 ;;    Cleanup some blank problems at region.
 ;;
-;; The problems, which are cleaned up, are:
-;;
-;; 1. empty lines at beginning of buffer.
-;; 2. empty lines at end of buffer.
-;;    If `whitespace-style' includes the value `empty', remove all
-;;    empty lines at beginning and/or end of buffer.
-;;
-;; 3. 8 or more SPACEs at beginning of line.
-;;    If `whitespace-style' includes the value `indentation':
-;;    replace 8 or more SPACEs at beginning of line by TABs, if
-;;    `indent-tabs-mode' is non-nil; otherwise, replace TABs by
-;;    SPACEs.
-;;    If `whitespace-style' includes the value `indentation::tab',
-;;    replace 8 or more SPACEs at beginning of line by TABs.
-;;    If `whitespace-style' includes the value `indentation::space',
-;;    replace TABs by SPACEs.
-;;
-;; 4. SPACEs before TAB.
-;;    If `whitespace-style' includes the value `space-before-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::tab', replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-before-tab::space', replace TABs by SPACEs.
-;;
-;; 5. SPACEs or TABs at end of line.
-;;    If `whitespace-style' includes the value `trailing', remove all
-;;    SPACEs or TABs at end of line.
-;;
-;; 6. 8 or more SPACEs after TAB.
-;;    If `whitespace-style' includes the value `space-after-tab':
-;;    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
-;;    otherwise, replace TABs by SPACEs.
-;;    If `whitespace-style' includes the value `space-after-tab::tab',
-;;    replace SPACEs by TABs.
-;;    If `whitespace-style' includes the value
-;;    `space-after-tab::space', replace TABs by SPACEs.
+;;
+;; Options
+;; -------
+;;
+;; Whitespace's behavior can be changed with M-x customize-group
+;; whitespace, which see for a full list of options.
 ;;
 ;;
 ;; Hooks
@@ -237,83 +206,6 @@
 ;;    It is evaluated after whitespace package is loaded.
 ;;
 ;;
-;; Options
-;; -------
-;;
-;; Below it's shown a brief description of whitespace options, please,
-;; see the options declaration in the code for a long documentation.
-;;
-;; `whitespace-style'		Specify which kind of blank is
-;;				visualized.
-;;
-;; `whitespace-space'		Face used to visualize SPACE.
-;;
-;; `whitespace-hspace'		Face used to visualize HARD SPACE.
-;;
-;; `whitespace-tab'		Face used to visualize TAB.
-;;
-;; `whitespace-newline'		Face used to visualize NEWLINE char
-;;				mapping.
-;;
-;; `whitespace-trailing'	Face used to visualize trailing
-;;				blanks.
-;;
-;; `whitespace-line'		Face used to visualize "long" lines.
-;;
-;; `whitespace-space-before-tab'	Face used to visualize SPACEs
-;;					before TAB.
-;;
-;; `whitespace-indentation'	Face used to visualize 8 or more
-;;				SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent'	Face used to visualize big indentation.
-;;
-;; `whitespace-empty'		Face used to visualize empty lines at
-;;				beginning and/or end of buffer.
-;;
-;; `whitespace-space-after-tab'	Face used to visualize 8 or more
-;;				SPACEs after TAB.
-;;
-;; `whitespace-space-regexp'	Specify SPACE characters regexp.
-;;
-;; `whitespace-hspace-regexp'	Specify HARD SPACE characters regexp.
-;;
-;; `whitespace-tab-regexp'	Specify TAB characters regexp.
-;;
-;; `whitespace-trailing-regexp'	Specify trailing characters regexp.
-;;
-;; `whitespace-space-before-tab-regexp'	Specify SPACEs before TAB
-;;					regexp.
-;;
-;; `whitespace-indentation-regexp'	Specify regexp for 8 or more
-;;					SPACEs at beginning of line.
-;;
-;; `whitespace-big-indent-regexp'	Specify big indentation at beginning of line
-;;					regexp.
-;;
-;; `whitespace-empty-at-bob-regexp'	Specify regexp for empty lines
-;;					at beginning of buffer.
-;;
-;; `whitespace-empty-at-eob-regexp'	Specify regexp for empty lines
-;;					at end of buffer.
-;;
-;; `whitespace-space-after-tab-regexp'	Specify regexp for 8 or more
-;;					SPACEs after TAB.
-;;
-;; `whitespace-line-column'	Specify column beyond which the line
-;;				is highlighted.
-;;
-;; `whitespace-display-mappings'	Specify an alist of mappings
-;;					for displaying characters.
-;;
-;; `whitespace-global-modes'	Modes for which global
-;;				`whitespace-mode' is automagically
-;;				turned on.
-;;
-;; `whitespace-action'		Specify which action is taken when a
-;;				buffer is visited or written.
-;;
-;;
 ;; Acknowledgments
 ;; ---------------
 ;;
-- 
2.7.4


[-- Attachment #4: 0003-Fix-whitespace-space-after-tab-regexp.patch --]
[-- Type: text/x-patch, Size: 1713 bytes --]

From ca1ff683b14384cc0b1e8a6b8ffa297131767e08 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:23:08 +0100
Subject: [PATCH 3/6] Fix whitespace-space-after-tab-regexp

* lisp/whitespace.el (whitespace-space-after-tab-regexp)
(whitespace-regexp): match all the spaces after tabs for highlighting,
not just the first tab-width. Fix whitespace-space-after-tab::space
version so that it requires at least tab-width spaces, not just 1.
See bug #24745.
---
 lisp/whitespace.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index f5c2f2f..f1f7605 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -737,8 +737,8 @@ whitespace-empty-at-eob-regexp
 
 
 (defcustom whitespace-space-after-tab-regexp
-  '("\t+\\(\\( \\{%d\\}\\)+\\)"
-    . "\\(\t+\\) +")
+  '("\t+\\(\\( \\{%d,\\}\\)+\\)"
+    . "\\(\t+\\) \\{%d,\\}")
   "Specify regexp for 8 or more SPACEs after TAB.
 
 It is a cons where the cons car is used for SPACEs visualization
@@ -1566,13 +1566,15 @@ whitespace-replace-action
 
 (defun whitespace-regexp (regexp &optional kind)
   "Return REGEXP depending on `whitespace-indent-tabs-mode'."
-  (cond
-   ((or (eq kind 'tab)
-	whitespace-indent-tabs-mode)
-    (format (car regexp) whitespace-tab-width))
-   ((or (eq kind 'space)
-	(not whitespace-indent-tabs-mode))
-    (cdr regexp))))
+  (format
+   (cond
+    ((or (eq kind 'tab)
+         whitespace-indent-tabs-mode)
+     (car regexp))
+    ((or (eq kind 'space)
+         (not whitespace-indent-tabs-mode))
+     (cdr regexp)))
+   whitespace-tab-width))
 
 
 (defun whitespace-indentation-regexp (&optional kind)
-- 
2.7.4


[-- Attachment #5: 0004-Make-whitespace-report-region-respect-current-settin.patch --]
[-- Type: text/x-patch, Size: 1289 bytes --]

From a08a69ee68002d2cfac7b94643779b1a0cca7f23 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Fri, 21 Oct 2016 15:25:12 +0100
Subject: [PATCH 4/6] Make whitespace-report-region respect current settings

* lisp/whitespace.el (whitespace-report-region): make it respect
whitespace-style, including any additions made by the force parameter.
This means that the function does not return t unless a whitespace
problem that the user cares about is reported.  See bug #24745.
---
 lisp/whitespace.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index f1f7605..f08a757 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1740,8 +1740,10 @@ whitespace-report-region
 			    (whitespace-space-after-tab-regexp 'space))
 			   (t
 			    (cdr option)))))
-		     (and (re-search-forward regexp rend t)
-			  (setq has-bogus t))))
+		     (when (re-search-forward regexp rend t)
+                       (unless has-bogus
+                         (setq has-bogus (memq (car option) whitespace-style)))
+                       t)))
 	       whitespace-report-list)))
 	(when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
 	  (whitespace-kill-buffer whitespace-report-buffer-name)
-- 
2.7.4


[-- Attachment #6: 0005-Document-use-of-tab-width.patch --]
[-- Type: text/x-patch, Size: 13677 bytes --]

From 67663dcc6e84a6a0dc171f8a87863a82914b7cb8 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Tue, 25 Oct 2016 23:04:18 +0100
Subject: [PATCH 5/6] Document use of `tab-width'

* lisp/whitespace.el: when talking about `8 or more spaces', mention
`tab-width' instead of 8.  See bug #24745.
---
 lisp/whitespace.el | 103 +++++++++++++++++++++++++++--------------------------
 1 file changed, 52 insertions(+), 51 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index f08a757..5abd3cb 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -332,8 +332,8 @@ whitespace-style
 			It has effect only if `face' (see above)
 			is present in `whitespace-style'.
 
-   indentation::tab	8 or more SPACEs at beginning of line are
-			visualized via faces.
+   indentation::tab	`tab-width' or more SPACEs at beginning of line
+			are visualized via faces.
 			It has effect only if `face' (see above)
 			is present in `whitespace-style'.
 
@@ -342,10 +342,10 @@ whitespace-style
 			It has effect only if `face' (see above)
 			is present in `whitespace-style'.
 
-   indentation		8 or more SPACEs at beginning of line are
-			visualized, if `indent-tabs-mode' (which see)
-			is non-nil; otherwise, TABs at beginning of
-			line are visualized via faces.
+   indentation		`tab-width' or more SPACEs at beginning of line
+			are visualized, if `indent-tabs-mode' (which
+			see) is non-nil; otherwise, TABs at beginning
+			of line are visualized via faces.
 			It has effect only if `face' (see above)
 			is present in `whitespace-style'.
 
@@ -353,18 +353,19 @@ whitespace-style
 			It has effect only if `face' (see above)
 			is present in `whitespace-style'.
 
-   space-after-tab::tab		8 or more SPACEs after a TAB are
-				visualized via faces.
+   space-after-tab::tab		`tab-width' or more SPACEs after a TAB
+				are visualized via faces.
 				It has effect only if `face' (see above)
 				is present in `whitespace-style'.
 
-   space-after-tab::space	TABs are visualized when 8 or more
-				SPACEs occur after a TAB, via faces.
+   space-after-tab::space	TABs are visualized when `tab-width' or
+				more SPACEs occur after a TAB, via
+				faces.
 				It has effect only if `face' (see above)
 				is present in `whitespace-style'.
 
-   space-after-tab		8 or more SPACEs after a TAB are
-				visualized, if `indent-tabs-mode'
+   space-after-tab		`tab-width' or more SPACEs after a TAB
+				are visualized, if `indent-tabs-mode'
 				(which see) is non-nil; otherwise,
 				the TABs are visualized via faces.
 				It has effect only if `face' (see above)
@@ -569,14 +570,14 @@ whitespace-space-before-tab
 
 
 (defvar whitespace-indentation 'whitespace-indentation
-  "Symbol face used to visualize 8 or more SPACEs at beginning of line.
-Used when `whitespace-style' includes the value `indentation'.")
+  "Symbol face used to visualize `tab-width' or more SPACEs at beginning of
+line.  Used when `whitespace-style' includes the value `indentation'.")
 (make-obsolete-variable 'whitespace-indentation "use the face instead." "24.4")
 
 (defface whitespace-indentation
   '((((class mono)) :inverse-video t :weight bold :underline t)
     (t :background "yellow" :foreground "firebrick"))
-  "Face used to visualize 8 or more SPACEs at beginning of line."
+  "Face used to visualize `tab-width' or more SPACEs at beginning of line."
   :group 'whitespace)
 
 (defface whitespace-big-indent
@@ -599,7 +600,7 @@ whitespace-empty
 
 
 (defvar whitespace-space-after-tab 'whitespace-space-after-tab
-  "Symbol face used to visualize 8 or more SPACEs after TAB.
+  "Symbol face used to visualize `tab-width' or more SPACEs after TAB.
 Used when `whitespace-style' includes the value `space-after-tab'.")
 (make-obsolete-variable 'whitespace-space-after-tab
                         "use the face instead." "24.4")
@@ -607,7 +608,7 @@ whitespace-space-after-tab
 (defface whitespace-space-after-tab
   '((((class mono)) :inverse-video t :weight bold :underline t)
     (t :background "yellow" :foreground "firebrick"))
-  "Face used to visualize 8 or more SPACEs after TAB."
+  "Face used to visualize `tab-width' or more SPACEs after TAB."
   :group 'whitespace)
 
 
@@ -708,7 +709,7 @@ whitespace-space-before-tab-regexp
 (defcustom whitespace-indentation-regexp
   '("^\t*\\(\\( \\{%d\\}\\)+\\)[^\n\t]"
     . "^ *\\(\t+\\)[^\n]")
-  "Specify regexp for 8 or more SPACEs at beginning of line.
+  "Specify regexp for `tab-width' or more SPACEs at beginning of line.
 
 It is a cons where the cons car is used for SPACEs visualization
 and the cons cdr is used for TABs visualization.
@@ -739,7 +740,7 @@ whitespace-empty-at-eob-regexp
 (defcustom whitespace-space-after-tab-regexp
   '("\t+\\(\\( \\{%d,\\}\\)+\\)"
     . "\\(\t+\\) \\{%d,\\}")
-  "Specify regexp for 8 or more SPACEs after TAB.
+  "Specify regexp for `tab-width' or more SPACEs after TAB.
 
 It is a cons where the cons car is used for SPACEs visualization
 and the cons cdr is used for TABs visualization.
@@ -1345,13 +1346,13 @@ whitespace-cleanup
    If `whitespace-style' includes the value `empty', remove all
    empty lines at beginning and/or end of buffer.
 
-3. 8 or more SPACEs at beginning of line.
+3. `tab-width' or more SPACEs at beginning of line.
    If `whitespace-style' includes the value `indentation':
-   replace 8 or more SPACEs at beginning of line by TABs, if
-   `indent-tabs-mode' is non-nil; otherwise, replace TABs by
+   replace `tab-width' or more SPACEs at beginning of line by
+   TABs, if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
    SPACEs.
    If `whitespace-style' includes the value `indentation::tab',
-   replace 8 or more SPACEs at beginning of line by TABs.
+   replace `tab-width' or more SPACEs at beginning of line by TABs.
    If `whitespace-style' includes the value `indentation::space',
    replace TABs by SPACEs.
 
@@ -1368,7 +1369,7 @@ whitespace-cleanup
    If `whitespace-style' includes the value `trailing', remove
    all SPACEs or TABs at end of line.
 
-6. 8 or more SPACEs after TAB.
+6. `tab-width' or more SPACEs after TAB.
    If `whitespace-style' includes the value `space-after-tab':
    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
    otherwise, replace TABs by SPACEs.
@@ -1389,10 +1390,10 @@ whitespace-cleanup
 	     current-prefix-arg)
 	 mark-active)
     ;; PROBLEMs 1 and 2 are not handled in region
-    ;; PROBLEM 3: 8 or more SPACEs at bol
+    ;; PROBLEM 3: `tab-width' or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
     ;; PROBLEM 5: SPACEs or TABs at eol
-    ;; PROBLEM 6: 8 or more SPACEs after TAB
+    ;; PROBLEM 6: `tab-width' or more SPACEs after TAB
     (whitespace-cleanup-region (region-beginning) (region-end)))
    ;; whole buffer
    (t
@@ -1409,10 +1410,10 @@ whitespace-cleanup
 	    (when (re-search-forward
                    whitespace-empty-at-eob-regexp nil t)
 	      (delete-region (match-beginning 1) (match-end 1)))))))
-    ;; PROBLEM 3: 8 or more SPACEs at bol
+    ;; PROBLEM 3: `tab-width' or more SPACEs at bol
     ;; PROBLEM 4: SPACEs before TAB
     ;; PROBLEM 5: SPACEs or TABs at eol
-    ;; PROBLEM 6: 8 or more SPACEs after TAB
+    ;; PROBLEM 6: `tab-width' or more SPACEs after TAB
     (whitespace-cleanup-region (point-min) (point-max)))))
 
 (defun whitespace-ensure-local-variables ()
@@ -1428,13 +1429,13 @@ whitespace-cleanup-region
 
 The problems cleaned up are:
 
-1. 8 or more SPACEs at beginning of line.
+1. `tab-width' or more SPACEs at beginning of line.
    If `whitespace-style' includes the value `indentation':
-   replace 8 or more SPACEs at beginning of line by TABs, if
-   `indent-tabs-mode' is non-nil; otherwise, replace TABs by
+   replace `tab-width' or more SPACEs at beginning of line by TABs,
+   if `indent-tabs-mode' is non-nil; otherwise, replace TABs by
    SPACEs.
    If `whitespace-style' includes the value `indentation::tab',
-   replace 8 or more SPACEs at beginning of line by TABs.
+   replace `tab-width' or more SPACEs at beginning of line by TABs.
    If `whitespace-style' includes the value `indentation::space',
    replace TABs by SPACEs.
 
@@ -1451,7 +1452,7 @@ whitespace-cleanup-region
    If `whitespace-style' includes the value `trailing', remove
    all SPACEs or TABs at end of line.
 
-4. 8 or more SPACEs after TAB.
+4. `tab-width' or more SPACEs after TAB.
    If `whitespace-style' includes the value `space-after-tab':
    replace SPACEs by TABs, if `indent-tabs-mode' is non-nil;
    otherwise, replace TABs by SPACEs.
@@ -1476,9 +1477,9 @@ whitespace-cleanup-region
 	  tmp)
       (save-excursion
 	(save-match-data                ;FIXME: Why?
-	  ;; PROBLEM 1: 8 or more SPACEs at bol
+	  ;; PROBLEM 1: `tab-width' or more SPACEs at bol
 	  (cond
-	   ;; ACTION: replace 8 or more SPACEs at bol by TABs, if
+	   ;; ACTION: replace `tab-width' or more SPACEs at bol by TABs, if
 	   ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
 	   ;; by SPACEs.
 	   ((memq 'indentation whitespace-style)
@@ -1490,7 +1491,7 @@ whitespace-cleanup-region
 		(delete-horizontal-space)
 		(unless (eolp)
 		  (indent-to tmp)))))
-	   ;; ACTION: replace 8 or more SPACEs at bol by TABs.
+	   ;; ACTION: replace `tab-width' or more SPACEs at bol by TABs.
 	   ((memq 'indentation::tab whitespace-style)
 	    (whitespace-replace-action
 	     'tabify rstart rend
@@ -1506,16 +1507,16 @@ whitespace-cleanup-region
 	    (whitespace-replace-action
 	     'delete-region rstart rend
 	     whitespace-trailing-regexp 1))
-	  ;; PROBLEM 4: 8 or more SPACEs after TAB
+	  ;; PROBLEM 4: `tab-width' or more SPACEs after TAB
 	  (cond
-	   ;; ACTION: replace 8 or more SPACEs by TABs, if
+	   ;; ACTION: replace `tab-width' or more SPACEs by TABs, if
 	   ;; `indent-tabs-mode' is non-nil; otherwise, replace TABs
 	   ;; by SPACEs.
 	   ((memq 'space-after-tab whitespace-style)
 	    (whitespace-replace-action
 	     (if whitespace-indent-tabs-mode 'tabify 'untabify)
 	     rstart rend (whitespace-space-after-tab-regexp) 1))
-	   ;; ACTION: replace 8 or more SPACEs by TABs.
+	   ;; ACTION: replace `tab-width' or more SPACEs by TABs.
 	   ((memq 'space-after-tab::tab whitespace-style)
 	    (whitespace-replace-action
 	     'tabify rstart rend
@@ -1615,15 +1616,15 @@ whitespace-report-text
  empty                    []     []  empty lines at beginning of buffer
  empty                    []     []  empty lines at end of buffer
  trailing                 []     []  SPACEs or TABs at end of line
- indentation              []     []  8 or more SPACEs at beginning of line
- indentation::tab         []     []  8 or more SPACEs at beginning of line
+ indentation              []     []  >= `tab-width' SPACEs at beginning of line
+ indentation::tab         []     []  >= `tab-width' SPACEs at beginning of line
  indentation::space       []     []  TABs at beginning of line
  space-before-tab         []     []  SPACEs before TAB
  space-before-tab::tab    []     []  SPACEs before TAB: SPACEs
  space-before-tab::space  []     []  SPACEs before TAB: TABs
- space-after-tab          []     []  8 or more SPACEs after TAB
- space-after-tab::tab     []     []  8 or more SPACEs after TAB: SPACEs
- space-after-tab::space   []     []  8 or more SPACEs after TAB: TABs
+ space-after-tab          []     []  >= `tab-width' SPACEs after TAB
+ space-after-tab::tab     []     []  >= `tab-width' SPACEs after TAB: SPACEs
+ space-after-tab::space   []     []  >= `tab-width' SPACEs after TAB: TABs
 
  indent-tabs-mode =
  tab-width        = \n\n"
@@ -1637,14 +1638,14 @@ whitespace-report-text
  empty                    []     []  empty lines at end of buffer
  trailing                 []     []  SPACEs or TABs at end of line
  indentation              []     []  TABs at beginning of line
- indentation::tab         []     []  8 or more SPACEs at beginning of line
+ indentation::tab         []     []  >= `tab-width' SPACEs at beginning of line
  indentation::space       []     []  TABs at beginning of line
  space-before-tab         []     []  SPACEs before TAB
  space-before-tab::tab    []     []  SPACEs before TAB: SPACEs
  space-before-tab::space  []     []  SPACEs before TAB: TABs
- space-after-tab          []     []  8 or more SPACEs after TAB
- space-after-tab::tab     []     []  8 or more SPACEs after TAB: SPACEs
- space-after-tab::space   []     []  8 or more SPACEs after TAB: TABs
+ space-after-tab          []     []  >= `tab-width' SPACEs after TAB
+ space-after-tab::tab     []     []  >= `tab-width' SPACEs after TAB: SPACEs
+ space-after-tab::space   []     []  >= `tab-width' SPACEs after TAB: TABs
 
  indent-tabs-mode =
  tab-width        = \n\n")
@@ -1696,9 +1697,9 @@ whitespace-report-region
    empty		1. empty lines at beginning of buffer.
    empty		2. empty lines at end of buffer.
    trailing		3. SPACEs or TABs at end of line.
-   indentation		4. 8 or more SPACEs at beginning of line.
+   indentation		4. line starts with `tab-width' or more SPACEs.
    space-before-tab	5. SPACEs before TAB.
-   space-after-tab	6. 8 or more SPACEs after TAB.
+   space-after-tab	6. `tab-width' or more SPACEs after TAB.
 
 * If `indent-tabs-mode' is nil:
    empty		1. empty lines at beginning of buffer.
@@ -1706,7 +1707,7 @@ whitespace-report-region
    trailing		3. SPACEs or TABs at end of line.
    indentation		4. TABS at beginning of line.
    space-before-tab	5. SPACEs before TAB.
-   space-after-tab	6. 8 or more SPACEs after TAB.
+   space-after-tab	6. `tab-width' or more SPACEs after TAB.
 
 See `whitespace-style' for documentation.
 See also `whitespace-cleanup' and `whitespace-cleanup-region' for
-- 
2.7.4


[-- Attachment #7: 0006-Stop-force-parameter-of-whitespace-report-region-hav.patch --]
[-- Type: text/x-patch, Size: 2688 bytes --]

From 3b6ec1d285b5460b180008541897c816c08c46c9 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <rrt@sc3d.org>
Date: Tue, 25 Oct 2016 23:20:59 +0100
Subject: [PATCH 6/6] Stop force parameter of whitespace-report-region having
 global effect

* lisp/whitespace.el (whitespace-report-region): force parameter
previously changed whitespace-style globally. Fix this, and use
whitespace-active-style, to take account of any changes the user may
have made. Simplify the documentation: the force parameter simply
forces all classes of whitespace problem to be considered.
See bug #24745.
---
 lisp/whitespace.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 5abd3cb..b62bd62 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1679,13 +1679,8 @@ whitespace-report-region
 
 If FORCE is non-nil or \\[universal-argument] was pressed just
 before calling `whitespace-report-region' interactively, it
-forces `whitespace-style' to have:
-
-   empty
-   trailing
-   indentation
-   space-before-tab
-   space-after-tab
+forces all classes of whitespace problem to be considered
+significant.
 
 If REPORT-IF-BOGUS is t, it reports only when there are any
 whitespace problems in buffer; if it is `never', it does not
@@ -1719,11 +1714,15 @@ whitespace-report-region
       (let* ((has-bogus nil)
 	     (rstart    (min start end))
 	     (rend      (max start end))
+             ;; Fall back to whitespace-style so we can run before
+             ;; before the mode is active.
+             (style     (copy-sequence
+                         (or whitespace-active-style whitespace-style)))
 	     (bogus-list
 	      (mapcar
 	       #'(lambda (option)
 		   (when force
-		     (add-to-list 'whitespace-style (car option)))
+		     (add-to-list 'style (car option)))
 		   (goto-char rstart)
 		   (let ((regexp
 			  (cond
@@ -1743,7 +1742,7 @@ whitespace-report-region
 			    (cdr option)))))
 		     (when (re-search-forward regexp rend t)
                        (unless has-bogus
-                         (setq has-bogus (memq (car option) whitespace-style)))
+                         (setq has-bogus (memq (car option) style)))
                        t)))
 	       whitespace-report-list)))
 	(when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
@@ -1763,7 +1762,7 @@ whitespace-report-region
 	      (dolist (option whitespace-report-list)
 		(forward-line 1)
 		(whitespace-mark-x
-		 27 (memq (car option) whitespace-style))
+		 27 (memq (car option) style))
 		(whitespace-mark-x 7 (car bogus-list))
 		(setq bogus-list (cdr bogus-list)))
 	      (forward-line 1)
-- 
2.7.4


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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-25 23:26               ` Reuben Thomas
@ 2016-11-01 15:32                 ` Reuben Thomas
  2016-11-03  1:07                   ` Dmitry Gutov
  2016-11-03  1:06                 ` Dmitry Gutov
  1 sibling, 1 reply; 15+ messages in thread
From: Reuben Thomas @ 2016-11-01 15:32 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745

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

​Any more comments, Dmitry?

-- 
http://rrt.sc3d.org

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

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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-10-25 23:26               ` Reuben Thomas
  2016-11-01 15:32                 ` Reuben Thomas
@ 2016-11-03  1:06                 ` Dmitry Gutov
  2016-11-03 12:38                   ` Reuben Thomas
  1 sibling, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-11-03  1:06 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 24745

On 26.10.2016 02:26, Reuben Thomas wrote:
> start or end of the buffer).  See bug #24745.

We use a standardized format for bug references: either bug#24745 or 
Bug#24745 (usually in parentheses).

> +;; Whitespace's behavior can be changed with M-x customize-group

`M-x customize-group whitespace' should probably be in quotes.

> +;; whitespace, which see for a full list of options.

"the full list"?

> (whitespace-regexp): match all the spaces after tabs for highlighting,

Please start the sentences with a capital letter.

 > * lisp/whitespace.el (whitespace-report-region): force parameter
previously changed whitespace-style globally. Fix this, and use

Please honor sentence-end-double-space, which is set to t in 
.dir-locals.el. Here and in other log messages.





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-11-01 15:32                 ` Reuben Thomas
@ 2016-11-03  1:07                   ` Dmitry Gutov
  2016-11-03 12:39                     ` Reuben Thomas
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Gutov @ 2016-11-03  1:07 UTC (permalink / raw)
  To: Reuben Thomas; +Cc: 24745

On 01.11.2016 17:32, Reuben Thomas wrote:
> ​Any more comments, Dmitry?

Just the minor ones. After fixing those, please install.

Thanks.





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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-11-03  1:06                 ` Dmitry Gutov
@ 2016-11-03 12:38                   ` Reuben Thomas
  0 siblings, 0 replies; 15+ messages in thread
From: Reuben Thomas @ 2016-11-03 12:38 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745

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

On 3 November 2016 at 01:06, Dmitry Gutov <dgutov@yandex.ru> wrote:

>
> > * lisp/whitespace.el (whitespace-report-region): force parameter
> previously changed whitespace-style globally. Fix this, and use
>
> Please honor sentence-end-double-space, which is set to t in
> .dir-locals.el. Here and in other log messages.
>

I have sentence-end-double-space customized to nil, and a find-file hook
that changes it according to the contents of the buffer. I changed this
hook function so that it only ever sets sentence-end-double-space, and
never clears it.

After this, I find that the variable is correctly overridden by
.dir-locals.el in some magit buffers, but not in COMMIT_EDITMSG buffers
(which are in text-mode). I don't know whether this is something to do with
commit buffers being invoked via emacsclient.

Anyway, I ensured the spacing manually, and filed a magit bug. I thought
this problem might be of interest to other Emacs maintainers, as magit
seems to be (rightfully!) quite popular.

-- 
http://rrt.sc3d.org

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

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

* bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks
  2016-11-03  1:07                   ` Dmitry Gutov
@ 2016-11-03 12:39                     ` Reuben Thomas
  0 siblings, 0 replies; 15+ messages in thread
From: Reuben Thomas @ 2016-11-03 12:39 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 24745

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

On 3 November 2016 at 01:07, Dmitry Gutov <dgutov@yandex.ru> wrote:

> On 01.11.2016 17:32, Reuben Thomas wrote:
>
>> ​Any more comments, Dmitry?
>>
>
> Just the minor ones. After fixing those, please install.
>
> Thanks.
>

​Done. Many thanks for your patient help.

-- 
http://rrt.sc3d.org

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

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

end of thread, other threads:[~2016-11-03 12:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 12:32 bug#24745: 25.1.50; whitespace.el: fix beginning/end of buffer checks Reuben Thomas
2016-10-20 22:43 ` Dmitry Gutov
2016-10-21 14:42   ` Reuben Thomas
2016-10-21 14:45     ` Dmitry Gutov
2016-10-21 14:52       ` Reuben Thomas
2016-10-24 23:36         ` Dmitry Gutov
2016-10-25 18:44           ` Reuben Thomas
2016-10-25 22:45             ` Dmitry Gutov
2016-10-25 23:26               ` Reuben Thomas
2016-11-01 15:32                 ` Reuben Thomas
2016-11-03  1:07                   ` Dmitry Gutov
2016-11-03 12:39                     ` Reuben Thomas
2016-11-03  1:06                 ` Dmitry Gutov
2016-11-03 12:38                   ` Reuben Thomas
     [not found] ` <handler.24745.B.14769667565022.ack@debbugs.gnu.org>
2016-10-21 14:38   ` bug#24745: Acknowledgement (25.1.50; whitespace.el: fix beginning/end of buffer checks) Reuben Thomas

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.