bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#17425: 24.4.50; tramp-cleanup-this-connection on push-button


From: Michael Albinus
Subject: bug#17425: 24.4.50; tramp-cleanup-this-connection on push-button
Date: Mon, 12 May 2014 20:50:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Maybe it is time to extend the semantics of
>> `file-accessible-directory-p'.
>
> Not sure what you mean: file-accessible-directory-p should test whether
> that directory can be used as "cwd".  Nothing more nothing less.
>
>> When FILENAME is remote, Tramp's (or any other) respective handler
>> would return nil if there isn't an established connection. IOW, Tramp
>> wouldn't open a non-existing connection.
>
> Why?

The scenario of the OP is as follows:

- There's a buffer with an existing remote default-directory, connection
  established.

- No problem to run browse-url in that buffer (the example was an
  rcirc buffer). It doesn't hurt, that default-directory is remote.

- After a while, the remote host wasn't available any more, for whatever
  reason.

- Now browse-url fails, because it checks file-directory-p and
  file-readable-p. Both operations try to access the remote
  default-directory.

If the check would be replaced file-accessible-directory-p, and this
operation doesn't try to reopen a stalled connection, it would be
sufficient for that use case.

Glenn has proposed a similar change, but with also checking (not
(file-remote-p default-directory)). I became a little bit nervous,
because file-remote-p isn't reserved not only for Tramp, but for any
file name handler (like url-handlers.el).

>> By this, we could just test `(file-accessible-directory-p default-directory)'
>
> Sorry, I lost you: Where would you use this test, instead of what?

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/net/browse-url.el.~117091~     2014-05-12 
20:47:03.821360420 +0200
--- /home/albinus/src/emacs/lisp/net/browse-url.el      2014-05-12 
20:46:53.969311566 +0200
***************
*** 812,819 ****
                           browse-url-mailto-function)
                      browse-url-browser-function))
        ;; Ensure that `default-directory' exists and is readable (b#6077).
!       (default-directory (if (and (file-directory-p default-directory)
!                                   (file-readable-p default-directory))
                               default-directory
                             (expand-file-name "~/"))))
      ;; When connected to various displays, be careful to use the display of
--- 812,818 ----
                           browse-url-mailto-function)
                      browse-url-browser-function))
        ;; Ensure that `default-directory' exists and is readable (b#6077).
!       (default-directory (if (file-accessible-directory-p default-directory)
                               default-directory
                             (expand-file-name "~/"))))
      ;; When connected to various displays, be careful to use the display of
--8<---------------cut here---------------end--------------->8---

>> without the threat to damage other packages like url-handlers.el.
>
> And I have no idea what damage you're referring to.

That's the whole thread about, I've discussed with Glenn.

>         Stefan

Best regards, Michael.





reply via email to

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