comparison lisp/emacs-lisp/lisp.el @ 90140:02f1dbc4a199

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-35 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 228-240) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 53-58) - Merge from emacs--cvs-trunk--0 - Update from CVS - Collapse feature addition/removal within single ChangeLog entry
author Miles Bader <miles@gnu.org>
date Sat, 09 Apr 2005 02:16:29 +0000
parents 3ebd9bdb4fe5 99b039f2f040
children f042e7c0fe20
comparison
equal deleted inserted replaced
90139:e0d294b9b23e 90140:02f1dbc4a199
29 29
30 ;;; Code: 30 ;;; Code:
31 31
32 ;; Note that this variable is used by non-lisp modes too. 32 ;; Note that this variable is used by non-lisp modes too.
33 (defcustom defun-prompt-regexp nil 33 (defcustom defun-prompt-regexp nil
34 "*If non-nil, a regexp to ignore before the character that starts a defun. 34 "*If non-nil, a regexp to ignore before a defun.
35 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.
36 See function `beginning-of-defun'. 36 See function `beginning-of-defun'."
37
38 Setting this variable automatically makes it local to the current buffer."
39 :type '(choice (const nil) 37 :type '(choice (const nil)
40 regexp) 38 regexp)
41 :group 'lisp) 39 :group 'lisp)
42 (make-variable-buffer-local 'defun-prompt-regexp) 40 (make-variable-buffer-local 'defun-prompt-regexp)
43 41
44 (defcustom parens-require-spaces t 42 (defcustom parens-require-spaces t
45 "Non-nil means `insert-parentheses' should insert whitespace as needed." 43 "If non-nil, `insert-parentheses' inserts whitespace as needed."
46 :type 'boolean 44 :type 'boolean
47 :group 'lisp) 45 :group 'lisp)
48 46
49 (defvar forward-sexp-function nil 47 (defvar forward-sexp-function nil
50 "If non-nil, `forward-sexp' delegates to this function. 48 "If non-nil, `forward-sexp' delegates to this function.
72 (defun mark-sexp (&optional arg allow-extend) 70 (defun mark-sexp (&optional arg allow-extend)
73 "Set mark ARG sexps from point. 71 "Set mark ARG sexps from point.
74 The place mark goes is the same place \\[forward-sexp] would 72 The place mark goes is the same place \\[forward-sexp] would
75 move to with the same argument. 73 move to with the same argument.
76 Interactively, if this command is repeated 74 Interactively, if this command is repeated
77 or (in Transient Mark mode) if the mark is active, 75 or (in Transient Mark mode) if the mark is active,
78 it marks the next ARG sexps after the ones already marked." 76 it marks the next ARG sexps after the ones already marked."
79 (interactive "P\np") 77 (interactive "P\np")
80 (cond ((and allow-extend 78 (cond ((and allow-extend
81 (or (and (eq last-command this-command) (mark t)) 79 (or (and (eq last-command this-command) (mark t))
82 (and transient-mark-mode mark-active))) 80 (and transient-mark-mode mark-active)))
231 This is used to find the end of the defun instead of using the normal 229 This is used to find the end of the defun instead of using the normal
232 recipe (see `end-of-defun'). Major modes can define this if the 230 recipe (see `end-of-defun'). Major modes can define this if the
233 normal method is not appropriate.") 231 normal method is not appropriate.")
234 232
235 (defun buffer-end (arg) 233 (defun buffer-end (arg)
236 "Return the \"far end\" position of the buffer, moving in direction ARG. 234 "Return the \"far end\" position of the buffer, in direction ARG.
237 If ARG is positive, that's the end of the buffer. 235 If ARG is positive, that's the end of the buffer.
238 Otherwise, that's the beginning of the buffer." 236 Otherwise, that's the beginning of the buffer."
239 (if (> arg 0) (point-max) (point-min))) 237 (if (> arg 0) (point-max) (point-min)))
240 238
241 (defun end-of-defun (&optional arg) 239 (defun end-of-defun (&optional arg)
242 "Move forward to next end of defun. With argument, do it that many times. 240 "Move forward to next end of defun.
241 With argument, do it that many times.
243 Negative argument -N means move back to Nth preceding end of defun. 242 Negative argument -N means move back to Nth preceding end of defun.
244 243
245 An end of a defun occurs right after the close-parenthesis that 244 An end of a defun occurs right after the close-parenthesis that
246 matches the open-parenthesis that starts a defun; see function 245 matches the open-parenthesis that starts a defun; see function
247 `beginning-of-defun'. 246 `beginning-of-defun'.
297 (defun mark-defun (&optional allow-extend) 296 (defun mark-defun (&optional allow-extend)
298 "Put mark at end of this defun, point at beginning. 297 "Put mark at end of this defun, point at beginning.
299 The defun marked is the one that contains point or follows point. 298 The defun marked is the one that contains point or follows point.
300 299
301 Interactively, if this command is repeated 300 Interactively, if this command is repeated
302 or (in Transient Mark mode) if the mark is active, 301 or (in Transient Mark mode) if the mark is active,
303 it marks the next defun after the ones already marked." 302 it marks the next defun after the ones already marked."
304 (interactive "p") 303 (interactive "p")
305 (cond ((and allow-extend 304 (cond ((and allow-extend
306 (or (and (eq last-command this-command) (mark t)) 305 (or (and (eq last-command this-command) (mark t))
307 (and transient-mark-mode mark-active))) 306 (and transient-mark-mode mark-active)))
422 (insert " ")))) 421 (insert " "))))
423 (insert-char (event-basic-type last-command-event) 422 (insert-char (event-basic-type last-command-event)
424 (prefix-numeric-value arg)))) 423 (prefix-numeric-value arg))))
425 424
426 (defun insert-parentheses (&optional arg) 425 (defun insert-parentheses (&optional arg)
427 "Enclose following ARG sexps in parentheses. Leave point after open-paren. 426 "Enclose following ARG sexps in parentheses.
427 Leave point after open-paren.
428 A negative ARG encloses the preceding ARG sexps instead. 428 A negative ARG encloses the preceding ARG sexps instead.
429 No argument is equivalent to zero: just insert `()' and leave point between. 429 No argument is equivalent to zero: just insert `()' and leave point between.
430 If `parens-require-spaces' is non-nil, this command also inserts a space 430 If `parens-require-spaces' is non-nil, this command also inserts a space
431 before and after, depending on the surrounding characters. 431 before and after, depending on the surrounding characters.
432 If region is active, insert enclosing characters at region boundaries." 432 If region is active, insert enclosing characters at region boundaries."