Subject: 23.2; diff mode refining creates many temporary files causing busy hard disk

From: Trevor Spiteri <[email-masked]>
Date: Tue, 20 Sep 2011 13:31:03 +0100

When I open a diff file, and one hunk has a lot of changes, I noticed 
that the hard disk becomes busy for quite a bit of time until the 
refinements in the hunk are highlighted. I am including a simple diff 
file a.diff  below which causes the problem to me. The diff file has 40 
changes in one hunk.

I tried to track down what was causing this, and found that the function 
smerge-refine-subst was creating two temporary files and deleting them 
for each part of the hunk, so for the example below it creates and 
deletes 80 temporary files, and the hard disk is a bit busy for about 3 
seconds on my system, just to refine one hunk.

If I modify smerge-refine-subst by changing the lines
          (file1 (make-temp-file "diff1"))
          (file2 (make-temp-file "diff2")))
to
          (file1 "/dev/shm/diff1")
          (file2 "/dev/shm/diff2"))
the hard disk remains quiet and I do not have to wait for 3 seconds, 
presumably because /dev/shm is in RAM, not on the hard disk.

This reminds me of something that nags me a bit, although it is not 
really a problem. Whenever I'm using ediff, moving to the next hunk 
always makes the hard disk work, so I hear a short hard disk sound for 
each hunk I move to. I don't know if this is related.

a.diff:
--- a    2011-09-20 13:08:11.760491820 +0100
+++ b    2011-09-20 13:08:17.891515308 +0100
@@ -2,85 +2,85 @@
  x
  x
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
-a
+b
  x
  x
  x

In GNU Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.4)
  of 2011-05-23 on x86-12.phx2.fedoraproject.org
Windowing system distributor `Fedora Project', version 11.0.11003000
configured using `configure  '--build=x86_64-redhat-linux-gnu' 
'--host=x86_64-redhat-linux-gnu' '--program-prefix=' 
'--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' 
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' 
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' 
'--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/var/lib' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' 
'--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' 
'--with-x-toolkit=gtk' 'build_alias=x86_64-redhat-linux-gnu' 
'host_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g 
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic''

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.utf8
   value of $XMODIFIERS: @im=none
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
   tooltip-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-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
   line-number-mode: t
   transient-mark-mode: t

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

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message idna sendmail regexp-opt ecomplete rfc822
mml easymenu 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 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)