Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandoc conversion on insert (markdown to org) is discarded #100

Open
cashpw opened this issue Dec 4, 2024 · 0 comments · May be fixed by #101
Open

Pandoc conversion on insert (markdown to org) is discarded #100

cashpw opened this issue Dec 4, 2024 · 0 comments · May be fixed by #101

Comments

@cashpw
Copy link

cashpw commented Dec 4, 2024

Am I missing something, or is the pandoc conversion on insert (from markdown to org-mode) not working? I think the root cause is the arguments passed to call-process-region. We should set BUFFER, DELETE, and DISPLAY to t.

Fixed version:

(defun emacs-everywhere-insert-selection ()
  "Insert the last text selection into the buffer."
  (pcase system-type
    ('darwin (progn
               (call-process "osascript" nil nil nil
                             "-e" "tell application \"System Events\" to keystroke \"c\" using command down")
               (sleep-for emacs-everywhere-clipboard-sleep-delay) ; lets clipboard info propagate
               (yank)))
    ((or 'ms-dos 'windows-nt 'cygwin)
     (emacs-everywhere-insert-selection--windows))
    (_ (when-let ((selection (gui-get-selection 'PRIMARY 'UTF8_STRING)))
         (gui-backend-set-selection 'PRIMARY "")
         (insert selection))))
  (when (and (eq major-mode 'org-mode)
             (emacs-everywhere-markdown-p)
             (executable-find "pandoc"))
    (apply #'call-process-region
           (point-min) (point-max) "pandoc"
           t t t
           emacs-everywhere-pandoc-md-args)
    (deactivate-mark) (goto-char (point-max)))
  (cond ((bound-and-true-p evil-local-mode) (evil-insert-state))))
cashpw pushed a commit to cashpw/emacs-everywhere that referenced this issue Dec 4, 2024
Overwrite the imported text on insert with the output from `pandoc`

Fixes tecosaur#100.
@cashpw cashpw linked a pull request Dec 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant