emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Proposing a new way for org-get-level-face to behave (customizable)
@ 2010-11-10 13:15 Jonathan BISSON
  2010-11-12 19:39 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan BISSON @ 2010-11-10 13:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I'm new to this list, and an 6-8 month (or so) user of org-mode.

I needed to get my outline-level-9 and further to look at least like the
outline-level-8 and not cycling to outline-level-1 as my customization
for this one got a bigger face. And I don't want a child to be bigger
than its parent for visibility purpose.

So I'm proposing this (I could provide a patch but as I'm not using the
very last version of orgmode neither the git one, I thought it was
useless to do so):

(defcustom org-cycle-level-faces t
  "If non-nil, level styles cycle after level org-n-level-faces, so
level org-n-level-faces+1 is styled like level 1. If nil, then all
levels >=org-n-level-faces are styled like level org-n-level-faces"
  :group 'org-appearance
  :type 'boolean)

(defun org-get-level-face (n)
  "Get the right face for match N in font-lock matching of headlines."
  (setq org-l (- (match-end 2) (match-beginning 1) 1))
  (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
  (if org-cycle-level-faces
  (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces))
  (setq org-f (nth (1- (if (< org-l org-n-level-faces) org-l
org-n-level-faces)) org-level-faces))
  )
  (cond
   ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
   ((eq n 2) org-f)
   (t (if org-level-color-stars-only nil org-f))))


Hope it will be of some interest for some of you.

Thanks to quicksilver on irc.freenode.net #org-mode for the help.


Cheers.

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

* Re: Proposing a new way for org-get-level-face to behave (customizable)
  2010-11-10 13:15 Proposing a new way for org-get-level-face to behave (customizable) Jonathan BISSON
@ 2010-11-12 19:39 ` Carsten Dominik
  2010-11-12 21:47   ` Jonathan BISSON
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-11-12 19:39 UTC (permalink / raw)
  To: Jonathan BISSON; +Cc: emacs-orgmode

Ji Jonathan,

thanks you for this, I have checked in a slightly modified version of  
your patch.

Thanks

- Carsten

On Nov 10, 2010, at 7:15 AM, Jonathan BISSON wrote:

> Hi,
>
> I'm new to this list, and an 6-8 month (or so) user of org-mode.
>
> I needed to get my outline-level-9 and further to look at least like  
> the
> outline-level-8 and not cycling to outline-level-1 as my customization
> for this one got a bigger face. And I don't want a child to be bigger
> than its parent for visibility purpose.
>
> So I'm proposing this (I could provide a patch but as I'm not using  
> the
> very last version of orgmode neither the git one, I thought it was
> useless to do so):
>
> (defcustom org-cycle-level-faces t
>  "If non-nil, level styles cycle after level org-n-level-faces, so
> level org-n-level-faces+1 is styled like level 1. If nil, then all
> levels >=org-n-level-faces are styled like level org-n-level-faces"
>  :group 'org-appearance
>  :type 'boolean)
>
> (defun org-get-level-face (n)
>  "Get the right face for match N in font-lock matching of headlines."
>  (setq org-l (- (match-end 2) (match-beginning 1) 1))
>  (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
>  (if org-cycle-level-faces
>  (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces))
>  (setq org-f (nth (1- (if (< org-l org-n-level-faces) org-l
> org-n-level-faces)) org-level-faces))
>  )
>  (cond
>   ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
>   ((eq n 2) org-f)
>   (t (if org-level-color-stars-only nil org-f))))
>
>
> Hope it will be of some interest for some of you.
>
> Thanks to quicksilver on irc.freenode.net #org-mode for the help.
>
>
> Cheers.
>
>
>
> _______________________________________________
> 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] 4+ messages in thread

* Re: Proposing a new way for org-get-level-face to behave (customizable)
  2010-11-12 19:39 ` Carsten Dominik
@ 2010-11-12 21:47   ` Jonathan BISSON
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan BISSON @ 2010-11-12 21:47 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On Fri, 2010-11-12 at 13:39 -0600, Carsten Dominik wrote:
> Ji Jonathan,
> 
> thanks you for this, I have checked in a slightly modified version of  
> your patch.
> 
> Thanks
> 
> - Carsten
> 
Hope this would be of some help. 

I was thinking about ways to add as much outlines as we wanted. Or ways
to have a cycling through a defined list of outlines (maybe I can start
by doing a cycling through defined elements (like looping through 4-8
only).
I'm looking to the code and git of org in order to understand a little
bit more the philosophy of the project.

Thanks !

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

* Proposing a new way for org-get-level-face to behave (customizable)
@ 2010-11-09 16:42 Jonathan BISSON
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan BISSON @ 2010-11-09 16:42 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I needed to get my outline-level-9 and further to look at least like the
outline-level-8 and not cycling to outline-level-1 as my customization
for this one got a bigger face. And I don't want a child to be bigger
than its parent for visibility purpose.

So I'm proposing this (I could provide a patch but as I'm not using the
very last version of orgmode neither the git one, I thought it was
useless to do so):

(defcustom org-cycle-level-faces t
  "If non-nil, level styles cycle after level org-n-level-faces, so
level org-n-level-faces+1 is styled like level 1. If nil, then all
levels >=org-n-level-faces are styled like level org-n-level-faces"
  :group 'org-appearance
  :type 'boolean)

(defun org-get-level-face (n)
  "Get the right face for match N in font-lock matching of headlines."
  (setq org-l (- (match-end 2) (match-beginning 1) 1))
  (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
  (if org-cycle-level-faces
  (setq org-f (nth (% (1- org-l) org-n-level-faces) org-level-faces))
  (setq org-f (nth (1- (if (< org-l org-n-level-faces) org-l
org-n-level-faces)) org-level-faces))
  )
  (cond
   ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
   ((eq n 2) org-f)
   (t (if org-level-color-stars-only nil org-f))))


Hope it will be of some interest for some of you.

Thanks to quicksilver on irc.freenode.net #org-mode for the help.


Cheers.

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

end of thread, other threads:[~2010-11-12 21:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-10 13:15 Proposing a new way for org-get-level-face to behave (customizable) Jonathan BISSON
2010-11-12 19:39 ` Carsten Dominik
2010-11-12 21:47   ` Jonathan BISSON
  -- strict thread matches above, loose matches on Subject: below --
2010-11-09 16:42 Jonathan BISSON

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).