diff options
| author | Dave Love | 2000-08-20 18:12:07 +0000 |
|---|---|---|
| committer | Dave Love | 2000-08-20 18:12:07 +0000 |
| commit | e50c4203bf378337e11b6c91074ea1b8fa8389b9 (patch) | |
| tree | 6899923d7665e12cc727b6c93e83c47c62a44925 | |
| parent | 13eb63ffef79c84b5e155be9e12c6b049024938c (diff) | |
| download | emacs-e50c4203bf378337e11b6c91074ea1b8fa8389b9.tar.gz emacs-e50c4203bf378337e11b6c91074ea1b8fa8389b9.zip | |
(defun-prompt-regexp, parens-require-spaces): Doc fix.
(down-list, backward-up-list, up-list, kill-sexp)
(backward-kill-sexp, mark-sexp)): Make arg optional.
(lisp-complete-symbol): Add optional arg PREDICATE.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 62 |
2 files changed, 44 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d078aad3204..9f915e83eaa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2000-08-20 Dave Love <fx@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/lisp.el (defun-prompt-regexp, parens-require-spaces): | ||
| 4 | Doc fix. | ||
| 5 | (down-list, backward-up-list, up-list, kill-sexp) | ||
| 6 | (backward-kill-sexp, mark-sexp): Make arg optional. | ||
| 7 | (lisp-complete-symbol): Add optional arg PREDICATE. | ||
| 8 | |||
| 9 | * cus-start.el: Add display-buffer-reuse-frames, | ||
| 10 | file-coding-system-alist. | ||
| 11 | |||
| 1 | 2000-08-20 Gerd Moellmann <gerd@gnu.org> | 12 | 2000-08-20 Gerd Moellmann <gerd@gnu.org> |
| 2 | 13 | ||
| 3 | * startup.el (command-line): Clear realized faces after | 14 | * startup.el (command-line): Clear realized faces after |
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index c484a12dc8d..90e02ee2bae 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -24,13 +24,14 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; Lisp editing commands to go with Lisp major mode. | 27 | ;; Lisp editing commands to go with Lisp major mode. More-or-less |
| 28 | ;; applicable in other modes too. | ||
| 28 | 29 | ||
| 29 | ;;; Code: | 30 | ;;; Code: |
| 30 | 31 | ||
| 31 | ;; Note that this variable is used by non-lisp modes too. | 32 | ;; Note that this variable is used by non-lisp modes too. |
| 32 | (defcustom defun-prompt-regexp nil | 33 | (defcustom defun-prompt-regexp nil |
| 33 | "*Non-nil => regexp to ignore, before the character that starts a defun. | 34 | "*If non-nil, a regexp to ignore before the character that starts a defun. |
| 34 | This is only necessary if the opening paren or brace is not in column 0. | 35 | This is only necessary if the opening paren or brace is not in column 0. |
| 35 | See function `beginning-of-defun'." | 36 | See function `beginning-of-defun'." |
| 36 | :type '(choice (const nil) | 37 | :type '(choice (const nil) |
| @@ -39,7 +40,7 @@ See function `beginning-of-defun'." | |||
| 39 | (make-variable-buffer-local 'defun-prompt-regexp) | 40 | (make-variable-buffer-local 'defun-prompt-regexp) |
| 40 | 41 | ||
| 41 | (defcustom parens-require-spaces t | 42 | (defcustom parens-require-spaces t |
| 42 | "Non-nil => `insert-parentheses' should insert whitespace as needed." | 43 | "Non-nil means `insert-parentheses' should insert whitespace as needed." |
| 43 | :type 'boolean | 44 | :type 'boolean |
| 44 | :group 'lisp) | 45 | :group 'lisp) |
| 45 | 46 | ||
| @@ -60,14 +61,14 @@ move forward across N balanced expressions." | |||
| 60 | (or arg (setq arg 1)) | 61 | (or arg (setq arg 1)) |
| 61 | (forward-sexp (- arg))) | 62 | (forward-sexp (- arg))) |
| 62 | 63 | ||
| 63 | (defun mark-sexp (arg) | 64 | (defun mark-sexp (&optional arg) |
| 64 | "Set mark ARG sexps from point. | 65 | "Set mark ARG sexps from point. |
| 65 | The place mark goes is the same place \\[forward-sexp] would | 66 | The place mark goes is the same place \\[forward-sexp] would |
| 66 | move to with the same argument." | 67 | move to with the same argument." |
| 67 | (interactive "p") | 68 | (interactive "p") |
| 68 | (push-mark | 69 | (push-mark |
| 69 | (save-excursion | 70 | (save-excursion |
| 70 | (forward-sexp arg) | 71 | (forward-sexp (or arg 1)) |
| 71 | (point)) | 72 | (point)) |
| 72 | nil t)) | 73 | nil t)) |
| 73 | 74 | ||
| @@ -87,51 +88,53 @@ Negative arg -N means move forward across N groups of parentheses." | |||
| 87 | (or arg (setq arg 1)) | 88 | (or arg (setq arg 1)) |
| 88 | (forward-list (- arg))) | 89 | (forward-list (- arg))) |
| 89 | 90 | ||
| 90 | (defun down-list (arg) | 91 | (defun down-list (&optional arg) |
| 91 | "Move forward down one level of parentheses. | 92 | "Move forward down one level of parentheses. |
| 92 | With ARG, do this that many times. | 93 | With ARG, do this that many times. |
| 93 | A negative argument means move backward but still go down a level. | 94 | A negative argument means move backward but still go down a level. |
| 94 | In Lisp programs, an argument is required." | 95 | In Lisp programs, an argument is required." |
| 95 | (interactive "p") | 96 | (interactive "p") |
| 97 | (or arg (setq arg 1)) | ||
| 96 | (let ((inc (if (> arg 0) 1 -1))) | 98 | (let ((inc (if (> arg 0) 1 -1))) |
| 97 | (while (/= arg 0) | 99 | (while (/= arg 0) |
| 98 | (goto-char (or (scan-lists (point) inc -1) (buffer-end arg))) | 100 | (goto-char (or (scan-lists (point) inc -1) (buffer-end arg))) |
| 99 | (setq arg (- arg inc))))) | 101 | (setq arg (- arg inc))))) |
| 100 | 102 | ||
| 101 | (defun backward-up-list (arg) | 103 | (defun backward-up-list (&optional arg) |
| 102 | "Move backward out of one level of parentheses. | 104 | "Move backward out of one level of parentheses. |
| 103 | With ARG, do this that many times. | 105 | With ARG, do this that many times. |
| 104 | A negative argument means move forward but still to a less deep spot. | 106 | A negative argument means move forward but still to a less deep spot. |
| 105 | In Lisp programs, an argument is required." | 107 | In Lisp programs, an argument is required." |
| 106 | (interactive "p") | 108 | (interactive "p") |
| 107 | (up-list (- arg))) | 109 | (up-list (- (or arg 1)))) |
| 108 | 110 | ||
| 109 | (defun up-list (arg) | 111 | (defun up-list (&optional arg) |
| 110 | "Move forward out of one level of parentheses. | 112 | "Move forward out of one level of parentheses. |
| 111 | With ARG, do this that many times. | 113 | With ARG, do this that many times. |
| 112 | A negative argument means move backward but still to a less deep spot. | 114 | A negative argument means move backward but still to a less deep spot. |
| 113 | In Lisp programs, an argument is required." | 115 | In Lisp programs, an argument is required." |
| 114 | (interactive "p") | 116 | (interactive "p") |
| 117 | (or arg (setq arg 1)) | ||
| 115 | (let ((inc (if (> arg 0) 1 -1))) | 118 | (let ((inc (if (> arg 0) 1 -1))) |
| 116 | (while (/= arg 0) | 119 | (while (/= arg 0) |
| 117 | (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))) | 120 | (goto-char (or (scan-lists (point) inc 1) (buffer-end arg))) |
| 118 | (setq arg (- arg inc))))) | 121 | (setq arg (- arg inc))))) |
| 119 | 122 | ||
| 120 | (defun kill-sexp (arg) | 123 | (defun kill-sexp (&optional arg) |
| 121 | "Kill the sexp (balanced expression) following the cursor. | 124 | "Kill the sexp (balanced expression) following the cursor. |
| 122 | With ARG, kill that many sexps after the cursor. | 125 | With ARG, kill that many sexps after the cursor. |
| 123 | Negative arg -N means kill N sexps before the cursor." | 126 | Negative arg -N means kill N sexps before the cursor." |
| 124 | (interactive "p") | 127 | (interactive "p") |
| 125 | (let ((opoint (point))) | 128 | (let ((opoint (point))) |
| 126 | (forward-sexp arg) | 129 | (forward-sexp (or arg 1)) |
| 127 | (kill-region opoint (point)))) | 130 | (kill-region opoint (point)))) |
| 128 | 131 | ||
| 129 | (defun backward-kill-sexp (arg) | 132 | (defun backward-kill-sexp (&optional arg) |
| 130 | "Kill the sexp (balanced expression) preceding the cursor. | 133 | "Kill the sexp (balanced expression) preceding the cursor. |
| 131 | With ARG, kill that many sexps before the cursor. | 134 | With ARG, kill that many sexps before the cursor. |
| 132 | Negative arg -N means kill N sexps after the cursor." | 135 | Negative arg -N means kill N sexps after the cursor." |
| 133 | (interactive "p") | 136 | (interactive "p") |
| 134 | (kill-sexp (- arg))) | 137 | (kill-sexp (- (or arg 1)))) |
| 135 | 138 | ||
| 136 | (defvar beginning-of-defun-function nil | 139 | (defvar beginning-of-defun-function nil |
| 137 | "If non-nil, function for `beginning-of-defun-raw' to call. | 140 | "If non-nil, function for `beginning-of-defun-raw' to call. |
| @@ -337,32 +340,33 @@ unbalanced character." | |||
| 337 | (error "Unmatched bracket or quote")) | 340 | (error "Unmatched bracket or quote")) |
| 338 | (t (signal (car data) (cdr data))))))) | 341 | (t (signal (car data) (cdr data))))))) |
| 339 | 342 | ||
| 340 | (defun lisp-complete-symbol () | 343 | (defun lisp-complete-symbol (&optional predicate) |
| 341 | "Perform completion on Lisp symbol preceding point. | 344 | "Perform completion on Lisp symbol preceding point. |
| 342 | Compare that symbol against the known Lisp symbols. | 345 | Compare that symbol against the known Lisp symbols. |
| 343 | 346 | ||
| 344 | The context determines which symbols are considered. | 347 | When called from a program, optional arg PREDICATE is a predicate |
| 345 | If the symbol starts just after an open-parenthesis, only symbols | 348 | determining which symbols are considered, e.g. `commandp'. |
| 346 | with function definitions are considered. Otherwise, all symbols with | 349 | If PREDICATE is nil, the context determines which symbols are |
| 347 | function definitions, values or properties are considered." | 350 | considered. If the symbol starts just after an open-parenthesis, only |
| 351 | symbols with function definitions are considered. Otherwise, all | ||
| 352 | symbols with function definitions, values or properties are | ||
| 353 | considered." | ||
| 348 | (interactive) | 354 | (interactive) |
| 349 | (let* ((end (point)) | 355 | (let* ((end (point)) |
| 350 | (buffer-syntax (syntax-table)) | 356 | (beg (with-syntax-table emacs-lisp-mode-syntax-table |
| 351 | (beg (unwind-protect | ||
| 352 | (save-excursion | 357 | (save-excursion |
| 353 | (set-syntax-table emacs-lisp-mode-syntax-table) | ||
| 354 | (backward-sexp 1) | 358 | (backward-sexp 1) |
| 355 | (while (= (char-syntax (following-char)) ?\') | 359 | (while (= (char-syntax (following-char)) ?\') |
| 356 | (forward-char 1)) | 360 | (forward-char 1)) |
| 357 | (point)) | 361 | (point)))) |
| 358 | (set-syntax-table buffer-syntax))) | 362 | (pattern (buffer-substring-no-properties beg end)) |
| 359 | (pattern (buffer-substring beg end)) | ||
| 360 | (predicate | 363 | (predicate |
| 361 | (if (eq (char-after (1- beg)) ?\() | 364 | (or predicate |
| 362 | 'fboundp | 365 | (if (eq (char-after (1- beg)) ?\() |
| 363 | (function (lambda (sym) | 366 | 'fboundp |
| 364 | (or (boundp sym) (fboundp sym) | 367 | (function (lambda (sym) |
| 365 | (symbol-plist sym)))))) | 368 | (or (boundp sym) (fboundp sym) |
| 369 | (symbol-plist sym))))))) | ||
| 366 | (completion (try-completion pattern obarray predicate))) | 370 | (completion (try-completion pattern obarray predicate))) |
| 367 | (cond ((eq completion t)) | 371 | (cond ((eq completion t)) |
| 368 | ((null completion) | 372 | ((null completion) |