[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with PHP setup
From: |
Jean-Christophe Helary |
Subject: |
Re: Help with PHP setup |
Date: |
Mon, 23 Jul 2018 00:20:47 +0900 |
> On Jul 22, 2018, at 22:56, Jean-Christophe Helary <brandelune@gmail.com>
> wrote:
>
> On macOS it seems the "open " command targets the same tab so I don't seem to
> have to be worried about that:
>
> (defun myLocalhostTest ()
> "saves and opens the file opened in the current buffer into localhost"
> (interactive)
> (save-excursion
> (save-buffer)
> (setq myRoot "http://localhost:8888/ <http://localhost:8888/>")
> (setq myFile (file-name-nondirectory (buffer-file-name)))
> (setq myTestCommand (concat "open " myRoot myFile))
> (shell-command myTestCommand)))
>
> The above trivial code needs improvements to handle cases where the file is
> not at the root of localhost, but that can wait for now :)
I found a way to update the output for "normal" php files but as I work on a
WordPress site where final urls do not reflect the local file path I'm finding
that my "trick" doesn't work:
(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)))
(setq myTestCommand (concat "open " myServerRoot myFile)) ;; this "open "
command only works on macOS... I don't know equivalents on Linux.
(shell-command myTestCommand)))
Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune
- Re: Help with PHP setup, (continued)
Re: Help with PHP setup, Bob Proulx, 2018/07/20
- Re: Help with PHP setup, Jean-Christophe Helary, 2018/07/20
- Re: Help with PHP setup, Bob Proulx, 2018/07/20
- Re: Help with PHP setup, Jean-Christophe Helary, 2018/07/21
- Re: Help with PHP setup, Jean-Christophe Helary, 2018/07/22
- Re: Help with PHP setup,
Jean-Christophe Helary <=
- Re: Help with PHP setup, Noam Postavsky, 2018/07/22
- Re: Help with PHP setup, Jean-Christophe Helary, 2018/07/22
- Re: Help with PHP setup, Jean-Christophe Helary, 2018/07/22
Message not available