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