emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small bug in PC-expand-many-files.


From: Michaël Cadilhac
Subject: Small bug in PC-expand-many-files.
Date: Tue, 06 Jun 2006 01:59:12 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Recipe:
In your ~, you have a directory `helloworld' in which there's a file
called `foobarbaz'. You don't have a directory named `demaille'.

$ emacs -Q
M-x partial-completion-mode RET
C-x C-f ~/demaille/akim RET
 (message: Use M-x make-directory RET RET to create the directory and
 its parents)

C-x C-f ~/hell/foo TAB
 (*error*: shell-command: Setting current directory: no such file or
 directory, /home/micha/demaille)


This is due to a call to `call-process' within a buffer created after
the `akim' one, from which it takes its default directory.

I propose the following change, which AFAICT, fixes the bug:

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9661
diff -c -r1.9661 ChangeLog
*** lisp/ChangeLog      1 Jun 2006 06:42:07 -0000       1.9661
--- lisp/ChangeLog      5 Jun 2006 23:51:00 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2006-06-06  Michaël Cadilhac  <address@hidden>
+ 
+       * complete.el (PC-expand-many-files): Go to the home directory
+       before `shell-command' if the default one is not executable.
+ 
  2006-06-01  Jan Djärv  <address@hidden>
  
        * term/x-win.el: Change x-menu-bar-start to menu-bar-open.
Index: lisp/complete.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/complete.el,v
retrieving revision 1.53
diff -c -r1.53 complete.el
*** lisp/complete.el    22 May 2006 18:09:40 -0000      1.53
--- lisp/complete.el    5 Jun 2006 23:51:00 -0000
***************
*** 778,783 ****
--- 778,785 ----
  (defun PC-expand-many-files (name)
    (with-current-buffer (generate-new-buffer " *Glob Output*")
      (erase-buffer)
+     (unless (file-executable-p default-directory)
+       (setq default-directory "~/"))
      (shell-command (concat "echo " name) t)
      (goto-char (point-min))
      ;; CSH-style shells were known to output "No match", whereas
-- 
 |      Michaël `Micha' Cadilhac   |  Un certain Blaise Pascal              |
 |         Epita/LRDE Promo 2007   |    etc... etc...                       |
 | http://www.lrde.org/~cadilh_m   |  -- Prévert (Les paris stupides)       |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgpuYMHMaC9LI.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]