branch: elpa/edit-indirect commit c6b08f5cd7bc66f52206b23f213c85a09fab888c Author: Fanael Linithien <fana...@gmail.com> Commit: Fanael Linithien <fana...@gmail.com>
Call quit-window only when a window is created Fixes #2. --- edit-indirect.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/edit-indirect.el b/edit-indirect.el index c44af77f3f..c339f2bda4 100644 --- a/edit-indirect.el +++ b/edit-indirect.el @@ -7,7 +7,7 @@ ;; This file is NOT part of GNU Emacs. -;; Copyright (c) 2014, Fanael Linithien +;; Copyright (c) 2014-2016, Fanael Linithien ;; All rights reserved. ;; ;; Redistribution and use in source and binary forms, with or without @@ -143,7 +143,9 @@ In any case, return the edit-indirect buffer." (user-error "No region"))) (let ((buffer (edit-indirect--get-edit-indirect-buffer beg end))) (when display-buffer - (select-window (display-buffer buffer))) + (let ((window (display-buffer buffer))) + (set-window-parameter window 'edit-indirect-should-quit t) + (select-window window))) buffer)) (defvar edit-indirect-mode-map @@ -338,7 +340,9 @@ called with updated positions." ;; won't try to call us again. (setq edit-indirect--overlay nil) ;; If we created a window, get rid of it. Kill the buffer we created. - (quit-window t)) + (if (window-parameter nil 'edit-indirect-should-quit) + (quit-window t) + (kill-buffer))) (defun edit-indirect--abort-on-kill-buffer () "Abort indirect edit.