[Orgmode] Re: can the symbol for leading stars be changed?

2009-03-16 Thread Tassilo Horn
Gray Calhoun gray.calh...@gmail.com writes:

Hi Gray,

   Is there a way for users to easily replace the leading stars with
 another symbol?  In particular, I want to replace the '*' with '#' so
 that I use org mode to write pseduocode for R in outline form -- R
 uses # to designate comments and this would ensure that the headers
 wouldn't be read as code.

I guess you want to use `orgstruct-mode' in R files, right?  I also had
the idea to do that, but till now I failed.  As a workaround I use
`outline-minor-mode' and set the `outline-regexp' to comment-character
of the languageone-or-many-stars.

Here's the code from my .emacs.

--8---cut here---start-8---
(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-start ;)
  (setq comment-starter ;;))
(concat ^ comment-starter \\*+)))

(defun th-outline-minor-mode-init ()
  (interactive)
  (setq outline-regexp (th-outline-regexp)))

(add-hook 'outline-minor-mode-hook
  'th-outline-minor-mode-init)
--8---cut here---end---8---

I wonder if I cannot make `orgstruct-mode' work the same way.  I've
always thought that it uses `outline-regexp' for the cycling and stuff,
but maybe I'm wrong.  What's the correct regexp that's used for
`org-cycle'?  `org-complex-heading-regexp'?

Bye,
Tassilo



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


Re: [Orgmode] Re: can the symbol for leading stars be changed?

2009-03-16 Thread Gray Calhoun
Hi Tassilo,
  Thanks for the suggestion -- your code worked great when I loaded it
on its own, but seems to be in conflict with something else in my
.emacs file, so I'll have to tinker with it a little bit.  This seems
like an okay temporary solution, but I may look into orgstruct proper
when I have some free time.

Best,
--Gray

2009/3/16 Tassilo Horn tass...@member.fsf.org:
 Gray Calhoun gray.calh...@gmail.com writes:

 Hi Gray,

   Is there a way for users to easily replace the leading stars with
 another symbol?  In particular, I want to replace the '*' with '#' so
 that I use org mode to write pseduocode for R in outline form -- R
 uses # to designate comments and this would ensure that the headers
 wouldn't be read as code.

 I guess you want to use `orgstruct-mode' in R files, right?  I also had
 the idea to do that, but till now I failed.  As a workaround I use
 `outline-minor-mode' and set the `outline-regexp' to comment-character
 of the languageone-or-many-stars.

 Here's the code from my .emacs.

 --8---cut here---start-8---
 (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-start ;)
      (setq comment-starter ;;))
    (concat ^ comment-starter \\*+)))

 (defun th-outline-minor-mode-init ()
  (interactive)
  (setq outline-regexp (th-outline-regexp)))

 (add-hook 'outline-minor-mode-hook
          'th-outline-minor-mode-init)
 --8---cut here---end---8---

 I wonder if I cannot make `orgstruct-mode' work the same way.  I've
 always thought that it uses `outline-regexp' for the cycling and stuff,
 but maybe I'm wrong.  What's the correct regexp that's used for
 `org-cycle'?  `org-complex-heading-regexp'?

 Bye,
 Tassilo



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




-- 
Gray Calhoun

Economics Department
UC San Diego

http://gray.calhoun.googlepages.com/


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


Re: [Orgmode] Re: can the symbol for leading stars be changed?

2009-03-16 Thread Carsten Dominik


On Mar 16, 2009, at 11:04 AM, Tassilo Horn wrote:


Gray Calhoun gray.calh...@gmail.com writes:

Hi Gray,


 Is there a way for users to easily replace the leading stars with
another symbol?  In particular, I want to replace the '*' with '#' so
that I use org mode to write pseduocode for R in outline form -- R
uses # to designate comments and this would ensure that the headers
wouldn't be read as code.


I guess you want to use `orgstruct-mode' in R files, right?  I also  
had

the idea to do that, but till now I failed.  As a workaround I use
`outline-minor-mode' and set the `outline-regexp' to comment- 
character

of the languageone-or-many-stars.

Here's the code from my .emacs.

--8---cut here---start-8---
(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-start ;)
 (setq comment-starter ;;))
   (concat ^ comment-starter \\*+)))

(defun th-outline-minor-mode-init ()
 (interactive)
 (setq outline-regexp (th-outline-regexp)))

(add-hook 'outline-minor-mode-hook
 'th-outline-minor-mode-init)
--8---cut here---end---8---

I wonder if I cannot make `orgstruct-mode' work the same way.  I've
always thought that it uses `outline-regexp' for the cycling and  
stuff,

but maybe I'm wrong.  What's the correct regexp that's used for
`org-cycle'?  `org-complex-heading-regexp'?


org-cycle does use outline-regexp, so this will work fine.  However,
for much other functionality, including demotion and promotion,
stars are hard-coded.

- Carsten


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