Lines Matching +defs:after +defs:mode
1 ;;; forms.el --- Forms mode: edit a file as a form to fill in
37 ;; Variable `forms--mode-setup' is local to *ALL* buffers, for it
38 ;; controls if forms-mode has been enabled in a buffer.
42 ;; Forms mode means visiting a data file which is supposed to consist
50 ;; Forms mode is a composite mode. It involves two files, and two
58 ;; Forms mode is invoked using M-x `forms-find-file' control-file.
61 ;; You may also visit the control file, and switch to forms mode by hand
62 ;; with M-x `forms-mode'.
64 ;; Automatic mode switching is supported if you specify
104 ;; read-only (view mode) as opposed to edit mode.
106 ;; possible, view mode is enforced.
134 ;; forms-insert-after [bool, default nil]
135 ;; Non-nil means: insertions of new records go after
143 ;; function that is called after the forms data file
146 ;; for forms-mode processing.
163 ;; been modified. It is called after the fields
168 ;; This variable controls if forms mode should use
221 ;; Other functions provided by forms mode are:
228 ;; switching edit <-> view mode v.v.
235 ;; The forms buffer can be in one of two modes: edit mode or view
236 ;; mode. View mode is a read-only mode, whereby you cannot modify the
239 ;; Edit mode commands:
245 ;; \C-c ? describe-mode
256 ;; Read-only mode commands:
260 ;; ? describe-mode
270 ;; same command keys as in edit mode.
272 ;; The following bindings are available, independent of the mode:
287 ;; forms mode functions next/prev record and first/last
304 (provide 'forms-mode) ;;; for compatibility
306 (defcustom forms-mode-hook nil
307 "Hook run upon entering Forms mode."
335 "Non-nil means: visit the file in view (read-only) mode.
342 "*Non-nil means replace scroll-up/down commands in Forms mode.
348 "*Non-nil means redefine beginning/end-of-buffer in Forms mode.
354 "The name of a function that is called after reading the data file.
379 (defcustom forms-insert-after nil
380 "*Non-nil means: inserts of new records go after current record.
407 (defvar forms-mode-map nil
409 (defvar forms-mode-ro-map nil
410 "Keymap for form buffer in view mode.")
411 (defvar forms-mode-edit-map nil
412 "Keymap for form buffer in edit mode.")
432 (defvar forms--mode-setup nil
433 "To keep track of forms-mode being set-up.")
434 (make-variable-buffer-local 'forms--mode-setup)
450 (defun forms-mode (&optional primary)
451 "Major mode to visit files in a field-structured manner using a form.
453 Commands: Equivalent keys in read-only mode:
458 C-c ? describe-mode ?
471 ;; This is not a simple major mode, as usual. Therefore, forms-mode
474 ;; A global buffer-local variable `forms--mode-setup' has the same
475 ;; effect but makes it possible to auto-invoke forms-mode using
483 (if (or primary (not forms--mode-setup))
499 (make-local-variable 'forms-insert-after)
609 (setq forms--mode-setup t)
630 ; The keymaps are global, so multiple forms mode buffers can share them.
631 ;(make-local-variable 'forms-mode-map)
632 ;(make-local-variable 'forms-mode-ro-map)
633 ;(make-local-variable 'forms-mode-edit-map)
634 (if forms-mode-map ; already defined
637 (forms--mode-commands)
641 ;; set the major mode indicator
642 (setq major-mode 'forms-mode)
643 (setq mode-name "Forms")
680 ;; Since we aren't really implementing a minor mode, we hack the modeline
683 (make-local-variable 'minor-mode-alist)
684 (setq minor-mode-alist (list (list 'forms-read-only " View")))
715 (if forms-insert-after
722 (run-mode-hooks 'forms-mode-hook 'forms-mode-hooks)
933 ;; Prevent insertion after the last text.
998 ;; ;; Prevent insertion after the last text.
1011 (progn ; until after insertion
1259 "Set the keymaps used in this mode."
1262 forms-mode-ro-map
1263 forms-mode-edit-map)))
1265 (defun forms--mode-commands ()
1266 "Fill the Forms mode keymaps."
1268 ;; `forms-mode-map' is always accessible via \C-c prefix.
1269 (setq forms-mode-map (make-keymap))
1270 (define-key forms-mode-map "\t" 'forms-next-field)
1271 (define-key forms-mode-map "\C-k" 'forms-delete-record)
1272 (define-key forms-mode-map "\C-q" 'forms-toggle-read-only)
1273 (define-key forms-mode-map "\C-o" 'forms-insert-record)
1274 (define-key forms-mode-map "\C-l" 'forms-jump-record)
1275 (define-key forms-mode-map "\C-n" 'forms-next-record)
1276 (define-key forms-mode-map "\C-p" 'forms-prev-record)
1277 (define-key forms-mode-map "\C-r" 'forms-search-backward)
1278 (define-key forms-mode-map "\C-s" 'forms-search-forward)
1279 (define-key forms-mode-map "\C-x" 'forms-exit)
1280 (define-key forms-mode-map "<" 'forms-first-record)
1281 (define-key forms-mode-map ">" 'forms-last-record)
1282 (define-key forms-mode-map "\C-?" 'forms-prev-record)
1284 ;; `forms-mode-ro-map' replaces the local map when in read-only mode.
1285 (setq forms-mode-ro-map (make-keymap))
1286 (suppress-keymap forms-mode-ro-map)
1287 (define-key forms-mode-ro-map "\C-c" forms-mode-map)
1288 (define-key forms-mode-ro-map "q" 'forms-toggle-read-only)
1289 (define-key forms-mode-ro-map "l" 'forms-jump-record)
1290 (define-key forms-mode-ro-map "n" 'forms-next-record)
1291 (define-key forms-mode-ro-map "p" 'forms-prev-record)
1292 (define-key forms-mode-ro-map "r" 'forms-search-backward)
1293 (define-key forms-mode-ro-map "s" 'forms-search-forward)
1294 (define-key forms-mode-ro-map "x" 'forms-exit)
1295 (define-key forms-mode-ro-map "<" 'forms-first-record)
1296 (define-key forms-mode-ro-map ">" 'forms-last-record)
1297 (define-key forms-mode-ro-map "?" 'describe-mode)
1298 (define-key forms-mode-ro-map " " 'forms-next-record)
1299 (forms--mode-commands1 forms-mode-ro-map)
1300 (forms--mode-menu-ro forms-mode-ro-map)
1303 (setq forms-mode-edit-map (make-keymap))
1304 (define-key forms-mode-edit-map "\C-c" forms-mode-map)
1305 (forms--mode-commands1 forms-mode-edit-map)
1306 (forms--mode-menu-edit forms-mode-edit-map)
1309 (defun forms--mode-menu-ro (map)
1323 '("Describe Mode" . describe-mode))
1355 (defun forms--mode-menu-edit (map)
1369 '("Describe Mode" . describe-mode))
1402 (defun forms--mode-commands1 (map)
1417 "Localize some commands for Forms mode."
1443 "Initial help for Forms mode."
1449 " \\[describe-mode]:help"))))
1462 "Internal exit from forms mode function."
1539 (setq mode-line-process
1616 "Visit a file in Forms mode."
1621 (or forms--mode-setup (forms-mode t))))
1625 "Visit a file in Forms mode in other window."
1630 (or forms--mode-setup (forms-mode t))))
1633 "Normal exit from Forms mode. Modified buffers are saved."
1638 "Exit from Forms mode without saving buffers."
1727 "Toggles read-only mode of a forms mode buffer.
1728 With an argument, enables read-only mode if the argument is positive.
1729 Otherwise enables edit mode if the visited file is writable."
1739 ;; Enable edit mode, if possible.
1749 (forms-mode)))
1751 ;; Enable view mode.
1756 (forms-mode))))
1768 With ARG: store the record after the current one.
1771 If `forms-insert-after is non-nil, the default behavior is to insert
1772 after the current record."
1781 (if (or (and arg forms-insert-after)
1782 (and (not arg) (not forms-insert-after)))
1904 "Forms mode replacement for save-buffer.
1907 after writing out the data."
2050 "*Enables forms-mode debugging if not nil.")
2069 (with-current-buffer (get-buffer-create "*forms-mode debug*")
2071 (emacs-lisp-mode))