From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Rename `eww' to `web' Date: Fri, 05 Jul 2013 07:02:18 -0400 Message-ID: References: <8738s087wj.fsf@gmail.com> <87bo6mjv4s.fsf@lifelogs.com> <871u7gavwx.fsf@catnip.gol.com> <87obaj39sc.fsf@lifelogs.com> <874ncbhsnv.fsf@gmail.com> <87ip0q1i49.fsf@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1373022148 12289 80.91.229.3 (5 Jul 2013 11:02:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Jul 2013 11:02:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 05 13:02:29 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uv3mW-0006Pk-KX for ged-emacs-devel@m.gmane.org; Fri, 05 Jul 2013 13:02:28 +0200 Original-Received: from localhost ([::1]:40476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv3mW-0001Cj-7L for ged-emacs-devel@m.gmane.org; Fri, 05 Jul 2013 07:02:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv3mS-0001Ce-Dp for emacs-devel@gnu.org; Fri, 05 Jul 2013 07:02:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uv3mQ-0002DS-Uw for emacs-devel@gnu.org; Fri, 05 Jul 2013 07:02:24 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:37831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uv3mQ-0002DN-Qx for emacs-devel@gnu.org; Fri, 05 Jul 2013 07:02:22 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r65B2JgN007748; Fri, 5 Jul 2013 07:02:20 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 06C39AE0D4; Fri, 5 Jul 2013 07:02:18 -0400 (EDT) In-Reply-To: <87ip0q1i49.fsf@lifelogs.com> (Ted Zlatanov's message of "Thu, 04 Jul 2013 11:04:38 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4629=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4629> : streams <994475> : uri <1467625> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161574 Archived-At: > So I think it makes sense to go straight to `eww' for that case: opening > a URL with `C-x C-f'. Like I said, it's DWIMmery. There will be a > small percentage of users unhappy with it, who will want to just view > the file, and we should make that easy (I guessed `find-file-literally' > incorrectly but it can be something simple to set in `url-handler-mode' > defcustoms). The key thing is that there are no command names to > discover--opening a URL Just Works. I currently use C-x C-f with url-handler-mode on a regular basis to open PDF, tarballs, and Elisp files. Sometime it gets it wrong because it only uses the URL name rather than the content-type metadata to choose the major mode, but want to make sure this keeps working. But I don't see any reason why this should collide with using eww in other cases: eww can't do anything particularly useful with PDF, tarballs and Elisp code anyway. > GM> emacs -Q -f url-handler-mode > GM> C-x C-f ftp://ftp.gnu.org > GM> C-x C-f http://www.gnu.org > Yup. The necessary changes to make this usable IMHO are: > 1) make it call `eww' by default and provide for a way to instead look > at file contents (current behavior, right?) Why would you want to use eww for all URLs, since it only handles HTML in a useful way, AFAIU? > 2) enable `url-handler-mode' by default Fine by me (BTW, I've been using the hack below to ape completion on http URLs). Stefan Using submit branch file:///home/monnier/src/emacs/bzr/trunk/ === modified file 'lisp/url/url-handlers.el' --- lisp/url/url-handlers.el 2013-05-22 07:30:44 +0000 +++ lisp/url/url-handlers.el 2013-05-24 19:52:40 +0000 @@ -311,11 +311,45 @@ (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) (defun url-file-name-completion (url directory &optional predicate) - (error "Unimplemented")) + (let ((all (url-file-name-all-completions url directory))) + (if (null all) + ;; If `url' is the empty string, don't return nil, so as to prevent + ;; partial-completion from recursing into the parent directory. + (if (equal url "") url) + (try-completion url all predicate)))) (put 'file-name-completion 'url-file-handlers 'url-file-name-completion) (defun url-file-name-all-completions (file directory) - (error "Unimplemented")) + ;; FIXME: Cache the "directory" buffers between completion requests. + (let ((buf (get-file-buffer directory))) + (unless buf + (setq buf (ignore-errors (find-file-noselect directory))) + (when buf + (with-current-buffer buf + (set (make-local-variable 'url-handler-temp-buf) t)))) + (when buf + (unwind-protect + (with-current-buffer buf + (save-excursion + (let ((all ()) + (case-fold-search t) + ;; FIXME: Handle URL-quoting. + (regexp (format "