Quantcast

MP_EDITOR doesn't work

classic Classic list List threaded Threaded
12 messages Options
db
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MP_EDITOR doesn't work

db
I set MP_EDITOR but it doesn't seem to work on base 2.4.1. VISUAL, second var MP checks according to the guide, does though.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Rainer Müller-4
On 2017-04-04 00:43, db wrote:
> I set MP_EDITOR but it doesn't seem to work on base 2.4.1. VISUAL, second var MP checks according to the guide, does though.

How did you test this? This works fine for me:

$ export MP_EDITOR=less
$ port edit zlib

I also added MP_EDITOR to the man page:
https://github.com/macports/macports-base/commit/9fa3ac3992a5df479cb79fde95c5dc1b94138545

Rainer
db
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

db
On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
> How did you test this? This works fine for me:
> $ export MP_EDITOR=less
> $ port edit zlib

export VISUAL=/opt/local/bin/vim     works
export MP_EDITOR=/opt/local/bin/vim  doesn't
db
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

db
On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
> On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
>> How did you test this? This works fine for me:
>> $ export MP_EDITOR=less
>> $ port edit zlib
> export VISUAL=/opt/local/bin/vim     works
> export MP_EDITOR=/opt/local/bin/vim  doesn't

Could you please try it with an editor?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Rainer Müller-4
On 2017-04-05 21:54, db wrote:
> On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
>> On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
>>> How did you test this? This works fine for me:
>>> $ export MP_EDITOR=less
>>> $ port edit zlib
>> export VISUAL=/opt/local/bin/vim     works
>> export MP_EDITOR=/opt/local/bin/vim  doesn't
>
> Could you please try it with an editor?

It works for me. I cannot reproduce the problem you have.

Rainer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Lenore Horner-2

On Apr 5, 2017, at 16:12, Rainer Müller <[hidden email]> wrote:

On 2017-04-05 21:54, db wrote:
On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
How did you test this? This works fine for me:
$ export MP_EDITOR=less
$ port edit zlib
export VISUAL=/opt/local/bin/vim     works
export MP_EDITOR=/opt/local/bin/vim  doesn't

Could you please try it with an editor?

It works for me. I cannot reproduce the problem you have.

Rainer

For me (MacOS 10.12.3, latest MacPorts, .profile as the relevant file to edit) 
$ export MP_EDITOR=/usr/bin/nano
$ export MP_EDITOR=/usr/bin/edit
to use TextWrangler (yes, I have it installed) fails with “Error: unable to invoke editor /usr/bin/edit: couldn't execute "/usr/bin/edit": no such file or directory”.  I tried 
$ export MP_EDITOR=/Applications/TextWrangler.app
but that fails with “Error: unable to invoke editor /Applications/TextWrangler.app: couldn't execute "/Applications/TextWrangler.app": permission denied” when I do 
$ port edit texlive-xetex 
and puts me in vim if I prepend sudo to the command.  (Oh, never mind.  I forgot I had the app store version and never installed the command line tools. Now 
$ export MP_EDITOR=/usr/local/bin/edit 
works.)  

I haven’t installed any editors through macports so I can’t check the /opt path, but at least stuff in /usr works as expected.  (And thanks to poking at this, I now know two things I didn’t know before I started down this rabbit hole.)
Lenore

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Ryan Schmidt-24

> On Apr 5, 2017, at 16:27, Lenore Horner <[hidden email]> wrote:
>
>
>> On Apr 5, 2017, at 16:12, Rainer Müller <[hidden email]> wrote:
>>
>> On 2017-04-05 21:54, db wrote:
>>> On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
>>>> On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
>>>>> How did you test this? This works fine for me:
>>>>> $ export MP_EDITOR=less
>>>>> $ port edit zlib
>>>> export VISUAL=/opt/local/bin/vim     works
>>>> export MP_EDITOR=/opt/local/bin/vim  doesn't
>>>
>>> Could you please try it with an editor?
>>
>> It works for me. I cannot reproduce the problem you have.
>>
>> Rainer
>
> For me (MacOS 10.12.3, latest MacPorts, .profile as the relevant file to edit)
> $ export MP_EDITOR=/usr/bin/nano
> works.  However, following https://guide.macports.org/chunked/installing.shell.html,
> $ export MP_EDITOR=/usr/bin/edit
> to use TextWrangler (yes, I have it installed) fails with “Error: unable to invoke editor /usr/bin/edit: couldn't execute "/usr/bin/edit": no such file or directory”.  I tried
> $ export MP_EDITOR=/Applications/TextWrangler.app
> but that fails with “Error: unable to invoke editor /Applications/TextWrangler.app: couldn't execute "/Applications/TextWrangler.app": permission denied” when I do
> $ port edit texlive-xetex
> and puts me in vim if I prepend sudo to the command.  (Oh, never mind.  I forgot I had the app store version and never installed the command line tools. Now
> $ export MP_EDITOR=/usr/local/bin/edit
> (note the correction to https://guide.macports.org/chunked/installing.shell.html)
> works.)  
>
> I haven’t installed any editors through macports so I can’t check the /opt path, but at least stuff in /usr works as expected.  (And thanks to poking at this, I now know two things I didn’t know before I started down this rabbit hole.)
>

Did you notice that as of El Capitan, OS X includes a feature called System Integrity Protection which prevents third parties from modifying the contents of system directories, such as /usr/bin, and for that reason the TextWrangler helpers are no longer installed to that location? They're now available inside the TextWrangler application bundle at /Applications/TextWrangler.app/Contents/Helpers/edit.

`edit` also doesn't work like `vi` in its default mode, in that it does not wait for the document to be closed before exiting. This can be confusing for some tools that expect the editor to wait. On my system, I define the EDITOR variable like this in my bash startup script:


export EDITOR=editor.sh


And then editor.sh is a short shell script in a directory in my PATH which contains:


#!/bin/sh
/Applications/TextWrangler.app/Contents/Helpers/edit +1 --wait --resume "$@"


This tells TextWrangler to open, select the first line of the file, wait until the file is closed before exiting, and when exiting, return to the program that caused TextWrangler to open (e.g. Terminal).


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Lenore Horner-2

> On Apr 5, 2017, at 20:35, Ryan Schmidt <[hidden email]> wrote:
>
>
>> On Apr 5, 2017, at 16:27, Lenore Horner <[hidden email]> wrote:
>>
>>
>>> On Apr 5, 2017, at 16:12, Rainer Müller <[hidden email]> wrote:
>>>
>>> On 2017-04-05 21:54, db wrote:
>>>> On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
>>>>> On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
>>>>>> How did you test this? This works fine for me:
>>>>>> $ export MP_EDITOR=less
>>>>>> $ port edit zlib
>>>>> export VISUAL=/opt/local/bin/vim     works
>>>>> export MP_EDITOR=/opt/local/bin/vim  doesn't
>>>>
>>>> Could you please try it with an editor?
>>>
>>> It works for me. I cannot reproduce the problem you have.
>>>
>>> Rainer
>>
>> For me (MacOS 10.12.3, latest MacPorts, .profile as the relevant file to edit)
>> $ export MP_EDITOR=/usr/bin/nano
>> works.  However, following https://guide.macports.org/chunked/installing.shell.html,
>> $ export MP_EDITOR=/usr/bin/edit
>> to use TextWrangler (yes, I have it installed) fails with “Error: unable to invoke editor /usr/bin/edit: couldn't execute "/usr/bin/edit": no such file or directory”.  I tried
>> $ export MP_EDITOR=/Applications/TextWrangler.app
>> but that fails with “Error: unable to invoke editor /Applications/TextWrangler.app: couldn't execute "/Applications/TextWrangler.app": permission denied” when I do
>> $ port edit texlive-xetex
>> and puts me in vim if I prepend sudo to the command.  (Oh, never mind.  I forgot I had the app store version and never installed the command line tools. Now
>> $ export MP_EDITOR=/usr/local/bin/edit
>> (note the correction to https://guide.macports.org/chunked/installing.shell.html)
>> works.)  
>>
>> I haven’t installed any editors through macports so I can’t check the /opt path, but at least stuff in /usr works as expected.  (And thanks to poking at this, I now know two things I didn’t know before I started down this rabbit hole.)
>>
>
> Did you notice that as of El Capitan, OS X includes a feature called System Integrity Protection which prevents third parties from modifying the contents of system directories, such as /usr/bin, and for that reason the TextWrangler helpers are no longer installed to that location? They're now available inside the TextWrangler application bundle at /Applications/TextWrangler.app/Contents/Helpers/edit.
>
> `edit` also doesn't work like `vi` in its default mode, in that it does not wait for the document to be closed before exiting. This can be confusing for some tools that expect the editor to wait. On my system, I define the EDITOR variable like this in my bash startup script:
>
>
> export EDITOR=editor.sh
>
>
> And then editor.sh is a short shell script in a directory in my PATH which contains:
>
>
> #!/bin/sh
> /Applications/TextWrangler.app/Contents/Helpers/edit +1 --wait --resume "$@"
>
>
> This tells TextWrangler to open, select the first line of the file, wait until the file is closed before exiting, and when exiting, return to the program that caused TextWrangler to open (e.g. Terminal).
>
>
Curious.  As I noted above, once I grabbed the command-line installer for TextWrangler, then /usr/local/bin/edit worked fine to start TextWrangler.  As far as I can tell, the web page should be corrected to say that the location is /usr/local/bin/edit as I noted above.
Lenore

db
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

db
In reply to this post by Ryan Schmidt-24
On 6 Apr 2017, at 02:35, Ryan Schmidt <[hidden email]> wrote:
> export EDITOR=editor.sh

And does it work with MP_EDITOR? I just tried setting it in a vanilla vm, no dice. I set -dv when editing a portfile, but no related information is being logged.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Ryan Schmidt-24
In reply to this post by Lenore Horner-2

> On Apr 5, 2017, at 20:32, Lenore Horner <[hidden email]> wrote:
>
>
>> On Apr 5, 2017, at 20:35, Ryan Schmidt <[hidden email]> wrote:
>>
>>
>>> On Apr 5, 2017, at 16:27, Lenore Horner <[hidden email]> wrote:
>>>
>>>
>>>> On Apr 5, 2017, at 16:12, Rainer Müller <[hidden email]> wrote:
>>>>
>>>> On 2017-04-05 21:54, db wrote:
>>>>> On 4 Apr 2017, at 11:21, db <[hidden email]> wrote:
>>>>>> On 4 Apr 2017, at 11:18, Rainer Müller <[hidden email]> wrote:
>>>>>>> How did you test this? This works fine for me:
>>>>>>> $ export MP_EDITOR=less
>>>>>>> $ port edit zlib
>>>>>> export VISUAL=/opt/local/bin/vim     works
>>>>>> export MP_EDITOR=/opt/local/bin/vim  doesn't
>>>>>
>>>>> Could you please try it with an editor?
>>>>
>>>> It works for me. I cannot reproduce the problem you have.
>>>>
>>>> Rainer
>>>
>>> For me (MacOS 10.12.3, latest MacPorts, .profile as the relevant file to edit)
>>> $ export MP_EDITOR=/usr/bin/nano
>>> works.  However, following https://guide.macports.org/chunked/installing.shell.html,
>>> $ export MP_EDITOR=/usr/bin/edit
>>> to use TextWrangler (yes, I have it installed) fails with “Error: unable to invoke editor /usr/bin/edit: couldn't execute "/usr/bin/edit": no such file or directory”.  I tried
>>> $ export MP_EDITOR=/Applications/TextWrangler.app
>>> but that fails with “Error: unable to invoke editor /Applications/TextWrangler.app: couldn't execute "/Applications/TextWrangler.app": permission denied” when I do
>>> $ port edit texlive-xetex
>>> and puts me in vim if I prepend sudo to the command.  (Oh, never mind.  I forgot I had the app store version and never installed the command line tools. Now
>>> $ export MP_EDITOR=/usr/local/bin/edit
>>> (note the correction to https://guide.macports.org/chunked/installing.shell.html)
>>> works.)  
>>>
>>> I haven’t installed any editors through macports so I can’t check the /opt path, but at least stuff in /usr works as expected.  (And thanks to poking at this, I now know two things I didn’t know before I started down this rabbit hole.)
>>>
>>
>> Did you notice that as of El Capitan, OS X includes a feature called System Integrity Protection which prevents third parties from modifying the contents of system directories, such as /usr/bin, and for that reason the TextWrangler helpers are no longer installed to that location? They're now available inside the TextWrangler application bundle at /Applications/TextWrangler.app/Contents/Helpers/edit.
>>
>> `edit` also doesn't work like `vi` in its default mode, in that it does not wait for the document to be closed before exiting. This can be confusing for some tools that expect the editor to wait. On my system, I define the EDITOR variable like this in my bash startup script:
>>
>>
>> export EDITOR=editor.sh
>>
>>
>> And then editor.sh is a short shell script in a directory in my PATH which contains:
>>
>>
>> #!/bin/sh
>> /Applications/TextWrangler.app/Contents/Helpers/edit +1 --wait --resume "$@"
>>
>>
>> This tells TextWrangler to open, select the first line of the file, wait until the file is closed before exiting, and when exiting, return to the program that caused TextWrangler to open (e.g. Terminal).
>>
>>
> Curious.  As I noted above, once I grabbed the command-line installer for TextWrangler, then /usr/local/bin/edit worked fine to start TextWrangler.  As far as I can tell, the web page should be corrected to say that the location is /usr/local/bin/edit as I noted above.

I've updated the guide:

https://github.com/macports/macports-guide/commit/25cda8abe5b1f6b1d1fd3b6b137bd4899f5e641e

I changed the instructions to reference BBEdit instead of TextWrangler, because it appears that TextWrangler is being discontinued soon. (Instead, BBEdit can now run for free forever, with limited features that are comparable to those offered in TextWrangler.)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

Joshua Root-8
In reply to this post by db
db wrote:
> On 6 Apr 2017, at 02:35, Ryan Schmidt <ryandesign at macports.org> wrote:
>> export EDITOR=editor.sh
>
> And does it work with MP_EDITOR? I just tried setting it in a vanilla vm, no dice. I set -dv when editing a portfile, but no related information is being logged.

Yes it works with MP_EDITOR, I just checked. You never showed the exact
command you are running; are you using sudo? That will strip all
environment variables that are not listed in env_keep. VISUAL and EDITOR
are there in the default sudoers, but MP_EDITOR is not.

- Josh
db
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MP_EDITOR doesn't work

db
On 6 Apr 2017, at 23:10, Joshua Root <[hidden email]> wrote:
> Yes it works with MP_EDITOR, I just checked. You never showed the exact command you are running; are you using sudo? That will strip all environment variables that are not listed in env_keep. VISUAL and EDITOR are there in the default sudoers, but MP_EDITOR is not.

I do not sudo and I did mention the commands a couple of days ago. In my bash startup file or in any shell

export VISUAL=/opt/local/bin/vim       works
export MP_EDITOR=/opt/local/bin/vim    doesn't work

I could keep using VISUAL without knowing why MP_EDITOR doesn't work in my machines, but it puzzles me.
Loading...