unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Invoke Ange-FTP from within Tramp
@ 2002-06-22 16:37 Kai Großjohann
  2002-06-22 21:58 ` Kim F. Storm
  2002-06-23 18:12 ` Richard Stallman
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-06-22 16:37 UTC (permalink / raw)


How to implement this feature?

My current idea is as follows:

* Create a function which, given an operation, a list of arguments,
  and a list of indices, invokes Ange-FTP.  (Call it tramp-run-ange-ftp.)

  The list of indices specifies where in the arg list you can find
  Ange-FTP filenames.  These arguments are then rewritten from Tramp
  format to Ange-FTP format.  Then ange-ftp-hook-function is invoked
  with the operation and those arguments.

* Change all tramp-handle-foo functions (foo are names of operations)
  to check whether Ange-FTP should be invoked, and have them signal
  `tramp-run-ange-ftp' with the list of indices (where to find
  filenames in the arg list) as argument.

* Change tramp-file-name-handler (the function mentioned in
  file-name-handler-alist) so that it catches the tramp-run-ange-ftp
  signal and invokes the tramp-run-ange-ftp function.

Other alternatives:

* Use throw/catch instead of signal/condition-case.  I have no idea
  which one to use.

* Put the invocation of Ange-FTP directly in the functions.  This
  means that all of the functions will get an additional conditional
  around it and the meat of the function is in the else part.

What do you think?  Is this the right way to do it?

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Invoke Ange-FTP from within Tramp
  2002-06-22 16:37 Invoke Ange-FTP from within Tramp Kai Großjohann
@ 2002-06-22 21:58 ` Kim F. Storm
  2002-06-23 18:12   ` Richard Stallman
  2002-06-23 18:12 ` Richard Stallman
  1 sibling, 1 reply; 6+ messages in thread
From: Kim F. Storm @ 2002-06-22 21:58 UTC (permalink / raw)
  Cc: emacs-devel

Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> How to implement this feature?
> 
> 
> * Put the invocation of Ange-FTP directly in the functions.  This
>   means that all of the functions will get an additional conditional
>   around it and the meat of the function is in the else part.

Couldn't this be done with a suitable defmacro ?

        (deftramp find-file (arg...)
           code)

expands to

        (defun tramp-find-file (arg...)
          (if (activate-ange-ftp ...)
             (ange-ftp-find-file arg...)
            code))


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Invoke Ange-FTP from within Tramp
  2002-06-22 16:37 Invoke Ange-FTP from within Tramp Kai Großjohann
  2002-06-22 21:58 ` Kim F. Storm
@ 2002-06-23 18:12 ` Richard Stallman
  2002-06-24 15:52   ` Kai Großjohann
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Stallman @ 2002-06-23 18:12 UTC (permalink / raw)
  Cc: emacs-devel

If you are programming the nonlocal control transfer,
it is better to use catch and throw, rather than errors.
(See the Emacs Lisp Manual.)

Since I have not studied the code, I don't have an opinion
about the third alternative.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Invoke Ange-FTP from within Tramp
  2002-06-22 21:58 ` Kim F. Storm
@ 2002-06-23 18:12   ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-06-23 18:12 UTC (permalink / raw)
  Cc: Kai.Grossjohann, emacs-devel

    Couldn't this be done with a suitable defmacro ?

	    (deftramp find-file (arg...)
	       code)

    expands to

	    (defun tramp-find-file (arg...)

If the actual function is called tramp-find-file, then the symbol that
appears in the code should be tramp-find-file, not find-file.
This is for the sake of etags, and C-s, and grep, etc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Invoke Ange-FTP from within Tramp
  2002-06-23 18:12 ` Richard Stallman
@ 2002-06-24 15:52   ` Kai Großjohann
  2002-06-25 11:07     ` Richard Stallman
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Großjohann @ 2002-06-24 15:52 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

> If you are programming the nonlocal control transfer,
> it is better to use catch and throw, rather than errors.
> (See the Emacs Lisp Manual.)

Okay, I will do that.  Note that I did look in the Emacs Lisp Manual,
but I didn't see anything which told me which variant to use.  That's
why I asked here.

Is there some kind of rule?

> Since I have not studied the code, I don't have an opinion
> about the third alternative.

I tried to do it, but then I decided to use the nonlocal control
transfer.  Having most of the function inside the `else' part of a
conditional appeared too ugly (to me).

kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Invoke Ange-FTP from within Tramp
  2002-06-24 15:52   ` Kai Großjohann
@ 2002-06-25 11:07     ` Richard Stallman
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2002-06-25 11:07 UTC (permalink / raw)
  Cc: emacs-devel

In the node Errors:

      Resist the temptation to use error handling to transfer control from
    one part of the program to another; use @code{catch} and @code{throw}
    instead.  @xref{Catch and Throw}.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-06-25 11:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-22 16:37 Invoke Ange-FTP from within Tramp Kai Großjohann
2002-06-22 21:58 ` Kim F. Storm
2002-06-23 18:12   ` Richard Stallman
2002-06-23 18:12 ` Richard Stallman
2002-06-24 15:52   ` Kai Großjohann
2002-06-25 11:07     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).