Results 1 to 7 of 7

Thread: KATE - multiples files in one instance - unexpected behavior when called from shell script

  1. #1
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,024

    Default KATE - multiples files in one instance - unexpected behavior when called from shell script

    Hello.

    I am calling kate from a shell script (saying : edit_files_of_the_day.sh ) for editing some kind of files in the same windows.
    The script was running fine until opensuse 10.3.

    Something like :

    Code:
    cd /my_dir1/my_dir2
    
    for afile in  paul.txt pierre.txt jean*.txt ;  do
        kate -u $afile
    done
    
    cd /my_dir1/my_dir4
    
    for afile in  manchester.txt Italy* ;  do
      if [ -d "$afile" ]; then
    	echo "$afile is a directory. Nothing to do"
      elif [ -f "$afile" ]; then
           kate -u $afile
      else
    	echo "$afile does not exist or is a special file. Nothing to do"
      fi
    done

    For 11.1, I had to modify the script by adding the following at the beginning of the shell.
    ( see also & at the end )

    Code:
    kate -u /my_data/dummy_file &
    and /my_data/dummy_file must exists otherwise kate stop loading files after the first one; waiting I close it for opening the next one and so on.

    Don't ask me why it was working.

    Now I am running 12.14.
    The script is working only once.
    After that it stop loading with these errors :

    linux:~/bin # ./edit_files_of_the_day.sh
    kate(9769) KXMLGUI::ActionList:lug: Index 16 is not within range (0 - 14
    kate(9790) KXMLGUI::ActionList:lug: Index 16 is not within range (0 - 14
    linux:~/bin #
    How could I call kate within for loop ?

    kate-4.7.2-2.1.2.x86_64
    KDE : Revision KDE 4.7 (2011-09-04)
    Thanks for helping. JCD
    __________

    server leap 15-- ASUS g75vw KDE leap 42.3 -- ASUS g750JZ KDE leap 42.3 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: KATE - multiples files in one instance - unexpected behavior when called from shell script

    Quote Originally Posted by jcdole View Post
    Hello.

    I am calling kate from a shell script (saying : edit_files_of_the_day.sh ) for editing some kind of files in the same windows.
    The script was running fine until opensuse 10.3.

    Something like :

    Code:
    cd /my_dir1/my_dir2
    
    for afile in  paul.txt pierre.txt jean*.txt ;  do
        kate -u $afile
    done
    
    cd /my_dir1/my_dir4
    
    for afile in  manchester.txt Italy* ;  do
      if [ -d "$afile" ]; then
        echo "$afile is a directory. Nothing to do"
      elif [ -f "$afile" ]; then
           kate -u $afile
      else
        echo "$afile does not exist or is a special file. Nothing to do"
      fi
    done

    For 11.1, I had to modify the script by adding the following at the beginning of the shell.
    ( see also & at the end )

    Code:
    kate -u /my_data/dummy_file &
    and /my_data/dummy_file must exists otherwise kate stop loading files after the first one; waiting I close it for opening the next one and so on.

    Don't ask me why it was working.

    Now I am running 12.14.
    The script is working only once.
    After that it stop loading with these errors :



    How could I call kate within for loop ?

    kate-4.7.2-2.1.2.x86_64
    KDE : Revision KDE 4.7 (2011-09-04)
    So a command like "kate -u /my_data/dummy_file &", will put that command running into the background (due to the & at the end). Loading Kate in a for/do/done loop would attempt to load all matching files up into Kate at the same time. I don't know for sure, but Kate may have a limit of 14 or so loaded text files, while you are trying to load 16 or more. The real question in my mind is why do you need to load so many files at once? I am doing good to edit one file at a time. However, I could not really tell what the end game was on editing so many files at once. I don't normally use Kate, but rather kwrite, but I have several scripts, using kwrite, that can be modified to use kate. Maybe one of these bash scripts will meet your fancy?

    N.S.F. - New Script File, Bash Script File Header Creator - Version 2.81 - Blogs - openSUSE Forums

    SYSEdit - System File Editor - Version 1.00 - Blogs - openSUSE Forums

    fewrup - File Editor With Root or User Permissions - Blogs - openSUSE Forums

    Kate has a home web site, maybe you can find more info there: Kate | Get an Edge in Editing | The Kate Editor Homepage, good luck and tell us if any of this stuff was useful.

    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,645
    Blog Entries
    14

    Default Re: KATE - multiples files in one instance - unexpected behavior when called from shell script

    Nice exercise on scripting but, here's what I do, does not need any scripts which need to be modified for different projects: I use Kate.

    Just open the files (file - open - selections possible).
    Then Sessions - Save As, give session a name.

    Next time: start Kate (it will by default open the last session. If needed select the saved session of you choice. Example: I develop on several websites, hundreds of php files in a session, named after the site. If more files are to be opened in the session, open session, open extra files, save session, files now belong to the session.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  4. #4
    Join Date
    Mar 2009
    Location
    sri mayapur, west bengal, india
    Posts
    958

    Default Re: KATE - multiples files in one instance - unexpected behaviorwhen called from shell script

    On Mon, 30 Apr 2012 00:56:02 +0530, Knurpht
    <Knurpht@no-mx.forums.opensuse.org> wrote:

    >
    > Nice exercise on scripting but, here's what I do, does not need any
    > scripts which need to be modified for different projects: I use Kate.
    >
    > Just open the files (file - open - selections possible).
    > Then Sessions - Save As, give session a name.
    >
    > Next time: start Kate (it will by default open the last session. If
    > needed select the saved session of you choice. Example: I develop on
    > several websites, hundreds of php files in a session, named after the
    > site. If more files are to be opened in the session, open session, open
    > extra files, save session, files now belong to the session.
    >



    already wanted to suggest the same, but then i thought he probably knew
    that already, sine he's using kate with multiple files, and wants to
    determine which files to open depending on some variable: the directory
    he's in, or the server he's on, or whatever.

    don't know his use case, but seems to be too much effort to me, since
    kate's sessions are quick to define and use, and flexible: "kdesu kate"
    for admin. tasks, and remote files via fish:/, per example. all gets saved
    in these sessions, and opened again next time. (i found that opening
    remote files is convenient & quick by dropping them into kate from an open
    konqueror window. otherwise it may take a while until the file dialog
    opens a remote connection.)

    --
    phani.

  5. #5
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,024

    Default Re: KATE - multiples files in one instance - unexpected behaviorwhen called from shell script

    Thank you for all of you.

    But any way , why was it working until 10.3 and not now.

    Now why is it working only once until I reboot..

    Code:
    linux:~/bin # ./logs_read_part0
    kate(9769) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9790) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9792) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9794) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9796) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9798) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9800) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9802) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9804) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9806) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9808) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    kate(9810) KXMLGUI::ActionList::plug: Index  16  is not within range (0 -  14 
    linux:~/bin # 
    I am using this kind of script for opening all samba, ldap config files at once, all logs at ounce, .........

    I am able to load all this files by hand one by one.
    Thanks for helping. JCD
    __________

    server leap 15-- ASUS g75vw KDE leap 42.3 -- ASUS g750JZ KDE leap 42.3 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  6. #6
    Join Date
    Mar 2009
    Location
    sri mayapur, west bengal, india
    Posts
    958

    Default Re: KATE - multiples files in one instance - unexpected behaviorwhen called from shell script

    On Mon, 30 Apr 2012 03:26:03 +0530, jcdole
    <jcdole@no-mx.forums.opensuse.org> wrote:

    >
    > Thank you for all of you.
    >
    > But any way , why was it working until 10.3 and not now.
    >
    > Now why is it working only once until I reboot..
    >
    >
    > Code:
    > --------------------
    > LINUX:~/BIN #[/B] ./LOGS_READ_PART0
    > KATE(9769) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9790) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9792) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9794) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9796) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9798) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9800) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9802) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9804) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9806) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9808) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > KATE(9810) KXMLGUI::ACTIONLIST:LUG: INDEX 16 IS NOT WITHIN RANGE
    > (0 - 14
    > [B]LINUX:~/BIN #
    > --------------------
    >
    >
    > I am using this kind of script for opening all samba, ldap config files
    > at once, all logs at ounce, .........
    >
    > I am able to load all this files by hand one by one.
    >



    i have no idea. perhaps you should ask on the KDE mailing list? i _seem_
    to remember to have seen such a bug in the KDE bug tracker, but it's been
    a while ago, and i don't know for which version of KDE that was, and if it
    was really your problem or not. i came across it while searching for
    another bug and didn't pay much attention.

    --
    phani.

  7. #7
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,024

    Default Re: KATE - multiples files in one instance - unexpected behaviorwhen called from shell script

    Thanks for helping. JCD
    __________

    server leap 15-- ASUS g75vw KDE leap 42.3 -- ASUS g750JZ KDE leap 42.3 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •