Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Put this in your .emacs

    (show-paren-mode)
    • That doesn't appear to do anything if the other paren if off the screen. Maybe I don't have some other magic set. Does it work for you?
      • Um, from reading your text, "If I can't have my jetpack I can at least have an editor that can show me where a block starts. Emacs does this when you type the closing brace. I'm not sure how to get it to do it on-hover", I understood that as "highlight the matching curly" whenever the cursor is on a { or }

        (similar to "mouse hover", but Emacs isn't very mouse oriented in general...)

        Did you mean something else?
        • Um, from reading your text, "If I can't have my jetpack I can at least have an editor that can show me where a block starts. Emacs does this when you type the closing brace. I'm not sure how to get it to do it on-hover", I understood that as "highlight the matching curly" whenever the cursor is on a { or }

          It's not very useful if the matching curly has scrolled off the top of the screen, ie. I can't see it. Setting show-paren-style to "parenthesis" it will highlight the other paren, which is off screen. If I use "expression" it will highlight the whole block, but the condition still lies off screen and out of sight.

          What I really want is it to say "Matches if( foo ) {", like it does when you type a closing brace. Show me the first line of the block so I can see the condition, the important bit.

          (similar to "mouse hover", but Emacs isn't very mouse oriented in general...)

          This is why I

  • In vim, the % key lets you bounce between chars, and putting 'set showmatch' in your .vimrc will briefly highlight the opening brace when you type a closing one.
  • This is something that an intelligent graphical IDE could show as a tool-tip when you hover the mouse over the closing brace. That way you don't need to repeat yourself in code, and you can still find out what the brace corresponds to without scrolling. Patrick
    • Or you could display it permanently at the end of the block, making it look like a tooltip or something, but not as a comment in the source code. (in Emacs, an overlay)

      I'm note sure I'd appreciate it though, it may be too noisy.

      Maybe it would be useful if it was only displayed whenever the block is longer than n lines, or whenever the other side of the block isn't visible.

      This may be one of those things that sound good/bad, but you won't really know how it pans out until you try it :)
  • Geany for example, shows a sidebar brace wrapping any blocks that occur in your code, such as subroutine functions, comment blocks, if statements, etc.

    I don't use geany myself but I can see how such a thing would be useful to coders.

    Now where's that vim plugin? :-) ...of course one can use folding in Vim as well.
    • ... of course one can use folding in Vim as well.

      If you're doing it right, the block is usually short enough that folding it isn't worthwhile.

  • End of scope comments are a pet hate of mine, for all the reasons you've given. And it's one of those things that people seem to cling to, as if it's a best practice like TDD.

    I hate clutter of any sort in code... which is a shame since I have to use Java for my next project...