- (indent-relative t) )
- ( (eq element '>)
- (indent-for-tab-command) )
- ( (eq element '<)
- (backward-delete-char-untabify (min tab-width (current-column))) )
- ( (eq element '_)
- (or point
- (setq point (point))) )
- ( (eq element '&)
- (if modified
- (setq definition (cdr definition))) )
- ( (eq element '|)
- (or modified
- (setq definition (cdr definition))) )
- ( (if (consp element)
- (or (stringp (car element))
- (consp (car element))))
- (while (skeleton-internal-list element (car element) t)) )
- ( (null element) )
- ( (skeleton-internal-1 (eval element)) )))
-
+ (indent-to (save-excursion
+ (goto-char pt)
+ (if pos (indent-according-to-mode))
+ (current-indentation)))))
+ (t (if pos (reindent-then-newline-and-indent)
+ (newline)
+ (indent-according-to-mode))))))
+ ((eq element '>)
+ (if (and skeleton-regions (eq (nth 1 skeleton) '_))
+ (indent-region (line-beginning-position)
+ (car skeleton-regions) nil)
+ (indent-according-to-mode)))
+ ((eq element '_)
+ (if skeleton-regions
+ (progn
+ (goto-char (pop skeleton-regions))
+ (and (<= (current-column) (current-indentation))
+ (eq (nth 1 skeleton) '\n)
+ (end-of-line 0)))
+ (or skeleton-point
+ (setq skeleton-point (point)))))
+ ((eq element '-)
+ (setq skeleton-point (point)))
+ ((eq element '&)
+ (when skeleton-modified (pop skeleton)))
+ ((eq element '|)
+ (unless skeleton-modified (pop skeleton)))
+ ((eq element '@)
+ (push (point) skeleton-positions))
+ ((eq 'quote (car-safe element))
+ (eval (nth 1 element)))
+ ((and (consp element)
+ (or (stringp (car element)) (listp (car element))))
+ ;; Don't forget: `symbolp' is also true for nil.
+ (if (symbolp (car-safe (car element)))
+ (while (and (skeleton-internal-list element nil t)
+ ;; If the interactor is nil, don't infinite loop.
+ (car element)))
+ (setq literal (car element))
+ (while literal
+ (skeleton-internal-list element (car literal))
+ (setq literal (cdr literal)))))
+ ((null element))
+ (t (skeleton-internal-1 (eval element) t recursive))))
+\f
+;; Maybe belongs into simple.el or elsewhere
+;; ;;;###autoload
+;; (define-skeleton local-variables-section
+;; "Insert a local variables section. Use current comment syntax if any."
+;; (completing-read "Mode: " obarray
+;; (lambda (symbol)
+;; (if (commandp symbol)
+;; (string-match "-mode$" (symbol-name symbol))))
+;; t)
+;; '(save-excursion
+;; (if (re-search-forward page-delimiter nil t)
+;; (error "Not on last page")))
+;; comment-start "Local Variables:" comment-end \n
+;; comment-start "mode: " str
+;; & -5 | '(kill-line 0) & -1 | comment-end \n
+;; ( (completing-read (format "Variable, %s: " skeleton-subprompt)
+;; obarray
+;; (lambda (symbol)
+;; (or (eq symbol 'eval)
+;; (user-variable-p symbol)))
+;; t)
+;; comment-start str ": "
+;; (read-from-minibuffer "Expression: " nil read-expression-map nil
+;; 'read-expression-history) | _
+;; comment-end \n)
+;; resume:
+;; comment-start "End:" comment-end \n)