1 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands
3 ;; Copyright (C) 1985, 1986, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
7 ;; Keywords: lisp, languages
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; The base major mode for editing Lisp code (used also for Emacs Lisp).
29 ;; This mode is documented in the Emacs manual.
33 (defvar font-lock-comment-face)
34 (defvar font-lock-doc-face)
35 (defvar font-lock-keywords-case-fold-search)
36 (defvar font-lock-string-face)
38 (defvar lisp-mode-abbrev-table nil)
40 (defvar emacs-lisp-mode-syntax-table
41 (let ((table (make-syntax-table)))
44 (modify-syntax-entry i "_ " table)
48 (modify-syntax-entry i "_ " table)
52 (modify-syntax-entry i "_ " table)
56 (modify-syntax-entry i "_ " table)
58 (modify-syntax-entry ?\s " " table)
59 (modify-syntax-entry ?\t " " table)
60 (modify-syntax-entry ?\f " " table)
61 (modify-syntax-entry ?\n "> " table)
62 ;; This is probably obsolete since nowadays such features use overlays.
63 ;; ;; Give CR the same syntax as newline, for selective-display.
64 ;; (modify-syntax-entry ?\^m "> " table)
65 (modify-syntax-entry ?\; "< " table)
66 (modify-syntax-entry ?` "' " table)
67 (modify-syntax-entry ?' "' " table)
68 (modify-syntax-entry ?, "' " table)
69 (modify-syntax-entry ?@ "' " table)
70 ;; Used to be singlequote; changed for flonums.
71 (modify-syntax-entry ?. "_ " table)
72 (modify-syntax-entry ?# "' " table)
73 (modify-syntax-entry ?\" "\" " table)
74 (modify-syntax-entry ?\\ "\\ " table)
75 (modify-syntax-entry ?\( "() " table)
76 (modify-syntax-entry ?\) ")( " table)
77 (modify-syntax-entry ?\[ "(] " table)
78 (modify-syntax-entry ?\] ")[ " table))
81 (defvar lisp-mode-syntax-table
82 (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
83 (modify-syntax-entry ?\[ "_ " table)
84 (modify-syntax-entry ?\] "_ " table)
85 (modify-syntax-entry ?# "' 14b" table)
86 (modify-syntax-entry ?| "\" 23bn" table)
89 (define-abbrev-table 'lisp-mode-abbrev-table ())
91 (defvar lisp-imenu-generic-expression
94 (purecopy (concat "^\\s-*("
97 '("defun" "defun*" "defsubst" "defmacro"
98 "defadvice" "define-skeleton"
99 "define-minor-mode" "define-global-minor-mode"
100 "define-globalized-minor-mode"
101 "define-derived-mode" "define-generic-mode"
102 "define-compiler-macro" "define-modify-macro"
103 "defsetf" "define-setf-expander"
104 "define-method-combination"
105 "defgeneric" "defmethod") t))
106 "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)"))
108 (list (purecopy "Variables")
109 (purecopy (concat "^\\s-*("
112 '("defvar" "defconst" "defconstant" "defcustom"
113 "defparameter" "define-symbol-macro") t))
114 "\\s-+\\(\\(\\sw\\|\\s_\\)+\\)"))
116 (list (purecopy "Types")
117 (purecopy (concat "^\\s-*("
120 '("defgroup" "deftheme" "deftype" "defstruct"
121 "defclass" "define-condition" "define-widget"
122 "defface" "defpackage") t))
123 "\\s-+'?\\(\\(\\sw\\|\\s_\\)+\\)"))
126 "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.")
128 ;; This was originally in autoload.el and is still used there.
129 (put 'autoload 'doc-string-elt 3)
130 (put 'defun 'doc-string-elt 3)
131 (put 'defun* 'doc-string-elt 3)
132 (put 'defvar 'doc-string-elt 3)
133 (put 'defcustom 'doc-string-elt 3)
134 (put 'deftheme 'doc-string-elt 2)
135 (put 'defconst 'doc-string-elt 3)
136 (put 'defmacro 'doc-string-elt 3)
137 (put 'defmacro* 'doc-string-elt 3)
138 (put 'defsubst 'doc-string-elt 3)
139 (put 'defstruct 'doc-string-elt 2)
140 (put 'define-skeleton 'doc-string-elt 2)
141 (put 'define-derived-mode 'doc-string-elt 4)
142 (put 'define-compilation-mode 'doc-string-elt 3)
143 (put 'easy-mmode-define-minor-mode 'doc-string-elt 2)
144 (put 'define-minor-mode 'doc-string-elt 2)
145 (put 'easy-mmode-define-global-mode 'doc-string-elt 2)
146 (put 'define-global-minor-mode 'doc-string-elt 2)
147 (put 'define-globalized-minor-mode 'doc-string-elt 2)
148 (put 'define-generic-mode 'doc-string-elt 7)
149 (put 'define-ibuffer-filter 'doc-string-elt 2)
150 (put 'define-ibuffer-op 'doc-string-elt 3)
151 (put 'define-ibuffer-sorter 'doc-string-elt 2)
152 (put 'lambda 'doc-string-elt 2)
153 (put 'defalias 'doc-string-elt 3)
154 (put 'defvaralias 'doc-string-elt 3)
155 (put 'define-category 'doc-string-elt 2)
157 (defvar lisp-doc-string-elt-property 'doc-string-elt
158 "The symbol property that holds the docstring position info.")
160 (defun lisp-font-lock-syntactic-face-function (state)
162 ;; This might be a (doc)string or a |...| symbol.
163 (let ((startpos (nth 8 state)))
164 (if (eq (char-after startpos) ?|)
165 ;; This is not a string, but a |...| symbol.
167 (let* ((listbeg (nth 1 state))
168 (firstsym (and listbeg
171 (and (looking-at "([ \t\n]*\\(\\(\\sw\\|\\s_\\)+\\)")
173 (docelt (and firstsym (get (intern-soft firstsym)
174 lisp-doc-string-elt-property))))
176 ;; It's a string in a form that can have a docstring.
177 ;; Check whether it's in docstring position.
179 (when (functionp docelt)
180 (goto-char (match-end 1))
181 (setq docelt (funcall docelt)))
185 (while (and (> docelt 0) (< (point) startpos)
186 (progn (forward-sexp 1) t))
187 (setq docelt (1- docelt)))
189 (and (zerop docelt) (<= (point) startpos)
190 (progn (forward-comment (point-max)) t)
191 (= (point) (nth 8 state)))))
193 font-lock-string-face))))
194 font-lock-comment-face))
196 ;; The LISP-SYNTAX argument is used by code in inf-lisp.el and is
197 ;; (uselessly) passed from pp.el, chistory.el, gnus-kill.el and score-mode.el
198 (defun lisp-mode-variables (&optional lisp-syntax)
200 (set-syntax-table lisp-mode-syntax-table))
201 (setq local-abbrev-table lisp-mode-abbrev-table)
202 (make-local-variable 'paragraph-ignore-fill-prefix)
203 (setq paragraph-ignore-fill-prefix t)
204 (make-local-variable 'fill-paragraph-function)
205 (setq fill-paragraph-function 'lisp-fill-paragraph)
206 ;; Adaptive fill mode gets the fill wrong for a one-line paragraph made of
207 ;; a single docstring. Let's fix it here.
208 (set (make-local-variable 'adaptive-fill-function)
209 (lambda () (if (looking-at "\\s-+\"[^\n\"]+\"\\s-*$") "")))
210 ;; Adaptive fill mode gets in the way of auto-fill,
211 ;; and should make no difference for explicit fill
212 ;; because lisp-fill-paragraph should do the job.
213 ;; I believe that newcomment's auto-fill code properly deals with it -stef
214 ;;(set (make-local-variable 'adaptive-fill-mode) nil)
215 (make-local-variable 'indent-line-function)
216 (setq indent-line-function 'lisp-indent-line)
217 (make-local-variable 'indent-region-function)
218 (setq indent-region-function 'lisp-indent-region)
219 (make-local-variable 'parse-sexp-ignore-comments)
220 (setq parse-sexp-ignore-comments t)
221 (make-local-variable 'outline-regexp)
222 (setq outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(")
223 (make-local-variable 'outline-level)
224 (setq outline-level 'lisp-outline-level)
225 (make-local-variable 'comment-start)
226 (setq comment-start ";")
227 (make-local-variable 'comment-start-skip)
228 ;; Look within the line for a ; following an even number of backslashes
229 ;; after either a non-backslash or the line beginning.
230 (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
231 (make-local-variable 'font-lock-comment-start-skip)
232 ;; Font lock mode uses this only when it KNOWS a comment is starting.
233 (setq font-lock-comment-start-skip ";+ *")
234 (make-local-variable 'comment-add)
235 (setq comment-add 1) ;default to `;;' in comment-region
236 (make-local-variable 'comment-column)
237 (setq comment-column 40)
238 ;; Don't get confused by `;' in doc strings when paragraph-filling.
239 (set (make-local-variable 'comment-use-global-state) t)
240 (make-local-variable 'imenu-generic-expression)
241 (setq imenu-generic-expression lisp-imenu-generic-expression)
242 (make-local-variable 'multibyte-syntax-as-symbol)
243 (setq multibyte-syntax-as-symbol t)
244 (set (make-local-variable 'syntax-begin-function) 'beginning-of-defun)
245 (setq font-lock-defaults
246 '((lisp-font-lock-keywords
247 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2)
248 nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil
249 (font-lock-mark-block-function . mark-defun)
250 (font-lock-syntactic-face-function
251 . lisp-font-lock-syntactic-face-function))))
253 (defun lisp-outline-level ()
254 "Lisp mode `outline-level' function."
255 (let ((len (- (match-end 0) (match-beginning 0))))
256 (if (looking-at "(\\|;;;###autoload")
260 (defvar lisp-mode-shared-map
261 (let ((map (make-sparse-keymap)))
262 (define-key map "\t" 'lisp-indent-line)
263 (define-key map "\e\C-q" 'indent-sexp)
264 (define-key map "\177" 'backward-delete-char-untabify)
265 ;; This gets in the way when viewing a Lisp file in view-mode. As
266 ;; long as [backspace] is mapped into DEL via the
267 ;; function-key-map, this should remain disabled!!
268 ;;;(define-key map [backspace] 'backward-delete-char-untabify)
270 "Keymap for commands shared by all sorts of Lisp modes.")
272 (defvar emacs-lisp-mode-map ()
273 "Keymap for Emacs Lisp mode.
274 All commands in `lisp-mode-shared-map' are inherited by this map.")
276 (if emacs-lisp-mode-map
278 (let ((map (make-sparse-keymap "Emacs-Lisp")))
279 (setq emacs-lisp-mode-map (make-sparse-keymap))
280 (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map)
281 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol)
282 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun)
283 (define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp)
284 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap))
285 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp]
286 (cons "Emacs-Lisp" map))
287 (define-key map [edebug-defun]
288 '("Instrument Function for Debugging" . edebug-defun))
289 (define-key map [byte-recompile]
290 '("Byte-recompile Directory..." . byte-recompile-directory))
291 (define-key map [emacs-byte-compile-and-load]
292 '("Byte-compile And Load" . emacs-lisp-byte-compile-and-load))
293 (define-key map [byte-compile]
294 '("Byte-compile This File" . emacs-lisp-byte-compile))
295 (define-key map [separator-eval] '("--"))
296 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-buffer))
297 (define-key map [eval-region] '("Evaluate Region" . eval-region))
298 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp))
299 (define-key map [separator-format] '("--"))
300 (define-key map [comment-region] '("Comment Out Region" . comment-region))
301 (define-key map [indent-region] '("Indent Region" . indent-region))
302 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
303 (put 'eval-region 'menu-enable 'mark-active)
304 (put 'comment-region 'menu-enable 'mark-active)
305 (put 'indent-region 'menu-enable 'mark-active)))
307 (defun emacs-lisp-byte-compile ()
308 "Byte compile the file containing the current buffer."
311 (byte-compile-file buffer-file-name)
312 (error "The buffer must be saved in a file first")))
314 (defun emacs-lisp-byte-compile-and-load ()
315 "Byte-compile the current file (if it has changed), then load compiled code."
318 (error "The buffer must be saved in a file first"))
320 ;; Recompile if file or buffer has changed since last compilation.
321 (if (and (buffer-modified-p)
322 (y-or-n-p (format "Save buffer %s first? " (buffer-name))))
324 (let ((compiled-file-name (byte-compile-dest-file buffer-file-name)))
325 (if (file-newer-than-file-p compiled-file-name buffer-file-name)
326 (load-file compiled-file-name)
327 (byte-compile-file buffer-file-name t))))
329 (defcustom emacs-lisp-mode-hook nil
330 "Hook run when entering Emacs Lisp mode."
331 :options '(turn-on-eldoc-mode imenu-add-menubar-index checkdoc-minor-mode)
335 (defcustom lisp-mode-hook nil
336 "Hook run when entering Lisp mode."
337 :options '(imenu-add-menubar-index)
341 (defcustom lisp-interaction-mode-hook nil
342 "Hook run when entering Lisp Interaction mode."
343 :options '(turn-on-eldoc-mode)
347 (defun emacs-lisp-mode ()
348 "Major mode for editing Lisp code to run in Emacs.
350 Delete converts tabs to spaces as it moves back.
351 Blank lines separate paragraphs. Semicolons start comments.
352 \\{emacs-lisp-mode-map}
353 Entry to this mode calls the value of `emacs-lisp-mode-hook'
354 if that value is non-nil."
356 (kill-all-local-variables)
357 (use-local-map emacs-lisp-mode-map)
358 (set-syntax-table emacs-lisp-mode-syntax-table)
359 (setq major-mode 'emacs-lisp-mode)
360 (setq mode-name "Emacs-Lisp")
361 (lisp-mode-variables)
362 (setq imenu-case-fold-search nil)
363 (run-mode-hooks 'emacs-lisp-mode-hook))
364 (put 'emacs-lisp-mode 'custom-mode-group 'lisp)
366 (defvar lisp-mode-map
367 (let ((map (make-sparse-keymap)))
368 (set-keymap-parent map lisp-mode-shared-map)
369 (define-key map "\e\C-x" 'lisp-eval-defun)
370 (define-key map "\C-c\C-z" 'run-lisp)
372 "Keymap for ordinary Lisp mode.
373 All commands in `lisp-mode-shared-map' are inherited by this map.")
376 "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
378 Delete converts tabs to spaces as it moves back.
379 Blank lines separate paragraphs. Semicolons start comments.
381 Note that `run-lisp' may be used either to start an inferior Lisp job
382 or to switch back to an existing one.
384 Entry to this mode calls the value of `lisp-mode-hook'
385 if that value is non-nil."
387 (kill-all-local-variables)
388 (use-local-map lisp-mode-map)
389 (setq major-mode 'lisp-mode)
390 (setq mode-name "Lisp")
391 (lisp-mode-variables)
392 (make-local-variable 'comment-start-skip)
393 (setq comment-start-skip
394 "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
395 (make-local-variable 'font-lock-keywords-case-fold-search)
396 (setq font-lock-keywords-case-fold-search t)
397 (setq imenu-case-fold-search t)
398 (set-syntax-table lisp-mode-syntax-table)
399 (run-mode-hooks 'lisp-mode-hook))
400 (put 'lisp-mode 'find-tag-default-function 'lisp-find-tag-default)
402 (defun lisp-find-tag-default ()
403 (let ((default (find-tag-default)))
404 (when (stringp default)
405 (if (string-match ":+" default)
406 (substring default (match-end 0))
409 ;; Used in old LispM code.
410 (defalias 'common-lisp-mode 'lisp-mode)
412 ;; This will do unless inf-lisp.el is loaded.
413 (defun lisp-eval-defun (&optional and-go)
414 "Send the current defun to the Lisp process made by \\[run-lisp]."
416 (error "Process lisp does not exist"))
418 (defvar lisp-interaction-mode-map
419 (let ((map (make-sparse-keymap)))
420 (set-keymap-parent map lisp-mode-shared-map)
421 (define-key map "\e\C-x" 'eval-defun)
422 (define-key map "\e\C-q" 'indent-pp-sexp)
423 (define-key map "\e\t" 'lisp-complete-symbol)
424 (define-key map "\n" 'eval-print-last-sexp)
426 "Keymap for Lisp Interaction mode.
427 All commands in `lisp-mode-shared-map' are inherited by this map.")
429 (defvar lisp-interaction-mode-abbrev-table lisp-mode-abbrev-table)
430 (define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction"
431 "Major mode for typing and evaluating Lisp forms.
432 Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression
433 before point, and prints its value into the buffer, advancing point.
434 Note that printing is controlled by `eval-expression-print-length'
435 and `eval-expression-print-level'.
438 Delete converts tabs to spaces as it moves back.
439 Paragraphs are separated only by blank lines.
440 Semicolons start comments.
441 \\{lisp-interaction-mode-map}
442 Entry to this mode calls the value of `lisp-interaction-mode-hook'
443 if that value is non-nil.")
445 (defun eval-print-last-sexp ()
446 "Evaluate sexp before point; print value into current buffer.
448 If `eval-expression-debug-on-error' is non-nil, which is the default,
449 this command arranges for all errors to enter the debugger.
451 Note that printing the result is controlled by the variables
452 `eval-expression-print-length' and `eval-expression-print-level',
455 (let ((standard-output (current-buffer)))
461 (defun last-sexp-setup-props (beg end value alt1 alt2)
462 "Set up text properties for the output of `eval-last-sexp-1'.
463 BEG and END are the start and end of the output in current-buffer.
464 VALUE is the Lisp value printed, ALT1 and ALT2 are strings for the
465 alternative printed representations that can be displayed."
466 (let ((map (make-sparse-keymap)))
467 (define-key map "\C-m" 'last-sexp-toggle-display)
468 (define-key map [down-mouse-2] 'mouse-set-point)
469 (define-key map [mouse-2] 'last-sexp-toggle-display)
472 `(printed-value (,value ,alt1 ,alt2)
475 help-echo "RET, mouse-2: toggle abbreviated display"
476 rear-nonsticky (mouse-face keymap help-echo
480 (defun last-sexp-toggle-display (&optional arg)
481 "Toggle between abbreviated and unabbreviated printed representations."
485 (let ((value (get-text-property (point) 'printed-value)))
487 (let ((beg (or (previous-single-property-change (min (point-max) (1+ (point)))
490 (end (or (next-single-char-property-change (point) 'printed-value) (point)))
491 (standard-output (current-buffer))
493 (delete-region beg end)
494 (insert (nth 1 value))
496 (setq point (1- (point))))
497 (last-sexp-setup-props beg (point)
501 (goto-char (min (point-max) point)))))))
503 (defun prin1-char (char)
504 "Return a string representing CHAR as a character rather than as an integer.
505 If CHAR is not a character, return nil."
508 (let ((c (event-basic-type char))
509 (mods (event-modifiers char))
511 ;; Prevent ?A from turning into ?\S-a.
512 (if (and (memq 'shift mods)
513 (zerop (logand char ?\S-\^@))
514 (not (let ((case-fold-search nil))
515 (char-equal c (upcase c)))))
516 (setq c (upcase c) mods nil))
517 ;; What string are we considering using?
524 (cond ((eq modif 'super) "\\s-")
525 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-))))
528 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
533 ;; Verify the string reads a CHAR, not to some other character.
534 ;; If it doesn't, return nil instead.
536 (= (car (read-from-string string)) char)
540 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
541 "Evaluate sexp before point; print value in minibuffer.
542 With argument, print output into current buffer."
543 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t)))
545 (eval (let ((stab (syntax-table))
550 (with-syntax-table emacs-lisp-mode-syntax-table
551 ;; If this sexp appears to be enclosed in `...'
552 ;; then ignore the surrounding quotes.
554 (or (eq (following-char) ?\')
555 (eq (preceding-char) ?\')))
557 ;; If we were after `?\e' (or similar case),
558 ;; use the whole thing, not just the `e'.
559 (when (eq (preceding-char) ?\\)
561 (when (eq (preceding-char) ??)
565 (when (eq (preceding-char) ?=)
568 (skip-chars-backward "0-9#=")
569 (setq labeled-p (looking-at "\\(#[0-9]+=\\)+")))
574 ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in
575 ;; `variable' so that the value is returned, not the
577 (if (and ignore-quotes
578 (eq (following-char) ?`))
580 (narrow-to-region (point-min) opoint)
581 (setq expr (read (current-buffer)))
582 ;; If it's an (interactive ...) form, it's more
583 ;; useful to show how an interactive call would
586 (eq (car expr) 'interactive)
588 (list 'call-interactively
595 (eval-last-sexp-print-value value))))
597 (defun eval-last-sexp-print-value (value)
598 (let ((unabbreviated (let ((print-length nil) (print-level nil))
599 (prin1-to-string value)))
600 (print-length eval-expression-print-length)
601 (print-level eval-expression-print-level)
606 (let ((str (eval-expression-print-format value)))
607 (if str (princ str)))
609 (when (and (bufferp standard-output)
610 (or (not (null print-length))
611 (not (null print-level)))
612 (not (string= unabbreviated
613 (buffer-substring-no-properties beg end))))
614 (last-sexp-setup-props beg end value
616 (buffer-substring-no-properties beg end))
620 (defvar eval-last-sexp-fake-value (make-symbol "t"))
622 (defun eval-last-sexp (eval-last-sexp-arg-internal)
623 "Evaluate sexp before point; print value in minibuffer.
624 Interactively, with prefix argument, print output into current buffer.
626 If `eval-expression-debug-on-error' is non-nil, which is the default,
627 this command arranges for all errors to enter the debugger."
629 (if (null eval-expression-debug-on-error)
630 (eval-last-sexp-1 eval-last-sexp-arg-internal)
631 (let ((old-value eval-last-sexp-fake-value) new-value value)
632 (let ((debug-on-error old-value))
633 (setq value (eval-last-sexp-1 eval-last-sexp-arg-internal))
634 (setq new-value debug-on-error))
635 (unless (eq old-value new-value)
636 (setq debug-on-error new-value))
639 (defun eval-defun-1 (form)
640 "Treat some expressions specially.
641 Reset the `defvar' and `defcustom' variables to the initial value.
642 Reinitialize the face according to the `defface' specification."
643 ;; The code in edebug-defun should be consistent with this, but not
644 ;; the same, since this gets a macroexpended form.
645 (cond ((not (listp form))
647 ((and (eq (car form) 'defvar)
648 (cdr-safe (cdr-safe form))
649 (boundp (cadr form)))
650 ;; Force variable to be re-set.
651 `(progn (defvar ,(nth 1 form) nil ,@(nthcdr 3 form))
652 (setq-default ,(nth 1 form) ,(nth 2 form))))
653 ;; `defcustom' is now macroexpanded to
654 ;; `custom-declare-variable' with a quoted value arg.
655 ((and (eq (car form) 'custom-declare-variable)
656 (default-boundp (eval (nth 1 form))))
657 ;; Force variable to be bound.
658 (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form))))
660 ;; `defface' is macroexpanded to `custom-declare-face'.
661 ((eq (car form) 'custom-declare-face)
663 (setq face-new-frame-defaults
664 (assq-delete-all (eval (nth 1 form)) face-new-frame-defaults))
665 (put (eval (nth 1 form)) 'face-defface-spec nil)
666 ;; Setting `customized-face' to the new spec after calling
667 ;; the form, but preserving the old saved spec in `saved-face',
668 ;; imitates the situation when the new face spec is set
669 ;; temporarily for the current session in the customize
670 ;; buffer, thus allowing `face-user-default-spec' to use the
671 ;; new customized spec instead of the saved spec.
672 ;; Resetting `saved-face' temporarily to nil is needed to let
673 ;; `defface' change the spec, regardless of a saved spec.
675 (put ,(nth 1 form) 'saved-face
676 ',(get (eval (nth 1 form)) 'saved-face))
677 (put ,(nth 1 form) 'customized-face
679 (put (eval (nth 1 form)) 'saved-face nil)))
680 ((eq (car form) 'progn)
681 (cons 'progn (mapcar 'eval-defun-1 (cdr form))))
684 (defun eval-defun-2 ()
685 "Evaluate defun that point is in or before.
686 The value is displayed in the minibuffer.
687 If the current defun is actually a call to `defvar',
688 then reset the variable using the initial value expression
689 even if the variable already has some other value.
690 \(Normally `defvar' does not change the variable's value
691 if it already has a value.\)
693 With argument, insert value in current buffer after the defun.
694 Return the result of evaluation."
696 (let ((debug-on-error eval-expression-debug-on-error)
697 (print-length eval-expression-print-length)
698 (print-level eval-expression-print-level))
700 ;; Arrange for eval-region to "read" the (possibly) altered form.
701 ;; eval-region handles recording which file defines a function or
702 ;; variable. Re-written using `apply' to avoid capturing
703 ;; variables like `end'.
706 (let ((standard-output t)
708 ;; Read the form from the buffer, and record where it ends.
713 (setq form (read (current-buffer)))
715 ;; Alter the form if necessary.
716 (setq form (eval-defun-1 (macroexpand form)))
717 (list beg end standard-output
719 ;; Skipping to the end of the specified region
720 ;; will make eval-region return.
723 ;; The result of evaluation has been put onto VALUES. So return it.
726 (defun eval-defun (edebug-it)
727 "Evaluate the top-level form containing point, or after point.
729 If the current defun is actually a call to `defvar' or `defcustom',
730 evaluating it this way resets the variable using its initial value
731 expression even if the variable already has some other value.
732 \(Normally `defvar' and `defcustom' do not alter the value if there
735 If `eval-expression-debug-on-error' is non-nil, which is the default,
736 this command arranges for all errors to enter the debugger.
738 With a prefix argument, instrument the code for Edebug.
740 If acting on a `defun' for FUNCTION, and the function was
741 instrumented, `Edebug: FUNCTION' is printed in the minibuffer. If not
742 instrumented, just FUNCTION is printed.
744 If not acting on a `defun', the result of evaluation is displayed in
745 the minibuffer. This display is controlled by the variables
746 `eval-expression-print-length' and `eval-expression-print-level',
751 (eval-defun (not edebug-all-defs)))
753 (if (null eval-expression-debug-on-error)
755 (let ((old-value (make-symbol "t")) new-value value)
756 (let ((debug-on-error old-value))
757 (setq value (eval-defun-2))
758 (setq new-value debug-on-error))
759 (unless (eq old-value new-value)
760 (setq debug-on-error new-value))
763 ;; May still be used by some external Lisp-mode variant.
764 (define-obsolete-function-alias 'lisp-comment-indent 'comment-indent-default)
766 ;; This function just forces a more costly detection of comments (using
767 ;; parse-partial-sexp from beginning-of-defun). I.e. It avoids the problem of
768 ;; taking a `;' inside a string started on another line for a comment starter.
769 ;; Note: `newcomment' gets it right now since we set comment-use-global-state
770 ;; so we could get rid of it. -stef
771 (defun lisp-mode-auto-fill ()
772 (if (> (current-column) (current-fill-column))
774 (nth 4 (syntax-ppss (point))))
776 (unless (and (boundp 'comment-auto-fill-only-comments)
777 comment-auto-fill-only-comments)
778 (let ((comment-start nil) (comment-start-skip nil))
781 (defvar lisp-indent-offset nil
782 "If non-nil, indent second line of expressions that many more columns.")
783 (defvar lisp-indent-function 'lisp-indent-function)
785 (defun lisp-indent-line (&optional whole-exp)
786 "Indent current line as Lisp code.
787 With argument, indent any additional lines of the same expression
788 rigidly along with this one."
790 (let ((indent (calculate-lisp-indent)) shift-amt end
791 (pos (- (point-max) (point)))
792 (beg (progn (beginning-of-line) (point))))
793 (skip-chars-forward " \t")
794 (if (or (null indent) (looking-at "\\s<\\s<\\s<"))
795 ;; Don't alter indentation of a ;;; comment line
796 ;; or a line that starts in a string.
797 (goto-char (- (point-max) pos))
798 (if (and (looking-at "\\s<") (not (looking-at "\\s<\\s<")))
799 ;; Single-semicolon comment lines should be indented
800 ;; as comment lines, not as code.
801 (progn (indent-for-comment) (forward-char -1))
802 (if (listp indent) (setq indent (car indent)))
803 (setq shift-amt (- indent (current-column)))
804 (if (zerop shift-amt)
806 (delete-region beg (point))
808 ;; If initial point was within line's indentation,
809 ;; position after the indentation. Else stay at same point in text.
810 (if (> (- (point-max) pos) (point))
811 (goto-char (- (point-max) pos)))
812 ;; If desired, shift remaining lines of expression the same amount.
813 (and whole-exp (not (zerop shift-amt))
822 (indent-code-rigidly beg end shift-amt)))))
824 (defvar calculate-lisp-indent-last-sexp)
826 (defun calculate-lisp-indent (&optional parse-start)
827 "Return appropriate indentation for current line as Lisp code.
828 In usual case returns an integer: the column to indent to.
829 If the value is nil, that means don't change the indentation
830 because the line starts inside a string.
832 The value can also be a list of the form (COLUMN CONTAINING-SEXP-START).
833 This means that following lines at the same level of indentation
834 should not necessarily be indented the same as this line.
835 Then COLUMN is the column to indent to, and CONTAINING-SEXP-START
836 is the buffer position of the start of the containing expression."
839 (let ((indent-point (point))
841 ;; setting this to a number inhibits calling hook
844 calculate-lisp-indent-last-sexp containing-sexp)
846 (goto-char parse-start)
847 (beginning-of-defun))
848 ;; Find outermost containing sexp
849 (while (< (point) indent-point)
850 (setq state (parse-partial-sexp (point) indent-point 0)))
851 ;; Find innermost containing sexp
854 (> (setq paren-depth (elt state 0)) 0))
856 (setq calculate-lisp-indent-last-sexp (elt state 2))
857 (setq containing-sexp (elt state 1))
858 ;; Position following last unclosed open.
859 (goto-char (1+ containing-sexp))
860 ;; Is there a complete sexp since then?
861 (if (and calculate-lisp-indent-last-sexp
862 (> calculate-lisp-indent-last-sexp (point)))
863 ;; Yes, but is there a containing sexp after that?
864 (let ((peek (parse-partial-sexp calculate-lisp-indent-last-sexp
866 (if (setq retry (car (cdr peek))) (setq state peek)))))
869 ;; Innermost containing sexp found
870 (goto-char (1+ containing-sexp))
871 (if (not calculate-lisp-indent-last-sexp)
872 ;; indent-point immediately follows open paren.
874 (setq desired-indent (current-column))
875 ;; Find the start of first element of containing sexp.
876 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
877 (cond ((looking-at "\\s(")
878 ;; First element of containing sexp is a list.
879 ;; Indent under that list.
881 ((> (save-excursion (forward-line 1) (point))
882 calculate-lisp-indent-last-sexp)
883 ;; This is the first line to start within the containing sexp.
884 ;; It's almost certainly a function call.
885 (if (= (point) calculate-lisp-indent-last-sexp)
886 ;; Containing sexp has nothing before this line
887 ;; except the first element. Indent under that element.
889 ;; Skip the first element, find start of second (the first
890 ;; argument of the function call) and indent under.
891 (progn (forward-sexp 1)
892 (parse-partial-sexp (point)
893 calculate-lisp-indent-last-sexp
895 (backward-prefix-chars))
897 ;; Indent beneath first sexp on same line as
898 ;; `calculate-lisp-indent-last-sexp'. Again, it's
899 ;; almost certainly a function call.
900 (goto-char calculate-lisp-indent-last-sexp)
902 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp
904 (backward-prefix-chars)))))
905 ;; Point is at the point to indent under unless we are inside a string.
906 ;; Call indentation hook except when overridden by lisp-indent-offset
907 ;; or if the desired indentation has already been computed.
908 (let ((normal-indent (current-column)))
910 ;; Inside a string, don't change indentation.
912 ((and (integerp lisp-indent-offset) containing-sexp)
913 ;; Indent by constant offset
914 (goto-char containing-sexp)
915 (+ (current-column) lisp-indent-offset))
917 ((and (boundp 'lisp-indent-function)
920 (or (funcall lisp-indent-function indent-point state)
925 (defun lisp-indent-function (indent-point state)
926 "This function is the normal value of the variable `lisp-indent-function'.
927 It is used when indenting a line within a function call, to see if the
928 called function says anything special about how to indent the line.
930 INDENT-POINT is the position where the user typed TAB, or equivalent.
931 Point is located at the point to indent under (for default indentation);
932 STATE is the `parse-partial-sexp' state for that position.
934 If the current line is in a call to a Lisp function
935 which has a non-nil property `lisp-indent-function',
936 that specifies how to do the indentation. The property value can be
937 * `defun', meaning indent `defun'-style;
938 * an integer N, meaning indent the first N arguments specially
939 like ordinary function arguments and then indent any further
940 arguments like a body;
941 * a function to call just as this function was called.
942 If that function returns nil, that means it doesn't specify
945 This function also returns nil meaning don't specify the indentation."
946 (let ((normal-indent (current-column)))
947 (goto-char (1+ (elt state 1)))
948 (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
949 (if (and (elt state 2)
950 (not (looking-at "\\sw\\|\\s_")))
951 ;; car of form doesn't seem to be a symbol
953 (if (not (> (save-excursion (forward-line 1) (point))
954 calculate-lisp-indent-last-sexp))
955 (progn (goto-char calculate-lisp-indent-last-sexp)
957 (parse-partial-sexp (point)
958 calculate-lisp-indent-last-sexp 0 t)))
959 ;; Indent under the list or under the first sexp on the same
960 ;; line as calculate-lisp-indent-last-sexp. Note that first
961 ;; thing on that line has to be complete sexp since we are
962 ;; inside the innermost containing sexp.
963 (backward-prefix-chars)
965 (let ((function (buffer-substring (point)
966 (progn (forward-sexp 1) (point))))
968 (setq method (or (get (intern-soft function) 'lisp-indent-function)
969 (get (intern-soft function) 'lisp-indent-hook)))
970 (cond ((or (eq method 'defun)
972 (> (length function) 3)
973 (string-match "\\`def" function)))
974 (lisp-indent-defform state indent-point))
976 (lisp-indent-specform method state
977 indent-point normal-indent))
979 (funcall method indent-point state)))))))
981 (defvar lisp-body-indent 2
982 "Number of columns to indent the second line of a `(def...)' form.")
984 (defun lisp-indent-specform (count state indent-point normal-indent)
985 (let ((containing-form-start (elt state 1))
987 body-indent containing-form-column)
988 ;; Move to the start of containing form, calculate indentation
989 ;; to use for non-distinguished forms (> count), and move past the
990 ;; function symbol. lisp-indent-function guarantees that there is at
991 ;; least one word or symbol character following open paren of containing
993 (goto-char containing-form-start)
994 (setq containing-form-column (current-column))
995 (setq body-indent (+ lisp-body-indent containing-form-column))
998 ;; Now find the start of the last form.
999 (parse-partial-sexp (point) indent-point 1 t)
1000 (while (and (< (point) indent-point)
1003 (setq count (1- count))
1005 (parse-partial-sexp (point) indent-point 1 t))
1007 ;; Point is sitting on first character of last (or count) sexp.
1009 ;; A distinguished form. If it is the first or second form use double
1010 ;; lisp-body-indent, else normal indent. With lisp-body-indent bound
1011 ;; to 2 (the default), this just happens to work the same with if as
1012 ;; the older code, but it makes unwind-protect, condition-case,
1013 ;; with-output-to-temp-buffer, et. al. much more tasteful. The older,
1014 ;; less hacked, behavior can be obtained by replacing below with
1015 ;; (list normal-indent containing-form-start).
1016 (if (<= (- i count) 1)
1017 (list (+ containing-form-column (* 2 lisp-body-indent))
1018 containing-form-start)
1019 (list normal-indent containing-form-start))
1020 ;; A non-distinguished form. Use body-indent if there are no
1021 ;; distinguished forms and this is the first undistinguished form,
1022 ;; or if this is the first undistinguished form and the preceding
1023 ;; distinguished form has indentation at least as great as body-indent.
1024 (if (or (and (= i 0) (= count 0))
1025 (and (= count 0) (<= body-indent normal-indent)))
1029 (defun lisp-indent-defform (state indent-point)
1030 (goto-char (car (cdr state)))
1032 (if (> (point) (car (cdr (cdr state))))
1034 (goto-char (car (cdr state)))
1035 (+ lisp-body-indent (current-column)))))
1038 ;; (put 'progn 'lisp-indent-function 0), say, causes progn to be indented
1039 ;; like defun if the first form is placed on the next line, otherwise
1040 ;; it is indented like any other form (i.e. forms line up under first).
1042 (put 'lambda 'lisp-indent-function 'defun)
1043 (put 'autoload 'lisp-indent-function 'defun)
1044 (put 'progn 'lisp-indent-function 0)
1045 (put 'prog1 'lisp-indent-function 1)
1046 (put 'prog2 'lisp-indent-function 2)
1047 (put 'save-excursion 'lisp-indent-function 0)
1048 (put 'save-window-excursion 'lisp-indent-function 0)
1049 (put 'save-selected-window 'lisp-indent-function 0)
1050 (put 'save-restriction 'lisp-indent-function 0)
1051 (put 'save-match-data 'lisp-indent-function 0)
1052 (put 'save-current-buffer 'lisp-indent-function 0)
1053 (put 'with-current-buffer 'lisp-indent-function 1)
1054 (put 'combine-after-change-calls 'lisp-indent-function 0)
1055 (put 'with-output-to-string 'lisp-indent-function 0)
1056 (put 'with-temp-file 'lisp-indent-function 1)
1057 (put 'with-temp-buffer 'lisp-indent-function 0)
1058 (put 'with-temp-message 'lisp-indent-function 1)
1059 (put 'with-syntax-table 'lisp-indent-function 1)
1060 (put 'let 'lisp-indent-function 1)
1061 (put 'let* 'lisp-indent-function 1)
1062 (put 'while 'lisp-indent-function 1)
1063 (put 'if 'lisp-indent-function 2)
1064 (put 'read-if 'lisp-indent-function 2)
1065 (put 'catch 'lisp-indent-function 1)
1066 (put 'condition-case 'lisp-indent-function 2)
1067 (put 'unwind-protect 'lisp-indent-function 1)
1068 (put 'with-output-to-temp-buffer 'lisp-indent-function 1)
1069 (put 'eval-after-load 'lisp-indent-function 1)
1070 (put 'dolist 'lisp-indent-function 1)
1071 (put 'dotimes 'lisp-indent-function 1)
1072 (put 'when 'lisp-indent-function 1)
1073 (put 'unless 'lisp-indent-function 1)
1075 (defun indent-sexp (&optional endpos)
1076 "Indent each line of the list starting just after point.
1077 If optional arg ENDPOS is given, indent each line, stopping when
1078 ENDPOS is encountered."
1080 (let ((indent-stack (list nil))
1082 ;; If ENDPOS is non-nil, use nil as STARTING-POINT
1083 ;; so that calculate-lisp-indent will find the beginning of
1084 ;; the defun we are in.
1085 ;; If ENDPOS is nil, it is safe not to scan before point
1086 ;; since every line we indent is more deeply nested than point is.
1087 (starting-point (if endpos nil (point)))
1088 (last-point (point))
1089 last-depth bol outer-loop-done inner-loop-done state this-indent)
1091 ;; Get error now if we don't have a complete sexp after point.
1092 (save-excursion (forward-sexp 1)))
1094 (setq outer-loop-done nil)
1095 (while (if endpos (< (point) endpos)
1096 (not outer-loop-done))
1097 (setq last-depth next-depth
1098 inner-loop-done nil)
1099 ;; Parse this line so we can learn the state
1100 ;; to indent the next line.
1101 ;; This inner loop goes through only once
1102 ;; unless a line ends inside a string.
1103 (while (and (not inner-loop-done)
1104 (not (setq outer-loop-done (eobp))))
1105 (setq state (parse-partial-sexp (point) (progn (end-of-line) (point))
1107 (setq next-depth (car state))
1108 ;; If the line contains a comment other than the sort
1109 ;; that is indented like code,
1110 ;; indent it now with indent-for-comment.
1111 ;; Comments indented like code are right already.
1112 ;; In any case clear the in-comment flag in the state
1113 ;; because parse-partial-sexp never sees the newlines.
1114 (if (car (nthcdr 4 state))
1115 (progn (indent-for-comment)
1117 (setcar (nthcdr 4 state) nil)))
1118 ;; If this line ends inside a string,
1119 ;; go straight to next line, remaining within the inner loop,
1120 ;; and turn off the \-flag.
1121 (if (car (nthcdr 3 state))
1124 (setcar (nthcdr 5 state) nil))
1125 (setq inner-loop-done t)))
1129 (setq indent-stack (nconc indent-stack
1130 (make-list (- next-depth) nil))
1131 last-depth (- last-depth next-depth)
1133 (or outer-loop-done endpos
1134 (setq outer-loop-done (<= next-depth 0)))
1137 (while (> last-depth next-depth)
1138 (setq indent-stack (cdr indent-stack)
1139 last-depth (1- last-depth)))
1140 (while (< last-depth next-depth)
1141 (setq indent-stack (cons nil indent-stack)
1142 last-depth (1+ last-depth)))
1143 ;; Now go to the next line and indent it according
1144 ;; to what we learned from parsing the previous one.
1147 (skip-chars-forward " \t")
1148 ;; But not if the line is blank, or just a comment
1149 ;; (except for double-semi comments; indent them as usual).
1150 (if (or (eobp) (looking-at "\\s<\\|\n"))
1152 (if (and (car indent-stack)
1153 (>= (car indent-stack) 0))
1154 (setq this-indent (car indent-stack))
1155 (let ((val (calculate-lisp-indent
1156 (if (car indent-stack) (- (car indent-stack))
1159 (setq this-indent val)
1161 (setcar indent-stack
1162 (setq this-indent val))
1163 (setcar indent-stack (- (car (cdr val))))
1164 (setq this-indent (car val))))))
1165 (if (and this-indent (/= (current-column) this-indent))
1166 (progn (delete-region bol (point))
1167 (indent-to this-indent)))))
1169 (setq outer-loop-done (= (point) last-point))
1170 (setq last-point (point)))))))
1172 (defun lisp-indent-region (start end)
1173 "Indent every line whose first char is between START and END inclusive."
1175 (let ((endmark (copy-marker end)))
1177 (and (bolp) (not (eolp))
1179 (indent-sexp endmark)
1180 (set-marker endmark nil))))
1182 (defun indent-pp-sexp (&optional arg)
1183 "Indent each line of the list starting just after point, or prettyprint it.
1184 A prefix argument specifies pretty-printing."
1189 (narrow-to-region (point) (progn (forward-sexp 1) (point)))
1191 (goto-char (point-max))
1192 (if (eq (char-before) ?\n)
1193 (delete-char -1)))))
1196 ;;;; Lisp paragraph filling commands.
1198 (defcustom emacs-lisp-docstring-fill-column 65
1199 "Value of `fill-column' to use when filling a docstring.
1200 Any non-integer value means do not use a different value of
1201 `fill-column' when filling docstrings."
1202 :type '(choice (integer)
1203 (const :tag "Use the current `fill-column'" t))
1206 (defun lisp-fill-paragraph (&optional justify)
1207 "Like \\[fill-paragraph], but handle Emacs Lisp comments and docstrings.
1208 If any of the current line is a comment, fill the comment or the
1209 paragraph of it that point is in, preserving the comment's indentation
1210 and initial semicolons."
1212 (or (fill-comment-paragraph justify)
1213 ;; Since fill-comment-paragraph returned nil, that means we're not in
1214 ;; a comment: Point is on a program line; we are interested
1215 ;; particularly in docstring lines.
1217 ;; We bind `paragraph-start' and `paragraph-separate' temporarily. They
1218 ;; are buffer-local, but we avoid changing them so that they can be set
1219 ;; to make `forward-paragraph' and friends do something the user wants.
1221 ;; `paragraph-start': The `(' in the character alternative and the
1222 ;; left-singlequote plus `(' sequence after the \\| alternative prevent
1223 ;; sexps and backquoted sexps that follow a docstring from being filled
1224 ;; with the docstring. This setting has the consequence of inhibiting
1225 ;; filling many program lines that are not docstrings, which is sensible,
1226 ;; because the user probably asked to fill program lines by accident, or
1227 ;; expecting indentation (perhaps we should try to do indenting in that
1228 ;; case). The `;' and `:' stop the paragraph being filled at following
1229 ;; comment lines and at keywords (e.g., in `defcustom'). Left parens are
1230 ;; escaped to keep font-locking, filling, & paren matching in the source
1233 ;; `paragraph-separate': A clever regexp distinguishes the first line of
1234 ;; a docstring and identifies it as a paragraph separator, so that it
1235 ;; won't be filled. (Since the first line of documentation stands alone
1236 ;; in some contexts, filling should not alter the contents the author has
1237 ;; chosen.) Only the first line of a docstring begins with whitespace
1238 ;; and a quotation mark and ends with a period or (rarely) a comma.
1240 ;; The `fill-column' is temporarily bound to
1241 ;; `emacs-lisp-docstring-fill-column' if that value is an integer.
1242 (let ((paragraph-start (concat paragraph-start
1243 "\\|\\s-*\\([(;:\"]\\|`(\\|#'(\\)"))
1245 (concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
1246 (fill-column (if (integerp emacs-lisp-docstring-fill-column)
1247 emacs-lisp-docstring-fill-column
1249 (fill-paragraph justify))
1250 ;; Never return nil.
1253 (defun indent-code-rigidly (start end arg &optional nochange-regexp)
1254 "Indent all lines of code, starting in the region, sideways by ARG columns.
1255 Does not affect lines starting inside comments or strings, assuming that
1256 the start of the region is not inside them.
1258 Called from a program, takes args START, END, COLUMNS and NOCHANGE-REGEXP.
1259 The last is a regexp which, if matched at the beginning of a line,
1260 means don't indent that line."
1261 (interactive "r\np")
1265 (setq end (point-marker))
1268 (setq state (parse-partial-sexp (point)
1270 (forward-line 1) (point))
1272 (while (< (point) end)
1273 (or (car (nthcdr 3 state))
1274 (and nochange-regexp
1275 (looking-at nochange-regexp))
1276 ;; If line does not start in string, indent it
1277 (let ((indent (current-indentation)))
1278 (delete-region (point) (progn (skip-chars-forward " \t") (point)))
1280 (indent-to (max 0 (+ indent arg)) 0))))
1281 (setq state (parse-partial-sexp (point)
1283 (forward-line 1) (point))
1286 (provide 'lisp-mode)
1288 ;; arch-tag: 414c7f93-c245-4b77-8ed5-ed05ef7ff1bf
1289 ;;; lisp-mode.el ends here