diff options
| author | Stefan Monnier | 2001-11-25 21:47:40 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-11-25 21:47:40 +0000 |
| commit | 52cf5c37c1ce9e3f6e4f35b91e3c784f6bfbdd7d (patch) | |
| tree | 340b3b7cae33c5b2c6efca69aff399634ee5cf03 | |
| parent | 0c773047fdc6d16d4533165b0deabbc4304901a9 (diff) | |
| download | emacs-52cf5c37c1ce9e3f6e4f35b91e3c784f6bfbdd7d.tar.gz emacs-52cf5c37c1ce9e3f6e4f35b91e3c784f6bfbdd7d.zip | |
(lisp-mode-variables): Set syntax-begin-function.
(lisp-interaction-mode-abbrev-table): Defvar to its correct value.
(lisp-interaction-mode): Don't set local-abbrev-table any more.
(lisp-mode-auto-fill): Use syntax-ppss and obey
comment-auto-fill-only-comments.
(lisp-fill-paragraph): Use syntax-ppss.
| -rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index b27ef1cb3c6..8ca7b9b0a18 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -195,6 +195,7 @@ | |||
| 195 | (setq imenu-generic-expression lisp-imenu-generic-expression) | 195 | (setq imenu-generic-expression lisp-imenu-generic-expression) |
| 196 | (make-local-variable 'multibyte-syntax-as-symbol) | 196 | (make-local-variable 'multibyte-syntax-as-symbol) |
| 197 | (setq multibyte-syntax-as-symbol t) | 197 | (setq multibyte-syntax-as-symbol t) |
| 198 | (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun) | ||
| 198 | (setq font-lock-defaults | 199 | (setq font-lock-defaults |
| 199 | '((lisp-font-lock-keywords | 200 | '((lisp-font-lock-keywords |
| 200 | lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) | 201 | lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) |
| @@ -366,6 +367,7 @@ if that value is non-nil." | |||
| 366 | "Keymap for Lisp Interaction mode. | 367 | "Keymap for Lisp Interaction mode. |
| 367 | All commands in `lisp-mode-shared-map' are inherited by this map.") | 368 | All commands in `lisp-mode-shared-map' are inherited by this map.") |
| 368 | 369 | ||
| 370 | (defvar lisp-interaction-mode-abbrev-table lisp-mode-abbrev-table) | ||
| 369 | (define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction" | 371 | (define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction" |
| 370 | "Major mode for typing and evaluating Lisp forms. | 372 | "Major mode for typing and evaluating Lisp forms. |
| 371 | Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression | 373 | Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression |
| @@ -379,8 +381,7 @@ Paragraphs are separated only by blank lines. | |||
| 379 | Semicolons start comments. | 381 | Semicolons start comments. |
| 380 | \\{lisp-interaction-mode-map} | 382 | \\{lisp-interaction-mode-map} |
| 381 | Entry to this mode calls the value of `lisp-interaction-mode-hook' | 383 | Entry to this mode calls the value of `lisp-interaction-mode-hook' |
| 382 | if that value is non-nil." | 384 | if that value is non-nil.") |
| 383 | (setq local-abbrev-table lisp-mode-abbrev-table)) | ||
| 384 | 385 | ||
| 385 | (defun eval-print-last-sexp () | 386 | (defun eval-print-last-sexp () |
| 386 | "Evaluate sexp before point; print value into current buffer. | 387 | "Evaluate sexp before point; print value into current buffer. |
| @@ -638,13 +639,12 @@ which see." | |||
| 638 | (defun lisp-mode-auto-fill () | 639 | (defun lisp-mode-auto-fill () |
| 639 | (if (> (current-column) (current-fill-column)) | 640 | (if (> (current-column) (current-fill-column)) |
| 640 | (if (save-excursion | 641 | (if (save-excursion |
| 641 | (nth 4 (parse-partial-sexp (save-excursion | 642 | (nth 4 (syntax-ppss (point)))) |
| 642 | (beginning-of-defun) | ||
| 643 | (point)) | ||
| 644 | (point)))) | ||
| 645 | (do-auto-fill) | 643 | (do-auto-fill) |
| 646 | (let ((comment-start nil) (comment-start-skip nil)) | 644 | (unless (and (boundp 'comment-auto-fill-only-comments) |
| 647 | (do-auto-fill))))) | 645 | comment-auto-fill-only-comments) |
| 646 | (let ((comment-start nil) (comment-start-skip nil)) | ||
| 647 | (do-auto-fill)))))) | ||
| 648 | 648 | ||
| 649 | (defvar lisp-indent-offset nil | 649 | (defvar lisp-indent-offset nil |
| 650 | "If non-nil, indent second line of expressions that many more columns.") | 650 | "If non-nil, indent second line of expressions that many more columns.") |
| @@ -1079,17 +1079,10 @@ and initial semicolons." | |||
| 1079 | ;; A line with some code, followed by a comment? Remember that the | 1079 | ;; A line with some code, followed by a comment? Remember that the |
| 1080 | ;; semi which starts the comment shouldn't be part of a string or | 1080 | ;; semi which starts the comment shouldn't be part of a string or |
| 1081 | ;; character. | 1081 | ;; character. |
| 1082 | ((condition-case nil | 1082 | ((let ((state (syntax-ppss (line-end-position)))) |
| 1083 | (save-restriction | 1083 | (when (nth 4 state) |
| 1084 | (narrow-to-region (point-min) | 1084 | (goto-char (nth 8 state)) |
| 1085 | (save-excursion (end-of-line) (point))) | 1085 | (looking-at ";+[\t ]*"))) |
| 1086 | (while (not (looking-at ";\\|$")) | ||
| 1087 | (skip-chars-forward "^;\n\"\\\\?") | ||
| 1088 | (cond | ||
| 1089 | ((eq (char-after (point)) ?\\) (forward-char 2)) | ||
| 1090 | ((memq (char-after (point)) '(?\" ??)) (forward-sexp 1)))) | ||
| 1091 | (looking-at ";+[\t ]*")) | ||
| 1092 | (error nil)) | ||
| 1093 | (setq has-comment t has-code-and-comment t) | 1086 | (setq has-comment t has-code-and-comment t) |
| 1094 | (setq comment-fill-prefix | 1087 | (setq comment-fill-prefix |
| 1095 | (concat (make-string (/ (current-column) tab-width) ?\t) | 1088 | (concat (make-string (/ (current-column) tab-width) ?\t) |