emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org mode in multi-mode
@ 2011-01-01 18:39 Hopsing K
  0 siblings, 0 replies; 2+ messages in thread
From: Hopsing K @ 2011-01-01 18:39 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1081 bytes --]

I am trying to use org-mode and c-mode together with using the
Two-Mode-Mode (http://www.emacswiki.org/cgi-bin/wiki/MultipleModes). I'd
like to embed org-mode comments
inside a c file, using org-mode for commenting c code,
something that would be quite useful I thought.
something like this
-------
/*<org>
* Description
  ** TODO write

</org>*/

int func1() {
  int i = 0;
}
------
The two-mode-mode.el defines the default mode to be
c-mode and the <org>..</org> chunks to be org-mode.
The problem now is that the * headers will fold past the
</org> marker. My question is:
 - is there another multi-mode that works with org
 - is there a #break style tag in org-mode that
   lets me define a section end: i.e.:
   <org>
   * Description
      ** TODO write
      #break
      This belongs to Description.
   #break
  not folded
   </org>

  Where I can define a subsection to end. When I then for instance TAB on
"** TODO write" only the
      ** TODO write
      #break
will fold. If I TAB on "* Description" only the part up till "not folded"
will fold.


-- Greetings Konrad

[-- Attachment #1.2: Type: text/html, Size: 1398 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* RE: org mode in multi-mode
@ 2011-01-02 19:42 Hopsing K
  0 siblings, 0 replies; 2+ messages in thread
From: Hopsing K @ 2011-01-02 19:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 383 bytes --]

Appended is a patch to implement kind of a "break" on
a child entry:

-- a.org ---
a
a
* s1
b
b
* #
c
c
-----------

When doing a TAB on "* s1" only the "b" section will fold.
"* #" (a heading with name "#") is implemented as a
child that is made visible by default when when unfolding.
It is also shown by default when cycling globally.
Works at all sublevels.

-- Greetings Konrad

[-- Attachment #1.2: Type: text/html, Size: 536 bytes --]

[-- Attachment #2: e.diff --]
[-- Type: text/x-patch, Size: 1806 bytes --]

--- emacs-23.2/lisp/org/org.el	2010-04-04 00:26:08.000000000 +0200
+++ src/c51/mk/org.el	2011-01-02 20:26:10.266860827 +0100
@@ -5245,6 +5245,8 @@
 (defun org-cycle-internal-local ()
   "Do the local cycling action."
   (org-back-to-heading)
+  (cond 
+   ((not (looking-at (concat outline-regexp "\s*#" )))
   (let ((goal-column 0) eoh eol eos level has-children children-skipped)
     ;; First, some boundaries
     (save-excursion
@@ -5318,7 +5320,7 @@
       (hide-subtree)
       (message "FOLDED")
       (setq org-cycle-subtree-status 'folded)
-      (run-hook-with-args 'org-cycle-hook 'folded)))))
+      (run-hook-with-args 'org-cycle-hook 'folded)))))))
 
 ;;;###autoload
 (defun org-global-cycle (&optional arg)
--- emacs-23.2/lisp/outline.el	2010-04-04 00:26:04.000000000 +0200
+++ src/c51/mk/outline.el	2011-01-02 20:35:17.303609833 +0100
@@ -913,8 +913,15 @@
       ;; Then unhide the top level headers.
       (outline-map-region
        (lambda ()
-	 (if (<= (funcall outline-level) levels)
-	     (outline-show-heading)))
+	 (if (<= (funcall outline-level) level)
+	       (if (looking-at (concat outline-regexp "\s*#" ))
+		   (progn
+		     (outline-show-heading )
+		     (show-entry ))
+		 (outline-show-heading))))
+;;       (lambda ()
+;;	 (if (<= (funcall outline-level) levels)
+;;	     (outline-show-heading)))
        beg end)))
   (run-hooks 'outline-view-change-hook))
 
@@ -994,7 +1001,11 @@
       (outline-map-region
        (lambda ()
 	 (if (<= (funcall outline-level) level)
-	     (outline-show-heading)))
+	       (if (looking-at (concat outline-regexp "\s*#" ))
+		   (progn
+		     (outline-show-heading )
+		     (show-entry ))
+		   (outline-show-heading))))
        (point)
        (progn (outline-end-of-subtree)
 	      (if (eobp) (point-max) (1+ (point)))))))

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2011-01-02 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-01 18:39 org mode in multi-mode Hopsing K
  -- strict thread matches above, loose matches on Subject: below --
2011-01-02 19:42 Hopsing K

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).