summaryrefslogtreecommitdiff
path: root/lisp/skeleton.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-12-07 16:36:09 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-07 16:36:09 +0100
commit3ee94cc7bb657f0d3186d344fb1236b50edd5f69 (patch)
treea2cd88d67d3b0f793b987095d0cc17803f5c91a9 /lisp/skeleton.el
parentb218c8b6b587d4f0629cbe81bf2dba95d07844d0 (diff)
downloademacs-3ee94cc7bb657f0d3186d344fb1236b50edd5f69.tar.gz
Insert skeletons at the correct point
* lisp/skeleton.el (skeleton-read): Don't insert the skeleton at an arbitrary point if the user moves around (bug#17752).
Diffstat (limited to 'lisp/skeleton.el')
-rw-r--r--lisp/skeleton.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index 6e2c10d9711..5578a937d76 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -312,10 +312,15 @@ automatically, and you are prompted to fill in the variable parts.")))
(save-excursion (insert "\n")))
(unwind-protect
(setq prompt (cond ((stringp prompt)
- (read-string (format prompt skeleton-subprompt)
- (setq initial-input
- (or initial-input
- (symbol-value 'input)))))
+ ;; The user may issue commands to move
+ ;; around (like `C-M-v'). Ensure that we
+ ;; insert the skeleton at the correct
+ ;; (initial) point.
+ (save-excursion
+ (read-string (format prompt skeleton-subprompt)
+ (setq initial-input
+ (or initial-input
+ (symbol-value 'input))))))
((functionp prompt)
(funcall prompt))
(t (eval prompt))))