Skip to content

Commit

Permalink
Merge pull request #40 from gongzhitaao/patch-1
Browse files Browse the repository at this point in the history
Fix #39 Remove call to `edit-indirect--clean-up`
  • Loading branch information
twlz0ne authored Jan 19, 2024
2 parents 9f5027a + 7154548 commit bfd0902
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions separedit.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
;; Author: Gong Qijian <[email protected]>
;; Created: 2019/04/06
;; Version: 0.3.37
;; Last-Updated: 2023-05-13 10:33:45 +0800
;; by: Gong Qijian
;; Package-Requires: ((emacs "25.1") (dash "2.18") (edit-indirect "0.1.5"))
;; Last-Updated: 2024-01-18 10:54:45 -0500
;; by: Zhitao Gong
;; Package-Requires: ((emacs "25.1") (dash "2.18") (edit-indirect "0.1.11"))
;; URL: https://github.com/twlz0ne/separedit.el
;; Keywords: tools languages docs

Expand Down Expand Up @@ -1677,7 +1677,7 @@ It will override by the key that `separedit' binding in source buffer.")
(scp (nth 3 separedit--help-variable-edit-info))
(buf (nth 4 separedit--help-variable-edit-info))
(val (if (nth 2 separedit--help-variable-edit-info)
(substring-no-properties (buffer-string))
(substring-no-properties (buffer-string))
(list 'quote (car (read-from-string (buffer-string)))))))
(cond
((and (eq scp 'local) buf) (with-current-buffer buf (eval `(setq-local ,sym ,val))))
Expand All @@ -1699,15 +1699,15 @@ It will override by the key that `separedit' binding in source buffer.")
;; Clone a buffer to protect the folding of text in edit buffer.
(clone-buffer (concat (buffer-name) " <clone>")))
(function-backup
;; Temprary disable the ‘edit-indirect--clean-up’ (but who calls
;; Temprary disable the ‘edit-indirect--abort’ (but who calls
;; this function after the clone buffer is killed?)
(symbol-function 'edit-indirect--clean-up)))
(symbol-function 'edit-indirect--abort)))
(unwind-protect
(with-current-buffer edit-buffer-clone
(fset 'edit-indirect--clean-up (lambda ()))
(fset 'edit-indirect--abort #'ignore)
(separedit--apply-changes))
(kill-buffer edit-buffer-clone)
(fset 'edit-indirect--clean-up function-backup)
(fset 'edit-indirect--abort function-backup)
(if (and separedit-write-file-when-execute-save
(buffer-file-name source-buffer))
(with-current-buffer source-buffer
Expand All @@ -1727,7 +1727,7 @@ It will override by the key that `separedit' binding in source buffer.")
(mark-beg (overlay-start edit-indirect--overlay))
(mark-end (overlay-end edit-indirect--overlay)))
(separedit--apply-changes)
(edit-indirect--clean-up) ;; Returned to source buffer
(edit-indirect--abort t) ;; Returned to source buffer
(goto-char
(save-excursion
(save-restriction
Expand Down Expand Up @@ -1844,7 +1844,7 @@ MAX-WIDTH maximum width that can be removed"
(defun separedit--remove-c/c++-macro-delimiter (_ &optional _)
"Remove c/c++ macro delimiter of each line when etering edit buffer."
(let ((inhibit-read-only t)
;; Regexp from `separedit-block-regexp-plists' is not working as
;; Regexp from `separedit-block-regexp-plists' is not working as
;; expected when search backward, use the following instead:
(regexp "\\(?:[^\s\t]\\|^[\s\t]\\)\\([\s\t]*\\\\[\s\t]*\\)"))
(save-excursion
Expand Down

0 comments on commit bfd0902

Please sign in to comment.