<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>95486</bug_id>
          
          <creation_ts>2004-12-19 22:05:27 +0000</creation_ts>
          <short_desc>Code folding with markers like in gvim or emacs&apos; folding-mode</short_desc>
          <delta_ts>2014-09-13 22:04:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kate</product>
          <component>syntax</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>wishlist</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Christian Kruse">ckruse</reporter>
          <assigned_to name="KWrite Developers">kwrite-bugs-null</assigned_to>
          <cc>trapni</cc>
          
          <cf_commitlink>http://commits.kde.org/ktexteditor/a4b952b32c4a0ee4300df4c2833de5dd81de2cbb</cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>40</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>295876</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-19 22:05:27 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.2.3)
Installed from:    Compiled From Sources

I like folding with markers like it is used in gvim or emacs&apos; folding mode (e.g. /* {{{ fold start */ ... /* }}} */). I don&apos;t know how complicated it is, but it would be _very_ nice (folding on code basis cannot work with complicated source, e.g. function defintions modified by #ifdefs).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>295880</commentid>
    <comment_count>1</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-19 22:22:23 +0000</bug_when>
    <thetext>kate supports region markers like this:
//BEGIN text
//END
We do not support /* }}} */ or something like that.
If your code confuses codefolding because of complicated #ifdefs I&apos;d rather suggest so simplify it, as we will not remove folding for { ... } blocks.

Please tell us if the //BEGIN ... //END region markers is enough for what you need.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>295898</commentid>
    <comment_count>2</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-19 23:49:27 +0000</bug_when>
    <thetext>Yes, I know about //BEGIN and //END. But in large projects than you have /* {{{ */ from people using emacs/vim and //BEGIN //END from people using kate. This is really bugging me. It would _really_ be nice if kate also supports vim-like markers.

Even, simplifying #ifdefs is not possible sometimes, why can&apos;t you just make it configurable to deactivate folding on code basis?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>295902</commentid>
    <comment_count>3</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-20 00:10:43 +0000</bug_when>
    <thetext>We cannot make it &quot;configurable&quot; because highlighting rules are defined in the syntax highlighting files. We could add vim like region markers (how do they work?).
Pros: compatibility for vim/emacs
Cons: speed issue: RegExpr rules are slow (compared to other rules).

Is /* {{{ */ a &quot;fixed sequence&quot; or is it variable like /* some more spaces {{{ */?

Anders, what do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>295905</commentid>
    <comment_count>4</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-20 00:17:42 +0000</bug_when>
    <thetext>It is /* sometext {{{ some text */ and /* sometext }}} sometext */ where sometext is optional.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>295993</commentid>
    <comment_count>5</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2004-12-20 11:41:08 +0000</bug_when>
    <thetext>On Monday 20 December 2004 00:10, Dominik Haumann wrote:
&gt; ------- You are receiving this mail because: -------
&gt; You are the assignee for the bug, or are watching the assignee.
&gt;
&gt; http://bugs.kde.org/show_bug.cgi?id=95486
&gt;
&gt;
&gt;
&gt;
&gt; ------- Additional Comments From dhdev gmx de  2004-12-20 00:10 -------
&gt; We cannot make it &quot;configurable&quot; because highlighting rules are defined in
&gt; the syntax highlighting files. We could add vim like region markers (how do
&gt; they work?). Pros: compatibility for vim/emacs
&gt; Cons: speed issue: RegExpr rules are slow (compared to other rules).
&gt;
&gt; Is /* {{{ */ a &quot;fixed sequence&quot; or is it variable like /* some more spaces
&gt; {{{ */?
&gt;
&gt; Anders, what do you think?

{{{ is quite common, jed uses it too, and if jowenn hadn&apos;t started using BEGIN 
and END, I&apos;d have suggested that.

I think we should support it, and maybe even encourage using it (by replacing 
our current markers in our own files).

I wonder if it would be worth trying to make both versions mandatory or 
automatically supported.

-anders
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296069</commentid>
    <comment_count>6</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-20 17:25:17 +0000</bug_when>
    <thetext>Ok, I&apos;d agree to replace BEGIN/END with {{{/}}}, but I don&apos;t know whether it&apos;s good to support both (I&apos;d rather drop the old on then).
Is somewhere a page that exactly defines the syntax of {{{/}}}?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296076</commentid>
    <comment_count>7</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2004-12-20 17:43:07 +0000</bug_when>
    <thetext>Emacs/vim/jed manuals? The only cli editor i use these days is nano, since I use kate or kwrite for most things :-)
I think we are somehow stuck with BEGIN/END since we have it, but we could make a survey of some sort. I&apos;m personally not aware of usage outside kate code and my own files. 
One thing that I like about the current syntax in kate is the built in labelling -- the fact that the rest of the line is highlighted. But that could probably be easily kept, allthough I&apos;m not aware if additional text on the line is supported by other editors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296081</commentid>
    <comment_count>8</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-20 17:58:31 +0000</bug_when>
    <thetext>Vim and emacs do support. /* {{{ text */ ... /* }}} */ results in following:

http://www.defunced.de/pics/screenshots/2004-12-20-175644_2560x1024_scrot.png

(172K, sorry but I have no imaging software installed)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296086</commentid>
    <comment_count>9</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2004-12-20 18:13:13 +0000</bug_when>
    <thetext>And what is the actual line? It looks like the &apos;{{{&apos; string is hidden?
As far as I can recall from jed, it doesn&apos;t require the &apos;{{{&apos; to be in a comment, that is only for the sake of the compiler. IIRC, it would take *any* matchhing &apos;{{{&apos; and &apos;}}}&apos; for a foldable region.

What we could do was creating a external file or virtual hl, and import that anywhere desired -- or maybe we could even force import into contexts with &apos;comment&apos; in their names automatically, or based on a property.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296120</commentid>
    <comment_count>10</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-20 20:12:35 +0000</bug_when>
    <thetext>&gt; And what is the actual line? It looks like the &apos;{{{&apos; string is hidden?

This is correct. The line itself looked like this:

/* {{{ This is a test */

&gt; As far as I can recall from jed, it doesn&apos;t require the &apos;{{{&apos; to be in a comment, that is only for the sake of the compiler. IIRC, it would take *any* matchhing &apos;{{{&apos; and &apos;}}}&apos; for a foldable region. 

This is correct for gvim, but not for Emacs&apos; folding-mode. In Emacs it has to be comment-marker {{{ (you can configure what comment-marker can be, e.g. my configuration for the folding-mode in emacs is as follows:

  (let* ((ptr (assq &apos;text-mode folding-mode-marks-alist)))
  (setcdr ptr (list &quot;# {{{&quot; &quot;# }}}&quot;)))

This makes folding-mode also working in Perl and PHP). I think it would be ok to match &apos;comment-sign {{{&apos; only, I didn&apos;t see any {{{ without comment sign before it neither I saw &apos;comment-sign test {{{&apos;. But this is of course up to you.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296181</commentid>
    <comment_count>11</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-21 00:23:08 +0000</bug_when>
    <thetext>As Anders already pointed out we have an extra color for region markers.
I think it would be easy to add a RegExp like \{\{\{.*(?=(\*/)) for a beginRegion and .*\}\}\} for an endRegion, then we still had the extra color.
What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296247</commentid>
    <comment_count>12</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2004-12-21 09:29:08 +0000</bug_when>
    <thetext>I think this would really be nice. I would be zealous.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296262</commentid>
    <comment_count>13</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2004-12-21 10:53:13 +0000</bug_when>
    <thetext>Dominik: My main concern is that it needs to go in every file. Allready, even we pushed the BEGIN/END folding in many highlights, it is missing in some. I think that if this works in C/C++ files, it will be expected to work in any other file as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296389</commentid>
    <comment_count>14</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-21 20:55:39 +0000</bug_when>
    <thetext>Yup, I thought about it: We can not include the rule with includeRues.
So every file has to be touched by hand (right now: 20 files). As I think compatibility with other editors has a high priority I&apos;d volunteer to do this even in this year :)
It would go into KDE 3.4 then, if you agree.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>296402</commentid>
    <comment_count>15</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2004-12-21 21:07:45 +0000</bug_when>
    <thetext>In fact I consider if we can automate this completely.
I am allready considering how to make some sort of injection method, so that php and similar languages can have modified highlight objects created automatically, which means injecting a rule into the top of every context. Something similar could be used, just that in this case any comment context, or if noe found, context 0, should have a rule injected. It would make it work *allways* also for new highlights. But so far it&apos;s mostly a vague idea :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>298199</commentid>
    <comment_count>16</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2004-12-30 19:14:44 +0000</bug_when>
    <thetext>I now tried to add {{{...}}} folding for c/cpp. It is not possible right now, example:
/* &lt;- opens a comment folding
text {{{ &lt;- opens a block folding
*/ &lt;- closes the comment folding
...

This does not work because the */ closes the {{{ region marker.
So, as far as i can see: either we remove /* */ comment folding and drop {{{ }}} or the other way round.

Sure, I could add {{{...}}} support for // comments, but that won&apos;t really help, as they are widely used in /**/ comments (I looked in several files from the linux kernel).
...I&apos;m sorry :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>327600</commentid>
    <comment_count>17</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2005-03-24 11:53:45 +0000</bug_when>
    <thetext>can&apos;t we create a file that supports that, and import that into comment context in any file that wants t support it? simply,
&apos;{{{&lt;text&gt;&apos; starts a region, and &apos;&lt;text&gt;}}}&apos; ends one?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>327766</commentid>
    <comment_count>18</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2005-03-24 18:29:40 +0000</bug_when>
    <thetext>&gt; can&apos;t we create a file that supports that, and import that into comment
&gt; context in any file that wants t support it? simply, &apos;{{{&lt;text&gt;&apos; starts a
&gt; region, and &apos;&lt;text&gt;}}}&apos; ends one?

In general: yes. But the code folding is too buggy in order to support it.
/* {{{ &lt;- this starts two regions, where ...
*/     &lt;- ... the one ends here, but the other goes on. This is *not*
          nested, and somehow leads to bugs (like in html: ok is
          &lt;a&gt;&lt;b&gt;&lt;/b&gt;&lt;/a&gt; but &lt;a&gt;&lt;b&gt;&lt;/a&gt;&lt;/b&gt; is not recommended)
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394067</commentid>
    <comment_count>19</comment_count>
    <who name="Christian Parpart">trapni</who>
    <bug_when>2005-11-30 08:12:03 +0000</bug_when>
    <thetext>I would really like to make this bug alive just once again.

in fact, I&apos;m a very happy long-term vim user, however, I&apos;m trying to use kdevelop for the rather large project in favor of an integrated debugging environment (because I got impressed by Visual Studio 2005 for C#).

Though, I&apos;m using {{{ and }}} extensivily as well, and no, my code is not unreadable because it&apos;s written shit. These are just complex (meaning: large) projects.

Furthermore, I do not believe that introducing //BEGIN and //END (w/o supporting already well known markers) had been a good idea, as, in fact, lots of users are already familar with {{{ and }}} anyways.


Folding code based on scope isn&apos;t just always what you want or even need.

Regards,
Christian Parpart.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394094</commentid>
    <comment_count>20</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2005-11-30 10:41:10 +0000</bug_when>
    <thetext>What should I say? I _totally_ agree with Christian Parpart. The lack of {{{ }}} markers are the most important reason, why I don&apos;t use kate/kdevelop.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394155</commentid>
    <comment_count>21</comment_count>
    <who name="Christian Parpart">trapni</who>
    <bug_when>2005-11-30 15:28:18 +0000</bug_when>
    <thetext>while reading back.... I&apos;d like to highlight, that (at least 4 vim), the {{{ and }}} markers does certainly not require to be located within a comment like /* */ or //.

although, I&apos;d like to note, that you may still support comment folding.
just layer the {{{ and }}} marker parsing atop the comment folding.

EBNF alike folding parser grammer:

Goal                 ::= [CCommentStyleFolds]...
CStyleFolds          ::= [ScopeStyleFolds] &apos;/*&apos; ScopeStyleFolds &apos;*/&apos;
ScopeStyleFolds      ::= [VimStyleFolds] &apos;{&apos; VimStyleFolds &apos;}&apos;
VimStyleFolds        ::= TextNoVimFoldMark &apos;{{{&apos; TextNoVimFoldMark &apos;}}}&apos;
TextNoVimFoldMark    ::= &lt;any char except sequence &apos;{{{&apos; and &apos;}}}&apos;&gt;

If my head isn&apos;t over heated now, then this little grammar should make us *all* happy with regards to support all the marks we want, and yet, the vim-style fold markers are parsed properly with respect to the scope and comment folds w/o loosing functionality.

regards,
Christian Parpart.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394156</commentid>
    <comment_count>22</comment_count>
    <who name="Christian Parpart">trapni</who>
    <bug_when>2005-11-30 15:31:47 +0000</bug_when>
    <thetext>please ignore my typo: s/CStyleFolds/CCommentStyleFolds/g - it&apos;s just meta anyways, sorry</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394206</commentid>
    <comment_count>23</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2005-11-30 18:27:01 +0000</bug_when>
    <thetext>Ok, it would be easily possible to add support for constructs like this:
(1) /* {{{ text */   and   /* }}} text */.

Right now, it is not possible to add support for constructs like
(2) /* text {{{ text */ or /* text }}} text */.

The reason why (2) is not possible is due some bugs in code folding, i.e. nested regions like
begin A
begin B
end A
end B
do not work very well.

So - is option (1) enough?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394207</commentid>
    <comment_count>24</comment_count>
    <who name="Christian Kruse">ckruse</who>
    <bug_when>2005-11-30 18:33:15 +0000</bug_when>
    <thetext>Support of option (1) would be great.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>394214</commentid>
    <comment_count>25</comment_count>
    <who name="Anders Lund">anderslund</who>
    <bug_when>2005-11-30 18:51:26 +0000</bug_when>
    <thetext>FYI, I plan to add (if we can all agree in the kate developer team) a way to push a context into the beginning of ALL contexts in a highlight. The idea is to make generation of various PHP/ASP/EmbPerl/Mason etc highlights automatic and dynamic.

Such a mechanism would make adding support for {{{ and }}} very easy too, just one rule in the xml file.

As for the mixing, folding regsions are balanced by the folding system in kate, no worry needed for that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>548806</commentid>
    <comment_count>26</comment_count>
    <who name="Andrew O. Shadoura">bugzilla</who>
    <bug_when>2007-10-06 23:33:01 +0000</bug_when>
    <thetext>Any news about /* {{{ */ this /* }}} */?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1471029</commentid>
    <comment_count>27</comment_count>
    <who name="Christoph Cullmann">christoph</who>
    <bug_when>2014-09-13 22:04:47 +0000</bug_when>
    <thetext>Git commit a4b952b32c4a0ee4300df4c2833de5dd81de2cbb by Christoph Cullmann.
Committed on 13/09/2014 at 22:01.
Pushed by cullmann into branch &apos;master&apos;.

use alert hl to have generic {{{ / }}} folding support
bit of a hack, but better than introducing one more hl we include everywhere
that wish is close to 10 years old :)

M  +3    -1    src/syntax/data/alert.xml

http://commits.kde.org/ktexteditor/a4b952b32c4a0ee4300df4c2833de5dd81de2cbb</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>