Ver Fonte

org.el (orgstruct-setup): Bind all intermediate key translations.

* org.el (orgstruct-setup): Bind all intermediate key
translations.
Christopher Schmidt há 12 anos atrás
pai
commit
8a3e48bd21
1 ficheiros alterados com 24 adições e 20 exclusões
  1. 24 20
      lisp/org.el

+ 24 - 20
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)))))
+	      (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)