Coder Social home page Coder Social logo

poly-org's Introduction

License GPL 3 MELPA

Polymode Logo

Polymode is a framework for multiple major modes (MMM) inside a single Emacs buffer. It is fast and has a simple but flexible object oriented design. Creating new polymodes normally takes a few lines of code.

Installation instructions and the full documentation are available at https://polymode.github.io/.

poly-org's People

Contributors

dvzubarev avatar maikol-solis avatar vspinu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

poly-org's Issues

unbound variables when invoking poly-org-mode

I fixed as follows:

diff --git a/poly-org.el b/poly-org.el
index 82050cc..6542cbc 100644
--- a/poly-org.el
+++ b/poly-org.el
@@ -98,15 +98,18 @@ Used in :switch-buffer-functions slot."
   (setq-local org-src-fontify-natively nil)
   (setq-local polymode-move-these-minor-modes-from-old-buffer
               (append '(org-indent-mode)
-                      polymode-move-these-minor-modes-from-old-buffer))
+                      (and (boundp 'polymode-move-these-minor-modes-from-old-buffer)
+                           polymode-move-these-minor-modes-from-old-buffer)))
   (setq-local polymode-run-these-before-change-functions-in-other-buffers
               (append '(org-before-change-function
                         org-element--cache-before-change
                         org-table-remove-rectangle-highlight)
-                      polymode-run-these-before-change-functions-in-other-buffers))
+                      (and (boundp 'polymode-run-these-before-change-functions-in-other-buffers)
+                           polymode-run-these-before-change-functions-in-other-buffers)))
   (setq-local polymode-run-these-after-change-functions-in-other-buffers
               (append '(org-element--cache-after-change)
-                      polymode-run-these-after-change-functions-in-other-buffers)))
+                      (and (boundp 'polymode-run-these-after-change-functions-in-other-buffers)
+                           polymode-run-these-after-change-functions-in-other-buffers))))
 
  ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.org\\'" . poly-org-mode))

wrong language parsing case

If you have an header with just the language and no spaces or other arguments, like #+begin_src python, when point is inside a polymode managed buffer (so a src block) org parses the language wrongly, it includes the subsequent line...the regex used by org to parse the language uses \S so any includes non white-space...and indeed \n is not a whitespace..but why does it happen only inside polymode? Parsing the point is at the header line works fine...

My current workaround is to just append a space to the end of the line if there isn't one

Collapsed source blocks expand when entering an org source code block with poly-org enabled

Hi.

First of all, thank you for Polymode. I've used it with great success for some time now.

Recently I upgraded to Emacs 28.1. Now, when I work in org mode with poly-org enabled, all collapsed source code blocks expand, and the cursor can jump to at different place.

In the two screenshots below I have an org file with five headings each with one emacs-lisp source code block which is collapsed. When the cursor moves into the block in heading 5, alle blocks are expanded and the cursor is moved to heading 2.
Ss1
Ss2

Org-mode navigation in R code blocks

Hi,
Is there a way to access org-mode navigation key binding when you are inside a R block. Currently, when I put the cursor in a R block ess keybindings take over and you can't use org-mode key binding like C-c C-n to move to different headers, etc. Is there a way around this? At the very least I would like to be able to jump out of the code the the parent header so I can access the org-keybindings again.

Alternatively is there a way to enable or disable ess when you are in the code block? Similar to previous behavior where we could do C-' to get a edit buffer ess mode?

thanks
FKG

consult-preview with poly-org don't work

Hi everyone!

I was doing some testing, and it's impossible to get poly-org with the preview feature. I think the problem comes from the fact that consult needs, in the "consult-preview-allowed-hooks" variable, a function like "global-org-modern-mode-check-buffers", which means that poly-org must also be in "global" mode. I've already done this, but without success (and I don't understand why... perhaps I've misunderstood something).

(require 'poly-org)

(define-globalized-minor-mode global-poly-org-mode
  poly-org-mode poly-org--on
  :group 'poly-org
  )

(defun poly-org--on ()
  "Enable `org-modern' in every Org buffer."
  (when (derived-mode-p #'org-mode)
    (poly-org-mode)))
    
    ;; not activate poly-org with this temporaly
;;(setq auto-mode-alist (remove '("\\.org\\'" . poly-org-mode) auto-mode-alist))

(add-to-list 'consult-preview-allowed-hooks 'global-poly-org-mode-check-buffers)

Hope that can help ^^

polyOrg and :session

Hi
I noticed that poly org seems to be ignoring the :session assign to the block.

Suppose I'm running multiple R session and I specify the code block to use a specific session (or I specify it for the buffer in the header). Then I would think poly org would automatically use the correct session to send the code to. Currently it ask you the first time which session to use and from then on it uses that session.

It seems to me that it would make sense if the :session header should define which R session to use.

thanks
FKG

Poly-org and org-capture

Buffer narrowing in org-capture is not working with poly-org-mode in the capture buffer.
Moreover, the C-c C-c and C-c C-k are not working.

make start from poly-org repo triggers error

I'm experiencing a couple issues when using poly-org. I tried to debug these by running make start from the poly-org repo. However, when I attempt to open an org buffer I get

File mode specification error: (wrong-type-argument eieio-object #s(pm-polymode unbound polyorg-polymode nil poly-org-hostmode (poly-org-innermode) (pm-exporter/pandoc) nil nil nil nil polymode-minor-mode-map nil poly-org-mode unbound nil nil nil) obj)

Have you encountered this? This is from an up-to-date poly-org mode and master branch emacs.

Polymode-org and org-mode buffer naviagation

I' updated to the latest version of polymode and poly-mode-org (20190605.2103) and the following errors started showing up in the Messages Buffer for my org file:

Error during redisplay: (poly-lock-function 1) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 4162) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 218181) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 699834) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 712692) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 855163) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 872268) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 953242) signaled (wrong-type-argument number-or-marker-p nil)
Error during redisplay: (poly-lock-function 962562) signaled (wrong-type-argument number-or-marker-p nil)]
(pm-switch-to-buffer 1286): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 4163): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 218182): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 699835): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 712693): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 722895): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 855164): Wrong type argument: number-or-marker-p, nil
(pm-switch-to-buffer 722895): Wrong type argument: number-or-marker-p, nil

Not sure what is happening here...

I tried entering the debugger on error, but it would not go to backtrace.

Any suggestions?

Shawn Way

'org-element-at-point’ cannot be used in non-Org buffer

When using poly-org I get a lot of warnings

⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer config.org[emacs-lisp]> (emacs-lisp-mode)
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer config.org[emacs-lisp]> (emacs-lisp-mode)
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer config.org[emacs-lisp]> (emacs-lisp-mode)
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer config.org[emacs-lisp]> (emacs-lisp-mode)
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer config.org[emacs-lisp]> (emacs-lisp-mode)
...

Note: config.orgis the file I am working on

These are very annoying.
For reference. I am using Doom Emacs and the following configuration

packages.el
(package! polymode)
(package! poly-org)
config.el
(after! org
  (require 'poly-org))

Any help fixing/avoiding these warnings would be greatly appreciated

slow editing for large org files

I'm experiencing a several-second lag when editing a large org-mode file (276K) with poly-org-mode enabled. polymode, poly-org and org-mode are all updated to the latest commit. I can disable polymode with M-x poly-org-mode and the issue disappears, but I really like the functionality polymode provides and would like to continue using it by default if possible. Moreover, switching is a bit inconvenient because it collapses my org headers whenever I disable it (although not when I reenable).

As a side note, when I switch between having polymode on and off, the message displayed is always "org polymode enabled" regardless of whether it's being enabled or disabled, even though it switches fine.

Poly-org breaks narrowing state when the cursor is inside a code block

Steps to reproduce:

  1. Open an org-mode file with multiple entries.
  2. Narrow to one of the entries containing a source block.
  3. Move cursors to the source block.

Expected behavior: the narrowing should be preserved
Observed behavior: the whole buffer is shown while the cursor is inside the code block. The narrowing is restored when the cursor is moved out of the code block.

Preserve left-/right-margin-width

Hi,

I've set my left- and right-margin-width for org-mode:

(use-package org
  :ensure nil
  :config
  (defun jh/toggle-org-mode-writing-configuration ()
    (interactive)
    (buffer-face-set '(:family "IBM Plex Mono"))
    (setq header-line-format " ")
    (setq line-spacing 0.1)
    (setq left-margin-width 2)
    (setq right-margin-width 2)
    (set-window-buffer nil (current-buffer)))
  (add-hook 'org-mode-hook 'jh/toggle-org-mode-writing-configuration))

However, when the poly-org-mode is on and when my point is in inside the source block, the margin resets itself. To see it in action:
simplescreenrecorder-2022-02-25_13 19 55

About Emacs:
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)

Set 'polymode-eval-region-function'

Normally I eval code blocks by moving my cursor inside them (e.g. in the middle of the code block) and pressing C-c C-c, which runs org-ctrl-c-ctrl-c.

It seems that the new way to do this in polymode is to use M-n v v (polymode-eval-region-or-chunk). However running that gets me:

polymode-eval-chunk: Undefined ‘polymode-eval-region-function’ in buffer .config.org[emacs-lisp]

The solution is here:
https://github.com/dcostaras/environment/blob/912226a337f30b62a769fb64c2f383d68acb1ca4/rc.org?plain=1#L1292-L1315

I think adding some code that sets polymode-eval-region-function as a setlocal in the .org buffer when (poly-org-mode) is ran would make the package more "batteries included". What do you think?

Or perhaps I'm confused and I should still be using C-c C-c? I'm not sure

Adding LaTeX delimiters \[...\] and \(...\)

I added the the non-symmetric delimiters [...] and (...). I also changed the search for \begin{} and \end{} regular expressions so they don't have to be on a line by themselves. The diff of the code is shown below. I've been testing this the last few days and found:

  1. poly-org can find the latex expressions and set the mode accordingly
  2. poly-org-mode causes org to not render /italic words/ in the graphical interface. When opening a document containing some words in italics emacs will render them properly, but if poly-org-mode is on and you run the cursor over the italicized word, then it will show the slashes and will not return to being italicized after the cursor leaves the word.
  3. I have observed some times that the mode will get stuck in latex. I don't know for sure why or when this happens.

Any help would be greatly appreciated in figuring this out. Also, I don't know how to approach the symmetric delimiters $...$ or $$...$$.

-EM
edited for clarity

diff.txt

Wrong org-ellipsis in poly-org with point in a source block

Poly-org changes non-default symbol used to indicate folding in org mode (" ⤵") by its default value ("..."), while it should not be the case.

The issue can be reproduced with the following config for emacs -Q.

  1. Load the config
  2. Open an org file with source blocks
  3. Move the point in to and out from a source block
  4. Observe repetitive changes between " ⤵" and "..."
  (require 'package)
  (setq package-archives '(("MELPA" . "https://melpa.org/packages/") ("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") ("org" . "http://orgmode.org/elpa/"))
	load-prefer-newer t
	package-user-dir "~/.emacs.d/elpa/"
	package--init-file-ensured t
	package-enable-at-startup nil)
  (unless (file-directory-p package-user-dir)
    (make-directory package-user-dir t))
  (setq load-path (append '("~/.emacs.d/site-lisp/") load-path))
  (setq load-path (append (directory-files "~/.emacs.d/site-lisp/" t "^[^.]" t) load-path))
  (setq load-path (append (directory-files package-user-dir t "^[^.]" t) load-path))
  (add-hook 'after-init-hook #'package-initialize)
  (package-initialize 'NO-ACTIVATE)
;; Package management & configuration:2 ends here

;; [[id:4c0a06f9-9e69-4ead-b570-e3143fa0d61d][Package management & configuration:3]]
(require 'use-package)
(use-package diminish :ensure t)
(require 'bind-key)
;; Package management & configuration:3 ends here
(setq org-ellipsis " ⤵")
(use-package polymode
  :ensure t
  :init
  (use-package poly-org
    :ensure t
    :config
    (setq poly-lock-allow-fontification nil)
    (defun org-source-block-major-mode ()
      "Return the name of major mode for the org source block at point."
      (when (re-search-forward "#\\+begin_src +\\([^ \t\n]+\\)")
        (if (string-match "\\(bash\\|sh\\|shell\\)" (match-string 1))
            "sh"
          (format "%s" (match-string 1)))))
    (setq pm-inner/org
	  (pm-inner-auto-chunkmode :name "org"
				   :mode 'host
				   :head-mode 'host
				   :tail-mode 'host
				   :head-matcher "^[ \t]*#\\+begin_src .*\n"
				   :tail-matcher "^[ \t]*#\\+end_src"
				   :head-adjust-face nil
				   :mode-matcher #'org-source-block-major-mode
				 :indent-offset org-edit-src-content-indentation))
    ))

poly-org mode slows down insertions to large org files

I have several large org files (>12000 lines) for keeping notes, and for which I do not need poly-org-mode (I do need it for other org files).
When I try inserting text in one of the large files with poly-org-mode running it is extremely slow (approx 1 second lag between each character insertion).
I cannot find a way to easily turn poly-org-mode off; with most other minor modes you can turn them off by entering the mode command with a negative argument, but that doesn't work with poly-org-mode.

Poly-org sends entire org file to python

Hi,

Instead of sending the specific codes in a code block, "C-c C-c" sends everything (including notes, results, headlines, etc.) in an org file to Python repl. Could you be able to help me with this issue?

But in an R code block, poly-org works as expected.

Thanks!

Support for lexical binding

Hi. As you know, in elisp blocks one can specify that their evaluation be performed with lexical-binding set to t. But, as far as i can tell, poly-org is oblivious of that setting: when i enter an elisp block, it always shows as set in dynamical binding, and evaluations inside with, say, C-x C-e, are performed with lexical-binding set to nil. Would it be possible to inherit the org block header setting?

Thanks!

Flycheck mixes code and text in org buffer

When flycheck is enabled in the major mode of code blocks, it actually checks all the org buffer when in poly-org mode.
As a result, many flycheck errors are actually triggering on the text in buffer.

Polymode is triggered in #+Latex_Header org document

Hi,

It seems that a recent change introduced an issue relative to the headers of an org document. Consider the following header:
bug_pm

As you can see, when opening the document, polymode triggers latex-mode starting from line 13, to the end of the document, which is not what we want. (In particular, this prevents the correct use of org mode for the whole document; see for instance line 18 which is still in latex-mode.)

Looks like certain expressions are treated differently since a recent update --- the exact same header did not raise any problem with versions of polymode around late December 2021.

Indents despite org-src-preserve-indentation

The help text for org-edit-src-content-indentation states, "[org-edit-src-content-indentation] has no effect if org-src-preserve-indentation is non-nil." However, the value of :indent-offset in define-auto-innermode does not take into account the value of org-src-preserve-indentation.

Any easy workaround for users is to set org-edit-src-content-indentation to 0. Alternatively, if the argument to :indent-offset can be a quoted function, one could easily be defined to respect both values.

Defining polymode for ESS[julia]

Hi,

This is just a noob question and absolutely not a bug report :)

I'm currently trying to write a fork for the ob-julia package, bringing back Julia into Org mode. Everything works great with polymode's autodetection: since the src blocks begin with #+begin_src julia, it associates julia-mode as innermodes for Julia source blocks. As I understand it, it's simply the result of the :mode-matcher #'poly-org-mode-matcher part in poly-org.el, that searches for the language in the header of the src block.

My goal would be to trigger automatically ess-julia-mode as innermode for Julia code blocks, instead of julia-mode. I.e., bypass the automated association made by poly-org-mode-matcher, by defining a new polymode (I suppose?). How could I do that? I tried some naive approaches, such as:

(define-innermode poly-org-julia-innermode
  :mode 'ess-julia-mode
  :head-mode 'host
  :tail-mode 'host
  :head-matcher "^[ \t]*\\#\\+begin_src julia *\n"
  :tail-matcher "^[ \t]*\\#\\+end_src")

(define-polymode poly-org-julia-mode
  :hostmode 'poly-org-hostmode
  :innermodes '(poly-org-julia-innermode))

(add-to-list 'auto-mode-alist '("\\.org\\'" . poly-org-julia-mode))

but this doesn't work. What could be the right way to do that?

Many thanks for your great package!


P.-S.: here is an example of Julia src block, just in case.

#+begin_src julia :results output :exports both
println("Hello world!")
#+end_src

C-c C-c in lisp blocks doesn't work as expected

If I have the following .org file:

#+begin_src lisp
  (asdf:load-system "alexandria")  
#+end_src

And I move the cursor into the block and hit C-c C-c, I get an error message such as the following:

poly-org-lisp-test/README-2.org:5:10:
  read-error: 
    READ error during COMPILE-FILE:
    
      end of file on #<SB-INT:FORM-TRACKING-STREAM for "file /tmp/slimetul4IH" {1005A0CFC3}>
    
      (in form starting at line: 5, column: 0, position: 53)

Compilation failed.

with SBCL, and with ABCL, I get:

   [Condition of type READER-ERROR]

Restarts:
 0: [ABORT] Abort compilation.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Abort thread.

Backtrace:
  0: (INVOKE-DEBUGGER #<READER-ERROR {14C15C16}>)
  1: org.armedbear.lisp.Lisp.error(Lisp.java:382)
  2: org.armedbear.lisp.LispReader$4.execute(LispReader.java:101) = #<function READ-RIGHT-PAREN {7CC89B3C}>
  3: org.armedbear.lisp.Stream.processChar(Stream.java:589)
  4: org.armedbear.lisp.Stream.readPreservingWhitespace(Stream.java:558)
  5: org.armedbear.lisp.Stream.read(Stream.java:501)
  6: org.armedbear.lisp.Stream$16.execute(Stream.java:2451) = #<function READ {2D99708D}>
  7: org.armedbear.lisp.Symbol.execute(Symbol.java:838)
  8: org.armedbear.lisp.LispThread.execute(LispThread.java:872)
  9: org.armedbear.lisp.read_conditional_2.execute(read-conditional.lisp:39) = #<function READ-CONDITIONAL {69E0C94D}>
 10: org.armedbear.lisp.LispThread.execute(LispThread.java:851)
 11: org.armedbear.lisp.Stream.readDispatchChar(Stream.java:817)
 12: org.armedbear.lisp.LispReader$6.execute(LispReader.java:130) = #<function READ-DISPATCH-CHAR {1995EAA7}>
 13: org.armedbear.lisp.Stream.processChar(Stream.java:589)
 14: org.armedbear.lisp.Stream.readList(Stream.java:756)
 15: org.armedbear.lisp.LispReader$3.execute(LispReader.java:88) = #<function READ-LIST {3B9CD93B}>
 16: org.armedbear.lisp.Stream.processChar(Stream.java:589)
 17: org.armedbear.lisp.Stream.readPreservingWhitespace(Stream.java:558)
 18: org.armedbear.lisp.Stream.readPreservingWhitespace(Stream.java:567)
 19: (READ #S(SYSTEM::STRING-INPUT-STREAM) T NIL T)

Not sure if this is a polymode, poly-org, org-mode problem, or what, but any help would be appreciated.
Thanks!

Preserve line-spacing

Hi,

I've set a custom line-spacing for Org-mode. And when my point is inside the src-blocks, the line-spacing resets itself. To see it in action:
simplescreenrecorder-2022-02-28_08 58 42

Thanks!

About Emacs:
GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)

Indentation and source block style issues

I'd love to use this package, but every time I move into a source block and start typing, the indentation isn't detected correctly. The cursor jumps outside of the block to the first column while inside.

Another issue is that the #+end_src styling is not applied in some cases. I have a custom background and foreground for those, and when using this mode, that styling disappears.

Font lock is not reapplied when org-indent-mode is turned on

I updated my setup recently and now (with org 9.3) I have issues with font-locking. While the spans are identified correctly and the mode changes appropriately, the font lock is only applied initially and and not reapplied through edits within the indirect buffer. Further, at some point the font-lock is lost at all. I had a look and disabling org-indent-mode or setting org-startup-indented to nil seems to make font-locking work again.

Here is the output of pm-debug-relevant-variables:

================== thesis.org ===================
((:change
  (before-change-functions whitespace-buffer-changed org-ref-delete-labels org-indent-notify-modified-headline org-before-change-function t sp--reset-memoization)
  (after-change-functions polymode-flush-syntax-ppss-cache poly-lock-after-change flycheck-handle-change org-indent-refresh-maybe t ws-butler-after-change))
 (:command
  (pre-command-hook polymode-pre-command-synchronize-state eldoc-pre-command-refresh-echo-area evil--jump-hook company-pre-command t)
  (post-command-hook polymode-post-command-select-buffer whitespace-post-command-hook eldoc-schedule-timer evil-normal-post-command company-post-command flycheck-hide-error-buffer flycheck-display-error-at-point-soon flycheck-error-list-highlight-errors flycheck-error-list-update-source flycheck-perform-deferred-syntax-check hl-line-maybe-unhighlight hl-line-highlight yas--post-command-handler t))
 (:font-lock
  (fontification-functions poly-lock-function)
  (font-lock-function . poly-lock-mode)
  (font-lock-flush-function . poly-lock-flush)
  (font-lock-ensure-function . poly-lock-fontify-now)
  (font-lock-fontify-region-function . font-lock-default-fontify-region)
  (font-lock-fontify-buffer-function . poly-lock-flush)
  (font-lock-unfontify-region-function . org-unfontify-region)
  (font-lock-unfontify-buffer-function . font-lock-default-unfontify-buffer)
  (jit-lock-after-change-extend-region-functions font-lock-extend-jit-lock-region-after-change t)
  (jit-lock-functions font-lock-fontify-region org-ref-add-labels)
  (poly-lock-defer-after-change . t))
 (:search
  (parse-sexp-lookup-properties . t)
  (parse-sexp-ignore-comments)
  (case-fold-search . t))
 (:indent
  (indent-line-function . pm-indent-line-dispatcher)
  (indent-region-function . pm-indent-region)
  (pm--indent-line-function-original . org-indent-line))
 (:revert
  (revert-buffer-function . revert-buffer--default)
  (before-revert-hook flycheck-teardown t ws-butler-before-revert)
  (after-revert-hook t ws-butler-after-save))
 (:save
  (after-save-hook flycheck-handle-save t ws-butler-after-save)
  (before-save-hook +org-update-cookies-h toc-org-insert-toc org-encrypt-entries t ws-butler-before-save)
  (write-contents-functions)
  (local-write-file-hooks)
  (write-file-functions whitespace-write-file-hook recentf-track-opened-file doom--recentf-touch-buffer-h undo-tree-save-history-hook))
 (:syntax
  (syntax-propertize-function . polymode-syntax-propertize)
  (syntax-propertize-extend-region-functions syntax-propertize-wholelines)
  (pm--syntax-propertize-function-original)))

Losing org text properties

I made the observation that org text properties are somewhat falling apart inside chunks after edititing in innermodes. E.g. i cannot check for org-in-src-block-p anymore (that function internally relies on (get-char-property). Is there anything I can do to make sure that text properties are reliably moved to the respective innermodes (ess and elisp in my case). My current workaround is a custom version of that predicate that falls back to org-element-context and org-element-type.

Autocomplete broken in anaconda-mode blocks

Autocompletion fails with a timeout if I'm editing in a poly-org block.

I'm using anaconda-mode, company-mode, and company-anaconda. The combination works as expected in normal source buffers.

Wrong major mode in bash/shell code blocks

The current implementation of :mode-matcher for poly-org assumes that language string in the src block is exactly same as the corresponding major mode.
However, it is not always the case.
Specifically, the following should be edited in sh-mode.

#+begin_src bash 
ls
#+end_src

The correct way to determine major mode would be calling org-src--get-lang-mode on the language name in the src block.

How to disable Variable Pitch Mode

Hi,
I use Org Mode with the Variable Pitch Mode enabled. I have configured the org-block face, so that it inherits the fixed-pitch face, so that the font in the source blocks is still a monospace font.
However this setup stoped working, when I enable poly-org, since now the org-block face is not applied (As far as I can tell.) and the innermodes still have the variable pitch mode enabled for some reason. I can move into a block manually and disable the variable-pitch mode manually there; or I can use the switch buffer hooks that polymode provides in order to disable the variable pitch mode, whenever I enter a source block.
But this solution starts out with the variable pitch mode enabled for the inner buffers, which is really ugly and I havn't found a way to disable the Variable Pitch Mode only in the innermodes when opening a new org-file.
How would I do that?

Poly-org-mode-map and evil

Another observation:

poly-org-mode-map is applied only after switching to insert-state first? What is the best way to initially take care of precedence of poly-org-mode-map over evil-normal-state-map?

Org properties etc not accessible within blocks

Hello! Discovered this package today & love it.

My problem: Within a code block, when poly-org-mode is enabled, (org-entry-properties) returns nil. This seems to be the same for various other org-specific functions.

(My specific use case is calling org-babel-tangle, which seems to be broken by this, although I haven't tested extensively).

It would be nice to be able to execute code within the context of the "other" mode, perhaps via a macro (poly-with-org-mode ...), or if the issue affects other poly mode-pairings, (poly-with-outer-mode ...).

This issue may be related to other issues that are already on here - I looked but couldn't tell. Apologies if it's effectively a duplicate.

Scope is not narrowed consistently for other modes (causing problems for paredit, in particular)

The following simple file:

* Table test
|--------+---------|
| Foo    | Bar     |
|--------+---------|
| Mouse  | Moose   |
| Donkey | Giraffe |
|--------+---------|

* Lisp test

#+begin_src lisp :session

  (format nil "Hello world!")
  
#+end_src

results in the following error when I try to open it with poly-org mode:

Polymode error (pm--mode-setup ’lisp-mode): Unmatched bracket or quote

If I delete one of the table lines (reducing the table to a header line and a single line of table contents, everything works fine.

Disable poly-org-latex-inner-mode

Hi,

After updating emacs packages, I noticed that the major mode for org files switches to latex/MPS whenever
the cursor enters a math environment \begin{equation} ... \end{equation}.

I believe this is due to poly-org-latex-inner-mode.

This breaks org-latex-impatient-mode (yangsheng6810/org-latex-impatient#18)
and furthermore after modifying one equation and saving the buffer I get the error :

Not enabling jit-lock: it does not work in indirect buffer

Then, polymode does not seem to work anymore until I reload the org file.

How can I disable poly-org-latex-inner-mode ?

Regards

poly-org breaks syntax highlighting

It seems that syntax hightlighting is broken, at least for python source blocks.
With poly-org enabled it looks like:
with
Without it:
without

My org-mode and poly-org configs:

(use-package org
  :ensure nil
  :config
  ; (org-babel-jupyter-override-src-block "python")
  (add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
  (add-to-list 'org-structure-template-alist '("p" . "src python"))
  :custom
  (org-startup-indented t)
  (org-startup-with-inline-images t)
  (org-src-tab-acts-natively t)
  (org-src-preserve-indentation nil)
  (org-edit-src-content-indentation 2)
  (org-src-window-setup 'current-window)
  (org-babel-load-languages '((emacs-lisp . t) (python . t))))

(use-package polymode)
(use-package poly-org)

(use-package org-superstar
  :hook (org-mode . (lambda () (org-superstar-mode 1))))

(use-package evil-org
  :after (org evil)
  :hook ((org-mode . evil-org-mode)
	 (evil-org-mode . (lambda ()
			    (evil-org-set-key-theme
			     '(navigation insert textobjects additional calendar))))))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.