Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 35279:139991123d49
(lisp-mode-shared-map): Bind `backspace' to `backward-delete-char-untabify'.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Fri, 12 Jan 2001 18:07:31 +0000 |
parents | bf44a3e27334 |
children | 0f77c1f47579 |
comparison
equal
deleted
inserted
replaced
35278:80050ac10dbf | 35279:139991123d49 |
---|---|
80 | 80 |
81 (define-abbrev-table 'lisp-mode-abbrev-table ()) | 81 (define-abbrev-table 'lisp-mode-abbrev-table ()) |
82 | 82 |
83 (defvar lisp-imenu-generic-expression | 83 (defvar lisp-imenu-generic-expression |
84 (list | 84 (list |
85 (list nil | 85 (list nil |
86 (purecopy "^\\s-*(def\\(un\\*?\\|subst\\|macro\\|advice\\|\ | 86 (purecopy "^\\s-*(def\\(un\\*?\\|subst\\|macro\\|advice\\|\ |
87 ine-skeleton\\|ine-minor-mode\\)\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)") 2) | 87 ine-skeleton\\|ine-minor-mode\\)\\s-+\\(\\sw\\(\\sw\\|\\s_\\)+\\)") 2) |
88 (list (purecopy "Variables") | 88 (list (purecopy "Variables") |
89 (purecopy "^\\s-*(def\\(var\\|const\\|custom\\)\\s-+\ | 89 (purecopy "^\\s-*(def\\(var\\|const\\|custom\\)\\s-+\ |
90 \\(\\sw\\(\\sw\\|\\s_\\)+\\)") 2) | 90 \\(\\sw\\(\\sw\\|\\s_\\)+\\)") 2) |
91 (list (purecopy "Types") | 91 (list (purecopy "Types") |
92 (purecopy "^\\s-*(def\\(group\\|type\\|struct\\|class\\|\ | 92 (purecopy "^\\s-*(def\\(group\\|type\\|struct\\|class\\|\ |
93 ine-condition\\|ine-widget\\|face\\)\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)") | 93 ine-condition\\|ine-widget\\|face\\)\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)") |
94 2)) | 94 2)) |
95 | 95 |
96 "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") | 96 "Imenu generic expression for Lisp mode. See `imenu-generic-expression'.") |
97 | 97 |
98 (defun lisp-mode-variables (lisp-syntax) | 98 (defun lisp-mode-variables (lisp-syntax) |
151 (if (looking-at "(") | 151 (if (looking-at "(") |
152 1000 | 152 1000 |
153 (looking-at outline-regexp) | 153 (looking-at outline-regexp) |
154 (- (match-end 0) (match-beginning 0)))) | 154 (- (match-end 0) (match-beginning 0)))) |
155 | 155 |
156 | 156 |
157 (defvar lisp-mode-shared-map | 157 (defvar lisp-mode-shared-map |
158 (let ((map (make-sparse-keymap))) | 158 (let ((map (make-sparse-keymap))) |
159 (define-key map "\e\C-q" 'indent-sexp) | 159 (define-key map "\e\C-q" 'indent-sexp) |
160 (define-key map "\177" 'backward-delete-char-untabify) | 160 (define-key map "\177" 'backward-delete-char-untabify) |
161 (define-key map [backspace] 'backward-delete-char-untabify) | |
161 map) | 162 map) |
162 "Keymap for commands shared by all sorts of Lisp modes.") | 163 "Keymap for commands shared by all sorts of Lisp modes.") |
163 | 164 |
164 (defvar emacs-lisp-mode-map () | 165 (defvar emacs-lisp-mode-map () |
165 "Keymap for Emacs Lisp mode. | 166 "Keymap for Emacs Lisp mode. |
304 (interactive) | 305 (interactive) |
305 (let ((standard-output (current-buffer))) | 306 (let ((standard-output (current-buffer))) |
306 (terpri) | 307 (terpri) |
307 (eval-last-sexp t) | 308 (eval-last-sexp t) |
308 (terpri))) | 309 (terpri))) |
309 | 310 |
310 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) | 311 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
311 "Evaluate sexp before point; print value in minibuffer. | 312 "Evaluate sexp before point; print value in minibuffer. |
312 With argument, print output into current buffer." | 313 With argument, print output into current buffer." |
313 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) | 314 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) |
314 (let ((value | 315 (let ((value |
329 ;; use the whole thing, not just the `e'. | 330 ;; use the whole thing, not just the `e'. |
330 (when (eq (preceding-char) ?\\) | 331 (when (eq (preceding-char) ?\\) |
331 (forward-char -1) | 332 (forward-char -1) |
332 (when (eq (preceding-char) ??) | 333 (when (eq (preceding-char) ??) |
333 (forward-char -1))) | 334 (forward-char -1))) |
334 | 335 |
335 ;; Skip over `#N='s. | 336 ;; Skip over `#N='s. |
336 (when (eq (preceding-char) ?=) | 337 (when (eq (preceding-char) ?=) |
337 (let (labeled-p) | 338 (let (labeled-p) |
338 (save-excursion | 339 (save-excursion |
339 (skip-chars-backward "0-9#=") | 340 (skip-chars-backward "0-9#=") |
342 (forward-sexp -1)))) | 343 (forward-sexp -1)))) |
343 | 344 |
344 (save-restriction | 345 (save-restriction |
345 ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in | 346 ;; vladimir@cs.ualberta.ca 30-Jul-1997: skip ` in |
346 ;; `variable' so that the value is returned, not the | 347 ;; `variable' so that the value is returned, not the |
347 ;; name | 348 ;; name |
348 (if (and ignore-quotes | 349 (if (and ignore-quotes |
349 (eq (following-char) ?`)) | 350 (eq (following-char) ?`)) |
350 (forward-char)) | 351 (forward-char)) |
351 (narrow-to-region (point-min) opoint) | 352 (narrow-to-region (point-min) opoint) |
352 (setq expr (read (current-buffer))) | 353 (setq expr (read (current-buffer))) |
379 (setq value (eval-last-sexp-1 eval-last-sexp-arg-internal)) | 380 (setq value (eval-last-sexp-1 eval-last-sexp-arg-internal)) |
380 (setq new-value debug-on-error)) | 381 (setq new-value debug-on-error)) |
381 (unless (eq old-value new-value) | 382 (unless (eq old-value new-value) |
382 (setq debug-on-error new-value)) | 383 (setq debug-on-error new-value)) |
383 value))) | 384 value))) |
384 | 385 |
385 (defun eval-defun-1 (form) | 386 (defun eval-defun-1 (form) |
386 "Change defvar into defconst within FORM. | 387 "Change defvar into defconst within FORM. |
387 Likewise for other constructs as necessary." | 388 Likewise for other constructs as necessary." |
388 ;; The code in edebug-defun should be consistent with this, but not | 389 ;; The code in edebug-defun should be consistent with this, but not |
389 ;; the same, since this gets a macroexpended form. | 390 ;; the same, since this gets a macroexpended form. |
421 ;; Arrange for eval-region to "read" the (possibly) altered form. | 422 ;; Arrange for eval-region to "read" the (possibly) altered form. |
422 ;; eval-region handles recording which file defines a function or | 423 ;; eval-region handles recording which file defines a function or |
423 ;; variable. Re-written using `apply' to avoid capturing | 424 ;; variable. Re-written using `apply' to avoid capturing |
424 ;; variables like `end'. | 425 ;; variables like `end'. |
425 (apply | 426 (apply |
426 #'eval-region | 427 #'eval-region |
427 (let ((standard-output t) | 428 (let ((standard-output t) |
428 beg end form) | 429 beg end form) |
429 ;; Read the form from the buffer, and record where it ends. | 430 ;; Read the form from the buffer, and record where it ends. |
430 (save-excursion | 431 (save-excursion |
431 (end-of-defun) | 432 (end-of-defun) |
473 (setq new-value debug-on-error)) | 474 (setq new-value debug-on-error)) |
474 (unless (eq old-value new-value) | 475 (unless (eq old-value new-value) |
475 (setq debug-on-error new-value)) | 476 (setq debug-on-error new-value)) |
476 value))))) | 477 value))))) |
477 | 478 |
478 | 479 |
479 (defun lisp-comment-indent () | 480 (defun lisp-comment-indent () |
480 (if (looking-at "\\s<\\s<\\s<") | 481 (if (looking-at "\\s<\\s<\\s<") |
481 (current-column) | 482 (current-column) |
482 (if (looking-at "\\s<\\s<") | 483 (if (looking-at "\\s<\\s<") |
483 (let ((tem (or (calculate-lisp-indent) (current-column)))) | 484 (let ((tem (or (calculate-lisp-indent) (current-column)))) |
731 (if (> (point) (car (cdr (cdr state)))) | 732 (if (> (point) (car (cdr (cdr state)))) |
732 (progn | 733 (progn |
733 (goto-char (car (cdr state))) | 734 (goto-char (car (cdr state))) |
734 (+ lisp-body-indent (current-column))))) | 735 (+ lisp-body-indent (current-column))))) |
735 | 736 |
736 | 737 |
737 ;; (put 'progn 'lisp-indent-function 0), say, causes progn to be indented | 738 ;; (put 'progn 'lisp-indent-function 0), say, causes progn to be indented |
738 ;; like defun if the first form is placed on the next line, otherwise | 739 ;; like defun if the first form is placed on the next line, otherwise |
739 ;; it is indented like any other form (i.e. forms line up under first). | 740 ;; it is indented like any other form (i.e. forms line up under first). |
740 | 741 |
741 (put 'lambda 'lisp-indent-function 'defun) | 742 (put 'lambda 'lisp-indent-function 'defun) |
874 (goto-char start) | 875 (goto-char start) |
875 (and (bolp) (not (eolp)) | 876 (and (bolp) (not (eolp)) |
876 (lisp-indent-line)) | 877 (lisp-indent-line)) |
877 (indent-sexp endmark) | 878 (indent-sexp endmark) |
878 (set-marker endmark nil)))) | 879 (set-marker endmark nil)))) |
879 | 880 |
880 ;;;; Lisp paragraph filling commands. | 881 ;;;; Lisp paragraph filling commands. |
881 | 882 |
882 (defun lisp-fill-paragraph (&optional justify) | 883 (defun lisp-fill-paragraph (&optional justify) |
883 "Like \\[fill-paragraph], but handle Emacs Lisp comments. | 884 "Like \\[fill-paragraph], but handle Emacs Lisp comments. |
884 If any of the current line is a comment, fill the comment or the | 885 If any of the current line is a comment, fill the comment or the |
984 (if (looking-at fill-prefix) | 985 (if (looking-at fill-prefix) |
985 nil | 986 nil |
986 (re-search-forward comment-start-skip) | 987 (re-search-forward comment-start-skip) |
987 (point)))))))) | 988 (point)))))))) |
988 t)) | 989 t)) |
989 | 990 |
990 (defun indent-code-rigidly (start end arg &optional nochange-regexp) | 991 (defun indent-code-rigidly (start end arg &optional nochange-regexp) |
991 "Indent all lines of code, starting in the region, sideways by ARG columns. | 992 "Indent all lines of code, starting in the region, sideways by ARG columns. |
992 Does not affect lines starting inside comments or strings, assuming that | 993 Does not affect lines starting inside comments or strings, assuming that |
993 the start of the region is not inside them. | 994 the start of the region is not inside them. |
994 | 995 |