2

I am trying out orgstruct-mode with python-mode (but I've also tried go-mode with the same result). If I enable orgstruct-mode and press S-TAB I get the error S- must prefix a single character, not ISO-leftTAB. I would have expected this to cycle the visibility of all the functions in the buffer.

If I put the point on a def foo function and do M-x org-cycle the the function is correctly folded and unfolded.

Checking the binding of S-TAB in the python buffer, it is: <S-iso-lefttab> runs the command orgstruct-hijacker-org-shifttab-2, who's doc mentions: In Structure, run org-shifttab.

If I run M-x org-shifttab it correctly folds up all the functions.

I've tried updating all my packages (including org from melpa), and I've tried running emacs -q - same result. Emacs 24.5.

Is this a bug or am I doing something stupid? Does anyone use orgstruct in a prog-mode?

Here's a backtrce:

Debugger entered--Lisp error: (error "S- must prefix a single character, not iso-leftTAB")
  signal(error ("S- must prefix a single character, not iso-leftTAB"))
  error("%s must prefix a single character, not %s" "S-" "iso-leftTAB")
  edmacro-parse-keys("S-iso-leftTAB" nil)
  read-kbd-macro("S-iso-leftTAB")
  (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))
  (progn (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key))))))
  (if rep (progn (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))))
  (when rep (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key))))))
  (while --dolist-tail-- (setq rep (car --dolist-tail--)) (when rep (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))) (when (key-binding key) (throw (quote exit) (key-binding key))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (let ((--dolist-tail-- (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL")))) rep) (while --dolist-tail-- (setq rep (car --dolist-tail--)) (when rep (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))) (when (key-binding key) (throw (quote exit) (key-binding key))) (setq --dolist-tail-- (cdr --dolist-tail--))) (setq rep nil) nil)
  (catch (quote --cl-block-nil--) (let ((--dolist-tail-- (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL")))) rep) (while --dolist-tail-- (setq rep (car --dolist-tail--)) (when rep (setq key (read-kbd-macro (let (...) (replace-regexp-in-string ... ... ...))))) (when (key-binding key) (throw (quote exit) (key-binding key))) (setq --dolist-tail-- (cdr --dolist-tail--))) (setq rep nil) nil))
  (cl--block-wrapper (catch (quote --cl-block-nil--) (let ((--dolist-tail-- (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL")))) rep) (while --dolist-tail-- (setq rep (car --dolist-tail--)) (when rep (setq key (read-kbd-macro (let ... ...)))) (when (key-binding key) (throw (quote exit) (key-binding key))) (setq --dolist-tail-- (cdr --dolist-tail--))) (setq rep nil) nil)))
  (cl-block nil (let ((--dolist-tail-- (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL")))) rep) (while --dolist-tail-- (setq rep (car --dolist-tail--)) (when rep (setq key (read-kbd-macro (let (...) (replace-regexp-in-string ... ... ...))))) (when (key-binding key) (throw (quote exit) (key-binding key))) (setq --dolist-tail-- (cdr --dolist-tail--))) (setq rep nil) nil))
  (dolist (rep (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL"))) nil) (when rep (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))) (when (key-binding key) (throw (quote exit) (key-binding key))))
  (catch (quote exit) (dolist (rep (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL"))) nil) (when rep (setq key (read-kbd-macro (let ((case-fold-search)) (replace-regexp-in-string (car rep) (cdr rep) (key-description key)))))) (when (key-binding key) (throw (quote exit) (key-binding key)))))
  (let ((key [S-iso-lefttab])) (catch (quote exit) (dolist (rep (quote (nil ("<\\([^>]*\\)tab>" . "\\1TAB") ("<\\([^>]*\\)return>" . "\\1RET") ("<\\([^>]*\\)escape>" . "\\1ESC") ("<\\([^>]*\\)delete>" . "\\1DEL"))) nil) (when rep (setq key (read-kbd-macro (let (...) (replace-regexp-in-string ... ... ...))))) (when (key-binding key) (throw (quote exit) (key-binding key))))))
  (let* ((orgstruct-mode) (binding (let ((key [S-iso-lefttab])) (catch (quote exit) (dolist (rep (quote ...) nil) (when rep (setq key ...)) (when (key-binding key) (throw ... ...))))))) (if (keymapp binding) (org-set-transient-map binding) (let ((func (or binding (unless disable (quote orgstruct-error))))) (when func (call-interactively func)))))
  (if fallback (let* ((orgstruct-mode) (binding (let ((key [S-iso-lefttab])) (catch (quote exit) (dolist (rep ... nil) (when rep ...) (when ... ...)))))) (if (keymapp binding) (org-set-transient-map binding) (let ((func (or binding (unless disable ...)))) (when func (call-interactively func))))) (org-run-like-in-org-mode (lambda nil (interactive) (let* ((org-heading-regexp (concat "^" orgstruct-heading-prefix-regexp "\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[        ]*$")) (org-outline-regexp (concat orgstruct-heading-prefix-regexp "\\*+ ")) (org-outline-regexp-bol (concat "^" org-outline-regexp)) (outline-regexp org-outline-regexp) (outline-heading-end-regexp "\n") (outline-level (quote org-outline-level)) (outline-heading-alist)) (call-interactively (quote org-shifttab))))))
  (let* ((disable nil) (fallback (or disable (not (let* ((org-heading-regexp ...) (org-outline-regexp ...) (org-outline-regexp-bol ...) (outline-regexp org-outline-regexp) (outline-heading-end-regexp "\n") (outline-level ...) (outline-heading-alist)) (org-context-p (quote headline) (quote item) nil)))))) (if fallback (let* ((orgstruct-mode) (binding (let ((key [S-iso-lefttab])) (catch (quote exit) (dolist ... ... ...))))) (if (keymapp binding) (org-set-transient-map binding) (let ((func (or binding ...))) (when func (call-interactively func))))) (org-run-like-in-org-mode (lambda nil (interactive) (let* ((org-heading-regexp (concat "^" orgstruct-heading-prefix-regexp "\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[     ]*$")) (org-outline-regexp (concat orgstruct-heading-prefix-regexp "\\*+ ")) (org-outline-regexp-bol (concat "^" org-outline-regexp)) (outline-regexp org-outline-regexp) (outline-heading-end-regexp "\n") (outline-level (quote org-outline-level)) (outline-heading-alist)) (call-interactively (quote org-shifttab)))))))
  orgstruct-hijacker-org-shifttab-2(1)
  call-interactively(orgstruct-hijacker-org-shifttab-2 nil nil)
  command-execute(orgstruct-hijacker-org-shifttab-2)
  • Works here (Emacs 24.5 on OS X). What system are you using? Can you set debug-on-error to t and rerun the command, if you get a stack trace place add it to your question. – Lindydancer Jul 17 '15 at 19:45
  • Looks like a bug in orgstruct-mode, it should be doing (read-kbd-macro "S-<iso-lefttab>"), not (read-kbd-macro "S-iso-leftTAB")` – npostavs Apr 21 '17 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.