diff options
| author | Glenn Morris | 2017-11-08 20:16:38 -0500 |
|---|---|---|
| committer | Glenn Morris | 2017-11-08 20:16:38 -0500 |
| commit | b9d7c902603a49d2624bdd35efdfba1785a4bce5 (patch) | |
| tree | c561ae129c307065382922565a7f880a4a3e03d0 | |
| parent | 73d670751a633fa478d97fb1bfdab2a753c9b2d2 (diff) | |
| download | emacs-b9d7c902603a49d2624bdd35efdfba1785a4bce5.tar.gz emacs-b9d7c902603a49d2624bdd35efdfba1785a4bce5.zip | |
In f90.el, set fill-paragraph-function to a useful value
* lisp/progmodes/f90.el (f90-mode-map) <menu>: Add fill-paragraph.
(f90-mode): Set fill-paragraph-function.
(f90-fill-paragraph): New command.
| -rw-r--r-- | lisp/progmodes/f90.el | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el index 72156288eba..0cd665ca24b 100644 --- a/lisp/progmodes/f90.el +++ b/lisp/progmodes/f90.el | |||
| @@ -133,7 +133,7 @@ | |||
| 133 | ;; f90-indent-region (can be called by calling indent-region) | 133 | ;; f90-indent-region (can be called by calling indent-region) |
| 134 | ;; f90-indent-subprogram | 134 | ;; f90-indent-subprogram |
| 135 | ;; f90-break-line f90-join-lines | 135 | ;; f90-break-line f90-join-lines |
| 136 | ;; f90-fill-region | 136 | ;; f90-fill-region f90-fill-paragraph |
| 137 | ;; f90-insert-end | 137 | ;; f90-insert-end |
| 138 | ;; f90-upcase-keywords f90-upcase-region-keywords | 138 | ;; f90-upcase-keywords f90-upcase-region-keywords |
| 139 | ;; f90-downcase-keywords f90-downcase-region-keywords | 139 | ;; f90-downcase-keywords f90-downcase-region-keywords |
| @@ -784,6 +784,7 @@ Can be overridden by the value of `font-lock-maximum-decoration'.") | |||
| 784 | ["Indent Region" f90-indent-region :active mark-active] | 784 | ["Indent Region" f90-indent-region :active mark-active] |
| 785 | ["Fill Region" f90-fill-region :active mark-active | 785 | ["Fill Region" f90-fill-region :active mark-active |
| 786 | :help "Fill long lines in the region"] | 786 | :help "Fill long lines in the region"] |
| 787 | ["Fill Statement/Comment" fill-paragraph :active t] | ||
| 787 | "--" | 788 | "--" |
| 788 | ["Break Line at Point" f90-break-line :active t | 789 | ["Break Line at Point" f90-break-line :active t |
| 789 | :help "Break the current line at point"] | 790 | :help "Break the current line at point"] |
| @@ -1185,6 +1186,7 @@ with no args, if that value is non-nil." | |||
| 1185 | (set (make-local-variable 'abbrev-all-caps) t) | 1186 | (set (make-local-variable 'abbrev-all-caps) t) |
| 1186 | (set (make-local-variable 'normal-auto-fill-function) 'f90-do-auto-fill) | 1187 | (set (make-local-variable 'normal-auto-fill-function) 'f90-do-auto-fill) |
| 1187 | (setq indent-tabs-mode nil) ; auto buffer local | 1188 | (setq indent-tabs-mode nil) ; auto buffer local |
| 1189 | (set (make-local-variable 'fill-paragraph-function) 'f90-fill-paragraph) | ||
| 1188 | (set (make-local-variable 'font-lock-defaults) | 1190 | (set (make-local-variable 'font-lock-defaults) |
| 1189 | '((f90-font-lock-keywords f90-font-lock-keywords-1 | 1191 | '((f90-font-lock-keywords f90-font-lock-keywords-1 |
| 1190 | f90-font-lock-keywords-2 | 1192 | f90-font-lock-keywords-2 |
| @@ -2158,6 +2160,20 @@ Like `join-line', but handles F90 syntax." | |||
| 2158 | (if (featurep 'xemacs) | 2160 | (if (featurep 'xemacs) |
| 2159 | (zmacs-deactivate-region) | 2161 | (zmacs-deactivate-region) |
| 2160 | (deactivate-mark)))) | 2162 | (deactivate-mark)))) |
| 2163 | |||
| 2164 | (defun f90-fill-paragraph (&optional justify) | ||
| 2165 | "In a comment, fill it as a paragraph, else fill the current statement. | ||
| 2166 | For use as the value of `fill-paragraph-function'. | ||
| 2167 | Passes optional argument JUSTIFY to `fill-comment-paragraph'. | ||
| 2168 | Always returns non-nil (to prevent `fill-paragraph' being called)." | ||
| 2169 | (interactive "*P") | ||
| 2170 | (or (fill-comment-paragraph justify) | ||
| 2171 | (save-excursion | ||
| 2172 | (f90-next-statement) | ||
| 2173 | (let ((end (if (bobp) (point) (1- (point))))) | ||
| 2174 | (f90-previous-statement) | ||
| 2175 | (f90-fill-region (point) end))) | ||
| 2176 | t)) | ||
| 2161 | 2177 | ||
| 2162 | (defconst f90-end-block-optional-name | 2178 | (defconst f90-end-block-optional-name |
| 2163 | '("program" "module" "subroutine" "function" "type") | 2179 | '("program" "module" "subroutine" "function" "type") |