emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/edit-indirect de645d8144 21/28: Add edit-indirect-save fun


From: ELPA Syncer
Subject: [nongnu] elpa/edit-indirect de645d8144 21/28: Add edit-indirect-save function and keybinding
Date: Thu, 7 Jul 2022 11:59:14 -0400 (EDT)

branch: elpa/edit-indirect
commit de645d8144e8a08f039a9c88185121ec81d957ef
Author: Daniel Kraus <daniel@kraus.my>
Commit: Fanael Linithien <fanael4@gmail.com>

    Add edit-indirect-save function and keybinding
    
    Act the same way as `org-edit-src-save` which is also
    bound to `C-x C-s`.
    When editing an indirect buffer you most likely don't want
    to save that buffer to a new file on disk but rather update
    the region only.
---
 edit-indirect.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/edit-indirect.el b/edit-indirect.el
index e749b6c7b4..fa2d6efa0e 100644
--- a/edit-indirect.el
+++ b/edit-indirect.el
@@ -161,6 +161,7 @@ In any case, return the edit-indirect buffer."
 
 (defvar edit-indirect-mode-map
   (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-x C-s") #'edit-indirect-save)
     (define-key map (kbd "C-c '") #'edit-indirect-commit)
     (define-key map (kbd "C-c C-c") #'edit-indirect-commit)
     (define-key map (kbd "C-c C-k") #'edit-indirect-abort)
@@ -182,6 +183,17 @@ buffer."
   (edit-indirect--commit)
   (edit-indirect--clean-up))
 
+(defun edit-indirect-save ()
+  "Save the modifications done in an edit-indirect buffer.
+That is, replace the original region in the parent buffer with the
+contents of the edit-indirect buffer.
+
+Can be called only when the current buffer is an edit-indirect
+buffer."
+  (interactive)
+  (edit-indirect--barf-if-not-indirect)
+  (edit-indirect--commit))
+
 (defun edit-indirect-abort ()
   "Abort indirect editing in the current buffer and kill the buffer.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]