From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Rogoff Subject: Re: problem with orgstruct/outline-minor-mode with indented headlines Date: Sun, 29 Jan 2012 07:15:51 +0000 (UTC) Message-ID: References: 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]:44820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrOzb-0000Kw-KO for emacs-orgmode@gnu.org; Sun, 29 Jan 2012 02:16:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrOzZ-00079K-IW for emacs-orgmode@gnu.org; Sun, 29 Jan 2012 02:16:03 -0500 Received: from plane.gmane.org ([80.91.229.3]:36748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrOzZ-00079G-C1 for emacs-orgmode@gnu.org; Sun, 29 Jan 2012 02:16:01 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RrOzX-00064U-F7 for emacs-orgmode@gnu.org; Sun, 29 Jan 2012 08:15:59 +0100 Received: from ip68-228-84-160.oc.oc.cox.net ([68.228.84.160]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 29 Jan 2012 08:15:59 +0100 Received: from david by ip68-228-84-160.oc.oc.cox.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 29 Jan 2012 08:15:59 +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: > > Hi all. > > I'm still trying to get orgstruct to work right. One thing I > found is that I7 was getting confused with outline-magic which > set up outline-minor-mode-map but not orgstruct-mode-map. I'm > working inside verilog-mode, which uses the same "//" comment > as c. So I defined outline-regexp: > > (setq outline-regexp "\\s-*// [*]+ ") ;; any line that starts with "// " > (possibly preceeded with whitespace) and some number of stars and a space > > This works fine. I needed the whitespace in front since > verilog-mode indents comments along with code. > > The problem is when I run org-cycle on a headline. The > following headline ends up on the same line (also in > outline-minor-mode). > > TRIMMED > > What's going on? There's some confusion about the headline > level being based on the indent and the number of stars. > > I'm so close, but need help figuring out this last problem. > Anyone? I've been trying to learn how outline-mode works to modify the outline level, but I'm not quite there yet. I made my own versions of the outline-level function to try and see what's going on: (defun dhr-outline-level () "Return the depth to which a statement is nested in the outline. Point must be at the beginning of a header line. This is actually either the level specified in `outline-heading-alist' or else the number of characters matched by `outline-regexp'." (interactive) (or (cdr (assoc (match-string 0) outline-heading-alist)) (- (match-end 0) (match-beginning 0)))) (defvar dhr-outline-level 'dhr-outline-level "*Function of no args to compute a header's nesting level in an outline. It can assume point is at the beginning of a header line and that the match data reflects the `outline-regexp'.") (defun dhr-disp-ol () (interactive) (message "outline level = %d" (funcall dhr-outline-level)) ) I'm close but still not quite there and could really use a little help! Again, I had to add variable whitespace to the beginning of outline-regex since verilog-mode indents comments. I want to be able to adjust the outline-level based on where "//" starts, not from the beginning of the line. Thanks in advance for any help on this! This really makes editing my code so much easier and if I can get this last bit to work right I can convince a bunch of other ASIC engineers to use it and emacs! David