weiner@novavax.UUCP (Bob Weiner) (03/22/90)
The diff file below represents changes since the last posting of "eiffel.el" to this newsgroup. It appropriately fixes the problems mentioned by hws@icsi.Berkeley.EDU (Heinz Schmidt) in his "eif-ext.el" package. It does not include the X interface code (since that does not belong here) or the Eiffel compilation code (since that is tool-specific rather than just language-specific). All changes are documented in the diff which follows. 13c13 < ;; LAST-MOD: 6-Feb-90 at 18:43:30 by Bob Weiner --- > ;; LAST-MOD: 22-Mar-90 at 02:38:11 by Bob Weiner 54c54 < ;; current line. --- > ;; current line, bound to {C-c t}. 57c57 < ;; LAST PUBLIC RELEASE = 12/10/89 --- > ;; BW PUBLIC RELEASE 1 = 12/10/89 107a108,135 > ;; BW PUBLIC RELEASE 2 = 02/07/90 > ;; > ;; Bob Weiner, 02/07/90 > ;; Moved 'eiffel-delim-string' and 'eiffel-indent-assign' from > ;; 'eif-multi-fmt.el' into this library so that the other library is > ;; loaded only when multi-line string and parenthesized list indentation > ;; is enabled. > ;; Corrected syntax entries for '{', '}', ',', '.', ';', ':', '?', '!', '@'. > ;; Bob Weiner, 02/09/90 > ;; Modified 'eiffel-return' to remove trailing whitespace. > ;; Bob Weiner, 03/21/90 > ;; Fixed a number of things based on input from hws@icsi.Berkeley.EDU (Heinz > ;; Schmidt) and his 'eif-ext.el' package. > ;; Fixed tiresome little movement bug in 'eiffel-indent-line'. > ;; Fixed 'e-get-block-indent' problem indenting lines after multi-line > ;; formal parameter lists. > ;; 'eiffel-beginning-of-feature' was changed to leave point at the start of > ;; the line on which the feature definition begins. Both > ;; 'eiffel-{beginning,end}-of-feature' were modified to handle beginning > ;; and end of buffer as stated in their doc strings. > ;; Fixed indentation problem in 'e-calc-indent' when 'end' appears on same > ;; line as a block qualifier keyword. Added > ;; 'eiffel-block-qualifier-regexp' constant to handle this. > ;; Made 'eiffel-moto-hdr-p' appear in user option list. > ;; Slightly modified 'eiffel-mode' doc string. > ;; Added 'eiffel-comment-region' bound to {C-c -} which comments a region. > ;; {C-u C-c -} uncomments the region. > ;; 131,134d158 < ;; Used to format multiple lines between parens and double quotes. < (require 'eif-mult-fmt) < < 140c164 < "If t, use our Motorola developed Eiffel construct template headers.") --- > "*If t, use our Motorola developed Eiffel construct template headers.") 153a178,179 > ;; Used to format multiple lines between parens and double quotes. > (if eiffel-indent-args-str (require 'eif-mult-fmt)) 158a185,189 > (defconst eiffel-block-qualifier-regexp > "[ \t]*\\(check\\|debug\\|do\\|else\\|elsif\\|from\\|if\\|inspect\\|loop\\|once\\|then\\|\\|until\\|when\\)[ \t]+" > "Regexp to match block qualifier keyword patterns.") > > 164,176c195,208 < (define-key eiffel-mode-map "\C-cc" 'eiffel-class) < (define-key eiffel-mode-map "\C-cf" 'eiffel-function) < (define-key eiffel-mode-map "\C-cp" 'eiffel-procedure) < (define-key eiffel-mode-map "\C-ca" 'eiffel-attribute) < (define-key eiffel-mode-map "\C-ci" 'eiffel-if) < (define-key eiffel-mode-map "\C-cl" 'eiffel-loop) < (define-key eiffel-mode-map "\C-cs" 'eiffel-set) < (define-key eiffel-mode-map "\C-cn" 'eiffel-inspect) < (define-key eiffel-mode-map "\C-cw" 'eiffel-when) < (define-key eiffel-mode-map "\C-ce" 'eiffel-elsif) < (define-key eiffel-mode-map "\t" 'eiffel-indent-line) < (define-key eiffel-mode-map "\C-ct" 'eiffel-line-type) < (define-key eiffel-mode-map "\C-c\\" 'eiffel-delim-string) --- > (define-key eiffel-mode-map "\C-cc" 'eiffel-class) > (define-key eiffel-mode-map "\C-cf" 'eiffel-function) > (define-key eiffel-mode-map "\C-cp" 'eiffel-procedure) > (define-key eiffel-mode-map "\C-ca" 'eiffel-attribute) > (define-key eiffel-mode-map "\C-ci" 'eiffel-if) > (define-key eiffel-mode-map "\C-cl" 'eiffel-loop) > (define-key eiffel-mode-map "\C-cs" 'eiffel-set) > (define-key eiffel-mode-map "\C-cn" 'eiffel-inspect) > (define-key eiffel-mode-map "\C-cw" 'eiffel-when) > (define-key eiffel-mode-map "\C-ce" 'eiffel-elsif) > (define-key eiffel-mode-map "\C-c-" 'eiffel-comment-region) > (define-key eiffel-mode-map "\t" 'eiffel-indent-line) > (define-key eiffel-mode-map "\C-ct" 'eiffel-line-type) > (define-key eiffel-mode-map "\C-c\\" 'eiffel-delim-string) 180,182c212,214 < (define-key eiffel-mode-map "\r" 'eiffel-return) < (define-key eiffel-mode-map "\177" 'backward-delete-char-untabify) < (define-key eiffel-mode-map "\M-;" 'eiffel-comment) --- > (define-key eiffel-mode-map "\r" 'eiffel-return) > (define-key eiffel-mode-map "\177" 'backward-delete-char-untabify) > (define-key eiffel-mode-map "\M-;" 'eiffel-comment) 219a252,253 > (modify-syntax-entry ?\{ "(} " table) > (modify-syntax-entry ?\} "){ " table) 230a265,271 > (modify-syntax-entry ?; "." table) > (modify-syntax-entry ?: "." table) > (modify-syntax-entry ?, "." table) > (modify-syntax-entry ?. "." table) > (modify-syntax-entry ?@ "." table) > (modify-syntax-entry ?? "." table) > (modify-syntax-entry ?! "." table) 271,276c312,316 < Abbreviations: < itg for INTEGER boo for BOOLEAN < cha for CHARACTER stg for STRING < rea for REAL dou for DOUBLE < res for Result cre for Create < cur for Current fgt for Forget --- > Important operations: > C-M-a Move to current or previous feature beginning. > C-M-e Move to current or previous feature end. > C-M-h Mark current feature. > C-c - Comment a region; C-u C-c - to uncomment. 280a321,322 > eiffel-moto-hdr-p If non-nil, insert Motorola feature comment headers > in feature templates. 282,285c324,329 < Feature operations: < C-M-a Move to current or previous feature beginning. < C-M-e Move to current or previous feature end. < C-M-h Mark current feature. --- > Abbreviations: > itg for INTEGER boo for BOOLEAN > cha for CHARACTER stg for STRING > rea for REAL dou for DOUBLE > res for Result cre for Create > cur for Current fgt for Forget 488c532,534 < (re-search-backward "from" nil t)(forward-line)(eiffel-indent-line)) --- > (re-search-backward "from" nil t) > (forward-line) > (eiffel-indent-line)) 518c564 < "Indent line, insert newline and new current line line." --- > "Indent line, delete trailing whitespace, insert newline and indent new current line." 520a567 > (delete-horizontal-space) 531c578,579 < (skip-chars-forward " \t")) --- > (and (looking-at "^[ \t]+") > (goto-char (match-end 0)))) 560c608,611 < ((e-ends-with-end-p) --- > ((and (e-ends-with-end-p) > (save-excursion > (beginning-of-line) > (not (looking-at eiffel-block-qualifier-regexp)))) 631c682 < (looking-at "^\\(.*[ \t]+\\)?end;?[ \t]*\\($\\|--\\)"))) --- > (looking-at "\\(.*[ \t]+\\)?end;?[ \t]*\\($\\|--\\)"))) 753,759c804,811 < (cond ((or (e-ends-with-is) ;routine definition comment < (save-excursion ;attribute definition comment < (and (= (e-get-block-indent) 0) < (progn (end-of-line) (= (preceding-char) ?\;)) < (= (forward-line -1) 0) < (or (e-empty-line-p) < (looking-at "feature[ \t]*$"))))) --- > (cond ((e-ends-with-is) ;routine definition comment > (+ eiffel-indent in)) > ((save-excursion ;attribute definition comment > (and (= (e-get-block-indent) 0) > (progn (end-of-line) (= (preceding-char) ?\;)) > (= (forward-line -1) 0) > (or (e-empty-line-p) > (looking-at "feature[ \t]*$")))) 815a868,869 > (if (re-search-backward "^[ \t]*[\n][ \t]+[a-zA-Z0-9]" nil t) > (goto-char (match-end 0))) 853c907 < "Put mark at end of feature, point at beginning." --- > "Put mark at end of feature, point at start of line prior to beginning." 859c913 < (re-search-backward "^\n" (- (point) 1) t)) --- > (forward-line -1)) 867c921 < (if (re-search-backward "^[ \t]*[\n][ \t]+[a-zA-Z0-9]\\|\\`" --- > (if (re-search-backward "^[ \t]*[\n][ \t]+[a-zA-Z0-9]" 869c923 < t)) --- > (progn (forward-line 1) t))) 876c930 < (if (re-search-forward "[a-zA-Z0-9].*[\n][ \t]*[\n]\\|\\'" --- > (if (re-search-forward "[a-zA-Z0-9].*[\n][ \t]*[\n]" 879a934,1007 > > (defun eiffel-indent-assign () > "Return proper indentation for an assignment continuation line or nil." > (save-excursion > (let ((bol (save-excursion (beginning-of-line) (point))) > (start) > (in-col)) > (while > (and (re-search-backward ":=\\|;" nil t) > (setq start (match-beginning 0)) > (re-search-backward > "--" (save-excursion (beginning-of-line) > (point)) > t))) > (and start > (goto-char start) > (looking-at ":=[ \t]*") > (goto-char (match-end 0)) > (setq e-last-indent-type "ASSIGNMENT CONTINUED" > in-col (current-column)) > ;; If any line between assignment start and line to be indented is > ;; indented less than the computed indent for current line > ;; 'in-col' then can't be an assignment continuation. This solves > ;; most problems where assignment statements are not terminated by > ;; semicolons, although I consider this a bad practice. > (while (and (forward-line 1) > (< (point) bol) > (progn (skip-chars-forward " \t") > (if (< (current-column) in-col) > (setq in-col nil) > t))))) > in-col))) > > (defun eiffel-delim-string () > "Places '\\' delimiters around multiple line string that point is within. > If point is not within a string, produces an error." > (interactive) > (let (start end) > (save-excursion > (if (and (setq start (if (re-search-backward "\"" nil t) (point))) > (setq end (if (re-search-forward "\"" nil t 2) (point)))) > (save-restriction > (narrow-to-region start end) > (goto-char (point-min)) > (while > (progn (if (looking-at "\"?[ \t]*\"?$") > nil > (if (/= ?\" (following-char)) > (progn (back-to-indentation) > (if (/= ?\\ (following-char)) > (insert "\\")))) > (end-of-line) > (and (/= ?\" (preceding-char)) > (/= ?\\ (preceding-char)) > (insert "\\")) > ) > (forward-line 1) > (not (eobp)) > ))) > (error "Point is not within a double quoted string."))))) > > (defun eiffel-comment-region (arg) > "Comments the lines of region. With prefix ARG, uncomments region." > (interactive "P") > (setq arg (if arg > '(and (looking-at "--|") (delete-char 3)) > '(insert "--|"))) > (let ((opoint (point))) > (goto-char (region-beginning)) > (while (< (point) (region-end)) > (beginning-of-line) > (eval arg) > (forward-line 1)) > (goto-char opoint))) -- Bob Weiner, Motorola, Inc., Usenet: ...!gatech!uflorida!novavax!weiner Internet: novavax!weiner@uunet.uu.net (407) 364-2087