all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Multiple people touching the same file with ange-ftp
@ 2007-01-10 22:40 rgb
  2007-01-10 22:52 ` rgb
  0 siblings, 1 reply; 6+ messages in thread
From: rgb @ 2007-01-10 22:40 UTC (permalink / raw)


I'm reading in the manual where it says:

Every time Emacs saves a buffer, it first checks the last-modification
date of the existing file on disk to verify that it has not changed
since the file was last visited or saved.

This doesn't happen when I visit a file via ange-ftp.
I'm accessing an unusual host so most of the support I've had to write
myself.  But I don't see anything related to modification timestamps
begin called when I trace the ange-ftp calls so I'm not sure how/what
to modify to make this work.

Does anyone have even the slightest idea where to start looking in
order to add support for this.

Thanks

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

* Re: Multiple people touching the same file with ange-ftp
  2007-01-10 22:40 Multiple people touching the same file with ange-ftp rgb
@ 2007-01-10 22:52 ` rgb
  2007-01-11  6:44   ` Kevin Rodgers
       [not found]   ` <mailman.2958.1168497899.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: rgb @ 2007-01-10 22:52 UTC (permalink / raw)



rgb wrote:
> I'm reading in the manual where it says:
>
> Every time Emacs saves a buffer, it first checks the last-modification
> date of the existing file on disk to verify that it has not changed
> since the file was last visited or saved.
>
> This doesn't happen when I visit a file via ange-ftp.
> I'm accessing an unusual host so most of the support I've had to write
> myself.  But I don't see anything related to modification timestamps
> begin called when I trace the ange-ftp calls so I'm not sure how/what
> to modify to make this work.
>
> Does anyone have even the slightest idea where to start looking in
> order to add support for this.
>
> Thanks

I did get a little further on this.
I see the command MDTM being attempted and the response
'command not understood' coming back.
If I could intercept this, the DIR command does show the modification
time so I should be able to find and return it.

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

* Re: Multiple people touching the same file with ange-ftp
  2007-01-10 22:52 ` rgb
@ 2007-01-11  6:44   ` Kevin Rodgers
       [not found]   ` <mailman.2958.1168497899.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2007-01-11  6:44 UTC (permalink / raw)


rgb wrote:
> rgb wrote:
>> I'm reading in the manual where it says:
>>
>> Every time Emacs saves a buffer, it first checks the last-modification
>> date of the existing file on disk to verify that it has not changed
>> since the file was last visited or saved.
>>
>> This doesn't happen when I visit a file via ange-ftp.
>> I'm accessing an unusual host so most of the support I've had to write
>> myself.  But I don't see anything related to modification timestamps
>> begin called when I trace the ange-ftp calls so I'm not sure how/what
>> to modify to make this work.
>>
>> Does anyone have even the slightest idea where to start looking in
>> order to add support for this.
>>
>> Thanks
> 
> I did get a little further on this.
> I see the command MDTM being attempted and the response
> 'command not understood' coming back.
> If I could intercept this, the DIR command does show the modification
> time so I should be able to find and return it.

Searching for MDTM in ange-ftp.el leads one to ange-ftp-file-modtime.

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: Multiple people touching the same file with ange-ftp
       [not found]   ` <mailman.2958.1168497899.2155.help-gnu-emacs@gnu.org>
@ 2007-01-11 17:34     ` rgb
  2007-01-12  8:00       ` Kevin Rodgers
       [not found]       ` <mailman.2987.1168588869.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: rgb @ 2007-01-11 17:34 UTC (permalink / raw)


Kevin Rodgers wrote:
> rgb wrote:
> > rgb wrote:
> >> I'm reading in the manual where it says:
> >>
> >> Every time Emacs saves a buffer, it first checks the last-modification
> >> date of the existing file on disk to verify that it has not changed
> >> since the file was last visited or saved.
> >>
> >> This doesn't happen when I visit a file via ange-ftp.
> >> I'm accessing an unusual host so most of the support I've had to write
> >> myself.  But I don't see anything related to modification timestamps
> >> begin called when I trace the ange-ftp calls so I'm not sure how/what
> >> to modify to make this work.
> >>
> >> Does anyone have even the slightest idea where to start looking in
> >> order to add support for this.
> >>
> >> Thanks
> >
> > I did get a little further on this.
> > I see the command MDTM being attempted and the response
> > 'command not understood' coming back.
> > If I could intercept this, the DIR command does show the modification
> > time so I should be able to find and return it.
>
> Searching for MDTM in ange-ftp.el leads one to ange-ftp-file-modtime.
>

Yes I did notice that.  Thanks
As yet I don't see an obvious way to override or intercept that
function on a  host by host basis.
I see examples of host specific calls being set up like this.
(add-to-list 'ange-ftp-parse-list-func-alist
	     '(vms . ange-ftp-parse-vms-listing))
But it doesn't work for this function.
I'm sure, with some further study
I'll find a way.  It's been a slow process so far.  Perhaps putting
advice around it is the only way.
There seems to be lots of essoteric knowledge needed to
retrieve the data needed to compute the time too.
I'm continuing to plug away at it and will keep my eye here
for shortcuts or advise on the best way to proceed.
Thanks

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

* Re: Multiple people touching the same file with ange-ftp
  2007-01-11 17:34     ` rgb
@ 2007-01-12  8:00       ` Kevin Rodgers
       [not found]       ` <mailman.2987.1168588869.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2007-01-12  8:00 UTC (permalink / raw)


rgb wrote:
> Kevin Rodgers wrote:
>> rgb wrote:
>>> I see the command MDTM being attempted and the response
>>> 'command not understood' coming back.
>>> If I could intercept this, the DIR command does show the modification
>>> time so I should be able to find and return it.
>> Searching for MDTM in ange-ftp.el leads one to ange-ftp-file-modtime.
>>
> 
> Yes I did notice that.  Thanks
> As yet I don't see an obvious way to override or intercept that
> function on a  host by host basis.
> I see examples of host specific calls being set up like this.
> (add-to-list 'ange-ftp-parse-list-func-alist
> 	     '(vms . ange-ftp-parse-vms-listing))
> But it doesn't work for this function.
> I'm sure, with some further study
> I'll find a way.  It's been a slow process so far.  Perhaps putting
> advice around it is the only way.
> There seems to be lots of essoteric knowledge needed to
> retrieve the data needed to compute the time too.
> I'm continuing to plug away at it and will keep my eye here
> for shortcuts or advise on the best way to proceed.

You could start by making ange-ftp-file-modtime extensible, the same way
ange-ftp-parse-listing is extensible via the ange-ftp-parse-list-func-alist
variable:

(defvar ange-ftp-file-modtime-func-alist nil
   "Alist saying how to return modification time of remote file.
Association list of \( TYPE \. FUNC \) pairs, where FUNC is a
routine which returns the modification time of a remote file from
a host of type TYPE.")

(defadvice ange-ftp-file-modtime (around func-alist activate)
   "If `ange-ftp-file-modtime-func-alist' has an entry for FILE's host type,
return the result of calling that function."
   (let* ((ftp-name (ange-ftp-ftp-name file))
	 (host (nth 0 ftp-name))
	 (user (nth 1 ftp-name))
	 (name (nth 2 ftp-name))
	 (func (assq (ange-ftp-host-type host)
		     ange-ftp-file-modtime-func-alist)))
     (if func
	(funcall func file)
       ad-do-it)))

Now you just have to implement ange-ftp-file-modtime-for-FOO and add
(FOO . ange-ftp-file-modtime-for-FOO) to ange-ftp-file-modtime-func-alist,
assuming ange-ftp-host-type returns FOO for file's on your server. :-)

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: Multiple people touching the same file with ange-ftp
       [not found]       ` <mailman.2987.1168588869.2155.help-gnu-emacs@gnu.org>
@ 2007-01-12 18:40         ` rgb
  0 siblings, 0 replies; 6+ messages in thread
From: rgb @ 2007-01-12 18:40 UTC (permalink / raw)


> >> Searching for MDTM in ange-ftp.el leads one to ange-ftp-file-modtime.
> >>
> > As yet I don't see an obvious way to override or intercept that
> > function on a  host by host basis.
>
> You could start by making ange-ftp-file-modtime extensible, the same way
> ange-ftp-parse-listing is extensible via the ange-ftp-parse-list-func-alist
> variable:
>
> (defvar ange-ftp-file-modtime-func-alist nil
>    "Alist saying how to return modification time of remote file.
> Association list of \( TYPE \. FUNC \) pairs, where FUNC is a
> routine which returns the modification time of a remote file from
> a host of type TYPE.")
>
> (defadvice ange-ftp-file-modtime (around func-alist activate)
>    "If `ange-ftp-file-modtime-func-alist' has an entry for FILE's host type,
> return the result of calling that function."
>    (let* ((ftp-name (ange-ftp-ftp-name file))
> 	 (host (nth 0 ftp-name))
> 	 (user (nth 1 ftp-name))
> 	 (name (nth 2 ftp-name))
> 	 (func (assq (ange-ftp-host-type host)
> 		     ange-ftp-file-modtime-func-alist)))
>      (if func
> 	(funcall func file)
>        ad-do-it)))
>
> Now you just have to implement ange-ftp-file-modtime-for-FOO and add
> (FOO . ange-ftp-file-modtime-for-FOO) to ange-ftp-file-modtime-func-alist,
> assuming ange-ftp-host-type returns FOO for file's on your server. :-)
>

Thanks.
I did get it working using your alist suggestion.

(defadvice ange-ftp-file-modtime
  (around host-type-alist-advice compile activate)
  "If `ange-ftp-file-modtime-func-alist' has an entry for FILE's host
type,
return the result of calling that function."
  (let ((fcn (cdr (assq (ange-ftp-host-type
                         (car (ange-ftp-ftp-name file)))
                        ange-ftp-file-modtime-func-alist))))
    (if fcn
        (setq ad-return-value (funcall fcn file))
    ad-do-it)))

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

end of thread, other threads:[~2007-01-12 18:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10 22:40 Multiple people touching the same file with ange-ftp rgb
2007-01-10 22:52 ` rgb
2007-01-11  6:44   ` Kevin Rodgers
     [not found]   ` <mailman.2958.1168497899.2155.help-gnu-emacs@gnu.org>
2007-01-11 17:34     ` rgb
2007-01-12  8:00       ` Kevin Rodgers
     [not found]       ` <mailman.2987.1168588869.2155.help-gnu-emacs@gnu.org>
2007-01-12 18:40         ` rgb

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.