[O] orgstruct in emacs -nw

2013-05-23 Thread Memnon Anon
Hi,

I tried to use the orgstruct minor mode, but it didn't seem to do
anything, although I used exactly the same setup Bastien showed in his
interview[1].

After a while, I realized it was because I was using emacs in an xterm.
Steps to reproduce below.[2] 

Wrong setup, a bug or intentional?

If it is supposed to work that way, 
it should perhaps be mentioned in the manual.

I also saw that Bastien somehow got colortheme support for
orgstructlines in elisp files. My cyberpunk doesn't do that OOTB,
so I guess I need to have a look at outshine[3] for that?

TIA
Memnon

Footnotes: 
[1]  https://www.youtube.com/watch?v=fnk0TJC7iJI
Nice one ;)

[2]  
* 1) emacs -Q -nw
* 2) load version from git:
   (add-to-list 'load-path path/to/org-mode/lisp)
   (add-to-list 'load-path path/to/org-mode/contrib/lisp)
   (add-to-list 'load-path path/to/org-mode/contrib/babel/lisp)
   (require 'org)
* 3) M-x find-file ~/orgstruct.test
,[ ~/orgstruct.test ]
* test
** test
** test 2
`
* 4) M-x orgstruct++-mode
* 5) Tab does not cycle while on `* test' headline
   But it does when emacs is started with emacs -Q in 1) 
   and same steps applied.

This is with:
ELISP (org-version t t t)
Org-mode version 8.0.3 (release_8.0.3-147-g06cdb2 
 @ /home/memnon/tmp/bin/org-mode/lisp/)
ELISP (emacs-version)
GNU Emacs 24.3.50.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2)\n 
 of 2013-05-11 on gkar, modified by Debian

[3]  
http://orgmode.org/worg/org-tutorials/org-outside-org.html#fontification-navigation-and-structure-editing




Re: [O] orgstruct in emacs -nw

2013-05-23 Thread Christopher Schmidt
 I tried to use the orgstruct minor mode, but it didn't seem to do
 anything, although I used exactly the same setup Bastien showed in his
 interview[1].

 After a while, I realized it was because I was using emacs in an
 xterm.  Steps to reproduce below.[2]

Some bindings, such as M-TAB, C-n or C-p, should work fine.

 Wrong setup, a bug or intentional?

This is a bug.  Can you please give this patch a try and see if it
corrects the issue?  Apply it on master (06cdb2d).  Thanks!
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8960,26 +8960,30 @@ buffer.  It will also recognize item context in multiline items.
 (let ((f (or (car-safe cell) cell))
 	  (disable-when-heading-prefix (cdr-safe cell)))
   (when (fboundp f)
-	(dolist (binding (nconc (where-is-internal f org-mode-map)
-(where-is-internal f outline-mode-map)))
-	  ;; TODO use local-function-key-map
-	  (dolist (rep '((tab . TAB)
-			 (return . RET)
-			 (escape . ESC)
-			 (delete . DEL)))
-	(setq binding (read-kbd-macro
-			   (let ((case-fold-search))
-			 (replace-regexp-in-string
-			  (regexp-quote (cdr rep))
-			  (car rep)
-			  (key-description binding))
-	  (let ((key (lookup-key orgstruct-mode-map binding)))
-	(when (or (not key) (numberp key))
-	  (condition-case nil
-		  (org-defkey orgstruct-mode-map
-			  binding
-			  (orgstruct-make-binding f binding disable-when-heading-prefix))
-		(error nil
+	(let ((new-bindings))
+	  (dolist (binding (nconc (where-is-internal f org-mode-map)
+  (where-is-internal f outline-mode-map)))
+	(push binding new-bindings)
+	;; TODO use local-function-key-map
+	(dolist (rep '((tab . TAB)
+			   (return . RET)
+			   (escape . ESC)
+			   (delete . DEL)))
+	  (setq binding (read-kbd-macro
+			 (let ((case-fold-search))
+			   (replace-regexp-in-string
+(regexp-quote (cdr rep))
+(car rep)
+(key-description binding)
+	  (cl-pushnew binding new-bindings :test 'equal)))
+	  (dolist (binding new-bindings)
+	(let ((key (lookup-key orgstruct-mode-map binding)))
+	  (when (or (not key) (numberp key))
+		(condition-case nil
+		(org-defkey orgstruct-mode-map
+binding
+(orgstruct-make-binding f binding disable-when-heading-prefix))
+		  (error nil)
   (run-hooks 'orgstruct-setup-hook))
 
 (defun orgstruct-make-binding (fun key disable-when-heading-prefix)

Christopher


Re: [O] orgstruct in emacs -nw

2013-05-23 Thread Thorsten Jolitz
Memnon Anon gegendosenflei...@googlemail.com writes:

 Footnotes: 
 [1]  https://www.youtube.com/watch?v=fnk0TJC7iJI
 Nice one ;)

Indeed, and it made me discover 'grep-find', thanks for the tip to
Bastien, thats definitely a useful function. 

-- 
cheers,
Thorsten




Re: [O] orgstruct in emacs -nw

2013-05-23 Thread Memnon Anon
Christopher Schmidt christop...@ch.ristopher.com writes:

 Wrong setup, a bug or intentional?

 This is a bug.  Can you please give this patch a try and see if it
 corrects the issue?  Apply it on master (06cdb2d).  Thanks!

Patch applied, Tab works. 
I will test it more thoroughly over the next days.

Thanks!
Memnon