Version: 2.0.4svn (using 3.5.10, Debian Package 4:3.5.10.dfsg.1-0lenny1 (lenny/sid)) Compiler: Target: i486-linux-gnu OS: Linux (i686) release 2.6.26-1-686 Taken from: https://sourceforge.net/forum/forum.php?thread_id=1942464&forum_id=292014 About one year ago, I started this thread on piping text with Kile, and submitted a patch to address this missing feature. All I wanted was to automatically reformat a paragraph: * inserting linebreaks in lines with more than 79 characters, * joining lines with less than 79 characters, but part of the same paragraph The UNIX commands that easily does it is fmt. Just pipe a text through it. Similar and very useful funcions are so simple to do invoke in vim, Emacs, even Kate! vim: select a paragraph, and press {g}+{q}. Or run :%! fmt Kate: enable the Kate TextFilter plugin, select a paragraph, press {ctrl}+{\}, and filter the text through fmt. Emacs: {meta}+{q} However, this is not possible to do in Kile. It's very tiresome to reformat paragraphs manually (BTW, does Kile sort text?). The patch I submitted just helps the user to filter a piece of text through fmt, sort, Perl scripts, etc, thus reformating paragraphs just like in Kate, vim and Emacs. To tell the truth, it has always been possible to emulate text piping in Kile, using the official Kile/DCOP interface. It is a bit tricky, but it is possible anyway. However, when *more than one tab are open* in Kile, things get very complicated. The reason is that is hard to guess, from within the DCOP interface, *which open tab is the active document*. That's why my unharmful patch is needed. It makes available an internal variable to the DCOP interface that denotes which tab is the active one. Using this variable, it is a matter of course to insert whatever you want, and wherever you want into the active document. The patch was not added to the official Kile, because it relies on the DCOP interface, instead of D-BUS. But the DCOP interface is still present in the official Kile 2.0.3, and this version still ships with a kile_remote_control.txt file, a simple manual that teaches the user how to use the very Kile/DCOP interface. So why wasn't the patch incorporated? I think developers just forgot to. In account of this one single tiny missing feature, I was forced to give up Kile, and vim has since then made lazy about finding a solution. It would be OK, were not the fact that at least one Kile user emails me *every month* asking whether I came up with a better solution. I am always sorry to say no, and I send my patch to them, and a script to automate the pipe line. It seems that this has been a required feature since 2004. See https://bugs.kde.org/show_bug.cgi?id=88796 https://bugs.kde.org/show_bug.cgi?id=89568 https://sourceforge.net/forum/forum.php?thread_id=1824819&forum_id=292014 In sum, the reason I'm posting this message is to let users know that, in account of such demands, I rewrote the patch and wrote a Bash script to automate piping in Kile, even though I am no longer a Kile user, much less a Kile developer. The patch is much simpler now, and the accompanying script much better. The patch against 2.0.3, the kilepipe script, and an already patched Kile Debian package are found in the ``hacks'' section of my homepage. http://phi.pro.br/hacks Usage examples: * Select a piece of text and run $ kilepipe perl myscript.pl $ kilepipe fmt $ kilepipe sort * And the selected text is replaced with the output from perl, fmt, sort, etc. The DCOP interface is slow, and the KTextEditor/DCOP interface is inconsistent sometimes. I will not maintain, and develop the script and the patch. There are bugs, but I hope another user may voluntarily accept the task. So use this tool with care, and continue to ask developers for these features: 1) We want to pipe to stdout and to read from stdin 2) We want to automatically reformat paragraphs
I had a look on this issue for kde4. And the current patch is not suitable for kile because it uses the internal Kate::Document instead of the more generic KTextEditor::Document. And in this way we would expose the private Kate::Document interface to the outside world. My suggestion is to add the following two DBUS calls which should help to solve this problem: QString getSelectedText(); // get the currently selected text in kile QString replaceSelectedText(QString); // get the currently selected text in kile and replace it with the returned string The cleanest solution would be to not fiddle at all with kile, but to write an KTextEditor plugin which is similiar to the Kate plugin "Kate TextFilter".
This enhancement request is "old". Is there a work-around?
Thank you for the bug report. As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists. If this bug is no longer persisting or relevant please change the status to resolved.