Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 54501:96f7b2598aa3
(lisp-mode-variables): Don't set
normal-auto-fill-function and comment-indent-function.
The default values now work just as well.
Don't set font-lock-beginning-of-syntax-function since we already set
syntax-begin-function.
(lisp-outline-level): Put ;;;###autoload at same level as (.
(prin1-char): Quote special chars.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 22 Mar 2004 15:31:46 +0000 |
parents | cad9b29a5224 |
children | ea0f46cadeb2 |
comparison
equal
deleted
inserted
replaced
54500:7a30ab50eb0b | 54501:96f7b2598aa3 |
---|---|
171 ;; Adaptive fill mode gets in the way of auto-fill, | 171 ;; Adaptive fill mode gets in the way of auto-fill, |
172 ;; and should make no difference for explicit fill | 172 ;; and should make no difference for explicit fill |
173 ;; because lisp-fill-paragraph should do the job. | 173 ;; because lisp-fill-paragraph should do the job. |
174 ;; I believe that newcomment's auto-fill code properly deals with it -stef | 174 ;; I believe that newcomment's auto-fill code properly deals with it -stef |
175 ;;(set (make-local-variable 'adaptive-fill-mode) nil) | 175 ;;(set (make-local-variable 'adaptive-fill-mode) nil) |
176 (make-local-variable 'normal-auto-fill-function) | |
177 (setq normal-auto-fill-function 'lisp-mode-auto-fill) | |
178 (make-local-variable 'indent-line-function) | 176 (make-local-variable 'indent-line-function) |
179 (setq indent-line-function 'lisp-indent-line) | 177 (setq indent-line-function 'lisp-indent-line) |
180 (make-local-variable 'indent-region-function) | 178 (make-local-variable 'indent-region-function) |
181 (setq indent-region-function 'lisp-indent-region) | 179 (setq indent-region-function 'lisp-indent-region) |
182 (make-local-variable 'parse-sexp-ignore-comments) | 180 (make-local-variable 'parse-sexp-ignore-comments) |
193 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") | 191 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *") |
194 (make-local-variable 'comment-add) | 192 (make-local-variable 'comment-add) |
195 (setq comment-add 1) ;default to `;;' in comment-region | 193 (setq comment-add 1) ;default to `;;' in comment-region |
196 (make-local-variable 'comment-column) | 194 (make-local-variable 'comment-column) |
197 (setq comment-column 40) | 195 (setq comment-column 40) |
198 (make-local-variable 'comment-indent-function) | |
199 (setq comment-indent-function 'lisp-comment-indent) | |
200 ;; Don't get confused by `;' in doc strings when paragraph-filling. | 196 ;; Don't get confused by `;' in doc strings when paragraph-filling. |
201 (set (make-local-variable 'comment-use-global-state) t) | 197 (set (make-local-variable 'comment-use-global-state) t) |
202 (make-local-variable 'imenu-generic-expression) | 198 (make-local-variable 'imenu-generic-expression) |
203 (setq imenu-generic-expression lisp-imenu-generic-expression) | 199 (setq imenu-generic-expression lisp-imenu-generic-expression) |
204 (make-local-variable 'multibyte-syntax-as-symbol) | 200 (make-local-variable 'multibyte-syntax-as-symbol) |
205 (setq multibyte-syntax-as-symbol t) | 201 (setq multibyte-syntax-as-symbol t) |
206 (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun) | 202 (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun) |
207 (setq font-lock-defaults | 203 (setq font-lock-defaults |
208 '((lisp-font-lock-keywords | 204 '((lisp-font-lock-keywords |
209 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) | 205 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2) |
210 nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun | 206 nil nil (("+-*/.<>=!?$%_&~^:" . "w")) nil |
211 (font-lock-mark-block-function . mark-defun) | 207 (font-lock-mark-block-function . mark-defun) |
212 (font-lock-syntactic-face-function | 208 (font-lock-syntactic-face-function |
213 . lisp-font-lock-syntactic-face-function)))) | 209 . lisp-font-lock-syntactic-face-function)))) |
214 | 210 |
215 (defun lisp-outline-level () | 211 (defun lisp-outline-level () |
216 "Lisp mode `outline-level' function." | 212 "Lisp mode `outline-level' function." |
217 (if (looking-at "(") | 213 (if (looking-at "(\\|;;;###autoload") |
218 1000 | 214 1000 |
219 (looking-at outline-regexp) | 215 (looking-at outline-regexp) |
220 (- (match-end 0) (match-beginning 0)))) | 216 (- (match-end 0) (match-beginning 0)))) |
221 | 217 |
222 | 218 |
451 (defun prin1-char (char) | 447 (defun prin1-char (char) |
452 "Return a string representing CHAR as a character rather than as an integer. | 448 "Return a string representing CHAR as a character rather than as an integer. |
453 If CHAR is not a character, return nil." | 449 If CHAR is not a character, return nil." |
454 (and (integerp char) | 450 (and (integerp char) |
455 (char-valid-p (event-basic-type char)) | 451 (char-valid-p (event-basic-type char)) |
456 (concat | 452 (let ((c (event-basic-type char))) |
457 "?" | 453 (concat |
458 (mapconcat | 454 "?" |
459 (lambda (modif) | 455 (mapconcat |
460 (cond ((eq modif 'super) "\\s-") | 456 (lambda (modif) |
461 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) | 457 (cond ((eq modif 'super) "\\s-") |
462 (event-modifiers char) "") | 458 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) |
463 (string (event-basic-type char))))) | 459 (event-modifiers char) "") |
460 (cond | |
461 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) | |
462 ((eq c 127) "\\C-?") | |
463 (t (string c))))))) | |
464 | 464 |
465 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) | 465 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
466 "Evaluate sexp before point; print value in minibuffer. | 466 "Evaluate sexp before point; print value in minibuffer. |
467 With argument, print output into current buffer." | 467 With argument, print output into current buffer." |
468 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) | 468 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) |
669 comment-column)))) | 669 comment-column)))) |
670 | 670 |
671 ;; This function just forces a more costly detection of comments (using | 671 ;; This function just forces a more costly detection of comments (using |
672 ;; parse-partial-sexp from beginning-of-defun). I.e. It avoids the problem of | 672 ;; parse-partial-sexp from beginning-of-defun). I.e. It avoids the problem of |
673 ;; taking a `;' inside a string started on another line for a comment starter. | 673 ;; taking a `;' inside a string started on another line for a comment starter. |
674 ;; Note: `newcomment' gets it right in 99% of the cases if you're using | 674 ;; Note: `newcomment' gets it right now since we set comment-use-global-state |
675 ;; font-lock, anyway, so we could get rid of it. -stef | 675 ;; so we could get rid of it. -stef |
676 (defun lisp-mode-auto-fill () | 676 (defun lisp-mode-auto-fill () |
677 (if (> (current-column) (current-fill-column)) | 677 (if (> (current-column) (current-fill-column)) |
678 (if (save-excursion | 678 (if (save-excursion |
679 (nth 4 (syntax-ppss (point)))) | 679 (nth 4 (syntax-ppss (point)))) |
680 (do-auto-fill) | 680 (do-auto-fill) |