From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.help Subject: Re: Help with PHP setup Date: Mon, 23 Jul 2018 00:53:08 +0900 Message-ID: <9A05B106-B738-44E4-814E-78FD1132D34F@gmail.com> References: <20180720165431792380014@bob.proulx.com> <441C26FC-5F31-4C6E-A201-56FBAC5070D0@gmail.com> <20180720215215494599155@bob.proulx.com> <372A84EC-BB98-4127-9391-02B34085B0E4@gmail.com> <3AEEA85D-D360-4800-8531-E77AD748C712@gmail.com> <978017CF-F2AC-40C0-BC86-8B504872FC8A@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1532274701 18201 195.159.176.226 (22 Jul 2018 15:51:41 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 22 Jul 2018 15:51:41 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 22 17:51:36 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fhGdw-0004YK-1V for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Jul 2018 17:51:32 +0200 Original-Received: from localhost ([::1]:56473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhGg2-00038D-Uh for geh-help-gnu-emacs@m.gmane.org; Sun, 22 Jul 2018 11:53:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhGfd-000388-LZ for help-gnu-emacs@gnu.org; Sun, 22 Jul 2018 11:53:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhGfa-0005vN-Ic for help-gnu-emacs@gnu.org; Sun, 22 Jul 2018 11:53:17 -0400 Original-Received: from mail-pl0-x235.google.com ([2607:f8b0:400e:c01::235]:37384) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhGfa-0005ub-CT for help-gnu-emacs@gnu.org; Sun, 22 Jul 2018 11:53:14 -0400 Original-Received: by mail-pl0-x235.google.com with SMTP id 31-v6so7189434plc.4 for ; Sun, 22 Jul 2018 08:53:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=hRwxZSlLzsydDVjCp4FKHFhohGZXIFwqePrRXJA2/ik=; b=fiLOj7w35nLECn/zfq1eeYZCiPldTbBKQB5uNc8fN5jq2coRK8j5yW+reGKZS+DSOr OQdeSaj1xSH/VSxGeNayBk+N5o4p77JObYFos9M/9kuqY6PeOeeW0t0cHEgNJbkhTjsF weujEwaFC0Aud2dl/+YNIoBsQ84GVC7zsSMDujH+I5m+IXqOu6hcA2EFsArcYrNG+vHS nrQMkvf/3CXW4ojTBUyY6E/F3Xhxw0+bciQyw9PavUu0hYGQOVW5EhaPiIw4Wm1VcMi0 Ev7p+tpdg8QM34NgBR9nqQVUFeJzjfgyck3/1sRGFZ0wrQyaEhaCtqcaKJ/s5IuQQYWp 8P0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=hRwxZSlLzsydDVjCp4FKHFhohGZXIFwqePrRXJA2/ik=; b=E5KGN65LR0x7BPFkZc08jFksS2A6cc4T0mJnkc/6WucHpDNNbJbz/15gcT0b2HG3Q0 bl2Zyqa009gxf8qCgTCwMn+fEgQJMfS6sT3V9n08DJOB4TdKuQFsL/FyNXkEVOqOiwek QYUWoVVtpRNQzkxFUyiXtqpxX27JmSPdFw4hjXAeORzaWpKrT31XcNwejoEG8PN00sEf /hpt7gbB0A7BazVHyesG+chik/GnseAW7EY95U4ajST1i63BkWX0IV/G8SL1qOuKlATO 27ZTCSi4O1yyJfZVlzzb7o55V/hELiwJahthst81A1O2SFoQUNDQD5t/+3T36WDoZ+pz 5LPw== X-Gm-Message-State: AOUpUlFnL6QAEPUub9oXIsRr376AvcTHHyAj/GYssQ0XiXHBlqhpckz0 tj+mnhJpsKL1H7CjaqebeEWqYogm X-Google-Smtp-Source: AAOMgpd0iPqp4XErHbWxtzOdHoCLi3NlOx8Vl5QOFJZbeG3MQ61DDegahcga96ZQEWRBj+iq0CSDRQ== X-Received: by 2002:a17:902:a24:: with SMTP id 33-v6mr9501963plo.88.1532274792909; Sun, 22 Jul 2018 08:53:12 -0700 (PDT) Original-Received: from [192.168.1.7] (pl36180.ag0304.nttpc.ne.jp. [133.232.212.84]) by smtp.gmail.com with ESMTPSA id e16-v6sm8964911pfn.46.2018.07.22.08.53.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 08:53:11 -0700 (PDT) In-Reply-To: <978017CF-F2AC-40C0-BC86-8B504872FC8A@gmail.com> X-Mailer: Apple Mail (2.3445.9.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:117554 Archived-At: > On Jul 23, 2018, at 0:44, Jean-Christophe Helary = wrote: >=20 >> On Jul 23, 2018, at 0:36, Noam Postavsky wrote: >>=20 >> On 22 July 2018 at 11:20, Jean-Christophe Helary = wrote: >>=20 >>> (setq myTestCommand (concat "open " myServerRoot myFile)) ;; this = "open " command only works on macOS... I don't know equivalents on = Linux. >>=20 >> By the way, xdg-open is approximately equivalent on many GNU/Linux >> distros; you might also consider using Emacs' >> browse-url-default-browser function, which tries looking for other >> browsers if the former fails. >=20 > Nice hint :) Thank you ! So, I guess I have something working for my case now: (defun myLocalhostTest () "saves and opens the file opened in the current buffer into localhost" (interactive) (global-set-key (kbd "s-r") 'myLocalhostTest) (save-excursion (save-buffer) (setq myLocalRoot "/Applications/MAMP/htdocs/") (setq myServerRoot "http://localhost:8888/") (setq myFile (substring (buffer-file-name) (length myLocalRoot))) ;; the 2 lines below are useful for some WP files, but I'm not sure = yet how the whole thing works (if (equal (car (cdr (split-string myFile "/"))) "wp-content") (setq myFile (concat (car (split-string myFile "/")) "/" = (file-name-nondirectory (buffer-file-name))))) ;; end of the WP special case (setq myURL (concat myServerRoot myFile)) (browse-url-default-browser myURL))) That works for all the php/html files I have, at least those that are in = similar relative position vs the localhost root. I'm sure there are better ways to achieve a similar result, but that's = good enough for now :) Thank you all. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune