Mercurial > vim
comparison src/fileio.c @ 10668:6a252c6afd5b v8.0.0224
patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
commit https://github.com/vim/vim/commit/7a2699e868bca781e26b060a44fc714d87cfa4ba
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jan 23 21:31:09 2017 +0100
patch 8.0.0224: change to 'fileformats' from autocmd does not take effect
Problem: When 'fileformats' is changed in a BufReadPre auto command, it
does not take effect in readfile(). (Gary Johnson)
Solution: Check the value of 'fileformats' after executing auto commands.
(Christian Brabandt)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 23 Jan 2017 21:45:04 +0100 |
parents | 01a5f64a7a20 |
children | d6857a8dc07e |
comparison
equal
deleted
inserted
replaced
10667:f458238fe289 | 10668:6a252c6afd5b |
---|---|
272 linenr_T skip_count = 0; | 272 linenr_T skip_count = 0; |
273 linenr_T read_count = 0; | 273 linenr_T read_count = 0; |
274 int msg_save = msg_scroll; | 274 int msg_save = msg_scroll; |
275 linenr_T read_no_eol_lnum = 0; /* non-zero lnum when last line of | 275 linenr_T read_no_eol_lnum = 0; /* non-zero lnum when last line of |
276 * last read was missing the eol */ | 276 * last read was missing the eol */ |
277 int try_mac = (vim_strchr(p_ffs, 'm') != NULL); | 277 int try_mac; |
278 int try_dos = (vim_strchr(p_ffs, 'd') != NULL); | 278 int try_dos; |
279 int try_unix = (vim_strchr(p_ffs, 'x') != NULL); | 279 int try_unix; |
280 int file_rewind = FALSE; | 280 int file_rewind = FALSE; |
281 #ifdef FEAT_MBYTE | 281 #ifdef FEAT_MBYTE |
282 int can_retry; | 282 int can_retry; |
283 linenr_T conv_error = 0; /* line nr with conversion error */ | 283 linenr_T conv_error = 0; /* line nr with conversion error */ |
284 linenr_T illegal_byte = 0; /* line nr with illegal byte */ | 284 linenr_T illegal_byte = 0; /* line nr with illegal byte */ |
736 * Set '[ mark to the line above where the lines go (line 1 if zero). | 736 * Set '[ mark to the line above where the lines go (line 1 if zero). |
737 */ | 737 */ |
738 curbuf->b_op_start.lnum = ((from == 0) ? 1 : from); | 738 curbuf->b_op_start.lnum = ((from == 0) ? 1 : from); |
739 curbuf->b_op_start.col = 0; | 739 curbuf->b_op_start.col = 0; |
740 | 740 |
741 try_mac = (vim_strchr(p_ffs, 'm') != NULL); | |
742 try_dos = (vim_strchr(p_ffs, 'd') != NULL); | |
743 try_unix = (vim_strchr(p_ffs, 'x') != NULL); | |
744 | |
741 #ifdef FEAT_AUTOCMD | 745 #ifdef FEAT_AUTOCMD |
742 if (!read_buffer) | 746 if (!read_buffer) |
743 { | 747 { |
744 int m = msg_scroll; | 748 int m = msg_scroll; |
745 int n = msg_scrolled; | 749 int n = msg_scrolled; |
767 apply_autocmds_exarg(EVENT_BUFREADPRE, NULL, sfname, | 771 apply_autocmds_exarg(EVENT_BUFREADPRE, NULL, sfname, |
768 FALSE, curbuf, eap); | 772 FALSE, curbuf, eap); |
769 else | 773 else |
770 apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname, | 774 apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname, |
771 FALSE, NULL, eap); | 775 FALSE, NULL, eap); |
776 /* autocommands may have changed it */ | |
777 try_mac = (vim_strchr(p_ffs, 'm') != NULL); | |
778 try_dos = (vim_strchr(p_ffs, 'd') != NULL); | |
779 try_unix = (vim_strchr(p_ffs, 'x') != NULL); | |
780 | |
772 if (msg_scrolled == n) | 781 if (msg_scrolled == n) |
773 msg_scroll = m; | 782 msg_scroll = m; |
774 | 783 |
775 #ifdef FEAT_EVAL | 784 #ifdef FEAT_EVAL |
776 if (aborting()) /* autocmds may abort script processing */ | 785 if (aborting()) /* autocmds may abort script processing */ |