1995-10-30 17:35:01 +00:00
|
|
|
|
;;; forms.el --- Forms mode: edit a file as a form to fill in
|
|
|
|
|
|
2021-01-01 09:13:56 +00:00
|
|
|
|
;; Copyright (C) 1991, 1994-1997, 2001-2021 Free Software Foundation,
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Inc.
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1995-10-28 16:21:33 +00:00
|
|
|
|
;; Author: Johan Vromans <jvromans@squirrel.nl>
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1993-06-12 20:53:59 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-06-12 20:53:59 +00:00
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2012-05-07 22:53:17 +00:00
|
|
|
|
;; Visit a file using a form. See etc/forms for examples.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; === Naming conventions
|
|
|
|
|
;;
|
|
|
|
|
;; The names of all variables and functions start with 'forms-'.
|
|
|
|
|
;; Names which start with 'forms--' are intended for internal use, and
|
|
|
|
|
;; should *NOT* be used from the outside.
|
|
|
|
|
;;
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; All variables are buffer-local, to enable multiple forms visits
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; simultaneously.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; Variable `forms--mode-setup' is local to *ALL* buffers, for it
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; controls if forms-mode has been enabled in a buffer.
|
|
|
|
|
;;
|
|
|
|
|
;; === How it works ===
|
|
|
|
|
;;
|
|
|
|
|
;; Forms mode means visiting a data file which is supposed to consist
|
|
|
|
|
;; of records each containing a number of fields. The records are
|
|
|
|
|
;; separated by a newline, the fields are separated by a user-defined
|
|
|
|
|
;; field separator (default: TAB).
|
|
|
|
|
;; When shown, a record is transferred to an Emacs buffer and
|
|
|
|
|
;; presented using a user-defined form. One record is shown at a
|
|
|
|
|
;; time.
|
|
|
|
|
;;
|
|
|
|
|
;; Forms mode is a composite mode. It involves two files, and two
|
|
|
|
|
;; buffers.
|
|
|
|
|
;; The first file, called the control file, defines the name of the
|
|
|
|
|
;; data file and the forms format. This file buffer will be used to
|
|
|
|
|
;; present the forms.
|
|
|
|
|
;; The second file holds the actual data. The buffer of this file
|
|
|
|
|
;; will be buried, for it is never accessed directly.
|
|
|
|
|
;;
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; Forms mode is invoked using M-x `forms-find-file' control-file.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Alternatively `forms-find-file-other-window' can be used.
|
|
|
|
|
;;
|
|
|
|
|
;; You may also visit the control file, and switch to forms mode by hand
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; with M-x `forms-mode'.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; Automatic mode switching is supported if you specify
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; "-*- forms -*-" in the first line of the control file.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
2005-05-18 10:17:59 +00:00
|
|
|
|
;; The control file is visited, evaluated using `eval-buffer',
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; and should set at least the following variables:
|
|
|
|
|
;;
|
|
|
|
|
;; forms-file [string]
|
|
|
|
|
;; The name of the data file.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-number-of-fields [integer]
|
|
|
|
|
;; The number of fields in each record.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-format-list [list]
|
|
|
|
|
;; Formatting instructions.
|
|
|
|
|
;;
|
|
|
|
|
;; `forms-format-list' should be a list, each element containing
|
|
|
|
|
;;
|
|
|
|
|
;; - a string, e.g. "hello". The string is inserted in the forms
|
|
|
|
|
;; "as is".
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; - an integer, denoting a field number.
|
|
|
|
|
;; The contents of this field are inserted at this point.
|
|
|
|
|
;; Fields are numbered starting with number one.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; - a function call, e.g. (insert "text").
|
|
|
|
|
;; This function call is dynamically evaluated and should return a
|
|
|
|
|
;; string. It should *NOT* have side-effects on the forms being
|
|
|
|
|
;; constructed. The current fields are available to the function
|
|
|
|
|
;; in the variable `forms-fields', they should *NOT* be modified.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; - a lisp symbol, that must evaluate to one of the above.
|
|
|
|
|
;;
|
|
|
|
|
;; Optional variables which may be set in the control file:
|
|
|
|
|
;;
|
|
|
|
|
;; forms-field-sep [string, default TAB]
|
|
|
|
|
;; The field separator used to separate the
|
|
|
|
|
;; fields in the data file. It may be a string.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-read-only [bool, default nil]
|
|
|
|
|
;; Non-nil means that the data file is visited
|
|
|
|
|
;; read-only (view mode) as opposed to edit mode.
|
|
|
|
|
;; If no write access to the data file is
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; possible, view mode is enforced.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
1996-03-01 21:13:01 +00:00
|
|
|
|
;; forms-check-number-of-fields [bool, default t]
|
|
|
|
|
;; If non-nil, a warning will be issued whenever
|
|
|
|
|
;; a record is found that does not have the number
|
|
|
|
|
;; of fields specified by `forms-number-of-fields'.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; forms-multi-line [string, default "^K"]
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; If non-null, the records of the data file may
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; contain fields that can span multiple lines in
|
|
|
|
|
;; the form.
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; This variable denotes the separator string
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; to be used for this purpose. Upon display, all
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; occurrences of this string are translated
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; to newlines. Upon storage they are translated
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; back to the separator string.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; forms-forms-scroll [bool, default nil]
|
|
|
|
|
;; Non-nil means: rebind locally the commands that
|
|
|
|
|
;; perform `scroll-up' or `scroll-down' to use
|
|
|
|
|
;; `forms-next-field' resp. `forms-prev-field'.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-forms-jump [bool, default nil]
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; Non-nil means: rebind locally the commands
|
|
|
|
|
;; `beginning-of-buffer' and `end-of-buffer' to
|
|
|
|
|
;; perform, respectively, `forms-first-record' and
|
|
|
|
|
;; `forms-last-record' instead.
|
1996-03-01 21:13:01 +00:00
|
|
|
|
;;
|
|
|
|
|
;; forms-insert-after [bool, default nil]
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; Non-nil means: insertions of new records go after
|
|
|
|
|
;; current record, also initial position is at the
|
|
|
|
|
;; last record. The default is to insert before the
|
|
|
|
|
;; current record and the initial position is at the
|
|
|
|
|
;; first record.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; forms-read-file-filter [symbol, default nil]
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; If not nil: this should be the name of a
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; function that is called after the forms data file
|
|
|
|
|
;; has been read. It can be used to transform
|
|
|
|
|
;; the contents of the file into a format more suitable
|
|
|
|
|
;; for forms-mode processing.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-write-file-filter [symbol, default nil]
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; If not nil: this should be the name of a
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; function that is called before the forms data file
|
|
|
|
|
;; is written (saved) to disk. It can be used to undo
|
|
|
|
|
;; the effects of `forms-read-file-filter', if any.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-new-record-filter [symbol, default nil]
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; If not nil: this should be the name of a
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; function that is called when a new
|
|
|
|
|
;; record is created. It can be used to fill in
|
|
|
|
|
;; the new record with default fields, for example.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-modified-record-filter [symbol, default nil]
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; If not nil: this should be the name of a
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; function that is called when a record has
|
|
|
|
|
;; been modified. It is called after the fields
|
|
|
|
|
;; are parsed. It can be used to register
|
|
|
|
|
;; modification dates, for example.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-use-text-properties [bool, see text for default]
|
|
|
|
|
;; This variable controls if forms mode should use
|
|
|
|
|
;; text properties to protect the form text from being
|
|
|
|
|
;; modified (using text-property `read-only').
|
|
|
|
|
;; Also, the read-write fields are shown using a
|
|
|
|
|
;; distinct face, if possible.
|
2020-10-20 17:31:40 +00:00
|
|
|
|
;; The `intangible' text property is used to
|
|
|
|
|
;; prevent moving into read-only fields.
|
|
|
|
|
;; This variable defaults to t.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; The default face to show read-write fields is
|
|
|
|
|
;; copied from face `region'.
|
|
|
|
|
;;
|
|
|
|
|
;; forms-ro-face [symbol, default 'default]
|
|
|
|
|
;; This is the face that is used to show
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; read-only text on the screen. If used, this
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; variable should be set to a symbol that is a
|
|
|
|
|
;; valid face.
|
|
|
|
|
;; E.g.
|
|
|
|
|
;; (make-face 'my-face)
|
|
|
|
|
;; (setq forms-ro-face 'my-face)
|
|
|
|
|
;;
|
|
|
|
|
;; forms-rw-face [symbol, default 'region]
|
|
|
|
|
;; This is the face that is used to show
|
|
|
|
|
;; read-write text on the screen.
|
|
|
|
|
;;
|
|
|
|
|
;; After evaluating the control file, its buffer is cleared and used
|
|
|
|
|
;; for further processing.
|
|
|
|
|
;; The data file (as designated by `forms-file') is visited in a buffer
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; `forms--file-buffer' which normally will not be shown.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Great malfunctioning may be expected if this file/buffer is modified
|
|
|
|
|
;; outside of this package while it is being visited!
|
|
|
|
|
;;
|
|
|
|
|
;; Normal operation is to transfer one line (record) from the data file,
|
|
|
|
|
;; split it into fields (into `forms--the-record-list'), and display it
|
|
|
|
|
;; using the specs in `forms-format-list'.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; A format routine `forms--format' is built upon startup to format
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; the records according to `forms-format-list'.
|
|
|
|
|
;;
|
|
|
|
|
;; When a form is changed the record is updated as soon as this form
|
|
|
|
|
;; is left. The contents of the form are parsed using information
|
|
|
|
|
;; obtained from `forms-format-list', and the fields which are
|
|
|
|
|
;; deduced from the form are modified. Fields not shown on the forms
|
|
|
|
|
;; retain their original values. The newly formed record then
|
|
|
|
|
;; replaces the contents of the old record in `forms--file-buffer'.
|
|
|
|
|
;; A parse routine `forms--parser' is built upon startup to parse
|
|
|
|
|
;; the records.
|
|
|
|
|
;;
|
|
|
|
|
;; Two exit functions exist: `forms-exit' and `forms-exit-no-save'.
|
|
|
|
|
;; `forms-exit' saves the data to the file, if modified.
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; `forms-exit-no-save' does not. However, if `forms-exit-no-save'
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; is executed and the file buffer has been modified, Emacs will ask
|
|
|
|
|
;; questions anyway.
|
|
|
|
|
;;
|
|
|
|
|
;; Other functions provided by forms mode are:
|
|
|
|
|
;;
|
|
|
|
|
;; paging (forward, backward) by record
|
|
|
|
|
;; jumping (first, last, random number)
|
|
|
|
|
;; searching
|
|
|
|
|
;; creating and deleting records
|
|
|
|
|
;; reverting the form (NOT the file buffer)
|
|
|
|
|
;; switching edit <-> view mode v.v.
|
|
|
|
|
;; jumping from field to field
|
|
|
|
|
;;
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; As a documented side-effect: jumping to the last record in the
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; file (using forms-last-record) will adjust forms--total-records if
|
|
|
|
|
;; needed.
|
|
|
|
|
;;
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; The forms buffer can be in one of two modes: edit mode or view
|
|
|
|
|
;; mode. View mode is a read-only mode, whereby you cannot modify the
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; contents of the buffer.
|
|
|
|
|
;;
|
|
|
|
|
;; Edit mode commands:
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; TAB forms-next-field
|
|
|
|
|
;; \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
|
|
|
|
|
;; \C-c \C-o forms-insert-record
|
|
|
|
|
;; \C-c \C-l forms-jump-record
|
|
|
|
|
;; \C-c \C-n forms-next-record
|
|
|
|
|
;; \C-c \C-p forms-prev-record
|
|
|
|
|
;; \C-c \C-r forms-search-backward
|
|
|
|
|
;; \C-c \C-s forms-search-forward
|
|
|
|
|
;; \C-c \C-x forms-exit
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Read-only mode commands:
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; SPC forms-next-record
|
|
|
|
|
;; DEL forms-prev-record
|
|
|
|
|
;; ? describe-mode
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; \C-q forms-toggle-read-only
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; l forms-jump-record
|
|
|
|
|
;; n forms-next-record
|
|
|
|
|
;; p forms-prev-record
|
|
|
|
|
;; r forms-search-backward
|
|
|
|
|
;; s forms-search-forward
|
|
|
|
|
;; x forms-exit
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Of course, it is also possible to use the \C-c prefix to obtain the
|
|
|
|
|
;; same command keys as in edit mode.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
|
|
|
|
;; The following bindings are available, independent of the mode:
|
|
|
|
|
;;
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; [next] forms-next-record
|
|
|
|
|
;; [prior] forms-prev-record
|
|
|
|
|
;; [begin] forms-first-record
|
|
|
|
|
;; [end] forms-last-record
|
|
|
|
|
;; [S-TAB] forms-prev-field
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; [backtab] forms-prev-field
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;
|
|
|
|
|
;; For convenience, TAB is always bound to `forms-next-field', so you
|
|
|
|
|
;; don't need the C-c prefix for this command.
|
|
|
|
|
;;
|
1999-05-01 01:11:12 +00:00
|
|
|
|
;; As mentioned above (see `forms-forms-scroll' and `forms-forms-jump'),
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; the bindings of standard functions `scroll-up', `scroll-down',
|
|
|
|
|
;; `beginning-of-buffer' and `end-of-buffer' can be locally replaced with
|
|
|
|
|
;; forms mode functions next/prev record and first/last
|
|
|
|
|
;; record.
|
|
|
|
|
;;
|
2003-05-28 11:19:48 +00:00
|
|
|
|
;; `write-file-functions' is defined to save the actual data file
|
2020-09-23 11:35:55 +00:00
|
|
|
|
;; instead of the buffer data, `revert-buffer-function' is defined to
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; revert a forms to original.
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defgroup forms nil
|
|
|
|
|
"Edit a file as a form to fill in."
|
|
|
|
|
:group 'data)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;; Global variables and constants:
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(defcustom forms-mode-hook nil
|
2001-02-07 23:40:52 +00:00
|
|
|
|
"Hook run upon entering Forms mode."
|
1997-08-19 04:55:58 +00:00
|
|
|
|
:group 'forms
|
2001-02-07 23:40:52 +00:00
|
|
|
|
:type 'hook)
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;; Mandatory variables - must be set by evaluating the control file.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms-file nil
|
1991-07-01 18:06:13 +00:00
|
|
|
|
"Name of the file holding the data.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms-format-list nil
|
1991-07-01 18:06:13 +00:00
|
|
|
|
"List of formatting specifications.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms-number-of-fields nil
|
|
|
|
|
"Number of fields per record.")
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;; Optional variables with default values.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defcustom forms-check-number-of-fields t
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"If non-nil, warn about records with wrong number of fields."
|
1997-08-19 04:55:58 +00:00
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'boolean)
|
1995-08-14 06:45:37 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defvar forms-field-sep "\t"
|
1993-06-12 20:53:59 +00:00
|
|
|
|
"Field separator character (default TAB).")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-08-27 06:47:51 +00:00
|
|
|
|
(defvar forms-read-only nil
|
|
|
|
|
"Non-nil means: visit the file in view (read-only) mode.
|
1997-08-27 23:10:59 +00:00
|
|
|
|
This is set automatically if the file permissions don't let you write it.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defvar forms-multi-line "\C-k" "\
|
|
|
|
|
If not nil: use this character to separate multi-line fields (default C-k).")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defcustom forms-forms-scroll nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means replace scroll-up/down commands in Forms mode.
|
1997-08-19 04:55:58 +00:00
|
|
|
|
The replacement commands performs forms-next/prev-record."
|
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'boolean)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defcustom forms-forms-jump nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means redefine beginning/end-of-buffer in Forms mode.
|
1997-08-19 04:55:58 +00:00
|
|
|
|
The replacement commands performs forms-first/last-record."
|
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'boolean)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(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.
|
1997-08-19 04:55:58 +00:00
|
|
|
|
This can be used to undo the effects of `form-read-file-hook'.")
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(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.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
This variable is for use by the filter routines only.
|
1993-07-17 19:15:19 +00:00
|
|
|
|
The contents may NOT be modified.")
|
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defcustom forms-use-text-properties t
|
2020-10-20 17:31:40 +00:00
|
|
|
|
"Non-nil means to use text properties. "
|
1997-08-19 04:55:58 +00:00
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'boolean)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1997-08-19 04:55:58 +00:00
|
|
|
|
(defcustom forms-insert-after nil
|
2008-12-03 05:48:14 +00:00
|
|
|
|
"Non-nil means: inserts of new records go after current record.
|
1997-08-19 04:55:58 +00:00
|
|
|
|
Also, initial position is at last record."
|
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
|
|
|
|
(defcustom forms-ro-face 'default
|
|
|
|
|
"The face (a symbol) that is used to display read-only text on the screen."
|
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'face)
|
|
|
|
|
|
|
|
|
|
(defcustom forms-rw-face 'region
|
|
|
|
|
"The face (a symbol) that is used to display read-write text on the screen."
|
|
|
|
|
:group 'forms
|
|
|
|
|
:type 'face)
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;; Internal variables.
|
|
|
|
|
|
|
|
|
|
(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.")
|
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(defvar forms-mode-map nil
|
1991-05-20 20:35:19 +00:00
|
|
|
|
"Keymap for form buffer.")
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(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.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms--markers nil
|
|
|
|
|
"Field markers in the screen.")
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defvar forms--dyntexts nil
|
|
|
|
|
"Dynamic texts (resulting from function calls) on the screen.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(defvar forms--the-record-list nil
|
1991-05-20 20:35:19 +00:00
|
|
|
|
"List of strings of the current record, as parsed from the file.")
|
|
|
|
|
|
|
|
|
|
(defvar forms--search-regexp nil
|
1995-01-05 11:54:18 +00:00
|
|
|
|
"Last regexp used by forms-search functions.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms--format nil
|
|
|
|
|
"Formatting routine.")
|
|
|
|
|
|
|
|
|
|
(defvar forms--parser nil
|
|
|
|
|
"Forms parser routine.")
|
|
|
|
|
|
Prefer defvar-local in remaining libraries
* lisp/align.el (align-mode-rules-list)
(align-mode-exclude-rules-list):
* lisp/bookmark.el (bookmark-current-bookmark)
(bookmark-annotation-name)
(bookmark--annotation-from-bookmark-list):
* lisp/calc/calc-embed.el (calc-embedded-all-active)
(calc-embedded-some-active):
* lisp/comint.el (comint-password-function):
* lisp/completion.el (completion-syntax-table):
* lisp/dframe.el (dframe-track-mouse-function)
(dframe-help-echo-function, dframe-mouse-click-function)
(dframe-mouse-position-function, dframe-timer)
(dframe-attached-frame, dframe-controlled):
* lisp/ehelp.el (electric-help-orig-major-mode):
* lisp/eshell/esh-util.el (eshell-path-env):
* lisp/expand.el (expand-pos, expand-index, expand-point):
* lisp/face-remap.el (text-scale-mode-remapping)
(text-scale-mode-lighter, text-scale-mode-amount)
(text-scale-remap-header-line, buffer-face-mode-remapping):
* lisp/ffap.el (ffap-menu-alist):
* lisp/files-x.el (connection-local-variables-alist):
* lisp/foldout.el (foldout-fold-list, foldout-mode-line-string):
* lisp/follow.el (follow-start-end-invalid):
* lisp/forms.el (forms--mode-setup):
* lisp/gnus/message.el (message-cross-post-old-target)
(message-options):
* lisp/help-mode.el (help-xref-stack, help-xref-forward-stack)
(help-xref-stack-item, help-xref-stack-forward-item):
* lisp/hexl.el (hexl-mode--old-var-vals, hexl-ascii-overlay):
* lisp/hilit-chg.el (hilit-chg-string):
* lisp/ido.el (ido-eoinput):
* lisp/imenu.el (imenu-generic-expression)
(imenu-create-index-function, imenu-default-goto-function)
(imenu-prev-index-position-function)
(imenu-extract-index-name-function, imenu-name-lookup-function)
(imenu-syntax-alist, imenu-case-fold-search):
* lisp/jka-compr.el (jka-compr-really-do-compress):
* lisp/language/ethio-util.el (ethio-prefer-ascii-space):
* lisp/leim/quail/hangul.el (hangul-input-method-help-text):
* lisp/leim/quail/japanese.el (quail-japanese-package-saved):
* lisp/linum.el (linum-overlays, linum-available):
* lisp/man.el (Man-original-frame, Man-arguments, Man--sections)
(Man--refpages, Man-page-list, Man-current-page)
(Man-page-mode-string):
* lisp/pcomplete.el (pcomplete-current-completions)
(pcomplete-last-completion-length)
(pcomplete-last-completion-stub, pcomplete-last-completion-raw)
(pcomplete-last-window-config, pcomplete-window-restore-timer):
* lisp/reveal.el (reveal-open-spots, reveal-last-tick):
* lisp/ruler-mode.el (ruler-mode):
* lisp/scroll-lock.el (scroll-lock-preserve-screen-pos-save):
* lisp/server.el (server-buffer-clients, server-existing-buffer):
* lisp/tab-line.el (tab-line-exclude):
* lisp/tar-mode.el (tar-data-buffer, tar-data-swapped):
* lisp/thumbs.el (thumbs-current-tmp-filename)
(thumbs-current-image-filename, thumbs-extra-images)
(thumbs-image-num, thumbs-buffer, thumbs-marked-list):
* lisp/tutorial.el (tutorial--point-before-chkeys)
(tutorial--point-after-chkeys, tutorial--lang):
* lisp/url/url-vars.el (url-current-object)
(url-current-mime-headers, url-current-lastloc):
* lisp/view.el (view-mode, view-old-buffer-read-only)
(view-old-Helper-return-blurb, view-page-size)
(view-half-page-size, view-last-regexp, view-return-to-alist)
(view-exit-action, view-overlay):
* lisp/wid-edit.el (widget-global-map, widget-field-new)
(widget-field-list, widget-field-last, widget-field-was):
* lisp/woman.el (woman-imenu-done): Prefer defvar-local.
2021-02-02 08:55:40 +00:00
|
|
|
|
(defvar-local forms--mode-setup nil
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"To keep track of forms-mode being set-up.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(defvar forms--dynamic-text nil
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Array that holds dynamic texts to insert between fields.")
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defvar forms--elements nil
|
|
|
|
|
"Array with the order in which the fields are displayed.")
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defvar forms--ro-face nil
|
|
|
|
|
"Face used to represent read-only data on the screen.")
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defvar forms--rw-face nil
|
|
|
|
|
"Face used to represent read-write data on the screen.")
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(defvar read-file-filter) ; bound in forms--intuit-from-file
|
|
|
|
|
|
2020-12-26 17:21:17 +00:00
|
|
|
|
;; The code used to use `run-hooks' but in a way that's actually
|
|
|
|
|
;; incompatible with hooks (and with lexical scoping), so this function
|
|
|
|
|
;; approximates the actual behavior that `run-hooks' provided.
|
|
|
|
|
(defun forms--run-functions (functions)
|
|
|
|
|
(if (functionp functions)
|
|
|
|
|
(funcall functions)
|
|
|
|
|
(mapc #'funcall functions)))
|
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;;###autoload
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms-mode (&optional primary)
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
;; FIXME: use define-derived-mode
|
1991-05-20 20:35:19 +00:00
|
|
|
|
"Major mode to visit files in a field-structured manner using a form.
|
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
Commands: Equivalent keys in read-only mode:
|
|
|
|
|
TAB forms-next-field TAB
|
2003-02-04 11:26:42 +00:00
|
|
|
|
C-c TAB forms-next-field
|
1998-07-17 14:01:15 +00:00
|
|
|
|
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-r forms-search-reverse r
|
|
|
|
|
C-c C-s forms-search-forward s
|
|
|
|
|
C-c C-x forms-exit x
|
1993-09-27 02:19:46 +00:00
|
|
|
|
"
|
|
|
|
|
(interactive)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; This is not a simple major mode, as usual. Therefore, forms-mode
|
|
|
|
|
;; takes an optional argument `primary' which is used for the
|
|
|
|
|
;; initial set-up. Normal use would leave `primary' to nil.
|
|
|
|
|
;; A global buffer-local variable `forms--mode-setup' has the same
|
|
|
|
|
;; effect but makes it possible to auto-invoke forms-mode using
|
|
|
|
|
;; `find-file'.
|
|
|
|
|
;; Note: although it seems logical to have `make-local-variable'
|
|
|
|
|
;; executed where the variable is first needed, I have deliberately
|
|
|
|
|
;; placed all calls in this function.
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; Primary set-up: evaluate buffer and check if the mandatory
|
|
|
|
|
;; variables have been set.
|
|
|
|
|
(if (or primary (not forms--mode-setup))
|
|
|
|
|
(progn
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: setting up...")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(kill-all-local-variables)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Make mandatory variables.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(make-local-variable 'forms-file)
|
|
|
|
|
(make-local-variable 'forms-number-of-fields)
|
|
|
|
|
(make-local-variable 'forms-format-list)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Make optional variables.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(make-local-variable 'forms-field-sep)
|
|
|
|
|
(make-local-variable 'forms-read-only)
|
|
|
|
|
(make-local-variable 'forms-multi-line)
|
|
|
|
|
(make-local-variable 'forms-forms-scroll)
|
|
|
|
|
(make-local-variable 'forms-forms-jump)
|
1996-03-01 21:13:01 +00:00
|
|
|
|
(make-local-variable 'forms-insert-after)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(make-local-variable 'forms-use-text-properties)
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
|
|
|
|
;; Filter functions.
|
|
|
|
|
(make-local-variable 'forms-read-file-filter)
|
|
|
|
|
(make-local-variable 'forms-write-file-filter)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(make-local-variable 'forms-new-record-filter)
|
|
|
|
|
(make-local-variable 'forms-modified-record-filter)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Make sure no filters exist.
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(setq forms-read-file-filter nil)
|
|
|
|
|
(setq forms-write-file-filter nil)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(setq forms-new-record-filter nil)
|
|
|
|
|
(setq forms-modified-record-filter nil)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
2020-08-18 21:17:47 +00:00
|
|
|
|
;; Setup faces to show read-only and read-write fields.
|
|
|
|
|
(make-local-variable 'forms-ro-face)
|
|
|
|
|
(make-local-variable 'forms-rw-face)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
;; eval the buffer, should set variables
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: processing control file...")
|
1994-06-13 12:07:44 +00:00
|
|
|
|
;; If enable-local-eval is not set to t the user is asked first.
|
|
|
|
|
(if (or (eq enable-local-eval t)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(yes-or-no-p
|
1994-06-13 12:07:44 +00:00
|
|
|
|
(concat "Evaluate lisp code in buffer "
|
2005-09-25 Romain Francoise <romain@orebokech.com>
* dired-aux.el (dired-copy-file-recursive):
* dired.el (dired-delete-file):
* ediff-mult.el (ediff-dir-diff-copy-file):
* ediff-util.el (ediff-test-save-region):
* forms.el (forms-mode):
* ido.el (ido-file-internal, ido-delete-file-at-head):
* log-edit.el (log-edit-done):
* ses.el (ses-yank-resize):
* play/gomoku.el (gomoku-human-plays, gomoku)
(gomoku-human-resigns, gomoku-prompt-for-other-game)
(gomoku-offer-a-draw):
* play/landmark.el (lm-human-resigns, lm):
* net/eudcb-ldap.el (eudc-ldap-check-base):
* play/mpuz.el (mpuz-offer-abort, mpuz-try-letter, mpuz-close-game):
* progmodes/ebrowse.el (ebrowse-find-pattern):
* progmodes/idlw-shell.el (idlwave-shell-set-bp-check):
* textmodes/reftex-index.el (reftex-index-initialize-phrases-buffer):
End `yes-or-no-p' and `y-or-n-p' prompts with question mark and
space.
* vc.el (vc-delete-file):
* play/gomoku.el (gomoku-terminate-game, gomoku)
(gomoku-prompt-for-move, gomoku-human-takes-back):
* play/landmark.el (lm-human-takes-back, lm-prompt-for-move)
(lm-start-robot, lm-human-plays): Remove extraneous spaces in
messages.
2005-09-24 23:26:28 +00:00
|
|
|
|
(buffer-name) " to display forms? ")))
|
2005-05-18 10:17:59 +00:00
|
|
|
|
(eval-buffer)
|
1994-06-13 12:07:44 +00:00
|
|
|
|
(error "`enable-local-eval' inhibits buffer evaluation"))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
;; Check if the mandatory variables make sense.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(or forms-file
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-file' has not been set")))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
|
|
|
|
;; Check forms-field-sep first, since it can be needed to
|
|
|
|
|
;; construct a default format list.
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(or (stringp forms-field-sep)
|
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-field-sep' is not a string")))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
|
|
|
|
(if forms-number-of-fields
|
|
|
|
|
(or (and (numberp forms-number-of-fields)
|
|
|
|
|
(> forms-number-of-fields 0))
|
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-number-of-fields' must be a number > 0")))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(or (null forms-format-list)
|
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-number-of-fields' has not been set"))))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
|
|
|
|
(or forms-format-list
|
|
|
|
|
(forms--intuit-from-file))
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if forms-multi-line
|
|
|
|
|
(if (and (stringp forms-multi-line)
|
|
|
|
|
(eq (length forms-multi-line) 1))
|
|
|
|
|
(if (string= forms-multi-line forms-field-sep)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
2005-06-14 11:30:22 +00:00
|
|
|
|
"`forms-multi-line' is equal to `forms-field-sep'")))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-multi-line' must be nil or a one-character string"))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Validate and process forms-format-list.
|
|
|
|
|
;;(message "forms: pre-processing format list...")
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(make-local-variable 'forms--elements)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms--process-format-list)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Build the formatter and parser.
|
|
|
|
|
;;(message "forms: building formatter...")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(make-local-variable 'forms--format)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(make-local-variable 'forms--markers)
|
|
|
|
|
(make-local-variable 'forms--dyntexts)
|
|
|
|
|
;;(message "forms: building parser...")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms--make-format)
|
|
|
|
|
(make-local-variable 'forms--parser)
|
|
|
|
|
(forms--make-parser)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: building parser... done.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Check if record filters are defined.
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(if (and forms-new-record-filter
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(not (functionp forms-new-record-filter)))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-new-record-filter' is not a function")))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
|
|
|
|
|
(if (and forms-modified-record-filter
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(not (functionp forms-modified-record-filter)))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-modified-record-filter' is not a function")))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
2012-03-28 07:24:26 +00:00
|
|
|
|
;; The filters access the contents of the forms using `forms-fields'.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(make-local-variable 'forms-fields)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Dynamic text support.
|
|
|
|
|
(make-local-variable 'forms--dynamic-text)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1998-10-06 23:22:48 +00:00
|
|
|
|
;; Prevent accidental overwrite of the control file and auto-save.
|
2016-03-12 11:05:49 +00:00
|
|
|
|
;; We bind change-major-mode-with-file-name to nil to prevent
|
|
|
|
|
;; set-visited-file-name from calling set-auto-mode, which
|
|
|
|
|
;; might kill all local variables and set forms-file nil,
|
|
|
|
|
;; which will then barf in find-file-noselect below. This can
|
2016-03-18 15:54:49 +00:00
|
|
|
|
;; happen when the user sets the default major mode that is
|
2016-03-12 11:05:49 +00:00
|
|
|
|
;; different from the Fundamental mode.
|
|
|
|
|
(let (change-major-mode-with-file-name)
|
|
|
|
|
(set-visited-file-name nil))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Prepare this buffer for further processing.
|
|
|
|
|
(setq buffer-read-only nil)
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
|
|
|
|
|
;;(message "forms: setting up... done.")
|
|
|
|
|
))
|
|
|
|
|
|
1994-06-13 12:07:44 +00:00
|
|
|
|
;; initialization done
|
|
|
|
|
(setq forms--mode-setup t)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Copy desired faces to the actual variables used by the forms formatter.
|
2020-08-18 21:17:47 +00:00
|
|
|
|
(make-local-variable 'forms--ro-face)
|
|
|
|
|
(make-local-variable 'forms--rw-face)
|
|
|
|
|
(if forms-read-only
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(progn
|
2020-08-18 21:17:47 +00:00
|
|
|
|
(setq forms--ro-face forms-ro-face)
|
|
|
|
|
(setq forms--rw-face forms-ro-face))
|
|
|
|
|
(setq forms--ro-face forms-ro-face)
|
|
|
|
|
(setq forms--rw-face forms-rw-face))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-06-30 22:37:30 +00:00
|
|
|
|
;; Make more local variables.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(make-local-variable 'forms--file-buffer)
|
|
|
|
|
(make-local-variable 'forms--total-records)
|
|
|
|
|
(make-local-variable 'forms--current-record)
|
|
|
|
|
(make-local-variable 'forms--the-record-list)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(make-local-variable 'forms--search-regexp)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
; The keymaps are global, so multiple forms mode buffers can share them.
|
|
|
|
|
;(make-local-variable 'forms-mode-map)
|
|
|
|
|
;(make-local-variable 'forms-mode-ro-map)
|
|
|
|
|
;(make-local-variable 'forms-mode-edit-map)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if forms-mode-map ; already defined
|
|
|
|
|
nil
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: building keymap...")
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(forms--mode-commands)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: building keymap... done.")
|
|
|
|
|
)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1994-03-28 23:13:07 +00:00
|
|
|
|
;; set the major mode indicator
|
|
|
|
|
(setq major-mode 'forms-mode)
|
|
|
|
|
(setq mode-name "Forms")
|
|
|
|
|
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
(cursor-intangible-mode 1)
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; find the data file
|
|
|
|
|
(setq forms--file-buffer (find-file-noselect forms-file))
|
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
;; Pre-transform.
|
|
|
|
|
(let ((read-file-filter forms-read-file-filter)
|
|
|
|
|
(write-file-filter forms-write-file-filter))
|
|
|
|
|
(if read-file-filter
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(let ((inhibit-read-only t)
|
|
|
|
|
(file-modified (buffer-modified-p)))
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(forms--run-functions read-file-filter)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(if (not file-modified) (set-buffer-modified-p nil)))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(if write-file-filter
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(add-hook 'write-file-functions write-file-filter nil t)))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(if write-file-filter
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
|
|
|
|
(add-hook 'write-file-functions write-file-filter nil t)))))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; count the number of records, and set see if it may be modified
|
|
|
|
|
(let (ro)
|
|
|
|
|
(setq forms--total-records
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(prog1
|
|
|
|
|
(progn
|
|
|
|
|
;;(message "forms: counting records...")
|
|
|
|
|
(bury-buffer (current-buffer))
|
|
|
|
|
(setq ro buffer-read-only)
|
|
|
|
|
(count-lines (point-min) (point-max)))
|
|
|
|
|
;;(message "forms: counting records... done.")
|
|
|
|
|
)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if ro
|
|
|
|
|
(setq forms-read-only t)))
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: proceeding setup...")
|
1993-10-21 00:43:51 +00:00
|
|
|
|
|
2012-06-02 10:56:09 +00:00
|
|
|
|
;; Since we aren't really implementing a minor mode, we hack the mode line
|
1993-10-21 00:43:51 +00:00
|
|
|
|
;; directly to get the text " View " into forms-read-only form buffers. For
|
|
|
|
|
;; that reason, this variable must be buffer only.
|
|
|
|
|
(make-local-variable 'minor-mode-alist)
|
|
|
|
|
(setq minor-mode-alist (list (list 'forms-read-only " View")))
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: proceeding setup (keymaps)...")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms--set-keymaps)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: proceeding setup (commands)...")
|
1993-06-19 00:08:24 +00:00
|
|
|
|
(forms--change-commands)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: proceeding setup (buffer)...")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(if (= forms--total-records 0)
|
|
|
|
|
;;(message "forms: proceeding setup (new file)...")
|
|
|
|
|
(progn
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(insert
|
2004-04-10 05:55:49 +00:00
|
|
|
|
"GNU Emacs Forms Mode\n\n"
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(if (file-exists-p forms-file)
|
Top-level elisp files respect ‘text-quoting-style’
In top-level elisp files, use format-message in diagnostic formats,
so that they follow user preference as per ‘text-quoting-style’
rather than being hard-coded to quote `like this'.
* lisp/allout.el (allout-get-configvar-values):
* lisp/apropos.el (apropos-symbols-internal):
* lisp/dired-aux.el (dired-do-shell-command, dired-create-files)
(dired-do-create-files-regexp, dired-create-files-non-directory):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log, dired-dnd-handle-local-file):
* lisp/disp-table.el (standard-display-european):
* lisp/find-dired.el (find-dired):
* lisp/forms.el (forms-mode):
* lisp/ido.el (ido-buffer-internal):
* lisp/info.el (Info-index-next):
* lisp/outline.el (outline-invent-heading):
* lisp/printing.el (pr-ps-outfile-preprint, pr-i-ps-send):
* lisp/proced.el (proced-log):
* lisp/ps-print.el (ps-print-preprint, ps-get-size):
* lisp/recentf.el (recentf-open-files, recentf-save-list):
* lisp/savehist.el (savehist-save):
* lisp/server.el (server-ensure-safe-dir):
* lisp/ses.el (ses-rename-cell):
* lisp/simple.el (list-processes--refresh):
* lisp/startup.el (command-line):
* lisp/strokes.el (strokes-unset-last-stroke)
(strokes-execute-stroke):
Use format-message so that quotes are restyled.
* lisp/cus-edit.el (custom-raised-buttons, customize-browse):
Don’t quote ‘raised’.
* lisp/descr-text.el (describe-char):
* lisp/dirtrack.el (dirtrack-debug-message):
* lisp/hexl.el (hexl-insert-multibyte-char):
Apply substitute-command-keys to help string.
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
Let dired-log do the formatting.
2015-08-26 08:30:29 +00:00
|
|
|
|
(format-message
|
|
|
|
|
"No records available in file `%s'\n\n" forms-file)
|
|
|
|
|
(format-message
|
|
|
|
|
"Creating new file `%s'\nwith %d field%s per record\n\n"
|
|
|
|
|
forms-file forms-number-of-fields
|
|
|
|
|
(if (= 1 forms-number-of-fields) "" "s")))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
"Use " (substitute-command-keys "\\[forms-insert-record]")
|
|
|
|
|
" to create new records.\n")
|
|
|
|
|
(setq forms--current-record 1)
|
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
|
(set-buffer-modified-p nil))
|
|
|
|
|
|
|
|
|
|
;; setup the first (or current) record to show
|
|
|
|
|
(if (< forms--current-record 1)
|
|
|
|
|
(setq forms--current-record 1))
|
|
|
|
|
(forms-jump-record forms--current-record)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1999-05-01 01:11:12 +00:00
|
|
|
|
(if forms-insert-after
|
|
|
|
|
(forms-last-record)
|
|
|
|
|
(forms-first-record))
|
|
|
|
|
)
|
1996-03-01 21:13:01 +00:00
|
|
|
|
|
2011-12-12 05:32:49 +00:00
|
|
|
|
;; user customizing
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: proceeding setup (user hooks)...")
|
2005-05-26 12:50:09 +00:00
|
|
|
|
(run-mode-hooks 'forms-mode-hook 'forms-mode-hooks)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;(message "forms: setting up... done.")
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
;; be helpful
|
|
|
|
|
(forms--help)
|
1994-06-13 12:07:44 +00:00
|
|
|
|
)
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms--process-format-list ()
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Validate `forms-format-list' and set some global variables.
|
|
|
|
|
;; Symbols in the list are evaluated, and consecutive strings are
|
|
|
|
|
;; concatenated.
|
|
|
|
|
;; Array `forms--elements' is constructed that contains the order
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; of the fields on the display. This array is used by
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; `forms--parser-using-text-properties' to extract the fields data
|
|
|
|
|
;; from the form on the screen.
|
1996-01-04 23:38:16 +00:00
|
|
|
|
;; Upon completion, `forms-format-list' is guaranteed correct, so
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; `forms--make-format' and `forms--make-parser' do not need to perform
|
|
|
|
|
;; any checks.
|
|
|
|
|
|
|
|
|
|
;; Verify that `forms-format-list' is not nil.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(or forms-format-list
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-format-list' has not been set")))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; It must be a list.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(or (listp forms-format-list)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms control file error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"`forms-format-list' is not a list")))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Assume every field is painted once.
|
|
|
|
|
;; `forms--elements' will grow if needed.
|
|
|
|
|
(setq forms--elements (make-vector forms-number-of-fields nil))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(let ((the-list forms-format-list) ; the list of format elements
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(prev-item nil)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(field-num 0)) ; highest field number
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(setq forms-format-list nil) ; gonna rebuild
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(while the-list
|
|
|
|
|
|
|
|
|
|
(let ((el (car-safe the-list))
|
|
|
|
|
(rem (cdr-safe the-list)))
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; If it is a symbol, eval it first.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(if (and (symbolp el)
|
|
|
|
|
(boundp el))
|
|
|
|
|
(setq el (eval el)))
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(cond
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Try string ...
|
|
|
|
|
((stringp el)
|
|
|
|
|
(if (stringp prev-item) ; try to concatenate strings
|
|
|
|
|
(setq prev-item (concat prev-item el))
|
|
|
|
|
(if prev-item
|
|
|
|
|
(setq forms-format-list
|
|
|
|
|
(append forms-format-list (list prev-item) nil)))
|
|
|
|
|
(setq prev-item el)))
|
|
|
|
|
|
|
|
|
|
;; Try numeric ...
|
2003-02-04 11:26:42 +00:00
|
|
|
|
((numberp el)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Validate range.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (or (<= el 0)
|
|
|
|
|
(> el forms-number-of-fields))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms format error: "
|
|
|
|
|
"field number %d out of range 1..%d")
|
|
|
|
|
el forms-number-of-fields))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Store forms order.
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(if (>= field-num (length forms--elements))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq forms--elements (vconcat forms--elements (1- el)))
|
|
|
|
|
(aset forms--elements field-num (1- el)))
|
|
|
|
|
(setq field-num (1+ field-num))
|
|
|
|
|
|
|
|
|
|
(if prev-item
|
|
|
|
|
(setq forms-format-list
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(append forms-format-list (list prev-item) nil)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq prev-item el))
|
|
|
|
|
|
|
|
|
|
;; Try function ...
|
1991-07-01 18:06:13 +00:00
|
|
|
|
((listp el)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Validate.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(or (fboundp (car-safe el))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms format error: "
|
1997-06-11 21:07:22 +00:00
|
|
|
|
"%S is not a function")
|
1996-01-29 23:15:25 +00:00
|
|
|
|
(car-safe el)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Shift.
|
|
|
|
|
(if prev-item
|
|
|
|
|
(setq forms-format-list
|
|
|
|
|
(append forms-format-list (list prev-item) nil)))
|
|
|
|
|
(setq prev-item el))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; else
|
|
|
|
|
(t
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(error (concat "Forms format error: "
|
1996-01-29 23:15:25 +00:00
|
|
|
|
"invalid element %S")
|
|
|
|
|
el)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Advance to next element of the list.
|
|
|
|
|
(setq the-list rem)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Append last item.
|
|
|
|
|
(if prev-item
|
|
|
|
|
(progn
|
|
|
|
|
(setq forms-format-list
|
|
|
|
|
(append forms-format-list (list prev-item) nil))
|
|
|
|
|
;; Append a newline if the last item is a field.
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; This prevents parsing problems.
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Also it makes it possible to insert an empty last field.
|
|
|
|
|
(if (numberp prev-item)
|
|
|
|
|
(setq forms-format-list
|
|
|
|
|
(append forms-format-list (list "\n") nil))))))
|
|
|
|
|
|
|
|
|
|
(forms--debug 'forms-format-list
|
|
|
|
|
'forms--elements))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Special treatment for read-only segments.
|
|
|
|
|
;;
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; If text is inserted between two read-only segments, there seems to
|
|
|
|
|
;; be no way to give the newly inserted text the RW face.
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; To solve this, read-only segments get the `insert-in-front-hooks'
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; property set with a function that temporarily switches the
|
|
|
|
|
;; properties of the first character of the segment to the RW face, so
|
|
|
|
|
;; the new text gets the right face. The `post-command-hook' is
|
|
|
|
|
;; used to restore the original properties.
|
1993-09-15 05:25:16 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms--iif-start nil
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Record start of modification command.")
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(defvar forms--iif-properties nil
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Original properties of the character being overridden.")
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun forms--iif-hook (_begin _end)
|
1993-09-15 05:25:16 +00:00
|
|
|
|
"`insert-in-front-hooks' function for read-only segments."
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; Note start location. By making it a marker that points one
|
|
|
|
|
;; character beyond the actual location, it is guaranteed to move
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; correctly if text is inserted.
|
|
|
|
|
(or forms--iif-start
|
|
|
|
|
(setq forms--iif-start (copy-marker (1+ (point)))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; Check if there is special treatment required.
|
|
|
|
|
(if (or (<= forms--iif-start 2)
|
|
|
|
|
(get-text-property (- forms--iif-start 2)
|
|
|
|
|
'read-only))
|
|
|
|
|
(progn
|
|
|
|
|
;; Fetch current properties.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(setq forms--iif-properties
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(text-properties-at (1- forms--iif-start)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; Replace them.
|
|
|
|
|
(let ((inhibit-read-only t))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(set-text-properties
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(1- forms--iif-start) forms--iif-start
|
|
|
|
|
(list 'face forms--rw-face 'front-sticky '(face))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; Enable `post-command-hook' to restore the properties.
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(add-hook 'post-command-hook #'forms--iif-post-command-hook))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; No action needed. Clear marker.
|
|
|
|
|
(setq forms--iif-start nil)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(defun forms--iif-post-command-hook ()
|
|
|
|
|
"`post-command-hook' function for read-only segments."
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Disable `post-command-hook'.
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(remove-hook 'post-command-hook #'forms--iif-post-command-hook)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Restore properties.
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(if forms--iif-start
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(set-text-properties
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(1- forms--iif-start) forms--iif-start
|
|
|
|
|
forms--iif-properties)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; Cleanup.
|
1993-09-15 05:25:16 +00:00
|
|
|
|
(setq forms--iif-start nil))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
(defvar forms--marker)
|
|
|
|
|
(defvar forms--dyntext)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--make-format ()
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Generate `forms--format' using the information in `forms-format-list'."
|
|
|
|
|
|
|
|
|
|
;; The real work is done using a mapcar of `forms--make-format-elt' on
|
|
|
|
|
;; `forms-format-list'.
|
|
|
|
|
;; This function sets up the necessary environment, and decides
|
|
|
|
|
;; which function to mapcar.
|
|
|
|
|
|
|
|
|
|
(let ((forms--marker 0)
|
|
|
|
|
(forms--dyntext 0))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(setq
|
1993-07-17 19:15:19 +00:00
|
|
|
|
forms--format
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(if forms-use-text-properties
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`(lambda (arg)
|
|
|
|
|
(let ((inhibit-read-only t))
|
2020-12-26 17:21:17 +00:00
|
|
|
|
,@(apply #'append
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(mapcar #'forms--make-format-elt-using-text-properties
|
1999-11-13 22:07:05 +00:00
|
|
|
|
forms-format-list))
|
|
|
|
|
;; Prevent insertion before the first text.
|
|
|
|
|
,@(if (numberp (car forms-format-list))
|
|
|
|
|
nil
|
|
|
|
|
'((add-text-properties (point-min) (1+ (point-min))
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
'(front-sticky (read-only cursor-intangible)))))
|
1999-11-13 22:07:05 +00:00
|
|
|
|
;; Prevent insertion after the last text.
|
|
|
|
|
(remove-text-properties (1- (point)) (point)
|
2019-08-01 12:59:46 +00:00
|
|
|
|
'(rear-nonsticky nil)))
|
1999-11-13 22:07:05 +00:00
|
|
|
|
(setq forms--iif-start nil))
|
|
|
|
|
`(lambda (arg)
|
2020-12-26 17:21:17 +00:00
|
|
|
|
,@(apply #'append
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(mapcar #'forms--make-format-elt forms-format-list)))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; We have tallied the number of markers and dynamic texts,
|
|
|
|
|
;; so we can allocate the arrays now.
|
|
|
|
|
(setq forms--markers (make-vector forms--marker nil))
|
|
|
|
|
(setq forms--dyntexts (make-vector forms--dyntext nil)))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(forms--debug 'forms--format))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defun forms--make-format-elt-using-text-properties (el)
|
|
|
|
|
"Helper routine to generate format function."
|
|
|
|
|
|
|
|
|
|
;; The format routine `forms--format' will look like
|
|
|
|
|
;;
|
|
|
|
|
;; ;; preamble
|
|
|
|
|
;; (lambda (arg)
|
|
|
|
|
;; (let ((inhibit-read-only t))
|
|
|
|
|
;;
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; ;; A string, e.g. "text: ".
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; (set-text-properties
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; (point)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; (progn (insert "text: ") (point))
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; (list 'face forms--ro-face
|
|
|
|
|
;; 'read-only 1
|
|
|
|
|
;; 'insert-in-front-hooks 'forms--iif-hook
|
|
|
|
|
;; 'rear-nonsticky '(read-only face insert-in-front-hooks)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; ;; A field, e.g. 6.
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; (let ((here (point)))
|
|
|
|
|
;; (aset forms--markers 0 (point-marker))
|
|
|
|
|
;; (insert (elt arg 5))
|
|
|
|
|
;; (or (= (point) here)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; (set-text-properties
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; here (point)
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; (list 'face forms--rw-face
|
|
|
|
|
;; 'front-sticky '(face))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; ;; Another string, e.g. "\nmore text: ".
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; (set-text-properties
|
|
|
|
|
;; (point)
|
|
|
|
|
;; (progn (insert "\nmore text: ") (point))
|
|
|
|
|
;; (list 'face forms--ro-face
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; 'read-only 2
|
|
|
|
|
;; 'insert-in-front-hooks 'forms--iif-hook
|
|
|
|
|
;; 'rear-nonsticky '(read-only face insert-in-front-hooks)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; ;; A function, e.g. (tocol 40).
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; (set-text-properties
|
|
|
|
|
;; (point)
|
|
|
|
|
;; (progn
|
|
|
|
|
;; (insert (aset forms--dyntexts 0 (tocol 40)))
|
|
|
|
|
;; (point))
|
|
|
|
|
;; (list 'face forms--ro-face
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; 'read-only 2
|
|
|
|
|
;; 'insert-in-front-hooks 'forms--iif-hook
|
|
|
|
|
;; 'rear-nonsticky '(read-only face insert-in-front-hooks)))
|
|
|
|
|
;;
|
|
|
|
|
;; ;; Prevent insertion before the first text.
|
|
|
|
|
;; (add-text-properties (point-min) (1+ (point-min))
|
|
|
|
|
;; '(front-sticky (read-only))))))
|
|
|
|
|
;; ;; Prevent insertion after the last text.
|
|
|
|
|
;; (remove-text-properties (1- (point)) (point)
|
2019-08-01 12:59:46 +00:00
|
|
|
|
;; '(rear-nonsticky nil)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;
|
|
|
|
|
;; ;; wrap up
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; (setq forms--iif-start nil)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; ))
|
|
|
|
|
|
|
|
|
|
(cond
|
|
|
|
|
((stringp el)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
|
|
|
|
`((set-text-properties
|
1999-11-13 22:07:05 +00:00
|
|
|
|
(point) ; start at point
|
|
|
|
|
(progn ; until after insertion
|
|
|
|
|
(insert ,el)
|
|
|
|
|
(point))
|
|
|
|
|
(list 'face forms--ro-face ; read-only appearance
|
|
|
|
|
'read-only ,@(list (1+ forms--marker))
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
'cursor-intangible ,@(list (1+ forms--marker))
|
1999-11-13 22:07:05 +00:00
|
|
|
|
'insert-in-front-hooks '(forms--iif-hook)
|
|
|
|
|
'rear-nonsticky '(face read-only insert-in-front-hooks
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
cursor-intangible)))))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
((numberp el)
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((let ((here (point)))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(aset forms--markers
|
1999-11-13 22:07:05 +00:00
|
|
|
|
,(prog1 forms--marker
|
|
|
|
|
(setq forms--marker (1+ forms--marker)))
|
|
|
|
|
(point-marker))
|
|
|
|
|
(insert (elt arg ,(1- el)))
|
|
|
|
|
(or (= (point) here)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(set-text-properties
|
1999-11-13 22:07:05 +00:00
|
|
|
|
here (point)
|
|
|
|
|
(list 'face forms--rw-face
|
|
|
|
|
'front-sticky '(face)))))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
((listp el)
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((set-text-properties
|
|
|
|
|
(point)
|
|
|
|
|
(progn
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(insert (aset forms--dyntexts
|
1999-11-13 22:07:05 +00:00
|
|
|
|
,(prog1 forms--dyntext
|
|
|
|
|
(setq forms--dyntext (1+ forms--dyntext)))
|
|
|
|
|
,el))
|
|
|
|
|
(point))
|
|
|
|
|
(list 'face forms--ro-face
|
|
|
|
|
'read-only ,@(list (1+ forms--marker))
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
'cursor-intangible ,@(list (1+ forms--marker))
|
1999-11-13 22:07:05 +00:00
|
|
|
|
'insert-in-front-hooks '(forms--iif-hook)
|
|
|
|
|
'rear-nonsticky '(read-only face insert-in-front-hooks
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
cursor-intangible)))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; end of cond
|
|
|
|
|
))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--make-format-elt (el)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Helper routine to generate format function."
|
|
|
|
|
|
|
|
|
|
;; If we're not using text properties, the format routine
|
|
|
|
|
;; `forms--format' will look like
|
|
|
|
|
;;
|
|
|
|
|
;; (lambda (arg)
|
|
|
|
|
;; ;; a string, e.g. "text: "
|
|
|
|
|
;; (insert "text: ")
|
|
|
|
|
;; ;; a field, e.g. 6
|
|
|
|
|
;; (aset forms--markers 0 (point-marker))
|
|
|
|
|
;; (insert (elt arg 5))
|
|
|
|
|
;; ;; another string, e.g. "\nmore text: "
|
|
|
|
|
;; (insert "\nmore text: ")
|
|
|
|
|
;; ;; a function, e.g. (tocol 40)
|
|
|
|
|
;; (insert (aset forms--dyntexts 0 (tocol 40)))
|
|
|
|
|
;; ... )
|
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(cond
|
1993-06-12 20:53:59 +00:00
|
|
|
|
((stringp el)
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((insert ,el)))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
((numberp el)
|
|
|
|
|
(prog1
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((aset forms--markers ,forms--marker (point-marker))
|
|
|
|
|
(insert (elt arg ,(1- el))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq forms--marker (1+ forms--marker))))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
((listp el)
|
|
|
|
|
(prog1
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((insert (aset forms--dyntexts ,forms--dyntext ,el)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq forms--dyntext (1+ forms--dyntext))))))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defvar forms--field)
|
|
|
|
|
(defvar forms--recordv)
|
|
|
|
|
(defvar forms--seen-text)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--make-parser ()
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Generate `forms--parser' from the information in `forms-format-list'."
|
|
|
|
|
|
|
|
|
|
;; If we can use text properties, we simply set it to
|
|
|
|
|
;; `forms--parser-using-text-properties'.
|
|
|
|
|
;; Otherwise, the function is constructed using a mapcar of
|
|
|
|
|
;; `forms--make-parser-elt on `forms-format-list'.
|
|
|
|
|
|
|
|
|
|
(setq
|
|
|
|
|
forms--parser
|
|
|
|
|
(if forms-use-text-properties
|
|
|
|
|
(function forms--parser-using-text-properties)
|
|
|
|
|
(let ((forms--field nil)
|
|
|
|
|
(forms--seen-text nil)
|
|
|
|
|
(forms--dyntext 0))
|
|
|
|
|
|
|
|
|
|
;; Note: we add a nil element to the list passed to `mapcar',
|
|
|
|
|
;; see `forms--make-parser-elt' for details.
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`(lambda nil
|
|
|
|
|
(let (here)
|
|
|
|
|
(goto-char (point-min))
|
2020-12-26 17:21:17 +00:00
|
|
|
|
,@(apply #'append
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(mapcar
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
#'forms--make-parser-elt
|
1999-11-13 22:07:05 +00:00
|
|
|
|
(append forms-format-list (list nil)))))))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(forms--debug 'forms--parser))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(defun forms--parser-using-text-properties ()
|
|
|
|
|
"Extract field info from forms when using text properties."
|
|
|
|
|
|
|
|
|
|
;; Using text properties, we can simply jump to the markers, and
|
|
|
|
|
;; extract the information up to the following read-only segment.
|
|
|
|
|
|
|
|
|
|
(let ((i 0)
|
|
|
|
|
here there)
|
|
|
|
|
(while (< i (length forms--markers))
|
|
|
|
|
(goto-char (setq here (aref forms--markers i)))
|
|
|
|
|
(if (get-text-property here 'read-only)
|
|
|
|
|
(aset forms--recordv (aref forms--elements i) nil)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(if (setq there
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(next-single-property-change here 'read-only))
|
|
|
|
|
(aset forms--recordv (aref forms--elements i)
|
1995-11-16 20:04:57 +00:00
|
|
|
|
(buffer-substring-no-properties here there))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(aset forms--recordv (aref forms--elements i)
|
1995-11-16 20:04:57 +00:00
|
|
|
|
(buffer-substring-no-properties here (point-max)))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq i (1+ i)))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--make-parser-elt (el)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Helper routine to generate forms parser function."
|
|
|
|
|
|
|
|
|
|
;; The parse routine will look like:
|
|
|
|
|
;;
|
|
|
|
|
;; (lambda nil
|
|
|
|
|
;; (let (here)
|
|
|
|
|
;; (goto-char (point-min))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; ;; "text: "
|
|
|
|
|
;; (if (not (looking-at "text: "))
|
|
|
|
|
;; (error "Parse error: cannot find \"text: \""))
|
|
|
|
|
;; (forward-char 6) ; past "text: "
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;;
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; ;; 6
|
|
|
|
|
;; ;; "\nmore text: "
|
|
|
|
|
;; (setq here (point))
|
|
|
|
|
;; (if (not (search-forward "\nmore text: " nil t nil))
|
|
|
|
|
;; (error "Parse error: cannot find \"\\nmore text: \""))
|
1995-11-16 20:04:57 +00:00
|
|
|
|
;; (aset forms--recordv 5 (buffer-substring-no-properties here (- (point) 12)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;;
|
|
|
|
|
;; ;; (tocol 40)
|
|
|
|
|
;; (let ((forms--dyntext (car-safe forms--dynamic-text)))
|
|
|
|
|
;; (if (not (looking-at (regexp-quote forms--dyntext)))
|
|
|
|
|
;; (error "Parse error: not looking at \"%s\"" forms--dyntext))
|
|
|
|
|
;; (forward-char (length forms--dyntext))
|
|
|
|
|
;; (setq forms--dynamic-text (cdr-safe forms--dynamic-text)))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; ...
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; ;; final flush (due to terminator sentinel, see below)
|
1995-11-16 20:04:57 +00:00
|
|
|
|
;; (aset forms--recordv 7 (buffer-substring-no-properties (point) (point-max)))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(cond
|
|
|
|
|
((stringp el)
|
|
|
|
|
(prog1
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if forms--field
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((setq here (point))
|
|
|
|
|
(if (not (search-forward ,el nil t nil))
|
|
|
|
|
(error "Parse error: cannot find `%s'" ,el))
|
|
|
|
|
(aset forms--recordv ,(1- forms--field)
|
|
|
|
|
(buffer-substring-no-properties here
|
|
|
|
|
(- (point) ,(length el)))))
|
|
|
|
|
`((if (not (looking-at ,(regexp-quote el)))
|
|
|
|
|
(error "Parse error: not looking at `%s'" ,el))
|
|
|
|
|
(forward-char ,(length el))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq forms--seen-text t)
|
|
|
|
|
(setq forms--field nil)))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
((numberp el)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if forms--field
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(error "Cannot parse adjacent fields %d and %d"
|
1993-07-17 19:15:19 +00:00
|
|
|
|
forms--field el)
|
|
|
|
|
(setq forms--field el)
|
1991-07-01 18:06:13 +00:00
|
|
|
|
nil))
|
|
|
|
|
((null el)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if forms--field
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((aset forms--recordv ,(1- forms--field)
|
|
|
|
|
(buffer-substring-no-properties (point) (point-max))))))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
((listp el)
|
|
|
|
|
(prog1
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if forms--field
|
1999-11-13 22:07:05 +00:00
|
|
|
|
`((let ((here (point))
|
|
|
|
|
(forms--dyntext (aref forms--dyntexts ,forms--dyntext)))
|
|
|
|
|
(if (not (search-forward forms--dyntext nil t nil))
|
|
|
|
|
(error "Parse error: cannot find `%s'" forms--dyntext))
|
|
|
|
|
(aset forms--recordv ,(1- forms--field)
|
|
|
|
|
(buffer-substring-no-properties here
|
|
|
|
|
(- (point) (length forms--dyntext))))))
|
|
|
|
|
`((let ((forms--dyntext (aref forms--dyntexts ,forms--dyntext)))
|
|
|
|
|
(if (not (looking-at (regexp-quote forms--dyntext)))
|
|
|
|
|
(error "Parse error: not looking at `%s'" forms--dyntext))
|
|
|
|
|
(forward-char (length forms--dyntext)))))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(setq forms--dyntext (1+ forms--dyntext))
|
|
|
|
|
(setq forms--seen-text t)
|
|
|
|
|
(setq forms--field nil)))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(defun forms--intuit-from-file ()
|
|
|
|
|
"Get number of fields and a default form using the data file."
|
|
|
|
|
|
|
|
|
|
;; If `forms-number-of-fields' is not set, get it from the data file.
|
|
|
|
|
(if (null forms-number-of-fields)
|
|
|
|
|
|
|
|
|
|
;; Need a file to do this.
|
|
|
|
|
(if (not (file-exists-p forms-file))
|
2005-06-14 11:30:22 +00:00
|
|
|
|
(error "Need existing file or explicit `forms-number-of-fields'")
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
|
|
|
|
;; Visit the file and extract the first record.
|
|
|
|
|
(setq forms--file-buffer (find-file-noselect forms-file))
|
|
|
|
|
(let ((read-file-filter forms-read-file-filter)
|
|
|
|
|
(the-record))
|
|
|
|
|
(setq the-record
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(forms--run-functions read-file-filter))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forms--get-record)))
|
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; This may be overkill, but try to avoid interference with
|
1994-07-26 19:47:39 +00:00
|
|
|
|
;; the normal processing.
|
|
|
|
|
(kill-buffer forms--file-buffer)
|
|
|
|
|
|
|
|
|
|
;; Count the number of fields in `the-record'.
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(let ((start-pos 0)
|
1994-07-26 19:47:39 +00:00
|
|
|
|
found-pos
|
|
|
|
|
(field-sep-length (length forms-field-sep)))
|
|
|
|
|
(setq forms-number-of-fields 1)
|
|
|
|
|
(while (setq found-pos
|
|
|
|
|
(string-match forms-field-sep the-record start-pos))
|
|
|
|
|
(progn
|
|
|
|
|
(setq forms-number-of-fields (1+ forms-number-of-fields))
|
|
|
|
|
(setq start-pos (+ field-sep-length found-pos))))))))
|
|
|
|
|
|
|
|
|
|
;; Construct default format list.
|
|
|
|
|
(setq forms-format-list (list "Forms file \"" forms-file "\".\n\n"))
|
|
|
|
|
(let ((i 0))
|
|
|
|
|
(while (<= (setq i (1+ i)) forms-number-of-fields)
|
|
|
|
|
(setq forms-format-list
|
|
|
|
|
(append forms-format-list
|
|
|
|
|
(list (format "%4d: " i) i "\n"))))))
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms--set-keymaps ()
|
|
|
|
|
"Set the keymaps used in this mode."
|
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(use-local-map (if forms-read-only
|
|
|
|
|
forms-mode-ro-map
|
1993-09-27 02:19:46 +00:00
|
|
|
|
forms-mode-edit-map)))
|
|
|
|
|
|
|
|
|
|
(defun forms--mode-commands ()
|
|
|
|
|
"Fill the Forms mode keymaps."
|
|
|
|
|
|
|
|
|
|
;; `forms-mode-map' is always accessible via \C-c prefix.
|
|
|
|
|
(setq forms-mode-map (make-keymap))
|
|
|
|
|
(define-key forms-mode-map "\t" 'forms-next-field)
|
|
|
|
|
(define-key forms-mode-map "\C-k" 'forms-delete-record)
|
|
|
|
|
(define-key forms-mode-map "\C-q" 'forms-toggle-read-only)
|
|
|
|
|
(define-key forms-mode-map "\C-o" 'forms-insert-record)
|
|
|
|
|
(define-key forms-mode-map "\C-l" 'forms-jump-record)
|
|
|
|
|
(define-key forms-mode-map "\C-n" 'forms-next-record)
|
|
|
|
|
(define-key forms-mode-map "\C-p" 'forms-prev-record)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key forms-mode-map "\C-r" 'forms-search-backward)
|
|
|
|
|
(define-key forms-mode-map "\C-s" 'forms-search-forward)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(define-key forms-mode-map "\C-x" 'forms-exit)
|
|
|
|
|
(define-key forms-mode-map "<" 'forms-first-record)
|
|
|
|
|
(define-key forms-mode-map ">" 'forms-last-record)
|
|
|
|
|
(define-key forms-mode-map "\C-?" 'forms-prev-record)
|
|
|
|
|
|
|
|
|
|
;; `forms-mode-ro-map' replaces the local map when in read-only mode.
|
|
|
|
|
(setq forms-mode-ro-map (make-keymap))
|
|
|
|
|
(suppress-keymap forms-mode-ro-map)
|
|
|
|
|
(define-key forms-mode-ro-map "\C-c" forms-mode-map)
|
|
|
|
|
(define-key forms-mode-ro-map "q" 'forms-toggle-read-only)
|
|
|
|
|
(define-key forms-mode-ro-map "l" 'forms-jump-record)
|
|
|
|
|
(define-key forms-mode-ro-map "n" 'forms-next-record)
|
|
|
|
|
(define-key forms-mode-ro-map "p" 'forms-prev-record)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key forms-mode-ro-map "r" 'forms-search-backward)
|
|
|
|
|
(define-key forms-mode-ro-map "s" 'forms-search-forward)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(define-key forms-mode-ro-map "x" 'forms-exit)
|
|
|
|
|
(define-key forms-mode-ro-map "<" 'forms-first-record)
|
|
|
|
|
(define-key forms-mode-ro-map ">" 'forms-last-record)
|
|
|
|
|
(define-key forms-mode-ro-map "?" 'describe-mode)
|
|
|
|
|
(define-key forms-mode-ro-map " " 'forms-next-record)
|
|
|
|
|
(forms--mode-commands1 forms-mode-ro-map)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(forms--mode-menu-ro forms-mode-ro-map)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
|
|
|
|
|
;; This is the normal, local map.
|
|
|
|
|
(setq forms-mode-edit-map (make-keymap))
|
|
|
|
|
(define-key forms-mode-edit-map "\C-c" forms-mode-map)
|
|
|
|
|
(forms--mode-commands1 forms-mode-edit-map)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(forms--mode-menu-edit forms-mode-edit-map)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
)
|
|
|
|
|
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(defun forms--mode-menu-ro (map)
|
2011-11-20 02:29:42 +00:00
|
|
|
|
;;; Menu initialization
|
1995-01-05 11:54:18 +00:00
|
|
|
|
; (define-key map [menu-bar] (make-sparse-keymap))
|
|
|
|
|
(define-key map [menu-bar forms]
|
|
|
|
|
(cons "Forms" (make-sparse-keymap "Forms")))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-exit]
|
1996-03-01 21:13:01 +00:00
|
|
|
|
'("Exit Forms Mode" . forms-exit))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-sep1]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-save]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Save Data" . forms-save-buffer))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-print]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Print Data" . forms-print))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-describe]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Describe Mode" . describe-mode))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-toggle-ro]
|
|
|
|
|
'("Toggle View/Edit" . forms-toggle-read-only))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-jump-record]
|
|
|
|
|
'("Jump" . forms-jump-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-search-backward]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Search Backward" . forms-search-backward))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-search-forward]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Search Forward" . forms-search-forward))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-delete-record]
|
|
|
|
|
'("Delete" . forms-delete-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-insert-record]
|
|
|
|
|
'("Insert" . forms-insert-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-sep2]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-last-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Last Record" . forms-last-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-first-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("First Record" . forms-first-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-prev-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Previous Record" . forms-prev-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-next-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Next Record" . forms-next-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-sep3]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-prev-field]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Previous Field" . forms-prev-field))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-next-field]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Next Field" . forms-next-field))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(put 'forms-insert-record 'menu-enable '(not forms-read-only))
|
|
|
|
|
(put 'forms-delete-record 'menu-enable '(not forms-read-only))
|
|
|
|
|
)
|
|
|
|
|
(defun forms--mode-menu-edit (map)
|
2011-11-20 02:29:42 +00:00
|
|
|
|
;;; Menu initialization
|
1995-01-05 11:54:18 +00:00
|
|
|
|
; (define-key map [menu-bar] (make-sparse-keymap))
|
|
|
|
|
(define-key map [menu-bar forms]
|
|
|
|
|
(cons "Forms" (make-sparse-keymap "Forms")))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit--exit]
|
|
|
|
|
'("Exit" . forms-exit))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-sep1]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-save]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Save Data" . forms-save-buffer))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-print]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Print Data" . forms-print))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-describe]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Describe Mode" . describe-mode))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-toggle-ro]
|
|
|
|
|
'("Toggle View/Edit" . forms-toggle-read-only))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-jump-record]
|
|
|
|
|
'("Jump" . forms-jump-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-search-backward]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Search Backward" . forms-search-backward))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-search-forward]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Search Forward" . forms-search-forward))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-delete-record]
|
|
|
|
|
'("Delete" . forms-delete-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-insert-record]
|
|
|
|
|
'("Insert" . forms-insert-record))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-sep2]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-last-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Last Record" . forms-last-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-first-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("First Record" . forms-first-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-prev-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Previous Record" . forms-prev-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-next-record]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Next Record" . forms-next-record))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-sep3]
|
|
|
|
|
'("----"))
|
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-prev-field]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Previous Field" . forms-prev-field))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(define-key map [menu-bar forms menu-forms-edit-next-field]
|
1995-05-30 22:54:53 +00:00
|
|
|
|
'("Next Field" . forms-next-field))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(put 'forms-insert-record 'menu-enable '(not forms-read-only))
|
|
|
|
|
(put 'forms-delete-record 'menu-enable '(not forms-read-only))
|
|
|
|
|
)
|
|
|
|
|
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(defun forms--mode-commands1 (map)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
"Helper routine to define keys."
|
2003-05-23 12:48:06 +00:00
|
|
|
|
(define-key map "\t" 'forms-next-field)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(define-key map [S-tab] 'forms-prev-field)
|
|
|
|
|
(define-key map [next] 'forms-next-record)
|
|
|
|
|
(define-key map [prior] 'forms-prev-record)
|
|
|
|
|
(define-key map [begin] 'forms-first-record)
|
|
|
|
|
(define-key map [last] 'forms-last-record)
|
|
|
|
|
(define-key map [backtab] 'forms-prev-field)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
)
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;; Changed functions
|
|
|
|
|
|
|
|
|
|
(defun forms--change-commands ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Localize some commands for Forms mode."
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; scroll-down -> forms-prev-record
|
|
|
|
|
;; scroll-up -> forms-next-record
|
1993-06-19 00:15:32 +00:00
|
|
|
|
(if forms-forms-scroll
|
|
|
|
|
(progn
|
2003-01-12 20:47:48 +00:00
|
|
|
|
(local-set-key [remap scroll-up] 'forms-next-record)
|
2010-04-14 00:33:32 +00:00
|
|
|
|
(local-set-key [remap scroll-down] 'forms-prev-record)
|
|
|
|
|
(local-set-key [remap scroll-up-command] 'forms-next-record)
|
|
|
|
|
(local-set-key [remap scroll-down-command] 'forms-prev-record)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;
|
|
|
|
|
;; beginning-of-buffer -> forms-first-record
|
|
|
|
|
;; end-of-buffer -> forms-end-record
|
1993-06-19 00:15:32 +00:00
|
|
|
|
(if forms-forms-jump
|
|
|
|
|
(progn
|
2003-01-12 20:47:48 +00:00
|
|
|
|
(local-set-key [remap beginning-of-buffer] 'forms-first-record)
|
|
|
|
|
(local-set-key [remap end-of-buffer] 'forms-last-record)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;
|
1994-07-26 19:47:39 +00:00
|
|
|
|
;; Save buffer
|
|
|
|
|
(local-set-key "\C-x\C-s" 'forms-save-buffer)
|
|
|
|
|
;;
|
1994-06-13 12:07:44 +00:00
|
|
|
|
;; We have our own revert function - use it.
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(make-local-variable 'revert-buffer-function)
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(setq revert-buffer-function #'forms--revert-buffer)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
|
|
|
|
|
t)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--help ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Initial help for Forms mode."
|
1996-01-25 00:54:17 +00:00
|
|
|
|
(message "%s" (substitute-command-keys (concat
|
1993-09-27 02:19:46 +00:00
|
|
|
|
"\\[forms-next-record]:next"
|
|
|
|
|
" \\[forms-prev-record]:prev"
|
|
|
|
|
" \\[forms-first-record]:first"
|
|
|
|
|
" \\[forms-last-record]:last"
|
|
|
|
|
" \\[describe-mode]:help"))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--trans (subj arg rep)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Translate in SUBJ all chars ARG into char REP. ARG and REP should
|
1991-05-20 20:35:19 +00:00
|
|
|
|
be single-char strings."
|
|
|
|
|
(let ((i 0)
|
|
|
|
|
(re (regexp-quote arg))
|
|
|
|
|
(k (string-to-char rep)))
|
|
|
|
|
(while (setq i (string-match re subj i))
|
|
|
|
|
(aset subj i k)
|
|
|
|
|
(setq i (1+ i)))))
|
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(defun forms--exit (&optional save)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
"Internal exit from forms mode function."
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(let ((buf (buffer-name forms--file-buffer)))
|
|
|
|
|
(forms--checkmod)
|
|
|
|
|
(if (and save
|
|
|
|
|
(buffer-modified-p forms--file-buffer))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(forms-save-buffer))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(delete-auto-save-file-if-necessary)
|
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
|
(if (get-buffer buf) ; not killed???
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(if save
|
|
|
|
|
(error "Problem saving buffer %s" (buffer-name buf)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(delete-auto-save-file-if-necessary)
|
|
|
|
|
(kill-buffer (current-buffer)))))
|
|
|
|
|
|
|
|
|
|
(defun forms--get-record ()
|
|
|
|
|
"Fetch the current record from the file buffer."
|
1993-07-17 19:15:19 +00:00
|
|
|
|
|
|
|
|
|
;; This function is executed in the context of the `forms--file-buffer'.
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(or (bolp)
|
|
|
|
|
(beginning-of-line nil))
|
|
|
|
|
(let ((here (point)))
|
|
|
|
|
(prog2
|
|
|
|
|
(end-of-line)
|
1995-11-16 20:04:57 +00:00
|
|
|
|
(buffer-substring-no-properties here (point))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(goto-char here))))
|
|
|
|
|
|
|
|
|
|
(defun forms--show-record (the-record)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Format THE-RECORD and display it in the current buffer."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Split the-record.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(let (the-result
|
|
|
|
|
(start-pos 0)
|
|
|
|
|
found-pos
|
|
|
|
|
(field-sep-length (length forms-field-sep)))
|
|
|
|
|
(if forms-multi-line
|
|
|
|
|
(forms--trans the-record forms-multi-line "\n"))
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Add an extra separator (makes splitting easy).
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq the-record (concat the-record forms-field-sep))
|
|
|
|
|
(while (setq found-pos (string-match forms-field-sep the-record start-pos))
|
|
|
|
|
(let ((ent (substring the-record start-pos found-pos)))
|
|
|
|
|
(setq the-result
|
|
|
|
|
(append the-result (list ent)))
|
|
|
|
|
(setq start-pos (+ field-sep-length found-pos))))
|
|
|
|
|
(setq forms--the-record-list the-result))
|
|
|
|
|
|
|
|
|
|
(setq buffer-read-only nil)
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if forms-use-text-properties
|
|
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
|
(set-text-properties (point-min) (point-max) nil)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Verify the number of fields, extend forms--the-record-list if needed.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (= (length forms--the-record-list) forms-number-of-fields)
|
|
|
|
|
nil
|
1995-08-14 06:45:37 +00:00
|
|
|
|
(if (null forms-check-number-of-fields)
|
|
|
|
|
nil
|
|
|
|
|
(message "Warning: this record has %d fields instead of %d"
|
|
|
|
|
(length forms--the-record-list) forms-number-of-fields))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (< (length forms--the-record-list) forms-number-of-fields)
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(setq forms--the-record-list
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(append forms--the-record-list
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(make-list
|
|
|
|
|
(- forms-number-of-fields
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(length forms--the-record-list))
|
|
|
|
|
"")))))
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Call the formatter function.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(setq forms-fields (append (list nil) forms--the-record-list nil))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(funcall forms--format forms--the-record-list)
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Prepare.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(setq buffer-read-only forms-read-only)
|
|
|
|
|
(setq mode-line-process
|
1999-01-15 16:19:53 +00:00
|
|
|
|
(concat " " (int-to-string forms--current-record)
|
|
|
|
|
"/" (int-to-string forms--total-records))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--parse-form ()
|
|
|
|
|
"Parse contents of form into list of strings."
|
|
|
|
|
;; The contents of the form are parsed, and a new list of strings
|
|
|
|
|
;; is constructed.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; A vector with the strings from the original record is
|
1993-06-30 22:37:30 +00:00
|
|
|
|
;; constructed, which is updated with the new contents. Therefore
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; fields which were not in the form are not modified.
|
|
|
|
|
;; Finally, the vector is transformed into a list for further processing.
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(let (forms--recordv)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Build the vector.
|
|
|
|
|
(setq forms--recordv (vconcat forms--the-record-list))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Parse the form and update the vector.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(let ((forms--dynamic-text forms--dynamic-text))
|
|
|
|
|
(funcall forms--parser))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(if forms-modified-record-filter
|
1991-07-01 18:06:13 +00:00
|
|
|
|
;; As a service to the user, we add a zeroth element so she
|
|
|
|
|
;; can use the same indices as in the forms definition.
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(let ((the-fields (vconcat [nil] forms--recordv)))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(setq the-fields (funcall forms-modified-record-filter the-fields))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(cdr (append the-fields nil)))
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Transform to a list and return.
|
|
|
|
|
(append forms--recordv nil))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--update ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Update current record with contents of form.
|
1993-07-17 19:15:19 +00:00
|
|
|
|
As a side effect: sets `forms--the-record-list'."
|
1993-06-30 22:37:30 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if forms-read-only
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(error "Buffer is read-only"))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(let (the-record)
|
|
|
|
|
;; Build new record.
|
|
|
|
|
(setq forms--the-record-list (forms--parse-form))
|
|
|
|
|
(setq the-record
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(mapconcat #'identity forms--the-record-list forms-field-sep))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(if (string-match-p (regexp-quote forms-field-sep)
|
|
|
|
|
(mapconcat #'identity forms--the-record-list ""))
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(error "Field separator occurs in record - update refused"))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Handle multi-line fields, if allowed.
|
|
|
|
|
(if forms-multi-line
|
|
|
|
|
(forms--trans the-record "\n" forms-multi-line))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; A final sanity check before updating.
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(if (string-match-p "\n" the-record)
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(error "Multi-line fields in this record - update refused"))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Use delete-region instead of kill-region, to avoid
|
|
|
|
|
;; adding junk to the kill-ring.
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(delete-region (line-beginning-position) (line-end-position))
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(insert the-record)
|
|
|
|
|
(beginning-of-line))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--checkmod ()
|
|
|
|
|
"Check if this form has been modified, and call forms--update if so."
|
|
|
|
|
(if (buffer-modified-p nil)
|
|
|
|
|
(let ((here (point)))
|
|
|
|
|
(forms--update)
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(goto-char here))))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;; Start and exit
|
1993-06-30 22:37:30 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms-find-file (fn)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Visit a file in Forms mode."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(interactive "fForms file: ")
|
1994-06-13 12:07:44 +00:00
|
|
|
|
(let ((enable-local-eval t)
|
|
|
|
|
(enable-local-variables t))
|
|
|
|
|
(find-file-read-only fn)
|
|
|
|
|
(or forms--mode-setup (forms-mode t))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-06-30 22:37:30 +00:00
|
|
|
|
;;;###autoload
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms-find-file-other-window (fn)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Visit a file in Forms mode in other window."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(interactive "fFbrowse file in other window: ")
|
1994-06-13 12:07:44 +00:00
|
|
|
|
(let ((enable-local-eval t)
|
|
|
|
|
(enable-local-variables t))
|
|
|
|
|
(find-file-other-window fn)
|
|
|
|
|
(or forms--mode-setup (forms-mode t))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(defun forms-exit ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Normal exit from Forms mode. Modified buffers are saved."
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(forms--exit t))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(defun forms-exit-no-save ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Exit from Forms mode without saving buffers."
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(forms--exit nil))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;; Navigating commands
|
|
|
|
|
|
|
|
|
|
(defun forms-next-record (arg)
|
|
|
|
|
"Advance to the ARGth following record."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(forms-jump-record (+ forms--current-record (prefix-numeric-value arg)) t))
|
|
|
|
|
|
|
|
|
|
(defun forms-prev-record (arg)
|
|
|
|
|
"Advance to the ARGth previous record."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(forms-jump-record (- forms--current-record (prefix-numeric-value arg)) t))
|
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(defun forms--goto-record (rn &optional current)
|
|
|
|
|
"Goto record number RN.
|
|
|
|
|
If CURRENT is provided, it specifies the current record and can be used
|
|
|
|
|
to speed up access to RN. Returns the number of records missing, if any."
|
|
|
|
|
(if current
|
|
|
|
|
(forward-line (- rn current))
|
|
|
|
|
;; goto-line does not do what we want when the buffer is narrowed.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line (1- rn))))
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(defun forms-jump-record (arg &optional relative)
|
|
|
|
|
"Jump to a random record."
|
|
|
|
|
(interactive "NRecord number: ")
|
|
|
|
|
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Verify that the record number is within range.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (or (> arg forms--total-records)
|
|
|
|
|
(<= arg 0))
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(error
|
1993-07-17 19:15:19 +00:00
|
|
|
|
;; Don't give the message if just paging.
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (not relative)
|
|
|
|
|
(message "Record number %d out of range 1..%d"
|
1997-06-10 18:32:33 +00:00
|
|
|
|
arg forms--total-records)
|
|
|
|
|
"")))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Flush.
|
|
|
|
|
(forms--checkmod)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Calculate displacement.
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(let ((cur forms--current-record))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; `forms--show-record' needs it now.
|
|
|
|
|
(setq forms--current-record arg)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Get the record and show it.
|
|
|
|
|
(forms--show-record
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(beginning-of-line)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; Move, and adjust the amount if needed (shouldn't happen).
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(setq cur (- arg (forms--goto-record arg (if relative cur))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(forms--get-record)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1997-06-10 18:32:33 +00:00
|
|
|
|
;; This shouldn't happen.
|
|
|
|
|
(if (/= forms--current-record cur)
|
|
|
|
|
(progn
|
|
|
|
|
(setq forms--current-record cur)
|
|
|
|
|
(error "Stuck at record %d" cur)))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms-first-record ()
|
|
|
|
|
"Jump to first record."
|
|
|
|
|
(interactive)
|
|
|
|
|
(forms-jump-record 1))
|
|
|
|
|
|
|
|
|
|
(defun forms-last-record ()
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Jump to last record.
|
|
|
|
|
As a side effect: re-calculates the number of records in the data file."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let
|
2003-02-04 11:26:42 +00:00
|
|
|
|
((numrec
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(count-lines (point-min) (point-max)))))
|
|
|
|
|
(if (= numrec forms--total-records)
|
|
|
|
|
nil
|
|
|
|
|
(setq forms--total-records numrec)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(message "Warning: number of records changed to %d" forms--total-records)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms-jump-record forms--total-records))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;;; Other commands
|
1993-06-30 22:37:30 +00:00
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(defun forms-toggle-read-only (arg)
|
|
|
|
|
"Toggles read-only mode of a forms mode buffer.
|
|
|
|
|
With an argument, enables read-only mode if the argument is positive.
|
1996-01-04 23:38:16 +00:00
|
|
|
|
Otherwise enables edit mode if the visited file is writable."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
|
|
|
|
|
(if (if arg
|
|
|
|
|
;; Negative arg means switch it off.
|
|
|
|
|
(<= (prefix-numeric-value arg) 0)
|
|
|
|
|
;; No arg means toggle.
|
|
|
|
|
forms-read-only)
|
|
|
|
|
|
|
|
|
|
;; Enable edit mode, if possible.
|
|
|
|
|
(let ((ro forms-read-only))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(if (with-current-buffer forms--file-buffer
|
1993-09-27 02:19:46 +00:00
|
|
|
|
buffer-read-only)
|
|
|
|
|
(progn
|
|
|
|
|
(setq forms-read-only t)
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(message "No write access to `%s'" forms-file))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(setq forms-read-only nil))
|
|
|
|
|
(if (equal ro forms-read-only)
|
|
|
|
|
nil
|
|
|
|
|
(forms-mode)))
|
|
|
|
|
|
|
|
|
|
;; Enable view mode.
|
|
|
|
|
(if forms-read-only
|
1991-05-20 20:35:19 +00:00
|
|
|
|
nil
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(forms--checkmod) ; sync
|
|
|
|
|
(setq forms-read-only t)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms-mode))))
|
|
|
|
|
|
|
|
|
|
;; Sample:
|
1991-07-01 18:06:13 +00:00
|
|
|
|
;; (defun my-new-record-filter (the-fields)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; ;; numbers are relative to 1
|
|
|
|
|
;; (aset the-fields 4 (current-time-string))
|
|
|
|
|
;; (aset the-fields 6 (user-login-name))
|
|
|
|
|
;; the-list)
|
1991-07-01 18:06:13 +00:00
|
|
|
|
;; (setq forms-new-record-filter 'my-new-record-filter)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(defun forms-insert-record (arg)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Create a new record before the current one.
|
|
|
|
|
With ARG: store the record after the current one.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
If `forms-new-record-filter' contains the name of a function,
|
1996-03-01 21:13:01 +00:00
|
|
|
|
it is called to fill (some of) the fields with default values.
|
Fix minor quoting problems in doc strings
These were glitches regardless of how or whether we tackle the
problem of grave accent in doc strings.
* lisp/calc/calc-aent.el (math-restore-placeholders):
* lisp/ido.el (ido-ignore-buffers, ido-ignore-files):
* lisp/leim/quail/cyrillic.el ("bulgarian-alt-phonetic"):
* lisp/leim/quail/hebrew.el ("hebrew-new")
("hebrew-biblical-sil"):
* lisp/leim/quail/thai.el ("thai-kesmanee"):
* lisp/progmodes/idlw-shell.el (idlwave-shell-file-name-chars):
Used curved quotes to avoid ambiguities like ‘`''’ in doc strings.
* lisp/calendar/calendar.el (calendar-month-abbrev-array):
* lisp/cedet/semantic/mru-bookmark.el (semantic-mrub-cache-flush-fcn):
* lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass):
* lisp/cedet/semantic/tag.el (semantic-tag-copy)
(semantic-tag-components):
* lisp/cedet/srecode/cpp.el (srecode-semantic-handle-:cpp):
* lisp/cedet/srecode/texi.el (srecode-texi-texify-docstring):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-all-constp):
* lisp/emacs-lisp/checkdoc.el (checkdoc-message-text-engine):
* lisp/emacs-lisp/generator.el (iter-next):
* lisp/gnus/gnus-art.el (gnus-treat-strip-list-identifiers)
(gnus-article-mode-syntax-table):
* lisp/net/rlogin.el (rlogin-directory-tracking-mode):
* lisp/net/soap-client.el (soap-wsdl-get):
* lisp/net/telnet.el (telnet-mode):
* lisp/org/org-compat.el (org-number-sequence):
* lisp/org/org.el (org-remove-highlights-with-change)
(org-structure-template-alist):
* lisp/org/ox-html.el (org-html-link-org-files-as-html):
* lisp/play/handwrite.el (handwrite-10pt, handwrite-11pt)
(handwrite-12pt, handwrite-13pt):
* lisp/progmodes/f90.el (f90-mode, f90-abbrev-start):
* lisp/progmodes/idlwave.el (idlwave-mode, idlwave-check-abbrev):
* lisp/progmodes/verilog-mode.el (verilog-tool)
(verilog-string-replace-matches, verilog-preprocess)
(verilog-auto-insert-lisp, verilog-auto-insert-last):
* lisp/textmodes/makeinfo.el (makeinfo-options):
* src/font.c (Ffont_spec):
Fix minor quoting problems in doc strings, e.g., missing quote,
``x'' where `x' was meant, etc.
* lisp/erc/erc-backend.el (erc-process-sentinel-2):
Fix minor quoting problem in other string.
* lisp/leim/quail/ethiopic.el ("ethiopic"):
* lisp/term/tvi970.el (tvi970-set-keypad-mode):
Omit unnecessary quotes.
* lisp/faces.el (set-face-attribute, set-face-underline)
(set-face-inverse-video, x-create-frame-with-faces):
* lisp/gnus/gnus-group.el (gnus-group-nnimap-edit-acl):
* lisp/mail/supercite.el (sc-attribs-%@-addresses)
(sc-attribs-!-addresses, sc-attribs-<>-addresses):
* lisp/net/tramp.el (tramp-methods):
* lisp/recentf.el (recentf-show-file-shortcuts-flag):
* lisp/textmodes/artist.el (artist-ellipse-right-char)
(artist-ellipse-left-char, artist-vaporize-fuzziness)
(artist-spray-chars, artist-mode, artist-replace-string)
(artist-put-pixel, artist-text-see-thru):
* lisp/vc/ediff-util.el (ediff-submit-report):
* lisp/vc/log-edit.el (log-edit-changelog-full-paragraphs):
Use double-quotes rather than TeX markup in doc strings.
* lisp/skeleton.el (skeleton-pair-insert-maybe):
Reword to avoid the need for grave accent and apostrophe.
* lisp/xt-mouse.el (xterm-mouse-tracking-enable-sequence):
Don't use grave and acute accents to quote.
2015-05-19 21:59:15 +00:00
|
|
|
|
If `forms-insert-after' is non-nil, the default behavior is to insert
|
1996-03-01 21:13:01 +00:00
|
|
|
|
after the current record."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(interactive "P")
|
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(if forms-read-only
|
|
|
|
|
(error ""))
|
|
|
|
|
|
1996-03-01 21:13:01 +00:00
|
|
|
|
(let (ln the-list the-record)
|
|
|
|
|
|
|
|
|
|
(if (or (and arg forms-insert-after)
|
|
|
|
|
(and (not arg) (not forms-insert-after)))
|
|
|
|
|
(setq ln forms--current-record)
|
|
|
|
|
(setq ln (1+ forms--current-record)))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(forms--checkmod)
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(if forms-new-record-filter
|
1991-05-20 20:35:19 +00:00
|
|
|
|
;; As a service to the user, we add a zeroth element so she
|
|
|
|
|
;; can use the same indices as in the forms definition.
|
|
|
|
|
(let ((the-fields (make-vector (1+ forms-number-of-fields) "")))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(setq the-fields (funcall forms-new-record-filter the-fields))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq the-list (cdr (append the-fields nil))))
|
|
|
|
|
(setq the-list (make-list forms-number-of-fields "")))
|
|
|
|
|
|
lisp/*.el: Remove lexical-binding warnings; additional small cleanups.
* calculator.el (calculator): Mark unused argument.
(calculator-paste, calculator-quit, calculator-integer-p):
Use ignore-errors.
(calculator-string-to-number, calculator-decimal, calculator-exp)
(calculator-op-or-exp): Use string-match-p.
* dired-aux.el (dired-compress): Use ignore-errors.
(dired-do-chxxx, dired-do-chmod, dired-trample-file-versions)
(dired-do-async-shell-command, dired-do-shell-command)
(dired-shell-stuff-it, dired-compress-file, dired-insert-subdir)
(dired-insert-subdir-validate): Use string-match-p.
(dired-map-dired-file-lines, dired-subdir-hidden-p): Use looking-at-p.
(dired-add-entry): Use string-match-p, looking-at-p.
(dired-insert-subdir-newpos): Remove unused local variable.
* dired.el (dired-buffer-more-recently-used-p): Declare.
(dired-insert-set-properties, dired-insert-old-subdirs):
Use ignore-errors.
* filenotify.el (file-notify-callback): Remove unused local variable.
* filesets.el (filesets-error): Mark unused argument.
(filesets-which-command-p, filesets-filter-dir-names)
(filesets-directory-files, filesets-get-external-viewer)
(filesets-ingroup-get-data): Use string-match-p.
* find-file.el (ff-other-file-name, ff-other-file-name)
(ff-find-the-other-file, ff-cc-hh-converter):
Remove unused local variables.
(ff-get-file-name): Use string-match-p.
(ff-all-dirs-under): Use ignore-errors.
* follow.el (follow-comint-scroll-to-bottom): Mark unused argument.
(follow-select-if-visible): Remove unused local variable.
* forms.el (read-file-filter): Move declaration.
(forms--make-format, forms--make-parser, forms-insert-record):
Quote function with #'.
(forms--update): Use string-match-p. Quote function with #'.
* help-mode.el (help-dir-local-var-def): Mark unused argument.
(help-make-xrefs): Use looking-at-p.
(help-xref-on-pp): Use looking-at-p, ignore-errors.
* ibuffer.el (ibuffer-ext-visible-p): Declare.
(ibuffer-confirm-operation-on): Use string-match-p.
* msb.el (msb-item-handler, msb-dired-item-handler):
Mark unused arguments.
* ses.el (ses-decode-cell-symbol)
(ses-kill-override): Remove unused local variable.
(ses-create-cell-variable, ses-relocate-formula): Use string-match-p.
(ses-load): Use ignore-errors, looking-at-p.
(ses-jump-safe): Use ignore-errors.
(ses-export-tsv, ses-export-tsf, ses-unsafe): Mark unused arguments.
* tabify.el (untabify, tabify): Mark unused arguments.
* thingatpt.el (thing-at-point--bounds-of-well-formed-url):
Mark unused argument.
(bounds-of-thing-at-point, thing-at-point-bounds-of-list-at-point)
(thing-at-point-newsgroup-p, form-at-point): Use ignore-errors.
2013-08-10 15:17:29 +00:00
|
|
|
|
(setq the-record (mapconcat #'identity the-list forms-field-sep))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
|
|
|
|
(forms--goto-record ln)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(open-line 1)
|
|
|
|
|
(insert the-record)
|
|
|
|
|
(beginning-of-line))
|
2003-02-04 11:26:42 +00:00
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq forms--current-record ln))
|
|
|
|
|
|
|
|
|
|
(setq forms--total-records (1+ forms--total-records))
|
|
|
|
|
(forms-jump-record forms--current-record))
|
|
|
|
|
|
|
|
|
|
(defun forms-delete-record (arg)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Deletes a record. With a prefix argument: don't ask."
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(interactive "P")
|
1993-09-27 02:19:46 +00:00
|
|
|
|
|
|
|
|
|
(if forms-read-only
|
|
|
|
|
(error ""))
|
|
|
|
|
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(forms--checkmod)
|
|
|
|
|
(if (or arg
|
|
|
|
|
(y-or-n-p "Really delete this record? "))
|
|
|
|
|
(let ((ln forms--current-record))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
|
|
|
|
(forms--goto-record ln)
|
1993-09-15 05:25:16 +00:00
|
|
|
|
;; Use delete-region instead of kill-region, to avoid
|
|
|
|
|
;; adding junk to the kill-ring.
|
1994-07-17 23:56:09 +00:00
|
|
|
|
(delete-region (progn (beginning-of-line) (point))
|
|
|
|
|
(progn (beginning-of-line 2) (point))))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq forms--total-records (1- forms--total-records))
|
|
|
|
|
(if (> forms--current-record forms--total-records)
|
|
|
|
|
(setq forms--current-record forms--total-records))
|
|
|
|
|
(forms-jump-record forms--current-record)))
|
|
|
|
|
(message ""))
|
|
|
|
|
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(defun forms-search-forward (regexp)
|
|
|
|
|
"Search forward for record containing REGEXP."
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list (read-string (concat "Search forward for"
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if forms--search-regexp
|
|
|
|
|
(concat " ("
|
|
|
|
|
forms--search-regexp
|
|
|
|
|
")"))
|
|
|
|
|
": "))))
|
|
|
|
|
(if (equal "" regexp)
|
|
|
|
|
(setq regexp forms--search-regexp))
|
|
|
|
|
(forms--checkmod)
|
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(let (the-line the-record here)
|
|
|
|
|
(with-current-buffer forms--file-buffer
|
1997-06-11 21:07:22 +00:00
|
|
|
|
(end-of-line)
|
|
|
|
|
(setq here (point))
|
|
|
|
|
(if (or (re-search-forward regexp nil t)
|
|
|
|
|
(and (> here (point-min))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(re-search-forward regexp here t))))
|
|
|
|
|
(progn
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq the-record (forms--get-record))
|
1997-06-11 21:07:22 +00:00
|
|
|
|
(setq the-line (1+ (count-lines (point-min) (point))))
|
|
|
|
|
(if (< (point) here)
|
|
|
|
|
(message "Wrapped")))
|
|
|
|
|
(goto-char here)
|
|
|
|
|
(error "Search failed: %s" regexp)))
|
|
|
|
|
(setq forms--current-record the-line)
|
|
|
|
|
(forms--show-record the-record))
|
|
|
|
|
(re-search-forward regexp nil t)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(setq forms--search-regexp regexp))
|
|
|
|
|
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(defun forms-search-backward (regexp)
|
|
|
|
|
"Search backward for record containing REGEXP."
|
2003-02-04 11:26:42 +00:00
|
|
|
|
(interactive
|
|
|
|
|
(list (read-string (concat "Search backward for"
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(if forms--search-regexp
|
|
|
|
|
(concat " ("
|
|
|
|
|
forms--search-regexp
|
|
|
|
|
")"))
|
|
|
|
|
": "))))
|
|
|
|
|
(if (equal "" regexp)
|
|
|
|
|
(setq regexp forms--search-regexp))
|
|
|
|
|
(forms--checkmod)
|
|
|
|
|
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(let (the-line the-record here)
|
|
|
|
|
(with-current-buffer forms--file-buffer
|
1997-06-11 21:07:22 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(setq here (point))
|
|
|
|
|
(if (or (re-search-backward regexp nil t)
|
|
|
|
|
(and (< (point) (point-max))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(re-search-backward regexp here t))))
|
|
|
|
|
(progn
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(setq the-record (forms--get-record))
|
1997-06-11 21:07:22 +00:00
|
|
|
|
(setq the-line (1+ (count-lines (point-min) (point))))
|
|
|
|
|
(if (> (point) here)
|
|
|
|
|
(message "Wrapped")))
|
|
|
|
|
(goto-char here)
|
|
|
|
|
(error "Search failed: %s" regexp)))
|
|
|
|
|
(setq forms--current-record the-line)
|
|
|
|
|
(forms--show-record the-record))
|
|
|
|
|
(re-search-forward regexp nil t)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(setq forms--search-regexp regexp))
|
|
|
|
|
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(defun forms-save-buffer (&optional args)
|
|
|
|
|
"Forms mode replacement for save-buffer.
|
|
|
|
|
It saves the data buffer instead of the forms buffer.
|
1997-06-10 18:32:33 +00:00
|
|
|
|
Calls `forms-write-file-filter' before, and `forms-read-file-filter'
|
|
|
|
|
after writing out the data."
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(interactive "p")
|
1994-06-13 12:07:44 +00:00
|
|
|
|
(forms--checkmod)
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(let ((write-file-filter forms-write-file-filter)
|
1999-05-31 08:34:19 +00:00
|
|
|
|
(read-file-filter forms-read-file-filter)
|
|
|
|
|
(cur forms--current-record))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer forms--file-buffer
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(let ((inhibit-read-only t))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
;; Write file hooks are run via write-file-functions.
|
2003-02-04 11:26:42 +00:00
|
|
|
|
;; (if write-file-filter
|
|
|
|
|
;; (save-excursion
|
2020-12-26 17:21:17 +00:00
|
|
|
|
;; (forms--run-functions write-file-filter)))
|
1999-05-31 08:34:19 +00:00
|
|
|
|
|
|
|
|
|
;; If they have a write-file-filter, force the buffer to be
|
|
|
|
|
;; saved even if it doesn't seem to be changed. First, they
|
|
|
|
|
;; might have changed the write-file-filter; and second, if
|
|
|
|
|
;; save-buffer does nothing, write-file-filter won't get run,
|
|
|
|
|
;; and then read-file-filter will be mightily confused.
|
|
|
|
|
(or (null write-file-filter)
|
|
|
|
|
(set-buffer-modified-p t))
|
1994-07-26 19:47:39 +00:00
|
|
|
|
(save-buffer args)
|
|
|
|
|
(if read-file-filter
|
1997-06-10 18:32:33 +00:00
|
|
|
|
(save-excursion
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(forms--run-functions read-file-filter)))
|
1999-05-31 08:34:19 +00:00
|
|
|
|
(set-buffer-modified-p nil)))
|
|
|
|
|
;; Make sure we end up with the same record number as we started.
|
|
|
|
|
;; Since read-file-filter may perform arbitrary transformations on
|
|
|
|
|
;; the data buffer contents, save-excursion is not enough.
|
|
|
|
|
(forms-jump-record cur))
|
1994-06-13 12:07:44 +00:00
|
|
|
|
t)
|
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
|
(defun forms--revert-buffer (&optional _arg noconfirm)
|
1991-05-20 20:35:19 +00:00
|
|
|
|
"Reverts current form to un-modified."
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (or noconfirm
|
|
|
|
|
(yes-or-no-p "Revert form to unmodified? "))
|
|
|
|
|
(progn
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(forms-jump-record forms--current-record))))
|
|
|
|
|
|
|
|
|
|
(defun forms-next-field (arg)
|
|
|
|
|
"Jump to ARG-th next field."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
|
|
|
|
|
(let ((i 0)
|
|
|
|
|
(here (point))
|
|
|
|
|
there
|
1995-04-25 17:44:28 +00:00
|
|
|
|
(cnt 0)
|
|
|
|
|
(inhibit-point-motion-hooks t))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
|
|
|
|
|
(if (zerop arg)
|
|
|
|
|
(setq cnt 1)
|
|
|
|
|
(setq cnt (+ cnt arg)))
|
|
|
|
|
|
|
|
|
|
(if (catch 'done
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(while (< i (length forms--markers))
|
1991-05-20 20:35:19 +00:00
|
|
|
|
(if (or (null (setq there (aref forms--markers i)))
|
|
|
|
|
(<= there here))
|
|
|
|
|
nil
|
|
|
|
|
(if (<= (setq cnt (1- cnt)) 0)
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char there)
|
|
|
|
|
(throw 'done t))))
|
|
|
|
|
(setq i (1+ i))))
|
|
|
|
|
nil
|
|
|
|
|
(goto-char (aref forms--markers 0)))))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
1993-09-27 02:19:46 +00:00
|
|
|
|
(defun forms-prev-field (arg)
|
|
|
|
|
"Jump to ARG-th previous field."
|
|
|
|
|
(interactive "p")
|
|
|
|
|
|
|
|
|
|
(let ((i (length forms--markers))
|
|
|
|
|
(here (point))
|
|
|
|
|
there
|
1995-04-25 17:44:28 +00:00
|
|
|
|
(cnt 0)
|
|
|
|
|
(inhibit-point-motion-hooks t))
|
1993-09-27 02:19:46 +00:00
|
|
|
|
|
|
|
|
|
(if (zerop arg)
|
|
|
|
|
(setq cnt 1)
|
|
|
|
|
(setq cnt (+ cnt arg)))
|
|
|
|
|
|
|
|
|
|
(if (catch 'done
|
|
|
|
|
(while (> i 0)
|
|
|
|
|
(setq i ( 1- i))
|
|
|
|
|
(if (or (null (setq there (aref forms--markers i)))
|
|
|
|
|
(>= there here))
|
|
|
|
|
nil
|
|
|
|
|
(if (<= (setq cnt (1- cnt)) 0)
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char there)
|
|
|
|
|
(throw 'done t))))))
|
|
|
|
|
nil
|
|
|
|
|
(goto-char (aref forms--markers (1- (length forms--markers)))))))
|
1995-01-05 11:54:18 +00:00
|
|
|
|
|
|
|
|
|
(defun forms-print ()
|
2005-06-14 11:30:22 +00:00
|
|
|
|
"Send the records to the printer with `print-buffer', one record per page."
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((inhibit-read-only t)
|
|
|
|
|
(save-record forms--current-record)
|
1999-01-15 16:19:53 +00:00
|
|
|
|
(total-nb-records forms--total-records)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(nb-record 1)
|
|
|
|
|
(record nil))
|
|
|
|
|
(while (<= nb-record forms--total-records)
|
|
|
|
|
(forms-jump-record nb-record)
|
|
|
|
|
(setq record (buffer-string))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create "*forms-print*")
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(goto-char (buffer-end 1))
|
|
|
|
|
(insert record)
|
|
|
|
|
(setq buffer-read-only nil)
|
1999-01-15 16:19:53 +00:00
|
|
|
|
(if (< nb-record total-nb-records)
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(insert "\n\n")))
|
|
|
|
|
(setq nb-record (1+ nb-record)))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer "*forms-print*"
|
1995-01-05 11:54:18 +00:00
|
|
|
|
(print-buffer)
|
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
|
(forms-jump-record save-record)))
|
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
;;;
|
|
|
|
|
;;; Special service
|
|
|
|
|
;;;
|
|
|
|
|
(defun forms-enumerate (the-fields)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"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.
|
1996-01-04 23:38:16 +00:00
|
|
|
|
It returns the highest number.
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
|
|
|
|
Usage: (setq forms-number-of-fields
|
|
|
|
|
(forms-enumerate
|
|
|
|
|
'(field1 field2 field2 ...)))"
|
|
|
|
|
|
|
|
|
|
(let ((the-index 0))
|
|
|
|
|
(while the-fields
|
|
|
|
|
(setq the-index (1+ the-index))
|
|
|
|
|
(let ((el (car-safe the-fields)))
|
|
|
|
|
(setq the-fields (cdr-safe the-fields))
|
|
|
|
|
(set el the-index)))
|
|
|
|
|
the-index))
|
1993-06-12 20:53:59 +00:00
|
|
|
|
|
1991-07-01 18:06:13 +00:00
|
|
|
|
;;; Debugging
|
1993-06-30 22:37:30 +00:00
|
|
|
|
|
2012-05-04 05:14:14 +00:00
|
|
|
|
(defcustom forms--debug nil
|
|
|
|
|
"If non-nil, enable Forms mode debugging."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'forms)
|
1991-07-01 18:06:13 +00:00
|
|
|
|
|
|
|
|
|
(defun forms--debug (&rest args)
|
1993-06-30 22:37:30 +00:00
|
|
|
|
"Internal debugging routine."
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(if forms--debug
|
2020-12-26 17:21:17 +00:00
|
|
|
|
(let ((ret
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (el)
|
|
|
|
|
(if (stringp el) el
|
|
|
|
|
(concat (prin1-to-string el) " = "
|
|
|
|
|
(if (boundp el)
|
|
|
|
|
(prin1-to-string (eval el))
|
|
|
|
|
"<unbound>")
|
|
|
|
|
"\n"
|
|
|
|
|
(if (fboundp el)
|
|
|
|
|
(concat (prin1-to-string (symbol-function el))
|
|
|
|
|
"\n")))))
|
|
|
|
|
args "")))
|
2003-05-29 23:53:21 +00:00
|
|
|
|
(with-current-buffer (get-buffer-create "*forms-mode debug*")
|
1993-07-17 19:15:19 +00:00
|
|
|
|
(if (zerop (buffer-size))
|
|
|
|
|
(emacs-lisp-mode))
|
1991-07-01 18:06:13 +00:00
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert ret)))))
|
|
|
|
|
|
Deprecate `intangible' and `point-entered' properties
* lisp/emacs-lisp/cursor-sensor.el: New file.
* lisp/simple.el (pre-redisplay-functions): New hook.
(redisplay--pre-redisplay-functions): New function.
(pre-redisplay-function): Use it.
(minibuffer-avoid-prompt): Mark obsolete.
(redisplay--update-region-highlight): Adapt it to work as a function on
pre-redisplay-functions.
* lisp/cus-start.el (minibuffer-prompt-properties--setter): New fun.
(minibuffer-prompt-properties): Use it. Use cursor-intangible rather
than point-entered to make the prompt intangible.
* lisp/forms.el: Move `provide' calls to the end.
(forms-mode): Don't use `run-hooks' on a local var.
(forms--make-format, forms--make-format-elt-using-text-properties):
Use cursor-intangible rather than `intangible'.
(forms-mode): Enable cursor-intangible-mode.
* lisp/isearch.el (isearch-mode): Use defvar-local.
(cursor-sensor-inhibit): Declare.
(isearch-mode): Set cursor-sensor-inhibit.
(isearch-done): Set it back.
(isearch-open-overlay-temporary, isearch-open-necessary-overlays)
(isearch-close-unnecessary-overlays): Don't bother with `intangible'
any more.
* lisp/ses.el (ses-localvars): Remove `mode-line-process'.
(ses-sym-rowcol, ses-cell-value, ses-col-width, ses-col-printer):
Add Edebug spec.
(ses-goto-print, ses-print-cell, ses-adjust-print-width)
(ses-goto-data, ses-setup, ses-copy-region): Don't let-bind
inhibit-point-motion-hooks any more.
(ses--cell-at-pos, ses--curcell): New functions, extracted from
ses-set-curcell.
(ses-set-curcell): Use them.
(ses-print-cell, ses-setup): Use cursor-intangible instead of
`intangible'. Make sure cursor-intangible isn't sticky at BOB.
(ses-print-cell-new-width, ses-reprint-all, ses-recalculate-all):
Use ses--cell-at-pos.
(ses--mode-line-process, ses--cursor-sensor-highlight): New functions,
extracted from ses-command-hook. Make them work with multiple windows
displaying the same buffer.
(ses-mode): Use them via mode-line-process and pre-redisplay-functions.
Enable cursor-intangible-mode.
(ses-command-hook): Remove cell highlight and mode-line update code.
(ses-forward-or-insert, ses-copy-region-helper, ses-sort-column):
Update for new name of text-property holding the cell name.
(ses-rename-cell): Don't mess with mode-line-process.
* lisp/erc/erc-stamp.el (erc-add-timestamp): Use the new
cursor-sensor-functions property instead of point-entered.
(erc-insert-timestamp-right, erc-format-timestamp):
Use cursor-intangible rather than `intangible'.
(erc-munge-invisibility-spec): Use add-to-invisibility-spec and
remove-from-invisibility-spec. Enable cursor-intangible-mode and
cursor-sensor-mode if needed.
(erc-echo-timestamp): Adapt to calling convention of
cursor-sensor-functions.
(erc-insert-timestamp-right): Remove unused vars `current-window' and
`indent'.
* lisp/gnus/gnus-group.el (gnus-tmp-*): Declare.
(gnus-update-group-mark-positions): Remove unused `topic' var.
(gnus-group-insert-group-line): Remove unused var `header'.
(gnus-group--setup-tool-bar-update): New function.
(gnus-group-insert-group-line): Use it.
(gnus-group-update-eval-form): Declare local
dynamically-bound variables.
(gnus-group-unsubscribe-group): Use \` and \' to match string bounds.
* lisp/gnus/gnus-topic.el (gnus-topic-jump-to-topic)
(gnus-group-prepare-topics, gnus-topic-update-topic)
(gnus-topic-change-level, gnus-topic-catchup-articles)
(gnus-topic-remove-group, gnus-topic-delete, gnus-topic-indent):
Use inhibit-read-only.
(gnus-topic-prepare-topic): Use gnus-group--setup-tool-bar-update.
(gnus-topic-mode): Use define-minor-mode and derived-mode-p.
* lisp/textmodes/reftex-index.el (reftex-display-index):
Use cursor-intangible-mode if available.
(reftex-index-post-command-hook): Check cursor-intangible.
* lisp/textmodes/reftex-toc.el (reftex-toc):
Use cursor-intangible-mode if available.
(reftex-toc-recenter, reftex-toc-post-command-hook):
Check cursor-intangible.
* lisp/textmodes/sgml-mode.el: Use lexical-binding.
(sgml-tag): Use cursor-sensor-functions instead of point-entered.
(sgml-tags-invisible): Use with-silent-modifications and
inhibit-read-only. Enable cursor-sensor-mode.
(sgml-cursor-sensor): Rename from sgml-point-entered and adjust to
calling convention of cursor-sensor-functions.
* lisp/textmodes/table.el (table-cell-map-hook, table-load-hook)
(table-point-entered-cell-hook, table-point-left-cell-hook):
Don't autoload.
(table-cell-entered-state): Remove var.
(table--put-cell-point-entered/left-property)
(table--remove-cell-properties):
Use cursor-sensor-functions rather than point-entered/left.
(table--point-entered/left-cell-function): Merge
table--point-entered-cell-function and table--point-left-cell-function
and adjust to calling convention of cursor-sensor-functions.
2015-04-13 19:51:15 +00:00
|
|
|
|
(provide 'forms-mode) ; for compatibility
|
|
|
|
|
(provide 'forms)
|
2001-07-16 12:23:00 +00:00
|
|
|
|
;;; forms.el ends here
|