emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] orgstruct in emacs -nw


From: Christopher Schmidt
Subject: Re: [O] orgstruct in emacs -nw
Date: Thu, 23 May 2013 13:46:12 +0100 (BST)

> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]