all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* folding-mode question
@ 2010-09-22  6:58 tomer
  2010-09-22  8:44 ` Marc Mientki
  0 siblings, 1 reply; 14+ messages in thread
From: tomer @ 2010-09-22  6:58 UTC (permalink / raw)
  To: help-gnu-emacs

Is it possbile to fold partial line ,line for example:

the folding mark is //<<<

not folded:
if (a==b) { //<<<
a=1
b=2
}//>>>

is it possbile to fold it like this:
if (a==b) {...

Thanks
Tomer



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-22  6:58 folding-mode question tomer
@ 2010-09-22  8:44 ` Marc Mientki
  2010-09-22  9:47   ` tomer
  0 siblings, 1 reply; 14+ messages in thread
From: Marc Mientki @ 2010-09-22  8:44 UTC (permalink / raw)
  To: help-gnu-emacs

Am 22.09.2010 08:58, schrieb tomer:
> Is it possbile to fold partial line ,line for example:
>
> the folding mark is //<<<
>
> not folded:
> if (a==b) { //<<<
> a=1
> b=2
> }//>>>
>
> is it possbile to fold it like this:
> if (a==b) {...

Yes (even without special marks like //<<<), try hideshow.el.

;; * Commands provided
;;
;; This file provides Hideshow Minor Mode.  When active, nine commands
;; are available, implementing block hiding and showing.  They (and their
;; keybindings) are:
;;
;;   hs-hide-block                      C-c @ C-h
;;   hs-show-block                      C-c @ C-s
;;   hs-hide-all                        C-c @ C-M-h
;;   hs-show-all                        C-c @ C-M-s
;;   hs-hide-level                      C-c @ C-l
;;   hs-toggle-hiding                   C-c @ C-c
;;   hs-mouse-toggle-hiding             [(shift mouse-2)]
;;   hs-hide-initial-comment-block
;;
;; Blocks are defined per mode.  In c-mode, c++-mode and java-mode, they
;; are simply text between curly braces, while in Lisp-ish modes parens
;; are used.  Multi-line comment blocks can also be hidden.  Read-only
;; buffers are not a problem, since hideshow doesn't modify the text.
;;
;; The command `M-x hs-minor-mode' toggles the minor mode or sets it
;; (similar to other minor modes).

HTH
regards
Marc



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-22  8:44 ` Marc Mientki
@ 2010-09-22  9:47   ` tomer
  2010-09-22 10:45     ` Marc Mientki
  0 siblings, 1 reply; 14+ messages in thread
From: tomer @ 2010-09-22  9:47 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 22, 10:44 am, Marc Mientki <mien...@nonet.com> wrote:
> Am 22.09.2010 08:58, schrieb tomer:
>
> > Is it possbile to fold partial line ,line for example:
>
> > the folding mark is //<<<
>
> > not folded:
> > if (a==b) { //<<<
> > a=1
> > b=2
> > }//>>>
>
> > is it possbile to fold it like this:
> > if (a==b) {...
>
> Yes (even without special marks like //<<<), try hideshow.el.
>
> ;; * Commands provided
> ;;
> ;; This file provides Hideshow Minor Mode.  When active, nine commands
> ;; are available, implementing block hiding and showing.  They (and their
> ;; keybindings) are:
> ;;
> ;;   hs-hide-block                      C-c @ C-h
> ;;   hs-show-block                      C-c @ C-s
> ;;   hs-hide-all                        C-c @ C-M-h
> ;;   hs-show-all                        C-c @ C-M-s
> ;;   hs-hide-level                      C-c @ C-l
> ;;   hs-toggle-hiding                   C-c @ C-c
> ;;   hs-mouse-toggle-hiding             [(shift mouse-2)]
> ;;   hs-hide-initial-comment-block
> ;;
> ;; Blocks are defined per mode.  In c-mode, c++-mode and java-mode, they
> ;; are simply text between curly braces, while in Lisp-ish modes parens
> ;; are used.  Multi-line comment blocks can also be hidden.  Read-only
> ;; buffers are not a problem, since hideshow doesn't modify the text.
> ;;
> ;; The command `M-x hs-minor-mode' toggles the minor mode or sets it
> ;; (similar to other minor modes).
>
> HTH
> regards
> Marc

Thanks for the answer I
work with a language called "e" (hardware verification langauge) it
looks like C but not exactly.
am I still able to use hideshow ?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-22  9:47   ` tomer
@ 2010-09-22 10:45     ` Marc Mientki
  2010-09-24  0:17       ` tomer
  0 siblings, 1 reply; 14+ messages in thread
From: Marc Mientki @ 2010-09-22 10:45 UTC (permalink / raw)
  To: help-gnu-emacs

Am 22.09.2010 11:47, schrieb tomer:

> Thanks for the answer I
> work with a language called "e" (hardware verification langauge) it
> looks like C but not exactly.
> am I still able to use hideshow ?

I would simply switch to c-mode and see what happens.

regards
Marc



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-22 10:45     ` Marc Mientki
@ 2010-09-24  0:17       ` tomer
  2010-09-24  7:13         ` Marc Mientki
  2010-09-25  0:47         ` Tim X
  0 siblings, 2 replies; 14+ messages in thread
From: tomer @ 2010-09-24  0:17 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 22, 12:45 pm, Marc Mientki <mien...@nonet.com> wrote:
> Am 22.09.2010 11:47, schrieb tomer:
>
> > Thanks for the answer I
> > work with a language called "e" (hardware verification langauge) it
> > looks like C but not exactly.
> > am I still able to use hideshow ?
>
> I would simply switch to c-mode and see what happens.
>
> regards
> Marc

I have tried it is not practical.
the folding is great because it not language related.
the thing that is miss is to collapse in the middle of the line.
doest the folding.el capable of collpase in the middle of the line?


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-24  0:17       ` tomer
@ 2010-09-24  7:13         ` Marc Mientki
  2010-09-25 19:31           ` tomer
       [not found]           ` <87sk0yk5al.fsf@puma.rapttech.com.au>
  2010-09-25  0:47         ` Tim X
  1 sibling, 2 replies; 14+ messages in thread
From: Marc Mientki @ 2010-09-24  7:13 UTC (permalink / raw)
  To: help-gnu-emacs

Am 24.09.2010 02:17, schrieb tomer:
> On Sep 22, 12:45 pm, Marc Mientki<mien...@nonet.com>  wrote:
>> Am 22.09.2010 11:47, schrieb tomer:
>>
>>> Thanks for the answer I
>>> work with a language called "e" (hardware verification langauge) it
>>> looks like C but not exactly.
>>> am I still able to use hideshow ?
>>
>> I would simply switch to c-mode and see what happens.
>>
>> regards
>> Marc
>
> I have tried it is not practical.
> the folding is great because it not language related.

What would you say what is the benefit of code folding?
I've never used folding. After I've tried this out I was so
dissapointed. This was never interested to me. My "mystery
theory" is that peole who advocate code folding never seen
realy good text editor with superb navigation mechanism like
Emacs. But maybe I'm wrong and I underrate code folding.

regards
Marc



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-24  0:17       ` tomer
  2010-09-24  7:13         ` Marc Mientki
@ 2010-09-25  0:47         ` Tim X
  1 sibling, 0 replies; 14+ messages in thread
From: Tim X @ 2010-09-25  0:47 UTC (permalink / raw)
  To: help-gnu-emacs

tomer <tomer1levin@walla.co.il> writes:

> On Sep 22, 12:45 pm, Marc Mientki <mien...@nonet.com> wrote:
>> Am 22.09.2010 11:47, schrieb tomer:
>>
>> > Thanks for the answer I
>> > work with a language called "e" (hardware verification langauge) it
>> > looks like C but not exactly.
>> > am I still able to use hideshow ?
>>
>> I would simply switch to c-mode and see what happens.
>>
>> regards
>> Marc
>
> I have tried it is not practical.
> the folding is great because it not language related.
> the thing that is miss is to collapse in the middle of the line.
> doest the folding.el capable of collpase in the middle of the line?

There are a couple of folding mode packages available on the emacs wiki.
I sometimes use one that works quite well. There was an older one which
I used a lot back in emacs 20 days. From memory, some of the folding
modes became a little dated and some a little unstable once overlays
were introduced into emacs. The biggest problem appears to have been
lack of maintenance. 

The mode I sometimes use (many of them are just called folding.el or
folding-mode.el, which makes it a bit confusing

;;; folding.el --- A folding-editor-like minor mode.

;; Copyright (C) 2002-2006
;;	     Jari Aalto
;; Copyright (C) 1994-2001
;;           Jari Aalto, Anders Lindgren.
;; Copyright (C) 1992, 1993
;;           Jamie Lokier, All rights reserved.
;;
;; Author:      Jamie Lokier    <jamie A T imbolc.ucc dt ie>
;;              Jari Aalto
;;              Anders Lindgren <andersl A T csd.uu dt se>
;; Maintainer:  Jari Aalto <jari aalto A T cante dt net>
;;              Anders Lindgren <andersl A T csd.uu dt se>
;; Created:     1992
;; Version:     2004.1125 (2.117+)
;; RCS version: $Revision: 1.3 $
;; Date:        $Date: 2006/09/11 16:03:17 $
;; Keywords:    tools

;;{{{ GPL

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation,
;; or (at your option) any later version.
;;
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;}}}

;;; Commentary:

;;{{{ Introduction

;; Preface
;;
;;      This package provides a minor mode, compatible with all major
;;      editing modes, for folding (hiding) parts of the edited text or
;;      program.
;;
;;      Folding mode handles a document as a tree, where each branch
;;      is bounded by special markers `{{{' and `}}}'. A branch can be
;;      placed inside another branch, creating a complete hierarchical
;;      structure.
;;
;;      Folding mode can CLOSE a fold, leaving only the initial `{{{'
;;      and possibly a comment visible.
;;
;;      It can also ENTER a fold, which means that only the current
;;      fold will be visible, all text above `{{{' and below `}}}'
;;      will be invisible.
;;
;;      Please note, that the maintainers do not recommend to use only
;;      folding for you your code layout and navigation. Folding.el is
;;      on its best when it can "chunk" large sections of code inside
;;      folds. The larger the chunks, the more the usability of
;;      folding will increase. Folding.el is not meant to hide
;;      individual functions: you may be better served by hideshow.el
;;      or imenu.el (which can parse the function indexes)

-- 
tcross (at) rapttech dot com dot au


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-24  7:13         ` Marc Mientki
@ 2010-09-25 19:31           ` tomer
  2010-09-28  9:49             ` Marc Mientki
       [not found]           ` <87sk0yk5al.fsf@puma.rapttech.com.au>
  1 sibling, 1 reply; 14+ messages in thread
From: tomer @ 2010-09-25 19:31 UTC (permalink / raw)
  To: help-gnu-emacs

On Sep 24, 9:13 am, Marc Mientki <mien...@nonet.com> wrote:
> Am 24.09.2010 02:17, schrieb tomer:
>
> > On Sep 22, 12:45 pm, Marc Mientki<mien...@nonet.com>  wrote:
> >> Am 22.09.2010 11:47, schrieb tomer:
>
> >>> Thanks for the answer I
> >>> work with a language called "e" (hardware verification langauge) it
> >>> looks like C but not exactly.
> >>> am I still able to use hideshow ?
>
> >> I would simply switch to c-mode and see what happens.
>
> >> regards
> >> Marc
>
> > I have tried it is not practical.
> > the folding is great because it not language related.
>
> What would you say what is the benefit of code folding?
> I've never used folding. After I've tried this out I was so
> dissapointed. This was never interested to me. My "mystery
> theory" is that peole who advocate code folding never seen
> realy good text editor with superb navigation mechanism like
> Emacs. But maybe I'm wrong and I underrate code folding.
>
> regards
> Marc

I appreciate your comments  , I think more or lest like you , but
recently i got a task which basically maintain old code from other
programmers, in which the distande between the open and close statemn
could be several emacs pages,and have 5 or more hirarchy insisde. this
makes it difficult to trak , but i cant change code , i need only to
maintain it.
my solution is use fodling i dont know other solution to keep it easy
to track the code
Thanks
Tomer


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
       [not found]           ` <87sk0yk5al.fsf@puma.rapttech.com.au>
@ 2010-09-28  9:35             ` Marc Mientki
  0 siblings, 0 replies; 14+ messages in thread
From: Marc Mientki @ 2010-09-28  9:35 UTC (permalink / raw)
  To: help-gnu-emacs

Am 25.09.2010 02:58, schrieb Tim X:
 > Marc Mientki<mientki@nonet.com>  writes:
 >
 >> Am 24.09.2010 02:17, schrieb tomer:
 >>> On Sep 22, 12:45 pm, Marc Mientki<mien...@nonet.com>   wrote:
 >>>> Am 22.09.2010 11:47, schrieb tomer:
 >>>>
 >>>>> Thanks for the answer I
 >>>>> work with a language called "e" (hardware verification langauge) it
 >>>>> looks like C but not exactly.
 >>>>> am I still able to use hideshow ?
 >>>>
 >>>> I would simply switch to c-mode and see what happens.
 >>>>
 >>>> regards
 >>>> Marc
 >>>
 >>> I have tried it is not practical.
 >>> the folding is great because it not language related.
 >>
 >> What would you say what is the benefit of code folding?
 >> I've never used folding. After I've tried this out I was so
 >> dissapointed. This was never interested to me. My "mystery
 >> theory" is that peole who advocate code folding never seen
 >> realy good text editor with superb navigation mechanism like
 >> Emacs. But maybe I'm wrong and I underrate code folding.
 >>
 >
 > I would say your theory is very weak.

OK. As I've noticed it was only my "mystery theory" ;)


 > One reason I liked it was that by using well structured folding markers,
 > you could have a screen that showed not only the current code you are
 > editing, but also summary information about other bits of code in the
 > buffer. This means that often, you could get a quick reminder without
 > having to navigate or move from hour current position at all. For
 > example, when writing lots of Java code, I used folding mode so that in
 > my buffer, I had folding marks that also showed the arguments and return
 > values of other methods etc in my class. I found this useful because I
 > could just look up and see what the arguments were for a method I'd
 > defined higher/lower in the file - no need to move my cursor at all, no
 > need to navigate anywhere - essntially, I got more useful real-estate
 > use out of my screen.

I use in such situation another technique: I split my frame (which is 
almost always full screen) into 2 (or more) windows. Each window can now 
show another part of (same or not same) text. For quick navigation I use 
my 4 "high-speed-bookmarks". There are ordinary Emacs bookmarks that I 
place on F9 to F12. I set a bookmark with M-F9..M-F12 and jump to 
bookmark simply with F9..F12. This is the code:

;; quick bookmark
(global-set-key
  [\M-f9]
  (lambda () (interactive) (bookmark-set "quick-bookmark-1")))

(global-set-key
  [f9]
  (lambda () (interactive) (bookmark-jump "quick-bookmark-1")))

And so on for F10, F11 and F12. There may be exist a smarten 
(generalized) solution, but I typed this once and left it so.

Unfortunately using bookmarks in two or more windows with the same 
buffer has one bug since Emacs23 - when I jump in window 1 it jumps in 
window 2 to the same place.

Sometimes I use also bm.el.

The bigest drawback of code folding for me is:

  - the visual text form changes. I don't like it.

  - it produced more effort. I must first navigate to the right place, 
then fold and than go elsewhere where I want to edit. Possibly I must 
repeat folding many times so that I get the state that I see in one 
window both distance piece of text and current edited text. With my 
bookmarks and splited frame I'am much faster.


regards
Marc




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-25 19:31           ` tomer
@ 2010-09-28  9:49             ` Marc Mientki
  2010-09-28 22:46               ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Marc Mientki @ 2010-09-28  9:49 UTC (permalink / raw)
  To: help-gnu-emacs

Am 25.09.2010 21:31, schrieb tomer:
 > On Sep 24, 9:13 am, Marc Mientki<mien...@nonet.com>  wrote:
 >> Am 24.09.2010 02:17, schrieb tomer:
 >>
 >>> On Sep 22, 12:45 pm, Marc Mientki<mien...@nonet.com>    wrote:
 >>>> Am 22.09.2010 11:47, schrieb tomer:
 >>
 >>>>> Thanks for the answer I work with a language called "e"
 >>>>> (hardware verification langauge) it looks like C but not
 >>>>> exactly. am I still able to use hideshow ?
 >>
 >>>> I would simply switch to c-mode and see what happens.
 >>
 >>>> regards
 >>>> Marc
 >>
 >>> I have tried it is not practical.
 >>> the folding is great because it not language related.
 >>
 >> What would you say what is the benefit of code folding?
 >> I've never used folding. After I've tried this out I was so
 >> dissapointed. This was never interested to me. My "mystery
 >> theory" is that peole who advocate code folding never seen
 >> realy good text editor with superb navigation mechanism
 >> like Emacs. But maybe I'm wrong and I underrate code
 >> folding.
 >>
 >> regards
 >> Marc
 >
 > I appreciate your comments, I think more or lest like you,

Nice to hear it! :)

 > but recently i got a task which basically maintain old code
 > from other programmers, in which the distande between the
 > open and close statemn could be several emacs pages,and have
 > 5 or more hirarchy insisde. this makes it difficult to trak,
 > but i cant change code, i need only to maintain it. my
 > solution is use fodling i dont know other solution to keep
 > it easy to track the code

Well... when you fold the source code you can't see it. When
you can't see it you can't understand it and as rasult you
can't track it ;-)

Do not take it too seriously, but emphasis on "too seriously".
Again und again I must read not own sources (C and C++), too.
For navigation in {}-hierarchy I use with love this piece of
lisp code:

;; define function to match a parenthesis otherwise insert a '~'
(defun goto-match-paren (arg)
   "Go to the matching parenthesis if on parenthesis otherwise insert '~'."
   (interactive "p")
   (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
         ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
         (t (self-insert-command (or arg 1)))))
(global-set-key (kbd "~") 'goto-match-paren)

This allows me to jump to corresponding { or } with '~'

And of course I use mic-paren.el and show-paren-mode.

regards
Marc





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-28  9:49             ` Marc Mientki
@ 2010-09-28 22:46               ` Stefan Monnier
  2010-09-29  8:54                 ` Marc Mientki
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Monnier @ 2010-09-28 22:46 UTC (permalink / raw)
  To: help-gnu-emacs

> This allows me to jump to corresponding { or } with '~'

What's wrong with C-M-f and C-M-b?


        Stefan



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-28 22:46               ` Stefan Monnier
@ 2010-09-29  8:54                 ` Marc Mientki
  2010-09-29  8:56                   ` Marc Mientki
  2010-09-29  9:00                   ` Marc Mientki
  0 siblings, 2 replies; 14+ messages in thread
From: Marc Mientki @ 2010-09-29  8:54 UTC (permalink / raw)
  To: help-gnu-emacs

Am 29.09.2010 00:46, schrieb Stefan Monnier:
>> This allows me to jump to corresponding { or } with '~'
>
> What's wrong with C-M-f and C-M-b?

First this:
forward-sexp: Scan error: "Containing expression ends prematurely", 
100949, 100950

It was a ordinary, syntax correct, compilable C++ file. The buffer was 
in c++-mode. It happens on ')' but not always on each ')'.

Second: when it is working it do not the same job as my goto-match-paren.

regards
Marc




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-29  8:54                 ` Marc Mientki
@ 2010-09-29  8:56                   ` Marc Mientki
  2010-09-29  9:00                   ` Marc Mientki
  1 sibling, 0 replies; 14+ messages in thread
From: Marc Mientki @ 2010-09-29  8:56 UTC (permalink / raw)
  To: help-gnu-emacs

Am 29.09.2010 10:54, schrieb Marc Mientki:
> Am 29.09.2010 00:46, schrieb Stefan Monnier:
>>> This allows me to jump to corresponding { or } with '~'
>>
>> What's wrong with C-M-f and C-M-b?
>
> First this:
> forward-sexp: Scan error: "Containing expression ends prematurely",
> 100949, 100950
>
> It was a ordinary, syntax correct, compilable C++ file. The buffer was
> in c++-mode. It happens on ')' but not always on each ')'.

Forget:
GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1

Marc



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: folding-mode question
  2010-09-29  8:54                 ` Marc Mientki
  2010-09-29  8:56                   ` Marc Mientki
@ 2010-09-29  9:00                   ` Marc Mientki
  1 sibling, 0 replies; 14+ messages in thread
From: Marc Mientki @ 2010-09-29  9:00 UTC (permalink / raw)
  To: help-gnu-emacs

Am 29.09.2010 10:54, schrieb Marc Mientki:
> Am 29.09.2010 00:46, schrieb Stefan Monnier:
>>> This allows me to jump to corresponding { or } with '~'
>>
>> What's wrong with C-M-f and C-M-b?
>
> First this:
> forward-sexp: Scan error: "Containing expression ends prematurely",
> 100949, 100950
>
> It was a ordinary, syntax correct, compilable C++ file. The buffer was
> in c++-mode. It happens on ')' but not always on each ')'.

Sorry, it was wrong. It happens on '++' like here:

     for(r=0; r<rows; r++)

when the point is somewhere between '(' and ')'.

regards
Marc



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-09-29  9:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22  6:58 folding-mode question tomer
2010-09-22  8:44 ` Marc Mientki
2010-09-22  9:47   ` tomer
2010-09-22 10:45     ` Marc Mientki
2010-09-24  0:17       ` tomer
2010-09-24  7:13         ` Marc Mientki
2010-09-25 19:31           ` tomer
2010-09-28  9:49             ` Marc Mientki
2010-09-28 22:46               ` Stefan Monnier
2010-09-29  8:54                 ` Marc Mientki
2010-09-29  8:56                   ` Marc Mientki
2010-09-29  9:00                   ` Marc Mientki
     [not found]           ` <87sk0yk5al.fsf@puma.rapttech.com.au>
2010-09-28  9:35             ` Marc Mientki
2010-09-25  0:47         ` Tim X

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.