From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ken Newsgroups: gmane.emacs.help Subject: Re: visiting remote files on webserver Date: Fri, 22 Aug 2014 08:19:45 -0400 Message-ID: <53F73561.2030706@mousecar.com> References: <877g27uvc6.fsf@yun.yagibdah.de> <21488.55126.483499.836883@mail.eng.it> <87mwb2975w.fsf@yun.yagibdah.de> <878ummod7j.fsf@ericabrahamsen.net> <87mwb1wtak.fsf@yun.yagibdah.de> <87lhqljlpo.fsf@ericabrahamsen.net> <871ts91vwn.fsf@yun.yagibdah.de> Reply-To: gebser@mousecar.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1408710038 22409 80.91.229.3 (22 Aug 2014 12:20:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2014 12:20:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 22 14:20:32 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1XKnpL-0005Hl-4q for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2014 14:20:19 +0200 Original-Received: from localhost ([::1]:36799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKnpK-0004NV-Kk for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2014 08:20:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKnp3-0004JF-LC for help-gnu-emacs@gnu.org; Fri, 22 Aug 2014 08:20:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKnox-0006SW-Dg for help-gnu-emacs@gnu.org; Fri, 22 Aug 2014 08:20:01 -0400 Original-Received: from mout.perfora.net ([74.208.4.197]:50145) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKnox-0006SB-6Z for help-gnu-emacs@gnu.org; Fri, 22 Aug 2014 08:19:55 -0400 Original-Received: from dellap.mousecar.net (clev-static1-cs17.static.dslohio.net [66.219.160.17]) by mrelay.perfora.net (node=mreueus002) with ESMTP (Nemesis) id 0LsAZt-1WLeuW2SMx-013wpy; Fri, 22 Aug 2014 14:19:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: <871ts91vwn.fsf@yun.yagibdah.de> X-Provags-ID: V02:K0:NSPb9ute+01P0OYmiHnXQOX8w/7/J4jHCnvWtzliShJ O9i1pdImcSvz6tZ1WCKLjU2v1Ei3OcSj5yH7Ia7905rPU4UWo9 ytCrRMVeF69/RW+ArYCReUvqF6DomvGlarw8wHFojHV+zP6Yzq H8xQfqLMoENSXLa/8IgTQGmN4CXxb0Va6QB5aMcRG3OurB7BMj LADxm1YXLNJq7aV14IZ+anoXjSlB1fd3xQi25J1zxE9WnZAHKV MS7VvRGWkYiewqL6gkhyzXU5/B6v71PkATYiNY/m52TFpIof8E qFNVlScyPCDBBicWRXF7oYw+L4Da5VFQz16948ngaokB+xNq7T woH3neeLcU/sAERKj+LMXRIs98k4RLr55AqLFs5R7 X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 74.208.4.197 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99343 Archived-At: On 08/21/2014 03:32 PM lee wrote: > lee writes: >>>> >>>>In this particular case, I wanted to get a script from some web >>>> >>>>server I don't have any special access to. I could have downloaded >>>> >>>>and saved and visited it, but why not load it directly into a >>>> >>>>buffer. With considerable help from this list years ago I wrote the below. It worked for a long time, until I upgraded emacs. It did what you want, plus a little bit more which can easily be edited out. ======================================================= ;url-fetch-web-page ;From within emacs, download & locally edit a remote web page. ;Copyright (c) 2010, Kenneth Fisler, Cleveland, Ohio, USA. ;This program is free software; you can redistribute it and/or ;modify it under the terms of the GNU General Public License ;as published by the Free Software Foundation; either version 2 ;of the License, or (at your option) any later version. ; ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ; ;You should have received a copy of the GNU General Public ;License along with this program; if not, write to the Free ;Software Foundation, Inc., 59 Temple Place, Suite 330, ;Boston, MA 02111-1307 USA ;Using the url.el library, so probably need to load it. (require 'url) (defun url-fetch-web-page (url) "Retrieve minibuffer-specified web page, load into a new buffer, then call another function for editing." (interactive "sLoad URL: ") (with-temp-buffer (url-retrieve url 'edit-web-page (list url 'status)))) (defun edit-web-page (&optional redirect url status) "Switch to the buffer returned by `url-retrieve'. Automatically strip out all C-m characters and then insert after html body tag the buffer's URL, appropriately html-tagged." (switch-to-buffer (current-buffer)) ;; remove all instances of ^M (found in MS-created files). (goto-char 0) (perform-replace " " "" nil nil nil t nil nil nil) (let ((case-fold-search t)) ;case-insensitive search (goto-char 0) ;go to top of buffer (re-search-forward "<[\t\n ]*BODY[^>]*>" nil t) ) ;insert URL into page (insert "\n\n

From: " url "\n

\n\n")) ========================================================= hth, ken