comparison lisp/prim/lisp.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 1370575f1259
children 3bb7ccffb0c0
comparison
equal deleted inserted replaced
154:94141801dd7e 155:43dd3413c7c7
1 ;;; lisp.el --- Lisp editing commands for XEmacs 1 ;;; lisp.el --- Lisp editing commands for XEmacs
2 2
3 ;; Copyright (C) 1985, 1986, 1994 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985, 1986, 1994, 1997 Free Software Foundation, Inc.
4 4
5 ;; Maintainer: FSF 5 ;; Maintainer: FSF
6 ;; Keywords: lisp, languages 6 ;; Keywords: lisp, languages
7 7
8 ;; This file is part of XEmacs. 8 ;; This file is part of XEmacs.
20 ;; You should have received a copy of the GNU General Public License 20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free 21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ;; 02111-1307, USA. 23 ;; 02111-1307, USA.
24 24
25 ;;; Synched up with: FSF 19.34. 25 ;;; Synched up with: Emacs/Mule zeta.
26 26
27 ;;; Commentary: 27 ;;; Commentary:
28 28
29 ;; Lisp editing commands to go with Lisp major mode. 29 ;; Lisp editing commands to go with Lisp major mode.
30 30
190 ;; XEmacs change (for zmacs regions) 190 ;; XEmacs change (for zmacs regions)
191 (interactive "_p") 191 (interactive "_p")
192 (if (or (null arg) (= arg 0)) (setq arg 1)) 192 (if (or (null arg) (= arg 0)) (setq arg 1))
193 (let ((first t)) 193 (let ((first t))
194 (while (and (> arg 0) (< (point) (point-max))) 194 (while (and (> arg 0) (< (point) (point-max)))
195 (let ((pos (point)) npos) 195 (let ((pos (point))) ; XEmacs -- remove unused npos.
196 (while (progn 196 (while (progn
197 (if (and first 197 (if (and first
198 (progn 198 (progn
199 (end-of-line 1) 199 (end-of-line 1)
200 (beginning-of-defun-raw 1))) 200 (beginning-of-defun-raw 1)))
231 (end-of-defun) 231 (end-of-defun)
232 (push-mark (point) nil t) 232 (push-mark (point) nil t)
233 (beginning-of-defun) 233 (beginning-of-defun)
234 (re-search-backward "^\n" (- (point) 1) t)) 234 (re-search-backward "^\n" (- (point) 1) t))
235 235
236 (defun narrow-to-defun (&optional arg)
237 "Make text outside current defun invisible.
238 The defun visible is the one that contains point or follows point."
239 (interactive)
240 (save-excursion
241 (widen)
242 (end-of-defun)
243 (let ((end (point)))
244 (beginning-of-defun)
245 (narrow-to-region (point) end))))
246
236 (defun insert-parentheses (arg) 247 (defun insert-parentheses (arg)
237 "Put parentheses around next ARG sexps. Leave point after open-paren. 248 "Enclose following ARG sexps in parentheses. Leave point after open-paren.
249 A negative ARG encloses the preceding ARG sexps instead.
238 No argument is equivalent to zero: just insert `()' and leave point between. 250 No argument is equivalent to zero: just insert `()' and leave point between.
239 If `parens-require-spaces' is non-nil, this command also inserts a space 251 If `parens-require-spaces' is non-nil, this command also inserts a space
240 before and after, depending on the surrounding characters." 252 before and after, depending on the surrounding characters."
241 (interactive "P") 253 (interactive "P")
242 (if arg (setq arg (prefix-numeric-value arg)) 254 (if arg (setq arg (prefix-numeric-value arg))
243 (setq arg 0)) 255 (setq arg 0))
244 (or (eq arg 0) (skip-chars-forward " \t")) 256 (cond ((> arg 0) (skip-chars-forward " \t"))
257 ((< arg 0) (forward-sexp arg) (setq arg (- arg))))
245 (and parens-require-spaces 258 (and parens-require-spaces
246 (not (bobp)) 259 (not (bobp))
247 (memq (char-syntax (preceding-char)) '(?w ?_ ?\) )) 260 (memq (char-syntax (preceding-char)) '(?w ?_ ?\) ))
248 (insert " ")) 261 (insert " "))
249 (insert ?\() 262 (insert ?\()
306 (delete-region beg end) 319 (delete-region beg end)
307 (insert completion)) 320 (insert completion))
308 (t 321 (t
309 (message "Making completion list...") 322 (message "Making completion list...")
310 (let ((list (all-completions pattern obarray predicate)) 323 (let ((list (all-completions pattern obarray predicate))
311 ;FSFmacs crock unnecessary in XEmacs (ROTFL -sb) 324 ;FSFmacs crock unnecessary in XEmacs
312 ;see minibuf.el 325 ;see minibuf.el
313 ;(completion-fixup-function 326 ;(completion-fixup-function
314 ; (function (lambda () (if (save-excursion 327 ; (function (lambda () (if (save-excursion
315 ; (goto-char (max (point-min) 328 ; (goto-char (max (point-min)
316 ; (- (point) 4))) 329 ; (- (point) 4)))