;;; srecode/fields.el --- Handling type-in fields in a buffer.
;;
-;; Copyright (C) 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;;
;; Author: Eric M. Ludlam <eric@siege-engine.com>
;; Each field has 2 overlays. The second overlay allows control in
;; the character just after the field, but does not highlight it.
+;; @TODO - Cancel an old field array if a new one is about to be created!
+
;; Keep this library independent of SRecode proper.
(require 'eieio)
"While inserting a set of fields, collect in this variable.
Once an insertion set is done, these fields will be activated.")
+\f
+;;; Customization
+;;
+
(defface srecode-field-face
'((((class color) (background dark))
(:underline "green"))
"*Face used to specify editable fields from a template."
:group 'semantic-faces)
+(defcustom srecode-fields-exit-confirmation nil
+ "Ask for confirmation before leaving field editing mode."
+ :group 'srecode
+ :type 'boolean)
+
;;; BASECLASS
;;
;; Fields and the template region share some basic overlay features.
(oset ir fields srecode-field-archive)
(setq srecode-field-archive nil)
- ;; Initailize myself first.
+ ;; Initialize myself first.
(call-next-method)
)
(remove-hook 'post-command-hook 'srecode-field-post-command t)
(if (srecode-point-in-region-p ar)
nil ;; Keep going
- ;; We moved out of the temlate. Cancel the edits.
+ ;; We moved out of the template. Cancel the edits.
(srecode-delete ar)))
))
(defun srecode-field-exit-ask ()
"Ask if the user wants to exit field-editing mini-mode."
(interactive)
- (when (y-or-n-p "Exit field-editing mode? ")
+ (when (or (not srecode-fields-exit-confirmation)
+ (y-or-n-p "Exit field-editing mode? "))
(srecode-delete (srecode-active-template-region))))
(provide 'srecode/fields)
+;; arch-tag: 00cea6f0-42ac-4b15-b778-46e6db0bfcb5
;;; srecode/fields.el ends here