Subject: It was a configuration problem (re: (emacs 23.0.9{,3,4} dired mode bug(?)))

From: ishikawa <[email-masked]>
Date: Tue, 02 Jun 2009 15:29:31 +0900

I am the original reporter.

Sorry that my innocuous post caused a discussion of die-hard
differences of preferences, it seems.
(It has been going on and off since the late 80's if I recall correctly.)

After a false startup, I finally narrow down the problem to
my hastily configured testing environment.

Indeed, when I ran emacs -q that said misbehavior is no longer
observed.
(as noted by  Chong Yidong <[email-masked]>
in message #10 in the bug database readable from the web interface.
Since I am not on the mailing list, I can only read the follow-ups
using this web interface. And thus my followup is delayed. Sorry for
the delay.
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3438

BAD environment.:

In my .emacs file, I explicitly set the load-path to those of GNU
emacs 22.2 lisp directory.  (I was using Debian GNU/linux and usually
I obtain the emacs tar ball myself and install it disregarding the
ordinary package supplied by debian.)  Because of the explicit setup,
23.0.94 read the older dired.el of 22.2 distribution.

When I fixed the configuration so that emacs startup reads
the files under the latest lisp directory, all is well now.

(I sometimes wonder how the beta and alpha testers set up their .emacs
files.)

Here is the sleuth work I did.

===================
1. In dired mode, "n", C-n, and  cursor down key are bound to dired-next-line

(From C-h k n in dired mode buffer)

n runs the command dired-next-line, which is an interactive compiled Lisp
function in `dired.el'.
It is bound to <down>, n, SPC, C-n.
(dired-next-line ARG)

Move down lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line.

[back]

======================
2. Let me take a look at dired-next-line. This is in dired.el

23.0.94
(defun dired-next-line (arg)
  "Move down lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line."
  (interactive "p")
  (forward-line arg)
  (dired-move-to-filename))

These lines look fine.
Actually, I spent a couple of hours looking inside the latest lisp files
and manually invoking forward-line, et al from console using "M-X"
even redefining dired-move-to-filename to be interactive so that
I can invoke it by "M-X". But then all was well.

When I realized the clean startup (-q) works OK from the earlier post, I
realized that my .emacs seems to be preferring lisp files under 22.2
lisp directory. So  I looked at the old dired.el under 22.2

GNU Emacs 22.2.

(defun dired-next-line (arg)
  "Move down lines then position at filename.
Optional prefix ARG says how many lines to move; default is one line."
  (interactive "p")
  (next-line arg)      <===== AHA, CULPRIT!
  (dired-move-to-filename))

In 22.2, next-line is called instead of forward-line.
This explains the misbehavior, and the cure caused by
(setq line-move-visual nil).

Now, I modified my .emacs file so that
load-path contains the latest test emacs lisp directory
at the beginning when I invoke 23.0.9x beta/alpha.
And all is well.

Thank you again for taking the time to look at my now false-positive
bug report.

BTW, as I mentioned at the beginning, the pros and cons of various
settings have been rehashed over the years (a couple of decades at
least).

All I can suggest is to leave enough hooks (to the point that the
unsuspecting user can hang himself/herself if careless) so that the
user can customize the environment.

In hindsight, though, there are good customization paths that prove to
be easy to incorporate future changes and difficult to work with
later, but again these are hindsight and I have no good guideline to
offer. I am afraid only a close brush with the difficulty and ease
of customization and then upgrade can give people the "feel" for the
design.

As a side note, I have so many customizations done over the
years (I consolidated emacs setup files in 1991 which I had used in
the late 1980's on various machines, Sun, HP, DEC, etc. and under
different OS versions, and still use the remnant today), and
some customizations are now difficult to deal with and sometimes I
have no idea what some lisp code snipets do despite my efforts to
comment them, but fearing interrupted
behavior, I have left them in in for now (for the last several years).

(cf. I even have a temporary fix for broken ld/dump for an arcane system.
  in one of the customization files emacs reads.
  ;;;
  ;;; fix for buggy C compilation, linking, or dumping.
  ;;; text-char-description is broken. (This was on SunOS 3? or 4? on Sun3
  ;;;
  (if (not (and (string-equal "x" (text-char-description ?x ))
		(string-equal "y" (text-char-description ?y ))
		(string-equal "z" (text-char-description ?z ))))
      (progn
	(message "Buggy text-char-description is overwritten.")
	(load-library "tcdfix")))
  ;;;;;;;;

Such is life.

TIA.