Put the following Emacs Lisp into a file named repro.el: (get-buffer-create "repro") (fundamental-mode) (erase-buffer) (set-variable 'show-trailing-whitespace t) (dotimes (_ 3) (insert "x\t\n\f\t\n")) (message "%s" (substitute-command-keys "Now type \\[delete-trailing-whitespace]")) Now invoke emacs with `-Q --load repro.el`. You'll see a buffer with a few lines, each with a red smear at the end indicating trailing whitespace (the TAB character). Now, like the echo area is telling you, type M-x delete-trailing-whitespace RET. You'll see the red go away on half the lines (the ones with an "x") but remain on the lines with form feeds. It's not entirely clear if this is a bug at all, since the doc for delete-trailing-whitespace doesn't specifically mention this situation; but it does say that that function considers form feeds to be _not_ whitespace, and also that the function deletes whitespace at the ends of lines, so it seems it ought to have deleted _all_ the tabs in this case. In GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-09-12 built on builder10-9.local Windowing system distributor 'Apple', version 10.3.1404 Configured using: 'configure --with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: global-magit-file-mode: t magit-auto-revert-mode: t global-git-commit-mode: t async-bytecomp-package-mode: t csv-field-index-mode: t pyvenv-mode: t projectile-mode: t desktop-save-mode: t savehist-mode: t shell-dirtrack-mode: t global-auto-revert-mode: t recentf-mode: t ido-everywhere: t diff-auto-refine-mode: t global-hl-line-mode: t override-global-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-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 line-number-mode: t transient-mark-mode: t Recent messages: History item: 279 [3 times] Mark saved where search started Truncate long lines enabled Mark saved where search started Mark set [3 times] Invoking man open in the background open man page formatted Mark saved where search started Making completion list... Scanning for dabbrevs...done Load-path shadows: /Users/erichan/.emacs.d/elpa/let-alist-1.0.5/let-alist hides /Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/let-alist Features: (shadow mail-extr emacsbug sendmail tabify man apropos debug eieio-opt speedbar sb-image ezimage dframe descr-text log-view git-rebase magit-extras vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs bug-reference vc vc-dispatcher url-file url-dired url-cache disp-table sgml-mode url-handlers dired-aux wdired calccomp calc-alg calc-menu calc-ext calc-aent calc calc-loaddefs calc-macs rect dabbrev misearch multi-isearch magit-bookmark magit-obsolete magit-blame magit-stash magit-bisect magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-collab ghub url-http url-gw url-auth let-alist magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff magit-core magit-autorevert magit-process magit-margin magit-mode git-commit magit-git magit-section magit-utils crm magit-popup log-edit message rfc822 mml mml-sec epg mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader pcvs-util add-log with-editor async-bytecomp async server cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs conf-mode csv-mode sort org-element org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m org org-macro org-footnote org-pcomplete org-list org-faces org-entities 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 cal-menu calendar cal-loaddefs sh-script smie executable smerge-mode company-oddmuse company-keywords company-etags company-gtags company-dabbrev-code company-dabbrev company-files company-cmake company-xcode company-clang company-eclim company-template company-css company-nxml company-bbdb highlight-indentation company elpy find-file-in-project ivy delsel colir ivy-overlay ffap windmove elpy-shell pyvenv esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode esh-util elpy-profile elpy-django s elpy-refactor files-x etags xref project cus-edit ruler-mode yasnippet flyspell ispell markdown-mode color noutline outline projectile thingatpt desktop frameset cus-start cus-load savehist work-log-mode warnings bookmark flymake python tramp-sh tramp tramp-compat tramp-loaddefs trampver shell pcomplete json map edit-list pp browse-kill-ring advice eww mm-url gnus gnus-ems nnheader mail-utils url-queue url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse auth-source eieio eieio-core gnus-util mm-util help-fns mail-prsvr password-cache url-vars mailcap shr dom subr-x browse-url format-spec ws-butler dired-subtree dired-hacks-utils dash wat derived autorevert filenotify recentf tree-widget wid-edit ido vc-git diff-mode ibuf-ext ibuffer ibuf-macs hl-line dired-x dired grep compile comint ansi-color ring find-func rotate cl cl-macs cl-seq face-remap edmacro kmacro tls gnutls 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 epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs pcase cl-lib rx time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win ucs-normalize term/common-win 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 kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 847442 81694) (symbols 48 65197 0) (miscs 40 5271 10928) (strings 32 197662 8798) (string-bytes 1 5932111) (vectors 16 82902) (vector-slots 8 2052903 228453) (floats 8 1011 325) (intervals 56 64230 72) (buffers 976 134))