[comp.emacs] dired and file names with spaces

rodney@fractal.ipl.rpi.edu (Rodney Peck II) (07/20/89)

Hi there, I was just looking around a directory with dired and I tried
to delete a file with a space in its name.  Suprise!  Dired took
everything up to the first space as the file name.  Well, that's not
quite right.  Filenames can have spaces in them.

So, I found the code responsible and whipped up this little patch.
It's completely optional and will not affect anyone who doesn't wish
to have it active.  To use it, simply patch your copy of
lisp/dired.el, byte-compile it, and put the following in your .emacs
file:

(setq dired-filename-terminating-expr "^\n")

which means to include everything up to the CR as a the filename.  The
original value was "^ \n" which stops at CR or the first space.
(wrong)

(How about that.  Something useful before 10am!)

here's the cdiff:
--Rodney


*** orig-dired.el	Thu Jul 20 09:18:06 1989
--- dired.el	Thu Jul 20 09:20:55 1989
***************
*** 266,271 ****
--- 266,276 ----
    (interactive)
    (find-file-other-window (dired-get-filename)))
  
+ (defvar dired-filename-terminating-expr "^ \n" 
+   "Expression for skip-chars-forward indicating the end of a filename on a dired line
+ Generally either \"^ \\n\" for default use or \"^\\n\" to properly get filenames with
+ spaces in them.")
+ 
  (defun dired-get-filename (&optional localp no-error-if-not-filep)
    "In dired, return name of file mentioned on this line.
  Value returned normally includes the directory name.
***************
*** 283,289 ****
  		 (skip-chars-forward "^ " eol)
  		 (skip-chars-forward " " eol)
  		 (let ((beg (point)))
! 		   (skip-chars-forward "^ \n")
  		   (if localp
  		       (buffer-substring beg (point))
  		     ;; >> uses default-directory, could lose on cd, multiple.
--- 288,294 ----
  		 (skip-chars-forward "^ " eol)
  		 (skip-chars-forward " " eol)
  		 (let ((beg (point)))
! 		   (skip-chars-forward dired-filename-terminating-expr)
  		   (if localp
  		       (buffer-substring beg (point))
  		     ;; >> uses default-directory, could lose on cd, multiple.

--
Rodney