comparison lisp/forms.el @ 13569:438ebe3b6f8d

Use `buffer-substring-no-properties' instead of `buffer-substring' to avoid the properties being copied.
author Johan Vromans <jvromans@squirrel.nl>
date Thu, 16 Nov 1995 20:04:57 +0000
parents 84acc3adcd63
children c045b6e55d08
comparison
equal deleted inserted replaced
13568:01ec2620dd87 13569:438ebe3b6f8d
286 ;;; Global variables and constants: 286 ;;; Global variables and constants:
287 287
288 (provide 'forms) ;;; official 288 (provide 'forms) ;;; official
289 (provide 'forms-mode) ;;; for compatibility 289 (provide 'forms-mode) ;;; for compatibility
290 290
291 (defconst forms-version (substring "$Revision: 2.21 $" 11 -2) 291 (defconst forms-version (substring "$Revision: 2.22 $" 11 -2)
292 "The version number of forms-mode (as string). The complete RCS id is: 292 "The version number of forms-mode (as string). The complete RCS id is:
293 293
294 $Id: forms.el,v 2.21 1995/10/28 16:21:33 rms Exp rms $") 294 $Id: forms.el,v 2.22 1995/10/30 17:07:02 rms Exp jvromans $")
295 295
296 (defvar forms-mode-hooks nil 296 (defvar forms-mode-hooks nil
297 "Hook functions to be run upon entering Forms mode.") 297 "Hook functions to be run upon entering Forms mode.")
298 298
299 ;;; Mandatory variables - must be set by evaluating the control file. 299 ;;; Mandatory variables - must be set by evaluating the control file.
308 "Number of fields per record.") 308 "Number of fields per record.")
309 309
310 ;;; Optional variables with default values. 310 ;;; Optional variables with default values.
311 311
312 (defvar forms-check-number-of-fields t 312 (defvar forms-check-number-of-fields t
313 "If non-nil, warn about records with wrong number of fields.") 313 "*If non-nil, warn about records with wrong number of fields.")
314 314
315 (defvar forms-field-sep "\t" 315 (defvar forms-field-sep "\t"
316 "Field separator character (default TAB).") 316 "Field separator character (default TAB).")
317 317
318 (defvar forms-read-only nil 318 (defvar forms-read-only nil
1091 (if (get-text-property here 'read-only) 1091 (if (get-text-property here 'read-only)
1092 (aset forms--recordv (aref forms--elements i) nil) 1092 (aset forms--recordv (aref forms--elements i) nil)
1093 (if (setq there 1093 (if (setq there
1094 (next-single-property-change here 'read-only)) 1094 (next-single-property-change here 'read-only))
1095 (aset forms--recordv (aref forms--elements i) 1095 (aset forms--recordv (aref forms--elements i)
1096 (buffer-substring here there)) 1096 (buffer-substring-no-properties here there))
1097 (aset forms--recordv (aref forms--elements i) 1097 (aset forms--recordv (aref forms--elements i)
1098 (buffer-substring here (point-max))))) 1098 (buffer-substring-no-properties here (point-max)))))
1099 (setq i (1+ i))))) 1099 (setq i (1+ i)))))
1100 1100
1101 (defun forms--make-parser-elt (el) 1101 (defun forms--make-parser-elt (el)
1102 "Helper routine to generate forms parser function." 1102 "Helper routine to generate forms parser function."
1103 1103
1115 ;; ;; 6 1115 ;; ;; 6
1116 ;; ;; "\nmore text: " 1116 ;; ;; "\nmore text: "
1117 ;; (setq here (point)) 1117 ;; (setq here (point))
1118 ;; (if (not (search-forward "\nmore text: " nil t nil)) 1118 ;; (if (not (search-forward "\nmore text: " nil t nil))
1119 ;; (error "Parse error: cannot find \"\\nmore text: \"")) 1119 ;; (error "Parse error: cannot find \"\\nmore text: \""))
1120 ;; (aset forms--recordv 5 (buffer-substring here (- (point) 12))) 1120 ;; (aset forms--recordv 5 (buffer-substring-no-properties here (- (point) 12)))
1121 ;; 1121 ;;
1122 ;; ;; (tocol 40) 1122 ;; ;; (tocol 40)
1123 ;; (let ((forms--dyntext (car-safe forms--dynamic-text))) 1123 ;; (let ((forms--dyntext (car-safe forms--dynamic-text)))
1124 ;; (if (not (looking-at (regexp-quote forms--dyntext))) 1124 ;; (if (not (looking-at (regexp-quote forms--dyntext)))
1125 ;; (error "Parse error: not looking at \"%s\"" forms--dyntext)) 1125 ;; (error "Parse error: not looking at \"%s\"" forms--dyntext))
1126 ;; (forward-char (length forms--dyntext)) 1126 ;; (forward-char (length forms--dyntext))
1127 ;; (setq forms--dynamic-text (cdr-safe forms--dynamic-text))) 1127 ;; (setq forms--dynamic-text (cdr-safe forms--dynamic-text)))
1128 ;; ... 1128 ;; ...
1129 ;; ;; final flush (due to terminator sentinel, see below) 1129 ;; ;; final flush (due to terminator sentinel, see below)
1130 ;; (aset forms--recordv 7 (buffer-substring (point) (point-max))) 1130 ;; (aset forms--recordv 7 (buffer-substring-no-properties (point) (point-max)))
1131 1131
1132 (cond 1132 (cond
1133 ((stringp el) 1133 ((stringp el)
1134 (prog1 1134 (prog1
1135 (if forms--field 1135 (if forms--field
1136 (` ((setq here (point)) 1136 (` ((setq here (point))
1137 (if (not (search-forward (, el) nil t nil)) 1137 (if (not (search-forward (, el) nil t nil))
1138 (error "Parse error: cannot find \"%s\"" (, el))) 1138 (error "Parse error: cannot find \"%s\"" (, el)))
1139 (aset forms--recordv (, (1- forms--field)) 1139 (aset forms--recordv (, (1- forms--field))
1140 (buffer-substring here 1140 (buffer-substring-no-properties here
1141 (- (point) (, (length el))))))) 1141 (- (point) (, (length el)))))))
1142 (` ((if (not (looking-at (, (regexp-quote el)))) 1142 (` ((if (not (looking-at (, (regexp-quote el))))
1143 (error "Parse error: not looking at \"%s\"" (, el))) 1143 (error "Parse error: not looking at \"%s\"" (, el)))
1144 (forward-char (, (length el)))))) 1144 (forward-char (, (length el))))))
1145 (setq forms--seen-text t) 1145 (setq forms--seen-text t)
1151 (setq forms--field el) 1151 (setq forms--field el)
1152 nil)) 1152 nil))
1153 ((null el) 1153 ((null el)
1154 (if forms--field 1154 (if forms--field
1155 (` ((aset forms--recordv (, (1- forms--field)) 1155 (` ((aset forms--recordv (, (1- forms--field))
1156 (buffer-substring (point) (point-max))))))) 1156 (buffer-substring-no-properties (point) (point-max)))))))
1157 ((listp el) 1157 ((listp el)
1158 (prog1 1158 (prog1
1159 (if forms--field 1159 (if forms--field
1160 (` ((let ((here (point)) 1160 (` ((let ((here (point))
1161 (forms--dyntext (aref forms--dyntexts (, forms--dyntext)))) 1161 (forms--dyntext (aref forms--dyntexts (, forms--dyntext))))
1162 (if (not (search-forward forms--dyntext nil t nil)) 1162 (if (not (search-forward forms--dyntext nil t nil))
1163 (error "Parse error: cannot find \"%s\"" forms--dyntext)) 1163 (error "Parse error: cannot find \"%s\"" forms--dyntext))
1164 (aset forms--recordv (, (1- forms--field)) 1164 (aset forms--recordv (, (1- forms--field))
1165 (buffer-substring here 1165 (buffer-substring-no-properties here
1166 (- (point) (length forms--dyntext))))))) 1166 (- (point) (length forms--dyntext)))))))
1167 (` ((let ((forms--dyntext (aref forms--dyntexts (, forms--dyntext)))) 1167 (` ((let ((forms--dyntext (aref forms--dyntexts (, forms--dyntext))))
1168 (if (not (looking-at (regexp-quote forms--dyntext))) 1168 (if (not (looking-at (regexp-quote forms--dyntext)))
1169 (error "Parse error: not looking at \"%s\"" forms--dyntext)) 1169 (error "Parse error: not looking at \"%s\"" forms--dyntext))
1170 (forward-char (length forms--dyntext)))))) 1170 (forward-char (length forms--dyntext))))))
1460 (or (bolp) 1460 (or (bolp)
1461 (beginning-of-line nil)) 1461 (beginning-of-line nil))
1462 (let ((here (point))) 1462 (let ((here (point)))
1463 (prog2 1463 (prog2
1464 (end-of-line) 1464 (end-of-line)
1465 (buffer-substring here (point)) 1465 (buffer-substring-no-properties here (point))
1466 (goto-char here)))) 1466 (goto-char here))))
1467 1467
1468 (defun forms--show-record (the-record) 1468 (defun forms--show-record (the-record)
1469 "Format THE-RECORD and display it in the current buffer." 1469 "Format THE-RECORD and display it in the current buffer."
1470 1470