Mercurial > vim
comparison src/vim9script.c @ 28139:f34afadbef47 v8.2.4594
patch 8.2.4594: need to write script to a file to be able to source them
Commit: https://github.com/vim/vim/commit/36a5b6867bb6c0bd69c8da7d788000ab8a0b0ab0
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Mar 19 12:56:51 2022 +0000
patch 8.2.4594: need to write script to a file to be able to source them
Problem: Need to write script to a file to be able to source them.
Solution: Make ":source" use lines from the current buffer. (Yegappan
Lakshmanan et al., closes #9967)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Mar 2022 14:00:03 +0100 |
parents | 1012048eed26 |
children | b0b712d48225 |
comparison
equal
deleted
inserted
replaced
28138:d14809743aa0 | 28139:f34afadbef47 |
---|---|
69 int sid = current_sctx.sc_sid; | 69 int sid = current_sctx.sc_sid; |
70 scriptitem_T *si; | 70 scriptitem_T *si; |
71 int found_noclear = FALSE; | 71 int found_noclear = FALSE; |
72 char_u *p; | 72 char_u *p; |
73 | 73 |
74 if (!getline_equal(eap->getline, eap->cookie, getsourceline)) | 74 if (!sourcing_a_script(eap)) |
75 { | 75 { |
76 emsg(_(e_vim9script_can_only_be_used_in_script)); | 76 emsg(_(e_vim9script_can_only_be_used_in_script)); |
77 return; | 77 return; |
78 } | 78 } |
79 | 79 |
631 ex_import(exarg_T *eap) | 631 ex_import(exarg_T *eap) |
632 { | 632 { |
633 char_u *cmd_end; | 633 char_u *cmd_end; |
634 evalarg_T evalarg; | 634 evalarg_T evalarg; |
635 | 635 |
636 if (!getline_equal(eap->getline, eap->cookie, getsourceline)) | 636 if (!sourcing_a_script(eap)) |
637 { | 637 { |
638 emsg(_(e_import_can_only_be_used_in_script)); | 638 emsg(_(e_import_can_only_be_used_in_script)); |
639 return; | 639 return; |
640 } | 640 } |
641 fill_evalarg_from_eap(&evalarg, eap, eap->skip); | 641 fill_evalarg_from_eap(&evalarg, eap, eap->skip); |