Closed mlwelles closed 8 months ago
Hi, thank you for cool PR!
Possibility to have clipboard history can really improve usability of Obsidian, but I'm not sure that embedding this functionality into the plugin can be the best solution for this case.
I want to propose an option with the plugin: https://github.com/Karakaz/obsidian-paste-from-history/tree/master
It doesn't work out of the box, and need a small patch of emacs-text-editor
:
diff --git a/main.ts b/main.ts
index 13264a2..5cd8657 100644
--- a/main.ts
+++ b/main.ts
@@ -178,6 +178,7 @@ export default class EmacsTextEditorPlugin extends Plugin {
}
navigator.clipboard.writeText(editor.getSelection())
+ document.dispatchEvent(new ClipboardEvent('copy'));
this.disableSelection(editor)
}
@@ -193,6 +194,7 @@ export default class EmacsTextEditorPlugin extends Plugin {
navigator.clipboard.writeText(editor.getSelection())
editor.replaceSelection("")
+ document.dispatchEvent(new ClipboardEvent('cut'));
this.disableSelection(editor)
}
From my side it's better option, because:
emacs-text-editor
should stay as small as possible to avoid overlapping functionality (and potential conflicts) with Obsidian runtime (and other plugins)Karakaz/obsidian-paste-from-history
has native UIDoes it make sense?
Solution from my previous comment added to Version 0.4.0.
Does it make sense?
Yes, but I think it means the plugin is misnamed.
It simply doesn't provide "emacs text editing" . I believe what's most important is that if you call it "emacs text support" it work like emacs. Kill and yank is not copy and paste. It's fundamentally different.
This is how it works in emacs.
And how it works in readline -- open a terminal and run bash or zsh, kill and yank works just like it does in in emacs -- not tied to the UI clipboard.
And how it works in macOS in every native text input widget since the NeXT step days. Integrated kill ring / yank support that is entirely independent of the application "cut and paste" clipboard.
One of the most furstrating things for me about using electron apps is that they don't use native widgets, and baseline text editing keystrokes that work everywhere else in the OS are broken.
I certainly don't begrudge your desire to create something different that you think would be better. Go for it!
But "emacs like" text editing isn't just keybindings. There's very specific (and long established) set of functionality that come with it. And folks like me who install it expecting that it provides these are going provided to be frustrated.
Again -- yank and kill is not copy and paste.
I'll probably go ahead and fork and publish my fork under a different name.
There's two different peers of mine I've recommended Obsidian to that abandoned it because, as they put it "editing is broken", and went back to using org-mode. I'd like to give them (and me) a reason to keep using it.
I completely agree that yank and kill is much more than just copy and paste.
Maybe this plugin (I've not tried it yet) can provide a more complete emacs-like experience.
Thank you again for your involvement.
Added kill ring buffer support
Logging changes
Makefile changes