khard icon indicating copy to clipboard operation
khard copied to clipboard

Spaces in $EDITOR should separate arguments

Open falsifian opened this issue 3 years ago • 2 comments

I have EDITOR=emacsclient -t, which confuses khard:

falsifian angel-dfly ~ $ echo $EDITOR
emacsclient -t
falsifian angel-dfly ~ $ khard new
Traceback (most recent call last):
  File "/usr/local/bin/khard", line 11, in <module>
    load_entry_point('khard==0.17.0', 'console_scripts', 'khard')()
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 1137, in main
    args.open_editor)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 544, in new_subcommand
    create_new_contact(selected_address_book)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 109, in create_new_contact
    edit(temp_file_name)
  File "/usr/local/lib/python3.7/site-packages/khard/khard.py", line 95, in edit
    child = subprocess.Popen(editor)
  File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'emacsclient -t': 'emacsclient -t'

Other programs seem to handle this. I suggest splitting $EDITOR on spaces.

falsifian avatar Jul 17 '21 16:07 falsifian

As a workaround you can specify the editor in your config file. The format allows you to specify a list so the question of splitting on whitespace is avoided.

For $EDITOR I am unclear what "The Standard" is. I assume there is no proper defined standard and every program just does what they think is right. Or is there some UNIX/Linux (quasi) "standard" that is documented somewhere?

lucc avatar Jun 28 '22 05:06 lucc

Thanks for the response. I was able to work around it. I'm not aware of any standard, but I think khard is the first place I noticed any trouble, which makes me suspect splitting on spaces is common.

(Anyway, I've switched editors and my current editing command doesn't need any extra arguments.)

falsifian avatar Jun 29 '22 06:06 falsifian