all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display
@ 2010-07-16 13:06 Reuben Thomas
  2010-07-26 18:16 ` bug#6651: Better fix Reuben Thomas
  2010-09-06 14:38 ` bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Vinicius Jose Latorre
  0 siblings, 2 replies; 3+ messages in thread
From: Reuben Thomas @ 2010-07-16 13:06 UTC (permalink / raw)
  To: 6651

I use whitespace-mode purely to correct white space when writing files.
Hence, I was using “(whitespace-mode 1)”, but was configuring all the
fonts to black so that I wouldn’t see any incorrect whitespace
characters displayed. Recently, I tracked down extremely poor
performance in c-mode to the fact that whitespace mode was on.

I came up with the following workaround:

1. Add (require 'whitespace) to my .emacs

2. Instead of adding (whitespace-mode 1) to the mode hooks in which I
want whitespace fixing, add (add-hook 'write-file-functions
'whitespace-write-file-hook nil t), which code I copied directly from
whitespace-mode.

I now get whitespace fixing (via the auto-cleanup flag in
whitespace-action) without the slow-down of having whitespace-mode
active. However, this is all a little fiddly. It would be nice if
whitespace-mode could be made to install its hooks without turning
itself on, perhaps by giving a special value to whitespace-mode, e.g. a
symbol like “’only-hooks”?


In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-06-13 on mord, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10706000
configured using `configure  '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  show-paren-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  global-auto-revert-mode: t
  desktop-save-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-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-p C-x b <return> M-x r e p o 
r t - e m a c s - b u g <return>

Recent messages:
Starting new Ispell process [british+accs] ...
Loading vc-git...done
Saving file /home/rrt/Software/zile-lua/src/extern.h...
run-hook-with-args-until-success: Symbol's function definition is void: whitespace-write-file-hook
whitespace
Saving file /home/rrt/.emacs.d/modes.el...
Wrote /home/rrt/.emacs.d/modes.el
Saving file /home/rrt/Software/zile-lua/src/extern.h...
Wrote /home/rrt/Software/zile-lua/src/extern.h
goto-history-element: End of history; no default available

Load-path shadows:
/usr/share/emacs/23.2/site-lisp/auctex/tex-style hides /usr/share/emacs/site-lisp/auctex/tex-style
/usr/share/emacs/23.2/site-lisp/auctex/tex-buf hides /usr/share/emacs/site-lisp/auctex/tex-buf
/usr/share/emacs/23.2/site-lisp/auctex/context hides /usr/share/emacs/site-lisp/auctex/context
/usr/share/emacs/23.2/site-lisp/auctex/bib-cite hides /usr/share/emacs/site-lisp/auctex/bib-cite
/usr/share/emacs/23.2/site-lisp/auctex/tex-fold hides /usr/share/emacs/site-lisp/auctex/tex-fold
/usr/share/emacs/23.2/site-lisp/auctex/tex-jp hides /usr/share/emacs/site-lisp/auctex/tex-jp
/usr/share/emacs/23.2/site-lisp/auctex/context-nl hides /usr/share/emacs/site-lisp/auctex/context-nl
/usr/share/emacs/23.2/site-lisp/auctex/toolbar-x hides /usr/share/emacs/site-lisp/auctex/toolbar-x
/usr/share/emacs/23.2/site-lisp/auctex/tex-mik hides /usr/share/emacs/site-lisp/auctex/tex-mik
/usr/share/emacs/23.2/site-lisp/auctex/context-en hides /usr/share/emacs/site-lisp/auctex/context-en
/usr/share/emacs/23.2/site-lisp/auctex/texmathp hides /usr/share/emacs/site-lisp/auctex/texmathp
/usr/share/emacs/23.2/site-lisp/auctex/tex-info hides /usr/share/emacs/site-lisp/auctex/tex-info
/usr/share/emacs/23.2/site-lisp/auctex/tex-fptex hides /usr/share/emacs/site-lisp/auctex/tex-fptex
/usr/share/emacs/23.2/site-lisp/auctex/tex-font hides /usr/share/emacs/site-lisp/auctex/tex-font
/usr/share/emacs/23.2/site-lisp/auctex/latex hides /usr/share/emacs/site-lisp/auctex/latex
/usr/share/emacs/23.2/site-lisp/auctex/font-latex hides /usr/share/emacs/site-lisp/auctex/font-latex
/usr/share/emacs/23.2/site-lisp/auctex/tex-bar hides /usr/share/emacs/site-lisp/auctex/tex-bar
/usr/share/emacs/23.2/site-lisp/auctex/multi-prompt hides /usr/share/emacs/site-lisp/auctex/multi-prompt
/usr/share/emacs/23.2/site-lisp/auctex/tex hides /usr/share/emacs/site-lisp/auctex/tex
/usr/share/emacs23/site-lisp/psgml/psgml hides /usr/share/emacs/site-lisp/psgml/psgml
/usr/share/emacs23/site-lisp/psgml/psgml-ids hides /usr/share/emacs/site-lisp/psgml/psgml-ids
/usr/share/emacs23/site-lisp/psgml/psgml-parse hides /usr/share/emacs/site-lisp/psgml/psgml-parse
/usr/share/emacs23/site-lisp/psgml/psgml-init hides /usr/share/emacs/site-lisp/psgml/psgml-init
/usr/share/emacs23/site-lisp/psgml/psgml-dtd hides /usr/share/emacs/site-lisp/psgml/psgml-dtd
/usr/share/emacs23/site-lisp/psgml/psgml-html hides /usr/share/emacs/site-lisp/psgml/psgml-html
/usr/share/emacs23/site-lisp/psgml/psgml-api hides /usr/share/emacs/site-lisp/psgml/psgml-api
/usr/share/emacs23/site-lisp/psgml/psgml-edit hides /usr/share/emacs/site-lisp/psgml/psgml-edit
/usr/share/emacs23/site-lisp/psgml/psgml-info hides /usr/share/emacs/site-lisp/psgml/psgml-info
/usr/share/emacs23/site-lisp/psgml/psgml-sysdep hides /usr/share/emacs/site-lisp/psgml/psgml-sysdep
/usr/share/emacs23/site-lisp/psgml/psgml-charent hides /usr/share/emacs/site-lisp/psgml/psgml-charent
/usr/share/emacs23/site-lisp/psgml/psgml-other hides /usr/share/emacs/site-lisp/psgml/psgml-other
/usr/share/emacs/23.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.2/lisp/textmodes/ispell

Features:
(shadow sort mail-extr message sendmail ecomplete rfc822 mml mml-sec
password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231
rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc
time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1
hex-util hashcash mail-utils emacsbug whitespace vc-git face-remap
flyspell filladapt auto-dictionary-autoloads dictionary-autoloads
js2-mode-autoloads package reporter completing-help ff-paths uniquify
paren savehist minibuf-eldef iswitchb icomplete autorevert time
cus-start cus-load desktop server change-mode advice help-fns
advice-preload ansi-color php-mode derived etags cc-langs cl cl-19
cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs speedbar sb-image ezimage dframe easymenu assoc lua-mode
regexp-opt comint ring etags-update smart-quotes easy-mmode edmacro
kmacro ispell ffap w3m-load psgml-init emacs-goodies-el
emacs-goodies-custom emacs-goodies-loaddefs devhelp preview-latex
tex-site auto-loads tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode
register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
loaddefs button minibuffer faces cus-face files text-properties overlay
md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)

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





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

* bug#6651: Better fix
  2010-07-16 13:06 bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Reuben Thomas
@ 2010-07-26 18:16 ` Reuben Thomas
  2010-09-06 14:38 ` bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Vinicius Jose Latorre
  1 sibling, 0 replies; 3+ messages in thread
From: Reuben Thomas @ 2010-07-26 18:16 UTC (permalink / raw)
  To: 6651

I recently found that my previous suggested workaround for using
whitespace-mode's autocorrection without display is flawed, as it
doesn't deal with local variables. This means that for example one's
settings for tabs vs spaces can be ignored.

Here's a fuller solution, which has two advantages: first, the local
variables now work, and secondly, the workaround of explicitly setting
write-file-functions is no longer needed. Instead, this version of the
workaround disables whitespace-mode display altogether, by simply
redefining whitespace-mode-{on,off}.

It could therefore form the basis of a refactoring that allows display
mode to be separated from correction mode.

Code follows (for .emacs or equivalent):

(require 'whitespace)

;; Versions of whitespace functions that don't turn visualisation on
(defun whitespace-turn-on ()
  "Turn on whitespace correction."
  ;; prepare local hooks
  (add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
  ;; create whitespace local buffer environment
  (set (make-local-variable 'whitespace-font-lock-mode) nil)
  (set (make-local-variable 'whitespace-font-lock) nil)
  (set (make-local-variable 'whitespace-font-lock-keywords) nil)
  (set (make-local-variable 'whitespace-display-table) nil)
  (set (make-local-variable 'whitespace-display-table-was-local) nil)
  (set (make-local-variable 'whitespace-active-style)
       (if (listp whitespace-style)
	   whitespace-style
	 (list whitespace-style)))
  (set (make-local-variable 'whitespace-indent-tabs-mode)
       indent-tabs-mode)
  (set (make-local-variable 'whitespace-tab-width)
       tab-width))
(defun whitespace-turn-off ()
  "Turn off whitespace correction."
  (remove-hook 'write-file-functions 'whitespace-write-file-hook t))

-- 
http://rrt.sc3d.org





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

* bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display
  2010-07-16 13:06 bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Reuben Thomas
  2010-07-26 18:16 ` bug#6651: Better fix Reuben Thomas
@ 2010-09-06 14:38 ` Vinicius Jose Latorre
  1 sibling, 0 replies; 3+ messages in thread
From: Vinicius Jose Latorre @ 2010-09-06 14:38 UTC (permalink / raw)
  To: 6651, Reuben Thomas

Hi Reuben,


The whitespace.el version 13.1 now allows to use cleanup-* functions 
without blank visualization.

If 'face symbol is not included into `whitespace-style' list, blanks are 
not visualized.

Please, see `whitespace-style' documentation.

Version 13.1 is in Emacs bzr and EmacsWiki.


Thanks for your report,


Vinicius






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

end of thread, other threads:[~2010-09-06 14:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-16 13:06 bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Reuben Thomas
2010-07-26 18:16 ` bug#6651: Better fix Reuben Thomas
2010-09-06 14:38 ` bug#6651: 23.2; Please allow whitespace fixing to be easily activated without whitespace display Vinicius Jose Latorre

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.