From aaf9533c562c36ea0f499a08ea2f30480b03a547 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Thu, 17 Sep 2026 17:04:56 -0700 Subject: [PATCH] Fix bug when pasting Markdown-formatted text Now Markdown ain't no smushed anymore. Also, the `edit-indirect` allows me to edit source code in a Markdown file just like org. --- ha-org-clipboard.org | 2 +- ha-programming.org | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ha-org-clipboard.org b/ha-org-clipboard.org index 782a7a6..c52eebe 100644 --- a/ha-org-clipboard.org +++ b/ha-org-clipboard.org @@ -145,7 +145,7 @@ Let's define the clipboard for a Mac. The challenge here is that we need to bina (shell-command-with-exit-code "osascript" "-e" "the clipboard as \"HTML\"") (if (= 0 exit-code) (list :html (ha-convert-applescript-to-html contents)) - (list :text (shell-command-to-string "osascript -e 'the clipboard'"))))) + (list :text (string-replace "\r" "\n" (shell-command-to-string "osascript -e 'the clipboard'")))))) (defun ha-convert-applescript-to-html (packed-contents) "Applescript's clipboard returns the contents in a packed array. diff --git a/ha-programming.org b/ha-programming.org index 94f81da..5c6c8bc 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -1125,6 +1125,12 @@ Also, I like Markdown to look like a word processor, similarly to my org files: Note that the markdown-specific commands use the ~C-c C-c~ and ~C-c C-s~ prefixes. +The [[https://github.com/Fanael/edit-indirect/blob/master/edit-indirect.el][edit-indirect]] code allows me to edit triple-backtick code in a separate buffer. + +#+BEGIN_SRC emacs-lisp + (use-package edit-indirect) +#+END_SRC + *** Rendering with Pandoc We call both the =markdown-command= and the =markdown-open-command= variables to render (and preview) a Markdown file (~C-c C-c o~), and calls the following scripts (which in turn, call =pandoc= as I depend on this for other org-related features):