comparison src/buffer.c @ 717:2fa8cb05b861 v7.0218

updated for version 7.0218
author vimboss
date Wed, 08 Mar 2006 21:32:40 +0000
parents ef3b59af4207
children d0d7131a797e
comparison
equal deleted inserted replaced
716:8ae24f338cab 717:2fa8cb05b861
249 aco_save_T aco; 249 aco_save_T aco;
250 250
251 /* Go to the buffer that was opened. */ 251 /* Go to the buffer that was opened. */
252 aucmd_prepbuf(&aco, old_curbuf); 252 aucmd_prepbuf(&aco, old_curbuf);
253 #endif 253 #endif
254 do_modelines(FALSE); 254 do_modelines(0);
255 curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED); 255 curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED);
256 256
257 #ifdef FEAT_AUTOCMD 257 #ifdef FEAT_AUTOCMD
258 # ifdef FEAT_EVAL 258 # ifdef FEAT_EVAL
259 apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf, 259 apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf,
745 /* User selected Recover at ATTENTION prompt. */ 745 /* User selected Recover at ATTENTION prompt. */
746 msg_scroll = TRUE; 746 msg_scroll = TRUE;
747 ml_recover(); 747 ml_recover();
748 MSG_PUTS("\n"); /* don't overwrite the last message */ 748 MSG_PUTS("\n"); /* don't overwrite the last message */
749 cmdline_row = msg_row; 749 cmdline_row = msg_row;
750 do_modelines(FALSE); 750 do_modelines(0);
751 751
752 # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL) 752 # if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
753 /* Restore the error/interrupt/exception state if not discarded by a 753 /* Restore the error/interrupt/exception state if not discarded by a
754 * new aborting error, interrupt, or uncaught exception. */ 754 * new aborting error, interrupt, or uncaught exception. */
755 leave_cleanup(&cs); 755 leave_cleanup(&cs);
4630 } 4630 }
4631 # endif /* FEAT_LISTCMDS */ 4631 # endif /* FEAT_LISTCMDS */
4632 4632
4633 #endif /* FEAT_WINDOWS */ 4633 #endif /* FEAT_WINDOWS */
4634 4634
4635 static int chk_modeline __ARGS((linenr_T, int));
4636
4635 /* 4637 /*
4636 * do_modelines() - process mode lines for the current file 4638 * do_modelines() - process mode lines for the current file
4637 * 4639 *
4640 * "flags" can be:
4641 * OPT_WINONLY only set options local to window
4642 * OPT_NOWIN don't set options local to window
4643 *
4638 * Returns immediately if the "ml" option isn't set. 4644 * Returns immediately if the "ml" option isn't set.
4639 */ 4645 */
4640 static int chk_modeline __ARGS((linenr_T, int));
4641
4642 void 4646 void
4643 do_modelines(win_only) 4647 do_modelines(flags)
4644 int win_only; /* Only do window-local options. */ 4648 int flags;
4645 { 4649 {
4646 linenr_T lnum; 4650 linenr_T lnum;
4647 int nmlines; 4651 int nmlines;
4648 static int entered = 0; 4652 static int entered = 0;
4649 4653
4656 return; 4660 return;
4657 4661
4658 ++entered; 4662 ++entered;
4659 for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count && lnum <= nmlines; 4663 for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count && lnum <= nmlines;
4660 ++lnum) 4664 ++lnum)
4661 if (chk_modeline(lnum, win_only) == FAIL) 4665 if (chk_modeline(lnum, flags) == FAIL)
4662 nmlines = 0; 4666 nmlines = 0;
4663 4667
4664 for (lnum = curbuf->b_ml.ml_line_count; lnum > 0 && lnum > nmlines 4668 for (lnum = curbuf->b_ml.ml_line_count; lnum > 0 && lnum > nmlines
4665 && lnum > curbuf->b_ml.ml_line_count - nmlines; --lnum) 4669 && lnum > curbuf->b_ml.ml_line_count - nmlines; --lnum)
4666 if (chk_modeline(lnum, win_only) == FAIL) 4670 if (chk_modeline(lnum, flags) == FAIL)
4667 nmlines = 0; 4671 nmlines = 0;
4668 --entered; 4672 --entered;
4669 } 4673 }
4670 4674
4671 #include "version.h" /* for version number */ 4675 #include "version.h" /* for version number */
4673 /* 4677 /*
4674 * chk_modeline() - check a single line for a mode string 4678 * chk_modeline() - check a single line for a mode string
4675 * Return FAIL if an error encountered. 4679 * Return FAIL if an error encountered.
4676 */ 4680 */
4677 static int 4681 static int
4678 chk_modeline(lnum, win_only) 4682 chk_modeline(lnum, flags)
4679 linenr_T lnum; 4683 linenr_T lnum;
4680 int win_only; /* Only do window-local options. */ 4684 int flags; /* Same as for do_modelines(). */
4681 { 4685 {
4682 char_u *s; 4686 char_u *s;
4683 char_u *e; 4687 char_u *e;
4684 char_u *linecopy; /* local copy of any modeline found */ 4688 char_u *linecopy; /* local copy of any modeline found */
4685 int prev; 4689 int prev;
4772 { 4776 {
4773 #ifdef FEAT_EVAL 4777 #ifdef FEAT_EVAL
4774 save_SID = current_SID; 4778 save_SID = current_SID;
4775 current_SID = SID_MODELINE; 4779 current_SID = SID_MODELINE;
4776 #endif 4780 #endif
4777 retval = do_set(s, OPT_MODELINE | OPT_LOCAL 4781 retval = do_set(s, OPT_MODELINE | OPT_LOCAL | flags);
4778 | (win_only ? OPT_WINONLY : 0));
4779 #ifdef FEAT_EVAL 4782 #ifdef FEAT_EVAL
4780 current_SID = save_SID; 4783 current_SID = save_SID;
4781 #endif 4784 #endif
4782 if (retval == FAIL) /* stop if error found */ 4785 if (retval == FAIL) /* stop if error found */
4783 break; 4786 break;