emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] Add another bullet type (→)
@ 2009-03-13 22:58 Martin Pohlack
  2009-03-14 10:07 ` Carsten Dominik
  2009-03-16  1:04 ` Daniel Clemente
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Pohlack @ 2009-03-13 22:58 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 670 bytes --]

Hi All,

I tend to use a right arrow (→, U2192) from time to time in plain
lists to separate normal item from conclusions / next actions etc.:

  - Topic
    - Fact 1
    - Fact 2
    → Conclusion

I would appreciate it if org-mode could support this type of bullet
point.  The attached patch implements what I had in mind.

I'm not sure if the adaptation in /org-cycle-list-bullet/ is useful
for others --- I don't use the arrow for many items in a list, but
only single ones --- But I included it in the patch for completeness.

(Also, there may be better ways to encode unicode chars in regexp than
using the utf-8 encoding, that the patch uses.)

Cheers,
Martin

[-- Attachment #2: org-list-arrow.diff --]
[-- Type: text/plain, Size: 4146 bytes --]

--- /home/mp26/src/org-mode/lisp/org-list.el	2009-03-13 23:42:05.000000000 +0100
+++ org-list.el	2009-03-13 19:57:51.000000000 +0100
@@ -118,7 +118,7 @@
   :type 'integer)
 
 (defvar org-list-beginning-re
-  "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +\\(.*\\)$")
+  "^\\([ \t]*\\)\\([-+*→]\\|[0-9]+[.)]\\) +\\(.*\\)$")
 
 (defcustom org-list-radio-list-templates
   '((latex-mode "% BEGIN RECEIVE ORGLST %n
@@ -158,9 +158,9 @@
       (goto-char (point-at-bol))
       (looking-at
        (cond
-	((eq llt t)  "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
-	((= llt ?.)  "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
-	((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+	((eq llt t)  "\\([ \t]*\\([-+→]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+	((= llt ?.)  "\\([ \t]*\\([-+→]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
+	((= llt ?\)) "\\([ \t]*\\([-+→]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \\|$\\)")
 	(t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))))))
 
 (defun org-at-item-bullet-p ()
@@ -205,7 +205,7 @@
 				  (looking-at "[ \t]*$")))))
 	   (timerp (and descp
 			(save-match-data
-			  (string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$"
+			  (string-match "^[-+*→][ \t]+[0-9]+:[0-9]+:[0-9]+$"
 					descp))))
 	   (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
 				(match-end 0)))
@@ -337,7 +337,7 @@
 	  (condition-case nil (org-back-to-heading t)
 	    (error (throw 'exit nil)))
 	  (unless (org-entry-get nil "ORDERED") (throw 'exit nil))
-	  (if (re-search-forward "^[ \t]*[-+*0-9.)] \\[[- ]\\]" end t)
+	  (if (re-search-forward "^[ \t]*[-+*→0-9.)] \\[[- ]\\]" end t)
 	      (org-current-line)
 	    nil))))))
 
@@ -360,7 +360,7 @@
 	  (end (move-marker (make-marker)
 			    (progn (outline-next-heading) (point))))
 	  (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
-	  (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
+	  (re-box "^[ \t]*\\([-+→*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
 	  (re-find (concat re "\\|" re-box))
 	  beg-cookie end-cookie is-percent c-on c-off lim
 	  eline curr-ind next-ind continue-from startsearch
@@ -674,7 +674,7 @@
   "Cycle through the different itemize/enumerate bullets.
 This cycle the entire list level through the sequence:
 
-   `-'	->  `+'	 ->  `*'  ->  `1.'  ->	`1)'
+   `-'  ->  `+'  ->  `→'  ->  `*'  ->  `1.'  ->  `1)'
 
 If WHICH is a string, use that as the new bullet.  If WHICH is an integer,
 0 means `-', 1 means `+' etc."
@@ -688,11 +688,12 @@
 	 new old)
      (setq new (cond
 		((and (numberp which)
-		      (nth (1- which) '("-" "+" "*" "1." "1)"))))
+		      (nth (1- which) '("-" "+" "→" "*" "1." "1)"))))
 		((string-match "-" current) (if prevp "1)" "+"))
 		((string-match "\\+" current)
-		 (if prevp "-" (if (looking-at "\\S-") "1." "*")))
-		((string-match "\\*" current) (if prevp "+" "1."))
+		 (if prevp "-" (if (looking-at "\\S-") "1." "→")))
+		((string-match "→" current) (if prevp "+" "*"))
+		((string-match "\\*" current) (if prevp "→" "1."))
 		((string-match "\\." current)
 		 (if prevp (if (looking-at "\\S-") "+" "*") "1)"))
 		((string-match ")" current) (if prevp "1." "-"))
@@ -929,7 +930,7 @@
        ((and (condition-case nil (progn (org-previous-item) t)
 	       (error nil))
 	     (or (forward-char 1) t)
-	     (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
+	     (re-search-forward "^\\([ \t]*\\([-+→]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
 	(setq ind-down (org-get-indentation)))
        ((and (goto-char pos)
 	     (org-at-item-p))
@@ -956,8 +957,8 @@
 	       (setq itemsep "[0-9]+\\(?:\\.\\|)\\)"
 		     ltype 'ordered))
 	      ((string-match "^.*::" (match-string 0))
-	       (setq itemsep "[-+]" ltype 'descriptive))
-	      (t (setq itemsep "[-+]" ltype 'unordered))))
+	       (setq itemsep "[-+→]" ltype 'descriptive))
+	      (t (setq itemsep "[-+→]" ltype 'unordered))))
       (let* ((indent1 (match-string 1))
 	     (nextitem (save-excursion
 			 (save-match-data

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

_______________________________________________
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

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

* Re:  [Patch] Add another bullet type (→)
  2009-03-13 22:58 [Patch] Add another bullet type (→) Martin Pohlack
@ 2009-03-14 10:07 ` Carsten Dominik
  2009-03-16  1:04 ` Daniel Clemente
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-03-14 10:07 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: emacs-orgmode

Hi Martin,

thank you for the patch.

I will, however, not install it, at least not in the present form.

Org-mode is hard-core plain text, and for me this also means that
all the control parts that have special meaning should be plain
ASCII characters.  The only exception is that tags are allowed
contain characters specific for other languages.  So I do not
want to hard-code a non-ASCII character in this way.

I would consider a patch which introduces a variable listing
the allowed bullet characters.  If you want to make such a patch,
it will be a non-trivial patch and you would have to sign
over copyright to the FSF so that I can include it.

Sorry for making this so hard....

One thing I would worry about is this:  Org sometimes normalized
all bullets in a list to have the same bullet type.  This would
interfere with your idea of having one special bullet in an
otherwise normal list.  Has this never cause problems in your setup?

- Carsten

On Mar 13, 2009, at 11:58 PM, Martin Pohlack wrote:

> Hi All,
>
> I tend to use a right arrow (→, U2192) from time to time in plain
> lists to separate normal item from conclusions / next actions etc.:
>
>  - Topic
>    - Fact 1
>    - Fact 2
>    → Conclusion
>
> I would appreciate it if org-mode could support this type of bullet
> point.  The attached patch implements what I had in mind.
>
> I'm not sure if the adaptation in /org-cycle-list-bullet/ is useful
> for others --- I don't use the arrow for many items in a list, but
> only single ones --- But I included it in the patch for completeness.
>
> (Also, there may be better ways to encode unicode chars in regexp than
> using the utf-8 encoding, that the patch uses.)
>
> Cheers,
> Martin
> --- /home/mp26/src/org-mode/lisp/org-list.el	2009-03-13  
> 23:42:05.000000000 +0100
> +++ org-list.el	2009-03-13 19:57:51.000000000 +0100
> @@ -118,7 +118,7 @@
>   :type 'integer)
>
> (defvar org-list-beginning-re
> -  "^\\([ \t]*\\)\\([-+*]\\|[0-9]+[.)]\\) +\\(.*\\)$")
> +  "^\\([ \t]*\\)\\([-+*→]\\|[0-9]+[.)]\\) +\\(.*\\)$")
>
> (defcustom org-list-radio-list-templates
>   '((latex-mode "% BEGIN RECEIVE ORGLST %n
> @@ -158,9 +158,9 @@
>       (goto-char (point-at-bol))
>       (looking-at
>        (cond
> -	((eq llt t)  "\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\\) 
> \\( \\|$\\)")
> -	((= llt ?.)  "\\([ \t]*\\([-+]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\\)\ 
> \( \\|$\\)")
> -	((= llt ?\)) "\\([ \t]*\\([-+]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\( \ 
> \|$\\)")
> +	((eq llt t)  "\\([ \t]*\\([-+→]\\|\\([0-9]+[.)]\\)\\)\\|[ \t]+\\*\ 
> \)\\( \\|$\\)")
> +	((= llt ?.)  "\\([ \t]*\\([-+→]\\|\\([0-9]+\\.\\)\\)\\|[ \t]+\\*\ 
> \)\\( \\|$\\)")
> +	((= llt ?\)) "\\([ \t]*\\([-+→]\\|\\([0-9]+))\\)\\|[ \t]+\\*\\)\\ 
> ( \\|$\\)")
> 	(t (error "Invalid value of `org-plain-list-ordered-item- 
> terminator'")))))))
>
> (defun org-at-item-bullet-p ()
> @@ -205,7 +205,7 @@
> 				  (looking-at "[ \t]*$")))))
> 	   (timerp (and descp
> 			(save-match-data
> -			  (string-match "^[-+*][ \t]+[0-9]+:[0-9]+:[0-9]+$"
> +			  (string-match "^[-+*→][ \t]+[0-9]+:[0-9]+:[0-9]+$"
> 					descp))))
> 	   (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
> 				(match-end 0)))
> @@ -337,7 +337,7 @@
> 	  (condition-case nil (org-back-to-heading t)
> 	    (error (throw 'exit nil)))
> 	  (unless (org-entry-get nil "ORDERED") (throw 'exit nil))
> -	  (if (re-search-forward "^[ \t]*[-+*0-9.)] \\[[- ]\\]" end t)
> +	  (if (re-search-forward "^[ \t]*[-+*→0-9.)] \\[[- ]\\]" end t)
> 	      (org-current-line)
> 	    nil))))))
>
> @@ -360,7 +360,7 @@
> 	  (end (move-marker (make-marker)
> 			    (progn (outline-next-heading) (point))))
> 	  (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
> -	  (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
> +	  (re-box "^[ \t]*\\([-+→*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
> 	  (re-find (concat re "\\|" re-box))
> 	  beg-cookie end-cookie is-percent c-on c-off lim
> 	  eline curr-ind next-ind continue-from startsearch
> @@ -674,7 +674,7 @@
>   "Cycle through the different itemize/enumerate bullets.
> This cycle the entire list level through the sequence:
>
> -   `-'	->  `+'	 ->  `*'  ->  `1.'  ->	`1)'
> +   `-'  ->  `+'  ->  `→'  ->  `*'  ->  `1.'  ->  `1)'
>
> If WHICH is a string, use that as the new bullet.  If WHICH is an  
> integer,
> 0 means `-', 1 means `+' etc."
> @@ -688,11 +688,12 @@
> 	 new old)
>      (setq new (cond
> 		((and (numberp which)
> -		      (nth (1- which) '("-" "+" "*" "1." "1)"))))
> +		      (nth (1- which) '("-" "+" "→" "*" "1." "1)"))))
> 		((string-match "-" current) (if prevp "1)" "+"))
> 		((string-match "\\+" current)
> -		 (if prevp "-" (if (looking-at "\\S-") "1." "*")))
> -		((string-match "\\*" current) (if prevp "+" "1."))
> +		 (if prevp "-" (if (looking-at "\\S-") "1." "→")))
> +		((string-match "→" current) (if prevp "+" "*"))
> +		((string-match "\\*" current) (if prevp "→" "1."))
> 		((string-match "\\." current)
> 		 (if prevp (if (looking-at "\\S-") "+" "*") "1)"))
> 		((string-match ")" current) (if prevp "1." "-"))
> @@ -929,7 +930,7 @@
>        ((and (condition-case nil (progn (org-previous-item) t)
> 	       (error nil))
> 	     (or (forward-char 1) t)
> -	     (re-search-forward "^\\([ \t]*\\([-+]\\|\\([0-9]+[.)]\\)\\)\\| 
> [ \t]+\\*\\)\\( \\|$\\)" bolpos t))
> +	     (re-search-forward "^\\([ \t]*\\([-+→]\\|\\([0-9]+[.)]\\)\\)\ 
> \|[ \t]+\\*\\)\\( \\|$\\)" bolpos t))
> 	(setq ind-down (org-get-indentation)))
>        ((and (goto-char pos)
> 	     (org-at-item-p))
> @@ -956,8 +957,8 @@
> 	       (setq itemsep "[0-9]+\\(?:\\.\\|)\\)"
> 		     ltype 'ordered))
> 	      ((string-match "^.*::" (match-string 0))
> -	       (setq itemsep "[-+]" ltype 'descriptive))
> -	      (t (setq itemsep "[-+]" ltype 'unordered))))
> +	       (setq itemsep "[-+→]" ltype 'descriptive))
> +	      (t (setq itemsep "[-+→]" ltype 'unordered))))
>       (let* ((indent1 (match-string 1))
> 	     (nextitem (save-excursion
> 			 (save-match-data
> _______________________________________________
> 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

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

* Re: [Patch] Add another bullet type (→)
  2009-03-13 22:58 [Patch] Add another bullet type (→) Martin Pohlack
  2009-03-14 10:07 ` Carsten Dominik
@ 2009-03-16  1:04 ` Daniel Clemente
  2009-03-16  5:52   ` Carsten Dominik
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Clemente @ 2009-03-16  1:04 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: emacs-orgmode

El vie, mar 13 2009, Martin Pohlack va escriure:
> Hi All,
>
> I tend to use a right arrow (→, U2192) from time to time in plain
> lists to separate normal item from conclusions / next actions etc.:

  Hey, me too! I use exactly → to hightlight items, but also to mark implications (I use ∴ for conclusions); I have many keys for that type of useful symbols. :-) (or should I write ☺…?)

>
>   - Topic
>     - Fact 1
>     - Fact 2
>     → Conclusion

  However, I have done it always like this:

   - Topic
     - Fact 1
     - Fact 2
     - → Conclusion

  So it is still a list, but I know this item is special. In this way I can also use the symbol in headings:

* some task
** option1
** → option2 (this is what I did)


  I still have to check org-choose.el, which provides a way to mark the chosen option between many alternatives in a more formal way.

  Greetings,

Daniel

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

* Re:  [Patch] Add another bullet type (→)
  2009-03-16  1:04 ` Daniel Clemente
@ 2009-03-16  5:52   ` Carsten Dominik
  2009-03-16  8:34     ` Martin Pohlack
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2009-03-16  5:52 UTC (permalink / raw)
  To: Daniel Clemente; +Cc: Martin Pohlack, emacs-orgmode


On Mar 16, 2009, at 2:04 AM, Daniel Clemente wrote:

> El vie, mar 13 2009, Martin Pohlack va escriure:
>> Hi All,
>>
>> I tend to use a right arrow (→, U2192) from time to time in plain
>> lists to separate normal item from conclusions / next actions etc.:
>
>  Hey, me too! I use exactly → to hightlight items, but also to mark  
> implications (I use ∴ for conclusions); I have many keys for that  
> type of useful symbols. :-) (or should I write ☺…?)
>
>>
>>  - Topic
>>    - Fact 1
>>    - Fact 2
>>    → Conclusion
>  However, I have done it always like this:
>
>   - Topic
>     - Fact 1
>     - Fact 2
>     - → Conclusion


This is, actually, a much better idea, so let's not go there
and make the item bullets configurable.  It is possible that
too much confusion will arrise from it.

It is also, in my opinion, quite visible!  If you want to make
it still more visible, you can try something like

(font-lock-add-keywords 'org-mode
'(("^\\([ \t]*[-*+]\\|^\\*+\\)[ \t]+→.*"
    0 font-lock-warning-face prepend)))

- Carsten




>
>
>  So it is still a list, but I know this item is special. In this way  
> I can also use the symbol in headings:
>
> * some task
> ** option1
> ** → option2 (this is what I did)
>
>
>  I still have to check org-choose.el, which provides a way to mark  
> the chosen option between many alternatives in a more formal way.
>
>  Greetings,
>
> Daniel
>
>
> _______________________________________________
> 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

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

* Re: [Patch] Add another bullet type (→)
  2009-03-16  5:52   ` Carsten Dominik
@ 2009-03-16  8:34     ` Martin Pohlack
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Pohlack @ 2009-03-16  8:34 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik wrote:
> On Mar 16, 2009, at 2:04 AM, Daniel Clemente wrote:

[...]

>>  However, I have done it always like this:
>>
>>   - Topic
>>     - Fact 1
>>     - Fact 2
>>     - → Conclusion
> 
> 
> This is, actually, a much better idea, so let's not go there
> and make the item bullets configurable.  It is possible that
> too much confusion will arrise from it.

This sounds reasonable, thanks.

Cheers,
Martin

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

end of thread, other threads:[~2009-03-16  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-13 22:58 [Patch] Add another bullet type (→) Martin Pohlack
2009-03-14 10:07 ` Carsten Dominik
2009-03-16  1:04 ` Daniel Clemente
2009-03-16  5:52   ` Carsten Dominik
2009-03-16  8:34     ` Martin Pohlack

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