Skip to content

Commit afa88b7

Browse files
authored
Merge pull request #271 from vim-denops/remove-foldmethod
👍 remove unnecessary 'foldmethod' changes
2 parents 2ac1b5a + c14d65b commit afa88b7

File tree

2 files changed

+182
-94
lines changed

2 files changed

+182
-94
lines changed

buffer/buffer.ts

+5-16
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,16 @@ async function ensurePrerequisites(denops: Denops): Promise<string> {
5757
function! DenopsStdBufferAppend_${suffix}(bufnr, lnum, repl) abort
5858
let modified = getbufvar(a:bufnr, '&modified')
5959
let modifiable = getbufvar(a:bufnr, '&modifiable')
60-
let foldmethod = getbufvar(a:bufnr, '&foldmethod')
6160
call setbufvar(a:bufnr, '&modifiable', 1)
62-
call setbufvar(a:bufnr, '&foldmethod', 'manual')
6361
call appendbufline(a:bufnr, a:lnum, a:repl)
6462
call setbufvar(a:bufnr, '&modified', modified)
6563
call setbufvar(a:bufnr, '&modifiable', modifiable)
66-
call setbufvar(a:bufnr, '&foldmethod', foldmethod)
6764
endfunction
6865
6966
function! DenopsStdBufferReplace_${suffix}(bufnr, repl, fileformat, fileencoding) abort
7067
let modified = getbufvar(a:bufnr, '&modified')
7168
let modifiable = getbufvar(a:bufnr, '&modifiable')
72-
let foldmethod = getbufvar(a:bufnr, '&foldmethod')
7369
call setbufvar(a:bufnr, '&modifiable', 1)
74-
call setbufvar(a:bufnr, '&foldmethod', 'manual')
7570
if a:fileformat isnot# v:null
7671
call setbufvar(a:bufnr, '&fileformat', a:fileformat)
7772
endif
@@ -82,7 +77,6 @@ async function ensurePrerequisites(denops: Denops): Promise<string> {
8277
call deletebufline(a:bufnr, len(a:repl) + 1, '$')
8378
call setbufvar(a:bufnr, '&modified', modified)
8479
call setbufvar(a:bufnr, '&modifiable', modifiable)
85-
call setbufvar(a:bufnr, '&foldmethod', foldmethod)
8680
endfunction
8781
8882
function! DenopsStdBufferConcreteRestore_${suffix}() abort
@@ -321,7 +315,7 @@ export interface DecodeResult {
321315
* }
322316
* ```
323317
*
324-
* It temporary change `modified`, `modifiable`, and `foldmethod` options to append
318+
* It temporary change `modified` and `modifiable` options to append
325319
* the content of the `buffer` buffer without unmodifiable error or so on.
326320
*/
327321
export async function append(
@@ -361,8 +355,8 @@ export interface AppendOptions {
361355
* }
362356
* ```
363357
*
364-
* It temporary change `modified`, `modifiable`, and `foldmethod` options to
365-
* replace the content of the `buffer` buffer without unmodifiable error or so on.
358+
* It temporary change `modified` and `modifiable` options to replace
359+
* the content of the `buffer` buffer without unmodifiable error or so on.
366360
*/
367361
export async function replace(
368362
denops: Denops,
@@ -518,25 +512,20 @@ export async function modifiable<T>(
518512
bufnr: number,
519513
executor: () => T,
520514
): Promise<T> {
521-
const [modified, modifiable, foldmethod] = await batch.collect(
515+
const [modified, modifiable] = await batch.collect(
522516
denops,
523517
(denops) => [
524518
op.modified.getBuffer(denops, bufnr),
525519
op.modifiable.getBuffer(denops, bufnr),
526-
op.foldmethod.getBuffer(denops, bufnr),
527520
],
528521
);
529-
await batch.batch(denops, async (denops) => {
530-
await fn.setbufvar(denops, bufnr, "&modifiable", 1);
531-
await fn.setbufvar(denops, bufnr, "&foldmethod", "manual");
532-
});
522+
await fn.setbufvar(denops, bufnr, "&modifiable", 1);
533523
try {
534524
return await executor();
535525
} finally {
536526
await batch.batch(denops, async (denops) => {
537527
await fn.setbufvar(denops, bufnr, "&modified", modified);
538528
await fn.setbufvar(denops, bufnr, "&modifiable", modifiable);
539-
await fn.setbufvar(denops, bufnr, "&foldmethod", foldmethod);
540529
});
541530
}
542531
}

0 commit comments

Comments
 (0)