all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: igrep on remote files with tramp?
Date: Tue, 02 Aug 2005 14:35:13 -0600	[thread overview]
Message-ID: <dcole3$bmk$1@sea.gmane.org> (raw)
In-Reply-To: <0001HW.BF12DC880234B350F0305550@news.ispnetbilling.com>

Daniel Berdine wrote:
 > On Thu, 28 Jul 2005 15:28:54 -0400, Kevin Rodgers wrote
 > (in article <mailman.1998.1122579165.20277.help-gnu-emacs@gnu.org>):
 > > igrep only supports ange-ftp (and efs) to the extent that the
 > > igrep-visited-files and Buffer-menu-igrep commands explicitly ignore
 > > remote files.
 > >
 > > To properly support remote files, igrep would need to invoke the grep
 > > command in a remote shell.  I know there has been discussion about
 > > whether Emacs should implement process handlers, so that tramp 
could run
 > > programs on a remote host when invoked from a buffer visiting a remote
 > > file.  But I don't know what was decided and implemented (if anything).
 >
 > Ok, thanks.
 >
 > I'm obviously ignorant here, but why is this so different than, say,
 > incremental searches across several remote files with tramp?

I'm completely ignorant about tramp.  Do you mean incremental search
across several buffers visiting remote files via tramp?  Or does tramp
provide its own incremental search command?

 > Can't a local igrep be run on the local tmp files that get used for so
 > many other purposes?

I don't know how tramp works, but ange-ftp evidently does not leave the
local tmp files on disk once their contents have been inserted into the
buffer.

 > In any case, being able to run remote processes with tramp would be 
great.

It turns out that ange-ftp provides file name handlers for
shell-command, which uses remote-shell-program (e.g.  /bin/remsh) to
execute the command on the other host when visiting a remote file or
directory.  So I would be suprised if tramp does not provide the same
functionality when you use e.g. `! grep foo *.java'.

But igrep and grep are based on compile, which uses start-process
instead of shell-command.  But since tramp provides commands for
compilation of files on remote hosts (see
http://www.gnu.org/software/tramp/#Compilation), perhaps tramp-util.el
just needs something like this (cribbed from tramp-compile):

(defun tramp-grep (command)
   "Run grep COMMAND on remote host."
   (interactive
    (list (read-from-minibuffer "Run grep (like this): "
                                (or (car grep-history) grep-command)
                                nil nil 'grep-history)))
   (setq grep-command command)
   (unless (string-match "[ \t]*&[ \t]*\\'" command)
     (setq command (concat command "&")))
   (save-some-buffers (not compilation-ask-about-save) nil)
   (let ((d default-directory))
     (save-excursion
       (pop-to-buffer (get-buffer-create "*grep*") t)
       (erase-buffer)
       (setq default-directory d)))
   (tramp-handle-shell-command command (get-buffer "*grep*"))
   (pop-to-buffer (get-buffer "*grep*"))
   (compilation-mode)
   (compilation-minor-mode 1)
   (tramp-minor-mode 1))

(tramp-remap-command 'grep 'tramp-grep)

(when (fboundp 'add-menu-button)
   (funcall 'add-menu-button
    '("Tools" "Grep")
    ["Search Files (Grep)..."
     (command-execute (if tramp-minor-mode 'tramp-grep 'grep))
     :active (fboundp 'grep)]))

 > I've frequently wished I could do this with gdb within emacs, for 
instance.

You are not alone.

-- 
Kevin Rodgers

  reply	other threads:[~2005-08-02 20:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-28 17:38 igrep on remote files with tramp? Daniel Berdine
2005-07-28 17:55 ` Daniel Berdine
2005-07-28 19:28 ` Kevin Rodgers
2005-07-28 21:02   ` Michael Albinus
2005-07-28 22:54     ` Kevin Rodgers
2005-07-28 19:43 ` Michael Albinus
     [not found] ` <mailman.1998.1122579165.20277.help-gnu-emacs@gnu.org>
2005-07-31 23:52   ` Daniel Berdine
2005-08-02 20:35     ` Kevin Rodgers [this message]
2005-08-02 23:56       ` Kevin Rodgers
2005-08-03  8:10       ` Michael Albinus
     [not found] ` <mailman.2000.1122579980.20277.help-gnu-emacs@gnu.org>
2005-08-01  0:04   ` Daniel Berdine
2005-08-01  5:01 ` igrep on remote files with tramp? (~Solved) Daniel Berdine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='dcole3$bmk$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.