[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suggestions for rcompile.el
From: |
Kevin Rodgers |
Subject: |
Re: Suggestions for rcompile.el |
Date: |
Thu, 19 Feb 2004 12:48:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Alfred M. Szmidt wrote:
> First suggestion, it would be nice when doing: C-u M-x remote-compile,
> that the function would ask once again for the user/host questions.
> It is quite annoying not to be able to specify a different host (or
> user) sometimes. Or maybe it should act more or less like compile and
> ask all questions all the time, and then have a remote-recompile
> command instead.
If you set remote-compile-prompt-for-user and/or -host, the following
patch should do what you want even when you are visiting a remote file.
The patch is a little lengthy because I was also able to clean up the
code.
2004-02-19 Kevin Rodgers <address@hidden>
* net/rcompile.el (remote-compile): Always prompt for HOST
remote-compile-prompt-for-host is set, even when visiting a
remote file, and provide a default. Same for USER and
remote-compile-prompt-for-user.
(remote-compile-prompt-for-host,
remote-compile-prompt-for-user): Update doc strings.
*** emacs-21.3/lisp/net/rcompile.el.orig Thu May 16 10:03:59 2002
--- emacs-21.3/lisp/net/rcompile.el Thu Feb 19 12:09:14 2004
***************
*** 96,107 ****
:group 'remote-compile)
(defcustom remote-compile-prompt-for-host nil
! "*Non-nil means prompt for host if not available from filename."
:type 'boolean
:group 'remote-compile)
(defcustom remote-compile-prompt-for-user nil
! "*Non-nil means prompt for user if not available from filename."
:type 'boolean
:group 'remote-compile)
--- 96,107 ----
:group 'remote-compile)
(defcustom remote-compile-prompt-for-host nil
! "*Non-nil means prompt for host."
:type 'boolean
:group 'remote-compile)
(defcustom remote-compile-prompt-for-user nil
! "*Non-nil means prompt for user."
:type 'boolean
:group 'remote-compile)
***************
*** 119,159 ****
"Compile the current buffer's directory on HOST. Log in as USER.
See \\[compile]."
(interactive
! (let ((parsed (or (and (featurep 'ange-ftp)
! (ange-ftp-ftp-name default-directory))))
! host user command prompt)
! (if parsed
! (setq host (nth 0 parsed)
! user (nth 1 parsed))
! (setq prompt (if (stringp remote-compile-host)
! (format "Compile on host (default %s): "
! remote-compile-host)
! "Compile on host: ")
! host (if (or remote-compile-prompt-for-host
! (null remote-compile-host))
! (read-from-minibuffer prompt
! "" nil nil
! 'remote-compile-host-history)
! remote-compile-host)
! user (if remote-compile-prompt-for-user
! (read-from-minibuffer (format
! "Compile by user (default %s)"
! (or remote-compile-user
! (user-login-name)))
! "" nil nil
! 'remote-compile-user-history)
! remote-compile-user)))
! (setq command (read-from-minibuffer "Compile command: "
! compile-command nil nil
! '(compile-history . 1)))
! (list (if (string= host "") remote-compile-host host)
! (if (string= user "") remote-compile-user user)
! command)))
(setq compile-command command)
- (cond (user
- (setq remote-compile-user user))
- ((null remote-compile-user)
- (setq remote-compile-user (user-login-name))))
(let* ((parsed (and (featurep 'ange-ftp)
(ange-ftp-ftp-name default-directory)))
(compile-command
--- 119,150 ----
"Compile the current buffer's directory on HOST. Log in as USER.
See \\[compile]."
(interactive
! (let* ((parsed (and (featurep 'ange-ftp)
! (ange-ftp-ftp-name default-directory)))
! (host (or (and parsed (nth 0 parsed))
! remote-compile-host))
! (user (or (and parsed (nth 0 parsed))
! remote-compile-user))
! command)
! (when (or remote-compile-prompt-for-host (null host))
! (setq host
! (read-string (if host
! (format "Compile on host (default: %s): " host)
! "Compile on host: ")
! nil 'remote-compile-host-history host)))
! (when (or remote-compile-prompt-for-user (null user))
! (setq user
! (read-string (format "Compile on %s by user (default: %s): "
! host (or user (user-login-name)))
! nil
! 'remote-compile-user-history
! (or user (user-login-name)))))
! (setq command
! (read-from-minibuffer "Compile command: "
! compile-command nil nil
! '(compile-history . 1)))
! (list host user command)))
(setq compile-command command)
(let* ((parsed (and (featurep 'ange-ftp)
(ange-ftp-ftp-name default-directory)))
(compile-command
***************
*** 160,172 ****
(format "%s %s -l %s \"(%scd %s; %s)\""
remote-shell-program
host
! remote-compile-user
(if remote-compile-run-before
(concat remote-compile-run-before "; ")
"")
(if parsed (nth 2 parsed) default-directory)
! compile-command)))
! (setq remote-compile-host host)
(save-some-buffers nil nil)
(compile-internal compile-command "No more errors")
;; Set comint-file-name-prefix in the compilation buffer so
--- 151,164 ----
(format "%s %s -l %s \"(%scd %s; %s)\""
remote-shell-program
host
! user
(if remote-compile-run-before
(concat remote-compile-run-before "; ")
"")
(if parsed (nth 2 parsed) default-directory)
! command)))
! (setq remote-compile-host host
! remote-compile-user user)
(save-some-buffers nil nil)
(compile-internal compile-command "No more errors")
;; Set comint-file-name-prefix in the compilation buffer so
--
Kevin Rodgers