diff options
author | David Aspinall <da@inf.ed.ac.uk> | 2012-08-14 10:37:25 +0000 |
---|---|---|
committer | David Aspinall <da@inf.ed.ac.uk> | 2012-08-14 10:37:25 +0000 |
commit | caf7542b618ef6e39853613733c5aa7d4607f224 (patch) | |
tree | b130d13cc2d5fe9cb6749cba24eebc1576344c41 /generic/pg-user.el | |
parent | cdacdc30c3708e1a824ada65584f6d6a5a4bc03d (diff) |
Add user option proof-next-command-insert-space.
Diffstat (limited to 'generic/pg-user.el')
-rw-r--r-- | generic/pg-user.el | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/generic/pg-user.el b/generic/pg-user.el index 3ff06579..10e27da9 100644 --- a/generic/pg-user.el +++ b/generic/pg-user.el @@ -41,27 +41,29 @@ ;;;###autoload (defun proof-script-new-command-advance () - "Move point to a nice position for a new command. -Assumes that point is at the end of a command." + "Move point to a nice position for a new command, possibly inserting spaces. +Assumes that point is at the end of a command. +No effect if `proof-next-command-insert-space' is nil." (interactive) - (let (sps) - (if (and (proof-next-command-new-line) - (setq sps (skip-chars-forward " \t")) - ;; don't break existing lines - (eolp)) - (progn (newline) - (unless proof-next-command-on-new-line - (indent-relative)))) - (unless (proof-next-command-new-line) - ;; Multiple commands per line: skip spaces at point, and insert - ;; the 1/0 number of spaces that were skipped in front of point - ;; (at least one). This has the pleasing effect that the spacing - ;; policy of the current line is copied: e.g. <command>; - ;; <command>; Tab columns don't work properly, however. - (let ((newspace (max (or sps 1) (skip-chars-forward " \t"))) - (p (point))) - (insert-char ?\040 newspace) - (goto-char p))))) + (when proof-next-command-insert-space + (let (sps) + (if (and (proof-next-command-new-line) + (setq sps (skip-chars-forward " \t")) + ;; don't break existing lines + (eolp)) + (progn (newline) + (unless proof-next-command-on-new-line + (indent-relative)))) + (unless (proof-next-command-new-line) + ;; Multiple commands per line: skip spaces at point, and insert + ;; the 1/0 number of spaces that were skipped in front of point + ;; (at least one). This has the pleasing effect that the spacing + ;; policy of the current line is copied: e.g. <command>; + ;; <command>; Tab columns don't work properly, however. + (let ((newspace (max (or sps 1) (skip-chars-forward " \t"))) + (p (point))) + (insert-char ?\040 newspace) + (goto-char p)))))) (defun proof-maybe-follow-locked-end (&optional pos) |