emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* orgstruct in emacs -nw
@ 2013-05-23 11:47 Memnon Anon
  2013-05-23 12:46 ` Christopher Schmidt
  2013-05-23 12:48 ` Thorsten Jolitz
  0 siblings, 2 replies; 4+ messages in thread
From: Memnon Anon @ 2013-05-23 11:47 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: orgstruct in emacs -nw
  2013-05-23 11:47 orgstruct in emacs -nw Memnon Anon
@ 2013-05-23 12:46 ` Christopher Schmidt
  2013-05-23 13:58   ` Memnon Anon
  2013-05-23 12:48 ` Thorsten Jolitz
  1 sibling, 1 reply; 4+ messages in thread
From: Christopher Schmidt @ 2013-05-23 12:46 UTC (permalink / raw)
  To: emacs-orgmode

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

> 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!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1978 bytes --]

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

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


        Christopher

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

* Re: orgstruct in emacs -nw
  2013-05-23 11:47 orgstruct in emacs -nw Memnon Anon
  2013-05-23 12:46 ` Christopher Schmidt
@ 2013-05-23 12:48 ` Thorsten Jolitz
  1 sibling, 0 replies; 4+ messages in thread
From: Thorsten Jolitz @ 2013-05-23 12:48 UTC (permalink / raw)
  To: emacs-orgmode

Memnon Anon <gegendosenfleisch@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

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

* Re: orgstruct in emacs -nw
  2013-05-23 12:46 ` Christopher Schmidt
@ 2013-05-23 13:58   ` Memnon Anon
  0 siblings, 0 replies; 4+ messages in thread
From: Memnon Anon @ 2013-05-23 13:58 UTC (permalink / raw)
  To: emacs-orgmode

Christopher Schmidt <christopher@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

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

end of thread, other threads:[~2013-05-23 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-23 11:47 orgstruct in emacs -nw Memnon Anon
2013-05-23 12:46 ` Christopher Schmidt
2013-05-23 13:58   ` Memnon Anon
2013-05-23 12:48 ` Thorsten Jolitz

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