]> code.delx.au - gnu-emacs/blobdiff - lisp/skeleton.el
Minor fixes in w32-shell-execute.
[gnu-emacs] / lisp / skeleton.el
index a7eae7464e2c5cde4301bb9c503570d08275363f..ac6550efe1b30a240fa0e95d8249f13b4b1e8314 100644 (file)
@@ -356,15 +356,6 @@ automatically, and you are prompted to fill in the variable parts.")))
       (signal 'quit 'recursive)
     recursive))
 
-(defun skeleton-newline ()
-  (if (or (eq (point) skeleton-point)
-          (eq (point) (car skeleton-positions)))
-      ;; If point is recorded, avoid `newline' since it may do things like
-      ;; strip trailing spaces, and since recorded points are commonly placed
-      ;; right after a trailing space, calling `newline' can destroy the
-      ;; position and renders the recorded position incorrect.
-      (insert "\n")
-    (newline)))
 
 (defun skeleton-internal-1 (element &optional literal recursive)
   (cond
@@ -384,7 +375,7 @@ automatically, and you are prompted to fill in the variable parts.")))
     (let ((pos (if (eq element '>) (point))))
       (cond
        ((and skeleton-regions (eq (nth 1 skeleton-il) '_))
-       (or (eolp) (newline))
+       (or (eolp) (insert "\n"))
        (if pos (save-excursion (goto-char pos) (indent-according-to-mode)))
        (indent-region (line-beginning-position)
                       (car skeleton-regions) nil))
@@ -393,13 +384,13 @@ automatically, and you are prompted to fill in the variable parts.")))
        (if pos (indent-according-to-mode)))
        (skeleton-newline-indent-rigidly
        (let ((pt (point)))
-         (skeleton-newline)
+          (insert "\n")
          (indent-to (save-excursion
                       (goto-char pt)
                       (if pos (indent-according-to-mode))
                       (current-indentation)))))
        (t (if pos (reindent-then-newline-and-indent)
-           (skeleton-newline)
+           (insert "\n")
            (indent-according-to-mode))))))
    ((eq element '>)
     (if (and skeleton-regions (eq (nth 1 skeleton-il) '_))
@@ -518,7 +509,6 @@ symmetrical ones, and the same character twice for the others."
     (let* ((mark (and skeleton-autowrap
                      (or (eq last-command 'mouse-drag-region)
                          (and transient-mark-mode mark-active))))
-          (skeleton-end-hook)
           (char last-command-event)
           (skeleton (or (assq char skeleton-pair-alist)
                         (assq char skeleton-pair-default-alist)
@@ -529,7 +519,9 @@ symmetrical ones, and the same character twice for the others."
                       (if (not skeleton-pair-on-word) (looking-at "\\w"))
                       (funcall skeleton-pair-filter-function))))
          (self-insert-command (prefix-numeric-value arg))
-       (skeleton-insert (cons nil skeleton) (if mark -1))))))
+       ;; Newlines not desirable for inserting pairs.  See bug#16138.
+       (let ((skeleton-end-newline nil))
+         (skeleton-insert (cons nil skeleton) (if mark -1)))))))
 
 \f
 ;; A more serious example can be found in sh-script.el