From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giovanni Giorgi Subject: Minor org mode for achieve code folding effects Date: Mon, 09 Jan 2012 16:14:15 +0100 Message-ID: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=_22e040f6ce519bbb6c9394206f19e6a5" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkGwE-0006EH-28 for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:15:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkGw5-00022f-M3 for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:15:06 -0500 Received: from mail6.webfaction.com ([74.55.86.74]:36793 helo=smtp.webfaction.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkGw5-00022V-Is for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:14:57 -0500 Received: from webmail.webfaction.com (wf2.webfaction.com [174.133.50.206]) by smtp.webfaction.com (Postfix) with ESMTP id 519C426EAF80 for ; Mon, 9 Jan 2012 09:14:15 -0600 (CST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Emacs orgmode --=_22e040f6ce519bbb6c9394206f19e6a5 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 Hi all, I'd like to edit some ruby/python/shell script using functions folding. I'd like to get a way to fold functions or method. I have found this article using outline mode: http://stackoverflow.com/questions/1085170/how-to-achieve-code-folding-effects-in-emacs but frankly I find it difficult to use because navigation is too difficult. (I have also excluded folding mode). Org Mode has a very nice navigation and key bindings, and I know it better then outline. There is a way to get a minor org-mode for replacing the above outline configuration? I am ready to experiment, if I need to patch things... --- Gio's Blog http://gioorgi.com --=_22e040f6ce519bbb6c9394206f19e6a5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Hi all,
 I'd like to edit some ruby/python/shell script using = functions folding.

I'd like to get a way to fold functions or method.

I have found this article using outline mode: 
http://stackove= rflow.com/questions/1085170/how-to-achieve-code-folding-effects-in-emacs

but frankly I find it difficult to use because navigation is too difficu= lt. (I have also excluded folding mode).

 

Org Mode has a very nice navigation and key bindings, and I know it bett= er then outline.
There is a way to get a minor org-mode for replacing = the above outline configuration?
I am ready to experiment, if I need t= o patch things... 

 

---
Gio's Blog http://gioorgi.com
--=_22e040f6ce519bbb6c9394206f19e6a5-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Minor org mode for achieve code folding effects Date: Mon, 9 Jan 2012 16:23:17 +0100 Message-ID: References: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:41437) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkH4q-0001XU-IE for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:24:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkH4k-0003Ty-HJ for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:24:00 -0500 Received: from mail-we0-f169.google.com ([74.125.82.169]:36660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkH4k-0003Tu-81 for emacs-orgmode@gnu.org; Mon, 09 Jan 2012 10:23:54 -0500 Received: by werf1 with SMTP id f1so3559555wer.0 for ; Mon, 09 Jan 2012 07:23:53 -0800 (PST) In-Reply-To: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giovanni Giorgi Cc: Emacs orgmode On Jan 9, 2012, at 4:14 PM, Giovanni Giorgi wrote: > Hi all, > I'd like to edit some ruby/python/shell script using functions = folding. >=20 > I'd like to get a way to fold functions or method. >=20 > I have found this article using outline mode:=20 > = http://stackoverflow.com/questions/1085170/how-to-achieve-code-folding-eff= ects-in-emacs >=20 > but frankly I find it difficult to use because navigation is too = difficult. (I have also excluded folding mode). >=20 >=20 > Org Mode has a very nice navigation and key bindings, and I know it = better then outline. > There is a way to get a minor org-mode for replacing the above outline = configuration? > I am ready to experiment, if I need to patch things...=20 Start by reading the FAQ: = http://orgmode.org/worg/org-faq.html#use-visibility-cycling-in-outline-mod= e - Carsten From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Minor org mode for achieve code folding effects Date: Tue, 10 Jan 2012 21:08:07 +0000 Message-ID: <8739bnjmfc.fsf@ucl.ac.uk> References: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkivU-0000B0-LZ for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 16:08:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkivT-0001a0-LK for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 16:08:12 -0500 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:59821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkivT-0001Zw-DN for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 16:08:11 -0500 Received: from [85.210.141.126] (helo=localhost) by vscane-b.ucl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1RkivR-0001T3-0C for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 21:08:09 +0000 In-Reply-To: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> (Giovanni Giorgi's message of "Mon, 09 Jan 2012 16:14:15 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Giovanni Giorgi writes: > > > Hi all, > I'd like to edit some ruby/python/shell script using > functions folding. > > I'd like to get a way to fold functions or method. Carsten has already given you one possible solution; another is to use org + babel with tangling to have each function or method within a separate headline in an org document. Check out the manual: (org) Working With Source Code or, within that section, the subsection (org) Extracting source code -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1 : using Org-mode version 7.8.03 (release_7.8.03.73.gd2b3d) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Alekseyev Subject: Re: Minor org mode for achieve code folding effects Date: Tue, 10 Jan 2012 16:47:58 -0600 Message-ID: References: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> <8739bnjmfc.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:47124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkkU5-0006s3-Q9 for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 17:48:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkkU4-0000mh-EB for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 17:48:01 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:44205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkkU4-0000mZ-9E for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 17:48:00 -0500 Received: by pbdd2 with SMTP id d2so132205pbd.0 for ; Tue, 10 Jan 2012 14:47:59 -0800 (PST) In-Reply-To: <8739bnjmfc.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Tue, Jan 10, 2012 at 3:08 PM, Eric S Fraga wrote: > Giovanni Giorgi writes: > >> >> >> Hi all, >> =A0I'd like to edit some ruby/python/shell script using >> functions folding. >> >> I'd like to get a way to fold functions or method. > > Carsten has already given you one possible solution; another is to use > org + babel with tangling to have each function or method within a > separate headline in an org document. =A0Check out the manual I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. One issue with this approach is that you might prefer finer control over what sections appear folded and what sections appear visible by default. To deal with this, I hacked org.el watch for special visibility-control markers in the heading line, so that e.g. * A heading ending with tilde-tilde like so ~~ would appear always visible. I hope to come up with a better solution for this in the future. The other issue is that Tassilo's code is currently broken for c-mode (possibly due to conflating *'s in /* comment syntax with *'s in the outline header level syntax). If you can fix it, that would be useful :) The code: (require 'outline) (add-hook 'outline-minor-mode-hook =09 '(lambda () (define-key outline-minor-mode-map (kbd "TAB") 'org-cycle) (define-key outline-minor-mode-map [(tab)] 'org-cycle) (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle) (define-key outline-minor-mode-map [backtab] 'org-global-cycle))) ;; Tassilo Horn's outline-minor-mode enhancement: derive regex from comment syntax (defvar th-outline-minor-mode-font-lock-keywords '((eval . (list (concat "^\\(?:" outline-regexp "\\).*") 0 '(outline-font-lock-face) t t))) "Additional expressions to highlight in Orgstruct Mode and Outline minor m= ode. The difference to `outline-font-lock-keywords' is that this will overwrite other highlighting.") (defun th-outline-regexp () "Calculate the outline regexp for the current mode." (let ((comment-starter (replace-regexp-in-string "[[:space:]]+" "" comment-start))) (when (string=3D comment-starter ";") (setq comment-starter ";;")) (when (string=3D comment-starter "#") (setq comment-starter "##")) (concat comment-starter " [*]+ "))) (defun th-outline-minor-mode-init () (interactive) (unless (eq major-mode 'latex-mode) (setq outline-regexp (th-outline-regexp)) (font-lock-add-keywords nil th-outline-minor-mode-font-lock-keywords) (font-lock-fontify-buffer))) (add-hook 'outline-minor-mode-hook 'th-outline-minor-mode-init) From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rogoff Subject: Re: Minor org mode for achieve code folding effects Date: Tue, 10 Jan 2012 16:34:55 -0800 Message-ID: <4F0CD92F.9030004@therogoffs.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------080003020900060706030104" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkm9c-0000Xw-7u for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 19:35:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkm9a-0003BL-UM for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 19:35:00 -0500 Received: from oproxy9.bluehost.com ([69.89.24.6]:55622) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Rkm9a-0003B9-Je for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 19:34:58 -0500 Received: from ip68-228-84-160.oc.oc.cox.net ([68.228.84.160] helo=therogoffs.local) by box775.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1Rkm9Y-0001bH-KU for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 17:34:56 -0700 References: CADzxs1nkW_KO_n7RsTtO_W2nAvyUvoKGy+FgztaRFiFyuh44ug@mail.gmail.com List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------080003020900060706030104 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Carlos Russo gmail.com> writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. This is great info! I was just looking for this in the last couple of days and appreciate everyone's code since it's way beyond my elisp abilities. I like this a lot more than the folding.el I had been using since I already use orgmode. However, I've got a question: I'm using this with verilog-mode which uses "// " to start comments. The problem is that when I indent my file, the comments indent too and it seems that output-minor-mode (and, I assume, orgmode) only recognize headings that start in column 0. How/where can I change this so it will recognize any line that is whitepace followed by the comment-start? Thanks! David --------------080003020900060706030104 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Carlos Russo <mestre.adamastor <at> gmail.com> writes:
I have used both Carsten's and Eric's solution, as well as
hideshow-org (https://github.com/secelis/hideshow-org), which works
rather well and deserves a mention.

Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience
functions to set the outline minor mode regexps to correspond to the
current comment syntax.  Thus, if I'm (for instance) in shell-script
mode, # * and # ** become the outline level 1 and 2 markers.

This is great info! I was just looking for this in the last couple of days and appreciate everyone's code since it's way beyond my elisp abilities.
I like this a lot more than the folding.el I had been using since I already use orgmode.  However, I've got a question:

I'm using this with verilog-mode which uses "// " to start comments.  The problem is that when I indent my file, the comments indent too and it seems that output-minor-mode (and, I assume, orgmode) only recognize headings that start in column 0.  How/where can I change this so it will recognize any line that is whitepace followed by the comment-start?

Thanks!

 David
--------------080003020900060706030104-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rogoff Subject: Re: Minor org mode for achieve code folding effects Date: Tue, 10 Jan 2012 17:21:40 -0800 Message-ID: <4F0CE424.7020409@therogoffs.com> References: CADzxs1nkW_KO_n7RsTtO_W2nAvyUvoKGy+FgztaRFiFyuh44ug@mail.gmail.com <4F0CD92F.9030004@therogoffs.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------040300050103060402070305" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rkmss-00073Y-5q for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 20:21:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rkmsq-0001JL-MF for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 20:21:46 -0500 Received: from oproxy5-pub.bluehost.com ([67.222.38.55]:60800) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Rkmsq-0001J3-BY for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 20:21:44 -0500 Received: from ip68-228-84-160.oc.oc.cox.net ([68.228.84.160] helo=therogoffs.local) by box775.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1Rkmso-0001A7-9X for emacs-orgmode@gnu.org; Tue, 10 Jan 2012 18:21:42 -0700 In-Reply-To: <4F0CD92F.9030004@therogoffs.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------040300050103060402070305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit > David Rogoff > January 10, 2012 4:34 PM > Carlos Russo gmail.com> writes: > I have used both Carsten's and Eric's solution, as well as > hideshow-org (https://github.com/secelis/hideshow-org), which works > rather well and deserves a mention. > > Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience > functions to set the outline minor mode regexps to correspond to the > current comment syntax. Thus, if I'm (for instance) in shell-script > mode, # * and # ** become the outline level 1 and 2 markers. > > This is great info! I was just looking for this in the last couple of > days and appreciate everyone's code since it's way beyond my elisp > abilities. > I like this a lot more than the folding.el I had been using since I > already use orgmode. However, I've got a question: > > I'm using this with verilog-mode which uses "// " to start comments. > The problem is that when I indent my file, the comments indent too and > it seems that output-minor-mode (and, I assume, orgmode) only > recognize headings that start in column 0. How/where can I change > this so it will recognize any line that is whitepace followed by the > comment-start? > This works, but is probably not the best way to do it: (defun th-outline-regexp () "Calculate the outline regexp for the current mode." (let ((comment-starter (replace-regexp-in-string "[[:space:]]+" "" comment-start))) (when (string= comment-starter ";") (setq comment-starter ";;")) (when (string= comment-starter "#") (setq comment-starter "##")) (when (eq major-mode 'verilog-mode) (setq comment-starter "\\s-*//")) ;; for verilog-mode, define comment-starter as any amount of whitespace followed by "//". This allows indented comments as outline levels (concat comment-starter " [*]+ "))) --------------040300050103060402070305 Content-Type: multipart/related; boundary="------------070104040000090305030507" --------------070104040000090305030507 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit

January 10, 2012 4:34 PM
Carlos Russo <mestre.adamastor <at> gmail.com> writes:
I have used both Carsten's and Eric's solution, as well as
hideshow-org (https://github.com/secelis/hideshow-org), which works
rather well and deserves a mention.

Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience
functions to set the outline minor mode regexps to correspond to the
current comment syntax.  Thus, if I'm (for instance) in shell-script
mode, # * and # ** become the outline level 1 and 2 markers.

This is great info! I was just looking for this in the last couple of days and appreciate everyone's code since it's way beyond my elisp abilities.
I like this a lot more than the folding.el I had been using since I already use orgmode.  However, I've got a question:

I'm using this with verilog-mode which uses "// " to start comments.  The problem is that when I indent my file, the comments indent too and it seems that output-minor-mode (and, I assume, orgmode) only recognize headings that start in column 0.  How/where can I change this so it will recognize any line that is whitepace followed by the comment-start?

This works, but is probably not the best way to do it:

(defun th-outline-regexp ()
  "Calculate the outline regexp for the current mode."
  (let ((comment-starter (replace-regexp-in-string
                          "[[:space:]]+" "" comment-start)))
    (when (string= comment-starter ";")
      (setq comment-starter ";;"))
    (when (string= comment-starter "#")
      (setq comment-starter "##"))
    (when (eq major-mode 'verilog-mode)
      (setq comment-starter "\\s-*//"))     ;; for verilog-mode, define comment-starter as any amount of whitespace followed by "//". This allows indented comments as outline levels
    (concat comment-starter " [*]+ ")))
--------------070104040000090305030507 Content-Type: image/jpeg; x-apple-mail-type=stationery; name="postbox-contact.jpg" Content-Transfer-Encoding: base64 Content-ID: Content-Disposition: inline; filename="postbox-contact.jpg" /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkL EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAAR CAAZABkDAREAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl 5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk 5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDzL41eMPGGsaH4WstFvbRta8YXxOoX1zZQ zSyx/YkllYu6E4BJOBxjCjAAFeK3GDlOa2PSoRdSSgilpvhX4E6hFZ+EJPB2mXGo+Witf21p bCQs3Adh5O3JNehQwlWcfb1ZKMf0PRcMO/3ahf0OcuvDdt8IfjP4Vvvh7eQPbxavBYagtzY2 qPtkmWJmSSKBCoBYDIbcDgjGK2xWFj9VVWLv10PPrUlSqWjf5nsv/DTv7Xf/AEUTwr/3w3+N eP7Zd5fh/kc2nkc/ZeH4teHgPW5JZwdIkOYp15ZZrFI2BPfHBB9KmunaUVbW35no5ZDnrXfR M9f0/wAGaTZxNq81pCDaxFYABgFugf8ADNdnLL6q6aPYUbVE2eHfGG3g0TTNR1R0R5dN1j7W h9WjkSUDPoSq16lbDThho0pabnn46UKjnNHx/wD8NA/ED/n7t/8Avz/9euD6lA8HnR9reB72 7Tw5psUtjcLJYYW5jMRVoWjVFdWXAwQVYEdcgjrXlVOepPZ7nrYCfsqifkd9d/EKLVbF9Lgh t5o5kMTo0uMg8EYxXvULqCV7P+up6cqsakrHhfxllKeGdb0Eh7fz3NwigGVkU7dxwBnHyn6V 7GYOboLq1Y8fESUOaKejPlD/AIU14/8A+ie+Nf8AwQT/APxNeRzM8qx9r/tM/wDJwfjf/r9/ 9pR1cvhNaPxng+rf8f1z/v8A9KeF6HTW+Jlj4d/8lN8L/wDYYsf/AEoSvWq9Dglsz9p68sD/ 2Q== --------------070104040000090305030507-- --------------040300050103060402070305-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Alekseyev Subject: Re: Minor org mode for achieve code folding effects Date: Wed, 11 Jan 2012 00:23:01 -0600 Message-ID: References: <4F0CD92F.9030004@therogoffs.com> <4F0CE424.7020409@therogoffs.com> Mime-Version: 1.0 Content-Type: multipart/related; boundary=e89a8ff1cceceb3b1c04b63aa914 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:53114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkraT-00044H-JM for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 01:23:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkraR-0005Kl-Rq for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 01:23:05 -0500 Received: from mail-pz0-f41.google.com ([209.85.210.41]:53868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkraR-0005Kh-HE for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 01:23:03 -0500 Received: by dakl33 with SMTP id l33so260795dak.0 for ; Tue, 10 Jan 2012 22:23:02 -0800 (PST) In-Reply-To: <4F0CE424.7020409@therogoffs.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Tassilo Horn --e89a8ff1cceceb3b1c04b63aa914 Content-Type: multipart/alternative; boundary=e89a8ff1cceceb3b1304b63aa913 --e89a8ff1cceceb3b1304b63aa913 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jan 10, 2012 at 7:21 PM, David Rogoff wrote: > > > David Rogoff > January 10, 2012 4:34 PM > Carlos Russo gmail.com> writes: > I have used both Carsten's and Eric's solution, as well as > hideshow-org (https://github.com/secelis/hideshow-org), which works > rather well and deserves a mention. > > Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience > functions to set the outline minor mode regexps to correspond to the > current comment syntax. Thus, if I'm (for instance) in shell-script > mode, # * and # ** become the outline level 1 and 2 markers. > > This is great info! I was just looking for this in the last couple of > days and appreciate everyone's code since it's way beyond my elisp > abilities. > I like this a lot more than the folding.el I had been using since I > already use orgmode. However, I've got a question: > > I'm using this with verilog-mode which uses "// " to start comments. The > problem is that when I indent my file, the comments indent too and it seems > that output-minor-mode (and, I assume, orgmode) only recognize headings > that start in column 0. How/where can I change this so it will recognize > any line that is whitepace followed by the comment-start? > > > I've done a little bit of digging into how Tassilo's code works, and realized that it's somewhat broken in the following way: if a mode provides its own outline-level function, chances are, his code will break (this is why c-mode doesn't work). Even if default outline-level is used, it will determine the level incorrectly since it just counts characters in the current outline regex. Thus, with the ouline regexp set to something like "## * " this function will say that you are on outline level 5. This might lead to some unexpected behavior. Long story short, here is the fixed code that provides and sets proper outline level: (defun th-outline-regexp () "Calculate the outline regexp for the current mode." (let ((comment-starter (replace-regexp-in-string "[[:space:]]+" "" comment-start))) (setq comment-starter (replace-regexp-in-string "*" "[*]" comment-starter)) (when (string= comment-starter ";") (setq comment-starter ";;")) (when (string= comment-starter "#") (setq comment-starter "##")) (concat "\\(" comment-starter "\\)" "\\( [*]+ \\)"))) (defun th-lva-outline-level () "Calculates appropriate outline level by counting the stars in the regex" (let ((stars-regex "[*]+") (outline-start-string (match-string 2))) ;; ideally, second group obtained by (match-string 2) will be just the stars (if (string-match stars-regex outline-start-string) (- (match-end 0) (match-beginning 0)) 0))) (defun th-outline-minor-mode-init () (interactive) (unless (eq major-mode 'latex-mode) (setq outline-regexp (th-outline-regexp)) (setq outline-level 'th-lva-outline-level) (font-lock-add-keywords nil th-outline-minor-mode-font-lock-keywords) (font-lock-fontify-buffer))) --e89a8ff1cceceb3b1304b63aa913 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Tue, Jan 10, 2012 at 7:21 PM, David R= ogoff <david@t= herogoffs.com> wrote:


=20 January 10, 2012= =20 4:34 PM
Carlos Russo <mestre.adamastor <at> gmail.com> writes:
I have used both Carsten's and Eric&#= 39;s=20 solution, as well as
hideshow-org (https://github.com/secelis/hideshow-org), which works
rather well and deserves a mention.

Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience<= br> functions to set the outline minor mode regexps to correspond to the
current comment syntax.=A0 Thus, if I'm (for instance) in shell-script<= br> mode, # * and # ** become the outline level 1 and 2 markers.

This is great info! I was just looking for this in the last couple of=20 days and appreciate everyone's code since it's way beyond my elisp= =20 abilities.
I like this a lot more than the folding.el I had been using since I=20 already use orgmode.=A0 However, I've got a question:

I'm using this with verilog-mode which uses "// " to start co= mments.=A0=20 The problem is that when I indent my file, the comments indent too and=20 it seems that output-minor-mode (and, I assume, orgmode) only recognize=20 headings that start in column 0.=A0 How/where can I change this so it will recognize any line that is whitepace followed by the comment-start?


=A0I've done a lit= tle bit of digging into how Tassilo's code works,=20 and realized that it's somewhat broken in the following way: if a mode= =20 provides its own outline-level function, chances are, his code will=20 break (this is why c-mode doesn't work).=A0 Even if default outline-lev= el=20 is used, it will determine the level incorrectly since it just counts=20 characters in the current outline regex.=A0 Thus, with the ouline regexp=20 set to something like "## * " this function will say that you are= on=20 outline level 5.=A0 This might lead to some unexpected behavior.=A0 Long=20 story short, here is the fixed code that provides and sets proper=20 outline level:

=A0 (defun th-outline-regexp ()
=A0=A0 "Calculate the outline regexp for the current mode."
=A0=A0 (let ((comment-starter (replace-regexp-in-string
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0 "[[:space:]]+" "" comment-start)))
=A0=A0=A0=A0 (setq comment-starter (replace-regexp-in-string "*" = "[*]" comment-starter))
=A0=A0=A0=A0 (when (string=3D comment-starter ";")
=A0=A0=A0=A0=A0=A0 (setq comment-starter ";;"))
=A0=A0=A0=A0 (when (string=3D comment-starter "#")
=A0=A0=A0=A0=A0=A0 (setq comment-starter "##"))
=A0=A0=A0=A0 (concat "\\(" comment-starter "\\)" "= \\( [*]+ \\)")))
=A0
=A0 (defun th-lva-outline-level ()
=A0=A0=A0 "Calculates appropriate outline level by counting the stars = in the regex"
=A0=A0=A0 (let ((stars-regex "[*]+") (outline-start-string (match= -string 2)))
=A0=A0=A0=A0=A0=A0 ;; ideally, second group obtained by (match-string 2) wi= ll be just the stars
=A0=A0=A0=A0=A0 (if (string-match stars-regex outline-start-string)
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (- (match-end 0) (match-beginning 0))
=A0=A0=A0=A0=A0=A0=A0 0)))
=A0
=A0 (defun th-outline-minor-mode-init ()
=A0=A0 (interactive)
=A0=A0 (unless (eq major-mode 'latex-mode)
=A0=A0=A0=A0 (setq outline-regexp (th-outline-regexp))
=A0=A0=A0=A0 (setq outline-level 'th-lva-outline-level)
=A0=A0=A0=A0 (font-lock-add-keywords
=A0=A0=A0=A0=A0 nil
=A0=A0=A0=A0=A0 th-outline-minor-mode-font-lock-keywords)
=A0=A0=A0=A0=A0 (font-lock-fontify-buffer)))
=A0
--e89a8ff1cceceb3b1304b63aa913-- --e89a8ff1cceceb3b1c04b63aa914 Content-Type: image/jpeg; x-apple-mail-type=stationery; name="postbox-contact.jpg" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: cc242eba6511fe91_0.1.1 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkI CQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQ EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAZABkDAREA AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3 ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3 uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDzL41e MPGGsaH4WstFvbRta8YXxOoX1zZQzSyx/YkllYu6E4BJOBxjCjAAFeK3GDlOa2PSoRdSSgilpvhX 4E6hFZ+EJPB2mXGo+Witf21pbCQs3Adh5O3JNehQwlWcfb1ZKMf0PRcMO/3ahf0OcuvDdt8IfjP4 Vvvh7eQPbxavBYagtzY2qPtkmWJmSSKBCoBYDIbcDgjGK2xWFj9VVWLv10PPrUlSqWjf5nsv/DTv 7Xf/AEUTwr/3w3+NeP7Zd5fh/kc2nkc/ZeH4teHgPW5JZwdIkOYp15ZZrFI2BPfHBB9KmunaUVbW 35no5ZDnrXfRM9f0/wAGaTZxNq81pCDaxFYABgFugf8ADNdnLL6q6aPYUbVE2eHfGG3g0TTNR1R0 R5dN1j7Wh9WjkSUDPoSq16lbDThho0pabnn46UKjnNHx/wD8NA/ED/n7t/8Avz/9euD6lA8HnR9r eB727Tw5psUtjcLJYYW5jMRVoWjVFdWXAwQVYEdcgjrXlVOepPZ7nrYCfsqifkd9d/EKLVbF9Lgh t5o5kMTo0uMg8EYxXvULqCV7P+up6cqsakrHhfxllKeGdb0Eh7fz3NwigGVkU7dxwBnHyn6V7GYO boLq1Y8fESUOaKejPlD/AIU14/8A+ie+Nf8AwQT/APxNeRzM8qx9r/tM/wDJwfjf/r9/9pR1cvhN aPxng+rf8f1z/v8A9KeF6HTW+Jlj4d/8lN8L/wDYYsf/AEoSvWq9Dglsz9p68sD/2Q== --e89a8ff1cceceb3b1c04b63aa914-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: Minor org mode for achieve code folding effects Date: Wed, 11 Jan 2012 08:43:09 +0100 Message-ID: <87ehv6it0y.fsf@tsdh.uni-koblenz.de> References: <4F0CD92F.9030004@therogoffs.com> <4F0CE424.7020409@therogoffs.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:59199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rksq4-0006IZ-Ci for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 02:43:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rksq3-00020U-BO for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 02:43:16 -0500 Received: from deliver.uni-koblenz.de ([141.26.64.15]:34219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rksq3-00020E-6r for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 02:43:15 -0500 In-Reply-To: (Leo Alekseyev's message of "Wed, 11 Jan 2012 00:23:01 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Leo Alekseyev Cc: emacs-orgmode@gnu.org Leo Alekseyev writes: > I've done a little bit of digging into how Tassilo's code works, and > realized that it's somewhat broken in the following way: if a mode > provides its own outline-level function, chances are, his code will > break (this is why c-mode doesn't work). Even if default > outline-level is used, it will determine the level incorrectly since > it just counts characters in the current outline regex. Yes, I was satisfied with having different colors. But thanks a lot for the improved version! Bye, Tassilo From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Minor org mode for achieve code folding effects Date: Wed, 11 Jan 2012 14:56:32 +0000 Message-ID: <877h0ycmov.fsf@ucl.ac.uk> References: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl0Zw-0000Nd-Pw for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:59:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rl0Zp-0007cT-Ia for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:59:08 -0500 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:62460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl0Zp-0007Zs-Dc for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 10:59:01 -0500 In-Reply-To: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> (Giovanni Giorgi's message of "Mon, 09 Jan 2012 16:14:15 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giovanni Giorgi Cc: Emacs orgmode Giovanni Giorgi writes: > > > Hi all, > I'd like to edit some ruby/python/shell script using > functions folding. > > I'd like to get a way to fold functions or method. Giovanni, I wonder, having thought about this some more, whether using org mode is the correct solution? (as much as I like org!) There are other solutions that may work /out of the box/ as you want. This is *emacs* we are talking about after all! For instance, when I was doing a lot of Java programming, I used hideshow.el all the time to hide block and function bodies. Works very well (although the default key bindings are annoying to me). Have a look! It's a standard package in emacs, at least in Emacs 24 but much earlier than that I believe. There's a small add-on called hideshow-org.el which may be useful as well: ,---- | ;;; hideshow-org.el - Provides org-mode like hide and show for hideshow.el | ;; | ;; Copyright (C) 2009 Shane Celis | ;; | ;; Author: Shane Celis `---- Have a search for that; if you can't find it, I can send you my copy but there may be a more up to date one on the web somewhere... HTH, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1 : using Org-mode version 7.8.03 (release_7.8.03.76.ga9c15) From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Alekseyev Subject: Re: Minor org mode for achieve code folding effects Date: Wed, 11 Jan 2012 20:12:12 -0600 Message-ID: References: <868da41d9950ca4a287a97c02084c28c@mail.webfaction.com> <877h0ycmov.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlA9H-0001cL-4B for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 21:12:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlA9G-0004Bc-0k for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 21:12:15 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:46923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlA9F-0004BY-QM for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 21:12:13 -0500 Received: by pbcc4 with SMTP id c4so38211pbc.0 for ; Wed, 11 Jan 2012 18:12:12 -0800 (PST) In-Reply-To: <877h0ycmov.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Giovanni Giorgi , Emacs orgmode > For instance, when I was doing a lot of Java programming, I used > hideshow.el all the time to hide block and function bodies. =A0Works very > well (although the default key bindings are annoying to me). =A0Have a > look! =A0It's a standard package in emacs, at least in Emacs 24 but much > earlier than that I believe. > > There's a small add-on called hideshow-org.el which may be useful as > well: Having read the OP, I'll second Eric's vote for hideshow-org. It's a better solution for folding functions. However, the combination of org/outline-minor-mode/Tassilo's code works well for splitting a file into foldable sections. Incidentally, you can use both of these methods at the same time; they don't conflict too much. --l From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rogoff Subject: Re: Minor org mode for achieve code folding effects Date: Thu, 12 Jan 2012 14:58:07 -0800 Message-ID: <4F0F657F.8050406@therogoffs.com> References: CADzxs1nkW_KO_n7RsTtO_W2nAvyUvoKGy+FgztaRFiFyuh44ug@mail.gmail.com <4F0CD92F.9030004@therogoffs.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------060905030503010101010308" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlTb3-000533-Ch for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:58:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlTb1-0003MV-GZ for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:58:12 -0500 Received: from oproxy9.bluehost.com ([69.89.24.6]:39652) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1RlTb1-0003MH-7p for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 17:58:11 -0500 Received: from ip68-228-84-160.oc.oc.cox.net ([68.228.84.160] helo=therogoffs.local) by box775.bluehost.com with esmtpa (Exim 4.76) (envelope-from ) id 1RlTay-0004YN-Ke for emacs-orgmode@gnu.org; Thu, 12 Jan 2012 15:58:08 -0700 In-Reply-To: <4F0CD92F.9030004@therogoffs.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------060905030503010101010308 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Carlos Russo gmail.com> writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. I have all this working and it's great. But... This is using outline-minor-mode. Like Giovanni, who started this thread, I'm used to orgmode, which is a little different although it uses outline mode. I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode. I got a little figured out, but got lost. I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right. I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap. It looks right. For example, c-h k TAB gives this: runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function. It is bound to . (orgstruct-hijacker-command-102 ARG) In Structure, run `org-cycle'. Outside of structure, run the binding of `[(tab)]' or ` '. However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle. I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code like this: (when (eq major-mode 'emacs-lisp-mode) (setq outline-regexp ";; [*]+ ")) (when (eq major-mode 'verilog-mode) (setq outline-regexp "\\s-*// [*]+ ")) Help Please! Thanks! David --------------060905030503010101010308 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Carlos Russo <mestre.adamastor <at> gmail.com> writes:
I have used both Carsten's and Eric's solution, as well as
hideshow-org (https://github.com/secelis/hideshow-org), which works
rather well and deserves a mention.

Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience
functions to set the outline minor mode regexps to correspond to the
current comment syntax.  Thus, if I'm (for instance) in shell-script
mode, # * and # ** become the outline level 1 and 2 markers.

I have all this working and it's great.  But...    This is using outline-minor-mode.  Like Giovanni, who started this thread,  I'm used to orgmode, which is a little different although it uses outline mode.  I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode.  I got a little figured out, but got lost.  I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right.  I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap.  It looks right. For example, c-h k TAB gives this:

<tab> runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function.
It is bound to <tab>.
(orgstruct-hijacker-command-102 ARG)
In Structure, run `org-cycle'.
Outside of structure, run the binding of `[(tab)]' or `    '.

However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle.

I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code like this:
(when (eq major-mode 'emacs-lisp-mode)
  (setq outline-regexp ";; [*]+ "))
(when (eq major-mode 'verilog-mode)
  (setq outline-regexp "\\s-*// [*]+ "))

Help Please!

Thanks!

 David

--------------060905030503010101010308-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rogoff Subject: Re: Minor org mode for achieve code folding effects Date: Mon, 16 Jan 2012 18:19:00 +0000 (UTC) Message-ID: References: CADzxs1nkW_KO_n7RsTtO_W2nAvyUvoKGy+FgztaRFiFyuh44ug@mail.gmail.com <4F0CD92F.9030004@therogoffs.com> <4F0F657F.8050406@therogoffs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rmr9L-0006eb-8V for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 13:19:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rmr9I-0002Jg-UQ for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 13:19:19 -0500 Received: from lo.gmane.org ([80.91.229.12]:36311) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rmr9I-0002JQ-Lf for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 13:19:16 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rmr9F-0001GV-3s for emacs-orgmode@gnu.org; Mon, 16 Jan 2012 19:19:13 +0100 Received: from pat.qlogic.com ([198.70.193.2]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jan 2012 19:19:13 +0100 Received: from david by pat.qlogic.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Jan 2012 19:19:13 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org David Rogoff therogoffs.com> writes: > Carlos Russo gmail.com> writes: >> I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. >> Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. > > I have all this working and it's great. But... This is using outline-minor- mode. Like Giovanni, who started this thread, I'm used to orgmode, which is a little different although it uses outline mode. I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode. I got a little figured out, but got lost. > I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right. I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap. It looks right. For example, c-h k TAB gives this: > runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function. It is bound to . > (orgstruct-hijacker-command-102 ARG) > In Structure, run `org-cycle'. > Outside of structure, run the binding of `[(tab)]' or ` '. > > However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle. > > I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code (for now) like this: > > (when (eq major-mode 'emacs-lisp-mode) > (setq outline-regexp ";; [*]+ ")) > (when (eq major-mode 'verilog-mode) > (setq outline-regexp "\\s-*// [*]+ ")) Anyone?