[oe-commits] [bitbake] 03/13: bitbake: contrib/vim: More Python indenting; move indent file to correct directory

git at git.openembedded.org git at git.openembedded.org
Wed Oct 23 22:00:07 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit a24cd11d17790087f1e3b3f9ca64c39754b16e5c
Author: Chris Laplante via bitbake-devel <bitbake-devel at lists.openembedded.org>
AuthorDate: Thu Oct 17 12:36:49 2019 -0400

    bitbake: contrib/vim: More Python indenting; move indent file to correct directory
    
    Signed-off-by: Chris Laplante <chris.laplante at agilent.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 bitbake/contrib/vim/{ => indent}/bitbake.vim | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/bitbake/contrib/vim/bitbake.vim b/bitbake/contrib/vim/indent/bitbake.vim
similarity index 91%
rename from bitbake/contrib/vim/bitbake.vim
rename to bitbake/contrib/vim/indent/bitbake.vim
index ff86c19..1c35cb3 100644
--- a/bitbake/contrib/vim/bitbake.vim
+++ b/bitbake/contrib/vim/indent/bitbake.vim
@@ -79,6 +79,8 @@ function GetPythonIndent(lnum)
             \ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
             \ searchpair_stopline, searchpair_timeout)
     if parlnum > 0
+      " We may have found the opening brace of a BitBake Python task, e.g. 'python do_task {'
+      " If so, ignore it here - it will be handled later.
       if s:is_python_func_def(parlnum)
         let parlnum = 0
         let plindent = indent(plnum)
@@ -105,6 +107,13 @@ function GetPythonIndent(lnum)
             \ searchpair_stopline, searchpair_timeout)
     if p > 0
         if s:is_python_func_def(p)
+          " Handle the user actually trying to close a BitBake Python task
+          let line = getline(a:lnum)
+          if line =~ '^\s*}'
+              return -2
+          endif
+
+          " Otherwise ignore the brace
           let p = 0
         else
           if p == plnum
@@ -231,15 +240,27 @@ let b:did_indent = 1
 
 
 function BitbakeIndent(lnum)
+    if !has('syntax_items')
+        return -1
+    endif
+
     let stack = synstack(a:lnum, col("."))
     if len(stack) == 0
         return -1
     endif
 
     let name = synIDattr(stack[0], "name")
+    "echo name
 
     if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1
         let ret = GetPythonIndent(a:lnum)
+        " Should always be indented by at least one shiftwidth; but allow
+        " return of -1 (defer to autoindent) or -2 (force indent to 0)
+        if ret == 0
+            return shiftwidth()
+        elseif ret == -2
+            return 0
+        endif
         return ret
     endif
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list