;ELC ;;; compiled by rms@mole.gnu.ai.mit.edu on Tue Jul 26 17:34:10 1994 ;;; from file /home/fsf/rms/e19/lisp/forms.el ;;; emacs version 19.25.90.2. ;;; bytecomp version FSF 2.10 ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "`/home/fsf/rms/e19/lisp/forms.el' was compiled for Emacs 19")) (byte-code "!!" [provide forms forms-mode] 2) (defconst forms-version (substring "$Revision: 2.10 $" 11 -2) "\ The version number of forms-mode (as string). The complete RCS id is: $Id: forms.el,v 2.10 1994/07/26 21:31:13 rms Exp $") (defvar forms-mode-hooks nil "\ Hook functions to be run upon entering Forms mode.") (defvar forms-file nil "\ Name of the file holding the data.") (defvar forms-format-list nil "\ List of formatting specifications.") (defvar forms-number-of-fields nil "\ Number of fields per record.") (defvar forms-field-sep " " "\ Field separator character (default TAB).") (defvar forms-read-only nil "\ Non-nil means: visit the file in view (read-only) mode. (Defaults to the write access on the data file).") (defvar forms-multi-line " " "\ If not nil: use this character to separate multi-line fields (default C-k).") (defvar forms-forms-scroll nil "\ *Non-nil means replace scroll-up/down commands in Forms mode. The replacement commands performs forms-next/prev-record.") (defvar forms-forms-jump nil "\ *Non-nil means redefine beginning/end-of-buffer in Forms mode. The replacement commands performs forms-first/last-record.") (defvar forms-read-file-filter nil "\ The name of a function that is called after reading the data file. This can be used to change the contents of the file to something more suitable for forms processing.") (defvar forms-write-file-filter nil "\ The name of a function that is called before writing the data file. This can be used to undo the effects of form-read-file-hook.") (defvar forms-new-record-filter nil "\ The name of a function that is called when a new record is created.") (defvar forms-modified-record-filter nil "\ The name of a function that is called when a record has been modified.") (defvar forms-fields nil "\ List with fields of the current forms. First field has number 1. This variable is for use by the filter routines only. The contents may NOT be modified.") (defvar forms-use-text-properties (fboundp (quote set-text-properties)) "\ *Non-nil means: use emacs-19 text properties. Defaults to t if this emacs is capable of handling text properties.") (defvar forms-ro-face (quote default) "\ The face (a symbol) that is used to display read-only text on the screen.") (defvar forms-rw-face (quote region) "\ The face (a symbol) that is used to display read-write text on the screen.") (defvar forms--file-buffer nil "\ Buffer which holds the file data") (defvar forms--total-records 0 "\ Total number of records in the data file.") (defvar forms--current-record 0 "\ Number of the record currently on the screen.") (defvar forms-mode-map nil "\ Keymap for form buffer.") (defvar forms-mode-ro-map nil "\ Keymap for form buffer in view mode.") (defvar forms-mode-edit-map nil "\ Keymap for form buffer in edit mode.") (defvar forms--markers nil "\ Field markers in the screen.") (defvar forms--dyntexts nil "\ Dynamic texts (resulting from function calls) on the screen.") (defvar forms--the-record-list nil "\ List of strings of the current record, as parsed from the file.") (defvar forms--search-regexp nil "\ Last regexp used by forms-search.") (defvar forms--format nil "\ Formatting routine.") (defvar forms--parser nil "\ Forms parser routine.") (defvar forms--mode-setup nil "\ To keep track of forms-mode being set-up.") (make-variable-buffer-local (quote forms--mode-setup)) (defvar forms--dynamic-text nil "\ Array that holds dynamic texts to insert between fields.") (defvar forms--elements nil "\ Array with the order in which the fields are displayed.") (defvar forms--ro-face nil "\ Face used to represent read-only data on the screen.") (defvar forms--rw-face nil "\ Face used to represent read-write data on the screen.") (defalias 'forms-mode #[(&optional primary) " ; !!!!!!!!!!!!! !Y!!=j Q!p t!\f~P!;P! VP!P!   ; G= P!P!!\f !!!! ! !P!)!)P!!!!7 !c!![9:c9:!!!!!@A BCDEF\f!; GH;qIJH!)K!GLM!GCM)G;qLM!GM)*N;qOp!7NPed\")<N)ÁQ!ȁRDCQS T K! 0" "'forms-number-of-fields' has not been set" forms--intuit-from-file 1 "'forms-multi-line' is equal to 'forms-field-sep'" "'forms-multi-line' must be nil or a one-character string" set-text-properties forms--process-format-list forms--format forms--markers forms--dyntexts forms--elements forms--make-format forms--parser forms--make-parser "'forms-new-record-filter' is not a function" "'forms-modified-record-filter' is not a function" forms-fields forms--dynamic-text set-visited-file-name buffer-read-only erase-buffer forms--ro-face forms--rw-face forms--file-buffer forms--total-records forms--current-record forms--the-record-list forms--search-regexp forms-mode-map forms--mode-commands forms-mode major-mode "Forms" mode-name find-file-noselect write-file-filter read-file-filter inhibit-read-only run-hooks set-buffer-modified-p make-variable-buffer-local local-write-file-hooks ro bury-buffer count-lines minor-mode-alist " View" forms--set-keymaps forms--change-commands "GNU Emacs Forms Mode version " forms-version "\n\n" file-exists-p "No records available in file \"" "\".\n\n" format "Creating new file \"%s\"\nwith %d field%s per record.\n\n" "" "s" "Use " substitute-command-keys "\\[forms-insert-record]" " to create new records.\n" forms-jump-record forms-mode-hooks forms--help] 10 "\ Major mode to visit files in a field-structured manner using a form. Commands: Equivalent keys in read-only mode: TAB forms-next-field TAB \\C-c TAB forms-next-field \\C-c < forms-first-record < \\C-c > forms-last-record > \\C-c ? describe-mode ? \\C-c \\C-k forms-delete-record \\C-c \\C-q forms-toggle-read-only q \\C-c \\C-o forms-insert-record \\C-c \\C-l forms-jump-record l \\C-c \\C-n forms-next-record n \\C-c \\C-p forms-prev-record p \\C-c \\C-s forms-search s \\C-c \\C-x forms-exit x " nil]) (defalias (quote forms--process-format-list) #[nil "\nP!<P!\"\n \f  \n  9K!K!;u ;a P  n C# XVP#\nGVS\"\nSI\nT\n  C# <!!Q!  C# !Q! ** $ C# $C#,\"" [forms-format-list error "Forms control file error: " "'forms-format-list' has not been set" "'forms-format-list' is not a list" make-vector forms-number-of-fields nil forms--elements 0 field-num prev-item this-item the-list rem el boundp eval append "Forms format error: " "field number %d out of range 1..%d" vconcat fboundp "not a function " prin1-to-string "invalid element " "\n" forms--debug] 6]) (defvar forms--iif-start nil "\ Record start of modification command.") (defvar forms--iif-properties nil "\ Original properties of the character being overridden.") (defalias 'forms--iif-hook #[(begin end) " `T!XZ\"8S!S F#)C\"щ" [forms--iif-start copy-marker 2 get-text-property read-only text-properties-at forms--iif-properties t inhibit-read-only set-text-properties face forms--rw-face front-sticky (face) append forms--iif-post-command-hook post-command-hook nil] 7 "\ `insert-in-front-hooks' function for read-only segments."]) (defalias 'forms--iif-post-command-hook #[nil "\n\"  S #)ȉ" [delq forms--iif-hook-post-command-hook post-command-hook forms--iif-start t inhibit-read-only set-text-properties forms--iif-properties nil] 4 "\ `post-command-hook' function for read-only segments."]) (defalias 'forms--make-format #[nil " )\f\"\"\f@?#BBBBB5\f\"\"BB\n\" \"*!" [0 forms--dyntext forms--marker forms-use-text-properties lambda (arg) let ((inhibit-read-only t)) append apply mapcar forms--make-format-elt-using-text-properties forms-format-list ((add-text-properties (point-min) (1+ (point-min)) (quote (front-sticky (read-only))))) ((remove-text-properties (1- (point)) (point) (quote (rear-nonsticky)))) ((setq forms--iif-start nil)) (arg) forms--make-format-elt forms--format make-vector nil forms--markers forms--dyntexts forms--debug] 10 "\ Generate `forms--format' using the information in `forms-format-list'."]) (defalias 'forms--make-format-elt-using-text-properties #[(el) "; DBB TC\"BBBBFCA T BBBSEDBBBBC \fH \n{II \fH d{I\fT+" [0 nil there here i forms--markers get-text-property read-only forms--recordv forms--elements next-single-property-change] 5 "\ Extract field info from forms when using text properties."]) (defalias 'forms--make-parser-elt #[(el) ";@ (BBDEE SGEEFE:!DDEEGDDS O #Շe SBBBC< EDD SBBBFCEDCBBCT" [el forms--field (setq here (point)) if not search-forward (nil t nil) error "Parse error: cannot find \"%s\"" aset forms--recordv buffer-substring here - (point) looking-at regexp-quote "Parse error: not looking at \"%s\"" forward-char t forms--seen-text nil "Cannot parse adjacent fields %d and %d" ((buffer-substring (point) (point-max))) let (here (point)) forms--dyntext aref forms--dyntexts (if (not (search-forward forms--dyntext nil t nil)) (error "Parse error: cannot find \"%s\"" forms--dyntext)) ((buffer-substring here (- (point) (length forms--dyntext)))) ((if (not (looking-at (regexp-quote forms--dyntext))) (error "Parse error: not looking at \"%s\"" forms--dyntext)) (forward-char (length forms--dyntext)))] 10 "\ Helper routine to generate forms parser function."]) (defalias 'forms--intuit-from-file #[nil "d\n!!d\n! \nq\f!)eb ) !G #bT\\G.\nETX\"E\"m)" [forms-number-of-fields file-exists-p forms-file error "Need existing file or explicit 'forms-number-of-records'." find-file-noselect forms--file-buffer forms-read-file-filter nil the-record read-file-filter t inhibit-read-only run-hooks forms--get-record kill-buffer 0 forms-field-sep field-sep-length found-pos start-pos the-result 1 string-match "Forms file \"" "\".\n\n" forms-format-list i append format "%4d: " "\n"] 5 "\ Get number of fields and a default form using the data file."]) (defalias 'forms--set-keymaps #[nil " \n\n !" [use-local-map forms-read-only forms-mode-ro-map forms-mode-edit-map] 2 "\ Set the keymaps used in this mode."]) (defalias 'forms--mode-commands #[nil "  # # # # # # # # # # # # # ! ############! ''#' #'!" [make-keymap forms-mode-map define-key " " forms-next-field " " forms-delete-record "" forms-toggle-read-only "" forms-insert-record "\f" forms-jump-record "" forms-next-record "" forms-prev-record "" forms-search "" forms-exit "<" forms-first-record ">" forms-last-record "?" describe-mode "" forms-mode-ro-map suppress-keymap "" "q" "l" "n" "p" "s" "x" " " forms--mode-commands1 forms-mode-edit-map] 4 "\ Fill the Forms mode keymaps."]) (defalias 'forms--mode-commands1 #[(map) " # # # # # # #" [define-key map [TAB] forms-next-field [S-tab] forms-prev-field [next] forms-next-record [prior] forms-prev-record [begin] forms-first-record [last] forms-last-record [backtab]] 4 "\ Helper routine to define keys."]) (defalias 'forms--change-commands #[nil " $ $- $ $\"!Ӈ" [forms-forms-scroll substitute-key-definition scroll-up forms-next-record current-local-map current-global-map scroll-down forms-prev-record forms-forms-jump beginning-of-buffer forms-first-record end-of-buffer forms-last-record local-set-key "" forms-save-buffer make-local-variable revert-buffer-function forms--revert-buffer t] 5 "\ Localize some commands for Forms mode."]) (defalias 'forms--help #[nil "ư!!" [message substitute-command-keys "\\[forms-next-record]:next" " \\[forms-prev-record]:prev" " \\[forms-first-record]:first" " \\[forms-last-record]:last" " \\[describe-mode]:help"] 7 "\ Initial help for Forms mode."]) (defalias 'forms--trans #[(subj arg rep) " G ! !   # -  I T ," [0 subj regexp-quote arg string-to-char rep k re x i string-match] 5 "\ Translate in SUBJ all chars ARG into char REP. ARG and REP should be single-char strings."]) (defalias 'forms--exit #[(query &optional save) " ! \f ! q p!)\n!3\f9 !9 p!)" [buffer-name forms--file-buffer buf forms--checkmod save buffer-modified-p forms-save-buffer delete-auto-save-file-if-necessary kill-buffer get-buffer beep message "Problem saving buffers?"] 2 "\ Internal exit from forms mode function."]) (defalias 'forms--get-record #[nil "ny` `{ b)" [0 here nil] 2 "\ Fetch the current record from the file buffer."]) (defalias 'forms--show-record #[(the-record) "\nG # \nP \n #@ \fO\f\fC\" \f\\),Wed#) GU G#GWGZ\"\"C#!eb! \"R#" [nil 0 forms-field-sep field-sep-length found-pos start-pos the-result forms-multi-line forms--trans the-record "\n" string-match ent append forms--the-record-list buffer-read-only forms-use-text-properties t inhibit-read-only set-text-properties erase-buffer forms-number-of-fields beep message "Warning: this record has %d fields instead of %d" make-list "" forms-fields forms--format set-buffer-modified-p forms-read-only " " forms--current-record "/" forms--total-records mode-line-process] 5 "\ Format THE-RECORD and display it in the current buffer."]) (defalias 'forms--parse-form #[nil " !\f )( \"!\"A), \")" [nil forms--recordv vconcat forms--the-record-list forms--dynamic-text forms--parser forms-modified-record-filter [nil] the-fields append] 3 "\ Parse contents of form into list of strings."]) (defalias 'forms--update #[nil " !  \n#\n!#\",!8 # \"H! cqy`)`)| cy))" [forms-read-only message "Read-only buffer!" beep nil the-record forms--parse-form forms--the-record-list mapconcat identity forms-field-sep string-match regexp-quote "" error "Field separator occurs in record - update refused!" forms-multi-line forms--trans "\n" "Multi-line fields in this record - update refused!" forms--file-buffer 0] 6 "\ Update current record with contents of form. As a side effect: sets `forms--the-record-list'."]) (defalias 'forms--checkmod #[nil "!` !\nb)" [buffer-modified-p nil here forms--update set-buffer-modified-p] 2 "\ Check if this form has been modified, and call forms--update if so."]) (defalias 'forms-find-file #[(fn) "\f! !*" [t enable-local-variables enable-local-eval find-file-read-only fn forms--mode-setup forms-mode] 2 "\ Visit a file in Forms mode." "fForms file: "]) (defalias 'forms-find-file-other-window #[(fn) "\f! !*" [t enable-local-variables enable-local-eval find-file-other-window fn forms--mode-setup forms-mode] 2 "\ Visit a file in Forms mode in other window." "fFbrowse file in other window: "]) (defalias 'forms-exit #[(query) " \"" [forms--exit query t] 3 "\ Normal exit from Forms mode. Modified buffers are saved." "P"]) (defalias 'forms-exit-no-save #[(query) " \"" [forms--exit query nil] 3 "\ Exit from Forms mode without saving buffers." "P"]) (defalias 'forms-next-record #[(arg) " !\\\"" [forms-jump-record forms--current-record prefix-numeric-value arg t] 4 "\ Advance to the ARGth following record." "P"]) (defalias 'forms-prev-record #[(arg) " !Z\"" [forms-jump-record forms--current-record prefix-numeric-value arg t] 4 "\ Advance to the ARGth previous record." "P"]) (defalias 'forms-jump-record #[(arg &optional relative) " V\fX \f?s # Z \nˊ\fqy\fL\nUX \ny[\\\\ X \n![\\\\ )! U?r   \"*" [arg forms--total-records 0 beep relative message "Record number %d out of range 1..%d" forms--checkmod forms--current-record cur disp forms--show-record forms--file-buffer goto-line forms--get-record "Stuck at record %d"] 5 "\ Jump to a random record." "NRecord number: "]) (defalias 'forms-first-record #[nil "!" [forms-jump-record 1] 2 "\ Jump to first record." nil]) (defalias 'forms-last-record #[nil "qed\") U \n \") !" [forms--file-buffer count-lines numrec forms--total-records beep message "Warning: number of records changed to %d" forms-jump-record] 4 "\ Jump to last record. As a side effect: re-calculates the number of records in the data file." nil]) (defalias 'forms-toggle-read-only #[(arg) "\f!X 7  q)*\n\" ,\f ?5 ) ?C  " [arg prefix-numeric-value 0 forms-read-only ro forms--file-buffer buffer-read-only t message "No write access to \"%s\"" forms-file beep nil forms-mode forms--checkmod] 3 "\ Toggles read-only mode of a forms mode buffer. With an argument, enables read-only mode if the argument is positive. Otherwise enables edit mode if the visited file is writeable." "P"]) (defalias 'forms-insert-record #[(arg) "! \fT\fʼn \n=\fT\" \n !  \"A)D\f\"#q!!cy)+T\f!" [forms-read-only error "" arg forms--current-record nil the-record the-list ln forms--checkmod forms-new-record-filter make-vector forms-number-of-fields the-fields append make-list mapconcat identity forms-field-sep forms--file-buffer goto-line open-line 1 0 forms--total-records forms-jump-record] 4 "\ Create a new record before the current one. With ARG: store the record after the current one. If `forms-new-record-filter' contains the name of a function, it is called to fill (some of) the fields with default values." "P"]) (defalias 'forms-delete-record #[(arg) "! \f!E q!y`y`|) S  V? !)!" [forms-read-only error "" forms--checkmod arg y-or-n-p "Really delete this record? " forms--current-record ln forms--file-buffer goto-line 0 1 forms--total-records forms-jump-record message] 2 "\ Deletes a record. With a prefix argument: don't ask." "P"]) (defalias 'forms-search #[(regexp) "\n ĉ  \nq`#9bQ!ĂE e`\"T )X !#," [regexp "" forms--search-regexp forms--checkmod nil forms-field-sep fld-sep here the-record the-line forms--file-buffer re-search-forward t message "\"" "\" not found." forms--get-record count-lines forms--current-record forms--show-record] 4 "\ Search REGEXP in file buffer." (list (read-string (concat "Search for" (if forms--search-regexp (concat " (" forms--search-regexp ")")) ": ")))]) (defalias 'forms-save-buffer #[(&optional args) "  q!\n!!+ć" [forms--checkmod forms-read-file-filter read-file-filter forms--file-buffer t inhibit-read-only save-buffer args run-hooks set-buffer-modified-p nil] 2 "\ Forms mode replacement for save-buffer. It saves the data buffer instead of the forms buffer. Calls `forms-write-file-filter' before writing out the data." "p"]) (defalias 'forms--revert-buffer #[(&optional arg noconfirm) "\n!!!" [noconfirm yes-or-no-p "Revert form to unmodified? " set-buffer-modified-p nil forms-jump-record forms--current-record] 2 "\ Reverts current form to un-modified." "P"]) (defalias 'forms-next-field #[(arg) "`U\n\\ɍ?%\nHb," [0 nil cnt there here i arg 1 done (byte-code " GW- H&\n X&\fSX&\nb\"T" [i forms--markers there here cnt 0 throw done t] 4) forms--markers] 4 "\ Jump to ARG-th next field." "p"]) (defalias 'forms-prev-field #[(arg) "G`U \\ʍ?(GSHb," [forms--markers nil 0 cnt there here i arg 1 done (byte-code "V+S\nH \fY SX b\"" [i 0 forms--markers there here cnt throw done t] 3)] 4 "\ Jump to ARG-th previous field." "p"]) (defalias 'forms-enumerate #[(the-fields) "\n T\n\n L) )" [0 the-index the-fields el] 2 "\ Take a quoted list of symbols, and set their values to sequential numbers. The first symbol gets number 1, the second 2 and so on. It returns the higest number. Usage: (setq forms-number-of-fields (forms-enumerate '(field1 field2 field2 ...)))"]) (defvar forms--debug nil "\ *Enables forms-mode debugging if not nil.") (defalias 'forms--debug #[(&rest args) "g Q  \f;\n\fPM\n\f!Q\f!:\f! \n !Q)?\nQ\f!M\n\fK!Q)!q Ua db\nc*" [forms--debug nil ret args el prin1-to-string " = " boundp eval vel "\n" "" fboundp get-buffer-create "*forms-mode debug*" buffer-size 0 emacs-lisp-mode] 3 "\ Internal debugging routine."])