Re: [O] org-babel for prolog

2015-05-16 Thread Lawrence Bottorff
No worries. I can wait. Thanks again for your efforts.

On Sat, May 16, 2015 at 9:28 AM, Bjarte Johansen 
bjarte.johan...@infomedia.uib.no wrote:


 On 16 May 2015, at 15:00, Lawrence Bottorff borg...@gmail.com wrote:

 I'm just a Prolog beginner, but this:

 #+begin_src prolog
 edge(a,b).
 edge(a,e).
 edge(b,d).
 edge(b,c).
 edge(c,a).
 edge(e,b).
 tedge(Node1,Node2) :-
 edge(Node1,SomeNode),
 edge(SomeNode,Node2).
 #+end_src

 keeps giving me this:

 executing Prolog code block...
 executing Prolog source code block
 org-babel-execute:prolog: Wrong type argument: char-or-string-p, ni


 Thank you for reporting a bug. I think I see what the problem is. You
 haven't defined a goal for the source block and ob-prolog doesn't guard for
 that. It should be easy to fix, but I am not sure if I will be able to do
 that before next week. If you want you can try to fix it yourself and send
 a PR on GitHub or a patch here.

 BTW, should it be

 (eval-after-load 'org
   '(require 'ob-prolog))

 or

 (eval-after-load org
   '(require 'ob-prolog))

 . . . org in quotes?


 I think both should work. I can't check right now as I only have my phone
 with me right now.


 On Thu, May 14, 2015 at 5:03 PM, Bjarte Johansen 
 bjarte.johan...@infomedia.uib.no wrote:


  On 14 May 2015, at 20:22, Puneeth Chaganti puncha...@gmail.com wrote:
 
  On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff borg...@gmail.com
 wrote:
 
  Confused by the requirement:
 
  ;; To activate ob-prolog add the following to your init.el file:
  ;;
  ;;  (eval-after-load 'org
  ;;'(require 'org-prolog))
 
 
  I'm guessing its a typo and should be ob-prolog. The file provides
 ob-prolog.

 Yes, I typed it wrong. Thank you for bringing it to my attention. I also
 discovered that it is better to use `org-babel-do-load-languages’ instead
 as well. I will change the recommendation tomorrow.

 Regards,
 Bjarte





[O] [patch] org-delete-indentation

2015-05-16 Thread Rasmus
Hi,

Due to recent controversy about Org being lacking Microsoftesque detail I
finally implemented org-delete-indentation, which is a function I have
been missing forever.

It only behaves differently from delete-indentation at headlines where it
add stuff to the headline text.  It is at least what I would expect.

Examples:

  * foo :tag:
  bar|
= (org-delete-indentation)
  * foo bar :tag:

  * foo | :tag:
   bar
= (org-delete-indentation t)
   * foo bar :tag:

—Rasmus

-- 
With monopolies the cake is a lie!
From ef242f5d599d4888cdf57e1f6a65db8406626499 Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Sat, 16 May 2015 17:19:03 +0200
Subject: [PATCH 2/2] org.el: New function org-delete-indentation

* org.el (org-delete-indentation): New function.
  (org-mode-map): Bind org-delete-indentation to M-^.
* test-org.el (test-org-delete-indentation): Test org-delete-indentation.
* ORG-NEWS: Add entry on org-delete-indentation.
---
 etc/ORG-NEWS |  3 +++
 lisp/org.el  | 25 +
 testing/lisp/test-org.el | 28 
 3 files changed, 56 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a3e1ae2..91e30f8 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -377,6 +377,9 @@ for details.
 Calling ~org-edit-footnote-reference~ (C-c ') on a footnote reference
 allows to edit its definition, as long as it is not anonymous, in
 a dedicated buffer.  It works even if buffer is currently narrowed.
+*** New function ~org-delete-indentation~ bound to ~M-^~
+Work as ~delete-indentation~ unless at heading, in which case text is
+added to headline text.
 ** Miscellaneous
 *** Strip all meta data from ITEM special property
 ITEM special property does not contain TODO, priority or tags anymore.
diff --git a/lisp/org.el b/lisp/org.el
index 93183f9..f30c25c 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19832,6 +19832,7 @@ boundaries.
 (org-defkey org-mode-map [remap comment-dwim] 'org-comment-dwim)
 (org-defkey org-mode-map [remap forward-paragraph] 'org-forward-paragraph)
 (org-defkey org-mode-map [remap backward-paragraph] 'org-backward-paragraph)
+(org-defkey org-mode-map \M-^ 'org-delete-indentation)
 (org-defkey org-mode-map \C-m 'org-return)
 (org-defkey org-mode-map \C-j 'org-return-indent)
 (org-defkey org-mode-map \C-c?'org-table-field-info)
@@ -21159,6 +21160,30 @@ This command does many different things, depending on context:
 (let ((org-note-abort t))
   (funcall org-finish-function
 
+(defun org-delete-indentation (optional ARG)
+  Join this line to previous and fix up whitespace at join.
+
+If previous row is a headline add to headline text.
+  (interactive *P)
+  (if (save-excursion (if ARG
+			  (beginning-of-line)
+			(forward-line -1))
+		  (looking-at org-complex-heading-regexp))
+  ;; At headline.
+  (let ((string (concat   (prog2 (and ARG (forward-line 1))
+(org-trim (delete-and-extract-region (line-beginning-position)
+	 (line-end-position)))
+	(when (eq (preceding-char) ?\n) (delete-region (point) (1- (point
+	(goto-char (or (match-beginning 5)
+		   (match-end 0)))
+	(skip-chars-backward  \t)
+	(when (and (match-beginning 5)
+		   ( (+ (point) (length string))
+		  (match-beginning 5)))
+	  (delete-region (point) (+ (point) (length string
+	(save-excursion (insert string)))
+(delete-indentation ARG)))
+
 (defun org-open-line (n)
   Insert a new row in tables, call `open-line' elsewhere.
 If `org-special-ctrl-o' is nil, just call `open-line' everywhere.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index ecfece5..a241f26 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -833,6 +833,34 @@
 
 ;;; Editing
 
+(ert-deftest test-org-delete-indentation ()
+  Test M-^ (`org-delete-indentation') specification.
+  ;; Regular test.
+  (should (equal foo bar
+		(org-test-with-temp-text
+		foo \n barpoint
+		  (org-delete-indentation)
+		  (buffer-string
+  ;; With optional argument.
+  (should (equal foo bar
+		(org-test-with-temp-text
+		foopoint \n bar
+		  (org-delete-indentation t)
+		  (buffer-string
+  ;; At headline text should be appended to the headline text.
+  (should
+   (equal * foo bar :tag:
+	  (org-test-with-temp-text
+	  * foo :tag:\n barpoint
+	(org-delete-indentation)
+	(buffer-string
+  (should
+   (equal * foo bar :tag:
+	  (org-test-with-temp-text
+	  * foo point:tag:\n bar
+	(org-delete-indentation t)
+	(buffer-string)
+
 (ert-deftest test-org/return ()
   Test RET (`org-return') specifications.
   ;; Regular test.
-- 
2.4.0



Re: [O] A Microsoftesque detail in org

2015-05-16 Thread Titus von der Malsburg

Hi Rasmus,

just tried the patch and while I still find it weird to change the
meaning of RET, this solution doesn’t get in my way as much as the
previous solution did.

One minor cosmetic issue:

* TODO foo bar :test:

When I RET between foo and bar, the tag moves to the left.  I think it
would be nicer if it would stay where it was.

  Titus


On 2015-05-16 Sat 08:28, Rasmus wrote:
 Hi,

 Thanks for the comments.

 Nicolas Goaziou m...@nicolasgoaziou.fr writes:


 RET breaks headline text may be more accurate.

 OK.

 +  (let* ((context (if org-return-follows-link (org-element-context)
 +   (org-element-at-point)))
 +(type (org-element-type context)))
 +(cond
 + ;; At a headline
 + ((and (eq type 'headline) (not (bolp)))

 You are removing an optimization here. 

 Checking if point is on a headline/inlinetask doesn't require to use
 `org-element-at-point'/`org-element-context'. It is faster to simply
 check for `org-outline-regexp' (or derived) at bol.

 This optimization is less important than it used to be, now that
 properties drawers are at a fixed location. Nevertheless, it might be
 worth keeping it in mind.

 I did it 'cause it's easier, I think, to read a single cond than first an
 if and then a cond.  The latter also seems easier to fix in the future.

 +  (org-show-entry)
 +  (let ((string ))
 +   (unless (and (save-excursion
 +  (beginning-of-line)
 +  (looking-at org-complex-heading-regexp))
 +(or (and (match-beginning 3)
 + ( (point)
 +(save-excursion
 +  (goto-char (match-beginning 4))
 +  (skip-chars-backward  \t)
 +  (point
 +(and (match-beginning 5)
 + (= (point) (match-beginning 5)
 +   ;; Point is on headline keywords, tags or cookies.  Do not break
 +   ;; them: add a newline after the headline instead.
 + (setq string (delete-and-extract-region
 +   (point) (or (match-beginning 5)
 +   (line-end-position

 The `setq' is not necessary here. Bind it within `let' instead.

 You are right.

 + (when (match-beginning 5)
 +   (insert (make-string (length string) ?\ 

   ?\  - ?\s
   
 If you add this feature, please augment `test-org/return' from
 test-org.el accordingly.

 Done and and attached.

 Anybody against pushing this?

 —Rasmus



signature.asc
Description: PGP signature


Re: [O] org-babel for prolog

2015-05-16 Thread Lawrence Bottorff
I'm just a Prolog beginner, but this:

#+begin_src prolog
edge(a,b).
edge(a,e).
edge(b,d).
edge(b,c).
edge(c,a).
edge(e,b).
tedge(Node1,Node2) :-
edge(Node1,SomeNode),
edge(SomeNode,Node2).
#+end_src

keeps giving me this:

executing Prolog code block...
executing Prolog source code block
org-babel-execute:prolog: Wrong type argument: char-or-string-p, ni

BTW, should it be

(eval-after-load 'org
  '(require 'ob-prolog))

or

(eval-after-load org
  '(require 'ob-prolog))

. . . org in quotes?

On Thu, May 14, 2015 at 5:03 PM, Bjarte Johansen 
bjarte.johan...@infomedia.uib.no wrote:


  On 14 May 2015, at 20:22, Puneeth Chaganti puncha...@gmail.com wrote:
 
  On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff borg...@gmail.com
 wrote:
 
  Confused by the requirement:
 
  ;; To activate ob-prolog add the following to your init.el file:
  ;;
  ;;  (eval-after-load 'org
  ;;'(require 'org-prolog))
 
 
  I'm guessing its a typo and should be ob-prolog. The file provides
 ob-prolog.

 Yes, I typed it wrong. Thank you for bringing it to my attention. I also
 discovered that it is better to use `org-babel-do-load-languages’ instead
 as well. I will change the recommendation tomorrow.

 Regards,
 Bjarte


Re: [O] A Microsoftesque detail in org

2015-05-16 Thread Rasmus
Hi Titus,

Titus von der Malsburg malsb...@posteo.de writes:

 just tried the patch and while I still find it weird to change the
 meaning of RET, this solution doesn’t get in my way as much as the
 previous solution did.

Try to:

(with-temp-buffer (org-mode) (describe-mode)).

A lot of keys have been orgified.

At the extreme of the anti-org-whatever-key line of though, how would
org-table work?

 One minor cosmetic issue:

 * TODO foo bar   :test:

 When I RET between foo and bar, the tag moves to the left.  I think it
 would be nicer if it would stay where it was.

Good observation.  I don't even know how to make a tab character in Emacs
so I blissfully assumed them away.

Anyway, this should be fixed now, though it will religiously adhere to
org-tags-column which, at least for my setup, your example does not.  I
think this is acceptable 'cause we also need to consider the example

* TODO foo \phi\delta  
:test:

Which is pretty hard due to the overlays (display-width is two, but real
length is more).

Could you try this version of the patch and see if you find it more
satisfactory?

Thanks,
Rasmus

-- 
Governments should be afraid of their people
From 60688c52732fbbe0757c57686089c55c709f2a07 Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Fri, 15 May 2015 13:08:11 +0200
Subject: [PATCH 1/2] org.el: RET breaks headline text

* org.el (org-return): RET breaks headline text.
* test-org.el (test-org/return): Test org-return on headline text.
* ORG-NEWS: Add entry on new org-return behavior.
---
 etc/ORG-NEWS |   4 +
 lisp/org.el  | 217 ++-
 testing/lisp/test-org.el |  28 +-
 3 files changed, 54 insertions(+), 195 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 3803060..a3e1ae2 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -93,6 +93,10 @@ functions.  The Org version of these functions skips over inline tasks
 *** ~org-element-context~ no longer return objects in keywords
 ~org-element-context~ used to return objects on some keywords, i.e.,
 =TITLE=, =DATE= and =AUTHOR=.  It now returns only the keyword.
+*** Behavior of ~org-return~ changed
+If point is before or after the true headline text, insert newline
+without changing the text.  If point is on headline text preserve
+tags.
 ** Removed functions
 *** Removed function ~org-translate-time~
 Use ~org-timestamp-translate~ instead.
diff --git a/lisp/org.el b/lisp/org.el
index 4b44a94..8527c2d 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19845,189 +19845,6 @@ boundaries.
 (org-defkey org-mode-map \C-c|'org-table-create-or-convert-from-region)
 (org-defkey org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
 (org-defkey org-mode-map \C-c~'org-table-create-with-table.el)
-(org-defkey org-mode-map \C-c\C-a 'org-attach)
-(org-defkey org-mode-map \C-c}'org-table-toggle-coordinate-overlays)
-(org-defkey org-mode-map \C-c{'org-table-toggle-formula-debugger)
-(org-defkey org-mode-map \C-c\C-e 'org-export-dispatch)
-(org-defkey org-mode-map \C-c:'org-toggle-fixed-width)
-(org-defkey org-mode-map \C-c\C-x\C-f 'org-emphasize)
-(org-defkey org-mode-map \C-c\C-xf'org-footnote-action)
-(org-defkey org-mode-map \C-c\C-x\C-mg'org-mobile-pull)
-(org-defkey org-mode-map \C-c\C-x\C-mp'org-mobile-push)
-(org-defkey org-mode-map \C-c@ 'org-mark-subtree)
-(org-defkey org-mode-map \M-h 'org-mark-element)
-(org-defkey org-mode-map [?\C-c (control ?*)] 'org-list-make-subtree)
-;;(org-defkey org-mode-map [?\C-c (control ?-)] 'org-list-make-list-from-subtree)
-
-(org-defkey org-mode-map \C-c\C-x\C-w 'org-cut-special)
-(org-defkey org-mode-map \C-c\C-x\M-w 'org-copy-special)
-(org-defkey org-mode-map \C-c\C-x\C-y 'org-paste-special)
-
-(org-defkey org-mode-map \C-c\C-x\C-t 'org-toggle-time-stamp-overlays)
-(org-defkey org-mode-map \C-c\C-x\C-i 'org-clock-in)
-(org-defkey org-mode-map \C-c\C-x\C-x 'org-clock-in-last)
-(org-defkey org-mode-map \C-c\C-x\C-z 'org-resolve-clocks)
-(org-defkey org-mode-map \C-c\C-x\C-o 'org-clock-out)
-(org-defkey org-mode-map \C-c\C-x\C-j 'org-clock-goto)
-(org-defkey org-mode-map \C-c\C-x\C-q 'org-clock-cancel)
-(org-defkey org-mode-map \C-c\C-x\C-d 'org-clock-display)
-(org-defkey org-mode-map \C-c\C-x\C-r 'org-clock-report)
-(org-defkey org-mode-map \C-c\C-x\C-u 'org-dblock-update)
-(org-defkey org-mode-map \C-c\C-x\C-l 'org-toggle-latex-fragment)
-(org-defkey org-mode-map \C-c\C-x\C-v 'org-toggle-inline-images)
-(org-defkey org-mode-map \C-c\C-x\C-\M-v 'org-redisplay-inline-images)
-(org-defkey org-mode-map \C-c\C-x\\   'org-toggle-pretty-entities)
-(org-defkey org-mode-map \C-c\C-x\C-b 'org-toggle-checkbox)
-(org-defkey org-mode-map \C-c\C-xp'org-set-property)
-(org-defkey org-mode-map \C-c\C-xP'org-set-property-and-value)
-(org-defkey org-mode-map \C-c\C-xe'org-set-effort)
-(org-defkey 

Re: [O] A Microsoftesque detail in org

2015-05-16 Thread Rasmus
Hi,

Thanks for the comments.

Nicolas Goaziou m...@nicolasgoaziou.fr writes:


 RET breaks headline text may be more accurate.

OK.

 +  (let* ((context (if org-return-follows-link (org-element-context)
 +(org-element-at-point)))
 + (type (org-element-type context)))
 +(cond
 + ;; At a headline
 + ((and (eq type 'headline) (not (bolp)))

 You are removing an optimization here. 

 Checking if point is on a headline/inlinetask doesn't require to use
 `org-element-at-point'/`org-element-context'. It is faster to simply
 check for `org-outline-regexp' (or derived) at bol.

 This optimization is less important than it used to be, now that
 properties drawers are at a fixed location. Nevertheless, it might be
 worth keeping it in mind.

I did it 'cause it's easier, I think, to read a single cond than first an
if and then a cond.  The latter also seems easier to fix in the future.

 +  (org-show-entry)
 +  (let ((string ))
 +(unless (and (save-excursion
 +   (beginning-of-line)
 +   (looking-at org-complex-heading-regexp))
 + (or (and (match-beginning 3)
 +  ( (point)
 + (save-excursion
 +   (goto-char (match-beginning 4))
 +   (skip-chars-backward  \t)
 +   (point
 + (and (match-beginning 5)
 +  (= (point) (match-beginning 5)
 +;; Point is on headline keywords, tags or cookies.  Do not break
 +;; them: add a newline after the headline instead.
 +  (setq string (delete-and-extract-region
 +(point) (or (match-beginning 5)
 +(line-end-position

 The `setq' is not necessary here. Bind it within `let' instead.

You are right.

 +  (when (match-beginning 5)
 +(insert (make-string (length string) ?\ 

   ?\  - ?\s
   
 If you add this feature, please augment `test-org/return' from
 test-org.el accordingly.

Done and and attached.

Anybody against pushing this?

—Rasmus

-- 
There are known knowns; there are things we know that we know
From a7e6e6b9c96c13be9ebdc0a5c4c2f5033cefbfc7 Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Fri, 15 May 2015 13:08:11 +0200
Subject: [PATCH 1/2] org.el: RET breaks headline text

* org.el (org-return): RET breaks headline text.
* test-org.el (test-org/return): Test org-return on headline text.
* ORG-NEWS: Add entry on new org-return behavior.
---
 etc/ORG-NEWS |  4 
 lisp/org.el  | 32 ++--
 testing/lisp/test-org.el | 28 ++--
 3 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 3803060..a3e1ae2 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -93,6 +93,10 @@ functions.  The Org version of these functions skips over inline tasks
 *** ~org-element-context~ no longer return objects in keywords
 ~org-element-context~ used to return objects on some keywords, i.e.,
 =TITLE=, =DATE= and =AUTHOR=.  It now returns only the keyword.
+*** Behavior of ~org-return~ changed
+If point is before or after the true headline text, insert newline
+without changing the text.  If point is on headline text preserve
+tags.
 ** Removed functions
 *** Removed function ~org-translate-time~
 Use ~org-timestamp-translate~ instead.
diff --git a/lisp/org.el b/lisp/org.el
index 4b44a94..93183f9 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21185,16 +21185,28 @@ will not happen if point is in a table or on a \dead\
 object (e.g., within a comment).  In these case, you need to use
 `org-open-at-point' directly.
   (interactive)
-  (if (and (save-excursion
-	 (beginning-of-line)
-	 (looking-at org-todo-line-regexp))
-	   (match-beginning 3)
-	   (= (point) (match-beginning 3)))
-  ;; Point is on headline tags.  Do not break them: add a newline
-  ;; after the headline instead.
-  (progn (org-show-entry)
-	 (end-of-line)
-	 (if indent (newline-and-indent) (newline)))
+  (if (and (not (bolp))
+	   (save-excursion (beginning-of-line)
+			   (looking-at org-complex-heading-regexp)))
+  ;; At a headline.
+  (let ((string (if (or ( (point)
+			   (save-excursion
+ (goto-char (match-beginning 4))
+ (skip-chars-backward  \t)
+ (point)))
+			(and (match-beginning 5)
+ (= (point) (match-beginning 5
+			;; Point is on headline keywords, tags or cookies.  Do not break
+			;; them: add a newline after the headline instead.
+			
+		  (delete-and-extract-region (point) (or (match-beginning 5)
+			 (line-end-position))
+	(when (match-beginning 5)
+	  (insert (make-string (length string) ?\s)))
+	(end-of-line)
+	(org-show-entry)
+	(if indent (newline-and-indent) (newline))
+	(save-excursion (insert (org-trim string
 (let* ((context (if 

Re: [O] [patch] org-delete-indentation

2015-05-16 Thread Rasmus
Rasmus ras...@gmx.us writes:

 Due to recent controversy about Org being lacking Microsoftesque detail I
 finally implemented org-delete-indentation, which is a function I have
 been missing forever.

Updated patch attached.  It now uses (org-fix-tags-on-the-fly).  A
consequence of this is that (i) it works with entities; (ii) it is very
strict about org-tag-column.  But I guess so is C-c C-c on headlines, so
maybe it is not an issue.

Rasmus

-- 
Summon the Mothership!
From 31ac966a7913de5a6cd3fb81e2ad4abfa3413d61 Mon Sep 17 00:00:00 2001
From: Rasmus ras...@gmx.us
Date: Sat, 16 May 2015 17:19:03 +0200
Subject: [PATCH 2/2] org.el: New function org-delete-indentation

* org.el (org-delete-indentation): New function.
  (org-mode-map): Bind org-delete-indentation to M-^.
* test-org.el (test-org-delete-indentation): Test org-delete-indentation.
* ORG-NEWS: Add entry on org-delete-indentation.
---
 etc/ORG-NEWS |  3 +++
 lisp/org.el  | 22 ++
 testing/lisp/test-org.el | 28 
 3 files changed, 53 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a3e1ae2..91e30f8 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -377,6 +377,9 @@ for details.
 Calling ~org-edit-footnote-reference~ (C-c ') on a footnote reference
 allows to edit its definition, as long as it is not anonymous, in
 a dedicated buffer.  It works even if buffer is currently narrowed.
+*** New function ~org-delete-indentation~ bound to ~M-^~
+Work as ~delete-indentation~ unless at heading, in which case text is
+added to headline text.
 ** Miscellaneous
 *** Strip all meta data from ITEM special property
 ITEM special property does not contain TODO, priority or tags anymore.
diff --git a/lisp/org.el b/lisp/org.el
index 8527c2d..59a2653 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19832,6 +19832,7 @@ boundaries.
 (org-defkey org-mode-map [remap comment-dwim] 'org-comment-dwim)
 (org-defkey org-mode-map [remap forward-paragraph] 'org-forward-paragraph)
 (org-defkey org-mode-map [remap backward-paragraph] 'org-backward-paragraph)
+(org-defkey org-mode-map \M-^ 'org-delete-indentation)
 (org-defkey org-mode-map \C-m 'org-return)
 (org-defkey org-mode-map \C-j 'org-return-indent)
 (org-defkey org-mode-map \C-c?'org-table-field-info)
@@ -20976,6 +20977,27 @@ This command does many different things, depending on context:
 (let ((org-note-abort t))
   (funcall org-finish-function
 
+(defun org-delete-indentation (optional ARG)
+  Join this line to previous and fix up whitespace at join.
+
+If previous row is a headline add to headline text.
+  (interactive *P)
+  (if (save-excursion (if ARG
+			  (beginning-of-line)
+			(forward-line -1))
+		  (looking-at org-complex-heading-regexp))
+  ;; At headline.
+  (let ((string (concat   (prog2 (and ARG (forward-line 1))
+(org-trim (delete-and-extract-region (line-beginning-position)
+	 (line-end-position)))
+	(when (eq (preceding-char) ?\n) (delete-region (point) (1- (point
+	(goto-char (or (match-beginning 5)
+		   (match-end 0)))
+	(skip-chars-backward  \t)
+	(save-excursion (insert string))
+	(org-fix-tags-on-the-fly))
+(delete-indentation ARG)))
+
 (defun org-open-line (n)
   Insert a new row in tables, call `open-line' elsewhere.
 If `org-special-ctrl-o' is nil, just call `open-line' everywhere.
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index ecfece5..a241f26 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -833,6 +833,34 @@
 
 ;;; Editing
 
+(ert-deftest test-org-delete-indentation ()
+  Test M-^ (`org-delete-indentation') specification.
+  ;; Regular test.
+  (should (equal foo bar
+		(org-test-with-temp-text
+		foo \n barpoint
+		  (org-delete-indentation)
+		  (buffer-string
+  ;; With optional argument.
+  (should (equal foo bar
+		(org-test-with-temp-text
+		foopoint \n bar
+		  (org-delete-indentation t)
+		  (buffer-string
+  ;; At headline text should be appended to the headline text.
+  (should
+   (equal * foo bar :tag:
+	  (org-test-with-temp-text
+	  * foo :tag:\n barpoint
+	(org-delete-indentation)
+	(buffer-string
+  (should
+   (equal * foo bar :tag:
+	  (org-test-with-temp-text
+	  * foo point:tag:\n bar
+	(org-delete-indentation t)
+	(buffer-string)
+
 (ert-deftest test-org/return ()
   Test RET (`org-return') specifications.
   ;; Regular test.
-- 
2.4.0



Re: [O] A Microsoftesque detail in org

2015-05-16 Thread Titus von der Malsburg

On 2015-05-16 Sat 12:00, Rasmus wrote:
 Hi Titus,

 Titus von der Malsburg malsb...@posteo.de writes:

 just tried the patch and while I still find it weird to change the
 meaning of RET, this solution doesn’t get in my way as much as the
 previous solution did.

 Try to:

 (with-temp-buffer (org-mode) (describe-mode)).

 A lot of keys have been orgified.

 At the extreme of the anti-org-whatever-key line of though, how would
 org-table work?

Let me first say that I think your latest patch is a good compromise and
I could totally live with that solution.

Having said that, I have very mixed feelings about how org behaves in
tables.  I’m a heavy user of org mode and feel highly comfortable with
every aspect of it.  Tables are the only exception.  They trip me up
again and again with behavior that I perceive as counter-intuitive.  The
problem is that org-mode is not the only citizen in the Emacs ecosystem
and therefore it matters more how the rest of Emacs behaves than how
Microsoft products or other outliners behave.  For instance, when I put
to cursor on a headline in a markdown document and press RET, I get a
newline at that position.  If I put the cursor on a headline in a LaTeX
document and press RET, again I get a newline.  The same goes for
subject lines in emails (message-mode) and many other similar
situations.  All these things are conceptually headlines and should
therefore behave the same way.  Anything else would create unnecessary
cognitive load for the user.  Since org-mode for many years used to
behave like all the other modes that I mentioned, it is not accurate to
call this position anti-org.  … my 5 cents.

Have a nice weekend!

  Titus


 One minor cosmetic issue:

 * TODO foo bar  :test:

 When I RET between foo and bar, the tag moves to the left.  I think it
 would be nicer if it would stay where it was.

 Good observation.  I don't even know how to make a tab character in Emacs
 so I blissfully assumed them away.

 Anyway, this should be fixed now, though it will religiously adhere to
 org-tags-column which, at least for my setup, your example does not.  I
 think this is acceptable 'cause we also need to consider the example

 * TODO foo \phi\delta 
  :test:

 Which is pretty hard due to the overlays (display-width is two, but real
 length is more).

 Could you try this version of the patch and see if you find it more
 satisfactory?

 Thanks,
 Rasmus



signature.asc
Description: PGP signature


Re: [O] Bug: org-set-tags duplicates tags in org-tag-persistent-alist

2015-05-16 Thread Nicolas Goaziou
Paul Rankin he...@paulwrankin.com writes:

 I'm on the Org ELPA version, which appears to get updated a few times
 a month. How far apart are they?

Very far away.

 If the alleged bug has been fixed in the development branch, is it
 worth then finding and merging with stable?

I don't think it is totally fixed, but it doesn't seem to appear anymore
under the circumstances you're describing.

Regards,



Re: [O] A Microsoftesque detail in org

2015-05-16 Thread Nicolas Goaziou
Hello,

Rasmus ras...@gmx.us writes:

 The attached patch re-enables breaks in region four of
 org-complex-heading-regexp, i.e. from the cookie up to tags.  A quick test
 suggests it works nicely.

Thank you.

 WDYT?

Some comments follow.

 Subject: [PATCH 2/2] org.el: RET works in headline text

 * org.el (org-return): RET works in headline text.

RET breaks headline text may be more accurate.

 +  (let* ((context (if org-return-follows-link (org-element-context)
 + (org-element-at-point)))
 +  (type (org-element-type context)))
 +(cond
 + ;; At a headline
 + ((and (eq type 'headline) (not (bolp)))

You are removing an optimization here. 

Checking if point is on a headline/inlinetask doesn't require to use
`org-element-at-point'/`org-element-context'. It is faster to simply
check for `org-outline-regexp' (or derived) at bol.

This optimization is less important than it used to be, now that
properties drawers are at a fixed location. Nevertheless, it might be
worth keeping it in mind.

 +  (org-show-entry)
 +  (let ((string ))
 + (unless (and (save-excursion
 +(beginning-of-line)
 +(looking-at org-complex-heading-regexp))
 +  (or (and (match-beginning 3)
 +   ( (point)
 +  (save-excursion
 +(goto-char (match-beginning 4))
 +(skip-chars-backward  \t)
 +(point
 +  (and (match-beginning 5)
 +   (= (point) (match-beginning 5)
 + ;; Point is on headline keywords, tags or cookies.  Do not break
 + ;; them: add a newline after the headline instead.
 +   (setq string (delete-and-extract-region
 + (point) (or (match-beginning 5)
 + (line-end-position

The `setq' is not necessary here. Bind it within `let' instead.

 +   (when (match-beginning 5)
 + (insert (make-string (length string) ?\ 

  ?\  - ?\s
  
If you add this feature, please augment `test-org/return' from
test-org.el accordingly.

Regards,

-- 
Nicolas Goaziou



Re: [O] ob-rec.el

2015-05-16 Thread Charles Millar



On 05/15/2015 11:07 PM, Nick Dokos wrote:

Charles Millar mill...@verizon.net writes:


It appears that ob-rec.el is in org-mode - somewhere - because when I
evaluate

#+begin_src rec :data Testrec2.rec

#+end_src


the output in the is

no org-babel execute function for rec

However once I add (rec . t) to my org-babel-load-languages and restart
emacs and then evaluate the block, etc.

#+begin_src rec :data Testrec2.rec

#+end_src

#+RESULTS:
| %Bar| %Baz|
|--+---|
| entrybar1 | entrybaz1 |
| entrybar2 | entrybaz2 |

So first question - where is ob-rec.el in org-mode?


M-x locate-library RET ob-rec RET

In my case, ob-rec was not present (but see below).



Second - should rec-utils be added as a supported language or should
some reference be made so that users know to add (rec . t) to their
org-babel-load-languages, if so desired?


I downloaded recutils-1.7.tar.gz from http://ftp.gnu.org/gnu/recutils/
and, after unpacking it, found rec-mode.el and ob-rec.el in the etc/
subdirectory of the unpacked tarball.


Thanks Nick. For me it ob-rec.el is hiding in plain sight - it is in my 
emacs/site-lisp directory by itself since I unpacked the tarball in that 
directory.Per your instruction, I used M-x locate-library and there it 
was and is.



Maybe you can add a pointer to where to get it (and a few words about
what it does) to

http://orgmode.org/worg/org-contrib/babel/languages.html

on Worg. N.B. the language should be rec, not rec-utils.

I would like to give it a shot however I believe that Jose Marchesi the 
person for this.


Charlie




[O] [PATCH] org-attach.el: fix check for git annex

2015-05-16 Thread Erik Hetzner
* lisp/org-attach.el (org-attach-commit): Check for .git/annex dir in
addition to annex dir in root git dir to ensure that git annex is used
---
 lisp/org-attach.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1737ec1..7f61910 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -283,7 +283,8 @@ This checks for the existence of a \.git\ directory in 
that directory.
(cd dir)
(let ((have-annex
   (and org-attach-git-annex-cutoff
-   (file-exists-p (expand-file-name annex git-dir)
+   (or (file-exists-p (expand-file-name annex git-dir))
+   (file-exists-p (expand-file-name .git/annex 
git-dir))
  (dolist (new-or-modified
   (split-string
(shell-command-to-string
-- 
2.1.4