magnars / smart-forward.el

semantic navigation based on expand-region.el
31 stars 4 forks source link

infinite loop in smart-forward #6

Open baerrach opened 5 years ago

baerrach commented 5 years ago

I've run smart-forward in my buffer trying to grab the region

  it(`Splitting diagrams`, async () => {
    const code = `
\`\`\`plantuml
@startuml
:actor1: --> (Usecase1)
newpage
:actor2: --> (Usecase2)
@enduml
\`\`\`
`

    await testRemarkPlugin.testPlugin({
      code,
    })
  })

(er/expand-region 1) continually gets called until it hits (point-min) and then gets locked in an infinite loop.

My emacs-fu isn't sufficient to use edebug and understand what is going on.

I suspect the problem is in smart--only-letters-in-region.

If I change this part of the code const code ... then these are the results:

Works

Remove @startuml/@enduml

    const code = `
\`\`\`plantuml
\`\`\`
`

Remove ```...```

    const code = `
`

Leave only newlines

const code = `

`

Fails

Only contains newlines and a

    const code = `
a
`