emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: Re: compile and the current directory]


From: Alfred M. Szmidt
Subject: Re: address@hidden: Re: compile and the current directory]
Date: Tue, 20 Jan 2004 08:12:05 +0100 (MET)

       +  (let (olddir default-directory)
       +    (unless (eq compilation-directory nil)
       +      (setq default-directory compilation-directory))
       +    (apply 'compile-internal (or compilation-arguments
       +                                 `(,(eval compile-command) "No more 
errors")))
       +    (setq default-directory olddir)))

   This is a roundabout and unreliable way to bind default-directory.
   Why not just bind it with let?

     (let ((default-directory (or compilation-directory default-directory)))
       (apply 'compile-internal (or compilation-arguments
              `(,(eval compile-command) "No more errors"))))

There wasn't any particular reason not to use let, here is a updated
version with the above suggestion, thanks.

*** compile.el.~1.282.~ Sun Nov 23 21:57:47 2003
--- compile.el  Tue Jan 20 08:10:23 2004
***************
*** 386,391 ****
--- 386,394 ----
  try; %s in the string is replaced by the text matching the FILE-IDX'th
  subexpression.")
  
+ (defvar compilation-directory nil
+   "Directory to restore to when doing `recompile'.")
+ 
  (defvar compilation-enter-directory-regexp-alist
    '(
      ;; Matches lines printed by the `-w' option of GNU Make.
***************
*** 578,583 ****
--- 581,587 ----
    (unless (equal command (eval compile-command))
      (setq compile-command command))
    (save-some-buffers (not compilation-ask-about-save) nil)
+   (setq compilation-directory default-directory)
    (compile-internal command "No more errors"))
  
  ;; run compile with the default command line
***************
*** 587,594 ****
  original use.  Otherwise, it recompiles using `compile-command'."
    (interactive)
    (save-some-buffers (not compilation-ask-about-save) nil)
!   (apply 'compile-internal (or compilation-arguments
!                             `(,(eval compile-command) "No more errors"))))
  
  (defcustom compilation-scroll-output nil
    "*Non-nil to scroll the *compilation* buffer window as output appears.
--- 591,599 ----
  original use.  Otherwise, it recompiles using `compile-command'."
    (interactive)
    (save-some-buffers (not compilation-ask-about-save) nil)
!   (let ((default-directory (or compilation-directory default-directory)))
!     (apply 'compile-internal (or compilation-arguments
!                                `(,(eval compile-command) "No more errors")))))
  
  (defcustom compilation-scroll-output nil
    "*Non-nil to scroll the *compilation* buffer window as output appears.




reply via email to

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