diff options
| author | Stefan Monnier | 2001-11-07 01:15:30 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-11-07 01:15:30 +0000 |
| commit | 63b74e641f93a6db205ae9dc2e02d57c7593383f (patch) | |
| tree | b28f2fc2e7de8837f60836d3bc6108577d75f50d | |
| parent | 16f97fc36f6ec003f0b1cf0db6431135081dd83d (diff) | |
| download | emacs-63b74e641f93a6db205ae9dc2e02d57c7593383f.tar.gz emacs-63b74e641f93a6db205ae9dc2e02d57c7593383f.zip | |
(lisp-imenu-generic-expression): Paren typo.
(lisp-mode-variables): Don't set paragraph-{start,separate}.
Don't disable adaptive-fill-mode.
(lisp-fill-paragraph): Use tab-width rather than 8.
Prevent filling the first line of docstrings.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 6b110dbd9f7..2f9e46fddbb 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -92,16 +92,16 @@ | |||
| 92 | "define-compiler-macro" "define-modify-macro" | 92 | "define-compiler-macro" "define-modify-macro" |
| 93 | "defsetf" "define-setf-expander" | 93 | "defsetf" "define-setf-expander" |
| 94 | "define-method-combination" | 94 | "define-method-combination" |
| 95 | "defgeneric" "defmethod") t) | 95 | "defgeneric" "defmethod") t)) |
| 96 | "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)"))) | 96 | "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)")) |
| 97 | 2) | 97 | 2) |
| 98 | (list (purecopy "Variables") | 98 | (list (purecopy "Variables") |
| 99 | (purecopy (concat "^\\s-*(" | 99 | (purecopy (concat "^\\s-*(" |
| 100 | (eval-when-compile | 100 | (eval-when-compile |
| 101 | (regexp-opt | 101 | (regexp-opt |
| 102 | '("defvar" "defconst" "defconstant" "defcustom" | 102 | '("defvar" "defconst" "defconstant" "defcustom" |
| 103 | "defparameter" "define-symbol-macro") t) | 103 | "defparameter" "define-symbol-macro") t)) |
| 104 | "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)"))) | 104 | "\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)")) |
| 105 | 2) | 105 | 2) |
| 106 | (list (purecopy "Types") | 106 | (list (purecopy "Types") |
| 107 | (purecopy (concat "^\\s-*(" | 107 | (purecopy (concat "^\\s-*(" |
| @@ -109,8 +109,8 @@ | |||
| 109 | (regexp-opt | 109 | (regexp-opt |
| 110 | '("defgroup" "deftype" "defstruct" "defclass" | 110 | '("defgroup" "deftype" "defstruct" "defclass" |
| 111 | "define-condition" "define-widget" "defface" | 111 | "define-condition" "define-widget" "defface" |
| 112 | "defpackage") t) | 112 | "defpackage") t)) |
| 113 | "\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)"))) | 113 | "\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)")) |
| 114 | 2)) | 114 | 2)) |
| 115 | 115 | ||
| 116 | "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") | 116 | "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") |
| @@ -155,13 +155,9 @@ | |||
| 155 | ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is | 155 | ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is |
| 156 | ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el | 156 | ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el |
| 157 | (defun lisp-mode-variables (&optional lisp-syntax) | 157 | (defun lisp-mode-variables (&optional lisp-syntax) |
| 158 | (cond (lisp-syntax | 158 | (when lisp-syntax |
| 159 | (set-syntax-table lisp-mode-syntax-table))) | 159 | (set-syntax-table lisp-mode-syntax-table)) |
| 160 | (setq local-abbrev-table lisp-mode-abbrev-table) | 160 | (setq local-abbrev-table lisp-mode-abbrev-table) |
| 161 | (make-local-variable 'paragraph-start) | ||
| 162 | (setq paragraph-start (concat page-delimiter "\\|$" )) | ||
| 163 | (make-local-variable 'paragraph-separate) | ||
| 164 | (setq paragraph-separate paragraph-start) | ||
| 165 | (make-local-variable 'paragraph-ignore-fill-prefix) | 161 | (make-local-variable 'paragraph-ignore-fill-prefix) |
| 166 | (setq paragraph-ignore-fill-prefix t) | 162 | (setq paragraph-ignore-fill-prefix t) |
| 167 | (make-local-variable 'fill-paragraph-function) | 163 | (make-local-variable 'fill-paragraph-function) |
| @@ -169,8 +165,8 @@ | |||
| 169 | ;; Adaptive fill mode gets in the way of auto-fill, | 165 | ;; Adaptive fill mode gets in the way of auto-fill, |
| 170 | ;; and should make no difference for explicit fill | 166 | ;; and should make no difference for explicit fill |
| 171 | ;; because lisp-fill-paragraph should do the job. | 167 | ;; because lisp-fill-paragraph should do the job. |
| 172 | (make-local-variable 'adaptive-fill-mode) | 168 | ;; I believe that newcomment's auto-fill code properly deals with it -stef |
| 173 | (setq adaptive-fill-mode nil) | 169 | ;;(set (make-local-variable 'adaptive-fill-mode) nil) |
| 174 | (make-local-variable 'normal-auto-fill-function) | 170 | (make-local-variable 'normal-auto-fill-function) |
| 175 | (setq normal-auto-fill-function 'lisp-mode-auto-fill) | 171 | (setq normal-auto-fill-function 'lisp-mode-auto-fill) |
| 176 | (make-local-variable 'indent-line-function) | 172 | (make-local-variable 'indent-line-function) |
| @@ -617,6 +613,11 @@ which see." | |||
| 617 | (max (if (bolp) 0 (1+ (current-column))) | 613 | (max (if (bolp) 0 (1+ (current-column))) |
| 618 | comment-column)))) | 614 | comment-column)))) |
| 619 | 615 | ||
| 616 | ;; This function just forces a more costly detection of comments (using | ||
| 617 | ;; parse-partial-sexp from beginning-of-defun). I.e. It avoids the problem of | ||
| 618 | ;; taking a `;' inside a string started on another line for a comment starter. | ||
| 619 | ;; Note: `newcomment' gets it right in 99% of the cases if you're using | ||
| 620 | ;; font-lock, anyway, so we could get rid of it. -stef | ||
| 620 | (defun lisp-mode-auto-fill () | 621 | (defun lisp-mode-auto-fill () |
| 621 | (if (> (current-column) (current-fill-column)) | 622 | (if (> (current-column) (current-fill-column)) |
| 622 | (if (save-excursion | 623 | (if (save-excursion |
| @@ -1054,8 +1055,8 @@ and initial semicolons." | |||
| 1054 | (error nil)) | 1055 | (error nil)) |
| 1055 | (setq has-comment t has-code-and-comment t) | 1056 | (setq has-comment t has-code-and-comment t) |
| 1056 | (setq comment-fill-prefix | 1057 | (setq comment-fill-prefix |
| 1057 | (concat (make-string (/ (current-column) 8) ?\t) | 1058 | (concat (make-string (/ (current-column) tab-width) ?\t) |
| 1058 | (make-string (% (current-column) 8) ?\ ) | 1059 | (make-string (% (current-column) tab-width) ?\ ) |
| 1059 | (buffer-substring (match-beginning 0) (match-end 0))))))) | 1060 | (buffer-substring (match-beginning 0) (match-end 0))))))) |
| 1060 | 1061 | ||
| 1061 | (if (not has-comment) | 1062 | (if (not has-comment) |
| @@ -1068,7 +1069,10 @@ and initial semicolons." | |||
| 1068 | ;; filled para at following comment lines and keywords | 1069 | ;; filled para at following comment lines and keywords |
| 1069 | ;; (typically in `defcustom'). | 1070 | ;; (typically in `defcustom'). |
| 1070 | (let ((paragraph-start (concat paragraph-start | 1071 | (let ((paragraph-start (concat paragraph-start |
| 1071 | "\\|\\s-*[\(;:\"]"))) | 1072 | "\\|\\s-*[\(;:\"]")) |
| 1073 | ;; Avoid filling the first line of docstring. | ||
| 1074 | (paragraph-separate | ||
| 1075 | (concat paragraph-separate "\\|\\s-*\".*\\.$"))) | ||
| 1072 | (fill-paragraph justify)) | 1076 | (fill-paragraph justify)) |
| 1073 | 1077 | ||
| 1074 | ;; Narrow to include only the comment, and then fill the region. | 1078 | ;; Narrow to include only the comment, and then fill the region. |
| @@ -1078,16 +1082,13 @@ and initial semicolons." | |||
| 1078 | (narrow-to-region | 1082 | (narrow-to-region |
| 1079 | ;; Find the first line we should include in the region to fill. | 1083 | ;; Find the first line we should include in the region to fill. |
| 1080 | (save-excursion | 1084 | (save-excursion |
| 1081 | (while (and (zerop (forward-line -1)) | 1085 | (while (and (looking-at "[ \t]*;") |
| 1082 | (looking-at "^[ \t]*;"))) | 1086 | (zerop (forward-line -1)))) |
| 1083 | ;; We may have gone too far. Go forward again. | ||
| 1084 | (or (looking-at ".*;") | ||
| 1085 | (forward-line 1)) | ||
| 1086 | (point)) | 1087 | (point)) |
| 1087 | ;; Find the beginning of the first line past the region to fill. | 1088 | ;; Find the beginning of the first line past the region to fill. |
| 1088 | (save-excursion | 1089 | (save-excursion |
| 1089 | (while (progn (forward-line 1) | 1090 | (while (progn (forward-line 1) |
| 1090 | (looking-at "^[ \t]*;"))) | 1091 | (looking-at "[ \t]*;"))) |
| 1091 | (point))) | 1092 | (point))) |
| 1092 | 1093 | ||
| 1093 | ;; Lines with only semicolons on them can be paragraph boundaries. | 1094 | ;; Lines with only semicolons on them can be paragraph boundaries. |