[oni-org] Fix using ‘oni-org-move-subtree’ multiple times in a row
Before, because of the use of ‘org-cut-subtree’, which in turn calls ‘kill-region’, which checks to see if ‘last-command’ equals ‘kill-region’ and uses either ‘kill-append’ or ‘kill-new’ repeated uses of the ‘oni-org-move-subtree’ command would append cut subtrees together and repeatedly paste the same subtrees over and over again. Setting ‘this-command’ will make sure that when the ‘kill-region’ checks the value of ‘last-command’ it won't find ‘kill-region’ there.
This commit is contained in:
parent
4b94f8403c
commit
da68ca4f7d
1 changed files with 4 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
;; Author: Tom Willemse <tom@ryuslash.org>
|
;; Author: Tom Willemse <tom@ryuslash.org>
|
||||||
;; Keywords: local
|
;; Keywords: local
|
||||||
;; Version: 2022.0508.160831
|
;; Version: 2022.0513.111418
|
||||||
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
|
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons olivetti mixed-pitch)
|
||||||
|
|
||||||
;; This program is free software; you can redistribute it and/or modify
|
;; This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -876,14 +876,15 @@ placed above TARGET. Otherwise it will be placed below it."
|
||||||
(intern (completing-read "Above / Below: " '(above below) nil t))))
|
(intern (completing-read "Above / Below: " '(above below) nil t))))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(let ((heading-level (car (org-heading-components)))
|
(let ((heading-level (car (org-heading-components)))
|
||||||
(marker (copy-marker (nth 3 target))))
|
(marker (copy-marker (nth 3 target)))
|
||||||
|
(this-command t))
|
||||||
(org-cut-subtree)
|
(org-cut-subtree)
|
||||||
(goto-char marker)
|
(goto-char marker)
|
||||||
(unless (eq placement 'above)
|
(unless (eq placement 'above)
|
||||||
(org-forward-heading-same-level 1)
|
(org-forward-heading-same-level 1)
|
||||||
(when (= (point) (marker-position marker))
|
(when (= (point) (marker-position marker))
|
||||||
(goto-char (point-max))))
|
(goto-char (point-max))))
|
||||||
(org-paste-subtree heading-level))))
|
(org-paste-subtree heading-level nil nil t))))
|
||||||
|
|
||||||
(provide 'oni-org)
|
(provide 'oni-org)
|
||||||
;;; oni-org.el ends here
|
;;; oni-org.el ends here
|
||||||
|
|
Loading…
Reference in a new issue